comment
stringlengths
1
211
input
stringlengths
155
20k
label
stringlengths
4
1k
original_idx
int64
203
514k
predicate
stringlengths
1
1k
"TheLostGlitchesComic: Purchase would exceed cap"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./TheLostGlitches.sol"; import "./ERC721A.sol"; contract TheLostGlitchesComic is ERC721A, AccessControlEnumerable, Ownable { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); TheLostGlitches public tlg; uint256 public MAX_COMICS; bool public METADATA_FROZEN; string public baseUri; bool public saleIsActive; bool public presaleIsActive; uint256 public mintPrice; uint256 public maxPerMint; uint256 public discountedMintPrice; event SetBaseUri(string indexed baseUri); modifier whenSaleActive { } modifier whenPresaleActive { } modifier whenMetadataNotFrozen { } constructor(address _tlg) ERC721A("The Lost Glitches Comic", "TLGCMC", 20) { } // ------------------ // Explicit overrides // ------------------ function supportsInterface(bytes4 interfaceId) public view override(ERC721A, AccessControlEnumerable) returns (bool) { } function tokenURI(uint256 _tokenId) public view override(ERC721A) returns (string memory) { } // ------------------ // Functions for the owner // ------------------ function setBaseUri(string memory _baseUri) external onlyOwner whenMetadataNotFrozen { } function freezeMetadata() external onlyOwner whenMetadataNotFrozen { } function setMintPrice(uint256 _mintPrice) external onlyOwner { } function setDiscountedMintPrice(uint256 _discountedMintPrice) external onlyOwner { } function toggleSaleState() external onlyOwner { } function togglePresaleState() external onlyOwner { } // Withdrawing function withdraw(address _to) external onlyOwner { } function withdrawTokens( IERC20 token, address receiver, uint256 amount ) external onlyOwner { } // ------------------ // Functions for external minting // ------------------ // External function mintComicsPresale(uint256 amount) external payable whenPresaleActive { require(tlg.balanceOf(msg.sender) > 0, "TheLostGlitchesComic: The presale is only for Glitch Owners."); require(<FILL_ME>) require(amount <= maxPerMint, "TheLostGlitchesComic: Amount exceeds max per mint"); _mintWithDiscount(amount); } function mintComics(uint256 amount) external payable whenSaleActive { } function mintComicsForCommunity(address to, uint256 amount) external onlyOwner { } function mintAirdrop(address to) external onlyRole(MINTER_ROLE) whenPresaleActive { } // Internal function _mintWithDiscount(uint256 amount) internal { } function _mintRegular(uint256 amount) internal { } function _mintMultiple(address to, uint256 amount) internal { } }
totalSupply()+amount<=MAX_COMICS,"TheLostGlitchesComic: Purchase would exceed cap"
9,878
totalSupply()+amount<=MAX_COMICS
"TheLostGlitchesComic: Minting would exceed cap"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./TheLostGlitches.sol"; import "./ERC721A.sol"; contract TheLostGlitchesComic is ERC721A, AccessControlEnumerable, Ownable { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); TheLostGlitches public tlg; uint256 public MAX_COMICS; bool public METADATA_FROZEN; string public baseUri; bool public saleIsActive; bool public presaleIsActive; uint256 public mintPrice; uint256 public maxPerMint; uint256 public discountedMintPrice; event SetBaseUri(string indexed baseUri); modifier whenSaleActive { } modifier whenPresaleActive { } modifier whenMetadataNotFrozen { } constructor(address _tlg) ERC721A("The Lost Glitches Comic", "TLGCMC", 20) { } // ------------------ // Explicit overrides // ------------------ function supportsInterface(bytes4 interfaceId) public view override(ERC721A, AccessControlEnumerable) returns (bool) { } function tokenURI(uint256 _tokenId) public view override(ERC721A) returns (string memory) { } // ------------------ // Functions for the owner // ------------------ function setBaseUri(string memory _baseUri) external onlyOwner whenMetadataNotFrozen { } function freezeMetadata() external onlyOwner whenMetadataNotFrozen { } function setMintPrice(uint256 _mintPrice) external onlyOwner { } function setDiscountedMintPrice(uint256 _discountedMintPrice) external onlyOwner { } function toggleSaleState() external onlyOwner { } function togglePresaleState() external onlyOwner { } // Withdrawing function withdraw(address _to) external onlyOwner { } function withdrawTokens( IERC20 token, address receiver, uint256 amount ) external onlyOwner { } // ------------------ // Functions for external minting // ------------------ // External function mintComicsPresale(uint256 amount) external payable whenPresaleActive { } function mintComics(uint256 amount) external payable whenSaleActive { } function mintComicsForCommunity(address to, uint256 amount) external onlyOwner { } function mintAirdrop(address to) external onlyRole(MINTER_ROLE) whenPresaleActive { require(to != address(0), "TheLostGlitchesComic: Cannot mint to zero address."); require(<FILL_ME>) _mintMultiple(to, 1); } // Internal function _mintWithDiscount(uint256 amount) internal { } function _mintRegular(uint256 amount) internal { } function _mintMultiple(address to, uint256 amount) internal { } }
totalSupply()+1<=MAX_COMICS,"TheLostGlitchesComic: Minting would exceed cap"
9,878
totalSupply()+1<=MAX_COMICS
"TheLostGlitchesComic: Ether value sent is not correct"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./TheLostGlitches.sol"; import "./ERC721A.sol"; contract TheLostGlitchesComic is ERC721A, AccessControlEnumerable, Ownable { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); TheLostGlitches public tlg; uint256 public MAX_COMICS; bool public METADATA_FROZEN; string public baseUri; bool public saleIsActive; bool public presaleIsActive; uint256 public mintPrice; uint256 public maxPerMint; uint256 public discountedMintPrice; event SetBaseUri(string indexed baseUri); modifier whenSaleActive { } modifier whenPresaleActive { } modifier whenMetadataNotFrozen { } constructor(address _tlg) ERC721A("The Lost Glitches Comic", "TLGCMC", 20) { } // ------------------ // Explicit overrides // ------------------ function supportsInterface(bytes4 interfaceId) public view override(ERC721A, AccessControlEnumerable) returns (bool) { } function tokenURI(uint256 _tokenId) public view override(ERC721A) returns (string memory) { } // ------------------ // Functions for the owner // ------------------ function setBaseUri(string memory _baseUri) external onlyOwner whenMetadataNotFrozen { } function freezeMetadata() external onlyOwner whenMetadataNotFrozen { } function setMintPrice(uint256 _mintPrice) external onlyOwner { } function setDiscountedMintPrice(uint256 _discountedMintPrice) external onlyOwner { } function toggleSaleState() external onlyOwner { } function togglePresaleState() external onlyOwner { } // Withdrawing function withdraw(address _to) external onlyOwner { } function withdrawTokens( IERC20 token, address receiver, uint256 amount ) external onlyOwner { } // ------------------ // Functions for external minting // ------------------ // External function mintComicsPresale(uint256 amount) external payable whenPresaleActive { } function mintComics(uint256 amount) external payable whenSaleActive { } function mintComicsForCommunity(address to, uint256 amount) external onlyOwner { } function mintAirdrop(address to) external onlyRole(MINTER_ROLE) whenPresaleActive { } // Internal function _mintWithDiscount(uint256 amount) internal { require(<FILL_ME>) _mintMultiple(msg.sender, amount); } function _mintRegular(uint256 amount) internal { } function _mintMultiple(address to, uint256 amount) internal { } }
discountedMintPrice*amount<=msg.value,"TheLostGlitchesComic: Ether value sent is not correct"
9,878
discountedMintPrice*amount<=msg.value
"TheLostGlitchesComic: Ether value sent is not correct"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./TheLostGlitches.sol"; import "./ERC721A.sol"; contract TheLostGlitchesComic is ERC721A, AccessControlEnumerable, Ownable { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); TheLostGlitches public tlg; uint256 public MAX_COMICS; bool public METADATA_FROZEN; string public baseUri; bool public saleIsActive; bool public presaleIsActive; uint256 public mintPrice; uint256 public maxPerMint; uint256 public discountedMintPrice; event SetBaseUri(string indexed baseUri); modifier whenSaleActive { } modifier whenPresaleActive { } modifier whenMetadataNotFrozen { } constructor(address _tlg) ERC721A("The Lost Glitches Comic", "TLGCMC", 20) { } // ------------------ // Explicit overrides // ------------------ function supportsInterface(bytes4 interfaceId) public view override(ERC721A, AccessControlEnumerable) returns (bool) { } function tokenURI(uint256 _tokenId) public view override(ERC721A) returns (string memory) { } // ------------------ // Functions for the owner // ------------------ function setBaseUri(string memory _baseUri) external onlyOwner whenMetadataNotFrozen { } function freezeMetadata() external onlyOwner whenMetadataNotFrozen { } function setMintPrice(uint256 _mintPrice) external onlyOwner { } function setDiscountedMintPrice(uint256 _discountedMintPrice) external onlyOwner { } function toggleSaleState() external onlyOwner { } function togglePresaleState() external onlyOwner { } // Withdrawing function withdraw(address _to) external onlyOwner { } function withdrawTokens( IERC20 token, address receiver, uint256 amount ) external onlyOwner { } // ------------------ // Functions for external minting // ------------------ // External function mintComicsPresale(uint256 amount) external payable whenPresaleActive { } function mintComics(uint256 amount) external payable whenSaleActive { } function mintComicsForCommunity(address to, uint256 amount) external onlyOwner { } function mintAirdrop(address to) external onlyRole(MINTER_ROLE) whenPresaleActive { } // Internal function _mintWithDiscount(uint256 amount) internal { } function _mintRegular(uint256 amount) internal { require(<FILL_ME>) _mintMultiple(msg.sender, amount); } function _mintMultiple(address to, uint256 amount) internal { } }
mintPrice*amount<=msg.value,"TheLostGlitchesComic: Ether value sent is not correct"
9,878
mintPrice*amount<=msg.value
CONTEXT_NOT_FOUND
pragma solidity ^0.6.3; contract BrightID { uint256 public id; struct Context { bool isActive; mapping(address => bool) owners; mapping(address => bool) nodes; mapping(uint256 => address[]) accounts; mapping(bytes32 => uint256) cIdToUid; mapping(address => uint256) ethToUid; } mapping(bytes32 => Context) private contexts; string private constant DUPLICATE_ETHEREUM_ADDRESS = "Duplicate ethereum address"; string private constant DUPLICATE_CONTEXT_ID = "Duplicate context id"; string private constant ONLY_CONTEXT_OWNER = "Only context owner"; string private constant UNAUTHORIZED_NODE = "Unauthorized node"; string private constant CONTEXT_NOT_FOUND = "Context not found"; string private constant NODE_NOT_FOUND = "Node not found"; string private constant ALREADY_EXISTS = "Already exists"; string private constant BAD_SIGNATURE = "Bad signature"; string private constant NO_CONTEXT_ID = "No context id"; /// Events event ContextAdded(bytes32 indexed context, address indexed owner); event ContextOwnerAdded(bytes32 indexed context, address owner); event ContextOwnerRemoved(bytes32 indexed context, address owner); event NodeAddedToContext(bytes32 indexed context, address nodeAddress); event NodeRemovedFromContext(bytes32 indexed context, address nodeAddress); event AddressLinked(bytes32 context, bytes32 contextId, address ethAddress); event SponsorshipRequested(bytes32 indexed context, bytes32 indexed contextid); constructor() public { } /** * @notice Check whether the context has been added to the smart contract using `addContext`. * @param context The context. * @return has the context been added? */ function isContext(bytes32 context) public view returns(bool) { } /** * @notice Check whether `nodeAddress`'s signature is acceptable for the context. * @param context The context. * @param nodeAddress The node's address. * @return can `nodeAddress` sign requests for this context? */ function isNodeInContext(bytes32 context, address nodeAddress) public view returns(bool) { } /** * @dev get uid. * @param context The context. * @param cIds an array of contextIds. */ function getUid(bytes32 context, bytes32[] memory cIds) internal returns(uint256) { } /** * @notice Link `cIds[0]` to `msg.sender` under `context`. * @param context The context. * @param cIds an array of contextIds. * @param v signature's v. * @param r signature's r. * @param s signature's s. */ function register( bytes32 context, bytes32[] memory cIds, uint8 v, bytes32 r, bytes32 s) public { require(<FILL_ME>) require(0 < cIds.length, NO_CONTEXT_ID); require(contexts[context].cIdToUid[cIds[0]] == 0, DUPLICATE_CONTEXT_ID); require(contexts[context].ethToUid[msg.sender] == 0, DUPLICATE_ETHEREUM_ADDRESS); bytes32 message = keccak256(abi.encodePacked(context, cIds)); address signerAddress = ecrecover(message, v, r, s); require(signerAddress != address(0), BAD_SIGNATURE); require(contexts[context].nodes[signerAddress], UNAUTHORIZED_NODE); uint256 uid = getUid(context, cIds); contexts[context].ethToUid[msg.sender] = uid; for(uint256 i=0; i < cIds.length-1; i++) { contexts[context].cIdToUid[cIds[i]] = uid; } // The last member of contexts[context].accounts[uid] is active address of the user contexts[context].accounts[uid].push(msg.sender); emit AddressLinked(context, cIds[0], msg.sender); } /** * @notice Check that `ethAddress` is the mostly recently used address by a unique human in the context. * Also return any addresses previously used by this unique human. * @param ethAddress an Ethereum address. * @param context the context. * @return is `ethAddress` the most recently used address by a unique human in the `context`. * @return addresses previously used by this unique human. */ function isUniqueHuman( address ethAddress, bytes32 context) public view returns(bool, address[] memory) { } /** * @notice Submit a request to sponsor `contextid` under `context`. * @param context The context. * @param contextid The contextid. */ function sponsor(bytes32 context, bytes32 contextid) public onlyContextOwner(context) { } /** * @notice Add a context. * @param context The context. */ function addContext(bytes32 context) public { } /** * @notice Add a context owner. * @param context The context. * @param owner The address of the context owner to be added. */ function addContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Remove a context owner. * @param context The context. * @param owner The address of the context owner to be removed. */ function removeContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Check that `owner` is a owner of `context`. * @param context The context. * @param owner The new context's owner. */ function isContextOwner(bytes32 context, address owner) public view returns(bool) { } /** * @notice Add `nodeAddress` as a node to the context. * @param context The context. * @param nodeAddress The node's address. */ function addNodeToContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @notice Remove `nodeAddress` from the context's nodes. * @param context The context. * @param nodeAddress The node's address. */ function removeNodeFromContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @dev Throws if called by any account other than the owner of the context. * @param context The context. */ modifier onlyContextOwner(bytes32 context) { } }
isContext(context),CONTEXT_NOT_FOUND
10,042
isContext(context)
DUPLICATE_CONTEXT_ID
pragma solidity ^0.6.3; contract BrightID { uint256 public id; struct Context { bool isActive; mapping(address => bool) owners; mapping(address => bool) nodes; mapping(uint256 => address[]) accounts; mapping(bytes32 => uint256) cIdToUid; mapping(address => uint256) ethToUid; } mapping(bytes32 => Context) private contexts; string private constant DUPLICATE_ETHEREUM_ADDRESS = "Duplicate ethereum address"; string private constant DUPLICATE_CONTEXT_ID = "Duplicate context id"; string private constant ONLY_CONTEXT_OWNER = "Only context owner"; string private constant UNAUTHORIZED_NODE = "Unauthorized node"; string private constant CONTEXT_NOT_FOUND = "Context not found"; string private constant NODE_NOT_FOUND = "Node not found"; string private constant ALREADY_EXISTS = "Already exists"; string private constant BAD_SIGNATURE = "Bad signature"; string private constant NO_CONTEXT_ID = "No context id"; /// Events event ContextAdded(bytes32 indexed context, address indexed owner); event ContextOwnerAdded(bytes32 indexed context, address owner); event ContextOwnerRemoved(bytes32 indexed context, address owner); event NodeAddedToContext(bytes32 indexed context, address nodeAddress); event NodeRemovedFromContext(bytes32 indexed context, address nodeAddress); event AddressLinked(bytes32 context, bytes32 contextId, address ethAddress); event SponsorshipRequested(bytes32 indexed context, bytes32 indexed contextid); constructor() public { } /** * @notice Check whether the context has been added to the smart contract using `addContext`. * @param context The context. * @return has the context been added? */ function isContext(bytes32 context) public view returns(bool) { } /** * @notice Check whether `nodeAddress`'s signature is acceptable for the context. * @param context The context. * @param nodeAddress The node's address. * @return can `nodeAddress` sign requests for this context? */ function isNodeInContext(bytes32 context, address nodeAddress) public view returns(bool) { } /** * @dev get uid. * @param context The context. * @param cIds an array of contextIds. */ function getUid(bytes32 context, bytes32[] memory cIds) internal returns(uint256) { } /** * @notice Link `cIds[0]` to `msg.sender` under `context`. * @param context The context. * @param cIds an array of contextIds. * @param v signature's v. * @param r signature's r. * @param s signature's s. */ function register( bytes32 context, bytes32[] memory cIds, uint8 v, bytes32 r, bytes32 s) public { require(isContext(context), CONTEXT_NOT_FOUND); require(0 < cIds.length, NO_CONTEXT_ID); require(<FILL_ME>) require(contexts[context].ethToUid[msg.sender] == 0, DUPLICATE_ETHEREUM_ADDRESS); bytes32 message = keccak256(abi.encodePacked(context, cIds)); address signerAddress = ecrecover(message, v, r, s); require(signerAddress != address(0), BAD_SIGNATURE); require(contexts[context].nodes[signerAddress], UNAUTHORIZED_NODE); uint256 uid = getUid(context, cIds); contexts[context].ethToUid[msg.sender] = uid; for(uint256 i=0; i < cIds.length-1; i++) { contexts[context].cIdToUid[cIds[i]] = uid; } // The last member of contexts[context].accounts[uid] is active address of the user contexts[context].accounts[uid].push(msg.sender); emit AddressLinked(context, cIds[0], msg.sender); } /** * @notice Check that `ethAddress` is the mostly recently used address by a unique human in the context. * Also return any addresses previously used by this unique human. * @param ethAddress an Ethereum address. * @param context the context. * @return is `ethAddress` the most recently used address by a unique human in the `context`. * @return addresses previously used by this unique human. */ function isUniqueHuman( address ethAddress, bytes32 context) public view returns(bool, address[] memory) { } /** * @notice Submit a request to sponsor `contextid` under `context`. * @param context The context. * @param contextid The contextid. */ function sponsor(bytes32 context, bytes32 contextid) public onlyContextOwner(context) { } /** * @notice Add a context. * @param context The context. */ function addContext(bytes32 context) public { } /** * @notice Add a context owner. * @param context The context. * @param owner The address of the context owner to be added. */ function addContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Remove a context owner. * @param context The context. * @param owner The address of the context owner to be removed. */ function removeContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Check that `owner` is a owner of `context`. * @param context The context. * @param owner The new context's owner. */ function isContextOwner(bytes32 context, address owner) public view returns(bool) { } /** * @notice Add `nodeAddress` as a node to the context. * @param context The context. * @param nodeAddress The node's address. */ function addNodeToContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @notice Remove `nodeAddress` from the context's nodes. * @param context The context. * @param nodeAddress The node's address. */ function removeNodeFromContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @dev Throws if called by any account other than the owner of the context. * @param context The context. */ modifier onlyContextOwner(bytes32 context) { } }
contexts[context].cIdToUid[cIds[0]]==0,DUPLICATE_CONTEXT_ID
10,042
contexts[context].cIdToUid[cIds[0]]==0
DUPLICATE_ETHEREUM_ADDRESS
pragma solidity ^0.6.3; contract BrightID { uint256 public id; struct Context { bool isActive; mapping(address => bool) owners; mapping(address => bool) nodes; mapping(uint256 => address[]) accounts; mapping(bytes32 => uint256) cIdToUid; mapping(address => uint256) ethToUid; } mapping(bytes32 => Context) private contexts; string private constant DUPLICATE_ETHEREUM_ADDRESS = "Duplicate ethereum address"; string private constant DUPLICATE_CONTEXT_ID = "Duplicate context id"; string private constant ONLY_CONTEXT_OWNER = "Only context owner"; string private constant UNAUTHORIZED_NODE = "Unauthorized node"; string private constant CONTEXT_NOT_FOUND = "Context not found"; string private constant NODE_NOT_FOUND = "Node not found"; string private constant ALREADY_EXISTS = "Already exists"; string private constant BAD_SIGNATURE = "Bad signature"; string private constant NO_CONTEXT_ID = "No context id"; /// Events event ContextAdded(bytes32 indexed context, address indexed owner); event ContextOwnerAdded(bytes32 indexed context, address owner); event ContextOwnerRemoved(bytes32 indexed context, address owner); event NodeAddedToContext(bytes32 indexed context, address nodeAddress); event NodeRemovedFromContext(bytes32 indexed context, address nodeAddress); event AddressLinked(bytes32 context, bytes32 contextId, address ethAddress); event SponsorshipRequested(bytes32 indexed context, bytes32 indexed contextid); constructor() public { } /** * @notice Check whether the context has been added to the smart contract using `addContext`. * @param context The context. * @return has the context been added? */ function isContext(bytes32 context) public view returns(bool) { } /** * @notice Check whether `nodeAddress`'s signature is acceptable for the context. * @param context The context. * @param nodeAddress The node's address. * @return can `nodeAddress` sign requests for this context? */ function isNodeInContext(bytes32 context, address nodeAddress) public view returns(bool) { } /** * @dev get uid. * @param context The context. * @param cIds an array of contextIds. */ function getUid(bytes32 context, bytes32[] memory cIds) internal returns(uint256) { } /** * @notice Link `cIds[0]` to `msg.sender` under `context`. * @param context The context. * @param cIds an array of contextIds. * @param v signature's v. * @param r signature's r. * @param s signature's s. */ function register( bytes32 context, bytes32[] memory cIds, uint8 v, bytes32 r, bytes32 s) public { require(isContext(context), CONTEXT_NOT_FOUND); require(0 < cIds.length, NO_CONTEXT_ID); require(contexts[context].cIdToUid[cIds[0]] == 0, DUPLICATE_CONTEXT_ID); require(<FILL_ME>) bytes32 message = keccak256(abi.encodePacked(context, cIds)); address signerAddress = ecrecover(message, v, r, s); require(signerAddress != address(0), BAD_SIGNATURE); require(contexts[context].nodes[signerAddress], UNAUTHORIZED_NODE); uint256 uid = getUid(context, cIds); contexts[context].ethToUid[msg.sender] = uid; for(uint256 i=0; i < cIds.length-1; i++) { contexts[context].cIdToUid[cIds[i]] = uid; } // The last member of contexts[context].accounts[uid] is active address of the user contexts[context].accounts[uid].push(msg.sender); emit AddressLinked(context, cIds[0], msg.sender); } /** * @notice Check that `ethAddress` is the mostly recently used address by a unique human in the context. * Also return any addresses previously used by this unique human. * @param ethAddress an Ethereum address. * @param context the context. * @return is `ethAddress` the most recently used address by a unique human in the `context`. * @return addresses previously used by this unique human. */ function isUniqueHuman( address ethAddress, bytes32 context) public view returns(bool, address[] memory) { } /** * @notice Submit a request to sponsor `contextid` under `context`. * @param context The context. * @param contextid The contextid. */ function sponsor(bytes32 context, bytes32 contextid) public onlyContextOwner(context) { } /** * @notice Add a context. * @param context The context. */ function addContext(bytes32 context) public { } /** * @notice Add a context owner. * @param context The context. * @param owner The address of the context owner to be added. */ function addContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Remove a context owner. * @param context The context. * @param owner The address of the context owner to be removed. */ function removeContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Check that `owner` is a owner of `context`. * @param context The context. * @param owner The new context's owner. */ function isContextOwner(bytes32 context, address owner) public view returns(bool) { } /** * @notice Add `nodeAddress` as a node to the context. * @param context The context. * @param nodeAddress The node's address. */ function addNodeToContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @notice Remove `nodeAddress` from the context's nodes. * @param context The context. * @param nodeAddress The node's address. */ function removeNodeFromContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @dev Throws if called by any account other than the owner of the context. * @param context The context. */ modifier onlyContextOwner(bytes32 context) { } }
contexts[context].ethToUid[msg.sender]==0,DUPLICATE_ETHEREUM_ADDRESS
10,042
contexts[context].ethToUid[msg.sender]==0
UNAUTHORIZED_NODE
pragma solidity ^0.6.3; contract BrightID { uint256 public id; struct Context { bool isActive; mapping(address => bool) owners; mapping(address => bool) nodes; mapping(uint256 => address[]) accounts; mapping(bytes32 => uint256) cIdToUid; mapping(address => uint256) ethToUid; } mapping(bytes32 => Context) private contexts; string private constant DUPLICATE_ETHEREUM_ADDRESS = "Duplicate ethereum address"; string private constant DUPLICATE_CONTEXT_ID = "Duplicate context id"; string private constant ONLY_CONTEXT_OWNER = "Only context owner"; string private constant UNAUTHORIZED_NODE = "Unauthorized node"; string private constant CONTEXT_NOT_FOUND = "Context not found"; string private constant NODE_NOT_FOUND = "Node not found"; string private constant ALREADY_EXISTS = "Already exists"; string private constant BAD_SIGNATURE = "Bad signature"; string private constant NO_CONTEXT_ID = "No context id"; /// Events event ContextAdded(bytes32 indexed context, address indexed owner); event ContextOwnerAdded(bytes32 indexed context, address owner); event ContextOwnerRemoved(bytes32 indexed context, address owner); event NodeAddedToContext(bytes32 indexed context, address nodeAddress); event NodeRemovedFromContext(bytes32 indexed context, address nodeAddress); event AddressLinked(bytes32 context, bytes32 contextId, address ethAddress); event SponsorshipRequested(bytes32 indexed context, bytes32 indexed contextid); constructor() public { } /** * @notice Check whether the context has been added to the smart contract using `addContext`. * @param context The context. * @return has the context been added? */ function isContext(bytes32 context) public view returns(bool) { } /** * @notice Check whether `nodeAddress`'s signature is acceptable for the context. * @param context The context. * @param nodeAddress The node's address. * @return can `nodeAddress` sign requests for this context? */ function isNodeInContext(bytes32 context, address nodeAddress) public view returns(bool) { } /** * @dev get uid. * @param context The context. * @param cIds an array of contextIds. */ function getUid(bytes32 context, bytes32[] memory cIds) internal returns(uint256) { } /** * @notice Link `cIds[0]` to `msg.sender` under `context`. * @param context The context. * @param cIds an array of contextIds. * @param v signature's v. * @param r signature's r. * @param s signature's s. */ function register( bytes32 context, bytes32[] memory cIds, uint8 v, bytes32 r, bytes32 s) public { require(isContext(context), CONTEXT_NOT_FOUND); require(0 < cIds.length, NO_CONTEXT_ID); require(contexts[context].cIdToUid[cIds[0]] == 0, DUPLICATE_CONTEXT_ID); require(contexts[context].ethToUid[msg.sender] == 0, DUPLICATE_ETHEREUM_ADDRESS); bytes32 message = keccak256(abi.encodePacked(context, cIds)); address signerAddress = ecrecover(message, v, r, s); require(signerAddress != address(0), BAD_SIGNATURE); require(<FILL_ME>) uint256 uid = getUid(context, cIds); contexts[context].ethToUid[msg.sender] = uid; for(uint256 i=0; i < cIds.length-1; i++) { contexts[context].cIdToUid[cIds[i]] = uid; } // The last member of contexts[context].accounts[uid] is active address of the user contexts[context].accounts[uid].push(msg.sender); emit AddressLinked(context, cIds[0], msg.sender); } /** * @notice Check that `ethAddress` is the mostly recently used address by a unique human in the context. * Also return any addresses previously used by this unique human. * @param ethAddress an Ethereum address. * @param context the context. * @return is `ethAddress` the most recently used address by a unique human in the `context`. * @return addresses previously used by this unique human. */ function isUniqueHuman( address ethAddress, bytes32 context) public view returns(bool, address[] memory) { } /** * @notice Submit a request to sponsor `contextid` under `context`. * @param context The context. * @param contextid The contextid. */ function sponsor(bytes32 context, bytes32 contextid) public onlyContextOwner(context) { } /** * @notice Add a context. * @param context The context. */ function addContext(bytes32 context) public { } /** * @notice Add a context owner. * @param context The context. * @param owner The address of the context owner to be added. */ function addContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Remove a context owner. * @param context The context. * @param owner The address of the context owner to be removed. */ function removeContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Check that `owner` is a owner of `context`. * @param context The context. * @param owner The new context's owner. */ function isContextOwner(bytes32 context, address owner) public view returns(bool) { } /** * @notice Add `nodeAddress` as a node to the context. * @param context The context. * @param nodeAddress The node's address. */ function addNodeToContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @notice Remove `nodeAddress` from the context's nodes. * @param context The context. * @param nodeAddress The node's address. */ function removeNodeFromContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @dev Throws if called by any account other than the owner of the context. * @param context The context. */ modifier onlyContextOwner(bytes32 context) { } }
contexts[context].nodes[signerAddress],UNAUTHORIZED_NODE
10,042
contexts[context].nodes[signerAddress]
ALREADY_EXISTS
pragma solidity ^0.6.3; contract BrightID { uint256 public id; struct Context { bool isActive; mapping(address => bool) owners; mapping(address => bool) nodes; mapping(uint256 => address[]) accounts; mapping(bytes32 => uint256) cIdToUid; mapping(address => uint256) ethToUid; } mapping(bytes32 => Context) private contexts; string private constant DUPLICATE_ETHEREUM_ADDRESS = "Duplicate ethereum address"; string private constant DUPLICATE_CONTEXT_ID = "Duplicate context id"; string private constant ONLY_CONTEXT_OWNER = "Only context owner"; string private constant UNAUTHORIZED_NODE = "Unauthorized node"; string private constant CONTEXT_NOT_FOUND = "Context not found"; string private constant NODE_NOT_FOUND = "Node not found"; string private constant ALREADY_EXISTS = "Already exists"; string private constant BAD_SIGNATURE = "Bad signature"; string private constant NO_CONTEXT_ID = "No context id"; /// Events event ContextAdded(bytes32 indexed context, address indexed owner); event ContextOwnerAdded(bytes32 indexed context, address owner); event ContextOwnerRemoved(bytes32 indexed context, address owner); event NodeAddedToContext(bytes32 indexed context, address nodeAddress); event NodeRemovedFromContext(bytes32 indexed context, address nodeAddress); event AddressLinked(bytes32 context, bytes32 contextId, address ethAddress); event SponsorshipRequested(bytes32 indexed context, bytes32 indexed contextid); constructor() public { } /** * @notice Check whether the context has been added to the smart contract using `addContext`. * @param context The context. * @return has the context been added? */ function isContext(bytes32 context) public view returns(bool) { } /** * @notice Check whether `nodeAddress`'s signature is acceptable for the context. * @param context The context. * @param nodeAddress The node's address. * @return can `nodeAddress` sign requests for this context? */ function isNodeInContext(bytes32 context, address nodeAddress) public view returns(bool) { } /** * @dev get uid. * @param context The context. * @param cIds an array of contextIds. */ function getUid(bytes32 context, bytes32[] memory cIds) internal returns(uint256) { } /** * @notice Link `cIds[0]` to `msg.sender` under `context`. * @param context The context. * @param cIds an array of contextIds. * @param v signature's v. * @param r signature's r. * @param s signature's s. */ function register( bytes32 context, bytes32[] memory cIds, uint8 v, bytes32 r, bytes32 s) public { } /** * @notice Check that `ethAddress` is the mostly recently used address by a unique human in the context. * Also return any addresses previously used by this unique human. * @param ethAddress an Ethereum address. * @param context the context. * @return is `ethAddress` the most recently used address by a unique human in the `context`. * @return addresses previously used by this unique human. */ function isUniqueHuman( address ethAddress, bytes32 context) public view returns(bool, address[] memory) { } /** * @notice Submit a request to sponsor `contextid` under `context`. * @param context The context. * @param contextid The contextid. */ function sponsor(bytes32 context, bytes32 contextid) public onlyContextOwner(context) { } /** * @notice Add a context. * @param context The context. */ function addContext(bytes32 context) public { require(<FILL_ME>) contexts[context].isActive = true; contexts[context].owners[msg.sender] = true; emit ContextAdded(context, msg.sender); } /** * @notice Add a context owner. * @param context The context. * @param owner The address of the context owner to be added. */ function addContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Remove a context owner. * @param context The context. * @param owner The address of the context owner to be removed. */ function removeContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Check that `owner` is a owner of `context`. * @param context The context. * @param owner The new context's owner. */ function isContextOwner(bytes32 context, address owner) public view returns(bool) { } /** * @notice Add `nodeAddress` as a node to the context. * @param context The context. * @param nodeAddress The node's address. */ function addNodeToContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @notice Remove `nodeAddress` from the context's nodes. * @param context The context. * @param nodeAddress The node's address. */ function removeNodeFromContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @dev Throws if called by any account other than the owner of the context. * @param context The context. */ modifier onlyContextOwner(bytes32 context) { } }
contexts[context].isActive!=true,ALREADY_EXISTS
10,042
contexts[context].isActive!=true
ALREADY_EXISTS
pragma solidity ^0.6.3; contract BrightID { uint256 public id; struct Context { bool isActive; mapping(address => bool) owners; mapping(address => bool) nodes; mapping(uint256 => address[]) accounts; mapping(bytes32 => uint256) cIdToUid; mapping(address => uint256) ethToUid; } mapping(bytes32 => Context) private contexts; string private constant DUPLICATE_ETHEREUM_ADDRESS = "Duplicate ethereum address"; string private constant DUPLICATE_CONTEXT_ID = "Duplicate context id"; string private constant ONLY_CONTEXT_OWNER = "Only context owner"; string private constant UNAUTHORIZED_NODE = "Unauthorized node"; string private constant CONTEXT_NOT_FOUND = "Context not found"; string private constant NODE_NOT_FOUND = "Node not found"; string private constant ALREADY_EXISTS = "Already exists"; string private constant BAD_SIGNATURE = "Bad signature"; string private constant NO_CONTEXT_ID = "No context id"; /// Events event ContextAdded(bytes32 indexed context, address indexed owner); event ContextOwnerAdded(bytes32 indexed context, address owner); event ContextOwnerRemoved(bytes32 indexed context, address owner); event NodeAddedToContext(bytes32 indexed context, address nodeAddress); event NodeRemovedFromContext(bytes32 indexed context, address nodeAddress); event AddressLinked(bytes32 context, bytes32 contextId, address ethAddress); event SponsorshipRequested(bytes32 indexed context, bytes32 indexed contextid); constructor() public { } /** * @notice Check whether the context has been added to the smart contract using `addContext`. * @param context The context. * @return has the context been added? */ function isContext(bytes32 context) public view returns(bool) { } /** * @notice Check whether `nodeAddress`'s signature is acceptable for the context. * @param context The context. * @param nodeAddress The node's address. * @return can `nodeAddress` sign requests for this context? */ function isNodeInContext(bytes32 context, address nodeAddress) public view returns(bool) { } /** * @dev get uid. * @param context The context. * @param cIds an array of contextIds. */ function getUid(bytes32 context, bytes32[] memory cIds) internal returns(uint256) { } /** * @notice Link `cIds[0]` to `msg.sender` under `context`. * @param context The context. * @param cIds an array of contextIds. * @param v signature's v. * @param r signature's r. * @param s signature's s. */ function register( bytes32 context, bytes32[] memory cIds, uint8 v, bytes32 r, bytes32 s) public { } /** * @notice Check that `ethAddress` is the mostly recently used address by a unique human in the context. * Also return any addresses previously used by this unique human. * @param ethAddress an Ethereum address. * @param context the context. * @return is `ethAddress` the most recently used address by a unique human in the `context`. * @return addresses previously used by this unique human. */ function isUniqueHuman( address ethAddress, bytes32 context) public view returns(bool, address[] memory) { } /** * @notice Submit a request to sponsor `contextid` under `context`. * @param context The context. * @param contextid The contextid. */ function sponsor(bytes32 context, bytes32 contextid) public onlyContextOwner(context) { } /** * @notice Add a context. * @param context The context. */ function addContext(bytes32 context) public { } /** * @notice Add a context owner. * @param context The context. * @param owner The address of the context owner to be added. */ function addContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Remove a context owner. * @param context The context. * @param owner The address of the context owner to be removed. */ function removeContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Check that `owner` is a owner of `context`. * @param context The context. * @param owner The new context's owner. */ function isContextOwner(bytes32 context, address owner) public view returns(bool) { } /** * @notice Add `nodeAddress` as a node to the context. * @param context The context. * @param nodeAddress The node's address. */ function addNodeToContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { require(isContext(context), CONTEXT_NOT_FOUND); require(<FILL_ME>) contexts[context].nodes[nodeAddress] = true; emit NodeAddedToContext(context, nodeAddress); } /** * @notice Remove `nodeAddress` from the context's nodes. * @param context The context. * @param nodeAddress The node's address. */ function removeNodeFromContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @dev Throws if called by any account other than the owner of the context. * @param context The context. */ modifier onlyContextOwner(bytes32 context) { } }
contexts[context].nodes[nodeAddress]!=true,ALREADY_EXISTS
10,042
contexts[context].nodes[nodeAddress]!=true
NODE_NOT_FOUND
pragma solidity ^0.6.3; contract BrightID { uint256 public id; struct Context { bool isActive; mapping(address => bool) owners; mapping(address => bool) nodes; mapping(uint256 => address[]) accounts; mapping(bytes32 => uint256) cIdToUid; mapping(address => uint256) ethToUid; } mapping(bytes32 => Context) private contexts; string private constant DUPLICATE_ETHEREUM_ADDRESS = "Duplicate ethereum address"; string private constant DUPLICATE_CONTEXT_ID = "Duplicate context id"; string private constant ONLY_CONTEXT_OWNER = "Only context owner"; string private constant UNAUTHORIZED_NODE = "Unauthorized node"; string private constant CONTEXT_NOT_FOUND = "Context not found"; string private constant NODE_NOT_FOUND = "Node not found"; string private constant ALREADY_EXISTS = "Already exists"; string private constant BAD_SIGNATURE = "Bad signature"; string private constant NO_CONTEXT_ID = "No context id"; /// Events event ContextAdded(bytes32 indexed context, address indexed owner); event ContextOwnerAdded(bytes32 indexed context, address owner); event ContextOwnerRemoved(bytes32 indexed context, address owner); event NodeAddedToContext(bytes32 indexed context, address nodeAddress); event NodeRemovedFromContext(bytes32 indexed context, address nodeAddress); event AddressLinked(bytes32 context, bytes32 contextId, address ethAddress); event SponsorshipRequested(bytes32 indexed context, bytes32 indexed contextid); constructor() public { } /** * @notice Check whether the context has been added to the smart contract using `addContext`. * @param context The context. * @return has the context been added? */ function isContext(bytes32 context) public view returns(bool) { } /** * @notice Check whether `nodeAddress`'s signature is acceptable for the context. * @param context The context. * @param nodeAddress The node's address. * @return can `nodeAddress` sign requests for this context? */ function isNodeInContext(bytes32 context, address nodeAddress) public view returns(bool) { } /** * @dev get uid. * @param context The context. * @param cIds an array of contextIds. */ function getUid(bytes32 context, bytes32[] memory cIds) internal returns(uint256) { } /** * @notice Link `cIds[0]` to `msg.sender` under `context`. * @param context The context. * @param cIds an array of contextIds. * @param v signature's v. * @param r signature's r. * @param s signature's s. */ function register( bytes32 context, bytes32[] memory cIds, uint8 v, bytes32 r, bytes32 s) public { } /** * @notice Check that `ethAddress` is the mostly recently used address by a unique human in the context. * Also return any addresses previously used by this unique human. * @param ethAddress an Ethereum address. * @param context the context. * @return is `ethAddress` the most recently used address by a unique human in the `context`. * @return addresses previously used by this unique human. */ function isUniqueHuman( address ethAddress, bytes32 context) public view returns(bool, address[] memory) { } /** * @notice Submit a request to sponsor `contextid` under `context`. * @param context The context. * @param contextid The contextid. */ function sponsor(bytes32 context, bytes32 contextid) public onlyContextOwner(context) { } /** * @notice Add a context. * @param context The context. */ function addContext(bytes32 context) public { } /** * @notice Add a context owner. * @param context The context. * @param owner The address of the context owner to be added. */ function addContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Remove a context owner. * @param context The context. * @param owner The address of the context owner to be removed. */ function removeContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Check that `owner` is a owner of `context`. * @param context The context. * @param owner The new context's owner. */ function isContextOwner(bytes32 context, address owner) public view returns(bool) { } /** * @notice Add `nodeAddress` as a node to the context. * @param context The context. * @param nodeAddress The node's address. */ function addNodeToContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @notice Remove `nodeAddress` from the context's nodes. * @param context The context. * @param nodeAddress The node's address. */ function removeNodeFromContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { require(isContext(context), CONTEXT_NOT_FOUND); require(<FILL_ME>) contexts[context].nodes[nodeAddress] = false; emit NodeRemovedFromContext(context, nodeAddress); } /** * @dev Throws if called by any account other than the owner of the context. * @param context The context. */ modifier onlyContextOwner(bytes32 context) { } }
contexts[context].nodes[nodeAddress]==true,NODE_NOT_FOUND
10,042
contexts[context].nodes[nodeAddress]==true
ONLY_CONTEXT_OWNER
pragma solidity ^0.6.3; contract BrightID { uint256 public id; struct Context { bool isActive; mapping(address => bool) owners; mapping(address => bool) nodes; mapping(uint256 => address[]) accounts; mapping(bytes32 => uint256) cIdToUid; mapping(address => uint256) ethToUid; } mapping(bytes32 => Context) private contexts; string private constant DUPLICATE_ETHEREUM_ADDRESS = "Duplicate ethereum address"; string private constant DUPLICATE_CONTEXT_ID = "Duplicate context id"; string private constant ONLY_CONTEXT_OWNER = "Only context owner"; string private constant UNAUTHORIZED_NODE = "Unauthorized node"; string private constant CONTEXT_NOT_FOUND = "Context not found"; string private constant NODE_NOT_FOUND = "Node not found"; string private constant ALREADY_EXISTS = "Already exists"; string private constant BAD_SIGNATURE = "Bad signature"; string private constant NO_CONTEXT_ID = "No context id"; /// Events event ContextAdded(bytes32 indexed context, address indexed owner); event ContextOwnerAdded(bytes32 indexed context, address owner); event ContextOwnerRemoved(bytes32 indexed context, address owner); event NodeAddedToContext(bytes32 indexed context, address nodeAddress); event NodeRemovedFromContext(bytes32 indexed context, address nodeAddress); event AddressLinked(bytes32 context, bytes32 contextId, address ethAddress); event SponsorshipRequested(bytes32 indexed context, bytes32 indexed contextid); constructor() public { } /** * @notice Check whether the context has been added to the smart contract using `addContext`. * @param context The context. * @return has the context been added? */ function isContext(bytes32 context) public view returns(bool) { } /** * @notice Check whether `nodeAddress`'s signature is acceptable for the context. * @param context The context. * @param nodeAddress The node's address. * @return can `nodeAddress` sign requests for this context? */ function isNodeInContext(bytes32 context, address nodeAddress) public view returns(bool) { } /** * @dev get uid. * @param context The context. * @param cIds an array of contextIds. */ function getUid(bytes32 context, bytes32[] memory cIds) internal returns(uint256) { } /** * @notice Link `cIds[0]` to `msg.sender` under `context`. * @param context The context. * @param cIds an array of contextIds. * @param v signature's v. * @param r signature's r. * @param s signature's s. */ function register( bytes32 context, bytes32[] memory cIds, uint8 v, bytes32 r, bytes32 s) public { } /** * @notice Check that `ethAddress` is the mostly recently used address by a unique human in the context. * Also return any addresses previously used by this unique human. * @param ethAddress an Ethereum address. * @param context the context. * @return is `ethAddress` the most recently used address by a unique human in the `context`. * @return addresses previously used by this unique human. */ function isUniqueHuman( address ethAddress, bytes32 context) public view returns(bool, address[] memory) { } /** * @notice Submit a request to sponsor `contextid` under `context`. * @param context The context. * @param contextid The contextid. */ function sponsor(bytes32 context, bytes32 contextid) public onlyContextOwner(context) { } /** * @notice Add a context. * @param context The context. */ function addContext(bytes32 context) public { } /** * @notice Add a context owner. * @param context The context. * @param owner The address of the context owner to be added. */ function addContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Remove a context owner. * @param context The context. * @param owner The address of the context owner to be removed. */ function removeContextOwner(bytes32 context, address owner) public onlyContextOwner(context) { } /** * @notice Check that `owner` is a owner of `context`. * @param context The context. * @param owner The new context's owner. */ function isContextOwner(bytes32 context, address owner) public view returns(bool) { } /** * @notice Add `nodeAddress` as a node to the context. * @param context The context. * @param nodeAddress The node's address. */ function addNodeToContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @notice Remove `nodeAddress` from the context's nodes. * @param context The context. * @param nodeAddress The node's address. */ function removeNodeFromContext(bytes32 context, address nodeAddress) public onlyContextOwner(context) { } /** * @dev Throws if called by any account other than the owner of the context. * @param context The context. */ modifier onlyContextOwner(bytes32 context) { require(<FILL_ME>) _; } }
contexts[context].owners[msg.sender],ONLY_CONTEXT_OWNER
10,042
contexts[context].owners[msg.sender]
"Disbursement Handler is closed"
/// @title Disbursement handler - Manages time locked disbursements of ERC20 tokens contract DisbursementHandler is DisbursementHandlerI, Ownable { using SafeMath for uint256; using SafeERC20 for ERC20; struct Disbursement { // Tokens cannot be withdrawn before this timestamp uint256 timestamp; // Amount of tokens to be disbursed uint256 value; } event Setup(address indexed _beneficiary, uint256 _timestamp, uint256 _value); event TokensWithdrawn(address indexed _to, uint256 _value); ERC20 public token; uint256 public totalAmount; mapping(address => Disbursement[]) public disbursements; bool public closed; modifier isOpen { require(<FILL_ME>) _; } modifier isClosed { } constructor(ERC20 _token) public { } /// @dev Called to create disbursements. /// @param _beneficiaries The addresses of the beneficiaries. /// @param _values The number of tokens to be locked for each disbursement. /// @param _timestamps Funds will be locked until this timestamp for each disbursement. function setupDisbursements( address[] _beneficiaries, uint256[] _values, uint256[] _timestamps ) external onlyOwner isOpen { } function close() external onlyOwner isOpen { } /// @dev Called by the sale contract to create a disbursement. /// @param _beneficiary The address of the beneficiary. /// @param _value Amount of tokens to be locked. /// @param _timestamp Funds will be locked until this timestamp. function setupDisbursement( address _beneficiary, uint256 _value, uint256 _timestamp ) internal { } /// @dev Transfers tokens to a beneficiary /// @param _beneficiary The address to transfer tokens to /// @param _index The index of the disbursement function withdraw(address _beneficiary, uint256 _index) external isClosed { } }
!closed,"Disbursement Handler is closed"
10,094
!closed
"Arrays not of equal length"
/// @title Disbursement handler - Manages time locked disbursements of ERC20 tokens contract DisbursementHandler is DisbursementHandlerI, Ownable { using SafeMath for uint256; using SafeERC20 for ERC20; struct Disbursement { // Tokens cannot be withdrawn before this timestamp uint256 timestamp; // Amount of tokens to be disbursed uint256 value; } event Setup(address indexed _beneficiary, uint256 _timestamp, uint256 _value); event TokensWithdrawn(address indexed _to, uint256 _value); ERC20 public token; uint256 public totalAmount; mapping(address => Disbursement[]) public disbursements; bool public closed; modifier isOpen { } modifier isClosed { } constructor(ERC20 _token) public { } /// @dev Called to create disbursements. /// @param _beneficiaries The addresses of the beneficiaries. /// @param _values The number of tokens to be locked for each disbursement. /// @param _timestamps Funds will be locked until this timestamp for each disbursement. function setupDisbursements( address[] _beneficiaries, uint256[] _values, uint256[] _timestamps ) external onlyOwner isOpen { require(<FILL_ME>) require(_beneficiaries.length > 0, "Arrays must have length > 0"); for (uint256 i = 0; i < _beneficiaries.length; i++) { setupDisbursement(_beneficiaries[i], _values[i], _timestamps[i]); } } function close() external onlyOwner isOpen { } /// @dev Called by the sale contract to create a disbursement. /// @param _beneficiary The address of the beneficiary. /// @param _value Amount of tokens to be locked. /// @param _timestamp Funds will be locked until this timestamp. function setupDisbursement( address _beneficiary, uint256 _value, uint256 _timestamp ) internal { } /// @dev Transfers tokens to a beneficiary /// @param _beneficiary The address to transfer tokens to /// @param _index The index of the disbursement function withdraw(address _beneficiary, uint256 _index) external isClosed { } }
(_beneficiaries.length==_values.length)&&(_beneficiaries.length==_timestamps.length),"Arrays not of equal length"
10,094
(_beneficiaries.length==_values.length)&&(_beneficiaries.length==_timestamps.length)
"don't own enough"
pragma solidity 0.8.7; //SPDX-License-Identifier: UNLICENSED contract StakeBulk is IERC721Receiver { IERC721 public nft_address; IERC20 public ft_address; uint256 public blocks_per_day = 6500; uint256 public rewards_per_day = 11 * 10**18; address admin; struct StakeData { uint256 accruedBlocks; uint256 stakingBlock; // time when the NFT was staked uint256 numStaked; } mapping(uint256 => address) NftIdToOwner; mapping(address => StakeData) NftOwnerToData; address[] stakers; uint256 totalStaked = 0; constructor(address nft, address ft, address ceo) { } function stake(uint256[] memory tokenIds) public { } function unstake(uint256[] memory tokenIds) public { require(<FILL_ME>) this.withdrawTokens(); for (uint256 index; index < tokenIds.length; index++) { if(NftIdToOwner[tokenIds[index]] == msg.sender){ nft_address.safeTransferFrom(address(this), msg.sender, tokenIds[index], ""); delete NftIdToOwner[tokenIds[index]]; totalStaked -= 1; NftOwnerToData[msg.sender].numStaked -= 1; } } } event withdrew(address indexed _from, uint _value); function withdrawTokens() public { } modifier onlyOwner() { } function getStakedData(address owner) public view returns(uint256, uint256, uint256) { } function getStakers() public view returns(address[] memory) { } function getTotalStaked() public view returns(uint256) { } function getOwnerOfNft(uint256 tokenId) public view returns(address) { } function withdraw(uint256 amount) public onlyOwner { } function updateReward(uint256 rewardAmount) public onlyOwner { } function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) override external returns (bytes4){ } }
NftOwnerToData[msg.sender].numStaked>0,"don't own enough"
10,296
NftOwnerToData[msg.sender].numStaked>0
null
pragma solidity 0.8.7; //SPDX-License-Identifier: UNLICENSED contract StakeBulk is IERC721Receiver { IERC721 public nft_address; IERC20 public ft_address; uint256 public blocks_per_day = 6500; uint256 public rewards_per_day = 11 * 10**18; address admin; struct StakeData { uint256 accruedBlocks; uint256 stakingBlock; // time when the NFT was staked uint256 numStaked; } mapping(uint256 => address) NftIdToOwner; mapping(address => StakeData) NftOwnerToData; address[] stakers; uint256 totalStaked = 0; constructor(address nft, address ft, address ceo) { } function stake(uint256[] memory tokenIds) public { } function unstake(uint256[] memory tokenIds) public { } event withdrew(address indexed _from, uint _value); function withdrawTokens() public { require(<FILL_ME>) uint256 earnedBlocks = ((block.number - NftOwnerToData[tx.origin].stakingBlock) * NftOwnerToData[tx.origin].numStaked) + NftOwnerToData[tx.origin].accruedBlocks; uint256 rewardAmount = (earnedBlocks * rewards_per_day) / blocks_per_day; require(ft_address.balanceOf(address(this)) >= rewardAmount, "contract doesn't own enough rewards"); emit withdrew(tx.origin, rewardAmount); ft_address.transfer(tx.origin, rewardAmount); NftOwnerToData[tx.origin].stakingBlock = block.number; NftOwnerToData[tx.origin].accruedBlocks = 0; } modifier onlyOwner() { } function getStakedData(address owner) public view returns(uint256, uint256, uint256) { } function getStakers() public view returns(address[] memory) { } function getTotalStaked() public view returns(uint256) { } function getOwnerOfNft(uint256 tokenId) public view returns(address) { } function withdraw(uint256 amount) public onlyOwner { } function updateReward(uint256 rewardAmount) public onlyOwner { } function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) override external returns (bytes4){ } }
NftOwnerToData[tx.origin].numStaked>0
10,296
NftOwnerToData[tx.origin].numStaked>0
"contract doesn't own enough rewards"
pragma solidity 0.8.7; //SPDX-License-Identifier: UNLICENSED contract StakeBulk is IERC721Receiver { IERC721 public nft_address; IERC20 public ft_address; uint256 public blocks_per_day = 6500; uint256 public rewards_per_day = 11 * 10**18; address admin; struct StakeData { uint256 accruedBlocks; uint256 stakingBlock; // time when the NFT was staked uint256 numStaked; } mapping(uint256 => address) NftIdToOwner; mapping(address => StakeData) NftOwnerToData; address[] stakers; uint256 totalStaked = 0; constructor(address nft, address ft, address ceo) { } function stake(uint256[] memory tokenIds) public { } function unstake(uint256[] memory tokenIds) public { } event withdrew(address indexed _from, uint _value); function withdrawTokens() public { require(NftOwnerToData[tx.origin].numStaked > 0); uint256 earnedBlocks = ((block.number - NftOwnerToData[tx.origin].stakingBlock) * NftOwnerToData[tx.origin].numStaked) + NftOwnerToData[tx.origin].accruedBlocks; uint256 rewardAmount = (earnedBlocks * rewards_per_day) / blocks_per_day; require(<FILL_ME>) emit withdrew(tx.origin, rewardAmount); ft_address.transfer(tx.origin, rewardAmount); NftOwnerToData[tx.origin].stakingBlock = block.number; NftOwnerToData[tx.origin].accruedBlocks = 0; } modifier onlyOwner() { } function getStakedData(address owner) public view returns(uint256, uint256, uint256) { } function getStakers() public view returns(address[] memory) { } function getTotalStaked() public view returns(uint256) { } function getOwnerOfNft(uint256 tokenId) public view returns(address) { } function withdraw(uint256 amount) public onlyOwner { } function updateReward(uint256 rewardAmount) public onlyOwner { } function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) override external returns (bytes4){ } }
ft_address.balanceOf(address(this))>=rewardAmount,"contract doesn't own enough rewards"
10,296
ft_address.balanceOf(address(this))>=rewardAmount
null
pragma solidity ^0.4.18; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { } function sub(uint a, uint b) internal pure returns (uint) { } function add(uint a, uint b) internal pure returns (uint) { } } /* * Token related contracts */ /* * ERC20Basic * Simpler version of ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public totalSupply; function balanceOf(address who) public view returns (uint); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { } } /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; address public newOwner; function Ownable() public { } modifier onlyOwner() { } modifier onlyNewOwner() { } /* // This code is dangerous because an error in the newOwner // means that this contract will be ownerless function transfer(address newOwner) public onlyOwner { require(newOwner != address(0)); owner = newOwner; } */ function proposeNewOwner(address _newOwner) external onlyOwner { } function acceptOwnership() external onlyNewOwner { } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) { } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyOwner canMint returns (bool) { } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = true; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } /* @title Pausable token * * @dev StandardToken modified with pausable transfers. **/ contract PausableToken is StandardToken, Pausable { function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) { } function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { } } /* * Actual token contract */ contract AcjToken is BurnableToken, MintableToken, PausableToken { using SafeMath for uint256; string public constant name = "Artist Connect Coin"; string public constant symbol = "ACJ"; uint public constant decimals = 18; function AcjToken() public { } function activate() external onlyOwner { } // This method will be used by the crowdsale smart contract // that owns the AcjToken and will distribute // the tokens to the contributors function initialTransfer(address _to, uint _value) external onlyOwner returns (bool) { } function burn(uint256 _amount) public onlyOwner { } } contract AcjCrowdsale is Ownable { using SafeMath for uint256; /* Bonuses */ // Presale bonus percentage uint public constant BONUS_PRESALE = 10; // Medium bonus percentage uint public constant BONUS_MID = 10; // High bonus percentage uint public constant BONUS_HI = 20; // Medium bonus threshold uint public constant BONUS_MID_QTY = 150 ether; // High bonus threshold uint public constant BONUS_HI_QTY = 335 ether; /* Absolute dates as timestamps */ uint public startPresale; uint public endPresale; uint public startIco; uint public endIco; // 30 days refund period on fail uint public constant REFUND_PERIOD = 30 days; /* Tokens **/ // Indicative token balances during the crowdsale mapping(address => uint256) public tokenBalances; // Token smart contract address address public token; // Total tokens created uint256 public tokensTotalSupply; // Tokens available for sale uint256 public tokensForSale; // Tokens sold via buyTokens uint256 public tokensSold; // Tokens created during the sale uint256 public tokensDistributed; // soft cap in ETH uint256 public tokensSoftCap; // ICO flat rate subject to bonuses uint256 public ethTokenRate; /* Management */ // Allow multiple administrators mapping(address => bool) public admins; /* Various */ // Total wei received uint256 public weiReceived; // Minimum contribution in ETH uint256 public weiMinContribution = 1 ether; // Contributions in wei for each address mapping(address => uint256) public contributions; // Refund state for each address mapping(address => bool) public refunds; /* Wallets */ // Company wallet that will receive the ETH address public companyWallet; /* Events */ // Yoohoo someone contributed ! event Contribute(address indexed _from, uint _amount); // Token <> ETH rate updated event TokenRateUpdated(uint _newRate); // ETH Refund event Refunded(address indexed _from, uint _amount); /* Modifiers */ modifier belowTotalSupply { } modifier belowHardCap { } modifier adminOnly { } modifier crowdsaleFailed { require(<FILL_ME>) _; } modifier crowdsaleSuccess { } modifier duringSale { } modifier afterSale { } modifier aboveMinimum { } /* Public methods */ /* * Constructor * Creating the new Token smart contract * and setting its owner to the current sender * */ function AcjCrowdsale( uint _presaleStart, uint _presaleEnd, uint _icoStart, uint _icoEnd, uint256 _rate, uint256 _cap, uint256 _goal, uint256 _totalSupply, address _token ) public { } /* * Fallback payable */ function () external payable { } /* Crowdsale staff only */ /* * Admin management */ function addAdmin(address _adr) external onlyOwner { } function removeAdmin(address _adr) external onlyOwner { } /* * Change the company wallet */ function updateCompanyWallet(address _wallet) external adminOnly { } /* * Change the owner of the token */ function proposeTokenOwner(address _newOwner) external adminOnly { } function acceptTokenOwnership() external onlyOwner { } /* * Activate the token */ function activateToken() external adminOnly crowdsaleSuccess afterSale { } /* * Adjust the token value before the ICO */ function adjustTokenExchangeRate(uint _rate) external adminOnly { } /* * Start therefund period * Each contributor has to claim own ETH */ function refundContribution() external crowdsaleFailed afterSale { } /* * After the refund period, remaining tokens * are transfered to the company wallet * Allow withdrawal at any time if the ICO is a success. */ function withdrawUnclaimed() external adminOnly { } /* * Pre-ICO and offline Investors, collaborators and team tokens */ function reserveTokens(address _beneficiary, uint256 _tokensQty) external adminOnly belowTotalSupply { } /* * Actually buy the tokens * requires an active sale time * and amount above the minimum contribution * and sold tokens inferior to tokens for sale */ function buyTokens(address _beneficiary) public payable duringSale aboveMinimum belowHardCap { } /* * Crowdsale Helpers */ function hasEnded() public view returns(bool) { } /* * Checks if the crowdsale is a success */ function isSuccess() public view returns(bool) { } /* * Checks if the crowdsale failed */ function isFailed() public view returns(bool) { } /* * Bonus calculations * Either time or ETH quantity based */ function getBonus(uint256 _wei) internal constant returns(uint256 ethToAcj) { } }
isFailed()
10,333
isFailed()
null
pragma solidity ^0.4.18; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { } function sub(uint a, uint b) internal pure returns (uint) { } function add(uint a, uint b) internal pure returns (uint) { } } /* * Token related contracts */ /* * ERC20Basic * Simpler version of ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public totalSupply; function balanceOf(address who) public view returns (uint); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { } } /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; address public newOwner; function Ownable() public { } modifier onlyOwner() { } modifier onlyNewOwner() { } /* // This code is dangerous because an error in the newOwner // means that this contract will be ownerless function transfer(address newOwner) public onlyOwner { require(newOwner != address(0)); owner = newOwner; } */ function proposeNewOwner(address _newOwner) external onlyOwner { } function acceptOwnership() external onlyNewOwner { } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) { } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyOwner canMint returns (bool) { } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = true; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } /* @title Pausable token * * @dev StandardToken modified with pausable transfers. **/ contract PausableToken is StandardToken, Pausable { function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) { } function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { } } /* * Actual token contract */ contract AcjToken is BurnableToken, MintableToken, PausableToken { using SafeMath for uint256; string public constant name = "Artist Connect Coin"; string public constant symbol = "ACJ"; uint public constant decimals = 18; function AcjToken() public { } function activate() external onlyOwner { } // This method will be used by the crowdsale smart contract // that owns the AcjToken and will distribute // the tokens to the contributors function initialTransfer(address _to, uint _value) external onlyOwner returns (bool) { } function burn(uint256 _amount) public onlyOwner { } } contract AcjCrowdsale is Ownable { using SafeMath for uint256; /* Bonuses */ // Presale bonus percentage uint public constant BONUS_PRESALE = 10; // Medium bonus percentage uint public constant BONUS_MID = 10; // High bonus percentage uint public constant BONUS_HI = 20; // Medium bonus threshold uint public constant BONUS_MID_QTY = 150 ether; // High bonus threshold uint public constant BONUS_HI_QTY = 335 ether; /* Absolute dates as timestamps */ uint public startPresale; uint public endPresale; uint public startIco; uint public endIco; // 30 days refund period on fail uint public constant REFUND_PERIOD = 30 days; /* Tokens **/ // Indicative token balances during the crowdsale mapping(address => uint256) public tokenBalances; // Token smart contract address address public token; // Total tokens created uint256 public tokensTotalSupply; // Tokens available for sale uint256 public tokensForSale; // Tokens sold via buyTokens uint256 public tokensSold; // Tokens created during the sale uint256 public tokensDistributed; // soft cap in ETH uint256 public tokensSoftCap; // ICO flat rate subject to bonuses uint256 public ethTokenRate; /* Management */ // Allow multiple administrators mapping(address => bool) public admins; /* Various */ // Total wei received uint256 public weiReceived; // Minimum contribution in ETH uint256 public weiMinContribution = 1 ether; // Contributions in wei for each address mapping(address => uint256) public contributions; // Refund state for each address mapping(address => bool) public refunds; /* Wallets */ // Company wallet that will receive the ETH address public companyWallet; /* Events */ // Yoohoo someone contributed ! event Contribute(address indexed _from, uint _amount); // Token <> ETH rate updated event TokenRateUpdated(uint _newRate); // ETH Refund event Refunded(address indexed _from, uint _amount); /* Modifiers */ modifier belowTotalSupply { } modifier belowHardCap { } modifier adminOnly { } modifier crowdsaleFailed { } modifier crowdsaleSuccess { require(<FILL_ME>) _; } modifier duringSale { } modifier afterSale { } modifier aboveMinimum { } /* Public methods */ /* * Constructor * Creating the new Token smart contract * and setting its owner to the current sender * */ function AcjCrowdsale( uint _presaleStart, uint _presaleEnd, uint _icoStart, uint _icoEnd, uint256 _rate, uint256 _cap, uint256 _goal, uint256 _totalSupply, address _token ) public { } /* * Fallback payable */ function () external payable { } /* Crowdsale staff only */ /* * Admin management */ function addAdmin(address _adr) external onlyOwner { } function removeAdmin(address _adr) external onlyOwner { } /* * Change the company wallet */ function updateCompanyWallet(address _wallet) external adminOnly { } /* * Change the owner of the token */ function proposeTokenOwner(address _newOwner) external adminOnly { } function acceptTokenOwnership() external onlyOwner { } /* * Activate the token */ function activateToken() external adminOnly crowdsaleSuccess afterSale { } /* * Adjust the token value before the ICO */ function adjustTokenExchangeRate(uint _rate) external adminOnly { } /* * Start therefund period * Each contributor has to claim own ETH */ function refundContribution() external crowdsaleFailed afterSale { } /* * After the refund period, remaining tokens * are transfered to the company wallet * Allow withdrawal at any time if the ICO is a success. */ function withdrawUnclaimed() external adminOnly { } /* * Pre-ICO and offline Investors, collaborators and team tokens */ function reserveTokens(address _beneficiary, uint256 _tokensQty) external adminOnly belowTotalSupply { } /* * Actually buy the tokens * requires an active sale time * and amount above the minimum contribution * and sold tokens inferior to tokens for sale */ function buyTokens(address _beneficiary) public payable duringSale aboveMinimum belowHardCap { } /* * Crowdsale Helpers */ function hasEnded() public view returns(bool) { } /* * Checks if the crowdsale is a success */ function isSuccess() public view returns(bool) { } /* * Checks if the crowdsale failed */ function isFailed() public view returns(bool) { } /* * Bonus calculations * Either time or ETH quantity based */ function getBonus(uint256 _wei) internal constant returns(uint256 ethToAcj) { } }
isSuccess()
10,333
isSuccess()
null
pragma solidity ^0.4.18; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { } function sub(uint a, uint b) internal pure returns (uint) { } function add(uint a, uint b) internal pure returns (uint) { } } /* * Token related contracts */ /* * ERC20Basic * Simpler version of ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public totalSupply; function balanceOf(address who) public view returns (uint); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { } } /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; address public newOwner; function Ownable() public { } modifier onlyOwner() { } modifier onlyNewOwner() { } /* // This code is dangerous because an error in the newOwner // means that this contract will be ownerless function transfer(address newOwner) public onlyOwner { require(newOwner != address(0)); owner = newOwner; } */ function proposeNewOwner(address _newOwner) external onlyOwner { } function acceptOwnership() external onlyNewOwner { } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) { } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyOwner canMint returns (bool) { } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = true; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } /* @title Pausable token * * @dev StandardToken modified with pausable transfers. **/ contract PausableToken is StandardToken, Pausable { function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) { } function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { } } /* * Actual token contract */ contract AcjToken is BurnableToken, MintableToken, PausableToken { using SafeMath for uint256; string public constant name = "Artist Connect Coin"; string public constant symbol = "ACJ"; uint public constant decimals = 18; function AcjToken() public { } function activate() external onlyOwner { } // This method will be used by the crowdsale smart contract // that owns the AcjToken and will distribute // the tokens to the contributors function initialTransfer(address _to, uint _value) external onlyOwner returns (bool) { } function burn(uint256 _amount) public onlyOwner { } } contract AcjCrowdsale is Ownable { using SafeMath for uint256; /* Bonuses */ // Presale bonus percentage uint public constant BONUS_PRESALE = 10; // Medium bonus percentage uint public constant BONUS_MID = 10; // High bonus percentage uint public constant BONUS_HI = 20; // Medium bonus threshold uint public constant BONUS_MID_QTY = 150 ether; // High bonus threshold uint public constant BONUS_HI_QTY = 335 ether; /* Absolute dates as timestamps */ uint public startPresale; uint public endPresale; uint public startIco; uint public endIco; // 30 days refund period on fail uint public constant REFUND_PERIOD = 30 days; /* Tokens **/ // Indicative token balances during the crowdsale mapping(address => uint256) public tokenBalances; // Token smart contract address address public token; // Total tokens created uint256 public tokensTotalSupply; // Tokens available for sale uint256 public tokensForSale; // Tokens sold via buyTokens uint256 public tokensSold; // Tokens created during the sale uint256 public tokensDistributed; // soft cap in ETH uint256 public tokensSoftCap; // ICO flat rate subject to bonuses uint256 public ethTokenRate; /* Management */ // Allow multiple administrators mapping(address => bool) public admins; /* Various */ // Total wei received uint256 public weiReceived; // Minimum contribution in ETH uint256 public weiMinContribution = 1 ether; // Contributions in wei for each address mapping(address => uint256) public contributions; // Refund state for each address mapping(address => bool) public refunds; /* Wallets */ // Company wallet that will receive the ETH address public companyWallet; /* Events */ // Yoohoo someone contributed ! event Contribute(address indexed _from, uint _amount); // Token <> ETH rate updated event TokenRateUpdated(uint _newRate); // ETH Refund event Refunded(address indexed _from, uint _amount); /* Modifiers */ modifier belowTotalSupply { } modifier belowHardCap { } modifier adminOnly { } modifier crowdsaleFailed { } modifier crowdsaleSuccess { } modifier duringSale { require(now < endIco); require(<FILL_ME>) _; } modifier afterSale { } modifier aboveMinimum { } /* Public methods */ /* * Constructor * Creating the new Token smart contract * and setting its owner to the current sender * */ function AcjCrowdsale( uint _presaleStart, uint _presaleEnd, uint _icoStart, uint _icoEnd, uint256 _rate, uint256 _cap, uint256 _goal, uint256 _totalSupply, address _token ) public { } /* * Fallback payable */ function () external payable { } /* Crowdsale staff only */ /* * Admin management */ function addAdmin(address _adr) external onlyOwner { } function removeAdmin(address _adr) external onlyOwner { } /* * Change the company wallet */ function updateCompanyWallet(address _wallet) external adminOnly { } /* * Change the owner of the token */ function proposeTokenOwner(address _newOwner) external adminOnly { } function acceptTokenOwnership() external onlyOwner { } /* * Activate the token */ function activateToken() external adminOnly crowdsaleSuccess afterSale { } /* * Adjust the token value before the ICO */ function adjustTokenExchangeRate(uint _rate) external adminOnly { } /* * Start therefund period * Each contributor has to claim own ETH */ function refundContribution() external crowdsaleFailed afterSale { } /* * After the refund period, remaining tokens * are transfered to the company wallet * Allow withdrawal at any time if the ICO is a success. */ function withdrawUnclaimed() external adminOnly { } /* * Pre-ICO and offline Investors, collaborators and team tokens */ function reserveTokens(address _beneficiary, uint256 _tokensQty) external adminOnly belowTotalSupply { } /* * Actually buy the tokens * requires an active sale time * and amount above the minimum contribution * and sold tokens inferior to tokens for sale */ function buyTokens(address _beneficiary) public payable duringSale aboveMinimum belowHardCap { } /* * Crowdsale Helpers */ function hasEnded() public view returns(bool) { } /* * Checks if the crowdsale is a success */ function isSuccess() public view returns(bool) { } /* * Checks if the crowdsale failed */ function isFailed() public view returns(bool) { } /* * Bonus calculations * Either time or ETH quantity based */ function getBonus(uint256 _wei) internal constant returns(uint256 ethToAcj) { } }
(now>startPresale&&now<endPresale)||now>startIco
10,333
(now>startPresale&&now<endPresale)||now>startIco
null
pragma solidity ^0.4.18; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { } function sub(uint a, uint b) internal pure returns (uint) { } function add(uint a, uint b) internal pure returns (uint) { } } /* * Token related contracts */ /* * ERC20Basic * Simpler version of ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public totalSupply; function balanceOf(address who) public view returns (uint); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { } } /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; address public newOwner; function Ownable() public { } modifier onlyOwner() { } modifier onlyNewOwner() { } /* // This code is dangerous because an error in the newOwner // means that this contract will be ownerless function transfer(address newOwner) public onlyOwner { require(newOwner != address(0)); owner = newOwner; } */ function proposeNewOwner(address _newOwner) external onlyOwner { } function acceptOwnership() external onlyNewOwner { } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) { } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyOwner canMint returns (bool) { } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = true; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } /* @title Pausable token * * @dev StandardToken modified with pausable transfers. **/ contract PausableToken is StandardToken, Pausable { function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) { } function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { } } /* * Actual token contract */ contract AcjToken is BurnableToken, MintableToken, PausableToken { using SafeMath for uint256; string public constant name = "Artist Connect Coin"; string public constant symbol = "ACJ"; uint public constant decimals = 18; function AcjToken() public { } function activate() external onlyOwner { } // This method will be used by the crowdsale smart contract // that owns the AcjToken and will distribute // the tokens to the contributors function initialTransfer(address _to, uint _value) external onlyOwner returns (bool) { } function burn(uint256 _amount) public onlyOwner { } } contract AcjCrowdsale is Ownable { using SafeMath for uint256; /* Bonuses */ // Presale bonus percentage uint public constant BONUS_PRESALE = 10; // Medium bonus percentage uint public constant BONUS_MID = 10; // High bonus percentage uint public constant BONUS_HI = 20; // Medium bonus threshold uint public constant BONUS_MID_QTY = 150 ether; // High bonus threshold uint public constant BONUS_HI_QTY = 335 ether; /* Absolute dates as timestamps */ uint public startPresale; uint public endPresale; uint public startIco; uint public endIco; // 30 days refund period on fail uint public constant REFUND_PERIOD = 30 days; /* Tokens **/ // Indicative token balances during the crowdsale mapping(address => uint256) public tokenBalances; // Token smart contract address address public token; // Total tokens created uint256 public tokensTotalSupply; // Tokens available for sale uint256 public tokensForSale; // Tokens sold via buyTokens uint256 public tokensSold; // Tokens created during the sale uint256 public tokensDistributed; // soft cap in ETH uint256 public tokensSoftCap; // ICO flat rate subject to bonuses uint256 public ethTokenRate; /* Management */ // Allow multiple administrators mapping(address => bool) public admins; /* Various */ // Total wei received uint256 public weiReceived; // Minimum contribution in ETH uint256 public weiMinContribution = 1 ether; // Contributions in wei for each address mapping(address => uint256) public contributions; // Refund state for each address mapping(address => bool) public refunds; /* Wallets */ // Company wallet that will receive the ETH address public companyWallet; /* Events */ // Yoohoo someone contributed ! event Contribute(address indexed _from, uint _amount); // Token <> ETH rate updated event TokenRateUpdated(uint _newRate); // ETH Refund event Refunded(address indexed _from, uint _amount); /* Modifiers */ modifier belowTotalSupply { } modifier belowHardCap { } modifier adminOnly { } modifier crowdsaleFailed { } modifier crowdsaleSuccess { } modifier duringSale { } modifier afterSale { } modifier aboveMinimum { } /* Public methods */ /* * Constructor * Creating the new Token smart contract * and setting its owner to the current sender * */ function AcjCrowdsale( uint _presaleStart, uint _presaleEnd, uint _icoStart, uint _icoEnd, uint256 _rate, uint256 _cap, uint256 _goal, uint256 _totalSupply, address _token ) public { } /* * Fallback payable */ function () external payable { } /* Crowdsale staff only */ /* * Admin management */ function addAdmin(address _adr) external onlyOwner { } function removeAdmin(address _adr) external onlyOwner { } /* * Change the company wallet */ function updateCompanyWallet(address _wallet) external adminOnly { } /* * Change the owner of the token */ function proposeTokenOwner(address _newOwner) external adminOnly { } function acceptTokenOwnership() external onlyOwner { } /* * Activate the token */ function activateToken() external adminOnly crowdsaleSuccess afterSale { } /* * Adjust the token value before the ICO */ function adjustTokenExchangeRate(uint _rate) external adminOnly { } /* * Start therefund period * Each contributor has to claim own ETH */ function refundContribution() external crowdsaleFailed afterSale { require(<FILL_ME>) require(contributions[msg.sender] > 0); uint256 _amount = contributions[msg.sender]; tokenBalances[msg.sender] = 0; refunds[msg.sender] = true; Refunded(msg.sender, contributions[msg.sender]); msg.sender.transfer(_amount); } /* * After the refund period, remaining tokens * are transfered to the company wallet * Allow withdrawal at any time if the ICO is a success. */ function withdrawUnclaimed() external adminOnly { } /* * Pre-ICO and offline Investors, collaborators and team tokens */ function reserveTokens(address _beneficiary, uint256 _tokensQty) external adminOnly belowTotalSupply { } /* * Actually buy the tokens * requires an active sale time * and amount above the minimum contribution * and sold tokens inferior to tokens for sale */ function buyTokens(address _beneficiary) public payable duringSale aboveMinimum belowHardCap { } /* * Crowdsale Helpers */ function hasEnded() public view returns(bool) { } /* * Checks if the crowdsale is a success */ function isSuccess() public view returns(bool) { } /* * Checks if the crowdsale failed */ function isFailed() public view returns(bool) { } /* * Bonus calculations * Either time or ETH quantity based */ function getBonus(uint256 _wei) internal constant returns(uint256 ethToAcj) { } }
!refunds[msg.sender]
10,333
!refunds[msg.sender]
null
pragma solidity ^0.4.18; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { } function sub(uint a, uint b) internal pure returns (uint) { } function add(uint a, uint b) internal pure returns (uint) { } } /* * Token related contracts */ /* * ERC20Basic * Simpler version of ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public totalSupply; function balanceOf(address who) public view returns (uint); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { } } /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; address public newOwner; function Ownable() public { } modifier onlyOwner() { } modifier onlyNewOwner() { } /* // This code is dangerous because an error in the newOwner // means that this contract will be ownerless function transfer(address newOwner) public onlyOwner { require(newOwner != address(0)); owner = newOwner; } */ function proposeNewOwner(address _newOwner) external onlyOwner { } function acceptOwnership() external onlyNewOwner { } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) { } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyOwner canMint returns (bool) { } } /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = true; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } /* @title Pausable token * * @dev StandardToken modified with pausable transfers. **/ contract PausableToken is StandardToken, Pausable { function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) { } function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) { } } /* * Actual token contract */ contract AcjToken is BurnableToken, MintableToken, PausableToken { using SafeMath for uint256; string public constant name = "Artist Connect Coin"; string public constant symbol = "ACJ"; uint public constant decimals = 18; function AcjToken() public { } function activate() external onlyOwner { } // This method will be used by the crowdsale smart contract // that owns the AcjToken and will distribute // the tokens to the contributors function initialTransfer(address _to, uint _value) external onlyOwner returns (bool) { } function burn(uint256 _amount) public onlyOwner { } } contract AcjCrowdsale is Ownable { using SafeMath for uint256; /* Bonuses */ // Presale bonus percentage uint public constant BONUS_PRESALE = 10; // Medium bonus percentage uint public constant BONUS_MID = 10; // High bonus percentage uint public constant BONUS_HI = 20; // Medium bonus threshold uint public constant BONUS_MID_QTY = 150 ether; // High bonus threshold uint public constant BONUS_HI_QTY = 335 ether; /* Absolute dates as timestamps */ uint public startPresale; uint public endPresale; uint public startIco; uint public endIco; // 30 days refund period on fail uint public constant REFUND_PERIOD = 30 days; /* Tokens **/ // Indicative token balances during the crowdsale mapping(address => uint256) public tokenBalances; // Token smart contract address address public token; // Total tokens created uint256 public tokensTotalSupply; // Tokens available for sale uint256 public tokensForSale; // Tokens sold via buyTokens uint256 public tokensSold; // Tokens created during the sale uint256 public tokensDistributed; // soft cap in ETH uint256 public tokensSoftCap; // ICO flat rate subject to bonuses uint256 public ethTokenRate; /* Management */ // Allow multiple administrators mapping(address => bool) public admins; /* Various */ // Total wei received uint256 public weiReceived; // Minimum contribution in ETH uint256 public weiMinContribution = 1 ether; // Contributions in wei for each address mapping(address => uint256) public contributions; // Refund state for each address mapping(address => bool) public refunds; /* Wallets */ // Company wallet that will receive the ETH address public companyWallet; /* Events */ // Yoohoo someone contributed ! event Contribute(address indexed _from, uint _amount); // Token <> ETH rate updated event TokenRateUpdated(uint _newRate); // ETH Refund event Refunded(address indexed _from, uint _amount); /* Modifiers */ modifier belowTotalSupply { } modifier belowHardCap { } modifier adminOnly { } modifier crowdsaleFailed { } modifier crowdsaleSuccess { } modifier duringSale { } modifier afterSale { } modifier aboveMinimum { } /* Public methods */ /* * Constructor * Creating the new Token smart contract * and setting its owner to the current sender * */ function AcjCrowdsale( uint _presaleStart, uint _presaleEnd, uint _icoStart, uint _icoEnd, uint256 _rate, uint256 _cap, uint256 _goal, uint256 _totalSupply, address _token ) public { } /* * Fallback payable */ function () external payable { } /* Crowdsale staff only */ /* * Admin management */ function addAdmin(address _adr) external onlyOwner { } function removeAdmin(address _adr) external onlyOwner { } /* * Change the company wallet */ function updateCompanyWallet(address _wallet) external adminOnly { } /* * Change the owner of the token */ function proposeTokenOwner(address _newOwner) external adminOnly { } function acceptTokenOwnership() external onlyOwner { } /* * Activate the token */ function activateToken() external adminOnly crowdsaleSuccess afterSale { } /* * Adjust the token value before the ICO */ function adjustTokenExchangeRate(uint _rate) external adminOnly { } /* * Start therefund period * Each contributor has to claim own ETH */ function refundContribution() external crowdsaleFailed afterSale { require(!refunds[msg.sender]); require(<FILL_ME>) uint256 _amount = contributions[msg.sender]; tokenBalances[msg.sender] = 0; refunds[msg.sender] = true; Refunded(msg.sender, contributions[msg.sender]); msg.sender.transfer(_amount); } /* * After the refund period, remaining tokens * are transfered to the company wallet * Allow withdrawal at any time if the ICO is a success. */ function withdrawUnclaimed() external adminOnly { } /* * Pre-ICO and offline Investors, collaborators and team tokens */ function reserveTokens(address _beneficiary, uint256 _tokensQty) external adminOnly belowTotalSupply { } /* * Actually buy the tokens * requires an active sale time * and amount above the minimum contribution * and sold tokens inferior to tokens for sale */ function buyTokens(address _beneficiary) public payable duringSale aboveMinimum belowHardCap { } /* * Crowdsale Helpers */ function hasEnded() public view returns(bool) { } /* * Checks if the crowdsale is a success */ function isSuccess() public view returns(bool) { } /* * Checks if the crowdsale failed */ function isFailed() public view returns(bool) { } /* * Bonus calculations * Either time or ETH quantity based */ function getBonus(uint256 _wei) internal constant returns(uint256 ethToAcj) { } }
contributions[msg.sender]>0
10,333
contributions[msg.sender]>0
"only 1 contract per address"
pragma solidity 0.5.1; contract GoForItToken is ERC20Burnable { uint constant TOTALTOKENSUPPLY = 12500000000 ether; string public name = "Goin Token"; string public symbol = "GOI"; uint8 public decimals = 18; mapping(address => address) public vestingContracts; event TokenVested(address beneficiary, address contractAddress, uint amount); /// @dev Constructor constructor(address[] memory beneficiaries, uint[] memory vestingInDays, uint[] memory amounts ) public { require(beneficiaries.length == vestingInDays.length && amounts.length == vestingInDays.length, "array length does not match"); for(uint i=0;i<beneficiaries.length;i++) { uint vestingDays = vestingInDays[i]; require(<FILL_ME>) if(vestingDays>0) { TokenVesting vestingContract =new TokenVesting(beneficiaries[i],now,vestingDays* 1 days,vestingInDays[i]* 1 days, false); _mint(address(vestingContract),amounts[i]); vestingContracts[beneficiaries[i]]=address(vestingContract); emit TokenVested(beneficiaries[i],address(vestingContract),amounts[i]); } else { _mint(beneficiaries[i],amounts[i]); } } require(totalSupply()== TOTALTOKENSUPPLY, "totalsupply does not match"); } function release() public { } }
vestingContracts[beneficiaries[i]]==address(0),"only 1 contract per address"
10,407
vestingContracts[beneficiaries[i]]==address(0)
"totalsupply does not match"
pragma solidity 0.5.1; contract GoForItToken is ERC20Burnable { uint constant TOTALTOKENSUPPLY = 12500000000 ether; string public name = "Goin Token"; string public symbol = "GOI"; uint8 public decimals = 18; mapping(address => address) public vestingContracts; event TokenVested(address beneficiary, address contractAddress, uint amount); /// @dev Constructor constructor(address[] memory beneficiaries, uint[] memory vestingInDays, uint[] memory amounts ) public { require(beneficiaries.length == vestingInDays.length && amounts.length == vestingInDays.length, "array length does not match"); for(uint i=0;i<beneficiaries.length;i++) { uint vestingDays = vestingInDays[i]; require(vestingContracts[beneficiaries[i]]== address(0), "only 1 contract per address"); if(vestingDays>0) { TokenVesting vestingContract =new TokenVesting(beneficiaries[i],now,vestingDays* 1 days,vestingInDays[i]* 1 days, false); _mint(address(vestingContract),amounts[i]); vestingContracts[beneficiaries[i]]=address(vestingContract); emit TokenVested(beneficiaries[i],address(vestingContract),amounts[i]); } else { _mint(beneficiaries[i],amounts[i]); } } require(<FILL_ME>) } function release() public { } }
totalSupply()==TOTALTOKENSUPPLY,"totalsupply does not match"
10,407
totalSupply()==TOTALTOKENSUPPLY
"no tokens vested"
pragma solidity 0.5.1; contract GoForItToken is ERC20Burnable { uint constant TOTALTOKENSUPPLY = 12500000000 ether; string public name = "Goin Token"; string public symbol = "GOI"; uint8 public decimals = 18; mapping(address => address) public vestingContracts; event TokenVested(address beneficiary, address contractAddress, uint amount); /// @dev Constructor constructor(address[] memory beneficiaries, uint[] memory vestingInDays, uint[] memory amounts ) public { } function release() public { require(<FILL_ME>) TokenVesting(vestingContracts[msg.sender]).release(IERC20(address(this))); } }
vestingContracts[msg.sender]!=address(0),"no tokens vested"
10,407
vestingContracts[msg.sender]!=address(0)
null
/** EMC United Co. Inc. */ pragma solidity 0.4.11; contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { } function safeSub(uint a, uint b) internal returns (uint) { } function safeAdd(uint a, uint b) internal returns (uint) { } // mitigate short address attack // thanks to https://github.com/numerai/contract/blob/c182465f82e50ced8dacb3977ec374a892f5fa8c/contracts/Safe.sol#L30-L34. // TODO: doublecheck implication of >= compared to == modifier onlyPayloadSize(uint numWords) { } } contract Token { // ERC20 standard function balanceOf(address _owner) constant returns (uint256 balance); function transfer(address _to, uint256 _value) returns (bool success); function transferFrom(address _from, address _to, uint256 _value) returns (bool success); function approve(address _spender, uint256 _value) returns (bool success); function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token, SafeMath { uint256 public totalSupply; // TODO: update tests to expect throw function transfer(address _to, uint256 _value) onlyPayloadSize(2) returns (bool success) { } // TODO: update tests to expect throw function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) returns (bool success) { } function balanceOf(address _owner) constant returns (uint256 balance) { } // To change the approve amount you first have to reduce the addresses' // allowance to zero by calling 'approve(_spender, 0)' if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 function approve(address _spender, uint256 _value) onlyPayloadSize(2) returns (bool success) { } function changeApproval(address _spender, uint256 _oldValue, uint256 _newValue) onlyPayloadSize(3) returns (bool success) { require(<FILL_ME>) allowed[msg.sender][_spender] = _newValue; Approval(msg.sender, _spender, _newValue); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; } /*------------------------------------ Eight Made Coin SYMBOL : EMC decimal : 8 issue amount : 9,500,000,000 --------------------------------------*/ contract EMC is StandardToken { /* Public variables of the token */ /* NOTE: The following variables are choice vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; // Token Name token issued uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18 string public symbol; // An identifier: eg SBX, XPR etc.. string public version = 'C1.0'; uint256 public unitsOneEthCanBuy; // How many units of your coin can be bought by 1 ETH? uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here. address public fundsWallet; // Where should the raised ETH go? // This is a constructor function // which means the following function name has to match the contract name declared above function EMC() { } function() payable{ } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { } }
allowed[msg.sender][_spender]==_oldValue
10,536
allowed[msg.sender][_spender]==_oldValue
"<minimum"
pragma solidity ^0.5.0; import "./Math.sol"; import "./Ownable.sol"; import "./SafeERC20.sol"; interface Executor { function execute(uint, uint, uint, uint) external; } contract KaniGovernance is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; function seize(IERC20 _token, uint amount) external { } bool public breaker = false; function setBreaker(bool _breaker) external { } mapping(address => uint) public voteLock; // period that your sake it locked to keep it for voting struct Proposal { uint id; address proposer; mapping(address => uint) forVotes; mapping(address => uint) againstVotes; uint totalForVotes; uint totalAgainstVotes; uint start; // block start; uint end; // start + period address executor; string hash; uint totalVotesAvailable; uint quorum; uint quorumRequired; bool open; } mapping (uint => Proposal) public proposals; uint public proposalCount; uint public period = 17280; // voting period in blocks ~ 17280 3 days for 15s/block uint public lock = 17280; // vote lock in blocks ~ 17280 3 days for 15s/block uint public minimum = 1e18; uint public quorum = 2000; bool public config = true; address public governance; function setGovernance(address _governance) public { } function setQuorum(uint _quorum) public { } function setMinimum(uint _minimum) public { } function setPeriod(uint _period) public { } function setLock(uint _lock) public { } function initialize(uint id) public { } event NewProposal(uint id, address creator, uint start, uint duration, address executor); event Vote(uint indexed id, address indexed voter, bool vote, uint weight); function propose(address executor, string memory hash) public { require(<FILL_ME>) proposals[proposalCount++] = Proposal({ id: proposalCount, proposer: msg.sender, totalForVotes: 0, totalAgainstVotes: 0, start: block.number, end: period.add(block.number), executor: executor, hash: hash, totalVotesAvailable: totalVotes, quorum: 0, quorumRequired: quorum, open: true }); emit NewProposal(proposalCount, msg.sender, block.number, period, executor); voteLock[msg.sender] = lock.add(block.number); } function execute(uint id) public { } function getStats(uint id) public view returns (uint _for, uint _against, uint _quorum) { } event ProposalFinished(uint indexed id, uint _for, uint _against, bool quorumReached); function tallyVotes(uint id) public { } function votesOf(address voter) public view returns (uint) { } uint public totalVotes; mapping(address => uint) public votes; event RegisterVoter(address voter, uint votes, uint totalVotes); event RevokeVoter(address voter, uint votes, uint totalVotes); function register() public { } function revoke() public { } mapping(address => bool) public voters; function voteFor(uint id) public { } function voteAgainst(uint id) public { } IERC20 public token = IERC20(0x790aCe920bAF3af2b773D4556A69490e077F6B4A); struct Player { uint256 stake; // 总质押总数 uint256 payout; // uint256 total_out; // 已经领取的分红 } mapping(address => Player) public plyr_; // (player => data) player data struct Global { uint256 total_stake; // 总质押总数 uint256 total_out; // 总分红金额 uint256 earnings_per_share; // 每股分红 } mapping(uint256 => Global) public global_; // (global => data) global data mapping (address => uint256) public deposittime; uint256 constant internal magnitude = 10**40; uint256 constant internal extraReward = 500000*1e18; uint256 internal rewarded = 0; uint256 internal dailyReward = extraReward.div(365); uint256 internal lastUpdateTime = 0; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); function make_profit(uint256 amount) public { } function make_profit_internal(uint256 amount) internal{ } function deposit(uint amount) external daily_reward { } function cal_out(address user) public view returns (uint256) { } function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) { } function claim() public daily_reward { } function withdraw(uint amount) public daily_reward { } modifier daily_reward(){ } function notifyRewardAmount() public onlyOwner { } }
votesOf(msg.sender)>minimum,"<minimum"
10,540
votesOf(msg.sender)>minimum
"!quorum"
pragma solidity ^0.5.0; import "./Math.sol"; import "./Ownable.sol"; import "./SafeERC20.sol"; interface Executor { function execute(uint, uint, uint, uint) external; } contract KaniGovernance is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; function seize(IERC20 _token, uint amount) external { } bool public breaker = false; function setBreaker(bool _breaker) external { } mapping(address => uint) public voteLock; // period that your sake it locked to keep it for voting struct Proposal { uint id; address proposer; mapping(address => uint) forVotes; mapping(address => uint) againstVotes; uint totalForVotes; uint totalAgainstVotes; uint start; // block start; uint end; // start + period address executor; string hash; uint totalVotesAvailable; uint quorum; uint quorumRequired; bool open; } mapping (uint => Proposal) public proposals; uint public proposalCount; uint public period = 17280; // voting period in blocks ~ 17280 3 days for 15s/block uint public lock = 17280; // vote lock in blocks ~ 17280 3 days for 15s/block uint public minimum = 1e18; uint public quorum = 2000; bool public config = true; address public governance; function setGovernance(address _governance) public { } function setQuorum(uint _quorum) public { } function setMinimum(uint _minimum) public { } function setPeriod(uint _period) public { } function setLock(uint _lock) public { } function initialize(uint id) public { } event NewProposal(uint id, address creator, uint start, uint duration, address executor); event Vote(uint indexed id, address indexed voter, bool vote, uint weight); function propose(address executor, string memory hash) public { } function execute(uint id) public { (uint _for, uint _against, uint _quorum) = getStats(id); require(<FILL_ME>) require(proposals[id].end < block.number , "!end"); if (proposals[id].open == true) { tallyVotes(id); } Executor(proposals[id].executor).execute(id, _for, _against, _quorum); } function getStats(uint id) public view returns (uint _for, uint _against, uint _quorum) { } event ProposalFinished(uint indexed id, uint _for, uint _against, bool quorumReached); function tallyVotes(uint id) public { } function votesOf(address voter) public view returns (uint) { } uint public totalVotes; mapping(address => uint) public votes; event RegisterVoter(address voter, uint votes, uint totalVotes); event RevokeVoter(address voter, uint votes, uint totalVotes); function register() public { } function revoke() public { } mapping(address => bool) public voters; function voteFor(uint id) public { } function voteAgainst(uint id) public { } IERC20 public token = IERC20(0x790aCe920bAF3af2b773D4556A69490e077F6B4A); struct Player { uint256 stake; // 总质押总数 uint256 payout; // uint256 total_out; // 已经领取的分红 } mapping(address => Player) public plyr_; // (player => data) player data struct Global { uint256 total_stake; // 总质押总数 uint256 total_out; // 总分红金额 uint256 earnings_per_share; // 每股分红 } mapping(uint256 => Global) public global_; // (global => data) global data mapping (address => uint256) public deposittime; uint256 constant internal magnitude = 10**40; uint256 constant internal extraReward = 500000*1e18; uint256 internal rewarded = 0; uint256 internal dailyReward = extraReward.div(365); uint256 internal lastUpdateTime = 0; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); function make_profit(uint256 amount) public { } function make_profit_internal(uint256 amount) internal{ } function deposit(uint amount) external daily_reward { } function cal_out(address user) public view returns (uint256) { } function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) { } function claim() public daily_reward { } function withdraw(uint amount) public daily_reward { } modifier daily_reward(){ } function notifyRewardAmount() public onlyOwner { } }
proposals[id].quorumRequired<_quorum,"!quorum"
10,540
proposals[id].quorumRequired<_quorum
"!end"
pragma solidity ^0.5.0; import "./Math.sol"; import "./Ownable.sol"; import "./SafeERC20.sol"; interface Executor { function execute(uint, uint, uint, uint) external; } contract KaniGovernance is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; function seize(IERC20 _token, uint amount) external { } bool public breaker = false; function setBreaker(bool _breaker) external { } mapping(address => uint) public voteLock; // period that your sake it locked to keep it for voting struct Proposal { uint id; address proposer; mapping(address => uint) forVotes; mapping(address => uint) againstVotes; uint totalForVotes; uint totalAgainstVotes; uint start; // block start; uint end; // start + period address executor; string hash; uint totalVotesAvailable; uint quorum; uint quorumRequired; bool open; } mapping (uint => Proposal) public proposals; uint public proposalCount; uint public period = 17280; // voting period in blocks ~ 17280 3 days for 15s/block uint public lock = 17280; // vote lock in blocks ~ 17280 3 days for 15s/block uint public minimum = 1e18; uint public quorum = 2000; bool public config = true; address public governance; function setGovernance(address _governance) public { } function setQuorum(uint _quorum) public { } function setMinimum(uint _minimum) public { } function setPeriod(uint _period) public { } function setLock(uint _lock) public { } function initialize(uint id) public { } event NewProposal(uint id, address creator, uint start, uint duration, address executor); event Vote(uint indexed id, address indexed voter, bool vote, uint weight); function propose(address executor, string memory hash) public { } function execute(uint id) public { (uint _for, uint _against, uint _quorum) = getStats(id); require(proposals[id].quorumRequired < _quorum, "!quorum"); require(<FILL_ME>) if (proposals[id].open == true) { tallyVotes(id); } Executor(proposals[id].executor).execute(id, _for, _against, _quorum); } function getStats(uint id) public view returns (uint _for, uint _against, uint _quorum) { } event ProposalFinished(uint indexed id, uint _for, uint _against, bool quorumReached); function tallyVotes(uint id) public { } function votesOf(address voter) public view returns (uint) { } uint public totalVotes; mapping(address => uint) public votes; event RegisterVoter(address voter, uint votes, uint totalVotes); event RevokeVoter(address voter, uint votes, uint totalVotes); function register() public { } function revoke() public { } mapping(address => bool) public voters; function voteFor(uint id) public { } function voteAgainst(uint id) public { } IERC20 public token = IERC20(0x790aCe920bAF3af2b773D4556A69490e077F6B4A); struct Player { uint256 stake; // 总质押总数 uint256 payout; // uint256 total_out; // 已经领取的分红 } mapping(address => Player) public plyr_; // (player => data) player data struct Global { uint256 total_stake; // 总质押总数 uint256 total_out; // 总分红金额 uint256 earnings_per_share; // 每股分红 } mapping(uint256 => Global) public global_; // (global => data) global data mapping (address => uint256) public deposittime; uint256 constant internal magnitude = 10**40; uint256 constant internal extraReward = 500000*1e18; uint256 internal rewarded = 0; uint256 internal dailyReward = extraReward.div(365); uint256 internal lastUpdateTime = 0; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); function make_profit(uint256 amount) public { } function make_profit_internal(uint256 amount) internal{ } function deposit(uint amount) external daily_reward { } function cal_out(address user) public view returns (uint256) { } function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) { } function claim() public daily_reward { } function withdraw(uint amount) public daily_reward { } modifier daily_reward(){ } function notifyRewardAmount() public onlyOwner { } }
proposals[id].end<block.number,"!end"
10,540
proposals[id].end<block.number
"!open"
pragma solidity ^0.5.0; import "./Math.sol"; import "./Ownable.sol"; import "./SafeERC20.sol"; interface Executor { function execute(uint, uint, uint, uint) external; } contract KaniGovernance is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; function seize(IERC20 _token, uint amount) external { } bool public breaker = false; function setBreaker(bool _breaker) external { } mapping(address => uint) public voteLock; // period that your sake it locked to keep it for voting struct Proposal { uint id; address proposer; mapping(address => uint) forVotes; mapping(address => uint) againstVotes; uint totalForVotes; uint totalAgainstVotes; uint start; // block start; uint end; // start + period address executor; string hash; uint totalVotesAvailable; uint quorum; uint quorumRequired; bool open; } mapping (uint => Proposal) public proposals; uint public proposalCount; uint public period = 17280; // voting period in blocks ~ 17280 3 days for 15s/block uint public lock = 17280; // vote lock in blocks ~ 17280 3 days for 15s/block uint public minimum = 1e18; uint public quorum = 2000; bool public config = true; address public governance; function setGovernance(address _governance) public { } function setQuorum(uint _quorum) public { } function setMinimum(uint _minimum) public { } function setPeriod(uint _period) public { } function setLock(uint _lock) public { } function initialize(uint id) public { } event NewProposal(uint id, address creator, uint start, uint duration, address executor); event Vote(uint indexed id, address indexed voter, bool vote, uint weight); function propose(address executor, string memory hash) public { } function execute(uint id) public { } function getStats(uint id) public view returns (uint _for, uint _against, uint _quorum) { } event ProposalFinished(uint indexed id, uint _for, uint _against, bool quorumReached); function tallyVotes(uint id) public { require(<FILL_ME>) require(proposals[id].end < block.number, "!end"); (uint _for, uint _against,) = getStats(id); bool _quorum = false; if (proposals[id].quorum >= proposals[id].quorumRequired) { _quorum = true; } proposals[id].open = false; emit ProposalFinished(id, _for, _against, _quorum); } function votesOf(address voter) public view returns (uint) { } uint public totalVotes; mapping(address => uint) public votes; event RegisterVoter(address voter, uint votes, uint totalVotes); event RevokeVoter(address voter, uint votes, uint totalVotes); function register() public { } function revoke() public { } mapping(address => bool) public voters; function voteFor(uint id) public { } function voteAgainst(uint id) public { } IERC20 public token = IERC20(0x790aCe920bAF3af2b773D4556A69490e077F6B4A); struct Player { uint256 stake; // 总质押总数 uint256 payout; // uint256 total_out; // 已经领取的分红 } mapping(address => Player) public plyr_; // (player => data) player data struct Global { uint256 total_stake; // 总质押总数 uint256 total_out; // 总分红金额 uint256 earnings_per_share; // 每股分红 } mapping(uint256 => Global) public global_; // (global => data) global data mapping (address => uint256) public deposittime; uint256 constant internal magnitude = 10**40; uint256 constant internal extraReward = 500000*1e18; uint256 internal rewarded = 0; uint256 internal dailyReward = extraReward.div(365); uint256 internal lastUpdateTime = 0; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); function make_profit(uint256 amount) public { } function make_profit_internal(uint256 amount) internal{ } function deposit(uint amount) external daily_reward { } function cal_out(address user) public view returns (uint256) { } function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) { } function claim() public daily_reward { } function withdraw(uint amount) public daily_reward { } modifier daily_reward(){ } function notifyRewardAmount() public onlyOwner { } }
proposals[id].open==true,"!open"
10,540
proposals[id].open==true
"voter"
pragma solidity ^0.5.0; import "./Math.sol"; import "./Ownable.sol"; import "./SafeERC20.sol"; interface Executor { function execute(uint, uint, uint, uint) external; } contract KaniGovernance is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; function seize(IERC20 _token, uint amount) external { } bool public breaker = false; function setBreaker(bool _breaker) external { } mapping(address => uint) public voteLock; // period that your sake it locked to keep it for voting struct Proposal { uint id; address proposer; mapping(address => uint) forVotes; mapping(address => uint) againstVotes; uint totalForVotes; uint totalAgainstVotes; uint start; // block start; uint end; // start + period address executor; string hash; uint totalVotesAvailable; uint quorum; uint quorumRequired; bool open; } mapping (uint => Proposal) public proposals; uint public proposalCount; uint public period = 17280; // voting period in blocks ~ 17280 3 days for 15s/block uint public lock = 17280; // vote lock in blocks ~ 17280 3 days for 15s/block uint public minimum = 1e18; uint public quorum = 2000; bool public config = true; address public governance; function setGovernance(address _governance) public { } function setQuorum(uint _quorum) public { } function setMinimum(uint _minimum) public { } function setPeriod(uint _period) public { } function setLock(uint _lock) public { } function initialize(uint id) public { } event NewProposal(uint id, address creator, uint start, uint duration, address executor); event Vote(uint indexed id, address indexed voter, bool vote, uint weight); function propose(address executor, string memory hash) public { } function execute(uint id) public { } function getStats(uint id) public view returns (uint _for, uint _against, uint _quorum) { } event ProposalFinished(uint indexed id, uint _for, uint _against, bool quorumReached); function tallyVotes(uint id) public { } function votesOf(address voter) public view returns (uint) { } uint public totalVotes; mapping(address => uint) public votes; event RegisterVoter(address voter, uint votes, uint totalVotes); event RevokeVoter(address voter, uint votes, uint totalVotes); function register() public { require(<FILL_ME>) voters[msg.sender] = true; votes[msg.sender] = plyr_[msg.sender].stake; totalVotes = totalVotes.add(votes[msg.sender]); emit RegisterVoter(msg.sender, votes[msg.sender], totalVotes); } function revoke() public { } mapping(address => bool) public voters; function voteFor(uint id) public { } function voteAgainst(uint id) public { } IERC20 public token = IERC20(0x790aCe920bAF3af2b773D4556A69490e077F6B4A); struct Player { uint256 stake; // 总质押总数 uint256 payout; // uint256 total_out; // 已经领取的分红 } mapping(address => Player) public plyr_; // (player => data) player data struct Global { uint256 total_stake; // 总质押总数 uint256 total_out; // 总分红金额 uint256 earnings_per_share; // 每股分红 } mapping(uint256 => Global) public global_; // (global => data) global data mapping (address => uint256) public deposittime; uint256 constant internal magnitude = 10**40; uint256 constant internal extraReward = 500000*1e18; uint256 internal rewarded = 0; uint256 internal dailyReward = extraReward.div(365); uint256 internal lastUpdateTime = 0; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); function make_profit(uint256 amount) public { } function make_profit_internal(uint256 amount) internal{ } function deposit(uint amount) external daily_reward { } function cal_out(address user) public view returns (uint256) { } function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) { } function claim() public daily_reward { } function withdraw(uint amount) public daily_reward { } modifier daily_reward(){ } function notifyRewardAmount() public onlyOwner { } }
voters[msg.sender]==false,"voter"
10,540
voters[msg.sender]==false
"!voter"
pragma solidity ^0.5.0; import "./Math.sol"; import "./Ownable.sol"; import "./SafeERC20.sol"; interface Executor { function execute(uint, uint, uint, uint) external; } contract KaniGovernance is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; function seize(IERC20 _token, uint amount) external { } bool public breaker = false; function setBreaker(bool _breaker) external { } mapping(address => uint) public voteLock; // period that your sake it locked to keep it for voting struct Proposal { uint id; address proposer; mapping(address => uint) forVotes; mapping(address => uint) againstVotes; uint totalForVotes; uint totalAgainstVotes; uint start; // block start; uint end; // start + period address executor; string hash; uint totalVotesAvailable; uint quorum; uint quorumRequired; bool open; } mapping (uint => Proposal) public proposals; uint public proposalCount; uint public period = 17280; // voting period in blocks ~ 17280 3 days for 15s/block uint public lock = 17280; // vote lock in blocks ~ 17280 3 days for 15s/block uint public minimum = 1e18; uint public quorum = 2000; bool public config = true; address public governance; function setGovernance(address _governance) public { } function setQuorum(uint _quorum) public { } function setMinimum(uint _minimum) public { } function setPeriod(uint _period) public { } function setLock(uint _lock) public { } function initialize(uint id) public { } event NewProposal(uint id, address creator, uint start, uint duration, address executor); event Vote(uint indexed id, address indexed voter, bool vote, uint weight); function propose(address executor, string memory hash) public { } function execute(uint id) public { } function getStats(uint id) public view returns (uint _for, uint _against, uint _quorum) { } event ProposalFinished(uint indexed id, uint _for, uint _against, bool quorumReached); function tallyVotes(uint id) public { } function votesOf(address voter) public view returns (uint) { } uint public totalVotes; mapping(address => uint) public votes; event RegisterVoter(address voter, uint votes, uint totalVotes); event RevokeVoter(address voter, uint votes, uint totalVotes); function register() public { } function revoke() public { require(<FILL_ME>) voters[msg.sender] = false; if (totalVotes < votes[msg.sender]) { //edge case, should be impossible, but this is defi totalVotes = 0; } else { totalVotes = totalVotes.sub(votes[msg.sender]); } emit RevokeVoter(msg.sender, votes[msg.sender], totalVotes); votes[msg.sender] = 0; } mapping(address => bool) public voters; function voteFor(uint id) public { } function voteAgainst(uint id) public { } IERC20 public token = IERC20(0x790aCe920bAF3af2b773D4556A69490e077F6B4A); struct Player { uint256 stake; // 总质押总数 uint256 payout; // uint256 total_out; // 已经领取的分红 } mapping(address => Player) public plyr_; // (player => data) player data struct Global { uint256 total_stake; // 总质押总数 uint256 total_out; // 总分红金额 uint256 earnings_per_share; // 每股分红 } mapping(uint256 => Global) public global_; // (global => data) global data mapping (address => uint256) public deposittime; uint256 constant internal magnitude = 10**40; uint256 constant internal extraReward = 500000*1e18; uint256 internal rewarded = 0; uint256 internal dailyReward = extraReward.div(365); uint256 internal lastUpdateTime = 0; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); function make_profit(uint256 amount) public { } function make_profit_internal(uint256 amount) internal{ } function deposit(uint amount) external daily_reward { } function cal_out(address user) public view returns (uint256) { } function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) { } function claim() public daily_reward { } function withdraw(uint amount) public daily_reward { } modifier daily_reward(){ } function notifyRewardAmount() public onlyOwner { } }
voters[msg.sender]==true,"!voter"
10,540
voters[msg.sender]==true
"<start"
pragma solidity ^0.5.0; import "./Math.sol"; import "./Ownable.sol"; import "./SafeERC20.sol"; interface Executor { function execute(uint, uint, uint, uint) external; } contract KaniGovernance is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; function seize(IERC20 _token, uint amount) external { } bool public breaker = false; function setBreaker(bool _breaker) external { } mapping(address => uint) public voteLock; // period that your sake it locked to keep it for voting struct Proposal { uint id; address proposer; mapping(address => uint) forVotes; mapping(address => uint) againstVotes; uint totalForVotes; uint totalAgainstVotes; uint start; // block start; uint end; // start + period address executor; string hash; uint totalVotesAvailable; uint quorum; uint quorumRequired; bool open; } mapping (uint => Proposal) public proposals; uint public proposalCount; uint public period = 17280; // voting period in blocks ~ 17280 3 days for 15s/block uint public lock = 17280; // vote lock in blocks ~ 17280 3 days for 15s/block uint public minimum = 1e18; uint public quorum = 2000; bool public config = true; address public governance; function setGovernance(address _governance) public { } function setQuorum(uint _quorum) public { } function setMinimum(uint _minimum) public { } function setPeriod(uint _period) public { } function setLock(uint _lock) public { } function initialize(uint id) public { } event NewProposal(uint id, address creator, uint start, uint duration, address executor); event Vote(uint indexed id, address indexed voter, bool vote, uint weight); function propose(address executor, string memory hash) public { } function execute(uint id) public { } function getStats(uint id) public view returns (uint _for, uint _against, uint _quorum) { } event ProposalFinished(uint indexed id, uint _for, uint _against, bool quorumReached); function tallyVotes(uint id) public { } function votesOf(address voter) public view returns (uint) { } uint public totalVotes; mapping(address => uint) public votes; event RegisterVoter(address voter, uint votes, uint totalVotes); event RevokeVoter(address voter, uint votes, uint totalVotes); function register() public { } function revoke() public { } mapping(address => bool) public voters; function voteFor(uint id) public { require(<FILL_ME>) require(proposals[id].end > block.number , ">end"); uint _against = proposals[id].againstVotes[msg.sender]; if (_against > 0) { proposals[id].totalAgainstVotes = proposals[id].totalAgainstVotes.sub(_against); proposals[id].againstVotes[msg.sender] = 0; } uint vote = votesOf(msg.sender).sub(proposals[id].forVotes[msg.sender]); proposals[id].totalForVotes = proposals[id].totalForVotes.add(vote); proposals[id].forVotes[msg.sender] = votesOf(msg.sender); proposals[id].totalVotesAvailable = totalVotes; uint _votes = proposals[id].totalForVotes.add(proposals[id].totalAgainstVotes); proposals[id].quorum = _votes.mul(10000).div(totalVotes); voteLock[msg.sender] = lock.add(block.number); emit Vote(id, msg.sender, true, vote); } function voteAgainst(uint id) public { } IERC20 public token = IERC20(0x790aCe920bAF3af2b773D4556A69490e077F6B4A); struct Player { uint256 stake; // 总质押总数 uint256 payout; // uint256 total_out; // 已经领取的分红 } mapping(address => Player) public plyr_; // (player => data) player data struct Global { uint256 total_stake; // 总质押总数 uint256 total_out; // 总分红金额 uint256 earnings_per_share; // 每股分红 } mapping(uint256 => Global) public global_; // (global => data) global data mapping (address => uint256) public deposittime; uint256 constant internal magnitude = 10**40; uint256 constant internal extraReward = 500000*1e18; uint256 internal rewarded = 0; uint256 internal dailyReward = extraReward.div(365); uint256 internal lastUpdateTime = 0; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); function make_profit(uint256 amount) public { } function make_profit_internal(uint256 amount) internal{ } function deposit(uint amount) external daily_reward { } function cal_out(address user) public view returns (uint256) { } function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) { } function claim() public daily_reward { } function withdraw(uint amount) public daily_reward { } modifier daily_reward(){ } function notifyRewardAmount() public onlyOwner { } }
proposals[id].start<block.number,"<start"
10,540
proposals[id].start<block.number
">end"
pragma solidity ^0.5.0; import "./Math.sol"; import "./Ownable.sol"; import "./SafeERC20.sol"; interface Executor { function execute(uint, uint, uint, uint) external; } contract KaniGovernance is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; function seize(IERC20 _token, uint amount) external { } bool public breaker = false; function setBreaker(bool _breaker) external { } mapping(address => uint) public voteLock; // period that your sake it locked to keep it for voting struct Proposal { uint id; address proposer; mapping(address => uint) forVotes; mapping(address => uint) againstVotes; uint totalForVotes; uint totalAgainstVotes; uint start; // block start; uint end; // start + period address executor; string hash; uint totalVotesAvailable; uint quorum; uint quorumRequired; bool open; } mapping (uint => Proposal) public proposals; uint public proposalCount; uint public period = 17280; // voting period in blocks ~ 17280 3 days for 15s/block uint public lock = 17280; // vote lock in blocks ~ 17280 3 days for 15s/block uint public minimum = 1e18; uint public quorum = 2000; bool public config = true; address public governance; function setGovernance(address _governance) public { } function setQuorum(uint _quorum) public { } function setMinimum(uint _minimum) public { } function setPeriod(uint _period) public { } function setLock(uint _lock) public { } function initialize(uint id) public { } event NewProposal(uint id, address creator, uint start, uint duration, address executor); event Vote(uint indexed id, address indexed voter, bool vote, uint weight); function propose(address executor, string memory hash) public { } function execute(uint id) public { } function getStats(uint id) public view returns (uint _for, uint _against, uint _quorum) { } event ProposalFinished(uint indexed id, uint _for, uint _against, bool quorumReached); function tallyVotes(uint id) public { } function votesOf(address voter) public view returns (uint) { } uint public totalVotes; mapping(address => uint) public votes; event RegisterVoter(address voter, uint votes, uint totalVotes); event RevokeVoter(address voter, uint votes, uint totalVotes); function register() public { } function revoke() public { } mapping(address => bool) public voters; function voteFor(uint id) public { require(proposals[id].start < block.number , "<start"); require(<FILL_ME>) uint _against = proposals[id].againstVotes[msg.sender]; if (_against > 0) { proposals[id].totalAgainstVotes = proposals[id].totalAgainstVotes.sub(_against); proposals[id].againstVotes[msg.sender] = 0; } uint vote = votesOf(msg.sender).sub(proposals[id].forVotes[msg.sender]); proposals[id].totalForVotes = proposals[id].totalForVotes.add(vote); proposals[id].forVotes[msg.sender] = votesOf(msg.sender); proposals[id].totalVotesAvailable = totalVotes; uint _votes = proposals[id].totalForVotes.add(proposals[id].totalAgainstVotes); proposals[id].quorum = _votes.mul(10000).div(totalVotes); voteLock[msg.sender] = lock.add(block.number); emit Vote(id, msg.sender, true, vote); } function voteAgainst(uint id) public { } IERC20 public token = IERC20(0x790aCe920bAF3af2b773D4556A69490e077F6B4A); struct Player { uint256 stake; // 总质押总数 uint256 payout; // uint256 total_out; // 已经领取的分红 } mapping(address => Player) public plyr_; // (player => data) player data struct Global { uint256 total_stake; // 总质押总数 uint256 total_out; // 总分红金额 uint256 earnings_per_share; // 每股分红 } mapping(uint256 => Global) public global_; // (global => data) global data mapping (address => uint256) public deposittime; uint256 constant internal magnitude = 10**40; uint256 constant internal extraReward = 500000*1e18; uint256 internal rewarded = 0; uint256 internal dailyReward = extraReward.div(365); uint256 internal lastUpdateTime = 0; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); function make_profit(uint256 amount) public { } function make_profit_internal(uint256 amount) internal{ } function deposit(uint amount) external daily_reward { } function cal_out(address user) public view returns (uint256) { } function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) { } function claim() public daily_reward { } function withdraw(uint amount) public daily_reward { } modifier daily_reward(){ } function notifyRewardAmount() public onlyOwner { } }
proposals[id].end>block.number,">end"
10,540
proposals[id].end>block.number
"invalid signature 's' value"
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. * * @dev Copy of the Zeppelin's library: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/b0cf6fbb7a70f31527f36579ad644e1cf12fdf4e/contracts/utils/cryptography/ECDSA.sol */ library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(<FILL_ME>) require(v == 27 || v == 28, "invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { } }
uint256(s)<=0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,"invalid signature 's' value"
10,554
uint256(s)<=0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0
null
contract Marketplace is Ownable { ERC721 public nft; mapping (uint256 => Listing) public listings; uint256 public minListingSeconds; uint256 public maxListingSeconds; struct Listing { address seller; uint256 startingPrice; uint256 minimumPrice; uint256 createdAt; uint256 durationSeconds; } event TokenListed(uint256 indexed _tokenId, uint256 _startingPrice, uint256 _minimumPrice, uint256 _durationSeconds, address _seller); event TokenUnlisted(uint256 indexed _tokenId, address _unlister); event TokenSold(uint256 indexed _tokenId, uint256 _price, uint256 _paidAmount, address indexed _seller, address _buyer); modifier nftOnly() { } function Marketplace(ERC721 _nft, uint256 _minListingSeconds, uint256 _maxListingSeconds) public { } function list(address _tokenSeller, uint256 _tokenId, uint256 _startingPrice, uint256 _minimumPrice, uint256 _durationSeconds) public nftOnly { require(_durationSeconds >= minListingSeconds && _durationSeconds <= maxListingSeconds); require(_startingPrice >= _minimumPrice); require(<FILL_ME>) listings[_tokenId] = Listing(_tokenSeller, _startingPrice, _minimumPrice, now, _durationSeconds); nft.takeOwnership(_tokenId); TokenListed(_tokenId, _startingPrice, _minimumPrice, _durationSeconds, _tokenSeller); } function unlist(address _caller, uint256 _tokenId) public nftOnly { } function purchase(address _caller, uint256 _tokenId, uint256 _totalPaid) public payable nftOnly { } function currentPrice(uint256 _tokenId) public view returns (uint256) { } function listingActive(uint256 _tokenId) internal view returns (bool) { } }
!listingActive(_tokenId)
10,571
!listingActive(_tokenId)
null
contract Marketplace is Ownable { ERC721 public nft; mapping (uint256 => Listing) public listings; uint256 public minListingSeconds; uint256 public maxListingSeconds; struct Listing { address seller; uint256 startingPrice; uint256 minimumPrice; uint256 createdAt; uint256 durationSeconds; } event TokenListed(uint256 indexed _tokenId, uint256 _startingPrice, uint256 _minimumPrice, uint256 _durationSeconds, address _seller); event TokenUnlisted(uint256 indexed _tokenId, address _unlister); event TokenSold(uint256 indexed _tokenId, uint256 _price, uint256 _paidAmount, address indexed _seller, address _buyer); modifier nftOnly() { } function Marketplace(ERC721 _nft, uint256 _minListingSeconds, uint256 _maxListingSeconds) public { } function list(address _tokenSeller, uint256 _tokenId, uint256 _startingPrice, uint256 _minimumPrice, uint256 _durationSeconds) public nftOnly { } function unlist(address _caller, uint256 _tokenId) public nftOnly { } function purchase(address _caller, uint256 _tokenId, uint256 _totalPaid) public payable nftOnly { Listing memory _listing = listings[_tokenId]; address _seller = _listing.seller; require(_caller != _seller); // Doesn't make sense for someone to buy/sell their own token. require(<FILL_ME>) uint256 _price = currentPrice(_tokenId); require(_totalPaid >= _price); delete listings[_tokenId]; nft.transfer(_caller, _tokenId); _seller.transfer(msg.value); TokenSold(_tokenId, _price, _totalPaid, _seller, _caller); } function currentPrice(uint256 _tokenId) public view returns (uint256) { } function listingActive(uint256 _tokenId) internal view returns (bool) { } }
listingActive(_tokenId)
10,571
listingActive(_tokenId)
null
pragma solidity ^0.4.11; contract SafeMath { function safeMul(uint256 a, uint256 b) internal constant returns (uint256 ) { } function safeDiv(uint256 a, uint256 b) internal constant returns (uint256 ) { } function safeSub(uint256 a, uint256 b) internal constant returns (uint256 ) { } function safeAdd(uint256 a, uint256 b) internal constant returns (uint256 ) { } } contract ERC20 { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) public constant returns (uint256 balance); /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) public returns (bool success); /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) public returns (bool success); /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) public constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is ERC20, SafeMath { mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; /// @dev Returns number of tokens owned by given address. /// @param _owner Address of token owner. function balanceOf(address _owner) public constant returns (uint256 balance) { } /// @dev Transfers sender's tokens to a given address. Returns success. /// @param _to Address of token receiver. /// @param _value Number of tokens to transfer. function transfer(address _to, uint256 _value) public returns (bool) { } /// @dev Allows allowed third party to transfer tokens from one address to another. Returns success. /// @param _from Address from where tokens are withdrawn. /// @param _to Address to where tokens are sent. /// @param _value Number of tokens to transfer. function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /// @dev Sets approved amount of tokens for spender. Returns success. /// @param _spender Address of allowed account. /// @param _value Number of approved tokens. function approve(address _spender, uint256 _value) public returns (bool) { } /// @dev Returns number of allowed tokens for given address. /// @param _owner Address of token owner. /// @param _spender Address of token spender. function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { } } contract MultiOwnable { mapping (address => bool) ownerMap; address[] public owners; event OwnerAdded(address indexed _newOwner); event OwnerRemoved(address indexed _oldOwner); modifier onlyOwner() { require(<FILL_ME>) _; } function MultiOwnable() { } function ownerCount() public constant returns (uint256) { } function isOwner(address owner) public constant returns (bool) { } function addOwner(address owner) onlyOwner public returns (bool) { } function removeOwner(address owner) onlyOwner public returns (bool) { } } contract TokenSpender { function receiveApproval(address _from, uint256 _value); } contract CommonBsToken is StandardToken, MultiOwnable { string public name; string public symbol; uint256 public totalSupply; uint8 public decimals = 18; string public version = 'v0.1'; address public creator; address public seller; // The main account that holds all tokens at the beginning. uint256 public saleLimit; // (e18) How many tokens can be sold in total through all tiers or tokensales. uint256 public tokensSold; // (e18) Number of tokens sold through all tiers or tokensales. uint256 public totalSales; // Total number of sale (including external sales) made through all tiers or tokensales. bool public locked; event Sell(address indexed _seller, address indexed _buyer, uint256 _value); event SellerChanged(address indexed _oldSeller, address indexed _newSeller); event Lock(); event Unlock(); event Burn(address indexed _burner, uint256 _value); modifier onlyUnlocked() { } function CommonBsToken( address _seller, string _name, string _symbol, uint256 _totalSupplyNoDecimals, uint256 _saleLimitNoDecimals ) MultiOwnable() { } function changeSeller(address newSeller) onlyOwner public returns (bool) { } function sellNoDecimals(address _to, uint256 _value) public returns (bool) { } function sell(address _to, uint256 _value) onlyOwner public returns (bool) { } function transfer(address _to, uint256 _value) onlyUnlocked public returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) onlyUnlocked public returns (bool) { } function lock() onlyOwner public { } function unlock() onlyOwner public { } function burn(uint256 _value) public returns (bool) { } /* Approve and then communicate the approved contract in a single tx */ function approveAndCall(address _spender, uint256 _value) public { } } contract XToken is CommonBsToken { function XToken() public CommonBsToken( 0xE3E9F66E5Ebe9E961662da34FF9aEA95c6795fd0, // TODO address _seller (main holder of all tokens) 'X full', 'X short', 100 * 1e6, // Max token supply. 40 * 1e6 // Sale limit - max tokens that can be sold through all tiers of tokensale. ) { } }
isOwner(msg.sender)
10,667
isOwner(msg.sender)
null
pragma solidity ^0.4.11; contract SafeMath { function safeMul(uint256 a, uint256 b) internal constant returns (uint256 ) { } function safeDiv(uint256 a, uint256 b) internal constant returns (uint256 ) { } function safeSub(uint256 a, uint256 b) internal constant returns (uint256 ) { } function safeAdd(uint256 a, uint256 b) internal constant returns (uint256 ) { } } contract ERC20 { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: uint256 public totalSupply; This automatically creates a getter function for the totalSupply. This is moved to the base contract since public getter functions are not currently recognised as an implementation of the matching abstract function by the compiler. */ /// total amount of tokens uint256 public totalSupply; /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) public constant returns (uint256 balance); /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) public returns (bool success); /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) public returns (bool success); /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) public constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is ERC20, SafeMath { mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; /// @dev Returns number of tokens owned by given address. /// @param _owner Address of token owner. function balanceOf(address _owner) public constant returns (uint256 balance) { } /// @dev Transfers sender's tokens to a given address. Returns success. /// @param _to Address of token receiver. /// @param _value Number of tokens to transfer. function transfer(address _to, uint256 _value) public returns (bool) { } /// @dev Allows allowed third party to transfer tokens from one address to another. Returns success. /// @param _from Address from where tokens are withdrawn. /// @param _to Address to where tokens are sent. /// @param _value Number of tokens to transfer. function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /// @dev Sets approved amount of tokens for spender. Returns success. /// @param _spender Address of allowed account. /// @param _value Number of approved tokens. function approve(address _spender, uint256 _value) public returns (bool) { } /// @dev Returns number of allowed tokens for given address. /// @param _owner Address of token owner. /// @param _spender Address of token spender. function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { } } contract MultiOwnable { mapping (address => bool) ownerMap; address[] public owners; event OwnerAdded(address indexed _newOwner); event OwnerRemoved(address indexed _oldOwner); modifier onlyOwner() { } function MultiOwnable() { } function ownerCount() public constant returns (uint256) { } function isOwner(address owner) public constant returns (bool) { } function addOwner(address owner) onlyOwner public returns (bool) { } function removeOwner(address owner) onlyOwner public returns (bool) { } } contract TokenSpender { function receiveApproval(address _from, uint256 _value); } contract CommonBsToken is StandardToken, MultiOwnable { string public name; string public symbol; uint256 public totalSupply; uint8 public decimals = 18; string public version = 'v0.1'; address public creator; address public seller; // The main account that holds all tokens at the beginning. uint256 public saleLimit; // (e18) How many tokens can be sold in total through all tiers or tokensales. uint256 public tokensSold; // (e18) Number of tokens sold through all tiers or tokensales. uint256 public totalSales; // Total number of sale (including external sales) made through all tiers or tokensales. bool public locked; event Sell(address indexed _seller, address indexed _buyer, uint256 _value); event SellerChanged(address indexed _oldSeller, address indexed _newSeller); event Lock(); event Unlock(); event Burn(address indexed _burner, uint256 _value); modifier onlyUnlocked() { } function CommonBsToken( address _seller, string _name, string _symbol, uint256 _totalSupplyNoDecimals, uint256 _saleLimitNoDecimals ) MultiOwnable() { } function changeSeller(address newSeller) onlyOwner public returns (bool) { } function sellNoDecimals(address _to, uint256 _value) public returns (bool) { } function sell(address _to, uint256 _value) onlyOwner public returns (bool) { // Check that we are not out of limit and still can sell tokens: if (saleLimit > 0) require(<FILL_ME>) require(_to != address(0)); require(_value > 0); require(_value <= balances[seller]); balances[seller] = safeSub(balances[seller], _value); balances[_to] = safeAdd(balances[_to], _value); Transfer(seller, _to, _value); tokensSold = safeAdd(tokensSold, _value); totalSales = safeAdd(totalSales, 1); Sell(seller, _to, _value); return true; } function transfer(address _to, uint256 _value) onlyUnlocked public returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) onlyUnlocked public returns (bool) { } function lock() onlyOwner public { } function unlock() onlyOwner public { } function burn(uint256 _value) public returns (bool) { } /* Approve and then communicate the approved contract in a single tx */ function approveAndCall(address _spender, uint256 _value) public { } } contract XToken is CommonBsToken { function XToken() public CommonBsToken( 0xE3E9F66E5Ebe9E961662da34FF9aEA95c6795fd0, // TODO address _seller (main holder of all tokens) 'X full', 'X short', 100 * 1e6, // Max token supply. 40 * 1e6 // Sale limit - max tokens that can be sold through all tiers of tokensale. ) { } }
safeSub(saleLimit,safeAdd(tokensSold,_value))>=0
10,667
safeSub(saleLimit,safeAdd(tokensSold,_value))>=0
'User amount above limit'
pragma solidity 0.8.1; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the token name. */ function name() external view returns (string memory); /** * @dev Returns the erc token owner. */ function getOwner() external view returns (address); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address _owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { } } contract MBTPool is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; // The address of the smart chef factory address public SMART_CHEF_FACTORY; // Platform fee wallet address public feeAddress; // Whether a limit is set for users bool public hasUserLimit; // Whether it is initialized bool public isInitialized; // Accrued token per share uint256 public accTokenPerShare; // The block number when BNNF mining ends. uint256 public bonusEndBlock; // The block number when BNNF mining starts. uint256 public startBlock; // The block number of the last pool update uint256 public lastRewardBlock; // The pool limit (0 if none) uint256 public poolLimitPerUser; // BNNF tokens created per block. uint256 public rewardPerBlock; // The precision factor uint256 public PRECISION_FACTOR; uint256 public lockStakeDate; uint256 public lockWithdrawDate; // The reward array mapping(uint256 => uint256) public rewardPerMonth; uint256 constant blocksPerMonth = 199380; // The reward token IERC20 public rewardToken; // The staked token IERC20 public stakedToken; // Info of each user that stakes tokens (stakedToken) mapping(address => UserInfo) public userInfo; struct UserInfo { uint256 amount; // How many staked tokens the user has provided uint256 rewardDebt; // Reward debt uint256 withdrawDate; // withdrawDate } event AdminTokenRecovery(address tokenRecovered, uint256 amount); event Deposit(address indexed user, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 amount); event NewStartAndEndBlocks(uint256 startBlock, uint256 endBlock); event NewRewardPerBlock(uint256 rewardPerBlock); event NewPoolLimit(uint256 poolLimitPerUser); event RewardsStop(uint256 blockNumber); event Withdraw(address indexed user, uint256 amount); event Initialize(IERC20 _stakedToken, IERC20 _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, address _admin, uint256 _lockStakeDate, uint256 _lockWithdrawDate, address _feeAddress); event StopReward(); constructor() { } /* * @notice Initialize the contract * @param _stakedToken: staked token address * @param _rewardToken: reward token address * @param _rewardPerBlock: reward per block (in rewardToken) * @param _startBlock: start block * @param _bonusEndBlock: end block * @param _poolLimitPerUser: pool limit per user in stakedToken (if any, else 0) * @param _admin: admin address with ownership */ function initialize( IERC20 _stakedToken, IERC20 _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, address _admin, uint256 _lockStakeDate, uint256 _lockWithdrawDate, address _feeAddress ) external { } /* * @notice Deposit staked tokens and collect reward tokens (if any) * @param _amount: amount to withdraw (in rewardToken) */ function deposit(uint256 _amount) external nonReentrant { UserInfo storage user = userInfo[msg.sender]; if (hasUserLimit) { require(<FILL_ME>) } if (lockStakeDate != 0 && _amount > 0) { require(block.timestamp < lockStakeDate, 'BANANA: stake locked'); } _updatePool(); if (user.amount > 0) { uint256 pending = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardDebt); if (pending > 0) { uint256 fee = pending * 3 / 1000; rewardToken.safeTransfer(address(msg.sender), pending - fee); rewardToken.safeTransfer(address(feeAddress), fee); } } if (_amount > 0) { user.amount = user.amount.add(_amount); stakedToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.withdrawDate = block.timestamp; } user.rewardDebt = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR); emit Deposit(msg.sender, _amount); } /* * @notice Withdraw staked tokens and collect reward tokens * @param _amount: amount to withdraw (in rewardToken) */ function withdraw(uint256 _amount) external nonReentrant { } /* * @notice Withdraw staked tokens without caring about rewards rewards * @dev Needs to be for emergency. */ function emergencyWithdraw() external nonReentrant { } /* * @notice Stop rewards * @dev Only callable by owner. Needs to be for emergency. */ function emergencyRewardWithdraw(uint256 _amount) external onlyOwner { } /** * @notice It allows the admin to recover wrong tokens sent to the contract * @param _tokenAddress: the address of the token to withdraw * @param _tokenAmount: the number of tokens to withdraw * @dev This function is only callable by admin. */ function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner { } /* * @notice Stop rewards * @dev Only callable by owner */ function stopReward() external onlyOwner { } /* * @notice Update pool limit per user * @dev Only callable by owner. * @param _hasUserLimit: whether the limit remains forced * @param _poolLimitPerUser: new pool limit per user */ function updatePoolLimitPerUser(bool _hasUserLimit, uint256 _poolLimitPerUser) external onlyOwner { } /* * @notice Update reward per block * @dev Only callable by owner. * @param _rewardPerBlock: the reward per block */ function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner { } /** * @notice It allows the admin to update start and end blocks * @dev This function is only callable by owner. * @param _startBlock: the new start block * @param _bonusEndBlock: the new end block */ function updateStartAndEndBlocks(uint256 _startBlock, uint256 _bonusEndBlock) external onlyOwner { } /* * @notice View function to see pending reward on frontend. * @param _user: user address * @return Pending reward for a given user */ function pendingReward(address _user) external view returns (uint256) { } /* * @notice Update reward variables of the given pool to be up-to-date. */ function _updatePool() internal { } function getLockStakeDate() external view returns (uint256) { } function getLockWithdrawDate() external view returns (uint256) { } /* * @notice View function to get bnn reward on frontend. * @param _from: from address * @param _to: to address * @return bnn reward */ function _getRewardBNN(uint256 _from, uint256 _to) internal view returns (uint256) { } }
_amount.add(user.amount)<=poolLimitPerUser,'User amount above limit'
10,677
_amount.add(user.amount)<=poolLimitPerUser
'BANANA: Withdraw was locked'
pragma solidity 0.8.1; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the token name. */ function name() external view returns (string memory); /** * @dev Returns the erc token owner. */ function getOwner() external view returns (address); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address _owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { } } contract MBTPool is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; // The address of the smart chef factory address public SMART_CHEF_FACTORY; // Platform fee wallet address public feeAddress; // Whether a limit is set for users bool public hasUserLimit; // Whether it is initialized bool public isInitialized; // Accrued token per share uint256 public accTokenPerShare; // The block number when BNNF mining ends. uint256 public bonusEndBlock; // The block number when BNNF mining starts. uint256 public startBlock; // The block number of the last pool update uint256 public lastRewardBlock; // The pool limit (0 if none) uint256 public poolLimitPerUser; // BNNF tokens created per block. uint256 public rewardPerBlock; // The precision factor uint256 public PRECISION_FACTOR; uint256 public lockStakeDate; uint256 public lockWithdrawDate; // The reward array mapping(uint256 => uint256) public rewardPerMonth; uint256 constant blocksPerMonth = 199380; // The reward token IERC20 public rewardToken; // The staked token IERC20 public stakedToken; // Info of each user that stakes tokens (stakedToken) mapping(address => UserInfo) public userInfo; struct UserInfo { uint256 amount; // How many staked tokens the user has provided uint256 rewardDebt; // Reward debt uint256 withdrawDate; // withdrawDate } event AdminTokenRecovery(address tokenRecovered, uint256 amount); event Deposit(address indexed user, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 amount); event NewStartAndEndBlocks(uint256 startBlock, uint256 endBlock); event NewRewardPerBlock(uint256 rewardPerBlock); event NewPoolLimit(uint256 poolLimitPerUser); event RewardsStop(uint256 blockNumber); event Withdraw(address indexed user, uint256 amount); event Initialize(IERC20 _stakedToken, IERC20 _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, address _admin, uint256 _lockStakeDate, uint256 _lockWithdrawDate, address _feeAddress); event StopReward(); constructor() { } /* * @notice Initialize the contract * @param _stakedToken: staked token address * @param _rewardToken: reward token address * @param _rewardPerBlock: reward per block (in rewardToken) * @param _startBlock: start block * @param _bonusEndBlock: end block * @param _poolLimitPerUser: pool limit per user in stakedToken (if any, else 0) * @param _admin: admin address with ownership */ function initialize( IERC20 _stakedToken, IERC20 _rewardToken, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _bonusEndBlock, uint256 _poolLimitPerUser, address _admin, uint256 _lockStakeDate, uint256 _lockWithdrawDate, address _feeAddress ) external { } /* * @notice Deposit staked tokens and collect reward tokens (if any) * @param _amount: amount to withdraw (in rewardToken) */ function deposit(uint256 _amount) external nonReentrant { } /* * @notice Withdraw staked tokens and collect reward tokens * @param _amount: amount to withdraw (in rewardToken) */ function withdraw(uint256 _amount) external nonReentrant { UserInfo storage user = userInfo[msg.sender]; require(user.amount >= _amount, 'Amount to withdraw too high'); require(<FILL_ME>) _updatePool(); uint256 pending = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardDebt); if (_amount > 0) { user.amount = user.amount.sub(_amount); stakedToken.safeTransfer(address(msg.sender), _amount); } if (pending > 0) { uint256 fee = pending * 3 / 1000; rewardToken.safeTransfer(address(msg.sender), pending - fee); rewardToken.safeTransfer(address(feeAddress), fee); } user.rewardDebt = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR); emit Withdraw(msg.sender, _amount); } /* * @notice Withdraw staked tokens without caring about rewards rewards * @dev Needs to be for emergency. */ function emergencyWithdraw() external nonReentrant { } /* * @notice Stop rewards * @dev Only callable by owner. Needs to be for emergency. */ function emergencyRewardWithdraw(uint256 _amount) external onlyOwner { } /** * @notice It allows the admin to recover wrong tokens sent to the contract * @param _tokenAddress: the address of the token to withdraw * @param _tokenAmount: the number of tokens to withdraw * @dev This function is only callable by admin. */ function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner { } /* * @notice Stop rewards * @dev Only callable by owner */ function stopReward() external onlyOwner { } /* * @notice Update pool limit per user * @dev Only callable by owner. * @param _hasUserLimit: whether the limit remains forced * @param _poolLimitPerUser: new pool limit per user */ function updatePoolLimitPerUser(bool _hasUserLimit, uint256 _poolLimitPerUser) external onlyOwner { } /* * @notice Update reward per block * @dev Only callable by owner. * @param _rewardPerBlock: the reward per block */ function updateRewardPerBlock(uint256 _rewardPerBlock) external onlyOwner { } /** * @notice It allows the admin to update start and end blocks * @dev This function is only callable by owner. * @param _startBlock: the new start block * @param _bonusEndBlock: the new end block */ function updateStartAndEndBlocks(uint256 _startBlock, uint256 _bonusEndBlock) external onlyOwner { } /* * @notice View function to see pending reward on frontend. * @param _user: user address * @return Pending reward for a given user */ function pendingReward(address _user) external view returns (uint256) { } /* * @notice Update reward variables of the given pool to be up-to-date. */ function _updatePool() internal { } function getLockStakeDate() external view returns (uint256) { } function getLockWithdrawDate() external view returns (uint256) { } /* * @notice View function to get bnn reward on frontend. * @param _from: from address * @param _to: to address * @return bnn reward */ function _getRewardBNN(uint256 _from, uint256 _to) internal view returns (uint256) { } }
user.withdrawDate+lockWithdrawDate>=block.timestamp,'BANANA: Withdraw was locked'
10,677
user.withdrawDate+lockWithdrawDate>=block.timestamp
null
pragma solidity ^0.4.21; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) constant external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface XPAAssetToken { function create(address user_, uint256 amount_) external returns(bool success); function burn(uint256 amount_) external returns(bool success); function burnFrom(address user_, uint256 amount_) external returns(bool success); function getDefaultExchangeRate() external returns(uint256); function getSymbol() external returns(bytes32); } interface Baliv { function getPrice(address fromToken_, address toToken_) external view returns(uint256); } interface FundAccount { function burn(address Token_, uint256 Amount_) external view returns(bool); } interface TokenFactory { function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address); function getPrice(address token_) external view returns(uint256); function getAssetLength() external view returns(uint256); function getAssetToken(uint256 index_) external view returns(address); } contract SafeMath { function safeAdd(uint x, uint y) internal pure returns(uint) { uint256 z = x + y; require(<FILL_ME>) return z; } function safeSub(uint x, uint y) internal pure returns(uint) { } function safeMul(uint x, uint y) internal pure returns(uint) { } function safeDiv(uint x, uint y) internal pure returns(uint) { } function random(uint N, uint salt) internal view returns(uint) { } } contract Authorization { mapping(address => address) public agentBooks; address public owner; address public operator; address public bank; bool public powerStatus = true; bool public forceOff = false; function Authorization() public { } modifier onlyOwner { } modifier onlyOperator { } modifier onlyActive { } function powerSwitch( bool onOff_ ) public onlyOperator { } function transferOwnership(address newOwner_) onlyOwner public { } function assignOperator(address user_) public onlyOwner { } function assignBank(address bank_) public onlyOwner { } function assignAgent( address agent_ ) public { } function isRepresentor( address representor_ ) public view returns(bool) { } function getUser( address representor_ ) internal view returns(address) { } } contract XPAAssets is SafeMath, Authorization { string public version = "0.5.0"; // contracts address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170; address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f; address public newXPAAssets = address(0); address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926; // setting uint256 public maxForceOffsetAmount = 1000000 ether; uint256 public minForceOffsetAmount = 10000 ether; // events event eMortgage(address, uint256); event eWithdraw(address, address, uint256); event eRepayment(address, address, uint256); event eOffset(address, address, uint256); event eExecuteOffset(uint256, address, uint256); event eMigrate(address); event eMigrateAmount(address); //data mapping(address => uint256) public fromAmountBooks; mapping(address => mapping(address => uint256)) public toAmountBooks; mapping(address => uint256) public forceOffsetBooks; mapping(address => bool) public migrateBooks; address[] public xpaAsset; address public fundAccount; uint256 public profit = 0; mapping(address => uint256) public unPaidFundAccount; uint256 public initCanOffsetTime = 0; //fee uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費 uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費 uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費 uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費 uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費 uint256 public forceOffsetExecuteMaxFee = 1000 ether; // constructor function XPAAssets( uint256 initCanOffsetTime_, address XPAAddr, address factoryAddr, address oldXPAAssetsAddr ) public { } function setFundAccount( address fundAccount_ ) public onlyOperator { } function createToken( string symbol_, string name_, uint256 defaultExchangeRate_ ) public onlyOperator { } //抵押 XPA function mortgage( address representor_ ) onlyActive public { } // 借出 XPA Assets, amount: 指定借出金額 function withdraw( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 領回 XPA, amount: 指定領回金額 function withdrawXPA( uint256 amount_, address representor_ ) onlyActive public { } // 檢查額度是否足夠借出 XPA Assets /*function checkWithdraw( address token_, uint256 amount_, address user_ ) internal view returns(bool) { if( token_ != XPA && amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether) ){ return true; }else if( token_ == XPA && amount_ <= getUsableXPA(user_) ){ return true; }else{ return false; } }*/ // 還款 XPA Assets, amount: 指定還回金額 function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 平倉 / 強行平倉, user: 指定平倉對象 function offset( address user_, address token_ ) onlyActive public { } function executeOffset( address user_, uint256 xpaAmount_, address xpaAssetToken, uint256 feeRate ) internal returns(uint256){ } function getPunishXPA( address user_ ) internal view returns(uint256){ } // 取得用戶抵押率, user: 指定用戶 function getMortgageRate( address user_ ) public view returns(uint256){ } // 取得最高抵押率 function getHighestMortgageRate() public view returns(uint256){ } // 取得平倉線 function getClosingLine() public view returns(uint256){ } // 取得 XPA Assets 匯率 function getPrice( address token_ ) public view returns(uint256){ } // 取得用戶可提領的XPA(扣掉最高抵押率後的XPA) function getUsableXPA( address user_ ) public view returns(uint256) { } // 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶 /*function getUsableAmount( address user_, address token_ ) public view returns(uint256) { uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether); return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether); }*/ // 取得用戶已借貸 XPA Assets 數量, user: 指定用戶 function getLoanAmount( address user_, address token_ ) public view returns(uint256) { } // 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶 function getRemainingAmount( address user_, address token_ ) public view returns(uint256) { } function burnFundAccount( address token_, uint256 amount_ ) onlyOperator public { } function transferProfit( address token_, uint256 amount_ ) onlyOperator public { } function setFeeRate( uint256 withDrawFeerate_, uint256 offsetFeerate_, uint256 forceOffsetBasicFeerate_, uint256 forceOffsetExecuteFeerate_, uint256 forceOffsetExtraFeerate_, uint256 forceOffsetExecuteMaxFee_ ) onlyOperator public { } function setForceOffsetAmount( uint256 maxForceOffsetAmount_, uint256 minForceOffsetAmount_ ) onlyOperator public { } function migrate( address newContract_ ) public onlyOwner { } function transferXPAAssetAndProfit( address[] xpaAsset_, uint256 profit_ ) public onlyOperator returns(bool) { } function transferUnPaidFundAccount( address xpaAsset_, uint256 unPaidAmount_ ) public onlyOperator returns(bool) { } function migratingAmountBooks( address user_, address newContract_ ) public onlyOperator { } function migrateAmountBooks( address user_ ) public onlyOperator { } function getFromAmountBooks( address user_ ) public view returns(uint256) { } function getForceOffsetBooks( address user_ ) public view returns(uint256) { } }
(z>=x)&&(z>=y)
10,792
(z>=x)&&(z>=y)
null
pragma solidity ^0.4.21; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) constant external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface XPAAssetToken { function create(address user_, uint256 amount_) external returns(bool success); function burn(uint256 amount_) external returns(bool success); function burnFrom(address user_, uint256 amount_) external returns(bool success); function getDefaultExchangeRate() external returns(uint256); function getSymbol() external returns(bytes32); } interface Baliv { function getPrice(address fromToken_, address toToken_) external view returns(uint256); } interface FundAccount { function burn(address Token_, uint256 Amount_) external view returns(bool); } interface TokenFactory { function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address); function getPrice(address token_) external view returns(uint256); function getAssetLength() external view returns(uint256); function getAssetToken(uint256 index_) external view returns(address); } contract SafeMath { function safeAdd(uint x, uint y) internal pure returns(uint) { } function safeSub(uint x, uint y) internal pure returns(uint) { } function safeMul(uint x, uint y) internal pure returns(uint) { uint z = x * y; require(<FILL_ME>) return z; } function safeDiv(uint x, uint y) internal pure returns(uint) { } function random(uint N, uint salt) internal view returns(uint) { } } contract Authorization { mapping(address => address) public agentBooks; address public owner; address public operator; address public bank; bool public powerStatus = true; bool public forceOff = false; function Authorization() public { } modifier onlyOwner { } modifier onlyOperator { } modifier onlyActive { } function powerSwitch( bool onOff_ ) public onlyOperator { } function transferOwnership(address newOwner_) onlyOwner public { } function assignOperator(address user_) public onlyOwner { } function assignBank(address bank_) public onlyOwner { } function assignAgent( address agent_ ) public { } function isRepresentor( address representor_ ) public view returns(bool) { } function getUser( address representor_ ) internal view returns(address) { } } contract XPAAssets is SafeMath, Authorization { string public version = "0.5.0"; // contracts address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170; address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f; address public newXPAAssets = address(0); address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926; // setting uint256 public maxForceOffsetAmount = 1000000 ether; uint256 public minForceOffsetAmount = 10000 ether; // events event eMortgage(address, uint256); event eWithdraw(address, address, uint256); event eRepayment(address, address, uint256); event eOffset(address, address, uint256); event eExecuteOffset(uint256, address, uint256); event eMigrate(address); event eMigrateAmount(address); //data mapping(address => uint256) public fromAmountBooks; mapping(address => mapping(address => uint256)) public toAmountBooks; mapping(address => uint256) public forceOffsetBooks; mapping(address => bool) public migrateBooks; address[] public xpaAsset; address public fundAccount; uint256 public profit = 0; mapping(address => uint256) public unPaidFundAccount; uint256 public initCanOffsetTime = 0; //fee uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費 uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費 uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費 uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費 uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費 uint256 public forceOffsetExecuteMaxFee = 1000 ether; // constructor function XPAAssets( uint256 initCanOffsetTime_, address XPAAddr, address factoryAddr, address oldXPAAssetsAddr ) public { } function setFundAccount( address fundAccount_ ) public onlyOperator { } function createToken( string symbol_, string name_, uint256 defaultExchangeRate_ ) public onlyOperator { } //抵押 XPA function mortgage( address representor_ ) onlyActive public { } // 借出 XPA Assets, amount: 指定借出金額 function withdraw( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 領回 XPA, amount: 指定領回金額 function withdrawXPA( uint256 amount_, address representor_ ) onlyActive public { } // 檢查額度是否足夠借出 XPA Assets /*function checkWithdraw( address token_, uint256 amount_, address user_ ) internal view returns(bool) { if( token_ != XPA && amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether) ){ return true; }else if( token_ == XPA && amount_ <= getUsableXPA(user_) ){ return true; }else{ return false; } }*/ // 還款 XPA Assets, amount: 指定還回金額 function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 平倉 / 強行平倉, user: 指定平倉對象 function offset( address user_, address token_ ) onlyActive public { } function executeOffset( address user_, uint256 xpaAmount_, address xpaAssetToken, uint256 feeRate ) internal returns(uint256){ } function getPunishXPA( address user_ ) internal view returns(uint256){ } // 取得用戶抵押率, user: 指定用戶 function getMortgageRate( address user_ ) public view returns(uint256){ } // 取得最高抵押率 function getHighestMortgageRate() public view returns(uint256){ } // 取得平倉線 function getClosingLine() public view returns(uint256){ } // 取得 XPA Assets 匯率 function getPrice( address token_ ) public view returns(uint256){ } // 取得用戶可提領的XPA(扣掉最高抵押率後的XPA) function getUsableXPA( address user_ ) public view returns(uint256) { } // 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶 /*function getUsableAmount( address user_, address token_ ) public view returns(uint256) { uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether); return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether); }*/ // 取得用戶已借貸 XPA Assets 數量, user: 指定用戶 function getLoanAmount( address user_, address token_ ) public view returns(uint256) { } // 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶 function getRemainingAmount( address user_, address token_ ) public view returns(uint256) { } function burnFundAccount( address token_, uint256 amount_ ) onlyOperator public { } function transferProfit( address token_, uint256 amount_ ) onlyOperator public { } function setFeeRate( uint256 withDrawFeerate_, uint256 offsetFeerate_, uint256 forceOffsetBasicFeerate_, uint256 forceOffsetExecuteFeerate_, uint256 forceOffsetExtraFeerate_, uint256 forceOffsetExecuteMaxFee_ ) onlyOperator public { } function setForceOffsetAmount( uint256 maxForceOffsetAmount_, uint256 minForceOffsetAmount_ ) onlyOperator public { } function migrate( address newContract_ ) public onlyOwner { } function transferXPAAssetAndProfit( address[] xpaAsset_, uint256 profit_ ) public onlyOperator returns(bool) { } function transferUnPaidFundAccount( address xpaAsset_, uint256 unPaidAmount_ ) public onlyOperator returns(bool) { } function migratingAmountBooks( address user_, address newContract_ ) public onlyOperator { } function migrateAmountBooks( address user_ ) public onlyOperator { } function getFromAmountBooks( address user_ ) public view returns(uint256) { } function getForceOffsetBooks( address user_ ) public view returns(uint256) { } }
(x==0)||(z/x==y)
10,792
(x==0)||(z/x==y)
null
pragma solidity ^0.4.21; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) constant external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface XPAAssetToken { function create(address user_, uint256 amount_) external returns(bool success); function burn(uint256 amount_) external returns(bool success); function burnFrom(address user_, uint256 amount_) external returns(bool success); function getDefaultExchangeRate() external returns(uint256); function getSymbol() external returns(bytes32); } interface Baliv { function getPrice(address fromToken_, address toToken_) external view returns(uint256); } interface FundAccount { function burn(address Token_, uint256 Amount_) external view returns(bool); } interface TokenFactory { function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address); function getPrice(address token_) external view returns(uint256); function getAssetLength() external view returns(uint256); function getAssetToken(uint256 index_) external view returns(address); } contract SafeMath { function safeAdd(uint x, uint y) internal pure returns(uint) { } function safeSub(uint x, uint y) internal pure returns(uint) { } function safeMul(uint x, uint y) internal pure returns(uint) { } function safeDiv(uint x, uint y) internal pure returns(uint) { } function random(uint N, uint salt) internal view returns(uint) { } } contract Authorization { mapping(address => address) public agentBooks; address public owner; address public operator; address public bank; bool public powerStatus = true; bool public forceOff = false; function Authorization() public { } modifier onlyOwner { } modifier onlyOperator { } modifier onlyActive { } function powerSwitch( bool onOff_ ) public onlyOperator { } function transferOwnership(address newOwner_) onlyOwner public { } function assignOperator(address user_) public onlyOwner { } function assignBank(address bank_) public onlyOwner { } function assignAgent( address agent_ ) public { } function isRepresentor( address representor_ ) public view returns(bool) { } function getUser( address representor_ ) internal view returns(address) { } } contract XPAAssets is SafeMath, Authorization { string public version = "0.5.0"; // contracts address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170; address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f; address public newXPAAssets = address(0); address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926; // setting uint256 public maxForceOffsetAmount = 1000000 ether; uint256 public minForceOffsetAmount = 10000 ether; // events event eMortgage(address, uint256); event eWithdraw(address, address, uint256); event eRepayment(address, address, uint256); event eOffset(address, address, uint256); event eExecuteOffset(uint256, address, uint256); event eMigrate(address); event eMigrateAmount(address); //data mapping(address => uint256) public fromAmountBooks; mapping(address => mapping(address => uint256)) public toAmountBooks; mapping(address => uint256) public forceOffsetBooks; mapping(address => bool) public migrateBooks; address[] public xpaAsset; address public fundAccount; uint256 public profit = 0; mapping(address => uint256) public unPaidFundAccount; uint256 public initCanOffsetTime = 0; //fee uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費 uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費 uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費 uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費 uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費 uint256 public forceOffsetExecuteMaxFee = 1000 ether; // constructor function XPAAssets( uint256 initCanOffsetTime_, address XPAAddr, address factoryAddr, address oldXPAAssetsAddr ) public { } function setFundAccount( address fundAccount_ ) public onlyOperator { } function createToken( string symbol_, string name_, uint256 defaultExchangeRate_ ) public onlyOperator { } //抵押 XPA function mortgage( address representor_ ) onlyActive public { } // 借出 XPA Assets, amount: 指定借出金額 function withdraw( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 領回 XPA, amount: 指定領回金額 function withdrawXPA( uint256 amount_, address representor_ ) onlyActive public { address user = getUser(representor_); if( amount_ >= 100 ether && amount_ <= getUsableXPA(user) ){ fromAmountBooks[user] = safeSub(fromAmountBooks[user], amount_); require(<FILL_ME>) emit eWithdraw(user, XPA, amount_); // write event } } // 檢查額度是否足夠借出 XPA Assets /*function checkWithdraw( address token_, uint256 amount_, address user_ ) internal view returns(bool) { if( token_ != XPA && amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether) ){ return true; }else if( token_ == XPA && amount_ <= getUsableXPA(user_) ){ return true; }else{ return false; } }*/ // 還款 XPA Assets, amount: 指定還回金額 function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 平倉 / 強行平倉, user: 指定平倉對象 function offset( address user_, address token_ ) onlyActive public { } function executeOffset( address user_, uint256 xpaAmount_, address xpaAssetToken, uint256 feeRate ) internal returns(uint256){ } function getPunishXPA( address user_ ) internal view returns(uint256){ } // 取得用戶抵押率, user: 指定用戶 function getMortgageRate( address user_ ) public view returns(uint256){ } // 取得最高抵押率 function getHighestMortgageRate() public view returns(uint256){ } // 取得平倉線 function getClosingLine() public view returns(uint256){ } // 取得 XPA Assets 匯率 function getPrice( address token_ ) public view returns(uint256){ } // 取得用戶可提領的XPA(扣掉最高抵押率後的XPA) function getUsableXPA( address user_ ) public view returns(uint256) { } // 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶 /*function getUsableAmount( address user_, address token_ ) public view returns(uint256) { uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether); return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether); }*/ // 取得用戶已借貸 XPA Assets 數量, user: 指定用戶 function getLoanAmount( address user_, address token_ ) public view returns(uint256) { } // 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶 function getRemainingAmount( address user_, address token_ ) public view returns(uint256) { } function burnFundAccount( address token_, uint256 amount_ ) onlyOperator public { } function transferProfit( address token_, uint256 amount_ ) onlyOperator public { } function setFeeRate( uint256 withDrawFeerate_, uint256 offsetFeerate_, uint256 forceOffsetBasicFeerate_, uint256 forceOffsetExecuteFeerate_, uint256 forceOffsetExtraFeerate_, uint256 forceOffsetExecuteMaxFee_ ) onlyOperator public { } function setForceOffsetAmount( uint256 maxForceOffsetAmount_, uint256 minForceOffsetAmount_ ) onlyOperator public { } function migrate( address newContract_ ) public onlyOwner { } function transferXPAAssetAndProfit( address[] xpaAsset_, uint256 profit_ ) public onlyOperator returns(bool) { } function transferUnPaidFundAccount( address xpaAsset_, uint256 unPaidAmount_ ) public onlyOperator returns(bool) { } function migratingAmountBooks( address user_, address newContract_ ) public onlyOperator { } function migrateAmountBooks( address user_ ) public onlyOperator { } function getFromAmountBooks( address user_ ) public view returns(uint256) { } function getForceOffsetBooks( address user_ ) public view returns(uint256) { } }
Token(XPA).transfer(user,amount_)
10,792
Token(XPA).transfer(user,amount_)
null
pragma solidity ^0.4.21; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) constant external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface XPAAssetToken { function create(address user_, uint256 amount_) external returns(bool success); function burn(uint256 amount_) external returns(bool success); function burnFrom(address user_, uint256 amount_) external returns(bool success); function getDefaultExchangeRate() external returns(uint256); function getSymbol() external returns(bytes32); } interface Baliv { function getPrice(address fromToken_, address toToken_) external view returns(uint256); } interface FundAccount { function burn(address Token_, uint256 Amount_) external view returns(bool); } interface TokenFactory { function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address); function getPrice(address token_) external view returns(uint256); function getAssetLength() external view returns(uint256); function getAssetToken(uint256 index_) external view returns(address); } contract SafeMath { function safeAdd(uint x, uint y) internal pure returns(uint) { } function safeSub(uint x, uint y) internal pure returns(uint) { } function safeMul(uint x, uint y) internal pure returns(uint) { } function safeDiv(uint x, uint y) internal pure returns(uint) { } function random(uint N, uint salt) internal view returns(uint) { } } contract Authorization { mapping(address => address) public agentBooks; address public owner; address public operator; address public bank; bool public powerStatus = true; bool public forceOff = false; function Authorization() public { } modifier onlyOwner { } modifier onlyOperator { } modifier onlyActive { } function powerSwitch( bool onOff_ ) public onlyOperator { } function transferOwnership(address newOwner_) onlyOwner public { } function assignOperator(address user_) public onlyOwner { } function assignBank(address bank_) public onlyOwner { } function assignAgent( address agent_ ) public { } function isRepresentor( address representor_ ) public view returns(bool) { } function getUser( address representor_ ) internal view returns(address) { } } contract XPAAssets is SafeMath, Authorization { string public version = "0.5.0"; // contracts address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170; address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f; address public newXPAAssets = address(0); address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926; // setting uint256 public maxForceOffsetAmount = 1000000 ether; uint256 public minForceOffsetAmount = 10000 ether; // events event eMortgage(address, uint256); event eWithdraw(address, address, uint256); event eRepayment(address, address, uint256); event eOffset(address, address, uint256); event eExecuteOffset(uint256, address, uint256); event eMigrate(address); event eMigrateAmount(address); //data mapping(address => uint256) public fromAmountBooks; mapping(address => mapping(address => uint256)) public toAmountBooks; mapping(address => uint256) public forceOffsetBooks; mapping(address => bool) public migrateBooks; address[] public xpaAsset; address public fundAccount; uint256 public profit = 0; mapping(address => uint256) public unPaidFundAccount; uint256 public initCanOffsetTime = 0; //fee uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費 uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費 uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費 uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費 uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費 uint256 public forceOffsetExecuteMaxFee = 1000 ether; // constructor function XPAAssets( uint256 initCanOffsetTime_, address XPAAddr, address factoryAddr, address oldXPAAssetsAddr ) public { } function setFundAccount( address fundAccount_ ) public onlyOperator { } function createToken( string symbol_, string name_, uint256 defaultExchangeRate_ ) public onlyOperator { } //抵押 XPA function mortgage( address representor_ ) onlyActive public { } // 借出 XPA Assets, amount: 指定借出金額 function withdraw( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 領回 XPA, amount: 指定領回金額 function withdrawXPA( uint256 amount_, address representor_ ) onlyActive public { } // 檢查額度是否足夠借出 XPA Assets /*function checkWithdraw( address token_, uint256 amount_, address user_ ) internal view returns(bool) { if( token_ != XPA && amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether) ){ return true; }else if( token_ == XPA && amount_ <= getUsableXPA(user_) ){ return true; }else{ return false; } }*/ // 還款 XPA Assets, amount: 指定還回金額 function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 平倉 / 強行平倉, user: 指定平倉對象 function offset( address user_, address token_ ) onlyActive public { uint256 userFromAmount = fromAmountBooks[user_] >= maxForceOffsetAmount ? maxForceOffsetAmount : fromAmountBooks[user_]; require(block.timestamp > initCanOffsetTime); require(userFromAmount > 0); address user = getUser(user_); if( user_ == user && getLoanAmount(user, token_) > 0 ){ emit eOffset(user, user_, userFromAmount); uint256 remainingXPA = executeOffset(user_, userFromAmount, token_, offsetFeeRate); if(remainingXPA > 0){ require(<FILL_ME>) //轉帳至平倉基金 } else { require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), safeSub(1 ether, offsetFeeRate)), 1 ether))); //轉帳至平倉基金 } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(userFromAmount, remainingXPA)); }else if( user_ != user && block.timestamp > (forceOffsetBooks[user_] + 28800) && getMortgageRate(user_) >= getClosingLine() ){ forceOffsetBooks[user_] = block.timestamp; uint256 punishXPA = getPunishXPA(user_); //get 10% xpa emit eOffset(user, user_, punishXPA); uint256[3] memory forceOffsetFee; forceOffsetFee[0] = safeDiv(safeMul(punishXPA, forceOffsetBasicFeeRate), 1 ether); //基本手續費(收益) forceOffsetFee[1] = safeDiv(safeMul(punishXPA, forceOffsetExtraFeeRate), 1 ether); //額外手續費(平倉基金) forceOffsetFee[2] = safeDiv(safeMul(punishXPA, forceOffsetExecuteFeeRate), 1 ether);//執行手續費(執行者) forceOffsetFee[2] = forceOffsetFee[2] > forceOffsetExecuteMaxFee ? forceOffsetExecuteMaxFee : forceOffsetFee[2]; profit = safeAdd(profit, forceOffsetFee[0]); uint256 allFee = safeAdd(forceOffsetFee[2],safeAdd(forceOffsetFee[0], forceOffsetFee[1])); remainingXPA = safeSub(punishXPA,allFee); for(uint256 i = 0; i < xpaAsset.length; i++) { if(getLoanAmount(user_, xpaAsset[i]) > 0){ remainingXPA = executeOffset(user_, remainingXPA, xpaAsset[i],0); if(remainingXPA == 0){ break; } } } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(punishXPA, remainingXPA)); require(Token(XPA).transfer(fundAccount, safeAdd(forceOffsetFee[1],safeSub(safeSub(punishXPA, allFee), remainingXPA)))); //轉帳至平倉基金 require(Token(XPA).transfer(msg.sender, forceOffsetFee[2])); //執行手續費轉給執行者 } } function executeOffset( address user_, uint256 xpaAmount_, address xpaAssetToken, uint256 feeRate ) internal returns(uint256){ } function getPunishXPA( address user_ ) internal view returns(uint256){ } // 取得用戶抵押率, user: 指定用戶 function getMortgageRate( address user_ ) public view returns(uint256){ } // 取得最高抵押率 function getHighestMortgageRate() public view returns(uint256){ } // 取得平倉線 function getClosingLine() public view returns(uint256){ } // 取得 XPA Assets 匯率 function getPrice( address token_ ) public view returns(uint256){ } // 取得用戶可提領的XPA(扣掉最高抵押率後的XPA) function getUsableXPA( address user_ ) public view returns(uint256) { } // 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶 /*function getUsableAmount( address user_, address token_ ) public view returns(uint256) { uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether); return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether); }*/ // 取得用戶已借貸 XPA Assets 數量, user: 指定用戶 function getLoanAmount( address user_, address token_ ) public view returns(uint256) { } // 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶 function getRemainingAmount( address user_, address token_ ) public view returns(uint256) { } function burnFundAccount( address token_, uint256 amount_ ) onlyOperator public { } function transferProfit( address token_, uint256 amount_ ) onlyOperator public { } function setFeeRate( uint256 withDrawFeerate_, uint256 offsetFeerate_, uint256 forceOffsetBasicFeerate_, uint256 forceOffsetExecuteFeerate_, uint256 forceOffsetExtraFeerate_, uint256 forceOffsetExecuteMaxFee_ ) onlyOperator public { } function setForceOffsetAmount( uint256 maxForceOffsetAmount_, uint256 minForceOffsetAmount_ ) onlyOperator public { } function migrate( address newContract_ ) public onlyOwner { } function transferXPAAssetAndProfit( address[] xpaAsset_, uint256 profit_ ) public onlyOperator returns(bool) { } function transferUnPaidFundAccount( address xpaAsset_, uint256 unPaidAmount_ ) public onlyOperator returns(bool) { } function migratingAmountBooks( address user_, address newContract_ ) public onlyOperator { } function migrateAmountBooks( address user_ ) public onlyOperator { } function getFromAmountBooks( address user_ ) public view returns(uint256) { } function getForceOffsetBooks( address user_ ) public view returns(uint256) { } }
Token(XPA).transfer(fundAccount,safeDiv(safeMul(safeSub(userFromAmount,remainingXPA),1ether),safeAdd(1ether,offsetFeeRate)))
10,792
Token(XPA).transfer(fundAccount,safeDiv(safeMul(safeSub(userFromAmount,remainingXPA),1ether),safeAdd(1ether,offsetFeeRate)))
null
pragma solidity ^0.4.21; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) constant external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface XPAAssetToken { function create(address user_, uint256 amount_) external returns(bool success); function burn(uint256 amount_) external returns(bool success); function burnFrom(address user_, uint256 amount_) external returns(bool success); function getDefaultExchangeRate() external returns(uint256); function getSymbol() external returns(bytes32); } interface Baliv { function getPrice(address fromToken_, address toToken_) external view returns(uint256); } interface FundAccount { function burn(address Token_, uint256 Amount_) external view returns(bool); } interface TokenFactory { function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address); function getPrice(address token_) external view returns(uint256); function getAssetLength() external view returns(uint256); function getAssetToken(uint256 index_) external view returns(address); } contract SafeMath { function safeAdd(uint x, uint y) internal pure returns(uint) { } function safeSub(uint x, uint y) internal pure returns(uint) { } function safeMul(uint x, uint y) internal pure returns(uint) { } function safeDiv(uint x, uint y) internal pure returns(uint) { } function random(uint N, uint salt) internal view returns(uint) { } } contract Authorization { mapping(address => address) public agentBooks; address public owner; address public operator; address public bank; bool public powerStatus = true; bool public forceOff = false; function Authorization() public { } modifier onlyOwner { } modifier onlyOperator { } modifier onlyActive { } function powerSwitch( bool onOff_ ) public onlyOperator { } function transferOwnership(address newOwner_) onlyOwner public { } function assignOperator(address user_) public onlyOwner { } function assignBank(address bank_) public onlyOwner { } function assignAgent( address agent_ ) public { } function isRepresentor( address representor_ ) public view returns(bool) { } function getUser( address representor_ ) internal view returns(address) { } } contract XPAAssets is SafeMath, Authorization { string public version = "0.5.0"; // contracts address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170; address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f; address public newXPAAssets = address(0); address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926; // setting uint256 public maxForceOffsetAmount = 1000000 ether; uint256 public minForceOffsetAmount = 10000 ether; // events event eMortgage(address, uint256); event eWithdraw(address, address, uint256); event eRepayment(address, address, uint256); event eOffset(address, address, uint256); event eExecuteOffset(uint256, address, uint256); event eMigrate(address); event eMigrateAmount(address); //data mapping(address => uint256) public fromAmountBooks; mapping(address => mapping(address => uint256)) public toAmountBooks; mapping(address => uint256) public forceOffsetBooks; mapping(address => bool) public migrateBooks; address[] public xpaAsset; address public fundAccount; uint256 public profit = 0; mapping(address => uint256) public unPaidFundAccount; uint256 public initCanOffsetTime = 0; //fee uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費 uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費 uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費 uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費 uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費 uint256 public forceOffsetExecuteMaxFee = 1000 ether; // constructor function XPAAssets( uint256 initCanOffsetTime_, address XPAAddr, address factoryAddr, address oldXPAAssetsAddr ) public { } function setFundAccount( address fundAccount_ ) public onlyOperator { } function createToken( string symbol_, string name_, uint256 defaultExchangeRate_ ) public onlyOperator { } //抵押 XPA function mortgage( address representor_ ) onlyActive public { } // 借出 XPA Assets, amount: 指定借出金額 function withdraw( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 領回 XPA, amount: 指定領回金額 function withdrawXPA( uint256 amount_, address representor_ ) onlyActive public { } // 檢查額度是否足夠借出 XPA Assets /*function checkWithdraw( address token_, uint256 amount_, address user_ ) internal view returns(bool) { if( token_ != XPA && amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether) ){ return true; }else if( token_ == XPA && amount_ <= getUsableXPA(user_) ){ return true; }else{ return false; } }*/ // 還款 XPA Assets, amount: 指定還回金額 function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 平倉 / 強行平倉, user: 指定平倉對象 function offset( address user_, address token_ ) onlyActive public { uint256 userFromAmount = fromAmountBooks[user_] >= maxForceOffsetAmount ? maxForceOffsetAmount : fromAmountBooks[user_]; require(block.timestamp > initCanOffsetTime); require(userFromAmount > 0); address user = getUser(user_); if( user_ == user && getLoanAmount(user, token_) > 0 ){ emit eOffset(user, user_, userFromAmount); uint256 remainingXPA = executeOffset(user_, userFromAmount, token_, offsetFeeRate); if(remainingXPA > 0){ require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), 1 ether), safeAdd(1 ether, offsetFeeRate)))); //轉帳至平倉基金 } else { require(<FILL_ME>) //轉帳至平倉基金 } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(userFromAmount, remainingXPA)); }else if( user_ != user && block.timestamp > (forceOffsetBooks[user_] + 28800) && getMortgageRate(user_) >= getClosingLine() ){ forceOffsetBooks[user_] = block.timestamp; uint256 punishXPA = getPunishXPA(user_); //get 10% xpa emit eOffset(user, user_, punishXPA); uint256[3] memory forceOffsetFee; forceOffsetFee[0] = safeDiv(safeMul(punishXPA, forceOffsetBasicFeeRate), 1 ether); //基本手續費(收益) forceOffsetFee[1] = safeDiv(safeMul(punishXPA, forceOffsetExtraFeeRate), 1 ether); //額外手續費(平倉基金) forceOffsetFee[2] = safeDiv(safeMul(punishXPA, forceOffsetExecuteFeeRate), 1 ether);//執行手續費(執行者) forceOffsetFee[2] = forceOffsetFee[2] > forceOffsetExecuteMaxFee ? forceOffsetExecuteMaxFee : forceOffsetFee[2]; profit = safeAdd(profit, forceOffsetFee[0]); uint256 allFee = safeAdd(forceOffsetFee[2],safeAdd(forceOffsetFee[0], forceOffsetFee[1])); remainingXPA = safeSub(punishXPA,allFee); for(uint256 i = 0; i < xpaAsset.length; i++) { if(getLoanAmount(user_, xpaAsset[i]) > 0){ remainingXPA = executeOffset(user_, remainingXPA, xpaAsset[i],0); if(remainingXPA == 0){ break; } } } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(punishXPA, remainingXPA)); require(Token(XPA).transfer(fundAccount, safeAdd(forceOffsetFee[1],safeSub(safeSub(punishXPA, allFee), remainingXPA)))); //轉帳至平倉基金 require(Token(XPA).transfer(msg.sender, forceOffsetFee[2])); //執行手續費轉給執行者 } } function executeOffset( address user_, uint256 xpaAmount_, address xpaAssetToken, uint256 feeRate ) internal returns(uint256){ } function getPunishXPA( address user_ ) internal view returns(uint256){ } // 取得用戶抵押率, user: 指定用戶 function getMortgageRate( address user_ ) public view returns(uint256){ } // 取得最高抵押率 function getHighestMortgageRate() public view returns(uint256){ } // 取得平倉線 function getClosingLine() public view returns(uint256){ } // 取得 XPA Assets 匯率 function getPrice( address token_ ) public view returns(uint256){ } // 取得用戶可提領的XPA(扣掉最高抵押率後的XPA) function getUsableXPA( address user_ ) public view returns(uint256) { } // 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶 /*function getUsableAmount( address user_, address token_ ) public view returns(uint256) { uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether); return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether); }*/ // 取得用戶已借貸 XPA Assets 數量, user: 指定用戶 function getLoanAmount( address user_, address token_ ) public view returns(uint256) { } // 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶 function getRemainingAmount( address user_, address token_ ) public view returns(uint256) { } function burnFundAccount( address token_, uint256 amount_ ) onlyOperator public { } function transferProfit( address token_, uint256 amount_ ) onlyOperator public { } function setFeeRate( uint256 withDrawFeerate_, uint256 offsetFeerate_, uint256 forceOffsetBasicFeerate_, uint256 forceOffsetExecuteFeerate_, uint256 forceOffsetExtraFeerate_, uint256 forceOffsetExecuteMaxFee_ ) onlyOperator public { } function setForceOffsetAmount( uint256 maxForceOffsetAmount_, uint256 minForceOffsetAmount_ ) onlyOperator public { } function migrate( address newContract_ ) public onlyOwner { } function transferXPAAssetAndProfit( address[] xpaAsset_, uint256 profit_ ) public onlyOperator returns(bool) { } function transferUnPaidFundAccount( address xpaAsset_, uint256 unPaidAmount_ ) public onlyOperator returns(bool) { } function migratingAmountBooks( address user_, address newContract_ ) public onlyOperator { } function migrateAmountBooks( address user_ ) public onlyOperator { } function getFromAmountBooks( address user_ ) public view returns(uint256) { } function getForceOffsetBooks( address user_ ) public view returns(uint256) { } }
Token(XPA).transfer(fundAccount,safeDiv(safeMul(safeSub(userFromAmount,remainingXPA),safeSub(1ether,offsetFeeRate)),1ether))
10,792
Token(XPA).transfer(fundAccount,safeDiv(safeMul(safeSub(userFromAmount,remainingXPA),safeSub(1ether,offsetFeeRate)),1ether))
null
pragma solidity ^0.4.21; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) constant external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface XPAAssetToken { function create(address user_, uint256 amount_) external returns(bool success); function burn(uint256 amount_) external returns(bool success); function burnFrom(address user_, uint256 amount_) external returns(bool success); function getDefaultExchangeRate() external returns(uint256); function getSymbol() external returns(bytes32); } interface Baliv { function getPrice(address fromToken_, address toToken_) external view returns(uint256); } interface FundAccount { function burn(address Token_, uint256 Amount_) external view returns(bool); } interface TokenFactory { function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address); function getPrice(address token_) external view returns(uint256); function getAssetLength() external view returns(uint256); function getAssetToken(uint256 index_) external view returns(address); } contract SafeMath { function safeAdd(uint x, uint y) internal pure returns(uint) { } function safeSub(uint x, uint y) internal pure returns(uint) { } function safeMul(uint x, uint y) internal pure returns(uint) { } function safeDiv(uint x, uint y) internal pure returns(uint) { } function random(uint N, uint salt) internal view returns(uint) { } } contract Authorization { mapping(address => address) public agentBooks; address public owner; address public operator; address public bank; bool public powerStatus = true; bool public forceOff = false; function Authorization() public { } modifier onlyOwner { } modifier onlyOperator { } modifier onlyActive { } function powerSwitch( bool onOff_ ) public onlyOperator { } function transferOwnership(address newOwner_) onlyOwner public { } function assignOperator(address user_) public onlyOwner { } function assignBank(address bank_) public onlyOwner { } function assignAgent( address agent_ ) public { } function isRepresentor( address representor_ ) public view returns(bool) { } function getUser( address representor_ ) internal view returns(address) { } } contract XPAAssets is SafeMath, Authorization { string public version = "0.5.0"; // contracts address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170; address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f; address public newXPAAssets = address(0); address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926; // setting uint256 public maxForceOffsetAmount = 1000000 ether; uint256 public minForceOffsetAmount = 10000 ether; // events event eMortgage(address, uint256); event eWithdraw(address, address, uint256); event eRepayment(address, address, uint256); event eOffset(address, address, uint256); event eExecuteOffset(uint256, address, uint256); event eMigrate(address); event eMigrateAmount(address); //data mapping(address => uint256) public fromAmountBooks; mapping(address => mapping(address => uint256)) public toAmountBooks; mapping(address => uint256) public forceOffsetBooks; mapping(address => bool) public migrateBooks; address[] public xpaAsset; address public fundAccount; uint256 public profit = 0; mapping(address => uint256) public unPaidFundAccount; uint256 public initCanOffsetTime = 0; //fee uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費 uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費 uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費 uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費 uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費 uint256 public forceOffsetExecuteMaxFee = 1000 ether; // constructor function XPAAssets( uint256 initCanOffsetTime_, address XPAAddr, address factoryAddr, address oldXPAAssetsAddr ) public { } function setFundAccount( address fundAccount_ ) public onlyOperator { } function createToken( string symbol_, string name_, uint256 defaultExchangeRate_ ) public onlyOperator { } //抵押 XPA function mortgage( address representor_ ) onlyActive public { } // 借出 XPA Assets, amount: 指定借出金額 function withdraw( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 領回 XPA, amount: 指定領回金額 function withdrawXPA( uint256 amount_, address representor_ ) onlyActive public { } // 檢查額度是否足夠借出 XPA Assets /*function checkWithdraw( address token_, uint256 amount_, address user_ ) internal view returns(bool) { if( token_ != XPA && amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether) ){ return true; }else if( token_ == XPA && amount_ <= getUsableXPA(user_) ){ return true; }else{ return false; } }*/ // 還款 XPA Assets, amount: 指定還回金額 function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 平倉 / 強行平倉, user: 指定平倉對象 function offset( address user_, address token_ ) onlyActive public { uint256 userFromAmount = fromAmountBooks[user_] >= maxForceOffsetAmount ? maxForceOffsetAmount : fromAmountBooks[user_]; require(block.timestamp > initCanOffsetTime); require(userFromAmount > 0); address user = getUser(user_); if( user_ == user && getLoanAmount(user, token_) > 0 ){ emit eOffset(user, user_, userFromAmount); uint256 remainingXPA = executeOffset(user_, userFromAmount, token_, offsetFeeRate); if(remainingXPA > 0){ require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), 1 ether), safeAdd(1 ether, offsetFeeRate)))); //轉帳至平倉基金 } else { require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), safeSub(1 ether, offsetFeeRate)), 1 ether))); //轉帳至平倉基金 } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(userFromAmount, remainingXPA)); }else if( user_ != user && block.timestamp > (forceOffsetBooks[user_] + 28800) && getMortgageRate(user_) >= getClosingLine() ){ forceOffsetBooks[user_] = block.timestamp; uint256 punishXPA = getPunishXPA(user_); //get 10% xpa emit eOffset(user, user_, punishXPA); uint256[3] memory forceOffsetFee; forceOffsetFee[0] = safeDiv(safeMul(punishXPA, forceOffsetBasicFeeRate), 1 ether); //基本手續費(收益) forceOffsetFee[1] = safeDiv(safeMul(punishXPA, forceOffsetExtraFeeRate), 1 ether); //額外手續費(平倉基金) forceOffsetFee[2] = safeDiv(safeMul(punishXPA, forceOffsetExecuteFeeRate), 1 ether);//執行手續費(執行者) forceOffsetFee[2] = forceOffsetFee[2] > forceOffsetExecuteMaxFee ? forceOffsetExecuteMaxFee : forceOffsetFee[2]; profit = safeAdd(profit, forceOffsetFee[0]); uint256 allFee = safeAdd(forceOffsetFee[2],safeAdd(forceOffsetFee[0], forceOffsetFee[1])); remainingXPA = safeSub(punishXPA,allFee); for(uint256 i = 0; i < xpaAsset.length; i++) { if(getLoanAmount(user_, xpaAsset[i]) > 0){ remainingXPA = executeOffset(user_, remainingXPA, xpaAsset[i],0); if(remainingXPA == 0){ break; } } } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(punishXPA, remainingXPA)); require(<FILL_ME>) //轉帳至平倉基金 require(Token(XPA).transfer(msg.sender, forceOffsetFee[2])); //執行手續費轉給執行者 } } function executeOffset( address user_, uint256 xpaAmount_, address xpaAssetToken, uint256 feeRate ) internal returns(uint256){ } function getPunishXPA( address user_ ) internal view returns(uint256){ } // 取得用戶抵押率, user: 指定用戶 function getMortgageRate( address user_ ) public view returns(uint256){ } // 取得最高抵押率 function getHighestMortgageRate() public view returns(uint256){ } // 取得平倉線 function getClosingLine() public view returns(uint256){ } // 取得 XPA Assets 匯率 function getPrice( address token_ ) public view returns(uint256){ } // 取得用戶可提領的XPA(扣掉最高抵押率後的XPA) function getUsableXPA( address user_ ) public view returns(uint256) { } // 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶 /*function getUsableAmount( address user_, address token_ ) public view returns(uint256) { uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether); return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether); }*/ // 取得用戶已借貸 XPA Assets 數量, user: 指定用戶 function getLoanAmount( address user_, address token_ ) public view returns(uint256) { } // 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶 function getRemainingAmount( address user_, address token_ ) public view returns(uint256) { } function burnFundAccount( address token_, uint256 amount_ ) onlyOperator public { } function transferProfit( address token_, uint256 amount_ ) onlyOperator public { } function setFeeRate( uint256 withDrawFeerate_, uint256 offsetFeerate_, uint256 forceOffsetBasicFeerate_, uint256 forceOffsetExecuteFeerate_, uint256 forceOffsetExtraFeerate_, uint256 forceOffsetExecuteMaxFee_ ) onlyOperator public { } function setForceOffsetAmount( uint256 maxForceOffsetAmount_, uint256 minForceOffsetAmount_ ) onlyOperator public { } function migrate( address newContract_ ) public onlyOwner { } function transferXPAAssetAndProfit( address[] xpaAsset_, uint256 profit_ ) public onlyOperator returns(bool) { } function transferUnPaidFundAccount( address xpaAsset_, uint256 unPaidAmount_ ) public onlyOperator returns(bool) { } function migratingAmountBooks( address user_, address newContract_ ) public onlyOperator { } function migrateAmountBooks( address user_ ) public onlyOperator { } function getFromAmountBooks( address user_ ) public view returns(uint256) { } function getForceOffsetBooks( address user_ ) public view returns(uint256) { } }
Token(XPA).transfer(fundAccount,safeAdd(forceOffsetFee[1],safeSub(safeSub(punishXPA,allFee),remainingXPA)))
10,792
Token(XPA).transfer(fundAccount,safeAdd(forceOffsetFee[1],safeSub(safeSub(punishXPA,allFee),remainingXPA)))
null
pragma solidity ^0.4.21; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) constant external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface XPAAssetToken { function create(address user_, uint256 amount_) external returns(bool success); function burn(uint256 amount_) external returns(bool success); function burnFrom(address user_, uint256 amount_) external returns(bool success); function getDefaultExchangeRate() external returns(uint256); function getSymbol() external returns(bytes32); } interface Baliv { function getPrice(address fromToken_, address toToken_) external view returns(uint256); } interface FundAccount { function burn(address Token_, uint256 Amount_) external view returns(bool); } interface TokenFactory { function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address); function getPrice(address token_) external view returns(uint256); function getAssetLength() external view returns(uint256); function getAssetToken(uint256 index_) external view returns(address); } contract SafeMath { function safeAdd(uint x, uint y) internal pure returns(uint) { } function safeSub(uint x, uint y) internal pure returns(uint) { } function safeMul(uint x, uint y) internal pure returns(uint) { } function safeDiv(uint x, uint y) internal pure returns(uint) { } function random(uint N, uint salt) internal view returns(uint) { } } contract Authorization { mapping(address => address) public agentBooks; address public owner; address public operator; address public bank; bool public powerStatus = true; bool public forceOff = false; function Authorization() public { } modifier onlyOwner { } modifier onlyOperator { } modifier onlyActive { } function powerSwitch( bool onOff_ ) public onlyOperator { } function transferOwnership(address newOwner_) onlyOwner public { } function assignOperator(address user_) public onlyOwner { } function assignBank(address bank_) public onlyOwner { } function assignAgent( address agent_ ) public { } function isRepresentor( address representor_ ) public view returns(bool) { } function getUser( address representor_ ) internal view returns(address) { } } contract XPAAssets is SafeMath, Authorization { string public version = "0.5.0"; // contracts address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170; address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f; address public newXPAAssets = address(0); address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926; // setting uint256 public maxForceOffsetAmount = 1000000 ether; uint256 public minForceOffsetAmount = 10000 ether; // events event eMortgage(address, uint256); event eWithdraw(address, address, uint256); event eRepayment(address, address, uint256); event eOffset(address, address, uint256); event eExecuteOffset(uint256, address, uint256); event eMigrate(address); event eMigrateAmount(address); //data mapping(address => uint256) public fromAmountBooks; mapping(address => mapping(address => uint256)) public toAmountBooks; mapping(address => uint256) public forceOffsetBooks; mapping(address => bool) public migrateBooks; address[] public xpaAsset; address public fundAccount; uint256 public profit = 0; mapping(address => uint256) public unPaidFundAccount; uint256 public initCanOffsetTime = 0; //fee uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費 uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費 uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費 uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費 uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費 uint256 public forceOffsetExecuteMaxFee = 1000 ether; // constructor function XPAAssets( uint256 initCanOffsetTime_, address XPAAddr, address factoryAddr, address oldXPAAssetsAddr ) public { } function setFundAccount( address fundAccount_ ) public onlyOperator { } function createToken( string symbol_, string name_, uint256 defaultExchangeRate_ ) public onlyOperator { } //抵押 XPA function mortgage( address representor_ ) onlyActive public { } // 借出 XPA Assets, amount: 指定借出金額 function withdraw( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 領回 XPA, amount: 指定領回金額 function withdrawXPA( uint256 amount_, address representor_ ) onlyActive public { } // 檢查額度是否足夠借出 XPA Assets /*function checkWithdraw( address token_, uint256 amount_, address user_ ) internal view returns(bool) { if( token_ != XPA && amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether) ){ return true; }else if( token_ == XPA && amount_ <= getUsableXPA(user_) ){ return true; }else{ return false; } }*/ // 還款 XPA Assets, amount: 指定還回金額 function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 平倉 / 強行平倉, user: 指定平倉對象 function offset( address user_, address token_ ) onlyActive public { uint256 userFromAmount = fromAmountBooks[user_] >= maxForceOffsetAmount ? maxForceOffsetAmount : fromAmountBooks[user_]; require(block.timestamp > initCanOffsetTime); require(userFromAmount > 0); address user = getUser(user_); if( user_ == user && getLoanAmount(user, token_) > 0 ){ emit eOffset(user, user_, userFromAmount); uint256 remainingXPA = executeOffset(user_, userFromAmount, token_, offsetFeeRate); if(remainingXPA > 0){ require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), 1 ether), safeAdd(1 ether, offsetFeeRate)))); //轉帳至平倉基金 } else { require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), safeSub(1 ether, offsetFeeRate)), 1 ether))); //轉帳至平倉基金 } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(userFromAmount, remainingXPA)); }else if( user_ != user && block.timestamp > (forceOffsetBooks[user_] + 28800) && getMortgageRate(user_) >= getClosingLine() ){ forceOffsetBooks[user_] = block.timestamp; uint256 punishXPA = getPunishXPA(user_); //get 10% xpa emit eOffset(user, user_, punishXPA); uint256[3] memory forceOffsetFee; forceOffsetFee[0] = safeDiv(safeMul(punishXPA, forceOffsetBasicFeeRate), 1 ether); //基本手續費(收益) forceOffsetFee[1] = safeDiv(safeMul(punishXPA, forceOffsetExtraFeeRate), 1 ether); //額外手續費(平倉基金) forceOffsetFee[2] = safeDiv(safeMul(punishXPA, forceOffsetExecuteFeeRate), 1 ether);//執行手續費(執行者) forceOffsetFee[2] = forceOffsetFee[2] > forceOffsetExecuteMaxFee ? forceOffsetExecuteMaxFee : forceOffsetFee[2]; profit = safeAdd(profit, forceOffsetFee[0]); uint256 allFee = safeAdd(forceOffsetFee[2],safeAdd(forceOffsetFee[0], forceOffsetFee[1])); remainingXPA = safeSub(punishXPA,allFee); for(uint256 i = 0; i < xpaAsset.length; i++) { if(getLoanAmount(user_, xpaAsset[i]) > 0){ remainingXPA = executeOffset(user_, remainingXPA, xpaAsset[i],0); if(remainingXPA == 0){ break; } } } fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(punishXPA, remainingXPA)); require(Token(XPA).transfer(fundAccount, safeAdd(forceOffsetFee[1],safeSub(safeSub(punishXPA, allFee), remainingXPA)))); //轉帳至平倉基金 require(<FILL_ME>) //執行手續費轉給執行者 } } function executeOffset( address user_, uint256 xpaAmount_, address xpaAssetToken, uint256 feeRate ) internal returns(uint256){ } function getPunishXPA( address user_ ) internal view returns(uint256){ } // 取得用戶抵押率, user: 指定用戶 function getMortgageRate( address user_ ) public view returns(uint256){ } // 取得最高抵押率 function getHighestMortgageRate() public view returns(uint256){ } // 取得平倉線 function getClosingLine() public view returns(uint256){ } // 取得 XPA Assets 匯率 function getPrice( address token_ ) public view returns(uint256){ } // 取得用戶可提領的XPA(扣掉最高抵押率後的XPA) function getUsableXPA( address user_ ) public view returns(uint256) { } // 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶 /*function getUsableAmount( address user_, address token_ ) public view returns(uint256) { uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether); return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether); }*/ // 取得用戶已借貸 XPA Assets 數量, user: 指定用戶 function getLoanAmount( address user_, address token_ ) public view returns(uint256) { } // 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶 function getRemainingAmount( address user_, address token_ ) public view returns(uint256) { } function burnFundAccount( address token_, uint256 amount_ ) onlyOperator public { } function transferProfit( address token_, uint256 amount_ ) onlyOperator public { } function setFeeRate( uint256 withDrawFeerate_, uint256 offsetFeerate_, uint256 forceOffsetBasicFeerate_, uint256 forceOffsetExecuteFeerate_, uint256 forceOffsetExtraFeerate_, uint256 forceOffsetExecuteMaxFee_ ) onlyOperator public { } function setForceOffsetAmount( uint256 maxForceOffsetAmount_, uint256 minForceOffsetAmount_ ) onlyOperator public { } function migrate( address newContract_ ) public onlyOwner { } function transferXPAAssetAndProfit( address[] xpaAsset_, uint256 profit_ ) public onlyOperator returns(bool) { } function transferUnPaidFundAccount( address xpaAsset_, uint256 unPaidAmount_ ) public onlyOperator returns(bool) { } function migratingAmountBooks( address user_, address newContract_ ) public onlyOperator { } function migrateAmountBooks( address user_ ) public onlyOperator { } function getFromAmountBooks( address user_ ) public view returns(uint256) { } function getForceOffsetBooks( address user_ ) public view returns(uint256) { } }
Token(XPA).transfer(msg.sender,forceOffsetFee[2])
10,792
Token(XPA).transfer(msg.sender,forceOffsetFee[2])
null
pragma solidity ^0.4.21; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) constant external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface XPAAssetToken { function create(address user_, uint256 amount_) external returns(bool success); function burn(uint256 amount_) external returns(bool success); function burnFrom(address user_, uint256 amount_) external returns(bool success); function getDefaultExchangeRate() external returns(uint256); function getSymbol() external returns(bytes32); } interface Baliv { function getPrice(address fromToken_, address toToken_) external view returns(uint256); } interface FundAccount { function burn(address Token_, uint256 Amount_) external view returns(bool); } interface TokenFactory { function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address); function getPrice(address token_) external view returns(uint256); function getAssetLength() external view returns(uint256); function getAssetToken(uint256 index_) external view returns(address); } contract SafeMath { function safeAdd(uint x, uint y) internal pure returns(uint) { } function safeSub(uint x, uint y) internal pure returns(uint) { } function safeMul(uint x, uint y) internal pure returns(uint) { } function safeDiv(uint x, uint y) internal pure returns(uint) { } function random(uint N, uint salt) internal view returns(uint) { } } contract Authorization { mapping(address => address) public agentBooks; address public owner; address public operator; address public bank; bool public powerStatus = true; bool public forceOff = false; function Authorization() public { } modifier onlyOwner { } modifier onlyOperator { } modifier onlyActive { } function powerSwitch( bool onOff_ ) public onlyOperator { } function transferOwnership(address newOwner_) onlyOwner public { } function assignOperator(address user_) public onlyOwner { } function assignBank(address bank_) public onlyOwner { } function assignAgent( address agent_ ) public { } function isRepresentor( address representor_ ) public view returns(bool) { } function getUser( address representor_ ) internal view returns(address) { } } contract XPAAssets is SafeMath, Authorization { string public version = "0.5.0"; // contracts address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170; address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f; address public newXPAAssets = address(0); address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926; // setting uint256 public maxForceOffsetAmount = 1000000 ether; uint256 public minForceOffsetAmount = 10000 ether; // events event eMortgage(address, uint256); event eWithdraw(address, address, uint256); event eRepayment(address, address, uint256); event eOffset(address, address, uint256); event eExecuteOffset(uint256, address, uint256); event eMigrate(address); event eMigrateAmount(address); //data mapping(address => uint256) public fromAmountBooks; mapping(address => mapping(address => uint256)) public toAmountBooks; mapping(address => uint256) public forceOffsetBooks; mapping(address => bool) public migrateBooks; address[] public xpaAsset; address public fundAccount; uint256 public profit = 0; mapping(address => uint256) public unPaidFundAccount; uint256 public initCanOffsetTime = 0; //fee uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費 uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費 uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費 uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費 uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費 uint256 public forceOffsetExecuteMaxFee = 1000 ether; // constructor function XPAAssets( uint256 initCanOffsetTime_, address XPAAddr, address factoryAddr, address oldXPAAssetsAddr ) public { } function setFundAccount( address fundAccount_ ) public onlyOperator { } function createToken( string symbol_, string name_, uint256 defaultExchangeRate_ ) public onlyOperator { } //抵押 XPA function mortgage( address representor_ ) onlyActive public { } // 借出 XPA Assets, amount: 指定借出金額 function withdraw( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 領回 XPA, amount: 指定領回金額 function withdrawXPA( uint256 amount_, address representor_ ) onlyActive public { } // 檢查額度是否足夠借出 XPA Assets /*function checkWithdraw( address token_, uint256 amount_, address user_ ) internal view returns(bool) { if( token_ != XPA && amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether) ){ return true; }else if( token_ == XPA && amount_ <= getUsableXPA(user_) ){ return true; }else{ return false; } }*/ // 還款 XPA Assets, amount: 指定還回金額 function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 平倉 / 強行平倉, user: 指定平倉對象 function offset( address user_, address token_ ) onlyActive public { } function executeOffset( address user_, uint256 xpaAmount_, address xpaAssetToken, uint256 feeRate ) internal returns(uint256){ } function getPunishXPA( address user_ ) internal view returns(uint256){ } // 取得用戶抵押率, user: 指定用戶 function getMortgageRate( address user_ ) public view returns(uint256){ } // 取得最高抵押率 function getHighestMortgageRate() public view returns(uint256){ } // 取得平倉線 function getClosingLine() public view returns(uint256){ } // 取得 XPA Assets 匯率 function getPrice( address token_ ) public view returns(uint256){ } // 取得用戶可提領的XPA(扣掉最高抵押率後的XPA) function getUsableXPA( address user_ ) public view returns(uint256) { } // 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶 /*function getUsableAmount( address user_, address token_ ) public view returns(uint256) { uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether); return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether); }*/ // 取得用戶已借貸 XPA Assets 數量, user: 指定用戶 function getLoanAmount( address user_, address token_ ) public view returns(uint256) { } // 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶 function getRemainingAmount( address user_, address token_ ) public view returns(uint256) { } function burnFundAccount( address token_, uint256 amount_ ) onlyOperator public { } function transferProfit( address token_, uint256 amount_ ) onlyOperator public { require(amount_ > 0); if( XPA != token_ && Token(token_).balanceOf(this) >= amount_ ) { require(<FILL_ME>) } if( XPA == token_ && Token(XPA).balanceOf(this) >= amount_ ) { profit = safeSub(profit,amount_); require(Token(token_).transfer(bank, amount_)); } } function setFeeRate( uint256 withDrawFeerate_, uint256 offsetFeerate_, uint256 forceOffsetBasicFeerate_, uint256 forceOffsetExecuteFeerate_, uint256 forceOffsetExtraFeerate_, uint256 forceOffsetExecuteMaxFee_ ) onlyOperator public { } function setForceOffsetAmount( uint256 maxForceOffsetAmount_, uint256 minForceOffsetAmount_ ) onlyOperator public { } function migrate( address newContract_ ) public onlyOwner { } function transferXPAAssetAndProfit( address[] xpaAsset_, uint256 profit_ ) public onlyOperator returns(bool) { } function transferUnPaidFundAccount( address xpaAsset_, uint256 unPaidAmount_ ) public onlyOperator returns(bool) { } function migratingAmountBooks( address user_, address newContract_ ) public onlyOperator { } function migrateAmountBooks( address user_ ) public onlyOperator { } function getFromAmountBooks( address user_ ) public view returns(uint256) { } function getForceOffsetBooks( address user_ ) public view returns(uint256) { } }
Token(token_).transfer(bank,amount_)
10,792
Token(token_).transfer(bank,amount_)
null
pragma solidity ^0.4.21; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) constant external returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } interface XPAAssetToken { function create(address user_, uint256 amount_) external returns(bool success); function burn(uint256 amount_) external returns(bool success); function burnFrom(address user_, uint256 amount_) external returns(bool success); function getDefaultExchangeRate() external returns(uint256); function getSymbol() external returns(bytes32); } interface Baliv { function getPrice(address fromToken_, address toToken_) external view returns(uint256); } interface FundAccount { function burn(address Token_, uint256 Amount_) external view returns(bool); } interface TokenFactory { function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address); function getPrice(address token_) external view returns(uint256); function getAssetLength() external view returns(uint256); function getAssetToken(uint256 index_) external view returns(address); } contract SafeMath { function safeAdd(uint x, uint y) internal pure returns(uint) { } function safeSub(uint x, uint y) internal pure returns(uint) { } function safeMul(uint x, uint y) internal pure returns(uint) { } function safeDiv(uint x, uint y) internal pure returns(uint) { } function random(uint N, uint salt) internal view returns(uint) { } } contract Authorization { mapping(address => address) public agentBooks; address public owner; address public operator; address public bank; bool public powerStatus = true; bool public forceOff = false; function Authorization() public { } modifier onlyOwner { } modifier onlyOperator { } modifier onlyActive { } function powerSwitch( bool onOff_ ) public onlyOperator { } function transferOwnership(address newOwner_) onlyOwner public { } function assignOperator(address user_) public onlyOwner { } function assignBank(address bank_) public onlyOwner { } function assignAgent( address agent_ ) public { } function isRepresentor( address representor_ ) public view returns(bool) { } function getUser( address representor_ ) internal view returns(address) { } } contract XPAAssets is SafeMath, Authorization { string public version = "0.5.0"; // contracts address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170; address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f; address public newXPAAssets = address(0); address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926; // setting uint256 public maxForceOffsetAmount = 1000000 ether; uint256 public minForceOffsetAmount = 10000 ether; // events event eMortgage(address, uint256); event eWithdraw(address, address, uint256); event eRepayment(address, address, uint256); event eOffset(address, address, uint256); event eExecuteOffset(uint256, address, uint256); event eMigrate(address); event eMigrateAmount(address); //data mapping(address => uint256) public fromAmountBooks; mapping(address => mapping(address => uint256)) public toAmountBooks; mapping(address => uint256) public forceOffsetBooks; mapping(address => bool) public migrateBooks; address[] public xpaAsset; address public fundAccount; uint256 public profit = 0; mapping(address => uint256) public unPaidFundAccount; uint256 public initCanOffsetTime = 0; //fee uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費 uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費 uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費 uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費 uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費 uint256 public forceOffsetExecuteMaxFee = 1000 ether; // constructor function XPAAssets( uint256 initCanOffsetTime_, address XPAAddr, address factoryAddr, address oldXPAAssetsAddr ) public { } function setFundAccount( address fundAccount_ ) public onlyOperator { } function createToken( string symbol_, string name_, uint256 defaultExchangeRate_ ) public onlyOperator { } //抵押 XPA function mortgage( address representor_ ) onlyActive public { } // 借出 XPA Assets, amount: 指定借出金額 function withdraw( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 領回 XPA, amount: 指定領回金額 function withdrawXPA( uint256 amount_, address representor_ ) onlyActive public { } // 檢查額度是否足夠借出 XPA Assets /*function checkWithdraw( address token_, uint256 amount_, address user_ ) internal view returns(bool) { if( token_ != XPA && amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether) ){ return true; }else if( token_ == XPA && amount_ <= getUsableXPA(user_) ){ return true; }else{ return false; } }*/ // 還款 XPA Assets, amount: 指定還回金額 function repayment( address token_, uint256 amount_, address representor_ ) onlyActive public { } // 平倉 / 強行平倉, user: 指定平倉對象 function offset( address user_, address token_ ) onlyActive public { } function executeOffset( address user_, uint256 xpaAmount_, address xpaAssetToken, uint256 feeRate ) internal returns(uint256){ } function getPunishXPA( address user_ ) internal view returns(uint256){ } // 取得用戶抵押率, user: 指定用戶 function getMortgageRate( address user_ ) public view returns(uint256){ } // 取得最高抵押率 function getHighestMortgageRate() public view returns(uint256){ } // 取得平倉線 function getClosingLine() public view returns(uint256){ } // 取得 XPA Assets 匯率 function getPrice( address token_ ) public view returns(uint256){ } // 取得用戶可提領的XPA(扣掉最高抵押率後的XPA) function getUsableXPA( address user_ ) public view returns(uint256) { } // 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶 /*function getUsableAmount( address user_, address token_ ) public view returns(uint256) { uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether); return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether); }*/ // 取得用戶已借貸 XPA Assets 數量, user: 指定用戶 function getLoanAmount( address user_, address token_ ) public view returns(uint256) { } // 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶 function getRemainingAmount( address user_, address token_ ) public view returns(uint256) { } function burnFundAccount( address token_, uint256 amount_ ) onlyOperator public { } function transferProfit( address token_, uint256 amount_ ) onlyOperator public { } function setFeeRate( uint256 withDrawFeerate_, uint256 offsetFeerate_, uint256 forceOffsetBasicFeerate_, uint256 forceOffsetExecuteFeerate_, uint256 forceOffsetExtraFeerate_, uint256 forceOffsetExecuteMaxFee_ ) onlyOperator public { } function setForceOffsetAmount( uint256 maxForceOffsetAmount_, uint256 minForceOffsetAmount_ ) onlyOperator public { } function migrate( address newContract_ ) public onlyOwner { } function transferXPAAssetAndProfit( address[] xpaAsset_, uint256 profit_ ) public onlyOperator returns(bool) { } function transferUnPaidFundAccount( address xpaAsset_, uint256 unPaidAmount_ ) public onlyOperator returns(bool) { } function migratingAmountBooks( address user_, address newContract_ ) public onlyOperator { } function migrateAmountBooks( address user_ ) public onlyOperator { require(msg.sender == oldXPAAssets); require(<FILL_ME>) migrateBooks[user_] = true; fromAmountBooks[user_] = safeAdd(fromAmountBooks[user_],XPAAssets(oldXPAAssets).getFromAmountBooks(user_)); forceOffsetBooks[user_] = XPAAssets(oldXPAAssets).getForceOffsetBooks(user_); for(uint256 i = 0; i < xpaAsset.length; i++) { toAmountBooks[user_][xpaAsset[i]] = safeAdd(toAmountBooks[user_][xpaAsset[i]], XPAAssets(oldXPAAssets).getLoanAmount(user_,xpaAsset[i])); } emit eMigrateAmount(user_); } function getFromAmountBooks( address user_ ) public view returns(uint256) { } function getForceOffsetBooks( address user_ ) public view returns(uint256) { } }
!migrateBooks[user_]
10,792
!migrateBooks[user_]
null
contract buyable is bloomingPool { address INFRASTRUCTURE_POOL_ADDRESS; mapping (uint256 => uint256) TokenIdtosetprice; mapping (uint256 => uint256) TokenIdtoprice; event Set_price_and_sell(uint256 tokenId, uint256 Price); event Stop_sell(uint256 tokenId); constructor() public {} function initialisation(address _infrastructure_address) public check(2){ } function set_price_and_sell(uint256 UniqueID,uint256 Price) external { } function stop_sell(uint256 UniqueID) external payable{ require(<FILL_ME>) clearApproval(tokenOwner[UniqueID],UniqueID); emit Stop_sell(UniqueID); } function buy(uint256 UniqueID) external payable { } function get_token_data(uint256 _tokenId) external view returns(uint256 _price, uint256 _setprice, bool _buyable){ } function get_token_data_buyable(uint256 _tokenId) external view returns(bool _buyable) { } function get_all_sellable_token()external view returns(bool[101] list_of_available){ } function get_my_tokens()external view returns(bool[101] list_of_my_tokens){ } }
tokenOwner[UniqueID]==msg.sender
10,802
tokenOwner[UniqueID]==msg.sender
null
contract buyable is bloomingPool { address INFRASTRUCTURE_POOL_ADDRESS; mapping (uint256 => uint256) TokenIdtosetprice; mapping (uint256 => uint256) TokenIdtoprice; event Set_price_and_sell(uint256 tokenId, uint256 Price); event Stop_sell(uint256 tokenId); constructor() public {} function initialisation(address _infrastructure_address) public check(2){ } function set_price_and_sell(uint256 UniqueID,uint256 Price) external { } function stop_sell(uint256 UniqueID) external payable{ } function buy(uint256 UniqueID) external payable { address _to = msg.sender; require(<FILL_ME>) TokenIdtoprice[UniqueID] = msg.value; uint _blooming = msg.value.div(20); uint _infrastructure = msg.value.div(20); uint _combined = _blooming.add(_infrastructure); uint _amount_for_seller = msg.value.sub(_combined); require(tokenOwner[UniqueID].call.gas(99999).value(_amount_for_seller)()); this.transferFrom(tokenOwner[UniqueID], _to, UniqueID); if(!INFRASTRUCTURE_POOL_ADDRESS.call.gas(99999).value(_infrastructure)()){ revert("transfer to infrastructurePool failed"); } } function get_token_data(uint256 _tokenId) external view returns(uint256 _price, uint256 _setprice, bool _buyable){ } function get_token_data_buyable(uint256 _tokenId) external view returns(bool _buyable) { } function get_all_sellable_token()external view returns(bool[101] list_of_available){ } function get_my_tokens()external view returns(bool[101] list_of_my_tokens){ } }
TokenIdtosetprice[UniqueID]==msg.value
10,802
TokenIdtosetprice[UniqueID]==msg.value
null
contract buyable is bloomingPool { address INFRASTRUCTURE_POOL_ADDRESS; mapping (uint256 => uint256) TokenIdtosetprice; mapping (uint256 => uint256) TokenIdtoprice; event Set_price_and_sell(uint256 tokenId, uint256 Price); event Stop_sell(uint256 tokenId); constructor() public {} function initialisation(address _infrastructure_address) public check(2){ } function set_price_and_sell(uint256 UniqueID,uint256 Price) external { } function stop_sell(uint256 UniqueID) external payable{ } function buy(uint256 UniqueID) external payable { address _to = msg.sender; require(TokenIdtosetprice[UniqueID] == msg.value); TokenIdtoprice[UniqueID] = msg.value; uint _blooming = msg.value.div(20); uint _infrastructure = msg.value.div(20); uint _combined = _blooming.add(_infrastructure); uint _amount_for_seller = msg.value.sub(_combined); require(<FILL_ME>) this.transferFrom(tokenOwner[UniqueID], _to, UniqueID); if(!INFRASTRUCTURE_POOL_ADDRESS.call.gas(99999).value(_infrastructure)()){ revert("transfer to infrastructurePool failed"); } } function get_token_data(uint256 _tokenId) external view returns(uint256 _price, uint256 _setprice, bool _buyable){ } function get_token_data_buyable(uint256 _tokenId) external view returns(bool _buyable) { } function get_all_sellable_token()external view returns(bool[101] list_of_available){ } function get_my_tokens()external view returns(bool[101] list_of_my_tokens){ } }
tokenOwner[UniqueID].call.gas(99999).value(_amount_for_seller)()
10,802
tokenOwner[UniqueID].call.gas(99999).value(_amount_for_seller)()
null
pragma solidity 0.4.24; /** * Math operations with safety checks */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { } function div(uint256 a, uint256 b) internal pure returns (uint256 c) { } function sub(uint256 a, uint256 b) internal pure returns (uint256 c) { } function add(uint256 a, uint256 b) internal pure returns (uint256 c) { } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); function burn(uint256 tokens) public returns (bool success); function freeze(uint256 tokens) public returns (bool success); function unfreeze(uint256 tokens) public returns (bool success); /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint tokens); /* This approve the allowance for the spender */ event Approval(address indexed tokenOwner, address indexed spender, uint tokens); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 tokens); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 tokens); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 tokens); } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); //constructor constructor () public { } modifier onlyOwner { } function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and an // initial supply // ---------------------------------------------------------------------------- contract ZQHQ is ERC20Interface, Owned { using SafeMath for uint; string public name; string public symbol; uint8 public decimals; uint256 public _totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balances; mapping(address => mapping(address => uint256)) allowed; mapping (address => uint256) public freezeOf; /* Initializes contract with initial supply tokens to the creator of the contract */ constructor ( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) public { } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public onlyOwner returns (bool success) { } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { } // ------------------------------------------------------------------------ // Burns the amount of tokens by the owner // ------------------------------------------------------------------------ function burn(uint256 tokens) public onlyOwner returns (bool success) { require(<FILL_ME>) // Check if the sender has enough require (tokens > 0) ; balances[msg.sender] = balances[msg.sender].sub(tokens); // Subtract from the sender _totalSupply = _totalSupply.sub(tokens); // Updates totalSupply emit Burn(msg.sender, tokens); return true; } // ------------------------------------------------------------------------ // Freeze the amount of tokens by the owner // ------------------------------------------------------------------------ function freeze(uint256 tokens) public onlyOwner returns (bool success) { } // ------------------------------------------------------------------------ // Unfreeze the amount of tokens by the owner // ------------------------------------------------------------------------ function unfreeze(uint256 tokens) public onlyOwner returns (bool success) { } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { } }
balances[msg.sender]>=tokens
10,887
balances[msg.sender]>=tokens
null
pragma solidity 0.4.24; /** * Math operations with safety checks */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { } function div(uint256 a, uint256 b) internal pure returns (uint256 c) { } function sub(uint256 a, uint256 b) internal pure returns (uint256 c) { } function add(uint256 a, uint256 b) internal pure returns (uint256 c) { } } // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); function burn(uint256 tokens) public returns (bool success); function freeze(uint256 tokens) public returns (bool success); function unfreeze(uint256 tokens) public returns (bool success); /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint tokens); /* This approve the allowance for the spender */ event Approval(address indexed tokenOwner, address indexed spender, uint tokens); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 tokens); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 tokens); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 tokens); } // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed _from, address indexed _to); //constructor constructor () public { } modifier onlyOwner { } function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } } // ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and an // initial supply // ---------------------------------------------------------------------------- contract ZQHQ is ERC20Interface, Owned { using SafeMath for uint; string public name; string public symbol; uint8 public decimals; uint256 public _totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balances; mapping(address => mapping(address => uint256)) allowed; mapping (address => uint256) public freezeOf; /* Initializes contract with initial supply tokens to the creator of the contract */ constructor ( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) public { } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public onlyOwner returns (bool success) { } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { } // ------------------------------------------------------------------------ // Burns the amount of tokens by the owner // ------------------------------------------------------------------------ function burn(uint256 tokens) public onlyOwner returns (bool success) { } // ------------------------------------------------------------------------ // Freeze the amount of tokens by the owner // ------------------------------------------------------------------------ function freeze(uint256 tokens) public onlyOwner returns (bool success) { } // ------------------------------------------------------------------------ // Unfreeze the amount of tokens by the owner // ------------------------------------------------------------------------ function unfreeze(uint256 tokens) public onlyOwner returns (bool success) { require(<FILL_ME>) // Check if the sender has enough require (tokens > 0) ; freezeOf[msg.sender] = freezeOf[msg.sender].sub(tokens); // Subtract from the sender balances[msg.sender] = balances[msg.sender].add(tokens); emit Unfreeze(msg.sender, tokens); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { } }
freezeOf[msg.sender]>=tokens
10,887
freezeOf[msg.sender]>=tokens
null
pragma solidity ^0.5.0; /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; constructor() public { } modifier onlyOwner() { } function transferOwnership(address newOwner) public onlyOwner { } } /* * ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { uint public totalSupply; function balanceOf(address who) public view returns (uint); function allowance(address owner, address spender) public view returns (uint); function transfer(address to, uint value) public returns (bool ok); function transferFrom(address from, address to, uint value) public returns (bool ok); function approve(address spender, uint value) public returns (bool ok); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } /** * Math operations with safety checks */ contract SafeMath { function safeMul(uint a, uint b) internal pure returns (uint) { } function safeDiv(uint a, uint b) internal pure returns (uint) { } function safeSub(uint a, uint b) internal pure returns (uint) { } function safeAdd(uint a, uint b) internal pure returns (uint) { } function max64(uint64 a, uint64 b) internal pure returns (uint64) { } function min64(uint64 a, uint64 b) internal pure returns (uint64) { } function max256(uint256 a, uint256 b) internal pure returns (uint256) { } function min256(uint256 a, uint256 b) internal pure returns (uint256) { } function assertThat(bool assertion) internal pure { } } /** * Standard ERC20 token with Short Hand Attack and approve() race condition mitigation. * * Based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, SafeMath { string public name; string public symbol; uint public decimals; /* Actual balances of token holders */ mapping(address => uint) balances; /* approve() allowances */ mapping(address => mapping(address => uint)) allowed; /** * * Fix for the ERC20 short address attack * * http://vessenes.com/the-erc20-short-address-attack-explained/ */ modifier onlyPayloadSize(uint size) { } function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) public returns (bool success) { } function transferFrom(address _from, address _to, uint _value) public returns (bool success) { } function balanceOf(address _owner) public view returns (uint balance) { } function approve(address _spender, uint _value) public returns (bool success) { } function allowance(address _owner, address _spender) public view returns (uint remaining) { } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { } } /** * @title Freezable * @dev Base contract which allows children to freeze the operations from a certain address in case of an emergency. */ contract Freezable is Ownable { mapping(address => bool) internal frozenAddresses; modifier ifNotFrozen() { require(<FILL_ME>) _; } function freezeAddress(address addr) public onlyOwner { } function unfreezeAddress(address addr) public onlyOwner { } } /** * @title Freezable token * @dev StandardToken modified with freezable transfers. **/ contract FreezableToken is StandardToken, Freezable { function transfer(address _to, uint256 _value) public ifNotFrozen returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) public ifNotFrozen returns (bool) { } function approve(address _spender, uint256 _value) public ifNotFrozen returns (bool) { } function increaseApproval(address _spender, uint _addedValue) public ifNotFrozen returns (bool success) { } function decreaseApproval(address _spender, uint _subtractedValue) public ifNotFrozen returns (bool success) { } } /** * A a standard token with an anti-theft mechanism. * Is able to restore stolen funds to a new address where the corresponding private key is safe. * */ contract AntiTheftToken is FreezableToken { function restoreFunds(address from, address to, uint amount) public onlyOwner { } } contract BurnableToken is StandardToken { /** How many tokens we burned */ event Burned(address burner, uint burnedAmount); /** * Burn extra tokens from a balance. * */ function burn(uint burnAmount) public { } } contract COPYLOCK is BurnableToken, AntiTheftToken { constructor() public { } }
frozenAddresses[msg.sender]==false
10,893
frozenAddresses[msg.sender]==false
null
pragma solidity ^0.5.0; /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; constructor() public { } modifier onlyOwner() { } function transferOwnership(address newOwner) public onlyOwner { } } /* * ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { uint public totalSupply; function balanceOf(address who) public view returns (uint); function allowance(address owner, address spender) public view returns (uint); function transfer(address to, uint value) public returns (bool ok); function transferFrom(address from, address to, uint value) public returns (bool ok); function approve(address spender, uint value) public returns (bool ok); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } /** * Math operations with safety checks */ contract SafeMath { function safeMul(uint a, uint b) internal pure returns (uint) { } function safeDiv(uint a, uint b) internal pure returns (uint) { } function safeSub(uint a, uint b) internal pure returns (uint) { } function safeAdd(uint a, uint b) internal pure returns (uint) { } function max64(uint64 a, uint64 b) internal pure returns (uint64) { } function min64(uint64 a, uint64 b) internal pure returns (uint64) { } function max256(uint256 a, uint256 b) internal pure returns (uint256) { } function min256(uint256 a, uint256 b) internal pure returns (uint256) { } function assertThat(bool assertion) internal pure { } } /** * Standard ERC20 token with Short Hand Attack and approve() race condition mitigation. * * Based on code by FirstBlood: * https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, SafeMath { string public name; string public symbol; uint public decimals; /* Actual balances of token holders */ mapping(address => uint) balances; /* approve() allowances */ mapping(address => mapping(address => uint)) allowed; /** * * Fix for the ERC20 short address attack * * http://vessenes.com/the-erc20-short-address-attack-explained/ */ modifier onlyPayloadSize(uint size) { } function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) public returns (bool success) { } function transferFrom(address _from, address _to, uint _value) public returns (bool success) { } function balanceOf(address _owner) public view returns (uint balance) { } function approve(address _spender, uint _value) public returns (bool success) { } function allowance(address _owner, address _spender) public view returns (uint remaining) { } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { } } /** * @title Freezable * @dev Base contract which allows children to freeze the operations from a certain address in case of an emergency. */ contract Freezable is Ownable { mapping(address => bool) internal frozenAddresses; modifier ifNotFrozen() { } function freezeAddress(address addr) public onlyOwner { } function unfreezeAddress(address addr) public onlyOwner { } } /** * @title Freezable token * @dev StandardToken modified with freezable transfers. **/ contract FreezableToken is StandardToken, Freezable { function transfer(address _to, uint256 _value) public ifNotFrozen returns (bool) { } function transferFrom(address _from, address _to, uint256 _value) public ifNotFrozen returns (bool) { } function approve(address _spender, uint256 _value) public ifNotFrozen returns (bool) { } function increaseApproval(address _spender, uint _addedValue) public ifNotFrozen returns (bool success) { } function decreaseApproval(address _spender, uint _subtractedValue) public ifNotFrozen returns (bool success) { } } /** * A a standard token with an anti-theft mechanism. * Is able to restore stolen funds to a new address where the corresponding private key is safe. * */ contract AntiTheftToken is FreezableToken { function restoreFunds(address from, address to, uint amount) public onlyOwner { //can only restore stolen funds from a frozen address require(<FILL_ME>) require(to != address(0)); require(amount <= balances[from]); balances[from] = safeSub(balances[from], amount); balances[to] = safeAdd(balances[to], amount); emit Transfer(from, to, amount); } } contract BurnableToken is StandardToken { /** How many tokens we burned */ event Burned(address burner, uint burnedAmount); /** * Burn extra tokens from a balance. * */ function burn(uint burnAmount) public { } } contract COPYLOCK is BurnableToken, AntiTheftToken { constructor() public { } }
frozenAddresses[from]==true
10,893
frozenAddresses[from]==true
"NPass:MAX_ALLOCATION_REACHED"
//SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./core/NPassCore.sol"; import "./interfaces/IN.sol"; interface ITreasure { function depositsOf(address account) external view returns (uint256[] memory); } /** * @title Adorable Aliens * @author maximonee (twitter.com/maximonee_) * @notice This contract provides minting for Adorable Aliens NFT by twitter.com/adorablealiens_ */ contract AdorableAliens is NPassCore { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; constructor( string memory name, string memory symbol, address _nContractAddress, bool onlyNHolders, uint256 maxTotalSupply, uint16 reservedAllowance, uint256 priceForNHoldersInWei, uint256 priceForOpenMintInWei) NPassCore( name, symbol, IN(_nContractAddress), onlyNHolders, maxTotalSupply, reservedAllowance, priceForNHoldersInWei, priceForOpenMintInWei ) { } bool public isPublicSaleActive = false; uint16 public constant M_PERCENT_CUT = 15; uint16 public constant A_PERCENT_CUT = 35; uint16 public constant I_PERCENT_CUT = 35; uint16 public constant DF_PERCENT_CUT = 15; address public constant mAddress = 0x07AF777f46489dFd49336A17bA69583F89596D1c; address public constant aAddress = 0xc4aD094A9455D24b52f5b3ec37dA3c3982d3B3e1; address public constant iAddress = 0xf2e55Eeac7a3D49fC8E9899aFe01965df6366133; address public constant dfAddress = 0xc9b9553B32825fDb236a1cB318154343DEa531dA; address public constant treasureStakingAddress = 0x08543f4c79f7e5d585A2622cA485e8201eFd9aDA; ITreasure treasure = ITreasure(treasureStakingAddress); string public baseTokenURI = "https://arweave.net/7DXOpVQMLfcO1IXHsCs9EPuYk6DGCMoplrJt2NpvCCk/"; function setPublicSaleState(bool _publicSaleActiveState) public onlyOwner { } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function _baseURI() internal view virtual override returns (string memory) { } /** Update the base token URI */ function setBaseURI(string memory _newBaseURI) public onlyOwner { } /** Allows minting for n holders if holding n in wallet or staking in Treasure farm */ function _isNHolder() internal view returns (bool) { } /** * @notice Allow a n token holder to bulk mint tokens */ function multiMintWithN(uint256 numberOfMints) public payable virtual nonReentrant { require(isPublicSaleActive, "SALE_NOT_ACTIVE"); require(numberOfMints <= MAX_MULTI_MINT_AMOUNT, "NPass:TOO_LARGE"); require(<FILL_ME>) require(msg.value >= priceForNHoldersInWei * numberOfMints, "NPass:INVALID_PRICE"); require(_isNHolder(), "MUST_BE_AN_N_OWNER"); // If reserved allowance is active we track mints count if (reservedAllowance > 0) { reserveMinted += uint16(numberOfMints); } for (uint256 i = 0; i < numberOfMints; i++) { uint256 tokenId = _tokenIds.current(); _safeMint(msg.sender, tokenId); _tokenIds.increment(); } _sendEthOut(); } /** * @notice Allow public to bulk mint tokens */ function multiMint(uint256 numberOfMints) public payable virtual nonReentrant { } /** * @notice Allow a n token holder to mint a token with one of their n token's id */ function mintWithN() public payable virtual nonReentrant { } /** * @notice Allow anyone to mint a token with the supply id if this pass is unrestricted. * n token holders can use this function without using the n token holders allowance, * this is useful when the allowance is fully utilized. */ function mint() public payable virtual nonReentrant { } function _sendEthOut() internal { } function _sendTo(address to_, uint256 value) internal { } }
(reservedAllowance==0&&totalSupply()+numberOfMints<=maxTotalSupply)||reserveMinted+numberOfMints<=reservedAllowance,"NPass:MAX_ALLOCATION_REACHED"
10,897
(reservedAllowance==0&&totalSupply()+numberOfMints<=maxTotalSupply)||reserveMinted+numberOfMints<=reservedAllowance
"MUST_BE_AN_N_OWNER"
//SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./core/NPassCore.sol"; import "./interfaces/IN.sol"; interface ITreasure { function depositsOf(address account) external view returns (uint256[] memory); } /** * @title Adorable Aliens * @author maximonee (twitter.com/maximonee_) * @notice This contract provides minting for Adorable Aliens NFT by twitter.com/adorablealiens_ */ contract AdorableAliens is NPassCore { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; constructor( string memory name, string memory symbol, address _nContractAddress, bool onlyNHolders, uint256 maxTotalSupply, uint16 reservedAllowance, uint256 priceForNHoldersInWei, uint256 priceForOpenMintInWei) NPassCore( name, symbol, IN(_nContractAddress), onlyNHolders, maxTotalSupply, reservedAllowance, priceForNHoldersInWei, priceForOpenMintInWei ) { } bool public isPublicSaleActive = false; uint16 public constant M_PERCENT_CUT = 15; uint16 public constant A_PERCENT_CUT = 35; uint16 public constant I_PERCENT_CUT = 35; uint16 public constant DF_PERCENT_CUT = 15; address public constant mAddress = 0x07AF777f46489dFd49336A17bA69583F89596D1c; address public constant aAddress = 0xc4aD094A9455D24b52f5b3ec37dA3c3982d3B3e1; address public constant iAddress = 0xf2e55Eeac7a3D49fC8E9899aFe01965df6366133; address public constant dfAddress = 0xc9b9553B32825fDb236a1cB318154343DEa531dA; address public constant treasureStakingAddress = 0x08543f4c79f7e5d585A2622cA485e8201eFd9aDA; ITreasure treasure = ITreasure(treasureStakingAddress); string public baseTokenURI = "https://arweave.net/7DXOpVQMLfcO1IXHsCs9EPuYk6DGCMoplrJt2NpvCCk/"; function setPublicSaleState(bool _publicSaleActiveState) public onlyOwner { } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function _baseURI() internal view virtual override returns (string memory) { } /** Update the base token URI */ function setBaseURI(string memory _newBaseURI) public onlyOwner { } /** Allows minting for n holders if holding n in wallet or staking in Treasure farm */ function _isNHolder() internal view returns (bool) { } /** * @notice Allow a n token holder to bulk mint tokens */ function multiMintWithN(uint256 numberOfMints) public payable virtual nonReentrant { require(isPublicSaleActive, "SALE_NOT_ACTIVE"); require(numberOfMints <= MAX_MULTI_MINT_AMOUNT, "NPass:TOO_LARGE"); require( // If no reserved allowance we respect total supply contraint (reservedAllowance == 0 && totalSupply() + numberOfMints <= maxTotalSupply) || reserveMinted + numberOfMints <= reservedAllowance, "NPass:MAX_ALLOCATION_REACHED" ); require(msg.value >= priceForNHoldersInWei * numberOfMints, "NPass:INVALID_PRICE"); require(<FILL_ME>) // If reserved allowance is active we track mints count if (reservedAllowance > 0) { reserveMinted += uint16(numberOfMints); } for (uint256 i = 0; i < numberOfMints; i++) { uint256 tokenId = _tokenIds.current(); _safeMint(msg.sender, tokenId); _tokenIds.increment(); } _sendEthOut(); } /** * @notice Allow public to bulk mint tokens */ function multiMint(uint256 numberOfMints) public payable virtual nonReentrant { } /** * @notice Allow a n token holder to mint a token with one of their n token's id */ function mintWithN() public payable virtual nonReentrant { } /** * @notice Allow anyone to mint a token with the supply id if this pass is unrestricted. * n token holders can use this function without using the n token holders allowance, * this is useful when the allowance is fully utilized. */ function mint() public payable virtual nonReentrant { } function _sendEthOut() internal { } function _sendTo(address to_, uint256 value) internal { } }
_isNHolder(),"MUST_BE_AN_N_OWNER"
10,897
_isNHolder()
"NPass:MAX_ALLOCATION_REACHED"
//SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./core/NPassCore.sol"; import "./interfaces/IN.sol"; interface ITreasure { function depositsOf(address account) external view returns (uint256[] memory); } /** * @title Adorable Aliens * @author maximonee (twitter.com/maximonee_) * @notice This contract provides minting for Adorable Aliens NFT by twitter.com/adorablealiens_ */ contract AdorableAliens is NPassCore { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; constructor( string memory name, string memory symbol, address _nContractAddress, bool onlyNHolders, uint256 maxTotalSupply, uint16 reservedAllowance, uint256 priceForNHoldersInWei, uint256 priceForOpenMintInWei) NPassCore( name, symbol, IN(_nContractAddress), onlyNHolders, maxTotalSupply, reservedAllowance, priceForNHoldersInWei, priceForOpenMintInWei ) { } bool public isPublicSaleActive = false; uint16 public constant M_PERCENT_CUT = 15; uint16 public constant A_PERCENT_CUT = 35; uint16 public constant I_PERCENT_CUT = 35; uint16 public constant DF_PERCENT_CUT = 15; address public constant mAddress = 0x07AF777f46489dFd49336A17bA69583F89596D1c; address public constant aAddress = 0xc4aD094A9455D24b52f5b3ec37dA3c3982d3B3e1; address public constant iAddress = 0xf2e55Eeac7a3D49fC8E9899aFe01965df6366133; address public constant dfAddress = 0xc9b9553B32825fDb236a1cB318154343DEa531dA; address public constant treasureStakingAddress = 0x08543f4c79f7e5d585A2622cA485e8201eFd9aDA; ITreasure treasure = ITreasure(treasureStakingAddress); string public baseTokenURI = "https://arweave.net/7DXOpVQMLfcO1IXHsCs9EPuYk6DGCMoplrJt2NpvCCk/"; function setPublicSaleState(bool _publicSaleActiveState) public onlyOwner { } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function _baseURI() internal view virtual override returns (string memory) { } /** Update the base token URI */ function setBaseURI(string memory _newBaseURI) public onlyOwner { } /** Allows minting for n holders if holding n in wallet or staking in Treasure farm */ function _isNHolder() internal view returns (bool) { } /** * @notice Allow a n token holder to bulk mint tokens */ function multiMintWithN(uint256 numberOfMints) public payable virtual nonReentrant { } /** * @notice Allow public to bulk mint tokens */ function multiMint(uint256 numberOfMints) public payable virtual nonReentrant { } /** * @notice Allow a n token holder to mint a token with one of their n token's id */ function mintWithN() public payable virtual nonReentrant { require(isPublicSaleActive, "SALE_NOT_ACTIVE"); require(<FILL_ME>) require(_isNHolder(), "MUST_BE_AN_N_OWNER"); require(msg.value >= priceForNHoldersInWei, "NPass:INVALID_PRICE"); // If reserved allowance is active we track mints count if (reservedAllowance > 0) { reserveMinted++; } uint256 tokenId = _tokenIds.current(); _safeMint(msg.sender, tokenId); _tokenIds.increment(); _sendEthOut(); } /** * @notice Allow anyone to mint a token with the supply id if this pass is unrestricted. * n token holders can use this function without using the n token holders allowance, * this is useful when the allowance is fully utilized. */ function mint() public payable virtual nonReentrant { } function _sendEthOut() internal { } function _sendTo(address to_, uint256 value) internal { } }
(reservedAllowance==0&&totalSupply()<maxTotalSupply)||reserveMinted<reservedAllowance,"NPass:MAX_ALLOCATION_REACHED"
10,897
(reservedAllowance==0&&totalSupply()<maxTotalSupply)||reserveMinted<reservedAllowance
"NPass:OPEN_MINTING_DISABLED"
//SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./core/NPassCore.sol"; import "./interfaces/IN.sol"; interface ITreasure { function depositsOf(address account) external view returns (uint256[] memory); } /** * @title Adorable Aliens * @author maximonee (twitter.com/maximonee_) * @notice This contract provides minting for Adorable Aliens NFT by twitter.com/adorablealiens_ */ contract AdorableAliens is NPassCore { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; constructor( string memory name, string memory symbol, address _nContractAddress, bool onlyNHolders, uint256 maxTotalSupply, uint16 reservedAllowance, uint256 priceForNHoldersInWei, uint256 priceForOpenMintInWei) NPassCore( name, symbol, IN(_nContractAddress), onlyNHolders, maxTotalSupply, reservedAllowance, priceForNHoldersInWei, priceForOpenMintInWei ) { } bool public isPublicSaleActive = false; uint16 public constant M_PERCENT_CUT = 15; uint16 public constant A_PERCENT_CUT = 35; uint16 public constant I_PERCENT_CUT = 35; uint16 public constant DF_PERCENT_CUT = 15; address public constant mAddress = 0x07AF777f46489dFd49336A17bA69583F89596D1c; address public constant aAddress = 0xc4aD094A9455D24b52f5b3ec37dA3c3982d3B3e1; address public constant iAddress = 0xf2e55Eeac7a3D49fC8E9899aFe01965df6366133; address public constant dfAddress = 0xc9b9553B32825fDb236a1cB318154343DEa531dA; address public constant treasureStakingAddress = 0x08543f4c79f7e5d585A2622cA485e8201eFd9aDA; ITreasure treasure = ITreasure(treasureStakingAddress); string public baseTokenURI = "https://arweave.net/7DXOpVQMLfcO1IXHsCs9EPuYk6DGCMoplrJt2NpvCCk/"; function setPublicSaleState(bool _publicSaleActiveState) public onlyOwner { } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function _baseURI() internal view virtual override returns (string memory) { } /** Update the base token URI */ function setBaseURI(string memory _newBaseURI) public onlyOwner { } /** Allows minting for n holders if holding n in wallet or staking in Treasure farm */ function _isNHolder() internal view returns (bool) { } /** * @notice Allow a n token holder to bulk mint tokens */ function multiMintWithN(uint256 numberOfMints) public payable virtual nonReentrant { } /** * @notice Allow public to bulk mint tokens */ function multiMint(uint256 numberOfMints) public payable virtual nonReentrant { } /** * @notice Allow a n token holder to mint a token with one of their n token's id */ function mintWithN() public payable virtual nonReentrant { } /** * @notice Allow anyone to mint a token with the supply id if this pass is unrestricted. * n token holders can use this function without using the n token holders allowance, * this is useful when the allowance is fully utilized. */ function mint() public payable virtual nonReentrant { require(isPublicSaleActive, "SALE_NOT_ACTIVE"); require(<FILL_ME>) require(openMintsAvailable() > 0, "NPass:MAX_ALLOCATION_REACHED"); require(msg.value >= priceForOpenMintInWei, "NPass:INVALID_PRICE"); uint256 tokenId = _tokenIds.current(); _safeMint(msg.sender, tokenId); _tokenIds.increment(); _sendEthOut(); } function _sendEthOut() internal { } function _sendTo(address to_, uint256 value) internal { } }
!onlyNHolders,"NPass:OPEN_MINTING_DISABLED"
10,897
!onlyNHolders
"NPass:MAX_ALLOCATION_REACHED"
//SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./core/NPassCore.sol"; import "./interfaces/IN.sol"; interface ITreasure { function depositsOf(address account) external view returns (uint256[] memory); } /** * @title Adorable Aliens * @author maximonee (twitter.com/maximonee_) * @notice This contract provides minting for Adorable Aliens NFT by twitter.com/adorablealiens_ */ contract AdorableAliens is NPassCore { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; constructor( string memory name, string memory symbol, address _nContractAddress, bool onlyNHolders, uint256 maxTotalSupply, uint16 reservedAllowance, uint256 priceForNHoldersInWei, uint256 priceForOpenMintInWei) NPassCore( name, symbol, IN(_nContractAddress), onlyNHolders, maxTotalSupply, reservedAllowance, priceForNHoldersInWei, priceForOpenMintInWei ) { } bool public isPublicSaleActive = false; uint16 public constant M_PERCENT_CUT = 15; uint16 public constant A_PERCENT_CUT = 35; uint16 public constant I_PERCENT_CUT = 35; uint16 public constant DF_PERCENT_CUT = 15; address public constant mAddress = 0x07AF777f46489dFd49336A17bA69583F89596D1c; address public constant aAddress = 0xc4aD094A9455D24b52f5b3ec37dA3c3982d3B3e1; address public constant iAddress = 0xf2e55Eeac7a3D49fC8E9899aFe01965df6366133; address public constant dfAddress = 0xc9b9553B32825fDb236a1cB318154343DEa531dA; address public constant treasureStakingAddress = 0x08543f4c79f7e5d585A2622cA485e8201eFd9aDA; ITreasure treasure = ITreasure(treasureStakingAddress); string public baseTokenURI = "https://arweave.net/7DXOpVQMLfcO1IXHsCs9EPuYk6DGCMoplrJt2NpvCCk/"; function setPublicSaleState(bool _publicSaleActiveState) public onlyOwner { } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { } function _baseURI() internal view virtual override returns (string memory) { } /** Update the base token URI */ function setBaseURI(string memory _newBaseURI) public onlyOwner { } /** Allows minting for n holders if holding n in wallet or staking in Treasure farm */ function _isNHolder() internal view returns (bool) { } /** * @notice Allow a n token holder to bulk mint tokens */ function multiMintWithN(uint256 numberOfMints) public payable virtual nonReentrant { } /** * @notice Allow public to bulk mint tokens */ function multiMint(uint256 numberOfMints) public payable virtual nonReentrant { } /** * @notice Allow a n token holder to mint a token with one of their n token's id */ function mintWithN() public payable virtual nonReentrant { } /** * @notice Allow anyone to mint a token with the supply id if this pass is unrestricted. * n token holders can use this function without using the n token holders allowance, * this is useful when the allowance is fully utilized. */ function mint() public payable virtual nonReentrant { require(isPublicSaleActive, "SALE_NOT_ACTIVE"); require(!onlyNHolders, "NPass:OPEN_MINTING_DISABLED"); require(<FILL_ME>) require(msg.value >= priceForOpenMintInWei, "NPass:INVALID_PRICE"); uint256 tokenId = _tokenIds.current(); _safeMint(msg.sender, tokenId); _tokenIds.increment(); _sendEthOut(); } function _sendEthOut() internal { } function _sendTo(address to_, uint256 value) internal { } }
openMintsAvailable()>0,"NPass:MAX_ALLOCATION_REACHED"
10,897
openMintsAvailable()>0
"Exceeding max supply!"
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........../@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@\....(@@@@@@@@@@@@@@@@...........@@@@@@@@@@@@@@@@)..../@@@@@@@@@@@@ // @@@@@@@@@@@@@@@..........@@@@@@@@@%...........@@@@@@@@@@,........,@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@.............@@@@@&...........@@@@@@.............@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@...............@@@...........@@@..............#@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@&...............@...........@...............@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#.......................................@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@...................................@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@.............................@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%.....................&%&&@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@(...........................................%@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@\................................................./@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#,.......&#,...............&#,........,#@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....&@/.@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..,@@@@@/.@@@@@%..,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // Stoners Rock // Smoke weed every day. // // 10,420 on-chain Rock NFTs // https://stonersrock.com // // Twitter: https://twitter.com/mystoners // // Produced by: @sircryptos // Art by: @linedetail // Code by: @altcryp // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract StonersRock is ERC721Burnable, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reserveIds; // Team address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C; // @sarasioux address public constant shaun = 0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50; // @sircryptos address public constant mark = 0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b; // @linedetail address public constant community = 0xd83Dd8A288270512b8A46F581A8254CD971dCb09; // stonersrock.eth // Rocks string public imageTx = ''; string public metadataTx = ''; string public baseUri; // Sales uint256 public saleStartBlock = 120250457; uint256 public constant rockPrice = 42069000000000000; //0.042069 ETH uint public constant maxRockPurchase = 20; uint public constant maxRockSupply = 10420; uint public constant maxReserveSupply = 420; // Internals event RockMinted(address minter, address receiver, uint256 tokenId); // Constructor constructor() ERC721("Stoners Rock", "ROCK") { } /* * Getters. */ function getCurrentRockId() public view returns(uint256 currentRockId) { } function getCurrentReserveId() public view returns(uint256 currentRockId) { } function exists(uint256 tokenId) public view returns(bool) { } function saleStarted() public view returns (bool) { } /* * Mint reserved rocks for giveaways and the teams. */ function reserveRocks(uint256 numberOfTokens) public onlyOwner { } function reserveRocks(uint256 numberOfTokens, address receiver) public onlyOwner { uint256 reserved = _reserveIds.current(); require(numberOfTokens <= maxRockPurchase, "Maximum 20!"); require(<FILL_ME>) for (uint i = 0; i < numberOfTokens; i++) { _reserveIds.increment(); uint256 tokenId = _reserveIds.current(); _safeMint(receiver, tokenId); emit RockMinted(msg.sender, receiver, tokenId); } } /** * Public function for minting a rock and enforcing requirements. */ function mintRock(uint numberOfTokens) public payable { } function mintRock(uint numberOfTokens, address receiver) public payable { } /** * External function for getting all rocks by a specific owner. */ function getRocksByOwner(address _owner) view public returns(uint256[] memory) { } /* * Owner setters. */ function setBaseUri(string memory _baseUri) public onlyOwner { } function setSaleStartBlock(uint256 _saleStartBlock) public onlyOwner { } function setProvenance(string memory _imageTx, string memory _metadataTx) public onlyOwner { } /* * Money management. */ function withdraw() public payable onlyOwner { } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { } /* * On chain storage. */ function uploadRockImages(bytes calldata s) external onlyOwner {} function uploadRockAttributes(bytes calldata s) external onlyOwner {} /* * Overrides */ function _baseURI() internal view override returns (string memory) { } receive () external payable virtual {} }
reserved.add(numberOfTokens)<=maxReserveSupply,"Exceeding max supply!"
10,936
reserved.add(numberOfTokens)<=maxReserveSupply
"Wait for the sale to start!"
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........../@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@\....(@@@@@@@@@@@@@@@@...........@@@@@@@@@@@@@@@@)..../@@@@@@@@@@@@ // @@@@@@@@@@@@@@@..........@@@@@@@@@%...........@@@@@@@@@@,........,@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@.............@@@@@&...........@@@@@@.............@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@...............@@@...........@@@..............#@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@&...............@...........@...............@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#.......................................@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@...................................@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@.............................@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%.....................&%&&@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@(...........................................%@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@\................................................./@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#,.......&#,...............&#,........,#@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....&@/.@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..,@@@@@/.@@@@@%..,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // Stoners Rock // Smoke weed every day. // // 10,420 on-chain Rock NFTs // https://stonersrock.com // // Twitter: https://twitter.com/mystoners // // Produced by: @sircryptos // Art by: @linedetail // Code by: @altcryp // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract StonersRock is ERC721Burnable, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reserveIds; // Team address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C; // @sarasioux address public constant shaun = 0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50; // @sircryptos address public constant mark = 0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b; // @linedetail address public constant community = 0xd83Dd8A288270512b8A46F581A8254CD971dCb09; // stonersrock.eth // Rocks string public imageTx = ''; string public metadataTx = ''; string public baseUri; // Sales uint256 public saleStartBlock = 120250457; uint256 public constant rockPrice = 42069000000000000; //0.042069 ETH uint public constant maxRockPurchase = 20; uint public constant maxRockSupply = 10420; uint public constant maxReserveSupply = 420; // Internals event RockMinted(address minter, address receiver, uint256 tokenId); // Constructor constructor() ERC721("Stoners Rock", "ROCK") { } /* * Getters. */ function getCurrentRockId() public view returns(uint256 currentRockId) { } function getCurrentReserveId() public view returns(uint256 currentRockId) { } function exists(uint256 tokenId) public view returns(bool) { } function saleStarted() public view returns (bool) { } /* * Mint reserved rocks for giveaways and the teams. */ function reserveRocks(uint256 numberOfTokens) public onlyOwner { } function reserveRocks(uint256 numberOfTokens, address receiver) public onlyOwner { } /** * Public function for minting a rock and enforcing requirements. */ function mintRock(uint numberOfTokens) public payable { } function mintRock(uint numberOfTokens, address receiver) public payable { uint256 totalIssued = _tokenIds.current(); require(<FILL_ME>) require(numberOfTokens <= maxRockPurchase, "Maximum 20!"); require(totalIssued.add(numberOfTokens) <= maxRockSupply, "Exceeding max supply!"); require(rockPrice.mul(numberOfTokens) <= msg.value, "Dont fuck around."); for(uint i = 0; i < numberOfTokens; i++) { _tokenIds.increment(); uint256 tokenId = _tokenIds.current(); _safeMint(receiver, tokenId); emit RockMinted(msg.sender, receiver, tokenId); } } /** * External function for getting all rocks by a specific owner. */ function getRocksByOwner(address _owner) view public returns(uint256[] memory) { } /* * Owner setters. */ function setBaseUri(string memory _baseUri) public onlyOwner { } function setSaleStartBlock(uint256 _saleStartBlock) public onlyOwner { } function setProvenance(string memory _imageTx, string memory _metadataTx) public onlyOwner { } /* * Money management. */ function withdraw() public payable onlyOwner { } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { } /* * On chain storage. */ function uploadRockImages(bytes calldata s) external onlyOwner {} function uploadRockAttributes(bytes calldata s) external onlyOwner {} /* * Overrides */ function _baseURI() internal view override returns (string memory) { } receive () external payable virtual {} }
saleStarted(),"Wait for the sale to start!"
10,936
saleStarted()
"Exceeding max supply!"
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........../@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@\....(@@@@@@@@@@@@@@@@...........@@@@@@@@@@@@@@@@)..../@@@@@@@@@@@@ // @@@@@@@@@@@@@@@..........@@@@@@@@@%...........@@@@@@@@@@,........,@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@.............@@@@@&...........@@@@@@.............@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@...............@@@...........@@@..............#@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@&...............@...........@...............@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#.......................................@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@...................................@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@.............................@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%.....................&%&&@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@(...........................................%@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@\................................................./@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#,.......&#,...............&#,........,#@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....&@/.@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..,@@@@@/.@@@@@%..,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // Stoners Rock // Smoke weed every day. // // 10,420 on-chain Rock NFTs // https://stonersrock.com // // Twitter: https://twitter.com/mystoners // // Produced by: @sircryptos // Art by: @linedetail // Code by: @altcryp // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract StonersRock is ERC721Burnable, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reserveIds; // Team address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C; // @sarasioux address public constant shaun = 0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50; // @sircryptos address public constant mark = 0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b; // @linedetail address public constant community = 0xd83Dd8A288270512b8A46F581A8254CD971dCb09; // stonersrock.eth // Rocks string public imageTx = ''; string public metadataTx = ''; string public baseUri; // Sales uint256 public saleStartBlock = 120250457; uint256 public constant rockPrice = 42069000000000000; //0.042069 ETH uint public constant maxRockPurchase = 20; uint public constant maxRockSupply = 10420; uint public constant maxReserveSupply = 420; // Internals event RockMinted(address minter, address receiver, uint256 tokenId); // Constructor constructor() ERC721("Stoners Rock", "ROCK") { } /* * Getters. */ function getCurrentRockId() public view returns(uint256 currentRockId) { } function getCurrentReserveId() public view returns(uint256 currentRockId) { } function exists(uint256 tokenId) public view returns(bool) { } function saleStarted() public view returns (bool) { } /* * Mint reserved rocks for giveaways and the teams. */ function reserveRocks(uint256 numberOfTokens) public onlyOwner { } function reserveRocks(uint256 numberOfTokens, address receiver) public onlyOwner { } /** * Public function for minting a rock and enforcing requirements. */ function mintRock(uint numberOfTokens) public payable { } function mintRock(uint numberOfTokens, address receiver) public payable { uint256 totalIssued = _tokenIds.current(); require(saleStarted(), "Wait for the sale to start!"); require(numberOfTokens <= maxRockPurchase, "Maximum 20!"); require(<FILL_ME>) require(rockPrice.mul(numberOfTokens) <= msg.value, "Dont fuck around."); for(uint i = 0; i < numberOfTokens; i++) { _tokenIds.increment(); uint256 tokenId = _tokenIds.current(); _safeMint(receiver, tokenId); emit RockMinted(msg.sender, receiver, tokenId); } } /** * External function for getting all rocks by a specific owner. */ function getRocksByOwner(address _owner) view public returns(uint256[] memory) { } /* * Owner setters. */ function setBaseUri(string memory _baseUri) public onlyOwner { } function setSaleStartBlock(uint256 _saleStartBlock) public onlyOwner { } function setProvenance(string memory _imageTx, string memory _metadataTx) public onlyOwner { } /* * Money management. */ function withdraw() public payable onlyOwner { } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { } /* * On chain storage. */ function uploadRockImages(bytes calldata s) external onlyOwner {} function uploadRockAttributes(bytes calldata s) external onlyOwner {} /* * Overrides */ function _baseURI() internal view override returns (string memory) { } receive () external payable virtual {} }
totalIssued.add(numberOfTokens)<=maxRockSupply,"Exceeding max supply!"
10,936
totalIssued.add(numberOfTokens)<=maxRockSupply
"Dont fuck around."
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........../@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@\....(@@@@@@@@@@@@@@@@...........@@@@@@@@@@@@@@@@)..../@@@@@@@@@@@@ // @@@@@@@@@@@@@@@..........@@@@@@@@@%...........@@@@@@@@@@,........,@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@.............@@@@@&...........@@@@@@.............@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@...............@@@...........@@@..............#@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@&...............@...........@...............@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#.......................................@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@...................................@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@.............................@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%.....................&%&&@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@(...........................................%@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@\................................................./@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#,.......&#,...............&#,........,#@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....&@/.@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..,@@@@@/.@@@@@%..,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // Stoners Rock // Smoke weed every day. // // 10,420 on-chain Rock NFTs // https://stonersrock.com // // Twitter: https://twitter.com/mystoners // // Produced by: @sircryptos // Art by: @linedetail // Code by: @altcryp // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract StonersRock is ERC721Burnable, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reserveIds; // Team address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C; // @sarasioux address public constant shaun = 0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50; // @sircryptos address public constant mark = 0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b; // @linedetail address public constant community = 0xd83Dd8A288270512b8A46F581A8254CD971dCb09; // stonersrock.eth // Rocks string public imageTx = ''; string public metadataTx = ''; string public baseUri; // Sales uint256 public saleStartBlock = 120250457; uint256 public constant rockPrice = 42069000000000000; //0.042069 ETH uint public constant maxRockPurchase = 20; uint public constant maxRockSupply = 10420; uint public constant maxReserveSupply = 420; // Internals event RockMinted(address minter, address receiver, uint256 tokenId); // Constructor constructor() ERC721("Stoners Rock", "ROCK") { } /* * Getters. */ function getCurrentRockId() public view returns(uint256 currentRockId) { } function getCurrentReserveId() public view returns(uint256 currentRockId) { } function exists(uint256 tokenId) public view returns(bool) { } function saleStarted() public view returns (bool) { } /* * Mint reserved rocks for giveaways and the teams. */ function reserveRocks(uint256 numberOfTokens) public onlyOwner { } function reserveRocks(uint256 numberOfTokens, address receiver) public onlyOwner { } /** * Public function for minting a rock and enforcing requirements. */ function mintRock(uint numberOfTokens) public payable { } function mintRock(uint numberOfTokens, address receiver) public payable { uint256 totalIssued = _tokenIds.current(); require(saleStarted(), "Wait for the sale to start!"); require(numberOfTokens <= maxRockPurchase, "Maximum 20!"); require(totalIssued.add(numberOfTokens) <= maxRockSupply, "Exceeding max supply!"); require(<FILL_ME>) for(uint i = 0; i < numberOfTokens; i++) { _tokenIds.increment(); uint256 tokenId = _tokenIds.current(); _safeMint(receiver, tokenId); emit RockMinted(msg.sender, receiver, tokenId); } } /** * External function for getting all rocks by a specific owner. */ function getRocksByOwner(address _owner) view public returns(uint256[] memory) { } /* * Owner setters. */ function setBaseUri(string memory _baseUri) public onlyOwner { } function setSaleStartBlock(uint256 _saleStartBlock) public onlyOwner { } function setProvenance(string memory _imageTx, string memory _metadataTx) public onlyOwner { } /* * Money management. */ function withdraw() public payable onlyOwner { } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { } /* * On chain storage. */ function uploadRockImages(bytes calldata s) external onlyOwner {} function uploadRockAttributes(bytes calldata s) external onlyOwner {} /* * Overrides */ function _baseURI() internal view override returns (string memory) { } receive () external payable virtual {} }
rockPrice.mul(numberOfTokens)<=msg.value,"Dont fuck around."
10,936
rockPrice.mul(numberOfTokens)<=msg.value
'Start block cannot be changed once sale has started.'
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........../@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@\....(@@@@@@@@@@@@@@@@...........@@@@@@@@@@@@@@@@)..../@@@@@@@@@@@@ // @@@@@@@@@@@@@@@..........@@@@@@@@@%...........@@@@@@@@@@,........,@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@.............@@@@@&...........@@@@@@.............@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@...............@@@...........@@@..............#@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@&...............@...........@...............@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#.......................................@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@...................................@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@.............................@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%.....................&%&&@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@(...........................................%@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@\................................................./@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#,.......&#,...............&#,........,#@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....&@/.@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..,@@@@@/.@@@@@%..,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // Stoners Rock // Smoke weed every day. // // 10,420 on-chain Rock NFTs // https://stonersrock.com // // Twitter: https://twitter.com/mystoners // // Produced by: @sircryptos // Art by: @linedetail // Code by: @altcryp // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract StonersRock is ERC721Burnable, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reserveIds; // Team address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C; // @sarasioux address public constant shaun = 0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50; // @sircryptos address public constant mark = 0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b; // @linedetail address public constant community = 0xd83Dd8A288270512b8A46F581A8254CD971dCb09; // stonersrock.eth // Rocks string public imageTx = ''; string public metadataTx = ''; string public baseUri; // Sales uint256 public saleStartBlock = 120250457; uint256 public constant rockPrice = 42069000000000000; //0.042069 ETH uint public constant maxRockPurchase = 20; uint public constant maxRockSupply = 10420; uint public constant maxReserveSupply = 420; // Internals event RockMinted(address minter, address receiver, uint256 tokenId); // Constructor constructor() ERC721("Stoners Rock", "ROCK") { } /* * Getters. */ function getCurrentRockId() public view returns(uint256 currentRockId) { } function getCurrentReserveId() public view returns(uint256 currentRockId) { } function exists(uint256 tokenId) public view returns(bool) { } function saleStarted() public view returns (bool) { } /* * Mint reserved rocks for giveaways and the teams. */ function reserveRocks(uint256 numberOfTokens) public onlyOwner { } function reserveRocks(uint256 numberOfTokens, address receiver) public onlyOwner { } /** * Public function for minting a rock and enforcing requirements. */ function mintRock(uint numberOfTokens) public payable { } function mintRock(uint numberOfTokens, address receiver) public payable { } /** * External function for getting all rocks by a specific owner. */ function getRocksByOwner(address _owner) view public returns(uint256[] memory) { } /* * Owner setters. */ function setBaseUri(string memory _baseUri) public onlyOwner { } function setSaleStartBlock(uint256 _saleStartBlock) public onlyOwner { require(<FILL_ME>) saleStartBlock = _saleStartBlock; } function setProvenance(string memory _imageTx, string memory _metadataTx) public onlyOwner { } /* * Money management. */ function withdraw() public payable onlyOwner { } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { } /* * On chain storage. */ function uploadRockImages(bytes calldata s) external onlyOwner {} function uploadRockAttributes(bytes calldata s) external onlyOwner {} /* * Overrides */ function _baseURI() internal view override returns (string memory) { } receive () external payable virtual {} }
!saleStarted(),'Start block cannot be changed once sale has started.'
10,936
!saleStarted()
null
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........../@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@\....(@@@@@@@@@@@@@@@@...........@@@@@@@@@@@@@@@@)..../@@@@@@@@@@@@ // @@@@@@@@@@@@@@@..........@@@@@@@@@%...........@@@@@@@@@@,........,@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@.............@@@@@&...........@@@@@@.............@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@...............@@@...........@@@..............#@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@&...............@...........@...............@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#.......................................@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@...................................@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@.............................@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%.....................&%&&@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@(...........................................%@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@\................................................./@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#,.......&#,...............&#,........,#@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....&@/.@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..,@@@@@/.@@@@@%..,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // Stoners Rock // Smoke weed every day. // // 10,420 on-chain Rock NFTs // https://stonersrock.com // // Twitter: https://twitter.com/mystoners // // Produced by: @sircryptos // Art by: @linedetail // Code by: @altcryp // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract StonersRock is ERC721Burnable, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reserveIds; // Team address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C; // @sarasioux address public constant shaun = 0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50; // @sircryptos address public constant mark = 0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b; // @linedetail address public constant community = 0xd83Dd8A288270512b8A46F581A8254CD971dCb09; // stonersrock.eth // Rocks string public imageTx = ''; string public metadataTx = ''; string public baseUri; // Sales uint256 public saleStartBlock = 120250457; uint256 public constant rockPrice = 42069000000000000; //0.042069 ETH uint public constant maxRockPurchase = 20; uint public constant maxRockSupply = 10420; uint public constant maxReserveSupply = 420; // Internals event RockMinted(address minter, address receiver, uint256 tokenId); // Constructor constructor() ERC721("Stoners Rock", "ROCK") { } /* * Getters. */ function getCurrentRockId() public view returns(uint256 currentRockId) { } function getCurrentReserveId() public view returns(uint256 currentRockId) { } function exists(uint256 tokenId) public view returns(bool) { } function saleStarted() public view returns (bool) { } /* * Mint reserved rocks for giveaways and the teams. */ function reserveRocks(uint256 numberOfTokens) public onlyOwner { } function reserveRocks(uint256 numberOfTokens, address receiver) public onlyOwner { } /** * Public function for minting a rock and enforcing requirements. */ function mintRock(uint numberOfTokens) public payable { } function mintRock(uint numberOfTokens, address receiver) public payable { } /** * External function for getting all rocks by a specific owner. */ function getRocksByOwner(address _owner) view public returns(uint256[] memory) { } /* * Owner setters. */ function setBaseUri(string memory _baseUri) public onlyOwner { } function setSaleStartBlock(uint256 _saleStartBlock) public onlyOwner { } function setProvenance(string memory _imageTx, string memory _metadataTx) public onlyOwner { } /* * Money management. */ function withdraw() public payable onlyOwner { uint256 _each = address(this).balance / 4; require(<FILL_ME>) require(payable(shaun).send(_each)); require(payable(mark).send(_each)); require(payable(community).send(_each)); } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { } /* * On chain storage. */ function uploadRockImages(bytes calldata s) external onlyOwner {} function uploadRockAttributes(bytes calldata s) external onlyOwner {} /* * Overrides */ function _baseURI() internal view override returns (string memory) { } receive () external payable virtual {} }
payable(sara).send(_each)
10,936
payable(sara).send(_each)
null
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........../@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@\....(@@@@@@@@@@@@@@@@...........@@@@@@@@@@@@@@@@)..../@@@@@@@@@@@@ // @@@@@@@@@@@@@@@..........@@@@@@@@@%...........@@@@@@@@@@,........,@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@.............@@@@@&...........@@@@@@.............@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@...............@@@...........@@@..............#@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@&...............@...........@...............@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#.......................................@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@...................................@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@.............................@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%.....................&%&&@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@(...........................................%@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@\................................................./@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#,.......&#,...............&#,........,#@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....&@/.@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..,@@@@@/.@@@@@%..,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // Stoners Rock // Smoke weed every day. // // 10,420 on-chain Rock NFTs // https://stonersrock.com // // Twitter: https://twitter.com/mystoners // // Produced by: @sircryptos // Art by: @linedetail // Code by: @altcryp // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract StonersRock is ERC721Burnable, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reserveIds; // Team address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C; // @sarasioux address public constant shaun = 0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50; // @sircryptos address public constant mark = 0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b; // @linedetail address public constant community = 0xd83Dd8A288270512b8A46F581A8254CD971dCb09; // stonersrock.eth // Rocks string public imageTx = ''; string public metadataTx = ''; string public baseUri; // Sales uint256 public saleStartBlock = 120250457; uint256 public constant rockPrice = 42069000000000000; //0.042069 ETH uint public constant maxRockPurchase = 20; uint public constant maxRockSupply = 10420; uint public constant maxReserveSupply = 420; // Internals event RockMinted(address minter, address receiver, uint256 tokenId); // Constructor constructor() ERC721("Stoners Rock", "ROCK") { } /* * Getters. */ function getCurrentRockId() public view returns(uint256 currentRockId) { } function getCurrentReserveId() public view returns(uint256 currentRockId) { } function exists(uint256 tokenId) public view returns(bool) { } function saleStarted() public view returns (bool) { } /* * Mint reserved rocks for giveaways and the teams. */ function reserveRocks(uint256 numberOfTokens) public onlyOwner { } function reserveRocks(uint256 numberOfTokens, address receiver) public onlyOwner { } /** * Public function for minting a rock and enforcing requirements. */ function mintRock(uint numberOfTokens) public payable { } function mintRock(uint numberOfTokens, address receiver) public payable { } /** * External function for getting all rocks by a specific owner. */ function getRocksByOwner(address _owner) view public returns(uint256[] memory) { } /* * Owner setters. */ function setBaseUri(string memory _baseUri) public onlyOwner { } function setSaleStartBlock(uint256 _saleStartBlock) public onlyOwner { } function setProvenance(string memory _imageTx, string memory _metadataTx) public onlyOwner { } /* * Money management. */ function withdraw() public payable onlyOwner { uint256 _each = address(this).balance / 4; require(payable(sara).send(_each)); require(<FILL_ME>) require(payable(mark).send(_each)); require(payable(community).send(_each)); } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { } /* * On chain storage. */ function uploadRockImages(bytes calldata s) external onlyOwner {} function uploadRockAttributes(bytes calldata s) external onlyOwner {} /* * Overrides */ function _baseURI() internal view override returns (string memory) { } receive () external payable virtual {} }
payable(shaun).send(_each)
10,936
payable(shaun).send(_each)
null
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........../@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@\....(@@@@@@@@@@@@@@@@...........@@@@@@@@@@@@@@@@)..../@@@@@@@@@@@@ // @@@@@@@@@@@@@@@..........@@@@@@@@@%...........@@@@@@@@@@,........,@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@.............@@@@@&...........@@@@@@.............@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@...............@@@...........@@@..............#@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@&...............@...........@...............@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#.......................................@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@...................................@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@.............................@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%.....................&%&&@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@(...........................................%@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@\................................................./@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#,.......&#,...............&#,........,#@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....&@/.@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..,@@@@@/.@@@@@%..,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // Stoners Rock // Smoke weed every day. // // 10,420 on-chain Rock NFTs // https://stonersrock.com // // Twitter: https://twitter.com/mystoners // // Produced by: @sircryptos // Art by: @linedetail // Code by: @altcryp // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract StonersRock is ERC721Burnable, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reserveIds; // Team address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C; // @sarasioux address public constant shaun = 0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50; // @sircryptos address public constant mark = 0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b; // @linedetail address public constant community = 0xd83Dd8A288270512b8A46F581A8254CD971dCb09; // stonersrock.eth // Rocks string public imageTx = ''; string public metadataTx = ''; string public baseUri; // Sales uint256 public saleStartBlock = 120250457; uint256 public constant rockPrice = 42069000000000000; //0.042069 ETH uint public constant maxRockPurchase = 20; uint public constant maxRockSupply = 10420; uint public constant maxReserveSupply = 420; // Internals event RockMinted(address minter, address receiver, uint256 tokenId); // Constructor constructor() ERC721("Stoners Rock", "ROCK") { } /* * Getters. */ function getCurrentRockId() public view returns(uint256 currentRockId) { } function getCurrentReserveId() public view returns(uint256 currentRockId) { } function exists(uint256 tokenId) public view returns(bool) { } function saleStarted() public view returns (bool) { } /* * Mint reserved rocks for giveaways and the teams. */ function reserveRocks(uint256 numberOfTokens) public onlyOwner { } function reserveRocks(uint256 numberOfTokens, address receiver) public onlyOwner { } /** * Public function for minting a rock and enforcing requirements. */ function mintRock(uint numberOfTokens) public payable { } function mintRock(uint numberOfTokens, address receiver) public payable { } /** * External function for getting all rocks by a specific owner. */ function getRocksByOwner(address _owner) view public returns(uint256[] memory) { } /* * Owner setters. */ function setBaseUri(string memory _baseUri) public onlyOwner { } function setSaleStartBlock(uint256 _saleStartBlock) public onlyOwner { } function setProvenance(string memory _imageTx, string memory _metadataTx) public onlyOwner { } /* * Money management. */ function withdraw() public payable onlyOwner { uint256 _each = address(this).balance / 4; require(payable(sara).send(_each)); require(payable(shaun).send(_each)); require(<FILL_ME>) require(payable(community).send(_each)); } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { } /* * On chain storage. */ function uploadRockImages(bytes calldata s) external onlyOwner {} function uploadRockAttributes(bytes calldata s) external onlyOwner {} /* * Overrides */ function _baseURI() internal view override returns (string memory) { } receive () external payable virtual {} }
payable(mark).send(_each)
10,936
payable(mark).send(_each)
null
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/\@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,.......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@........../@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@\....(@@@@@@@@@@@@@@@@...........@@@@@@@@@@@@@@@@)..../@@@@@@@@@@@@ // @@@@@@@@@@@@@@@..........@@@@@@@@@%...........@@@@@@@@@@,........,@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@.............@@@@@&...........@@@@@@.............@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@...............@@@...........@@@..............#@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@&...............@...........@...............@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#.......................................@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@...................................@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@.............................@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@&%%%.....................&%&&@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@(...........................................%@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@\................................................./@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@#,.......&#,...............&#,........,#@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.....&@/.@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@..,@@@@@/.@@@@@%..,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // Stoners Rock // Smoke weed every day. // // 10,420 on-chain Rock NFTs // https://stonersrock.com // // Twitter: https://twitter.com/mystoners // // Produced by: @sircryptos // Art by: @linedetail // Code by: @altcryp // // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; contract StonersRock is ERC721Burnable, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; Counters.Counter private _tokenIds; Counters.Counter private _reserveIds; // Team address public constant sara = 0x00796e910Bd0228ddF4cd79e3f353871a61C351C; // @sarasioux address public constant shaun = 0x7fc55376D5A29e0Ee86C18C81bb2fC8F9f490E50; // @sircryptos address public constant mark = 0xB58Fb5372e9Aa0C86c3B281179c05Af3bB7a181b; // @linedetail address public constant community = 0xd83Dd8A288270512b8A46F581A8254CD971dCb09; // stonersrock.eth // Rocks string public imageTx = ''; string public metadataTx = ''; string public baseUri; // Sales uint256 public saleStartBlock = 120250457; uint256 public constant rockPrice = 42069000000000000; //0.042069 ETH uint public constant maxRockPurchase = 20; uint public constant maxRockSupply = 10420; uint public constant maxReserveSupply = 420; // Internals event RockMinted(address minter, address receiver, uint256 tokenId); // Constructor constructor() ERC721("Stoners Rock", "ROCK") { } /* * Getters. */ function getCurrentRockId() public view returns(uint256 currentRockId) { } function getCurrentReserveId() public view returns(uint256 currentRockId) { } function exists(uint256 tokenId) public view returns(bool) { } function saleStarted() public view returns (bool) { } /* * Mint reserved rocks for giveaways and the teams. */ function reserveRocks(uint256 numberOfTokens) public onlyOwner { } function reserveRocks(uint256 numberOfTokens, address receiver) public onlyOwner { } /** * Public function for minting a rock and enforcing requirements. */ function mintRock(uint numberOfTokens) public payable { } function mintRock(uint numberOfTokens, address receiver) public payable { } /** * External function for getting all rocks by a specific owner. */ function getRocksByOwner(address _owner) view public returns(uint256[] memory) { } /* * Owner setters. */ function setBaseUri(string memory _baseUri) public onlyOwner { } function setSaleStartBlock(uint256 _saleStartBlock) public onlyOwner { } function setProvenance(string memory _imageTx, string memory _metadataTx) public onlyOwner { } /* * Money management. */ function withdraw() public payable onlyOwner { uint256 _each = address(this).balance / 4; require(payable(sara).send(_each)); require(payable(shaun).send(_each)); require(payable(mark).send(_each)); require(<FILL_ME>) } function forwardERC20s(IERC20 _token, uint256 _amount) public onlyOwner { } /* * On chain storage. */ function uploadRockImages(bytes calldata s) external onlyOwner {} function uploadRockAttributes(bytes calldata s) external onlyOwner {} /* * Overrides */ function _baseURI() internal view override returns (string memory) { } receive () external payable virtual {} }
payable(community).send(_each)
10,936
payable(community).send(_each)
"ERC721K: token already minted"
// SPDX-License-Identifier: MIT /** * ERC721Keg is a slight modification from the recently created ERC721A standard to meet * the Keg Plebs needs. */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; struct AddressStats { uint128 balance; uint128 totalMints; } string private _name; string private _symbol; uint256 private currentMintCount = 0; mapping(uint256 => address) private _owners; mapping(address => AddressStats) private _addressStats; mapping(uint256 => address) private _tokenApprovals; mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { } /** * @dev */ function totalSupply() public view returns (uint256) { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { } function _totalMints(address owner) internal view returns (uint256) { } /** * @dev Helper function for ownerOf() */ function findOwner(uint256 tokenId) internal view returns (address) { } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { } /** * @dev See {IERC721Metadata-name}. */ function name() external view virtual override returns (string memory) { } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() external view virtual override returns (string memory) { } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) external virtual override { } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) external virtual override { } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) external virtual override { } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by who owns them or approved accounts via {approve} or {setApprovalForAll}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId, address owner) internal view virtual returns (bool) { } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 _mintAmt) internal virtual { } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - there must be `quantity` tokens remaining unminted in the total collection. * - `to` cannot be the zero address * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 _mintAmt, bytes memory _data ) internal { require(to != address(0), "ERC721Keg: mint to the zero address"); uint256 firstTokenId = currentMintCount; require(<FILL_ME>) _beforeTokenTransfer(address(0), to, firstTokenId, _mintAmt); _owners[firstTokenId] = to; // set the id to the minter's addi AddressStats memory addressStats = _addressStats[to]; _addressStats[to] = AddressStats( addressStats.balance + uint128(_mintAmt), addressStats.totalMints + uint128(_mintAmt) ); uint256 updatedIndex = firstTokenId; for(uint128 i = 0; i < _mintAmt; i++) { emit Transfer(address(0), to, updatedIndex); require( _checkOnERC721Received(address(0), to, updatedIndex, _data), "ERC721Keg: transfer to non ERC721Receiver implementer" ); updatedIndex++; } currentMintCount = updatedIndex; } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal { } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId, address owner) internal virtual { } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint mintAmt ) internal virtual {} }
!_exists(firstTokenId),"ERC721K: token already minted"
10,970
!_exists(firstTokenId)
"ERC721Keg: transfer to non ERC721Receiver implementer"
// SPDX-License-Identifier: MIT /** * ERC721Keg is a slight modification from the recently created ERC721A standard to meet * the Keg Plebs needs. */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; struct AddressStats { uint128 balance; uint128 totalMints; } string private _name; string private _symbol; uint256 private currentMintCount = 0; mapping(uint256 => address) private _owners; mapping(address => AddressStats) private _addressStats; mapping(uint256 => address) private _tokenApprovals; mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { } /** * @dev */ function totalSupply() public view returns (uint256) { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { } function _totalMints(address owner) internal view returns (uint256) { } /** * @dev Helper function for ownerOf() */ function findOwner(uint256 tokenId) internal view returns (address) { } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { } /** * @dev See {IERC721Metadata-name}. */ function name() external view virtual override returns (string memory) { } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() external view virtual override returns (string memory) { } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) external virtual override { } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) external virtual override { } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) external virtual override { } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by who owns them or approved accounts via {approve} or {setApprovalForAll}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId, address owner) internal view virtual returns (bool) { } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 _mintAmt) internal virtual { } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - there must be `quantity` tokens remaining unminted in the total collection. * - `to` cannot be the zero address * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 _mintAmt, bytes memory _data ) internal { require(to != address(0), "ERC721Keg: mint to the zero address"); uint256 firstTokenId = currentMintCount; require(!_exists(firstTokenId), "ERC721K: token already minted"); _beforeTokenTransfer(address(0), to, firstTokenId, _mintAmt); _owners[firstTokenId] = to; // set the id to the minter's addi AddressStats memory addressStats = _addressStats[to]; _addressStats[to] = AddressStats( addressStats.balance + uint128(_mintAmt), addressStats.totalMints + uint128(_mintAmt) ); uint256 updatedIndex = firstTokenId; for(uint128 i = 0; i < _mintAmt; i++) { emit Transfer(address(0), to, updatedIndex); require(<FILL_ME>) updatedIndex++; } currentMintCount = updatedIndex; } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal { } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId, address owner) internal virtual { } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint mintAmt ) internal virtual {} }
_checkOnERC721Received(address(0),to,updatedIndex,_data),"ERC721Keg: transfer to non ERC721Receiver implementer"
10,970
_checkOnERC721Received(address(0),to,updatedIndex,_data)
"ERC721Keg: transfer not called by owner or approved of."
// SPDX-License-Identifier: MIT /** * ERC721Keg is a slight modification from the recently created ERC721A standard to meet * the Keg Plebs needs. */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; struct AddressStats { uint128 balance; uint128 totalMints; } string private _name; string private _symbol; uint256 private currentMintCount = 0; mapping(uint256 => address) private _owners; mapping(address => AddressStats) private _addressStats; mapping(uint256 => address) private _tokenApprovals; mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { } /** * @dev */ function totalSupply() public view returns (uint256) { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { } function _totalMints(address owner) internal view returns (uint256) { } /** * @dev Helper function for ownerOf() */ function findOwner(uint256 tokenId) internal view returns (address) { } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { } /** * @dev See {IERC721Metadata-name}. */ function name() external view virtual override returns (string memory) { } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() external view virtual override returns (string memory) { } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) external virtual override { } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) external virtual override { } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) external virtual override { } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by who owns them or approved accounts via {approve} or {setApprovalForAll}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId, address owner) internal view virtual returns (bool) { } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 _mintAmt) internal virtual { } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - there must be `quantity` tokens remaining unminted in the total collection. * - `to` cannot be the zero address * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 _mintAmt, bytes memory _data ) internal { } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal { address currOwner = findOwner(tokenId); require(<FILL_ME>) require( currOwner == from, "ERC721Keg: transfer of token that is not own." ); require(to != address(0), "ERC721Keg: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, currOwner); _addressStats[from].balance -= 1; _addressStats[to].balance += 1; _owners[tokenId] = to; // check/update the following token id if(_owners[tokenId + 1] == address(0)) { if(_exists(tokenId + 1)) { _owners[tokenId + 1] = currOwner; } } emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId, address owner) internal virtual { } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint mintAmt ) internal virtual {} }
_isApprovedOrOwner(_msgSender(),tokenId,currOwner),"ERC721Keg: transfer not called by owner or approved of."
10,970
_isApprovedOrOwner(_msgSender(),tokenId,currOwner)
"Account state has already been proven."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { // Exit quickly to avoid unnecessary work. require(<FILL_ME>) // Function will fail if the proof is not a valid inclusion or exclusion proof. ( bool exists, bytes memory encodedAccount ) = Lib_SecureMerkleTrie.get( abi.encodePacked(_ovmContractAddress), _stateTrieWitness, preStateRoot ); if (exists == true) { // Account exists, this was an inclusion proof. Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount( encodedAccount ); address ethContractAddress = _ethContractAddress; if (account.codeHash == EMPTY_ACCOUNT_CODE_HASH) { // Use a known empty contract to prevent an attack in which a user provides a // contract address here and then later deploys code to it. ethContractAddress = 0x0000000000000000000000000000000000000000; } else { // Otherwise, make sure that the code at the provided eth address matches the hash // of the code stored on L2. require( Lib_EthUtils.getCodeHash(ethContractAddress) == account.codeHash, // solhint-disable-next-line max-line-length "OVM_StateTransitioner: Provided L1 contract code hash does not match L2 contract code hash." ); } ovmStateManager.putAccount( _ovmContractAddress, Lib_OVMCodec.Account({ nonce: account.nonce, balance: account.balance, storageRoot: account.storageRoot, codeHash: account.codeHash, ethAddress: ethContractAddress, isFresh: false }) ); } else { // Account does not exist, this was an exclusion proof. ovmStateManager.putEmptyAccount(_ovmContractAddress); } } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { } }
(ovmStateManager.hasAccount(_ovmContractAddress)==false&&ovmStateManager.hasEmptyAccount(_ovmContractAddress)==false),"Account state has already been proven."
11,008
(ovmStateManager.hasAccount(_ovmContractAddress)==false&&ovmStateManager.hasEmptyAccount(_ovmContractAddress)==false)
"OVM_StateTransitioner: Provided L1 contract code hash does not match L2 contract code hash."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { // Exit quickly to avoid unnecessary work. require( ( ovmStateManager.hasAccount(_ovmContractAddress) == false && ovmStateManager.hasEmptyAccount(_ovmContractAddress) == false ), "Account state has already been proven." ); // Function will fail if the proof is not a valid inclusion or exclusion proof. ( bool exists, bytes memory encodedAccount ) = Lib_SecureMerkleTrie.get( abi.encodePacked(_ovmContractAddress), _stateTrieWitness, preStateRoot ); if (exists == true) { // Account exists, this was an inclusion proof. Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount( encodedAccount ); address ethContractAddress = _ethContractAddress; if (account.codeHash == EMPTY_ACCOUNT_CODE_HASH) { // Use a known empty contract to prevent an attack in which a user provides a // contract address here and then later deploys code to it. ethContractAddress = 0x0000000000000000000000000000000000000000; } else { // Otherwise, make sure that the code at the provided eth address matches the hash // of the code stored on L2. require(<FILL_ME>) } ovmStateManager.putAccount( _ovmContractAddress, Lib_OVMCodec.Account({ nonce: account.nonce, balance: account.balance, storageRoot: account.storageRoot, codeHash: account.codeHash, ethAddress: ethContractAddress, isFresh: false }) ); } else { // Account does not exist, this was an exclusion proof. ovmStateManager.putEmptyAccount(_ovmContractAddress); } } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { } }
Lib_EthUtils.getCodeHash(ethContractAddress)==account.codeHash,"OVM_StateTransitioner: Provided L1 contract code hash does not match L2 contract code hash."
11,008
Lib_EthUtils.getCodeHash(ethContractAddress)==account.codeHash
"Storage slot has already been proven."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { // Exit quickly to avoid unnecessary work. require(<FILL_ME>) require( ovmStateManager.hasAccount(_ovmContractAddress) == true, "Contract must be verified before proving a storage slot." ); bytes32 storageRoot = ovmStateManager.getAccountStorageRoot(_ovmContractAddress); bytes32 value; if (storageRoot == EMPTY_ACCOUNT_STORAGE_ROOT) { // Storage trie was empty, so the user is always allowed to insert zero-byte values. value = bytes32(0); } else { // Function will fail if the proof is not a valid inclusion or exclusion proof. ( bool exists, bytes memory encodedValue ) = Lib_SecureMerkleTrie.get( abi.encodePacked(_key), _storageTrieWitness, storageRoot ); if (exists == true) { // Inclusion proof. // Stored values are RLP encoded, with leading zeros removed. value = Lib_BytesUtils.toBytes32PadLeft( Lib_RLPReader.readBytes(encodedValue) ); } else { // Exclusion proof, can only be zero bytes. value = bytes32(0); } } ovmStateManager.putContractStorage( _ovmContractAddress, _key, value ); } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { } }
ovmStateManager.hasContractStorage(_ovmContractAddress,_key)==false,"Storage slot has already been proven."
11,008
ovmStateManager.hasContractStorage(_ovmContractAddress,_key)==false
"Contract must be verified before proving a storage slot."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { // Exit quickly to avoid unnecessary work. require( ovmStateManager.hasContractStorage(_ovmContractAddress, _key) == false, "Storage slot has already been proven." ); require(<FILL_ME>) bytes32 storageRoot = ovmStateManager.getAccountStorageRoot(_ovmContractAddress); bytes32 value; if (storageRoot == EMPTY_ACCOUNT_STORAGE_ROOT) { // Storage trie was empty, so the user is always allowed to insert zero-byte values. value = bytes32(0); } else { // Function will fail if the proof is not a valid inclusion or exclusion proof. ( bool exists, bytes memory encodedValue ) = Lib_SecureMerkleTrie.get( abi.encodePacked(_key), _storageTrieWitness, storageRoot ); if (exists == true) { // Inclusion proof. // Stored values are RLP encoded, with leading zeros removed. value = Lib_BytesUtils.toBytes32PadLeft( Lib_RLPReader.readBytes(encodedValue) ); } else { // Exclusion proof, can only be zero bytes. value = bytes32(0); } } ovmStateManager.putContractStorage( _ovmContractAddress, _key, value ); } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { } }
ovmStateManager.hasAccount(_ovmContractAddress)==true,"Contract must be verified before proving a storage slot."
11,008
ovmStateManager.hasAccount(_ovmContractAddress)==true
"Invalid transaction provided."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { require(<FILL_ME>) // We require gas to complete the logic here in run() before/after execution, // But must ensure the full _tx.gasLimit can be given to the ovmCALL (determinism) // This includes 1/64 of the gas getting lost because of EIP-150 (lost twice--first // going into EM, then going into the code contract). require( // 1032/1000 = 1.032 = (64/63)^2 rounded up gasleft() >= 100000 + _transaction.gasLimit * 1032 / 1000, "Not enough gas to execute transaction deterministically." ); iOVM_ExecutionManager ovmExecutionManager = iOVM_ExecutionManager(resolve("OVM_ExecutionManager")); // We call `setExecutionManager` right before `run` (and not earlier) just in case the // OVM_ExecutionManager address was updated between the time when this contract was created // and when `applyTransaction` was called. ovmStateManager.setExecutionManager(address(ovmExecutionManager)); // `run` always succeeds *unless* the user hasn't provided enough gas to `applyTransaction` // or an INVALID_STATE_ACCESS flag was triggered. Either way, we won't get beyond this line // if that's the case. ovmExecutionManager.run(_transaction, address(ovmStateManager)); // Prevent the Execution Manager from calling this SM again. ovmStateManager.setExecutionManager(address(0)); phase = TransitionPhase.POST_EXECUTION; } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { } }
Lib_OVMCodec.hashTransaction(_transaction)==transactionHash,"Invalid transaction provided."
11,008
Lib_OVMCodec.hashTransaction(_transaction)==transactionHash
"Not enough gas to execute transaction deterministically."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { require( Lib_OVMCodec.hashTransaction(_transaction) == transactionHash, "Invalid transaction provided." ); // We require gas to complete the logic here in run() before/after execution, // But must ensure the full _tx.gasLimit can be given to the ovmCALL (determinism) // This includes 1/64 of the gas getting lost because of EIP-150 (lost twice--first // going into EM, then going into the code contract). require(<FILL_ME>) iOVM_ExecutionManager ovmExecutionManager = iOVM_ExecutionManager(resolve("OVM_ExecutionManager")); // We call `setExecutionManager` right before `run` (and not earlier) just in case the // OVM_ExecutionManager address was updated between the time when this contract was created // and when `applyTransaction` was called. ovmStateManager.setExecutionManager(address(ovmExecutionManager)); // `run` always succeeds *unless* the user hasn't provided enough gas to `applyTransaction` // or an INVALID_STATE_ACCESS flag was triggered. Either way, we won't get beyond this line // if that's the case. ovmExecutionManager.run(_transaction, address(ovmStateManager)); // Prevent the Execution Manager from calling this SM again. ovmStateManager.setExecutionManager(address(0)); phase = TransitionPhase.POST_EXECUTION; } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { } }
gasleft()>=100000+_transaction.gasLimit*1032/1000,"Not enough gas to execute transaction deterministically."
11,008
gasleft()>=100000+_transaction.gasLimit*1032/1000
"All storage must be committed before committing account states."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { require(<FILL_ME>) require ( ovmStateManager.commitAccount(_ovmContractAddress) == true, "Account state wasn't changed or has already been committed." ); Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress); postStateRoot = Lib_SecureMerkleTrie.update( abi.encodePacked(_ovmContractAddress), Lib_OVMCodec.encodeEVMAccount( Lib_OVMCodec.toEVMAccount(account) ), _stateTrieWitness, postStateRoot ); // Emit an event to help clients figure out the proof ordering. emit AccountCommitted( _ovmContractAddress ); } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { } }
ovmStateManager.getTotalUncommittedContractStorage()==0,"All storage must be committed before committing account states."
11,008
ovmStateManager.getTotalUncommittedContractStorage()==0
"Account state wasn't changed or has already been committed."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { require( ovmStateManager.getTotalUncommittedContractStorage() == 0, "All storage must be committed before committing account states." ); require(<FILL_ME>) Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress); postStateRoot = Lib_SecureMerkleTrie.update( abi.encodePacked(_ovmContractAddress), Lib_OVMCodec.encodeEVMAccount( Lib_OVMCodec.toEVMAccount(account) ), _stateTrieWitness, postStateRoot ); // Emit an event to help clients figure out the proof ordering. emit AccountCommitted( _ovmContractAddress ); } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { } }
ovmStateManager.commitAccount(_ovmContractAddress)==true,"Account state wasn't changed or has already been committed."
11,008
ovmStateManager.commitAccount(_ovmContractAddress)==true
"Storage slot value wasn't changed or has already been committed."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { require(<FILL_ME>) Lib_OVMCodec.Account memory account = ovmStateManager.getAccount(_ovmContractAddress); bytes32 value = ovmStateManager.getContractStorage(_ovmContractAddress, _key); account.storageRoot = Lib_SecureMerkleTrie.update( abi.encodePacked(_key), Lib_RLPWriter.writeBytes( Lib_Bytes32Utils.removeLeadingZeros(value) ), _storageTrieWitness, account.storageRoot ); ovmStateManager.putAccount(_ovmContractAddress, account); // Emit an event to help clients figure out the proof ordering. emit ContractStorageCommitted( _ovmContractAddress, _key ); } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { } }
ovmStateManager.commitContractStorage(_ovmContractAddress,_key)==true,"Storage slot value wasn't changed or has already been committed."
11,008
ovmStateManager.commitContractStorage(_ovmContractAddress,_key)==true
"All accounts must be committed before completing a transition."
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; import { Lib_EthUtils } from "../../libraries/utils/Lib_EthUtils.sol"; import { Lib_Bytes32Utils } from "../../libraries/utils/Lib_Bytes32Utils.sol"; import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol"; import { Lib_RLPWriter } from "../../libraries/rlp/Lib_RLPWriter.sol"; import { Lib_RLPReader } from "../../libraries/rlp/Lib_RLPReader.sol"; /* Interface Imports */ import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_ExecutionManager } from "../../iOVM/execution/iOVM_ExecutionManager.sol"; import { iOVM_StateManager } from "../../iOVM/execution/iOVM_StateManager.sol"; import { iOVM_StateManagerFactory } from "../../iOVM/execution/iOVM_StateManagerFactory.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_StateTransitioner * @dev The State Transitioner coordinates the execution of a state transition during the evaluation * of a fraud proof. It feeds verified input to the Execution Manager's run(), and controls a * State Manager (which is uniquely created for each fraud proof). * Once a fraud proof has been initialized, this contract is provided with the pre-state root and * verifies that the OVM storage slots committed to the State Mangager are contained in that state * This contract controls the State Manager and Execution Manager, and uses them to calculate the * post-state root by applying the transaction. The Fraud Verifier can then check for fraud by * comparing the calculated post-state root with the proposed post-state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOVM_StateTransitioner { /******************* * Data Structures * *******************/ enum TransitionPhase { PRE_EXECUTION, POST_EXECUTION, COMPLETE } /******************************************* * Contract Variables: Contract References * *******************************************/ iOVM_StateManager public ovmStateManager; /******************************************* * Contract Variables: Internal Accounting * *******************************************/ bytes32 internal preStateRoot; bytes32 internal postStateRoot; TransitionPhase public phase; uint256 internal stateTransitionIndex; bytes32 internal transactionHash; /************* * Constants * *************/ // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_CODE_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line max-line-length bytes32 internal constant EMPTY_ACCOUNT_STORAGE_ROOT = 0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. * @param _stateTransitionIndex Index of the state transition being verified. * @param _preStateRoot State root before the transition was executed. * @param _transactionHash Hash of the executed transaction. */ constructor( address _libAddressManager, uint256 _stateTransitionIndex, bytes32 _preStateRoot, bytes32 _transactionHash ) Lib_AddressResolver(_libAddressManager) { } /********************** * Function Modifiers * **********************/ /** * Checks that a function is only run during a specific phase. * @param _phase Phase the function must run within. */ modifier onlyDuringPhase( TransitionPhase _phase ) { } /********************************** * Public Functions: State Access * **********************************/ /** * Retrieves the state root before execution. * @return _preStateRoot State root before execution. */ function getPreStateRoot() override external view returns ( bytes32 _preStateRoot ) { } /** * Retrieves the state root after execution. * @return _postStateRoot State root after execution. */ function getPostStateRoot() override external view returns ( bytes32 _postStateRoot ) { } /** * Checks whether the transitioner is complete. * @return _complete Whether or not the transition process is finished. */ function isComplete() override external view returns ( bool _complete ) { } /*********************************** * Public Functions: Pre-Execution * ***********************************/ /** * Allows a user to prove the initial state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _ethContractAddress Address of the corresponding contract on L1. * @param _stateTrieWitness Proof of the account state. */ function proveContractState( address _ovmContractAddress, address _ethContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to prove the initial state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function proveStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /******************************* * Public Functions: Execution * *******************************/ /** * Executes the state transition. * @param _transaction OVM transaction to execute. */ function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /************************************ * Public Functions: Post-Execution * ************************************/ /** * Allows a user to commit the final state of a contract. * @param _ovmContractAddress Address of the contract on the OVM. * @param _stateTrieWitness Proof of the account state. */ function commitContractState( address _ovmContractAddress, bytes memory _stateTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /** * Allows a user to commit the final state of a contract storage slot. * @param _ovmContractAddress Address of the contract on the OVM. * @param _key Claimed account slot key. * @param _storageTrieWitness Proof of the storage slot. */ function commitStorageSlot( address _ovmContractAddress, bytes32 _key, bytes memory _storageTrieWitness ) override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { } /********************************** * Public Functions: Finalization * **********************************/ /** * Finalizes the transition process. */ function completeTransition() override external onlyDuringPhase(TransitionPhase.POST_EXECUTION) { require(<FILL_ME>) require( ovmStateManager.getTotalUncommittedContractStorage() == 0, "All storage must be committed before completing a transition." ); phase = TransitionPhase.COMPLETE; } }
ovmStateManager.getTotalUncommittedAccounts()==0,"All accounts must be committed before completing a transition."
11,008
ovmStateManager.getTotalUncommittedAccounts()==0
"Invalid pre-state root inclusion proof."
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_StateTransitionerFactory } from "../../iOVM/verification/iOVM_StateTransitionerFactory.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_StateCommitmentChain } from "../../iOVM/chain/iOVM_StateCommitmentChain.sol"; import { iOVM_CanonicalTransactionChain } from "../../iOVM/chain/iOVM_CanonicalTransactionChain.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_FraudVerifier * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. * If the fraud proof was successful it prunes any state batches from State Commitment Chain * which were published after the fraudulent state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier { /******************************************* * Contract Variables: Internal Accounting * *******************************************/ mapping (bytes32 => iOVM_StateTransitioner) internal transitioners; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. */ constructor( address _libAddressManager ) Lib_AddressResolver(_libAddressManager) {} /*************************************** * Public Functions: Transition Status * ***************************************/ /** * Retrieves the state transitioner for a given root. * @param _preStateRoot State root to query a transitioner for. * @return _transitioner Corresponding state transitioner contract. */ function getStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) override public view returns ( iOVM_StateTransitioner _transitioner ) { } /**************************************** * Public Functions: Fraud Verification * ****************************************/ /** * Begins the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _transaction OVM transaction claimed to be fraudulent. * @param _txChainElement OVM transaction chain element. * @param _transactionBatchHeader Batch header for the provided transaction. * @param _transactionProof Inclusion proof for the provided transaction. */ function initializeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, Lib_OVMCodec.Transaction memory _transaction, Lib_OVMCodec.TransactionChainElement memory _txChainElement, Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _transactionProof ) override public contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction)) { bytes32 _txHash = Lib_OVMCodec.hashTransaction(_transaction); if (_hasStateTransitioner(_preStateRoot, _txHash)) { return; } iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve("OVM_StateCommitmentChain")); iOVM_CanonicalTransactionChain ovmCanonicalTransactionChain = iOVM_CanonicalTransactionChain(resolve("OVM_CanonicalTransactionChain")); require(<FILL_ME>) require( ovmCanonicalTransactionChain.verifyTransaction( _transaction, _txChainElement, _transactionBatchHeader, _transactionProof ), "Invalid transaction inclusion proof." ); require ( // solhint-disable-next-line max-line-length _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1 == _transactionBatchHeader.prevTotalElements + _transactionProof.index, "Pre-state root global index must equal to the transaction root global index." ); _deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index); emit FraudProofInitialized( _preStateRoot, _preStateRootProof.index, _txHash, msg.sender ); } /** * Finalizes the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _txHash The transaction for the state root * @param _postStateRoot State root after the fraudulent transaction. * @param _postStateRootBatchHeader Batch header for the provided post-state root. * @param _postStateRootProof Inclusion proof for the provided post-state root. */ function finalizeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, bytes32 _txHash, bytes32 _postStateRoot, Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof ) override public contributesToFraudProof(_preStateRoot, _txHash) { } /************************************ * Internal Functions: Verification * ************************************/ /** * Checks whether a transitioner already exists for a given pre-state root. * @param _preStateRoot Pre-state root to check. * @return _exists Whether or not we already have a transitioner for the root. */ function _hasStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) internal view returns ( bool _exists ) { } /** * Deploys a new state transitioner. * @param _preStateRoot Pre-state root to initialize the transitioner with. * @param _txHash Hash of the transaction this transitioner will execute. * @param _stateTransitionIndex Index of the transaction in the chain. */ function _deployTransitioner( bytes32 _preStateRoot, bytes32 _txHash, uint256 _stateTransitionIndex ) internal { } /** * Removes a state transition from the state commitment chain. * @param _postStateRootBatchHeader Header for the post-state root. * @param _preStateRoot Pre-state root hash. */ function _cancelStateTransition( Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, bytes32 _preStateRoot ) internal { } }
ovmStateCommitmentChain.verifyStateCommitment(_preStateRoot,_preStateRootBatchHeader,_preStateRootProof),"Invalid pre-state root inclusion proof."
11,014
ovmStateCommitmentChain.verifyStateCommitment(_preStateRoot,_preStateRootBatchHeader,_preStateRootProof)
"Invalid transaction inclusion proof."
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_StateTransitionerFactory } from "../../iOVM/verification/iOVM_StateTransitionerFactory.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_StateCommitmentChain } from "../../iOVM/chain/iOVM_StateCommitmentChain.sol"; import { iOVM_CanonicalTransactionChain } from "../../iOVM/chain/iOVM_CanonicalTransactionChain.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_FraudVerifier * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. * If the fraud proof was successful it prunes any state batches from State Commitment Chain * which were published after the fraudulent state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier { /******************************************* * Contract Variables: Internal Accounting * *******************************************/ mapping (bytes32 => iOVM_StateTransitioner) internal transitioners; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. */ constructor( address _libAddressManager ) Lib_AddressResolver(_libAddressManager) {} /*************************************** * Public Functions: Transition Status * ***************************************/ /** * Retrieves the state transitioner for a given root. * @param _preStateRoot State root to query a transitioner for. * @return _transitioner Corresponding state transitioner contract. */ function getStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) override public view returns ( iOVM_StateTransitioner _transitioner ) { } /**************************************** * Public Functions: Fraud Verification * ****************************************/ /** * Begins the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _transaction OVM transaction claimed to be fraudulent. * @param _txChainElement OVM transaction chain element. * @param _transactionBatchHeader Batch header for the provided transaction. * @param _transactionProof Inclusion proof for the provided transaction. */ function initializeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, Lib_OVMCodec.Transaction memory _transaction, Lib_OVMCodec.TransactionChainElement memory _txChainElement, Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _transactionProof ) override public contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction)) { bytes32 _txHash = Lib_OVMCodec.hashTransaction(_transaction); if (_hasStateTransitioner(_preStateRoot, _txHash)) { return; } iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve("OVM_StateCommitmentChain")); iOVM_CanonicalTransactionChain ovmCanonicalTransactionChain = iOVM_CanonicalTransactionChain(resolve("OVM_CanonicalTransactionChain")); require( ovmStateCommitmentChain.verifyStateCommitment( _preStateRoot, _preStateRootBatchHeader, _preStateRootProof ), "Invalid pre-state root inclusion proof." ); require(<FILL_ME>) require ( // solhint-disable-next-line max-line-length _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1 == _transactionBatchHeader.prevTotalElements + _transactionProof.index, "Pre-state root global index must equal to the transaction root global index." ); _deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index); emit FraudProofInitialized( _preStateRoot, _preStateRootProof.index, _txHash, msg.sender ); } /** * Finalizes the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _txHash The transaction for the state root * @param _postStateRoot State root after the fraudulent transaction. * @param _postStateRootBatchHeader Batch header for the provided post-state root. * @param _postStateRootProof Inclusion proof for the provided post-state root. */ function finalizeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, bytes32 _txHash, bytes32 _postStateRoot, Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof ) override public contributesToFraudProof(_preStateRoot, _txHash) { } /************************************ * Internal Functions: Verification * ************************************/ /** * Checks whether a transitioner already exists for a given pre-state root. * @param _preStateRoot Pre-state root to check. * @return _exists Whether or not we already have a transitioner for the root. */ function _hasStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) internal view returns ( bool _exists ) { } /** * Deploys a new state transitioner. * @param _preStateRoot Pre-state root to initialize the transitioner with. * @param _txHash Hash of the transaction this transitioner will execute. * @param _stateTransitionIndex Index of the transaction in the chain. */ function _deployTransitioner( bytes32 _preStateRoot, bytes32 _txHash, uint256 _stateTransitionIndex ) internal { } /** * Removes a state transition from the state commitment chain. * @param _postStateRootBatchHeader Header for the post-state root. * @param _preStateRoot Pre-state root hash. */ function _cancelStateTransition( Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, bytes32 _preStateRoot ) internal { } }
ovmCanonicalTransactionChain.verifyTransaction(_transaction,_txChainElement,_transactionBatchHeader,_transactionProof),"Invalid transaction inclusion proof."
11,014
ovmCanonicalTransactionChain.verifyTransaction(_transaction,_txChainElement,_transactionBatchHeader,_transactionProof)
"Pre-state root global index must equal to the transaction root global index."
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_StateTransitionerFactory } from "../../iOVM/verification/iOVM_StateTransitionerFactory.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_StateCommitmentChain } from "../../iOVM/chain/iOVM_StateCommitmentChain.sol"; import { iOVM_CanonicalTransactionChain } from "../../iOVM/chain/iOVM_CanonicalTransactionChain.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_FraudVerifier * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. * If the fraud proof was successful it prunes any state batches from State Commitment Chain * which were published after the fraudulent state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier { /******************************************* * Contract Variables: Internal Accounting * *******************************************/ mapping (bytes32 => iOVM_StateTransitioner) internal transitioners; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. */ constructor( address _libAddressManager ) Lib_AddressResolver(_libAddressManager) {} /*************************************** * Public Functions: Transition Status * ***************************************/ /** * Retrieves the state transitioner for a given root. * @param _preStateRoot State root to query a transitioner for. * @return _transitioner Corresponding state transitioner contract. */ function getStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) override public view returns ( iOVM_StateTransitioner _transitioner ) { } /**************************************** * Public Functions: Fraud Verification * ****************************************/ /** * Begins the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _transaction OVM transaction claimed to be fraudulent. * @param _txChainElement OVM transaction chain element. * @param _transactionBatchHeader Batch header for the provided transaction. * @param _transactionProof Inclusion proof for the provided transaction. */ function initializeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, Lib_OVMCodec.Transaction memory _transaction, Lib_OVMCodec.TransactionChainElement memory _txChainElement, Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _transactionProof ) override public contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction)) { bytes32 _txHash = Lib_OVMCodec.hashTransaction(_transaction); if (_hasStateTransitioner(_preStateRoot, _txHash)) { return; } iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve("OVM_StateCommitmentChain")); iOVM_CanonicalTransactionChain ovmCanonicalTransactionChain = iOVM_CanonicalTransactionChain(resolve("OVM_CanonicalTransactionChain")); require( ovmStateCommitmentChain.verifyStateCommitment( _preStateRoot, _preStateRootBatchHeader, _preStateRootProof ), "Invalid pre-state root inclusion proof." ); require( ovmCanonicalTransactionChain.verifyTransaction( _transaction, _txChainElement, _transactionBatchHeader, _transactionProof ), "Invalid transaction inclusion proof." ); require(<FILL_ME>) _deployTransitioner(_preStateRoot, _txHash, _preStateRootProof.index); emit FraudProofInitialized( _preStateRoot, _preStateRootProof.index, _txHash, msg.sender ); } /** * Finalizes the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _txHash The transaction for the state root * @param _postStateRoot State root after the fraudulent transaction. * @param _postStateRootBatchHeader Batch header for the provided post-state root. * @param _postStateRootProof Inclusion proof for the provided post-state root. */ function finalizeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, bytes32 _txHash, bytes32 _postStateRoot, Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof ) override public contributesToFraudProof(_preStateRoot, _txHash) { } /************************************ * Internal Functions: Verification * ************************************/ /** * Checks whether a transitioner already exists for a given pre-state root. * @param _preStateRoot Pre-state root to check. * @return _exists Whether or not we already have a transitioner for the root. */ function _hasStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) internal view returns ( bool _exists ) { } /** * Deploys a new state transitioner. * @param _preStateRoot Pre-state root to initialize the transitioner with. * @param _txHash Hash of the transaction this transitioner will execute. * @param _stateTransitionIndex Index of the transaction in the chain. */ function _deployTransitioner( bytes32 _preStateRoot, bytes32 _txHash, uint256 _stateTransitionIndex ) internal { } /** * Removes a state transition from the state commitment chain. * @param _postStateRootBatchHeader Header for the post-state root. * @param _preStateRoot Pre-state root hash. */ function _cancelStateTransition( Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, bytes32 _preStateRoot ) internal { } }
_preStateRootBatchHeader.prevTotalElements+_preStateRootProof.index+1==_transactionBatchHeader.prevTotalElements+_transactionProof.index,"Pre-state root global index must equal to the transaction root global index."
11,014
_preStateRootBatchHeader.prevTotalElements+_preStateRootProof.index+1==_transactionBatchHeader.prevTotalElements+_transactionProof.index
"State transition process must be completed prior to finalization."
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_StateTransitionerFactory } from "../../iOVM/verification/iOVM_StateTransitionerFactory.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_StateCommitmentChain } from "../../iOVM/chain/iOVM_StateCommitmentChain.sol"; import { iOVM_CanonicalTransactionChain } from "../../iOVM/chain/iOVM_CanonicalTransactionChain.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_FraudVerifier * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. * If the fraud proof was successful it prunes any state batches from State Commitment Chain * which were published after the fraudulent state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier { /******************************************* * Contract Variables: Internal Accounting * *******************************************/ mapping (bytes32 => iOVM_StateTransitioner) internal transitioners; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. */ constructor( address _libAddressManager ) Lib_AddressResolver(_libAddressManager) {} /*************************************** * Public Functions: Transition Status * ***************************************/ /** * Retrieves the state transitioner for a given root. * @param _preStateRoot State root to query a transitioner for. * @return _transitioner Corresponding state transitioner contract. */ function getStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) override public view returns ( iOVM_StateTransitioner _transitioner ) { } /**************************************** * Public Functions: Fraud Verification * ****************************************/ /** * Begins the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _transaction OVM transaction claimed to be fraudulent. * @param _txChainElement OVM transaction chain element. * @param _transactionBatchHeader Batch header for the provided transaction. * @param _transactionProof Inclusion proof for the provided transaction. */ function initializeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, Lib_OVMCodec.Transaction memory _transaction, Lib_OVMCodec.TransactionChainElement memory _txChainElement, Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _transactionProof ) override public contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction)) { } /** * Finalizes the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _txHash The transaction for the state root * @param _postStateRoot State root after the fraudulent transaction. * @param _postStateRootBatchHeader Batch header for the provided post-state root. * @param _postStateRootProof Inclusion proof for the provided post-state root. */ function finalizeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, bytes32 _txHash, bytes32 _postStateRoot, Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof ) override public contributesToFraudProof(_preStateRoot, _txHash) { iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash); iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve("OVM_StateCommitmentChain")); require(<FILL_ME>) require ( // solhint-disable-next-line max-line-length _postStateRootBatchHeader.prevTotalElements + _postStateRootProof.index == _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1, "Post-state root global index must equal to the pre state root global index plus one." ); require( ovmStateCommitmentChain.verifyStateCommitment( _preStateRoot, _preStateRootBatchHeader, _preStateRootProof ), "Invalid pre-state root inclusion proof." ); require( ovmStateCommitmentChain.verifyStateCommitment( _postStateRoot, _postStateRootBatchHeader, _postStateRootProof ), "Invalid post-state root inclusion proof." ); // If the post state root did not match, then there was fraud and we should delete the batch require( _postStateRoot != transitioner.getPostStateRoot(), "State transition has not been proven fraudulent." ); _cancelStateTransition(_postStateRootBatchHeader, _preStateRoot); // TEMPORARY: Remove the transitioner; for minnet. transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitioner(0x0000000000000000000000000000000000000000); emit FraudProofFinalized( _preStateRoot, _preStateRootProof.index, _txHash, msg.sender ); } /************************************ * Internal Functions: Verification * ************************************/ /** * Checks whether a transitioner already exists for a given pre-state root. * @param _preStateRoot Pre-state root to check. * @return _exists Whether or not we already have a transitioner for the root. */ function _hasStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) internal view returns ( bool _exists ) { } /** * Deploys a new state transitioner. * @param _preStateRoot Pre-state root to initialize the transitioner with. * @param _txHash Hash of the transaction this transitioner will execute. * @param _stateTransitionIndex Index of the transaction in the chain. */ function _deployTransitioner( bytes32 _preStateRoot, bytes32 _txHash, uint256 _stateTransitionIndex ) internal { } /** * Removes a state transition from the state commitment chain. * @param _postStateRootBatchHeader Header for the post-state root. * @param _preStateRoot Pre-state root hash. */ function _cancelStateTransition( Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, bytes32 _preStateRoot ) internal { } }
transitioner.isComplete()==true,"State transition process must be completed prior to finalization."
11,014
transitioner.isComplete()==true
"Post-state root global index must equal to the pre state root global index plus one."
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_StateTransitionerFactory } from "../../iOVM/verification/iOVM_StateTransitionerFactory.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_StateCommitmentChain } from "../../iOVM/chain/iOVM_StateCommitmentChain.sol"; import { iOVM_CanonicalTransactionChain } from "../../iOVM/chain/iOVM_CanonicalTransactionChain.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_FraudVerifier * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. * If the fraud proof was successful it prunes any state batches from State Commitment Chain * which were published after the fraudulent state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier { /******************************************* * Contract Variables: Internal Accounting * *******************************************/ mapping (bytes32 => iOVM_StateTransitioner) internal transitioners; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. */ constructor( address _libAddressManager ) Lib_AddressResolver(_libAddressManager) {} /*************************************** * Public Functions: Transition Status * ***************************************/ /** * Retrieves the state transitioner for a given root. * @param _preStateRoot State root to query a transitioner for. * @return _transitioner Corresponding state transitioner contract. */ function getStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) override public view returns ( iOVM_StateTransitioner _transitioner ) { } /**************************************** * Public Functions: Fraud Verification * ****************************************/ /** * Begins the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _transaction OVM transaction claimed to be fraudulent. * @param _txChainElement OVM transaction chain element. * @param _transactionBatchHeader Batch header for the provided transaction. * @param _transactionProof Inclusion proof for the provided transaction. */ function initializeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, Lib_OVMCodec.Transaction memory _transaction, Lib_OVMCodec.TransactionChainElement memory _txChainElement, Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _transactionProof ) override public contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction)) { } /** * Finalizes the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _txHash The transaction for the state root * @param _postStateRoot State root after the fraudulent transaction. * @param _postStateRootBatchHeader Batch header for the provided post-state root. * @param _postStateRootProof Inclusion proof for the provided post-state root. */ function finalizeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, bytes32 _txHash, bytes32 _postStateRoot, Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof ) override public contributesToFraudProof(_preStateRoot, _txHash) { iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash); iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve("OVM_StateCommitmentChain")); require( transitioner.isComplete() == true, "State transition process must be completed prior to finalization." ); require(<FILL_ME>) require( ovmStateCommitmentChain.verifyStateCommitment( _preStateRoot, _preStateRootBatchHeader, _preStateRootProof ), "Invalid pre-state root inclusion proof." ); require( ovmStateCommitmentChain.verifyStateCommitment( _postStateRoot, _postStateRootBatchHeader, _postStateRootProof ), "Invalid post-state root inclusion proof." ); // If the post state root did not match, then there was fraud and we should delete the batch require( _postStateRoot != transitioner.getPostStateRoot(), "State transition has not been proven fraudulent." ); _cancelStateTransition(_postStateRootBatchHeader, _preStateRoot); // TEMPORARY: Remove the transitioner; for minnet. transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitioner(0x0000000000000000000000000000000000000000); emit FraudProofFinalized( _preStateRoot, _preStateRootProof.index, _txHash, msg.sender ); } /************************************ * Internal Functions: Verification * ************************************/ /** * Checks whether a transitioner already exists for a given pre-state root. * @param _preStateRoot Pre-state root to check. * @return _exists Whether or not we already have a transitioner for the root. */ function _hasStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) internal view returns ( bool _exists ) { } /** * Deploys a new state transitioner. * @param _preStateRoot Pre-state root to initialize the transitioner with. * @param _txHash Hash of the transaction this transitioner will execute. * @param _stateTransitionIndex Index of the transaction in the chain. */ function _deployTransitioner( bytes32 _preStateRoot, bytes32 _txHash, uint256 _stateTransitionIndex ) internal { } /** * Removes a state transition from the state commitment chain. * @param _postStateRootBatchHeader Header for the post-state root. * @param _preStateRoot Pre-state root hash. */ function _cancelStateTransition( Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, bytes32 _preStateRoot ) internal { } }
_postStateRootBatchHeader.prevTotalElements+_postStateRootProof.index==_preStateRootBatchHeader.prevTotalElements+_preStateRootProof.index+1,"Post-state root global index must equal to the pre state root global index plus one."
11,014
_postStateRootBatchHeader.prevTotalElements+_postStateRootProof.index==_preStateRootBatchHeader.prevTotalElements+_preStateRootProof.index+1
"Invalid post-state root inclusion proof."
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Library Imports */ import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; import { iOVM_StateTransitioner } from "../../iOVM/verification/iOVM_StateTransitioner.sol"; import { iOVM_StateTransitionerFactory } from "../../iOVM/verification/iOVM_StateTransitionerFactory.sol"; import { iOVM_BondManager } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_StateCommitmentChain } from "../../iOVM/chain/iOVM_StateCommitmentChain.sol"; import { iOVM_CanonicalTransactionChain } from "../../iOVM/chain/iOVM_CanonicalTransactionChain.sol"; /* Contract Imports */ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol"; /** * @title OVM_FraudVerifier * @dev The Fraud Verifier contract coordinates the entire fraud proof verification process. * If the fraud proof was successful it prunes any state batches from State Commitment Chain * which were published after the fraudulent state root. * * Compiler used: solc * Runtime target: EVM */ contract OVM_FraudVerifier is Lib_AddressResolver, Abs_FraudContributor, iOVM_FraudVerifier { /******************************************* * Contract Variables: Internal Accounting * *******************************************/ mapping (bytes32 => iOVM_StateTransitioner) internal transitioners; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. */ constructor( address _libAddressManager ) Lib_AddressResolver(_libAddressManager) {} /*************************************** * Public Functions: Transition Status * ***************************************/ /** * Retrieves the state transitioner for a given root. * @param _preStateRoot State root to query a transitioner for. * @return _transitioner Corresponding state transitioner contract. */ function getStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) override public view returns ( iOVM_StateTransitioner _transitioner ) { } /**************************************** * Public Functions: Fraud Verification * ****************************************/ /** * Begins the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _transaction OVM transaction claimed to be fraudulent. * @param _txChainElement OVM transaction chain element. * @param _transactionBatchHeader Batch header for the provided transaction. * @param _transactionProof Inclusion proof for the provided transaction. */ function initializeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, Lib_OVMCodec.Transaction memory _transaction, Lib_OVMCodec.TransactionChainElement memory _txChainElement, Lib_OVMCodec.ChainBatchHeader memory _transactionBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _transactionProof ) override public contributesToFraudProof(_preStateRoot, Lib_OVMCodec.hashTransaction(_transaction)) { } /** * Finalizes the fraud verification process. * @param _preStateRoot State root before the fraudulent transaction. * @param _preStateRootBatchHeader Batch header for the provided pre-state root. * @param _preStateRootProof Inclusion proof for the provided pre-state root. * @param _txHash The transaction for the state root * @param _postStateRoot State root after the fraudulent transaction. * @param _postStateRootBatchHeader Batch header for the provided post-state root. * @param _postStateRootProof Inclusion proof for the provided post-state root. */ function finalizeFraudVerification( bytes32 _preStateRoot, Lib_OVMCodec.ChainBatchHeader memory _preStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _preStateRootProof, bytes32 _txHash, bytes32 _postStateRoot, Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, Lib_OVMCodec.ChainInclusionProof memory _postStateRootProof ) override public contributesToFraudProof(_preStateRoot, _txHash) { iOVM_StateTransitioner transitioner = getStateTransitioner(_preStateRoot, _txHash); iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(resolve("OVM_StateCommitmentChain")); require( transitioner.isComplete() == true, "State transition process must be completed prior to finalization." ); require ( // solhint-disable-next-line max-line-length _postStateRootBatchHeader.prevTotalElements + _postStateRootProof.index == _preStateRootBatchHeader.prevTotalElements + _preStateRootProof.index + 1, "Post-state root global index must equal to the pre state root global index plus one." ); require( ovmStateCommitmentChain.verifyStateCommitment( _preStateRoot, _preStateRootBatchHeader, _preStateRootProof ), "Invalid pre-state root inclusion proof." ); require(<FILL_ME>) // If the post state root did not match, then there was fraud and we should delete the batch require( _postStateRoot != transitioner.getPostStateRoot(), "State transition has not been proven fraudulent." ); _cancelStateTransition(_postStateRootBatchHeader, _preStateRoot); // TEMPORARY: Remove the transitioner; for minnet. transitioners[keccak256(abi.encodePacked(_preStateRoot, _txHash))] = iOVM_StateTransitioner(0x0000000000000000000000000000000000000000); emit FraudProofFinalized( _preStateRoot, _preStateRootProof.index, _txHash, msg.sender ); } /************************************ * Internal Functions: Verification * ************************************/ /** * Checks whether a transitioner already exists for a given pre-state root. * @param _preStateRoot Pre-state root to check. * @return _exists Whether or not we already have a transitioner for the root. */ function _hasStateTransitioner( bytes32 _preStateRoot, bytes32 _txHash ) internal view returns ( bool _exists ) { } /** * Deploys a new state transitioner. * @param _preStateRoot Pre-state root to initialize the transitioner with. * @param _txHash Hash of the transaction this transitioner will execute. * @param _stateTransitionIndex Index of the transaction in the chain. */ function _deployTransitioner( bytes32 _preStateRoot, bytes32 _txHash, uint256 _stateTransitionIndex ) internal { } /** * Removes a state transition from the state commitment chain. * @param _postStateRootBatchHeader Header for the post-state root. * @param _preStateRoot Pre-state root hash. */ function _cancelStateTransition( Lib_OVMCodec.ChainBatchHeader memory _postStateRootBatchHeader, bytes32 _preStateRoot ) internal { } }
ovmStateCommitmentChain.verifyStateCommitment(_postStateRoot,_postStateRootBatchHeader,_postStateRootProof),"Invalid post-state root inclusion proof."
11,014
ovmStateCommitmentChain.verifyStateCommitment(_postStateRoot,_postStateRootBatchHeader,_postStateRootProof)
Errors.ALREADY_FINALIZED
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_BondManager, Errors, ERC20 } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; /** * @title OVM_BondManager * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, * and the Verifier's gas costs are refunded. * * Compiler used: solc * Runtime target: EVM */ contract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver { /**************************** * Constants and Parameters * ****************************/ /// The period to find the earliest fraud proof for a publisher uint256 public constant multiFraudProofPeriod = 7 days; /// The dispute period uint256 public constant disputePeriodSeconds = 7 days; /// The minimum collateral a sequencer must post uint256 public constant requiredCollateral = 1 ether; /******************************************* * Contract Variables: Contract References * *******************************************/ /// The bond token ERC20 immutable public token; /******************************************** * Contract Variables: Internal Accounting * *******************************************/ /// The bonds posted by each proposer mapping(address => Bond) public bonds; /// For each pre-state root, there's an array of witnessProviders that must be rewarded /// for posting witnesses mapping(bytes32 => Rewards) public witnessProviders; /*************** * Constructor * ***************/ /// Initializes with a ERC20 token to be used for the fidelity bonds /// and with the Address Manager constructor( ERC20 _token, address _libAddressManager ) Lib_AddressResolver(_libAddressManager) { } /******************** * Public Functions * ********************/ /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`. function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public { } /// Slashes + distributes rewards or frees up the sequencer's bond, only called by /// `FraudVerifier.finalizeFraudVerification` function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public { require(msg.sender == resolve("OVM_FraudVerifier"), Errors.ONLY_FRAUD_VERIFIER); require(<FILL_ME>) // allow users to claim from that state root's // pool of collateral (effectively slashing the sequencer) witnessProviders[_preStateRoot].canClaim = true; Bond storage bond = bonds[publisher]; if (bond.firstDisputeAt == 0) { bond.firstDisputeAt = block.timestamp; bond.earliestDisputedStateRoot = _preStateRoot; bond.earliestTimestamp = timestamp; } else if ( // only update the disputed state root for the publisher if it's within // the dispute period _and_ if it's before the previous one block.timestamp < bond.firstDisputeAt + multiFraudProofPeriod && timestamp < bond.earliestTimestamp ) { bond.earliestDisputedStateRoot = _preStateRoot; bond.earliestTimestamp = timestamp; } // if the fraud proof's dispute period does not intersect with the // withdrawal's timestamp, then the user should not be slashed // e.g if a user at day 10 submits a withdrawal, and a fraud proof // from day 1 gets published, the user won't be slashed since day 8 (1d + 7d) // is before the user started their withdrawal. on the contrary, if the user // had started their withdrawal at, say, day 6, they would be slashed if ( bond.withdrawalTimestamp != 0 && uint256(bond.withdrawalTimestamp) > timestamp + disputePeriodSeconds && bond.state == State.WITHDRAWING ) { return; } // slash! bond.state = State.NOT_COLLATERALIZED; } /// Sequencers call this function to post collateral which will be used for /// the `appendBatch` call function deposit() override public { } /// Starts the withdrawal for a publisher function startWithdrawal() override public { } /// Finalizes a pending withdrawal from a publisher function finalizeWithdrawal() override public { } /// Claims the user's reward for the witnesses they provided for the earliest /// disputed state root of the designated publisher function claim(address who) override public { } /// Checks if the user is collateralized function isCollateralized(address who) override public view returns (bool) { } /// Gets how many witnesses the user has provided for the state root function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) { } }
witnessProviders[_preStateRoot].canClaim==false,Errors.ALREADY_FINALIZED
11,015
witnessProviders[_preStateRoot].canClaim==false
Errors.ERC20_ERR
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_BondManager, Errors, ERC20 } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; /** * @title OVM_BondManager * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, * and the Verifier's gas costs are refunded. * * Compiler used: solc * Runtime target: EVM */ contract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver { /**************************** * Constants and Parameters * ****************************/ /// The period to find the earliest fraud proof for a publisher uint256 public constant multiFraudProofPeriod = 7 days; /// The dispute period uint256 public constant disputePeriodSeconds = 7 days; /// The minimum collateral a sequencer must post uint256 public constant requiredCollateral = 1 ether; /******************************************* * Contract Variables: Contract References * *******************************************/ /// The bond token ERC20 immutable public token; /******************************************** * Contract Variables: Internal Accounting * *******************************************/ /// The bonds posted by each proposer mapping(address => Bond) public bonds; /// For each pre-state root, there's an array of witnessProviders that must be rewarded /// for posting witnesses mapping(bytes32 => Rewards) public witnessProviders; /*************** * Constructor * ***************/ /// Initializes with a ERC20 token to be used for the fidelity bonds /// and with the Address Manager constructor( ERC20 _token, address _libAddressManager ) Lib_AddressResolver(_libAddressManager) { } /******************** * Public Functions * ********************/ /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`. function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public { } /// Slashes + distributes rewards or frees up the sequencer's bond, only called by /// `FraudVerifier.finalizeFraudVerification` function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public { } /// Sequencers call this function to post collateral which will be used for /// the `appendBatch` call function deposit() override public { require(<FILL_ME>) // This cannot overflow bonds[msg.sender].state = State.COLLATERALIZED; } /// Starts the withdrawal for a publisher function startWithdrawal() override public { } /// Finalizes a pending withdrawal from a publisher function finalizeWithdrawal() override public { } /// Claims the user's reward for the witnesses they provided for the earliest /// disputed state root of the designated publisher function claim(address who) override public { } /// Checks if the user is collateralized function isCollateralized(address who) override public view returns (bool) { } /// Gets how many witnesses the user has provided for the state root function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) { } }
token.transferFrom(msg.sender,address(this),requiredCollateral),Errors.ERC20_ERR
11,015
token.transferFrom(msg.sender,address(this),requiredCollateral)
Errors.ERC20_ERR
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_BondManager, Errors, ERC20 } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; /** * @title OVM_BondManager * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, * and the Verifier's gas costs are refunded. * * Compiler used: solc * Runtime target: EVM */ contract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver { /**************************** * Constants and Parameters * ****************************/ /// The period to find the earliest fraud proof for a publisher uint256 public constant multiFraudProofPeriod = 7 days; /// The dispute period uint256 public constant disputePeriodSeconds = 7 days; /// The minimum collateral a sequencer must post uint256 public constant requiredCollateral = 1 ether; /******************************************* * Contract Variables: Contract References * *******************************************/ /// The bond token ERC20 immutable public token; /******************************************** * Contract Variables: Internal Accounting * *******************************************/ /// The bonds posted by each proposer mapping(address => Bond) public bonds; /// For each pre-state root, there's an array of witnessProviders that must be rewarded /// for posting witnesses mapping(bytes32 => Rewards) public witnessProviders; /*************** * Constructor * ***************/ /// Initializes with a ERC20 token to be used for the fidelity bonds /// and with the Address Manager constructor( ERC20 _token, address _libAddressManager ) Lib_AddressResolver(_libAddressManager) { } /******************** * Public Functions * ********************/ /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`. function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public { } /// Slashes + distributes rewards or frees up the sequencer's bond, only called by /// `FraudVerifier.finalizeFraudVerification` function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public { } /// Sequencers call this function to post collateral which will be used for /// the `appendBatch` call function deposit() override public { } /// Starts the withdrawal for a publisher function startWithdrawal() override public { } /// Finalizes a pending withdrawal from a publisher function finalizeWithdrawal() override public { Bond storage bond = bonds[msg.sender]; require( block.timestamp >= uint256(bond.withdrawalTimestamp) + disputePeriodSeconds, Errors.TOO_EARLY ); require(bond.state == State.WITHDRAWING, Errors.SLASHED); // refunds! bond.state = State.NOT_COLLATERALIZED; bond.withdrawalTimestamp = 0; require(<FILL_ME>) } /// Claims the user's reward for the witnesses they provided for the earliest /// disputed state root of the designated publisher function claim(address who) override public { } /// Checks if the user is collateralized function isCollateralized(address who) override public view returns (bool) { } /// Gets how many witnesses the user has provided for the state root function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) { } }
token.transfer(msg.sender,requiredCollateral),Errors.ERC20_ERR
11,015
token.transfer(msg.sender,requiredCollateral)
Errors.CANNOT_CLAIM
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_BondManager, Errors, ERC20 } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; /** * @title OVM_BondManager * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, * and the Verifier's gas costs are refunded. * * Compiler used: solc * Runtime target: EVM */ contract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver { /**************************** * Constants and Parameters * ****************************/ /// The period to find the earliest fraud proof for a publisher uint256 public constant multiFraudProofPeriod = 7 days; /// The dispute period uint256 public constant disputePeriodSeconds = 7 days; /// The minimum collateral a sequencer must post uint256 public constant requiredCollateral = 1 ether; /******************************************* * Contract Variables: Contract References * *******************************************/ /// The bond token ERC20 immutable public token; /******************************************** * Contract Variables: Internal Accounting * *******************************************/ /// The bonds posted by each proposer mapping(address => Bond) public bonds; /// For each pre-state root, there's an array of witnessProviders that must be rewarded /// for posting witnesses mapping(bytes32 => Rewards) public witnessProviders; /*************** * Constructor * ***************/ /// Initializes with a ERC20 token to be used for the fidelity bonds /// and with the Address Manager constructor( ERC20 _token, address _libAddressManager ) Lib_AddressResolver(_libAddressManager) { } /******************** * Public Functions * ********************/ /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`. function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public { } /// Slashes + distributes rewards or frees up the sequencer's bond, only called by /// `FraudVerifier.finalizeFraudVerification` function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public { } /// Sequencers call this function to post collateral which will be used for /// the `appendBatch` call function deposit() override public { } /// Starts the withdrawal for a publisher function startWithdrawal() override public { } /// Finalizes a pending withdrawal from a publisher function finalizeWithdrawal() override public { } /// Claims the user's reward for the witnesses they provided for the earliest /// disputed state root of the designated publisher function claim(address who) override public { Bond storage bond = bonds[who]; require( block.timestamp >= bond.firstDisputeAt + multiFraudProofPeriod, Errors.WAIT_FOR_DISPUTES ); // reward the earliest state root for this publisher bytes32 _preStateRoot = bond.earliestDisputedStateRoot; Rewards storage rewards = witnessProviders[_preStateRoot]; // only allow claiming if fraud was proven in `finalize` require(<FILL_ME>) // proportional allocation - only reward 50% (rest gets locked in the // contract forever uint256 amount = (requiredCollateral * rewards.gasSpent[msg.sender]) / (2 * rewards.total); // reset the user's spent gas so they cannot double claim rewards.gasSpent[msg.sender] = 0; // transfer require(token.transfer(msg.sender, amount), Errors.ERC20_ERR); } /// Checks if the user is collateralized function isCollateralized(address who) override public view returns (bool) { } /// Gets how many witnesses the user has provided for the state root function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) { } }
rewards.canClaim,Errors.CANNOT_CLAIM
11,015
rewards.canClaim
Errors.ERC20_ERR
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; /* Library Imports */ import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol"; /* Interface Imports */ import { iOVM_BondManager, Errors, ERC20 } from "../../iOVM/verification/iOVM_BondManager.sol"; import { iOVM_FraudVerifier } from "../../iOVM/verification/iOVM_FraudVerifier.sol"; /** * @title OVM_BondManager * @dev The Bond Manager contract handles deposits in the form of an ERC20 token from bonded * Proposers. It also handles the accounting of gas costs spent by a Verifier during the course of a * fraud proof. In the event of a successful fraud proof, the fraudulent Proposer's bond is slashed, * and the Verifier's gas costs are refunded. * * Compiler used: solc * Runtime target: EVM */ contract OVM_BondManager is iOVM_BondManager, Lib_AddressResolver { /**************************** * Constants and Parameters * ****************************/ /// The period to find the earliest fraud proof for a publisher uint256 public constant multiFraudProofPeriod = 7 days; /// The dispute period uint256 public constant disputePeriodSeconds = 7 days; /// The minimum collateral a sequencer must post uint256 public constant requiredCollateral = 1 ether; /******************************************* * Contract Variables: Contract References * *******************************************/ /// The bond token ERC20 immutable public token; /******************************************** * Contract Variables: Internal Accounting * *******************************************/ /// The bonds posted by each proposer mapping(address => Bond) public bonds; /// For each pre-state root, there's an array of witnessProviders that must be rewarded /// for posting witnesses mapping(bytes32 => Rewards) public witnessProviders; /*************** * Constructor * ***************/ /// Initializes with a ERC20 token to be used for the fidelity bonds /// and with the Address Manager constructor( ERC20 _token, address _libAddressManager ) Lib_AddressResolver(_libAddressManager) { } /******************** * Public Functions * ********************/ /// Adds `who` to the list of witnessProviders for the provided `preStateRoot`. function recordGasSpent(bytes32 _preStateRoot, bytes32 _txHash, address who, uint256 gasSpent) override public { } /// Slashes + distributes rewards or frees up the sequencer's bond, only called by /// `FraudVerifier.finalizeFraudVerification` function finalize(bytes32 _preStateRoot, address publisher, uint256 timestamp) override public { } /// Sequencers call this function to post collateral which will be used for /// the `appendBatch` call function deposit() override public { } /// Starts the withdrawal for a publisher function startWithdrawal() override public { } /// Finalizes a pending withdrawal from a publisher function finalizeWithdrawal() override public { } /// Claims the user's reward for the witnesses they provided for the earliest /// disputed state root of the designated publisher function claim(address who) override public { Bond storage bond = bonds[who]; require( block.timestamp >= bond.firstDisputeAt + multiFraudProofPeriod, Errors.WAIT_FOR_DISPUTES ); // reward the earliest state root for this publisher bytes32 _preStateRoot = bond.earliestDisputedStateRoot; Rewards storage rewards = witnessProviders[_preStateRoot]; // only allow claiming if fraud was proven in `finalize` require(rewards.canClaim, Errors.CANNOT_CLAIM); // proportional allocation - only reward 50% (rest gets locked in the // contract forever uint256 amount = (requiredCollateral * rewards.gasSpent[msg.sender]) / (2 * rewards.total); // reset the user's spent gas so they cannot double claim rewards.gasSpent[msg.sender] = 0; // transfer require(<FILL_ME>) } /// Checks if the user is collateralized function isCollateralized(address who) override public view returns (bool) { } /// Gets how many witnesses the user has provided for the state root function getGasSpent(bytes32 preStateRoot, address who) override public view returns (uint256) { } }
token.transfer(msg.sender,amount),Errors.ERC20_ERR
11,015
token.transfer(msg.sender,amount)
"Exceed airdop allowance limit."
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; contract FacaNFT is Ownable, ERC721, ERC721Enumerable, VRFConsumerBase, ReentrancyGuard { using SafeMath for uint256; event FacaNFTRandomnessRequest(uint timestamp); event FacaNFTRandomnessFulfil(uint timestamp, bytes32 requestId, uint256 seed); event FacaNFTChainlinkError(uint timestamp, bytes32 requestId); event FacaNFTReveal(uint timestamp); event FacaManualSetSeed(uint timestamp); event FacaWhitelist(address adress); event PermanentURI(string _value, uint256 indexed _id); bool _revealed = false; bool _requestedVRF = false; bytes32 _keyHash; uint private _mode = 0; uint private _limitPrivateSaleTx = 2; uint private _limitPublicSaleTx = 20; uint public maxAirdrop; uint public maxPrivateSale; uint public totalAirdrop; uint public totalPrivateSale; uint public maxSupply; uint256 public seed = 0; uint256 private _privateSalePrice = 77000000000000000; //0.077ETH uint256 private _publicSalePrice = 88000000000000000; //0.088ETH string _tokenBaseURI; string _defaultURI; mapping(address => uint) private _originalOwns; mapping(address => uint) private _presaleMinted; mapping(address => bool) private _originalOwner; mapping(address => bool) private _presaleAllowed; /** * @param vrfCoordinator address of Chainlink VRF coordinator to use * @param linkToken address of LINK token * @param keyHash Chainlink VRF keyhash for the coordinator * @param tokenName Token name * @param tokenSymbol Token symbol * @param baseURI token base URI * @param defaultURI token default URI aka loot box * @param maximumAirdrop max amount for airdrop * @param maximumPrivateSale max amount to sale in private sale * @param maximumSupply max supply of token */ constructor( address vrfCoordinator, address linkToken, bytes32 keyHash, string memory tokenName, string memory tokenSymbol, string memory baseURI, string memory defaultURI, uint maximumAirdrop, uint maximumPrivateSale, uint maximumSupply ) ERC721(tokenName, tokenSymbol) VRFConsumerBase(vrfCoordinator, linkToken) { } /** * @dev ensure collector pays for mint token and message sender is directly interact (and not a contract) * @param amount number of token to mint */ modifier mintable(uint amount) { } /** * @dev add collector to private sale allowlist */ function addAllowlist(address[] memory allowlist) public onlyOwner { } /** * @dev airdrop token for marketing and influencer campaign */ function airdrop(address[] memory _to, uint256 amount) public onlyOwner { require(<FILL_ME>) for (uint i = 0; i < _to.length; i+=1) { mintFaca(_to[i], amount, true); // mint for marketing & influencer } } /** * @dev return token base URI to construct metadata URL */ function tokenBaseURI() public view returns (string memory) { } /** * @dev get sale mode * 0 - offline * 1 - presale * 2 - before public sale * 3 - public sale * 4 - close public sale * 5 - sold out */ function getSaleMode() public view returns(uint) { } /** * @dev get sale price base on sale mode */ function getPrice() public view returns(uint256) { } /** * @dev get current amount of minted token by sale mode */ function getMintedBySaleMode() public view returns(uint256) { } /** * @dev get current token amount available for sale (by sale mode) */ function getMaxSupplyBySaleMode() public view returns(uint256) { } /** * @dev emit event for OpenSea to freeze metadata. */ function freezeMetadata() public onlyOwner { } /** * @dev ensure collector is under allowlist */ function inAllowlist(address collector) public view returns(bool) { } /** * @dev check if collector is an original minter */ function isOriginalOwner(address collector) public view returns(bool) { } function isRequestedVrf() public view returns(bool) { } function isRevealed() public view returns(bool) { } /** * @dev shuffle metadata with seed provided by VRF */ function metadataOf(uint256 tokenId) public view returns (string memory) { } /** * @dev Mint NFT */ function mintNFT(uint256 amount) public payable nonReentrant mintable(amount) returns (bool) { } /** * @dev get amount of original minted amount. */ function originalMintedBalanceOf(address collector) public view returns(uint){ } function publicSalePrice() public view returns(uint256) { } function privateSalePrice() public view returns(uint256) { } /** * @dev request Chainlink VRF for a random seed */ function requestChainlinkVRF() public onlyOwner { } /** * @dev set token base URI */ function setBaseURI(string memory baseURI) public onlyOwner { } /** * @dev reveal all lootbox */ function reveal() public onlyOwner { } /** * @dev set public sale price in case we have last minutes change on sale price/promotion */ function setPublicSalePrice(uint256 price) public onlyOwner { } /** * @dev set seed number (only used for automate testing and emergency reveal) */ function setSeed(uint randomNumber) public onlyOwner { } /** * @dev start private sale */ function startPrivateSale() public onlyOwner { } /** * @dev change mode to before public sale */ function startBeforePublicSale() public onlyOwner { } /** * @dev change mode to public sale */ function startPublicSale() public onlyOwner { } /** * @dev close public sale */ function closePublicSale() public onlyOwner { } function stopAllSale() public onlyOwner { } function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { } /** * @dev return token metadata based on reveal status */ function tokenURI(uint256 tokenId) public view override (ERC721) returns (string memory) { } /** * @dev total public sale amount */ function totalPublicSale() public view returns(uint) { } /** * @dev withdraw ether to owner/admin wallet * @notice only owner can call this method */ function withdraw() public onlyOwner { } function _beforeTokenTransfer(address from, address to, uint256 tokenId ) internal virtual override(ERC721, ERC721Enumerable){ } /** * @dev ensure original minter is logged and favor for future use. */ function addOriginalOwns(address collector) internal { } /** * @dev ensure private sale amount will not exceed quota per collector */ function isValidPrivateSaleAmount(address collector,uint amount) internal view returns(bool) { } /** * @dev ensure private sale amount will not oversell */ function isOversell(uint amount) internal view returns(bool) { } /** * @dev Mints amount `amount` of token to collector * @param collector The collector to receive the token * @param amount The amount of token to be minted * @param isAirdrop Flag for use in airdrop (internally) */ function mintFaca( address collector, uint256 amount, bool isAirdrop) internal returns (bool) { } /** * @dev receive random number from chainlink * @notice random number will greater than zero */ function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override { } /** * @dev log trade amount for controlling the capacity of tx * @param collector collector address * @param amount amount of sale * @param isAirdrop flag for log airdrop transaction */ function logTrade(address collector,uint amount, bool isAirdrop) internal { } }
totalAirdrop+(_to.length*amount)<=maxAirdrop,"Exceed airdop allowance limit."
11,065
totalAirdrop+(_to.length*amount)<=maxAirdrop
"You have already generated a random seed"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; contract FacaNFT is Ownable, ERC721, ERC721Enumerable, VRFConsumerBase, ReentrancyGuard { using SafeMath for uint256; event FacaNFTRandomnessRequest(uint timestamp); event FacaNFTRandomnessFulfil(uint timestamp, bytes32 requestId, uint256 seed); event FacaNFTChainlinkError(uint timestamp, bytes32 requestId); event FacaNFTReveal(uint timestamp); event FacaManualSetSeed(uint timestamp); event FacaWhitelist(address adress); event PermanentURI(string _value, uint256 indexed _id); bool _revealed = false; bool _requestedVRF = false; bytes32 _keyHash; uint private _mode = 0; uint private _limitPrivateSaleTx = 2; uint private _limitPublicSaleTx = 20; uint public maxAirdrop; uint public maxPrivateSale; uint public totalAirdrop; uint public totalPrivateSale; uint public maxSupply; uint256 public seed = 0; uint256 private _privateSalePrice = 77000000000000000; //0.077ETH uint256 private _publicSalePrice = 88000000000000000; //0.088ETH string _tokenBaseURI; string _defaultURI; mapping(address => uint) private _originalOwns; mapping(address => uint) private _presaleMinted; mapping(address => bool) private _originalOwner; mapping(address => bool) private _presaleAllowed; /** * @param vrfCoordinator address of Chainlink VRF coordinator to use * @param linkToken address of LINK token * @param keyHash Chainlink VRF keyhash for the coordinator * @param tokenName Token name * @param tokenSymbol Token symbol * @param baseURI token base URI * @param defaultURI token default URI aka loot box * @param maximumAirdrop max amount for airdrop * @param maximumPrivateSale max amount to sale in private sale * @param maximumSupply max supply of token */ constructor( address vrfCoordinator, address linkToken, bytes32 keyHash, string memory tokenName, string memory tokenSymbol, string memory baseURI, string memory defaultURI, uint maximumAirdrop, uint maximumPrivateSale, uint maximumSupply ) ERC721(tokenName, tokenSymbol) VRFConsumerBase(vrfCoordinator, linkToken) { } /** * @dev ensure collector pays for mint token and message sender is directly interact (and not a contract) * @param amount number of token to mint */ modifier mintable(uint amount) { } /** * @dev add collector to private sale allowlist */ function addAllowlist(address[] memory allowlist) public onlyOwner { } /** * @dev airdrop token for marketing and influencer campaign */ function airdrop(address[] memory _to, uint256 amount) public onlyOwner { } /** * @dev return token base URI to construct metadata URL */ function tokenBaseURI() public view returns (string memory) { } /** * @dev get sale mode * 0 - offline * 1 - presale * 2 - before public sale * 3 - public sale * 4 - close public sale * 5 - sold out */ function getSaleMode() public view returns(uint) { } /** * @dev get sale price base on sale mode */ function getPrice() public view returns(uint256) { } /** * @dev get current amount of minted token by sale mode */ function getMintedBySaleMode() public view returns(uint256) { } /** * @dev get current token amount available for sale (by sale mode) */ function getMaxSupplyBySaleMode() public view returns(uint256) { } /** * @dev emit event for OpenSea to freeze metadata. */ function freezeMetadata() public onlyOwner { } /** * @dev ensure collector is under allowlist */ function inAllowlist(address collector) public view returns(bool) { } /** * @dev check if collector is an original minter */ function isOriginalOwner(address collector) public view returns(bool) { } function isRequestedVrf() public view returns(bool) { } function isRevealed() public view returns(bool) { } /** * @dev shuffle metadata with seed provided by VRF */ function metadataOf(uint256 tokenId) public view returns (string memory) { } /** * @dev Mint NFT */ function mintNFT(uint256 amount) public payable nonReentrant mintable(amount) returns (bool) { } /** * @dev get amount of original minted amount. */ function originalMintedBalanceOf(address collector) public view returns(uint){ } function publicSalePrice() public view returns(uint256) { } function privateSalePrice() public view returns(uint256) { } /** * @dev request Chainlink VRF for a random seed */ function requestChainlinkVRF() public onlyOwner { require(<FILL_ME>) require(LINK.balanceOf(address(this)) >= 2000000000000000000); requestRandomness(_keyHash, 2000000000000000000); _requestedVRF = true; emit FacaNFTRandomnessRequest(block.timestamp); } /** * @dev set token base URI */ function setBaseURI(string memory baseURI) public onlyOwner { } /** * @dev reveal all lootbox */ function reveal() public onlyOwner { } /** * @dev set public sale price in case we have last minutes change on sale price/promotion */ function setPublicSalePrice(uint256 price) public onlyOwner { } /** * @dev set seed number (only used for automate testing and emergency reveal) */ function setSeed(uint randomNumber) public onlyOwner { } /** * @dev start private sale */ function startPrivateSale() public onlyOwner { } /** * @dev change mode to before public sale */ function startBeforePublicSale() public onlyOwner { } /** * @dev change mode to public sale */ function startPublicSale() public onlyOwner { } /** * @dev close public sale */ function closePublicSale() public onlyOwner { } function stopAllSale() public onlyOwner { } function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { } /** * @dev return token metadata based on reveal status */ function tokenURI(uint256 tokenId) public view override (ERC721) returns (string memory) { } /** * @dev total public sale amount */ function totalPublicSale() public view returns(uint) { } /** * @dev withdraw ether to owner/admin wallet * @notice only owner can call this method */ function withdraw() public onlyOwner { } function _beforeTokenTransfer(address from, address to, uint256 tokenId ) internal virtual override(ERC721, ERC721Enumerable){ } /** * @dev ensure original minter is logged and favor for future use. */ function addOriginalOwns(address collector) internal { } /** * @dev ensure private sale amount will not exceed quota per collector */ function isValidPrivateSaleAmount(address collector,uint amount) internal view returns(bool) { } /** * @dev ensure private sale amount will not oversell */ function isOversell(uint amount) internal view returns(bool) { } /** * @dev Mints amount `amount` of token to collector * @param collector The collector to receive the token * @param amount The amount of token to be minted * @param isAirdrop Flag for use in airdrop (internally) */ function mintFaca( address collector, uint256 amount, bool isAirdrop) internal returns (bool) { } /** * @dev receive random number from chainlink * @notice random number will greater than zero */ function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override { } /** * @dev log trade amount for controlling the capacity of tx * @param collector collector address * @param amount amount of sale * @param isAirdrop flag for log airdrop transaction */ function logTrade(address collector,uint amount, bool isAirdrop) internal { } }
!_requestedVRF,"You have already generated a random seed"
11,065
!_requestedVRF
null
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; contract FacaNFT is Ownable, ERC721, ERC721Enumerable, VRFConsumerBase, ReentrancyGuard { using SafeMath for uint256; event FacaNFTRandomnessRequest(uint timestamp); event FacaNFTRandomnessFulfil(uint timestamp, bytes32 requestId, uint256 seed); event FacaNFTChainlinkError(uint timestamp, bytes32 requestId); event FacaNFTReveal(uint timestamp); event FacaManualSetSeed(uint timestamp); event FacaWhitelist(address adress); event PermanentURI(string _value, uint256 indexed _id); bool _revealed = false; bool _requestedVRF = false; bytes32 _keyHash; uint private _mode = 0; uint private _limitPrivateSaleTx = 2; uint private _limitPublicSaleTx = 20; uint public maxAirdrop; uint public maxPrivateSale; uint public totalAirdrop; uint public totalPrivateSale; uint public maxSupply; uint256 public seed = 0; uint256 private _privateSalePrice = 77000000000000000; //0.077ETH uint256 private _publicSalePrice = 88000000000000000; //0.088ETH string _tokenBaseURI; string _defaultURI; mapping(address => uint) private _originalOwns; mapping(address => uint) private _presaleMinted; mapping(address => bool) private _originalOwner; mapping(address => bool) private _presaleAllowed; /** * @param vrfCoordinator address of Chainlink VRF coordinator to use * @param linkToken address of LINK token * @param keyHash Chainlink VRF keyhash for the coordinator * @param tokenName Token name * @param tokenSymbol Token symbol * @param baseURI token base URI * @param defaultURI token default URI aka loot box * @param maximumAirdrop max amount for airdrop * @param maximumPrivateSale max amount to sale in private sale * @param maximumSupply max supply of token */ constructor( address vrfCoordinator, address linkToken, bytes32 keyHash, string memory tokenName, string memory tokenSymbol, string memory baseURI, string memory defaultURI, uint maximumAirdrop, uint maximumPrivateSale, uint maximumSupply ) ERC721(tokenName, tokenSymbol) VRFConsumerBase(vrfCoordinator, linkToken) { } /** * @dev ensure collector pays for mint token and message sender is directly interact (and not a contract) * @param amount number of token to mint */ modifier mintable(uint amount) { } /** * @dev add collector to private sale allowlist */ function addAllowlist(address[] memory allowlist) public onlyOwner { } /** * @dev airdrop token for marketing and influencer campaign */ function airdrop(address[] memory _to, uint256 amount) public onlyOwner { } /** * @dev return token base URI to construct metadata URL */ function tokenBaseURI() public view returns (string memory) { } /** * @dev get sale mode * 0 - offline * 1 - presale * 2 - before public sale * 3 - public sale * 4 - close public sale * 5 - sold out */ function getSaleMode() public view returns(uint) { } /** * @dev get sale price base on sale mode */ function getPrice() public view returns(uint256) { } /** * @dev get current amount of minted token by sale mode */ function getMintedBySaleMode() public view returns(uint256) { } /** * @dev get current token amount available for sale (by sale mode) */ function getMaxSupplyBySaleMode() public view returns(uint256) { } /** * @dev emit event for OpenSea to freeze metadata. */ function freezeMetadata() public onlyOwner { } /** * @dev ensure collector is under allowlist */ function inAllowlist(address collector) public view returns(bool) { } /** * @dev check if collector is an original minter */ function isOriginalOwner(address collector) public view returns(bool) { } function isRequestedVrf() public view returns(bool) { } function isRevealed() public view returns(bool) { } /** * @dev shuffle metadata with seed provided by VRF */ function metadataOf(uint256 tokenId) public view returns (string memory) { } /** * @dev Mint NFT */ function mintNFT(uint256 amount) public payable nonReentrant mintable(amount) returns (bool) { } /** * @dev get amount of original minted amount. */ function originalMintedBalanceOf(address collector) public view returns(uint){ } function publicSalePrice() public view returns(uint256) { } function privateSalePrice() public view returns(uint256) { } /** * @dev request Chainlink VRF for a random seed */ function requestChainlinkVRF() public onlyOwner { require(!_requestedVRF, "You have already generated a random seed"); require(<FILL_ME>) requestRandomness(_keyHash, 2000000000000000000); _requestedVRF = true; emit FacaNFTRandomnessRequest(block.timestamp); } /** * @dev set token base URI */ function setBaseURI(string memory baseURI) public onlyOwner { } /** * @dev reveal all lootbox */ function reveal() public onlyOwner { } /** * @dev set public sale price in case we have last minutes change on sale price/promotion */ function setPublicSalePrice(uint256 price) public onlyOwner { } /** * @dev set seed number (only used for automate testing and emergency reveal) */ function setSeed(uint randomNumber) public onlyOwner { } /** * @dev start private sale */ function startPrivateSale() public onlyOwner { } /** * @dev change mode to before public sale */ function startBeforePublicSale() public onlyOwner { } /** * @dev change mode to public sale */ function startPublicSale() public onlyOwner { } /** * @dev close public sale */ function closePublicSale() public onlyOwner { } function stopAllSale() public onlyOwner { } function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { } /** * @dev return token metadata based on reveal status */ function tokenURI(uint256 tokenId) public view override (ERC721) returns (string memory) { } /** * @dev total public sale amount */ function totalPublicSale() public view returns(uint) { } /** * @dev withdraw ether to owner/admin wallet * @notice only owner can call this method */ function withdraw() public onlyOwner { } function _beforeTokenTransfer(address from, address to, uint256 tokenId ) internal virtual override(ERC721, ERC721Enumerable){ } /** * @dev ensure original minter is logged and favor for future use. */ function addOriginalOwns(address collector) internal { } /** * @dev ensure private sale amount will not exceed quota per collector */ function isValidPrivateSaleAmount(address collector,uint amount) internal view returns(bool) { } /** * @dev ensure private sale amount will not oversell */ function isOversell(uint amount) internal view returns(bool) { } /** * @dev Mints amount `amount` of token to collector * @param collector The collector to receive the token * @param amount The amount of token to be minted * @param isAirdrop Flag for use in airdrop (internally) */ function mintFaca( address collector, uint256 amount, bool isAirdrop) internal returns (bool) { } /** * @dev receive random number from chainlink * @notice random number will greater than zero */ function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override { } /** * @dev log trade amount for controlling the capacity of tx * @param collector collector address * @param amount amount of sale * @param isAirdrop flag for log airdrop transaction */ function logTrade(address collector,uint amount, bool isAirdrop) internal { } }
LINK.balanceOf(address(this))>=2000000000000000000
11,065
LINK.balanceOf(address(this))>=2000000000000000000
"You can only reveal once."
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; contract FacaNFT is Ownable, ERC721, ERC721Enumerable, VRFConsumerBase, ReentrancyGuard { using SafeMath for uint256; event FacaNFTRandomnessRequest(uint timestamp); event FacaNFTRandomnessFulfil(uint timestamp, bytes32 requestId, uint256 seed); event FacaNFTChainlinkError(uint timestamp, bytes32 requestId); event FacaNFTReveal(uint timestamp); event FacaManualSetSeed(uint timestamp); event FacaWhitelist(address adress); event PermanentURI(string _value, uint256 indexed _id); bool _revealed = false; bool _requestedVRF = false; bytes32 _keyHash; uint private _mode = 0; uint private _limitPrivateSaleTx = 2; uint private _limitPublicSaleTx = 20; uint public maxAirdrop; uint public maxPrivateSale; uint public totalAirdrop; uint public totalPrivateSale; uint public maxSupply; uint256 public seed = 0; uint256 private _privateSalePrice = 77000000000000000; //0.077ETH uint256 private _publicSalePrice = 88000000000000000; //0.088ETH string _tokenBaseURI; string _defaultURI; mapping(address => uint) private _originalOwns; mapping(address => uint) private _presaleMinted; mapping(address => bool) private _originalOwner; mapping(address => bool) private _presaleAllowed; /** * @param vrfCoordinator address of Chainlink VRF coordinator to use * @param linkToken address of LINK token * @param keyHash Chainlink VRF keyhash for the coordinator * @param tokenName Token name * @param tokenSymbol Token symbol * @param baseURI token base URI * @param defaultURI token default URI aka loot box * @param maximumAirdrop max amount for airdrop * @param maximumPrivateSale max amount to sale in private sale * @param maximumSupply max supply of token */ constructor( address vrfCoordinator, address linkToken, bytes32 keyHash, string memory tokenName, string memory tokenSymbol, string memory baseURI, string memory defaultURI, uint maximumAirdrop, uint maximumPrivateSale, uint maximumSupply ) ERC721(tokenName, tokenSymbol) VRFConsumerBase(vrfCoordinator, linkToken) { } /** * @dev ensure collector pays for mint token and message sender is directly interact (and not a contract) * @param amount number of token to mint */ modifier mintable(uint amount) { } /** * @dev add collector to private sale allowlist */ function addAllowlist(address[] memory allowlist) public onlyOwner { } /** * @dev airdrop token for marketing and influencer campaign */ function airdrop(address[] memory _to, uint256 amount) public onlyOwner { } /** * @dev return token base URI to construct metadata URL */ function tokenBaseURI() public view returns (string memory) { } /** * @dev get sale mode * 0 - offline * 1 - presale * 2 - before public sale * 3 - public sale * 4 - close public sale * 5 - sold out */ function getSaleMode() public view returns(uint) { } /** * @dev get sale price base on sale mode */ function getPrice() public view returns(uint256) { } /** * @dev get current amount of minted token by sale mode */ function getMintedBySaleMode() public view returns(uint256) { } /** * @dev get current token amount available for sale (by sale mode) */ function getMaxSupplyBySaleMode() public view returns(uint256) { } /** * @dev emit event for OpenSea to freeze metadata. */ function freezeMetadata() public onlyOwner { } /** * @dev ensure collector is under allowlist */ function inAllowlist(address collector) public view returns(bool) { } /** * @dev check if collector is an original minter */ function isOriginalOwner(address collector) public view returns(bool) { } function isRequestedVrf() public view returns(bool) { } function isRevealed() public view returns(bool) { } /** * @dev shuffle metadata with seed provided by VRF */ function metadataOf(uint256 tokenId) public view returns (string memory) { } /** * @dev Mint NFT */ function mintNFT(uint256 amount) public payable nonReentrant mintable(amount) returns (bool) { } /** * @dev get amount of original minted amount. */ function originalMintedBalanceOf(address collector) public view returns(uint){ } function publicSalePrice() public view returns(uint256) { } function privateSalePrice() public view returns(uint256) { } /** * @dev request Chainlink VRF for a random seed */ function requestChainlinkVRF() public onlyOwner { } /** * @dev set token base URI */ function setBaseURI(string memory baseURI) public onlyOwner { } /** * @dev reveal all lootbox */ function reveal() public onlyOwner { require(<FILL_ME>) _revealed = true; } /** * @dev set public sale price in case we have last minutes change on sale price/promotion */ function setPublicSalePrice(uint256 price) public onlyOwner { } /** * @dev set seed number (only used for automate testing and emergency reveal) */ function setSeed(uint randomNumber) public onlyOwner { } /** * @dev start private sale */ function startPrivateSale() public onlyOwner { } /** * @dev change mode to before public sale */ function startBeforePublicSale() public onlyOwner { } /** * @dev change mode to public sale */ function startPublicSale() public onlyOwner { } /** * @dev close public sale */ function closePublicSale() public onlyOwner { } function stopAllSale() public onlyOwner { } function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { } /** * @dev return token metadata based on reveal status */ function tokenURI(uint256 tokenId) public view override (ERC721) returns (string memory) { } /** * @dev total public sale amount */ function totalPublicSale() public view returns(uint) { } /** * @dev withdraw ether to owner/admin wallet * @notice only owner can call this method */ function withdraw() public onlyOwner { } function _beforeTokenTransfer(address from, address to, uint256 tokenId ) internal virtual override(ERC721, ERC721Enumerable){ } /** * @dev ensure original minter is logged and favor for future use. */ function addOriginalOwns(address collector) internal { } /** * @dev ensure private sale amount will not exceed quota per collector */ function isValidPrivateSaleAmount(address collector,uint amount) internal view returns(bool) { } /** * @dev ensure private sale amount will not oversell */ function isOversell(uint amount) internal view returns(bool) { } /** * @dev Mints amount `amount` of token to collector * @param collector The collector to receive the token * @param amount The amount of token to be minted * @param isAirdrop Flag for use in airdrop (internally) */ function mintFaca( address collector, uint256 amount, bool isAirdrop) internal returns (bool) { } /** * @dev receive random number from chainlink * @notice random number will greater than zero */ function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override { } /** * @dev log trade amount for controlling the capacity of tx * @param collector collector address * @param amount amount of sale * @param isAirdrop flag for log airdrop transaction */ function logTrade(address collector,uint amount, bool isAirdrop) internal { } }
!_revealed,"You can only reveal once."
11,065
!_revealed
"Only whitelist addresses allowed."
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; contract FacaNFT is Ownable, ERC721, ERC721Enumerable, VRFConsumerBase, ReentrancyGuard { using SafeMath for uint256; event FacaNFTRandomnessRequest(uint timestamp); event FacaNFTRandomnessFulfil(uint timestamp, bytes32 requestId, uint256 seed); event FacaNFTChainlinkError(uint timestamp, bytes32 requestId); event FacaNFTReveal(uint timestamp); event FacaManualSetSeed(uint timestamp); event FacaWhitelist(address adress); event PermanentURI(string _value, uint256 indexed _id); bool _revealed = false; bool _requestedVRF = false; bytes32 _keyHash; uint private _mode = 0; uint private _limitPrivateSaleTx = 2; uint private _limitPublicSaleTx = 20; uint public maxAirdrop; uint public maxPrivateSale; uint public totalAirdrop; uint public totalPrivateSale; uint public maxSupply; uint256 public seed = 0; uint256 private _privateSalePrice = 77000000000000000; //0.077ETH uint256 private _publicSalePrice = 88000000000000000; //0.088ETH string _tokenBaseURI; string _defaultURI; mapping(address => uint) private _originalOwns; mapping(address => uint) private _presaleMinted; mapping(address => bool) private _originalOwner; mapping(address => bool) private _presaleAllowed; /** * @param vrfCoordinator address of Chainlink VRF coordinator to use * @param linkToken address of LINK token * @param keyHash Chainlink VRF keyhash for the coordinator * @param tokenName Token name * @param tokenSymbol Token symbol * @param baseURI token base URI * @param defaultURI token default URI aka loot box * @param maximumAirdrop max amount for airdrop * @param maximumPrivateSale max amount to sale in private sale * @param maximumSupply max supply of token */ constructor( address vrfCoordinator, address linkToken, bytes32 keyHash, string memory tokenName, string memory tokenSymbol, string memory baseURI, string memory defaultURI, uint maximumAirdrop, uint maximumPrivateSale, uint maximumSupply ) ERC721(tokenName, tokenSymbol) VRFConsumerBase(vrfCoordinator, linkToken) { } /** * @dev ensure collector pays for mint token and message sender is directly interact (and not a contract) * @param amount number of token to mint */ modifier mintable(uint amount) { } /** * @dev add collector to private sale allowlist */ function addAllowlist(address[] memory allowlist) public onlyOwner { } /** * @dev airdrop token for marketing and influencer campaign */ function airdrop(address[] memory _to, uint256 amount) public onlyOwner { } /** * @dev return token base URI to construct metadata URL */ function tokenBaseURI() public view returns (string memory) { } /** * @dev get sale mode * 0 - offline * 1 - presale * 2 - before public sale * 3 - public sale * 4 - close public sale * 5 - sold out */ function getSaleMode() public view returns(uint) { } /** * @dev get sale price base on sale mode */ function getPrice() public view returns(uint256) { } /** * @dev get current amount of minted token by sale mode */ function getMintedBySaleMode() public view returns(uint256) { } /** * @dev get current token amount available for sale (by sale mode) */ function getMaxSupplyBySaleMode() public view returns(uint256) { } /** * @dev emit event for OpenSea to freeze metadata. */ function freezeMetadata() public onlyOwner { } /** * @dev ensure collector is under allowlist */ function inAllowlist(address collector) public view returns(bool) { } /** * @dev check if collector is an original minter */ function isOriginalOwner(address collector) public view returns(bool) { } function isRequestedVrf() public view returns(bool) { } function isRevealed() public view returns(bool) { } /** * @dev shuffle metadata with seed provided by VRF */ function metadataOf(uint256 tokenId) public view returns (string memory) { } /** * @dev Mint NFT */ function mintNFT(uint256 amount) public payable nonReentrant mintable(amount) returns (bool) { } /** * @dev get amount of original minted amount. */ function originalMintedBalanceOf(address collector) public view returns(uint){ } function publicSalePrice() public view returns(uint256) { } function privateSalePrice() public view returns(uint256) { } /** * @dev request Chainlink VRF for a random seed */ function requestChainlinkVRF() public onlyOwner { } /** * @dev set token base URI */ function setBaseURI(string memory baseURI) public onlyOwner { } /** * @dev reveal all lootbox */ function reveal() public onlyOwner { } /** * @dev set public sale price in case we have last minutes change on sale price/promotion */ function setPublicSalePrice(uint256 price) public onlyOwner { } /** * @dev set seed number (only used for automate testing and emergency reveal) */ function setSeed(uint randomNumber) public onlyOwner { } /** * @dev start private sale */ function startPrivateSale() public onlyOwner { } /** * @dev change mode to before public sale */ function startBeforePublicSale() public onlyOwner { } /** * @dev change mode to public sale */ function startPublicSale() public onlyOwner { } /** * @dev close public sale */ function closePublicSale() public onlyOwner { } function stopAllSale() public onlyOwner { } function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { } /** * @dev return token metadata based on reveal status */ function tokenURI(uint256 tokenId) public view override (ERC721) returns (string memory) { } /** * @dev total public sale amount */ function totalPublicSale() public view returns(uint) { } /** * @dev withdraw ether to owner/admin wallet * @notice only owner can call this method */ function withdraw() public onlyOwner { } function _beforeTokenTransfer(address from, address to, uint256 tokenId ) internal virtual override(ERC721, ERC721Enumerable){ } /** * @dev ensure original minter is logged and favor for future use. */ function addOriginalOwns(address collector) internal { } /** * @dev ensure private sale amount will not exceed quota per collector */ function isValidPrivateSaleAmount(address collector,uint amount) internal view returns(bool) { } /** * @dev ensure private sale amount will not oversell */ function isOversell(uint amount) internal view returns(bool) { } /** * @dev Mints amount `amount` of token to collector * @param collector The collector to receive the token * @param amount The amount of token to be minted * @param isAirdrop Flag for use in airdrop (internally) */ function mintFaca( address collector, uint256 amount, bool isAirdrop) internal returns (bool) { // private sale if(getSaleMode() == 1) { require(<FILL_ME>) require(isValidPrivateSaleAmount(collector, amount), "Max presale amount exceeded."); } if (getSaleMode() > 0 && !isAirdrop) { require(isOversell(amount), "Cannot oversell"); } for (uint256 i = 0; i < amount; i+=1) { uint256 tokenIndex = totalSupply(); if (tokenIndex < maxSupply) { _safeMint(collector, tokenIndex+1); addOriginalOwns(collector); } } logTrade(collector, amount, isAirdrop); return true; } /** * @dev receive random number from chainlink * @notice random number will greater than zero */ function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override { } /** * @dev log trade amount for controlling the capacity of tx * @param collector collector address * @param amount amount of sale * @param isAirdrop flag for log airdrop transaction */ function logTrade(address collector,uint amount, bool isAirdrop) internal { } }
inAllowlist(collector),"Only whitelist addresses allowed."
11,065
inAllowlist(collector)