使用prettier格式化代码
This commit is contained in:
parent
cbf5712881
commit
69681b8106
15
.prettierrc.json
Normal file
15
.prettierrc.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "*.sol",
|
||||||
|
"options": {
|
||||||
|
"printWidth": 80,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"singleQuote": false,
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"explicitTypes": "always"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -3,7 +3,7 @@ pragma solidity 0.8.10;
|
|||||||
|
|
||||||
contract Migrations {
|
contract Migrations {
|
||||||
address public owner = msg.sender;
|
address public owner = msg.sender;
|
||||||
uint public last_completed_migration;
|
uint256 public last_completed_migration;
|
||||||
|
|
||||||
modifier restricted() {
|
modifier restricted() {
|
||||||
require(
|
require(
|
||||||
@ -13,7 +13,7 @@ contract Migrations {
|
|||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCompleted(uint completed) external restricted {
|
function setCompleted(uint256 completed) external restricted {
|
||||||
last_completed_migration = completed;
|
last_completed_migration = completed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,20 +7,24 @@ contract BETimelockController is TimelockController {
|
|||||||
uint256 public constant MAX_DELAY = 16 days;
|
uint256 public constant MAX_DELAY = 16 days;
|
||||||
uint256 private _minDelay;
|
uint256 private _minDelay;
|
||||||
|
|
||||||
constructor(
|
constructor(address[] memory proposers, address[] memory executors)
|
||||||
address[] memory proposers,
|
TimelockController(MIN_DELAY, proposers, executors)
|
||||||
address[] memory executors)
|
{
|
||||||
TimelockController(MIN_DELAY, proposers, executors){
|
|
||||||
_minDelay = MIN_DELAY;
|
_minDelay = MIN_DELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Returns the minimum delay for an operation to become valid.
|
* @dev Returns the minimum delay for an operation to become valid.
|
||||||
*
|
*
|
||||||
* This value can be changed by executing an operation that calls `updateDelay`.
|
* This value can be changed by executing an operation that calls `updateDelay`.
|
||||||
*/
|
*/
|
||||||
function getMinDelay() public view virtual override returns (uint256 duration) {
|
function getMinDelay()
|
||||||
|
public
|
||||||
|
view
|
||||||
|
virtual
|
||||||
|
override
|
||||||
|
returns (uint256 duration)
|
||||||
|
{
|
||||||
return _minDelay;
|
return _minDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,11 +39,19 @@ contract BETimelockController is TimelockController {
|
|||||||
* an operation where the timelock is the target and the data is the ABI-encoded call to this function.
|
* an operation where the timelock is the target and the data is the ABI-encoded call to this function.
|
||||||
*/
|
*/
|
||||||
function updateDelay(uint256 newDelay) external virtual override {
|
function updateDelay(uint256 newDelay) external virtual override {
|
||||||
require(msg.sender == address(this), "BETimelockController: caller must be timelock");
|
require(
|
||||||
require(newDelay >= MIN_DELAY, "BETimelockController: newDelay must greater than or equal to MIN_DELAY");
|
msg.sender == address(this),
|
||||||
require(newDelay <= MAX_DELAY, "BETimelockController: newDelay must less than or equal to MAX_DELAY");
|
"BETimelockController: caller must be timelock"
|
||||||
|
);
|
||||||
|
require(
|
||||||
|
newDelay >= MIN_DELAY,
|
||||||
|
"BETimelockController: newDelay must greater than or equal to MIN_DELAY"
|
||||||
|
);
|
||||||
|
require(
|
||||||
|
newDelay <= MAX_DELAY,
|
||||||
|
"BETimelockController: newDelay must less than or equal to MAX_DELAY"
|
||||||
|
);
|
||||||
emit MinDelayChange(_minDelay, newDelay);
|
emit MinDelayChange(_minDelay, newDelay);
|
||||||
_minDelay = newDelay;
|
_minDelay = newDelay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,17 +53,10 @@ contract HasSignature is Ownable, Approval{
|
|||||||
* @dev Returns the domain separator for the current chain.
|
* @dev Returns the domain separator for the current chain.
|
||||||
*/
|
*/
|
||||||
function _domainSeparatorV4() internal view returns (bytes32) {
|
function _domainSeparatorV4() internal view returns (bytes32) {
|
||||||
if (
|
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
|
||||||
address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID
|
|
||||||
) {
|
|
||||||
return _CACHED_DOMAIN_SEPARATOR;
|
return _CACHED_DOMAIN_SEPARATOR;
|
||||||
} else {
|
} else {
|
||||||
return
|
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
|
||||||
_buildDomainSeparator(
|
|
||||||
_TYPE_HASH,
|
|
||||||
_HASHED_NAME,
|
|
||||||
_HASHED_VERSION
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,32 +101,26 @@ contract HasSignature is Ownable, Approval{
|
|||||||
bytes memory signature
|
bytes memory signature
|
||||||
) public pure {
|
) public pure {
|
||||||
require(signature.length == 65, "[BE] invalid signature length");
|
require(signature.length == 65, "[BE] invalid signature length");
|
||||||
bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(
|
bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash(hash);
|
||||||
hash
|
|
||||||
);
|
|
||||||
|
|
||||||
address recovered = ECDSA.recover(ethSignedMessageHash, signature);
|
address recovered = ECDSA.recover(ethSignedMessageHash, signature);
|
||||||
require(recovered == signer, "[BE] invalid signature");
|
require(recovered == signer, "[BE] invalid signature");
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier signatureValid(
|
modifier signatureValid(bytes calldata signature) {
|
||||||
bytes calldata signature
|
|
||||||
) {
|
|
||||||
require(
|
require(
|
||||||
!_usedSignatures[signature],
|
!_usedSignatures[signature],
|
||||||
"signature used. please send another transaction with new signature"
|
"signature used. please send another transaction with new signature"
|
||||||
);
|
);
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev mark signature used
|
* @dev mark signature used
|
||||||
*/
|
*/
|
||||||
function useSignature(
|
function useSignature(bytes calldata signature) public approvaled {
|
||||||
bytes calldata signature
|
|
||||||
) public approvaled {
|
|
||||||
if (!_usedSignatures[signature]) {
|
if (!_usedSignatures[signature]) {
|
||||||
_usedSignatures[signature] = true;
|
_usedSignatures[signature] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,10 @@ interface IBEERC1155 is IERC1155 {
|
|||||||
uint256[] memory values
|
uint256[] memory values
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
function balanceOf(address account, uint256 id) external view returns (uint256);
|
function balanceOf(address account, uint256 id)
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (uint256);
|
||||||
|
|
||||||
function canMint(uint256 id) external view returns (bool);
|
function canMint(uint256 id) external view returns (bool);
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ pragma solidity 0.8.10;
|
|||||||
|
|
||||||
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
interface IBEERC721 is IERC721 {
|
interface IBEERC721 is IERC721 {
|
||||||
function mint(address to, uint256 tokenId) external;
|
function mint(address to, uint256 tokenId) external;
|
||||||
|
|
||||||
function burn(address owner, uint256 tokenId) external;
|
function burn(address owner, uint256 tokenId) external;
|
||||||
|
|
||||||
function ownerOf(uint256 tokenId) external view returns (address owner);
|
function ownerOf(uint256 tokenId) external view returns (address owner);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,5 @@ interface IEvolveFactory {
|
|||||||
bytes calldata signature
|
bytes calldata signature
|
||||||
) external;
|
) external;
|
||||||
|
|
||||||
function useSignature(
|
function useSignature(bytes calldata signature) external;
|
||||||
bytes calldata signature
|
|
||||||
) external;
|
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,9 @@ contract EvolveFactory is Ownable, TimeChecker, Initializable, HasSignature {
|
|||||||
|
|
||||||
address public executor;
|
address public executor;
|
||||||
|
|
||||||
event TokenEvolved(
|
event TokenEvolved(address indexed owner, uint256[] tokenIds);
|
||||||
address indexed owner,
|
|
||||||
uint256[] tokenIds
|
|
||||||
);
|
|
||||||
|
|
||||||
constructor()
|
constructor() HasSignature("EvolveFactory", "1") {}
|
||||||
HasSignature("EvolveFactory", "1"){
|
|
||||||
}
|
|
||||||
|
|
||||||
function init(address chipAddress) external initializer onlyOwner {
|
function init(address chipAddress) external initializer onlyOwner {
|
||||||
chip = IBEERC1155(chipAddress);
|
chip = IBEERC1155(chipAddress);
|
||||||
@ -35,7 +30,7 @@ contract EvolveFactory is Ownable, TimeChecker, Initializable, HasSignature {
|
|||||||
* @dev update executor
|
* @dev update executor
|
||||||
*/
|
*/
|
||||||
function updateExecutor(address account) external onlyOwner {
|
function updateExecutor(address account) external onlyOwner {
|
||||||
require(account != address(0), 'address can not be zero');
|
require(account != address(0), "address can not be zero");
|
||||||
executor = account;
|
executor = account;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,15 +78,14 @@ contract EvolveFactory is Ownable, TimeChecker, Initializable, HasSignature {
|
|||||||
nft.burn(to, tokenIds[1]);
|
nft.burn(to, tokenIds[1]);
|
||||||
if (tokenIds[2] > 0) {
|
if (tokenIds[2] > 0) {
|
||||||
uint256 amount = 1;
|
uint256 amount = 1;
|
||||||
chip.burnBatch(to,
|
chip.burnBatch(
|
||||||
|
to,
|
||||||
tokenIds[2].asSingletonArray(),
|
tokenIds[2].asSingletonArray(),
|
||||||
amount.asSingletonArray());
|
amount.asSingletonArray()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
useSignature(signature);
|
useSignature(signature);
|
||||||
emit TokenEvolved(
|
emit TokenEvolved(to, signArray);
|
||||||
to,
|
|
||||||
signArray
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function evolveChip(
|
function evolveChip(
|
||||||
@ -115,14 +109,16 @@ contract EvolveFactory is Ownable, TimeChecker, Initializable, HasSignature {
|
|||||||
amounts[i - 1] = 1;
|
amounts[i - 1] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bytes32 criteriaMessageHash = getMessageHash(to, startTime, saltNonce, tokenIds);
|
bytes32 criteriaMessageHash = getMessageHash(
|
||||||
|
to,
|
||||||
|
startTime,
|
||||||
|
saltNonce,
|
||||||
|
tokenIds
|
||||||
|
);
|
||||||
checkSigner(executor, criteriaMessageHash, signature);
|
checkSigner(executor, criteriaMessageHash, signature);
|
||||||
chip.burnBatch(to, idsForBurn, amounts);
|
chip.burnBatch(to, idsForBurn, amounts);
|
||||||
useSignature(signature);
|
useSignature(signature);
|
||||||
emit TokenEvolved(
|
emit TokenEvolved(to, tokenIds);
|
||||||
to,
|
|
||||||
tokenIds
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessageHash(
|
function getMessageHash(
|
||||||
@ -138,5 +134,4 @@ contract EvolveFactory is Ownable, TimeChecker, Initializable, HasSignature {
|
|||||||
}
|
}
|
||||||
return keccak256(encoded);
|
return keccak256(encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,13 @@ import "../utils/TimeChecker.sol";
|
|||||||
import "../core/HasSignature.sol";
|
import "../core/HasSignature.sol";
|
||||||
import "./FactoryBase.sol";
|
import "./FactoryBase.sol";
|
||||||
|
|
||||||
contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasSignature {
|
contract MinterFactory is
|
||||||
|
Ownable,
|
||||||
|
FactoryBase,
|
||||||
|
TimeChecker,
|
||||||
|
Initializable,
|
||||||
|
HasSignature
|
||||||
|
{
|
||||||
using UInt for uint256;
|
using UInt for uint256;
|
||||||
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
|
||||||
address public executor;
|
address public executor;
|
||||||
@ -30,7 +36,6 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
uint256 indexed tokenId
|
uint256 indexed tokenId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
event TokenMintedBatch(
|
event TokenMintedBatch(
|
||||||
address contractAddress,
|
address contractAddress,
|
||||||
address indexed to,
|
address indexed to,
|
||||||
@ -38,7 +43,6 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
uint256[] amounts
|
uint256[] amounts
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
constructor() HasSignature("MinterFactory", "1") {}
|
constructor() HasSignature("MinterFactory", "1") {}
|
||||||
|
|
||||||
function init(address[4] calldata _erc721s) external initializer onlyOwner {
|
function init(address[4] calldata _erc721s) external initializer onlyOwner {
|
||||||
@ -48,7 +52,6 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
shard = IBEERC1155(_erc721s[3]);
|
shard = IBEERC1155(_erc721s[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev update executor
|
* @dev update executor
|
||||||
*/
|
*/
|
||||||
@ -58,7 +61,10 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setFeeToAddress(address _feeToAddress) external onlyOwner {
|
function setFeeToAddress(address _feeToAddress) external onlyOwner {
|
||||||
require(_feeToAddress != address(0), 'fee received address can not be zero');
|
require(
|
||||||
|
_feeToAddress != address(0),
|
||||||
|
"fee received address can not be zero"
|
||||||
|
);
|
||||||
feeToAddress = _feeToAddress;
|
feeToAddress = _feeToAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,10 +99,7 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
/**
|
/**
|
||||||
* @dev batch mint 1155 Chip to user
|
* @dev batch mint 1155 Chip to user
|
||||||
*/
|
*/
|
||||||
function mintChipBatch(address to, uint256[] memory ids)
|
function mintChipBatch(address to, uint256[] memory ids) external onlyOwner {
|
||||||
external
|
|
||||||
onlyOwner
|
|
||||||
{
|
|
||||||
require(
|
require(
|
||||||
to != address(0),
|
to != address(0),
|
||||||
"MinterFactory::mintChipBatch: to address can not be zero"
|
"MinterFactory::mintChipBatch: to address can not be zero"
|
||||||
@ -140,8 +143,13 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
) external signatureValid(signature) timeValid(startTime) {
|
) external signatureValid(signature) timeValid(startTime) {
|
||||||
uint256[] memory signArray = new uint256[](1);
|
uint256[] memory signArray = new uint256[](1);
|
||||||
signArray[0] = id;
|
signArray[0] = id;
|
||||||
bytes32 criteriaMessageHash =
|
bytes32 criteriaMessageHash = getMessageHash(
|
||||||
getMessageHash(to, address(nft), startTime, saltNonce, signArray);
|
to,
|
||||||
|
address(nft),
|
||||||
|
startTime,
|
||||||
|
saltNonce,
|
||||||
|
signArray
|
||||||
|
);
|
||||||
checkSigner(executor, criteriaMessageHash, signature);
|
checkSigner(executor, criteriaMessageHash, signature);
|
||||||
mint721NFT(to, id, nft);
|
mint721NFT(to, id, nft);
|
||||||
useSignature(signature);
|
useSignature(signature);
|
||||||
@ -171,8 +179,13 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
signArray[i * 2] = ids[i];
|
signArray[i * 2] = ids[i];
|
||||||
signArray[i * 2 + 1] = amounts[i];
|
signArray[i * 2 + 1] = amounts[i];
|
||||||
}
|
}
|
||||||
bytes32 criteriaMessageHash =
|
bytes32 criteriaMessageHash = getMessageHash(
|
||||||
getMessageHash(to, address(nft), startTime, saltNonce, signArray);
|
to,
|
||||||
|
address(nft),
|
||||||
|
startTime,
|
||||||
|
saltNonce,
|
||||||
|
signArray
|
||||||
|
);
|
||||||
checkSigner(executor, criteriaMessageHash, signature);
|
checkSigner(executor, criteriaMessageHash, signature);
|
||||||
mint1155NFTBatch(to, ids, amounts, nft);
|
mint1155NFTBatch(to, ids, amounts, nft);
|
||||||
useSignature(signature);
|
useSignature(signature);
|
||||||
@ -200,8 +213,11 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
signArray[i * 2] = ids[i];
|
signArray[i * 2] = ids[i];
|
||||||
signArray[i * 2 + 1] = amounts[i];
|
signArray[i * 2 + 1] = amounts[i];
|
||||||
}
|
}
|
||||||
bytes32 criteriaMessageHash =
|
bytes32 criteriaMessageHash = getShardMixHash(
|
||||||
getShardMixHash(param, address(nft), signArray);
|
param,
|
||||||
|
address(nft),
|
||||||
|
signArray
|
||||||
|
);
|
||||||
checkSigner(executor, criteriaMessageHash, signature);
|
checkSigner(executor, criteriaMessageHash, signature);
|
||||||
// Check payment approval and buyer balance
|
// Check payment approval and buyer balance
|
||||||
IERC20 paymentContract = IERC20(param.payToken);
|
IERC20 paymentContract = IERC20(param.payToken);
|
||||||
@ -214,11 +230,7 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
"MinterFactory: doesn't approve MinterFactory to spend payment amount"
|
"MinterFactory: doesn't approve MinterFactory to spend payment amount"
|
||||||
);
|
);
|
||||||
// transfer money to address
|
// transfer money to address
|
||||||
paymentContract.safeTransferFrom(
|
paymentContract.safeTransferFrom(param.to, feeToAddress, param.payAmount);
|
||||||
param.to,
|
|
||||||
feeToAddress,
|
|
||||||
param.payAmount
|
|
||||||
);
|
|
||||||
shard.burnBatch(param.to, ids, amounts);
|
shard.burnBatch(param.to, ids, amounts);
|
||||||
mint721NFT(param.to, param.nftId, nft);
|
mint721NFT(param.to, param.nftId, nft);
|
||||||
useSignature(signature);
|
useSignature(signature);
|
||||||
@ -255,7 +267,6 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
emit TokenMintedBatch(address(nft), to, ids, amounts);
|
emit TokenMintedBatch(address(nft), to, ids, amounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getMessageHash(
|
function getMessageHash(
|
||||||
address _to,
|
address _to,
|
||||||
address _nftAddress,
|
address _nftAddress,
|
||||||
@ -263,8 +274,12 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
uint256 _saltNonce,
|
uint256 _saltNonce,
|
||||||
uint256[] memory _ids
|
uint256[] memory _ids
|
||||||
) public pure returns (bytes32) {
|
) public pure returns (bytes32) {
|
||||||
bytes memory encoded =
|
bytes memory encoded = abi.encodePacked(
|
||||||
abi.encodePacked(_to, _nftAddress, _startTime, _saltNonce);
|
_to,
|
||||||
|
_nftAddress,
|
||||||
|
_startTime,
|
||||||
|
_saltNonce
|
||||||
|
);
|
||||||
uint256 len = _ids.length;
|
uint256 len = _ids.length;
|
||||||
for (uint256 i = 0; i < len; ++i) {
|
for (uint256 i = 0; i < len; ++i) {
|
||||||
encoded = bytes.concat(encoded, abi.encodePacked(_ids[i]));
|
encoded = bytes.concat(encoded, abi.encodePacked(_ids[i]));
|
||||||
@ -277,8 +292,7 @@ contract MinterFactory is Ownable, FactoryBase, TimeChecker, Initializable, HasS
|
|||||||
address nftAddress,
|
address nftAddress,
|
||||||
uint256[] memory _ids
|
uint256[] memory _ids
|
||||||
) internal pure returns (bytes32) {
|
) internal pure returns (bytes32) {
|
||||||
bytes memory encoded =
|
bytes memory encoded = abi.encodePacked(
|
||||||
abi.encodePacked(
|
|
||||||
param.to,
|
param.to,
|
||||||
nftAddress,
|
nftAddress,
|
||||||
param.nftId,
|
param.nftId,
|
||||||
|
@ -38,11 +38,7 @@ contract MysteryBoxProxy is Ownable, Initializable, HasSignature {
|
|||||||
|
|
||||||
constructor() HasSignature("MysteryBoxProxy", "1") {}
|
constructor() HasSignature("MysteryBoxProxy", "1") {}
|
||||||
|
|
||||||
function init(address[4] calldata _erc721s)
|
function init(address[4] calldata _erc721s) external initializer onlyOwner {
|
||||||
external
|
|
||||||
initializer
|
|
||||||
onlyOwner
|
|
||||||
{
|
|
||||||
hero = IBEERC721(_erc721s[0]);
|
hero = IBEERC721(_erc721s[0]);
|
||||||
equip = IBEERC721(_erc721s[1]);
|
equip = IBEERC721(_erc721s[1]);
|
||||||
chip = IBEERC721(_erc721s[2]);
|
chip = IBEERC721(_erc721s[2]);
|
||||||
@ -58,7 +54,7 @@ contract MysteryBoxProxy is Ownable, Initializable, HasSignature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mintBoxTo(address to, uint256 tokenId) external onlyOwner {
|
function mintBoxTo(address to, uint256 tokenId) external onlyOwner {
|
||||||
require(to != address(0), 'to address can not be zero');
|
require(to != address(0), "to address can not be zero");
|
||||||
box.mint(to, tokenId);
|
box.mint(to, tokenId);
|
||||||
emit TokenMinted(address(box), to, tokenId);
|
emit TokenMinted(address(box), to, tokenId);
|
||||||
}
|
}
|
||||||
@ -69,10 +65,7 @@ contract MysteryBoxProxy is Ownable, Initializable, HasSignature {
|
|||||||
uint256 saltNonce,
|
uint256 saltNonce,
|
||||||
bytes calldata signature
|
bytes calldata signature
|
||||||
) external {
|
) external {
|
||||||
require(
|
require(ids.length == 3, "MysteryBoxProxy: amount of token id mismatch");
|
||||||
ids.length == 3,
|
|
||||||
"MysteryBoxProxy: amount of token id mismatch"
|
|
||||||
);
|
|
||||||
require(
|
require(
|
||||||
!usedSignatures[signature],
|
!usedSignatures[signature],
|
||||||
"MysteryBoxProxy: signature used. please send another transaction with new signature"
|
"MysteryBoxProxy: signature used. please send another transaction with new signature"
|
||||||
@ -140,12 +133,7 @@ contract MysteryBoxProxy is Ownable, Initializable, HasSignature {
|
|||||||
) internal view returns (uint256) {
|
) internal view returns (uint256) {
|
||||||
uint256 random = uint256(
|
uint256 random = uint256(
|
||||||
keccak256(
|
keccak256(
|
||||||
abi.encodePacked(
|
abi.encodePacked(owner, nonce, block.difficulty, block.timestamp)
|
||||||
owner,
|
|
||||||
nonce,
|
|
||||||
block.difficulty,
|
|
||||||
block.timestamp
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return random % _length;
|
return random % _length;
|
||||||
|
@ -34,30 +34,23 @@ contract UserEvolveFactory is Ownable, Initializable {
|
|||||||
bytes calldata signature
|
bytes calldata signature
|
||||||
) external returns (bool success) {
|
) external returns (bool success) {
|
||||||
address to = _msgSender();
|
address to = _msgSender();
|
||||||
try factory.evolve721NFT(to, tokenIds, startTime, saltNonce, signature, hero) {
|
try
|
||||||
|
factory.evolve721NFT(to, tokenIds, startTime, saltNonce, signature, hero)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
} catch Error(string memory reason) {
|
} catch Error(string memory reason) {
|
||||||
bytes memory by;
|
bytes memory by;
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
emit TokenEvolveFail(
|
emit TokenEvolveFail(to, signature, reason, by);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
by
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
} catch (bytes memory lowLevelData) {
|
} catch (bytes memory lowLevelData) {
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
string memory reason;
|
string memory reason;
|
||||||
emit TokenEvolveFail(
|
emit TokenEvolveFail(to, signature, reason, lowLevelData);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
lowLevelData
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev evolve function for equip NFT
|
* @dev evolve function for equip NFT
|
||||||
* tokenIds: [equip_to_evolve, equip_for_burn, chip]
|
* tokenIds: [equip_to_evolve, equip_for_burn, chip]
|
||||||
@ -69,27 +62,19 @@ contract UserEvolveFactory is Ownable, Initializable {
|
|||||||
bytes calldata signature
|
bytes calldata signature
|
||||||
) external returns (bool success) {
|
) external returns (bool success) {
|
||||||
address to = _msgSender();
|
address to = _msgSender();
|
||||||
try factory.evolve721NFT(to, tokenIds, startTime, saltNonce, signature, equip) {
|
try
|
||||||
|
factory.evolve721NFT(to, tokenIds, startTime, saltNonce, signature, equip)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
} catch Error(string memory reason) {
|
} catch Error(string memory reason) {
|
||||||
bytes memory by;
|
bytes memory by;
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
emit TokenEvolveFail(
|
emit TokenEvolveFail(to, signature, reason, by);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
by
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
} catch (bytes memory lowLevelData) {
|
} catch (bytes memory lowLevelData) {
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
string memory reason;
|
string memory reason;
|
||||||
emit TokenEvolveFail(
|
emit TokenEvolveFail(to, signature, reason, lowLevelData);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
lowLevelData
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,33 +89,17 @@ contract UserEvolveFactory is Ownable, Initializable {
|
|||||||
bytes calldata signature
|
bytes calldata signature
|
||||||
) external returns (bool success) {
|
) external returns (bool success) {
|
||||||
address to = _msgSender();
|
address to = _msgSender();
|
||||||
try factory.evolveChip(
|
try factory.evolveChip(to, ids, startTime, saltNonce, signature) {
|
||||||
to,
|
|
||||||
ids,
|
|
||||||
startTime,
|
|
||||||
saltNonce,
|
|
||||||
signature
|
|
||||||
) {
|
|
||||||
return true;
|
return true;
|
||||||
} catch Error(string memory reason) {
|
} catch Error(string memory reason) {
|
||||||
bytes memory by;
|
bytes memory by;
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
emit TokenEvolveFail(
|
emit TokenEvolveFail(to, signature, reason, by);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
by
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
} catch (bytes memory lowLevelData) {
|
} catch (bytes memory lowLevelData) {
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
string memory reason;
|
string memory reason;
|
||||||
emit TokenEvolveFail(
|
emit TokenEvolveFail(to, signature, reason, lowLevelData);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
lowLevelData
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ contract UserMinterFactory is Ownable, FactoryBase, Initializable {
|
|||||||
shard = IBEERC1155(addressArr[3]);
|
shard = IBEERC1155(addressArr[3]);
|
||||||
factory = MinterFactory(addressArr[4]);
|
factory = MinterFactory(addressArr[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev mint hero by user
|
* @dev mint hero by user
|
||||||
*/
|
*/
|
||||||
@ -38,30 +39,21 @@ contract UserMinterFactory is Ownable, FactoryBase, Initializable {
|
|||||||
bytes calldata signature
|
bytes calldata signature
|
||||||
) external returns (bool success) {
|
) external returns (bool success) {
|
||||||
address to = _msgSender();
|
address to = _msgSender();
|
||||||
try factory.mint721ByUser(to, tokenId, startTime, saltNonce, signature, hero) {
|
try
|
||||||
|
factory.mint721ByUser(to, tokenId, startTime, saltNonce, signature, hero)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
} catch Error(string memory reason) {
|
} catch Error(string memory reason) {
|
||||||
bytes memory by;
|
bytes memory by;
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, by);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
by
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
} catch (bytes memory lowLevelData) {
|
} catch (bytes memory lowLevelData) {
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
string memory reason;
|
string memory reason;
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, lowLevelData);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
lowLevelData
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,30 +66,21 @@ contract UserMinterFactory is Ownable, FactoryBase, Initializable {
|
|||||||
bytes calldata signature
|
bytes calldata signature
|
||||||
) external returns (bool success) {
|
) external returns (bool success) {
|
||||||
address to = _msgSender();
|
address to = _msgSender();
|
||||||
try factory.mint721ByUser(to, tokenId, startTime, saltNonce, signature, equip) {
|
try
|
||||||
|
factory.mint721ByUser(to, tokenId, startTime, saltNonce, signature, equip)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
} catch Error(string memory reason) {
|
} catch Error(string memory reason) {
|
||||||
bytes memory by;
|
bytes memory by;
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, by);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
by
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
} catch (bytes memory lowLevelData) {
|
} catch (bytes memory lowLevelData) {
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
string memory reason;
|
string memory reason;
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, lowLevelData);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
lowLevelData
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,27 +98,27 @@ contract UserMinterFactory is Ownable, FactoryBase, Initializable {
|
|||||||
amounts[i] = 1;
|
amounts[i] = 1;
|
||||||
}
|
}
|
||||||
address to = _msgSender();
|
address to = _msgSender();
|
||||||
try factory.mint1155BatchByUser(to, ids, amounts, startTime, saltNonce, signature, chip) {
|
try
|
||||||
|
factory.mint1155BatchByUser(
|
||||||
|
to,
|
||||||
|
ids,
|
||||||
|
amounts,
|
||||||
|
startTime,
|
||||||
|
saltNonce,
|
||||||
|
signature,
|
||||||
|
chip
|
||||||
|
)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
} catch Error(string memory reason) {
|
} catch Error(string memory reason) {
|
||||||
bytes memory by;
|
bytes memory by;
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, by);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
by
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
} catch (bytes memory lowLevelData) {
|
} catch (bytes memory lowLevelData) {
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
string memory reason;
|
string memory reason;
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, lowLevelData);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
lowLevelData
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,30 +134,31 @@ contract UserMinterFactory is Ownable, FactoryBase, Initializable {
|
|||||||
bytes calldata signature
|
bytes calldata signature
|
||||||
) external returns (bool success) {
|
) external returns (bool success) {
|
||||||
address to = _msgSender();
|
address to = _msgSender();
|
||||||
try factory.mint1155BatchByUser(to, ids, amounts, startTime, saltNonce, signature, shard) {
|
try
|
||||||
|
factory.mint1155BatchByUser(
|
||||||
|
to,
|
||||||
|
ids,
|
||||||
|
amounts,
|
||||||
|
startTime,
|
||||||
|
saltNonce,
|
||||||
|
signature,
|
||||||
|
shard
|
||||||
|
)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
} catch Error(string memory reason) {
|
} catch Error(string memory reason) {
|
||||||
bytes memory by;
|
bytes memory by;
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, by);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
by
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
} catch (bytes memory lowLevelData) {
|
} catch (bytes memory lowLevelData) {
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
string memory reason;
|
string memory reason;
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, lowLevelData);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
lowLevelData
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev mint hero or equip with shard
|
* @dev mint hero or equip with shard
|
||||||
*/
|
*/
|
||||||
@ -197,36 +181,24 @@ contract UserMinterFactory is Ownable, FactoryBase, Initializable {
|
|||||||
nft = equip;
|
nft = equip;
|
||||||
}
|
}
|
||||||
ShardParam memory param = ShardParam(
|
ShardParam memory param = ShardParam(
|
||||||
to, nftId, payToken, payAmount, startTime, saltNonce);
|
to,
|
||||||
try factory.shardMixByUser(
|
nftId,
|
||||||
param,
|
payToken,
|
||||||
ids,
|
payAmount,
|
||||||
amounts,
|
startTime,
|
||||||
signature,
|
saltNonce
|
||||||
nft
|
);
|
||||||
) {
|
try factory.shardMixByUser(param, ids, amounts, signature, nft) {
|
||||||
return true;
|
return true;
|
||||||
} catch Error(string memory reason) {
|
} catch Error(string memory reason) {
|
||||||
bytes memory by;
|
bytes memory by;
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, by);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
by
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
} catch (bytes memory lowLevelData) {
|
} catch (bytes memory lowLevelData) {
|
||||||
factory.useSignature(signature);
|
factory.useSignature(signature);
|
||||||
string memory reason;
|
string memory reason;
|
||||||
emit TokenMintFail(
|
emit TokenMintFail(to, signature, reason, lowLevelData);
|
||||||
to,
|
|
||||||
signature,
|
|
||||||
reason,
|
|
||||||
lowLevelData
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,10 @@ contract BEBoxMall is Ownable, HasSignature, TimelockController{
|
|||||||
|
|
||||||
bool public address_initialized;
|
bool public address_initialized;
|
||||||
|
|
||||||
constructor(
|
constructor(address[] memory proposers, address[] memory executors)
|
||||||
address[] memory proposers,
|
|
||||||
address[] memory executors)
|
|
||||||
TimelockController(MIN_DELAY, proposers, executors)
|
TimelockController(MIN_DELAY, proposers, executors)
|
||||||
HasSignature("BEBoxMall", "1"){
|
HasSignature("BEBoxMall", "1")
|
||||||
|
{
|
||||||
_minDelay = MIN_DELAY;
|
_minDelay = MIN_DELAY;
|
||||||
address_initialized = false;
|
address_initialized = false;
|
||||||
}
|
}
|
||||||
@ -37,14 +36,21 @@ contract BEBoxMall is Ownable, HasSignature, TimelockController{
|
|||||||
|
|
||||||
address public paymentReceivedAddress;
|
address public paymentReceivedAddress;
|
||||||
|
|
||||||
function setPaymentReceivedAddress(address _paymentReceivedAddress)
|
function setPaymentReceivedAddress(address _paymentReceivedAddress) public {
|
||||||
public
|
require(
|
||||||
{
|
_paymentReceivedAddress != address(0),
|
||||||
require(_paymentReceivedAddress != address(0), 'BEBoxMall::setPaymentReceivedAddress: payment received address can not be zero');
|
"BEBoxMall::setPaymentReceivedAddress: payment received address can not be zero"
|
||||||
|
);
|
||||||
if (address_initialized) {
|
if (address_initialized) {
|
||||||
require(msg.sender == address(this), "BEBoxMall::setPaymentReceivedAddress: Call must come from BEBoxMall.");
|
require(
|
||||||
|
msg.sender == address(this),
|
||||||
|
"BEBoxMall::setPaymentReceivedAddress: Call must come from BEBoxMall."
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
require(msg.sender == owner(), "BEBoxMall::setPaymentReceivedAddress: First call must come from owner.");
|
require(
|
||||||
|
msg.sender == owner(),
|
||||||
|
"BEBoxMall::setPaymentReceivedAddress: First call must come from owner."
|
||||||
|
);
|
||||||
address_initialized = true;
|
address_initialized = true;
|
||||||
}
|
}
|
||||||
paymentReceivedAddress = _paymentReceivedAddress;
|
paymentReceivedAddress = _paymentReceivedAddress;
|
||||||
@ -82,16 +88,9 @@ contract BEBoxMall is Ownable, HasSignature, TimelockController{
|
|||||||
userAddress,
|
userAddress,
|
||||||
address(this)
|
address(this)
|
||||||
);
|
);
|
||||||
require(
|
require(allowToPayAmount >= price, "BEBoxPayment: Invalid token allowance");
|
||||||
allowToPayAmount >= price,
|
|
||||||
"BEBoxPayment: Invalid token allowance"
|
|
||||||
);
|
|
||||||
// Transfer payment
|
// Transfer payment
|
||||||
paymentToken.safeTransferFrom(
|
paymentToken.safeTransferFrom(userAddress, paymentReceivedAddress, price);
|
||||||
userAddress,
|
|
||||||
paymentReceivedAddress,
|
|
||||||
price
|
|
||||||
);
|
|
||||||
useSignature(signature);
|
useSignature(signature);
|
||||||
// Emit payment event
|
// Emit payment event
|
||||||
emit BEBoxPaid(boxId, userAddress, _type, price, paymentErc20);
|
emit BEBoxPaid(boxId, userAddress, _type, price, paymentErc20);
|
||||||
@ -106,7 +105,9 @@ contract BEBoxMall is Ownable, HasSignature, TimelockController{
|
|||||||
return
|
return
|
||||||
keccak256(
|
keccak256(
|
||||||
abi.encode(
|
abi.encode(
|
||||||
keccak256("set(uint256 item,address token,uint256 price,uint256 salt)"),
|
keccak256(
|
||||||
|
"set(uint256 item,address token,uint256 price,uint256 salt)"
|
||||||
|
),
|
||||||
_boxType,
|
_boxType,
|
||||||
_paymentErc20,
|
_paymentErc20,
|
||||||
_price,
|
_price,
|
||||||
@ -120,7 +121,13 @@ contract BEBoxMall is Ownable, HasSignature, TimelockController{
|
|||||||
*
|
*
|
||||||
* This value can be changed by executing an operation that calls `updateDelay`.
|
* This value can be changed by executing an operation that calls `updateDelay`.
|
||||||
*/
|
*/
|
||||||
function getMinDelay() public view virtual override returns (uint256 duration) {
|
function getMinDelay()
|
||||||
|
public
|
||||||
|
view
|
||||||
|
virtual
|
||||||
|
override
|
||||||
|
returns (uint256 duration)
|
||||||
|
{
|
||||||
return _minDelay;
|
return _minDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,8 +143,14 @@ contract BEBoxMall is Ownable, HasSignature, TimelockController{
|
|||||||
*/
|
*/
|
||||||
function updateDelay(uint256 newDelay) external virtual override {
|
function updateDelay(uint256 newDelay) external virtual override {
|
||||||
require(msg.sender == address(this), "BEBoxMall: caller must be timelock");
|
require(msg.sender == address(this), "BEBoxMall: caller must be timelock");
|
||||||
require(newDelay >= MIN_DELAY, "BEBoxMall: newDelay must greater than or equal to MIN_DELAY");
|
require(
|
||||||
require(newDelay <= MAX_DELAY, "BEBoxMall: newDelay must less than or equal to MAX_DELAY");
|
newDelay >= MIN_DELAY,
|
||||||
|
"BEBoxMall: newDelay must greater than or equal to MIN_DELAY"
|
||||||
|
);
|
||||||
|
require(
|
||||||
|
newDelay <= MAX_DELAY,
|
||||||
|
"BEBoxMall: newDelay must less than or equal to MAX_DELAY"
|
||||||
|
);
|
||||||
emit MinDelayChange(_minDelay, newDelay);
|
emit MinDelayChange(_minDelay, newDelay);
|
||||||
_minDelay = newDelay;
|
_minDelay = newDelay;
|
||||||
}
|
}
|
||||||
|
@ -38,18 +38,20 @@ contract MarketPlace is Ownable, HasSignature {
|
|||||||
uint256 fee
|
uint256 fee
|
||||||
);
|
);
|
||||||
|
|
||||||
constructor()
|
constructor() HasSignature("MarketPlace", "1") {}
|
||||||
HasSignature("MarketPlace", "1"){
|
|
||||||
}
|
|
||||||
|
|
||||||
function setFeeToAddress(address _feeToAddress) external onlyOwner {
|
function setFeeToAddress(address _feeToAddress) external onlyOwner {
|
||||||
require(_feeToAddress != address(0), 'fee received address can not be zero');
|
require(
|
||||||
|
_feeToAddress != address(0),
|
||||||
|
"fee received address can not be zero"
|
||||||
|
);
|
||||||
feeToAddress = _feeToAddress;
|
feeToAddress = _feeToAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTransactionFee(uint256 _transactionFee) external onlyOwner {
|
function setTransactionFee(uint256 _transactionFee) external onlyOwner {
|
||||||
require(
|
require(
|
||||||
_transactionFee >= MIN_TRANSACTION_FEE && _transactionFee <= MAX_TRANSACTION_FEE,
|
_transactionFee >= MIN_TRANSACTION_FEE &&
|
||||||
|
_transactionFee <= MAX_TRANSACTION_FEE,
|
||||||
"Marketplace: _transactionFee must >= 50 and <= 1000"
|
"Marketplace: _transactionFee must >= 50 and <= 1000"
|
||||||
);
|
);
|
||||||
transactionFee = _transactionFee;
|
transactionFee = _transactionFee;
|
||||||
@ -105,10 +107,7 @@ contract MarketPlace is Ownable, HasSignature {
|
|||||||
// address[3] [seller_address,nft_address,payment_token_address]
|
// address[3] [seller_address,nft_address,payment_token_address]
|
||||||
// uint256[3] [token_id,price,salt_nonce]
|
// uint256[3] [token_id,price,salt_nonce]
|
||||||
// bytes seller_signature
|
// bytes seller_signature
|
||||||
require(
|
require(paymentTokens[addresses[2]], "Marketplace: invalid payment method");
|
||||||
paymentTokens[addresses[2]],
|
|
||||||
"Marketplace: invalid payment method"
|
|
||||||
);
|
|
||||||
|
|
||||||
bytes32 criteriaMessageHash = getMessageHash(
|
bytes32 criteriaMessageHash = getMessageHash(
|
||||||
addresses[1],
|
addresses[1],
|
||||||
@ -166,10 +165,9 @@ contract MarketPlace is Ownable, HasSignature {
|
|||||||
/**
|
/**
|
||||||
* @dev Function to emit transaction matched event
|
* @dev Function to emit transaction matched event
|
||||||
*/
|
*/
|
||||||
function emitEvent(
|
function emitEvent(address[3] calldata addresses, uint256[3] calldata values)
|
||||||
address[3] calldata addresses,
|
internal
|
||||||
uint256[3] calldata values
|
{
|
||||||
) internal {
|
|
||||||
emit MatchTransaction(
|
emit MatchTransaction(
|
||||||
values[0],
|
values[0],
|
||||||
addresses[1],
|
addresses[1],
|
||||||
@ -191,7 +189,9 @@ contract MarketPlace is Ownable, HasSignature {
|
|||||||
return
|
return
|
||||||
keccak256(
|
keccak256(
|
||||||
abi.encode(
|
abi.encode(
|
||||||
keccak256("set(address nft,uint256 tokenId,address payToken,uint256 price,uint256 salt)"),
|
keccak256(
|
||||||
|
"set(address nft,uint256 tokenId,address payToken,uint256 price,uint256 salt)"
|
||||||
|
),
|
||||||
_nftAddress,
|
_nftAddress,
|
||||||
_tokenId,
|
_tokenId,
|
||||||
_paymentErc20,
|
_paymentErc20,
|
||||||
|
@ -47,7 +47,6 @@ abstract contract BEBase1155 is ERC1155, Ownable, AccessControl {
|
|||||||
_mintBatch(to, ids, amounts, data);
|
_mintBatch(to, ids, amounts, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function burnBatch(
|
function burnBatch(
|
||||||
address account,
|
address account,
|
||||||
uint256[] memory ids,
|
uint256[] memory ids,
|
||||||
@ -70,34 +69,22 @@ abstract contract BEBase1155 is ERC1155, Ownable, AccessControl {
|
|||||||
/**
|
/**
|
||||||
* @dev Add factory to mint/burn item
|
* @dev Add factory to mint/burn item
|
||||||
*/
|
*/
|
||||||
function setMintFactory(address factory)
|
function setMintFactory(address factory) external onlyOwner {
|
||||||
external
|
|
||||||
onlyOwner
|
|
||||||
{
|
|
||||||
_grantRole(MINTER_ROLE, factory);
|
_grantRole(MINTER_ROLE, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Remove factory
|
* @dev Remove factory
|
||||||
*/
|
*/
|
||||||
function removeMintFactory(address factory)
|
function removeMintFactory(address factory) external onlyOwner {
|
||||||
external
|
|
||||||
onlyOwner
|
|
||||||
{
|
|
||||||
_revokeRole(MINTER_ROLE, factory);
|
_revokeRole(MINTER_ROLE, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
function grantLockRole(address account)
|
function grantLockRole(address account) external onlyOwner {
|
||||||
external
|
|
||||||
onlyOwner
|
|
||||||
{
|
|
||||||
_grantRole(LOCK_ROLE, account);
|
_grantRole(LOCK_ROLE, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
function revokeLockRole(address account)
|
function revokeLockRole(address account) external onlyOwner {
|
||||||
external
|
|
||||||
onlyOwner
|
|
||||||
{
|
|
||||||
_revokeRole(LOCK_ROLE, account);
|
_revokeRole(LOCK_ROLE, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +102,6 @@ abstract contract BEBase1155 is ERC1155, Ownable, AccessControl {
|
|||||||
_revokeRole(BURN_ROLE, proxy);
|
_revokeRole(BURN_ROLE, proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Total amount of tokens in with a given id.
|
* @dev Total amount of tokens in with a given id.
|
||||||
*/
|
*/
|
||||||
@ -130,13 +116,12 @@ abstract contract BEBase1155 is ERC1155, Ownable, AccessControl {
|
|||||||
return _totalSupply[id] > 0;
|
return _totalSupply[id] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function canMint(uint256 /*id*/) external view virtual returns (bool) {
|
function canMint(
|
||||||
|
uint256 /*id*/
|
||||||
|
) external view virtual returns (bool) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Lock token to use in game or for rental
|
* @dev Lock token to use in game or for rental
|
||||||
*/
|
*/
|
||||||
@ -241,10 +226,9 @@ abstract contract BEBase1155 is ERC1155, Ownable, AccessControl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
|
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
|
||||||
if (
|
if (_ownedTokensIndex[to][tokenId] == 0 && balanceOf(to, tokenId) == 0) {
|
||||||
_ownedTokensIndex[to][tokenId] == 0 && balanceOf(to, tokenId) == 0
|
|
||||||
) {
|
|
||||||
_ownedTokensIndex[to][tokenId] = _ownedTokens[to].length + 1;
|
_ownedTokensIndex[to][tokenId] = _ownedTokens[to].length + 1;
|
||||||
_ownedTokens[to].push(tokenId);
|
_ownedTokens[to].push(tokenId);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
pragma solidity 0.8.10;
|
pragma solidity 0.8.10;
|
||||||
|
|
||||||
import "./BEBase1155.sol";
|
import "./BEBase1155.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* for Hero and Weapon shard
|
* for Hero and Weapon shard
|
||||||
*/
|
*/
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
pragma solidity 0.8.10;
|
pragma solidity 0.8.10;
|
||||||
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
|
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
|
||||||
|
|
||||||
|
|
||||||
contract BECoin is ERC20Burnable {
|
contract BECoin is ERC20Burnable {
|
||||||
uint256 public constant INITIALIZED_CAP = 100000000 * 1e18;
|
uint256 public constant INITIALIZED_CAP = 100000000 * 1e18;
|
||||||
|
|
||||||
|
@ -4,15 +4,13 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|||||||
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
|
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
|
||||||
import "@openzeppelin/contracts/security/Pausable.sol";
|
import "@openzeppelin/contracts/security/Pausable.sol";
|
||||||
import "@openzeppelin/contracts/access/Ownable.sol";
|
import "@openzeppelin/contracts/access/Ownable.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this contract will transfer ownership to BETimelockController after deployed
|
* this contract will transfer ownership to BETimelockController after deployed
|
||||||
* all onlyowner method would add timelock
|
* all onlyowner method would add timelock
|
||||||
*/
|
*/
|
||||||
contract BEGold is ERC20, ERC20Burnable, Pausable, Ownable {
|
contract BEGold is ERC20, ERC20Burnable, Pausable, Ownable {
|
||||||
|
constructor() ERC20("CRYPTO ELITE'S GOLD", "CEG") {}
|
||||||
|
|
||||||
constructor() ERC20("CRYPTO ELITE'S GOLD", "CEG") {
|
|
||||||
}
|
|
||||||
|
|
||||||
function pause() external onlyOwner {
|
function pause() external onlyOwner {
|
||||||
_pause();
|
_pause();
|
||||||
@ -26,11 +24,11 @@ contract BEGold is ERC20, ERC20Burnable, Pausable, Ownable {
|
|||||||
_mint(to, amount);
|
_mint(to, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _beforeTokenTransfer(address from, address to, uint256 amount)
|
function _beforeTokenTransfer(
|
||||||
internal
|
address from,
|
||||||
whenNotPaused
|
address to,
|
||||||
override
|
uint256 amount
|
||||||
{
|
) internal override whenNotPaused {
|
||||||
super._beforeTokenTransfer(from, to, amount);
|
super._beforeTokenTransfer(from, to, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,8 +32,9 @@ abstract contract BEBase is ERC721, AccessControl, ERC721Enumerable, Ownable {
|
|||||||
*/
|
*/
|
||||||
function mint(address to, uint256 tokenId)
|
function mint(address to, uint256 tokenId)
|
||||||
external
|
external
|
||||||
|
virtual
|
||||||
onlyRole(MINTER_ROLE)
|
onlyRole(MINTER_ROLE)
|
||||||
virtual {
|
{
|
||||||
require(!_exists(tokenId), "Must have unique tokenId");
|
require(!_exists(tokenId), "Must have unique tokenId");
|
||||||
// We cannot just use balanceOf to create the new tokenId because tokens
|
// We cannot just use balanceOf to create the new tokenId because tokens
|
||||||
// can be burned (destroyed), so we need a separate counter.
|
// can be burned (destroyed), so we need a separate counter.
|
||||||
@ -67,26 +68,21 @@ abstract contract BEBase is ERC721, AccessControl, ERC721Enumerable, Ownable {
|
|||||||
function revokeBurnProxy(address proxy) external onlyOwner {
|
function revokeBurnProxy(address proxy) external onlyOwner {
|
||||||
_revokeRole(BURN_ROLE, proxy);
|
_revokeRole(BURN_ROLE, proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Add address to lock item
|
* @dev Add address to lock item
|
||||||
*/
|
*/
|
||||||
function grantLockRole(address account)
|
function grantLockRole(address account) external onlyOwner {
|
||||||
external
|
|
||||||
onlyOwner
|
|
||||||
{
|
|
||||||
_grantRole(LOCK_ROLE, account);
|
_grantRole(LOCK_ROLE, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Remove address for lock item
|
* @dev Remove address for lock item
|
||||||
*/
|
*/
|
||||||
function revokeLockRole(address account)
|
function revokeLockRole(address account) external onlyOwner {
|
||||||
external
|
|
||||||
onlyOwner
|
|
||||||
{
|
|
||||||
_revokeRole(LOCK_ROLE, account);
|
_revokeRole(LOCK_ROLE, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Lock token to use in game or for rental
|
* @dev Lock token to use in game or for rental
|
||||||
*/
|
*/
|
||||||
@ -144,7 +140,6 @@ abstract contract BEBase is ERC721, AccessControl, ERC721Enumerable, Ownable {
|
|||||||
return super.supportsInterface(interfaceId);
|
return super.supportsInterface(interfaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Burns `tokenId`.
|
* @dev Burns `tokenId`.
|
||||||
*
|
*
|
||||||
@ -154,8 +149,8 @@ abstract contract BEBase is ERC721, AccessControl, ERC721Enumerable, Ownable {
|
|||||||
*/
|
*/
|
||||||
function burn(address owner, uint256 tokenId)
|
function burn(address owner, uint256 tokenId)
|
||||||
external
|
external
|
||||||
onlyRole(BURN_ROLE)
|
|
||||||
virtual
|
virtual
|
||||||
|
onlyRole(BURN_ROLE)
|
||||||
{
|
{
|
||||||
require(_exists(tokenId), "TokenId not exists");
|
require(_exists(tokenId), "TokenId not exists");
|
||||||
require(!lockedTokens[tokenId], "Can not burn locked token");
|
require(!lockedTokens[tokenId], "Can not burn locked token");
|
||||||
@ -165,6 +160,4 @@ abstract contract BEBase is ERC721, AccessControl, ERC721Enumerable, Ownable {
|
|||||||
);
|
);
|
||||||
_burn(tokenId);
|
_burn(tokenId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,11 @@ import "./BEBase.sol";
|
|||||||
contract BEMysteryBox is BEBase {
|
contract BEMysteryBox is BEBase {
|
||||||
constructor() ERC721("CRYPTO ELITE'S MYSTERY BOXES", "BOX") {}
|
constructor() ERC721("CRYPTO ELITE'S MYSTERY BOXES", "BOX") {}
|
||||||
|
|
||||||
function userTokens(address user, uint256 start, uint256 page)
|
function userTokens(
|
||||||
external view returns (uint256 [] memory){
|
address user,
|
||||||
|
uint256 start,
|
||||||
|
uint256 page
|
||||||
|
) external view returns (uint256[] memory) {
|
||||||
uint256 size = balanceOf(user);
|
uint256 size = balanceOf(user);
|
||||||
uint256[] memory results = new uint256[](page);
|
uint256[] memory results = new uint256[](page);
|
||||||
if (start < size) {
|
if (start < size) {
|
||||||
|
@ -9,6 +9,7 @@ contract TimeChecker is Ownable {
|
|||||||
constructor() {
|
constructor() {
|
||||||
_duration = 1 days;
|
_duration = 1 days;
|
||||||
}
|
}
|
||||||
|
|
||||||
modifier timeValid(uint256 time) {
|
modifier timeValid(uint256 time) {
|
||||||
require(
|
require(
|
||||||
time + _duration >= block.timestamp,
|
time + _duration >= block.timestamp,
|
||||||
@ -20,8 +21,7 @@ contract TimeChecker is Ownable {
|
|||||||
/**
|
/**
|
||||||
* @dev Returns the max duration for function called by user
|
* @dev Returns the max duration for function called by user
|
||||||
*/
|
*/
|
||||||
function getDuration() external view
|
function getDuration() external view returns (uint256 duration) {
|
||||||
returns (uint256 duration) {
|
|
||||||
return _duration;
|
return _duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +31,4 @@ contract TimeChecker is Ownable {
|
|||||||
function updateDuation(uint256 valNew) external onlyOwner {
|
function updateDuation(uint256 valNew) external onlyOwner {
|
||||||
_duration = valNew;
|
_duration = valNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,11 @@
|
|||||||
pragma solidity 0.8.10;
|
pragma solidity 0.8.10;
|
||||||
|
|
||||||
library UInt {
|
library UInt {
|
||||||
|
function asSingletonArray(uint256 element)
|
||||||
function asSingletonArray(uint256 element) internal pure returns (uint256[] memory) {
|
internal
|
||||||
|
pure
|
||||||
|
returns (uint256[] memory)
|
||||||
|
{
|
||||||
uint256[] memory array = new uint256[](1);
|
uint256[] memory array = new uint256[](1);
|
||||||
array[0] = element;
|
array[0] = element;
|
||||||
return array;
|
return array;
|
||||||
|
104
package-lock.json
generated
104
package-lock.json
generated
@ -1426,6 +1426,15 @@
|
|||||||
"integrity": "sha1-n7OjzzEyMoFR81PeRjLgHlIQK+o=",
|
"integrity": "sha1-n7OjzzEyMoFR81PeRjLgHlIQK+o=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@solidity-parser/parser": {
|
||||||
|
"version": "0.14.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@solidity-parser/parser/-/parser-0.14.3.tgz",
|
||||||
|
"integrity": "sha512-29g2SZ29HtsqA58pLCtopI1P/cPy5/UAzlcAXO6T/CNJimG6yA8kx4NaseMyJULiC+TEs02Y9/yeHzClqoA0hw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"antlr4ts": "^0.5.0-alpha.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@szmarczak/http-timer": {
|
"@szmarczak/http-timer": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmmirror.com/@szmarczak/http-timer/download/@szmarczak/http-timer-1.1.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@szmarczak/http-timer/download/@szmarczak/http-timer-1.1.2.tgz",
|
||||||
@ -3061,6 +3070,12 @@
|
|||||||
"color-convert": "^1.9.0"
|
"color-convert": "^1.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"antlr4ts": {
|
||||||
|
"version": "0.5.0-alpha.4",
|
||||||
|
"resolved": "https://registry.npmmirror.com/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz",
|
||||||
|
"integrity": "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"any-signal": {
|
"any-signal": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmmirror.com/any-signal/download/any-signal-2.1.2.tgz",
|
"resolved": "https://registry.npmmirror.com/any-signal/download/any-signal-2.1.2.tgz",
|
||||||
@ -15296,6 +15311,89 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"prettier": {
|
||||||
|
"version": "2.7.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/prettier/-/prettier-2.7.1.tgz",
|
||||||
|
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"prettier-plugin-solidity": {
|
||||||
|
"version": "1.0.0-beta.24",
|
||||||
|
"resolved": "https://registry.npmmirror.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.24.tgz",
|
||||||
|
"integrity": "sha512-6JlV5BBTWzmDSq4kZ9PTXc3eLOX7DF5HpbqmmaF+kloyUwOZbJ12hIYsUaZh2fVgZdV2t0vWcvY6qhILhlzgqg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@solidity-parser/parser": "^0.14.3",
|
||||||
|
"emoji-regex": "^10.1.0",
|
||||||
|
"escape-string-regexp": "^4.0.0",
|
||||||
|
"semver": "^7.3.7",
|
||||||
|
"solidity-comments-extractor": "^0.0.7",
|
||||||
|
"string-width": "^4.2.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-regex": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"emoji-regex": {
|
||||||
|
"version": "10.1.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-10.1.0.tgz",
|
||||||
|
"integrity": "sha512-xAEnNCT3w2Tg6MA7ly6QqYJvEoY1tm9iIjJ3yMKK9JPlWuRHAMoe5iETwQnx3M9TVbFMfsrBgWKR+IsmswwNjg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"escape-string-regexp": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"is-fullwidth-code-point": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"semver": {
|
||||||
|
"version": "7.3.7",
|
||||||
|
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.3.7.tgz",
|
||||||
|
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"lru-cache": "^6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"string-width": {
|
||||||
|
"version": "4.2.3",
|
||||||
|
"resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz",
|
||||||
|
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"emoji-regex": "^8.0.0",
|
||||||
|
"is-fullwidth-code-point": "^3.0.0",
|
||||||
|
"strip-ansi": "^6.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"emoji-regex": {
|
||||||
|
"version": "8.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
|
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-ansi": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-regex": "^5.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"printj": {
|
"printj": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmmirror.com/printj/download/printj-1.1.2.tgz",
|
"resolved": "https://registry.npmmirror.com/printj/download/printj-1.1.2.tgz",
|
||||||
@ -16708,6 +16806,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"solidity-comments-extractor": {
|
||||||
|
"version": "0.0.7",
|
||||||
|
"resolved": "https://registry.npmmirror.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz",
|
||||||
|
"integrity": "sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"source-list-map": {
|
"source-list-map": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmmirror.com/source-list-map/download/source-list-map-2.0.1.tgz",
|
"resolved": "https://registry.npmmirror.com/source-list-map/download/source-list-map-2.0.1.tgz",
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npx truffle test",
|
"test": "npx truffle test",
|
||||||
"build": "truffle compile",
|
"build": "truffle compile",
|
||||||
|
"prettier": "prettier --write 'contracts/**/*.sol'",
|
||||||
|
"lint": "prettier --list-different 'contracts/**/*.sol'",
|
||||||
"deploy:dev": "truffle migrate --network development",
|
"deploy:dev": "truffle migrate --network development",
|
||||||
"deploy:20": "truffle migrate --network lan20 --compile-none",
|
"deploy:20": "truffle migrate --network lan20 --compile-none",
|
||||||
"deploy:22": "truffle migrate --network lan22 --compile-none",
|
"deploy:22": "truffle migrate --network lan22 --compile-none",
|
||||||
@ -20,6 +22,8 @@
|
|||||||
"@openzeppelin/test-helpers": "^0.5.15",
|
"@openzeppelin/test-helpers": "^0.5.15",
|
||||||
"@truffle/hdwallet-provider": "^2.0.0",
|
"@truffle/hdwallet-provider": "^2.0.0",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
|
"prettier": "^2.7.1",
|
||||||
|
"prettier-plugin-solidity": "^1.0.0-beta.24",
|
||||||
"truffle": "^5.4.23",
|
"truffle": "^5.4.23",
|
||||||
"truffle-plugin-stdjsonin": "git+https://github.com/mhrsalehi/truffle-plugin-stdjsonin.git",
|
"truffle-plugin-stdjsonin": "git+https://github.com/mhrsalehi/truffle-plugin-stdjsonin.git",
|
||||||
"truffle-plugin-verify": "^0.5.25"
|
"truffle-plugin-verify": "^0.5.25"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user