contract_name
stringlengths
1
61
file_path
stringlengths
5
50.4k
contract_address
stringlengths
42
42
language
stringclasses
1 value
class_name
stringlengths
1
61
class_code
stringlengths
4
330k
class_documentation
stringlengths
0
29.1k
class_documentation_type
stringclasses
6 values
func_name
stringlengths
0
62
func_code
stringlengths
1
303k
func_documentation
stringlengths
2
14.9k
func_documentation_type
stringclasses
4 values
compiler_version
stringlengths
15
42
license_type
stringclasses
14 values
swarm_source
stringlengths
0
71
meta
dict
__index_level_0__
int64
0
60.4k
SplicePriceStrategyStatic
contracts/Splice.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
Splice
contract Splice is ERC721Upgradeable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable, IERC2981Upgradeable { using SafeMathUpgradeable for uint256; using StringsUpgradeable for uint32; /// @notice you didn't send sufficient fees along error InsufficientFees(); /// @notice The combination of origin and style already has been minted error ProvenanceAlreadyUsed(); /// @notice only reserved mints are left or not on allowlist error NotAllowedToMint(string reason); error NotOwningOrigin(); uint8 public ROYALTY_PERCENT; string private baseUri; //lookup table //keccak(0xcollection + origin_tokenId + styleTokenId) => tokenId mapping(bytes32 => uint64) public provenanceToTokenId; /** * @notice the contract that manages all styles as NFTs. * Styles are owned by artists and manage fee quoting. * Style NFTs are transferrable (you can sell your style to others) */ SpliceStyleNFT public styleNFT; /** * @notice the splice platform account, i.e. a Gnosis Safe / DAO Treasury etc. */ address public platformBeneficiary; event Withdrawn(address indexed user, uint256 amount); event Minted( bytes32 indexed origin_hash, uint64 indexed tokenId, uint32 indexed styleTokenId ); event RoyaltiesUpdated(uint8 royalties); event BeneficiaryChanged(address newBeneficiary); function initialize( string memory baseUri_, SpliceStyleNFT initializedStyleNFT_ ) public initializer { __ERC721_init('Splice', 'SPLICE'); __Ownable_init(); __Pausable_init(); __ReentrancyGuard_init(); ROYALTY_PERCENT = 10; platformBeneficiary = msg.sender; baseUri = baseUri_; styleNFT = initializedStyleNFT_; } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function setBaseUri(string memory newBaseUri) external onlyOwner { baseUri = newBaseUri; } function _baseURI() internal view override returns (string memory) { return baseUri; } //todo: the platform benef. should be the only one to name a new beneficiary, not the owner. function setPlatformBeneficiary(address payable newAddress) external onlyOwner { require(address(0) != newAddress, 'must be a real address'); platformBeneficiary = newAddress; emit BeneficiaryChanged(newAddress); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * in case anything drops ETH/ERC20/ERC721 on us accidentally, * this will help us withdraw it. */ function withdrawEth() external nonReentrant onlyOwner { AddressUpgradeable.sendValue( payable(platformBeneficiary), address(this).balance ); } function withdrawERC20(IERC20 token) external nonReentrant onlyOwner { bool result = token.transfer( platformBeneficiary, token.balanceOf(address(this)) ); if (!result) revert('the transfer failed'); } function withdrawERC721(IERC721 nftContract, uint256 tokenId) external nonReentrant onlyOwner { nftContract.transferFrom(address(this), platformBeneficiary, tokenId); } function styleAndTokenByTokenId(uint256 tokenId) public pure returns (uint32 styleTokenId, uint32 token_tokenId) { bytes memory tokenIdBytes = abi.encode(tokenId); styleTokenId = BytesLib.toUint32(tokenIdBytes, 24); token_tokenId = BytesLib.toUint32(tokenIdBytes, 28); } // for OpenSea function contractURI() public pure returns (string memory) { return 'https://getsplice.io/contract-metadata'; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require( _exists(tokenId), 'ERC721Metadata: URI query for nonexistent token' ); (uint32 styleTokenId, uint32 spliceTokenId) = styleAndTokenByTokenId( tokenId ); if (styleNFT.isFrozen(styleTokenId)) { StyleSettings memory settings = styleNFT.getSettings(styleTokenId); return string( abi.encodePacked( 'ipfs://', settings.styleCID, '/', spliceTokenId.toString() ) ); } else { return super.tokenURI(tokenId); } } function quote( uint32 styleTokenId, IERC721[] memory nfts, uint256[] memory originTokenIds ) external view returns (uint256 fee) { return styleNFT.quoteFee(styleTokenId, nfts, originTokenIds); } /** * @notice this will only have an effect for new styles */ function updateRoyalties(uint8 royaltyPercentage) external onlyOwner { require(royaltyPercentage <= 10, 'royalties must never exceed 10%'); ROYALTY_PERCENT = royaltyPercentage; emit RoyaltiesUpdated(royaltyPercentage); } // https://eips.ethereum.org/EIPS/eip-2981 // https://docs.openzeppelin.com/contracts/4.x/api/interfaces#IERC2981 // https://forum.openzeppelin.com/t/how-do-eip-2891-royalties-work/17177 /** * potentially (hopefully) called by marketplaces to find a target address where to send royalties * @notice the returned address will be a payment splitting instance */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view returns (address receiver, uint256 royaltyAmount) { (uint32 styleTokenId, ) = styleAndTokenByTokenId(tokenId); receiver = styleNFT.getSettings(styleTokenId).paymentSplitter; royaltyAmount = (ROYALTY_PERCENT * salePrice).div(100); } function mint( IERC721[] memory originCollections, uint256[] memory originTokenIds, uint32 styleTokenId, bytes32[] memory allowlistProof, bytes calldata inputParams ) external payable whenNotPaused nonReentrant returns (uint64 tokenId) { //CHECKS require( styleNFT.isMintable( styleTokenId, originCollections, originTokenIds, msg.sender ) ); if (styleNFT.availableForPublicMinting(styleTokenId) == 0) { if ( allowlistProof.length == 0 || !styleNFT.verifyAllowlistEntryProof( styleTokenId, allowlistProof, msg.sender ) ) { revert NotAllowedToMint('no reservations left or proof failed'); } else { styleNFT.decreaseAllowance(styleTokenId, msg.sender); } } uint256 fee = styleNFT.quoteFee( styleTokenId, originCollections, originTokenIds ); if (msg.value < fee) revert InsufficientFees(); bytes32 _provenanceHash = keccak256( abi.encodePacked(originCollections, originTokenIds, styleTokenId) ); if (provenanceToTokenId[_provenanceHash] != 0x0) { revert ProvenanceAlreadyUsed(); } //EFFECTS uint32 nextStyleMintId = styleNFT.incrementMintedPerStyle(styleTokenId); tokenId = BytesLib.toUint64( abi.encodePacked(styleTokenId, nextStyleMintId), 0 ); provenanceToTokenId[_provenanceHash] = tokenId; //INTERACTIONS with external contracts for (uint256 i = 0; i < originCollections.length; i++) { //https://github.com/crytic/building-secure-contracts/blob/master/development-guidelines/token_integration.md address _owner = originCollections[i].ownerOf(originTokenIds[i]); if (_owner != msg.sender || _owner == address(0)) { revert NotOwningOrigin(); } } AddressUpgradeable.sendValue( payable(styleNFT.getSettings(styleTokenId).paymentSplitter), fee ); _safeMint(msg.sender, tokenId); emit Minted( keccak256(abi.encode(originCollections, originTokenIds)), tokenId, styleTokenId ); //if someone sent slightly too much, we're sending it back to them uint256 surplus = msg.value.sub(fee); if (surplus > 0 && surplus < 100_000_000 gwei) { AddressUpgradeable.sendValue(payable(msg.sender), surplus); } return tokenId; } }
/// @title Splice is a protocol to mint NFTs out of origin NFTs /// @author Stefan Adolf @elmariachi111
NatSpecSingleLine
setPlatformBeneficiary
function setPlatformBeneficiary(address payable newAddress) external onlyOwner { require(address(0) != newAddress, 'must be a real address'); platformBeneficiary = newAddress; emit BeneficiaryChanged(newAddress); }
//todo: the platform benef. should be the only one to name a new beneficiary, not the owner.
LineComment
v0.8.10+commit.fc410830
{ "func_code_index": [ 2151, 2391 ] }
56,561
SplicePriceStrategyStatic
contracts/Splice.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
Splice
contract Splice is ERC721Upgradeable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable, IERC2981Upgradeable { using SafeMathUpgradeable for uint256; using StringsUpgradeable for uint32; /// @notice you didn't send sufficient fees along error InsufficientFees(); /// @notice The combination of origin and style already has been minted error ProvenanceAlreadyUsed(); /// @notice only reserved mints are left or not on allowlist error NotAllowedToMint(string reason); error NotOwningOrigin(); uint8 public ROYALTY_PERCENT; string private baseUri; //lookup table //keccak(0xcollection + origin_tokenId + styleTokenId) => tokenId mapping(bytes32 => uint64) public provenanceToTokenId; /** * @notice the contract that manages all styles as NFTs. * Styles are owned by artists and manage fee quoting. * Style NFTs are transferrable (you can sell your style to others) */ SpliceStyleNFT public styleNFT; /** * @notice the splice platform account, i.e. a Gnosis Safe / DAO Treasury etc. */ address public platformBeneficiary; event Withdrawn(address indexed user, uint256 amount); event Minted( bytes32 indexed origin_hash, uint64 indexed tokenId, uint32 indexed styleTokenId ); event RoyaltiesUpdated(uint8 royalties); event BeneficiaryChanged(address newBeneficiary); function initialize( string memory baseUri_, SpliceStyleNFT initializedStyleNFT_ ) public initializer { __ERC721_init('Splice', 'SPLICE'); __Ownable_init(); __Pausable_init(); __ReentrancyGuard_init(); ROYALTY_PERCENT = 10; platformBeneficiary = msg.sender; baseUri = baseUri_; styleNFT = initializedStyleNFT_; } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function setBaseUri(string memory newBaseUri) external onlyOwner { baseUri = newBaseUri; } function _baseURI() internal view override returns (string memory) { return baseUri; } //todo: the platform benef. should be the only one to name a new beneficiary, not the owner. function setPlatformBeneficiary(address payable newAddress) external onlyOwner { require(address(0) != newAddress, 'must be a real address'); platformBeneficiary = newAddress; emit BeneficiaryChanged(newAddress); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * in case anything drops ETH/ERC20/ERC721 on us accidentally, * this will help us withdraw it. */ function withdrawEth() external nonReentrant onlyOwner { AddressUpgradeable.sendValue( payable(platformBeneficiary), address(this).balance ); } function withdrawERC20(IERC20 token) external nonReentrant onlyOwner { bool result = token.transfer( platformBeneficiary, token.balanceOf(address(this)) ); if (!result) revert('the transfer failed'); } function withdrawERC721(IERC721 nftContract, uint256 tokenId) external nonReentrant onlyOwner { nftContract.transferFrom(address(this), platformBeneficiary, tokenId); } function styleAndTokenByTokenId(uint256 tokenId) public pure returns (uint32 styleTokenId, uint32 token_tokenId) { bytes memory tokenIdBytes = abi.encode(tokenId); styleTokenId = BytesLib.toUint32(tokenIdBytes, 24); token_tokenId = BytesLib.toUint32(tokenIdBytes, 28); } // for OpenSea function contractURI() public pure returns (string memory) { return 'https://getsplice.io/contract-metadata'; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require( _exists(tokenId), 'ERC721Metadata: URI query for nonexistent token' ); (uint32 styleTokenId, uint32 spliceTokenId) = styleAndTokenByTokenId( tokenId ); if (styleNFT.isFrozen(styleTokenId)) { StyleSettings memory settings = styleNFT.getSettings(styleTokenId); return string( abi.encodePacked( 'ipfs://', settings.styleCID, '/', spliceTokenId.toString() ) ); } else { return super.tokenURI(tokenId); } } function quote( uint32 styleTokenId, IERC721[] memory nfts, uint256[] memory originTokenIds ) external view returns (uint256 fee) { return styleNFT.quoteFee(styleTokenId, nfts, originTokenIds); } /** * @notice this will only have an effect for new styles */ function updateRoyalties(uint8 royaltyPercentage) external onlyOwner { require(royaltyPercentage <= 10, 'royalties must never exceed 10%'); ROYALTY_PERCENT = royaltyPercentage; emit RoyaltiesUpdated(royaltyPercentage); } // https://eips.ethereum.org/EIPS/eip-2981 // https://docs.openzeppelin.com/contracts/4.x/api/interfaces#IERC2981 // https://forum.openzeppelin.com/t/how-do-eip-2891-royalties-work/17177 /** * potentially (hopefully) called by marketplaces to find a target address where to send royalties * @notice the returned address will be a payment splitting instance */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view returns (address receiver, uint256 royaltyAmount) { (uint32 styleTokenId, ) = styleAndTokenByTokenId(tokenId); receiver = styleNFT.getSettings(styleTokenId).paymentSplitter; royaltyAmount = (ROYALTY_PERCENT * salePrice).div(100); } function mint( IERC721[] memory originCollections, uint256[] memory originTokenIds, uint32 styleTokenId, bytes32[] memory allowlistProof, bytes calldata inputParams ) external payable whenNotPaused nonReentrant returns (uint64 tokenId) { //CHECKS require( styleNFT.isMintable( styleTokenId, originCollections, originTokenIds, msg.sender ) ); if (styleNFT.availableForPublicMinting(styleTokenId) == 0) { if ( allowlistProof.length == 0 || !styleNFT.verifyAllowlistEntryProof( styleTokenId, allowlistProof, msg.sender ) ) { revert NotAllowedToMint('no reservations left or proof failed'); } else { styleNFT.decreaseAllowance(styleTokenId, msg.sender); } } uint256 fee = styleNFT.quoteFee( styleTokenId, originCollections, originTokenIds ); if (msg.value < fee) revert InsufficientFees(); bytes32 _provenanceHash = keccak256( abi.encodePacked(originCollections, originTokenIds, styleTokenId) ); if (provenanceToTokenId[_provenanceHash] != 0x0) { revert ProvenanceAlreadyUsed(); } //EFFECTS uint32 nextStyleMintId = styleNFT.incrementMintedPerStyle(styleTokenId); tokenId = BytesLib.toUint64( abi.encodePacked(styleTokenId, nextStyleMintId), 0 ); provenanceToTokenId[_provenanceHash] = tokenId; //INTERACTIONS with external contracts for (uint256 i = 0; i < originCollections.length; i++) { //https://github.com/crytic/building-secure-contracts/blob/master/development-guidelines/token_integration.md address _owner = originCollections[i].ownerOf(originTokenIds[i]); if (_owner != msg.sender || _owner == address(0)) { revert NotOwningOrigin(); } } AddressUpgradeable.sendValue( payable(styleNFT.getSettings(styleTokenId).paymentSplitter), fee ); _safeMint(msg.sender, tokenId); emit Minted( keccak256(abi.encode(originCollections, originTokenIds)), tokenId, styleTokenId ); //if someone sent slightly too much, we're sending it back to them uint256 surplus = msg.value.sub(fee); if (surplus > 0 && surplus < 100_000_000 gwei) { AddressUpgradeable.sendValue(payable(msg.sender), surplus); } return tokenId; } }
/// @title Splice is a protocol to mint NFTs out of origin NFTs /// @author Stefan Adolf @elmariachi111
NatSpecSingleLine
withdrawEth
function withdrawEth() external nonReentrant onlyOwner { AddressUpgradeable.sendValue( payable(platformBeneficiary), address(this).balance ); }
/** * in case anything drops ETH/ERC20/ERC721 on us accidentally, * this will help us withdraw it. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 2784, 2951 ] }
56,562
SplicePriceStrategyStatic
contracts/Splice.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
Splice
contract Splice is ERC721Upgradeable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable, IERC2981Upgradeable { using SafeMathUpgradeable for uint256; using StringsUpgradeable for uint32; /// @notice you didn't send sufficient fees along error InsufficientFees(); /// @notice The combination of origin and style already has been minted error ProvenanceAlreadyUsed(); /// @notice only reserved mints are left or not on allowlist error NotAllowedToMint(string reason); error NotOwningOrigin(); uint8 public ROYALTY_PERCENT; string private baseUri; //lookup table //keccak(0xcollection + origin_tokenId + styleTokenId) => tokenId mapping(bytes32 => uint64) public provenanceToTokenId; /** * @notice the contract that manages all styles as NFTs. * Styles are owned by artists and manage fee quoting. * Style NFTs are transferrable (you can sell your style to others) */ SpliceStyleNFT public styleNFT; /** * @notice the splice platform account, i.e. a Gnosis Safe / DAO Treasury etc. */ address public platformBeneficiary; event Withdrawn(address indexed user, uint256 amount); event Minted( bytes32 indexed origin_hash, uint64 indexed tokenId, uint32 indexed styleTokenId ); event RoyaltiesUpdated(uint8 royalties); event BeneficiaryChanged(address newBeneficiary); function initialize( string memory baseUri_, SpliceStyleNFT initializedStyleNFT_ ) public initializer { __ERC721_init('Splice', 'SPLICE'); __Ownable_init(); __Pausable_init(); __ReentrancyGuard_init(); ROYALTY_PERCENT = 10; platformBeneficiary = msg.sender; baseUri = baseUri_; styleNFT = initializedStyleNFT_; } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function setBaseUri(string memory newBaseUri) external onlyOwner { baseUri = newBaseUri; } function _baseURI() internal view override returns (string memory) { return baseUri; } //todo: the platform benef. should be the only one to name a new beneficiary, not the owner. function setPlatformBeneficiary(address payable newAddress) external onlyOwner { require(address(0) != newAddress, 'must be a real address'); platformBeneficiary = newAddress; emit BeneficiaryChanged(newAddress); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * in case anything drops ETH/ERC20/ERC721 on us accidentally, * this will help us withdraw it. */ function withdrawEth() external nonReentrant onlyOwner { AddressUpgradeable.sendValue( payable(platformBeneficiary), address(this).balance ); } function withdrawERC20(IERC20 token) external nonReentrant onlyOwner { bool result = token.transfer( platformBeneficiary, token.balanceOf(address(this)) ); if (!result) revert('the transfer failed'); } function withdrawERC721(IERC721 nftContract, uint256 tokenId) external nonReentrant onlyOwner { nftContract.transferFrom(address(this), platformBeneficiary, tokenId); } function styleAndTokenByTokenId(uint256 tokenId) public pure returns (uint32 styleTokenId, uint32 token_tokenId) { bytes memory tokenIdBytes = abi.encode(tokenId); styleTokenId = BytesLib.toUint32(tokenIdBytes, 24); token_tokenId = BytesLib.toUint32(tokenIdBytes, 28); } // for OpenSea function contractURI() public pure returns (string memory) { return 'https://getsplice.io/contract-metadata'; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require( _exists(tokenId), 'ERC721Metadata: URI query for nonexistent token' ); (uint32 styleTokenId, uint32 spliceTokenId) = styleAndTokenByTokenId( tokenId ); if (styleNFT.isFrozen(styleTokenId)) { StyleSettings memory settings = styleNFT.getSettings(styleTokenId); return string( abi.encodePacked( 'ipfs://', settings.styleCID, '/', spliceTokenId.toString() ) ); } else { return super.tokenURI(tokenId); } } function quote( uint32 styleTokenId, IERC721[] memory nfts, uint256[] memory originTokenIds ) external view returns (uint256 fee) { return styleNFT.quoteFee(styleTokenId, nfts, originTokenIds); } /** * @notice this will only have an effect for new styles */ function updateRoyalties(uint8 royaltyPercentage) external onlyOwner { require(royaltyPercentage <= 10, 'royalties must never exceed 10%'); ROYALTY_PERCENT = royaltyPercentage; emit RoyaltiesUpdated(royaltyPercentage); } // https://eips.ethereum.org/EIPS/eip-2981 // https://docs.openzeppelin.com/contracts/4.x/api/interfaces#IERC2981 // https://forum.openzeppelin.com/t/how-do-eip-2891-royalties-work/17177 /** * potentially (hopefully) called by marketplaces to find a target address where to send royalties * @notice the returned address will be a payment splitting instance */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view returns (address receiver, uint256 royaltyAmount) { (uint32 styleTokenId, ) = styleAndTokenByTokenId(tokenId); receiver = styleNFT.getSettings(styleTokenId).paymentSplitter; royaltyAmount = (ROYALTY_PERCENT * salePrice).div(100); } function mint( IERC721[] memory originCollections, uint256[] memory originTokenIds, uint32 styleTokenId, bytes32[] memory allowlistProof, bytes calldata inputParams ) external payable whenNotPaused nonReentrant returns (uint64 tokenId) { //CHECKS require( styleNFT.isMintable( styleTokenId, originCollections, originTokenIds, msg.sender ) ); if (styleNFT.availableForPublicMinting(styleTokenId) == 0) { if ( allowlistProof.length == 0 || !styleNFT.verifyAllowlistEntryProof( styleTokenId, allowlistProof, msg.sender ) ) { revert NotAllowedToMint('no reservations left or proof failed'); } else { styleNFT.decreaseAllowance(styleTokenId, msg.sender); } } uint256 fee = styleNFT.quoteFee( styleTokenId, originCollections, originTokenIds ); if (msg.value < fee) revert InsufficientFees(); bytes32 _provenanceHash = keccak256( abi.encodePacked(originCollections, originTokenIds, styleTokenId) ); if (provenanceToTokenId[_provenanceHash] != 0x0) { revert ProvenanceAlreadyUsed(); } //EFFECTS uint32 nextStyleMintId = styleNFT.incrementMintedPerStyle(styleTokenId); tokenId = BytesLib.toUint64( abi.encodePacked(styleTokenId, nextStyleMintId), 0 ); provenanceToTokenId[_provenanceHash] = tokenId; //INTERACTIONS with external contracts for (uint256 i = 0; i < originCollections.length; i++) { //https://github.com/crytic/building-secure-contracts/blob/master/development-guidelines/token_integration.md address _owner = originCollections[i].ownerOf(originTokenIds[i]); if (_owner != msg.sender || _owner == address(0)) { revert NotOwningOrigin(); } } AddressUpgradeable.sendValue( payable(styleNFT.getSettings(styleTokenId).paymentSplitter), fee ); _safeMint(msg.sender, tokenId); emit Minted( keccak256(abi.encode(originCollections, originTokenIds)), tokenId, styleTokenId ); //if someone sent slightly too much, we're sending it back to them uint256 surplus = msg.value.sub(fee); if (surplus > 0 && surplus < 100_000_000 gwei) { AddressUpgradeable.sendValue(payable(msg.sender), surplus); } return tokenId; } }
/// @title Splice is a protocol to mint NFTs out of origin NFTs /// @author Stefan Adolf @elmariachi111
NatSpecSingleLine
contractURI
function contractURI() public pure returns (string memory) { return 'https://getsplice.io/contract-metadata'; }
// for OpenSea
LineComment
v0.8.10+commit.fc410830
{ "func_code_index": [ 3696, 3815 ] }
56,563
SplicePriceStrategyStatic
contracts/Splice.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
Splice
contract Splice is ERC721Upgradeable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable, IERC2981Upgradeable { using SafeMathUpgradeable for uint256; using StringsUpgradeable for uint32; /// @notice you didn't send sufficient fees along error InsufficientFees(); /// @notice The combination of origin and style already has been minted error ProvenanceAlreadyUsed(); /// @notice only reserved mints are left or not on allowlist error NotAllowedToMint(string reason); error NotOwningOrigin(); uint8 public ROYALTY_PERCENT; string private baseUri; //lookup table //keccak(0xcollection + origin_tokenId + styleTokenId) => tokenId mapping(bytes32 => uint64) public provenanceToTokenId; /** * @notice the contract that manages all styles as NFTs. * Styles are owned by artists and manage fee quoting. * Style NFTs are transferrable (you can sell your style to others) */ SpliceStyleNFT public styleNFT; /** * @notice the splice platform account, i.e. a Gnosis Safe / DAO Treasury etc. */ address public platformBeneficiary; event Withdrawn(address indexed user, uint256 amount); event Minted( bytes32 indexed origin_hash, uint64 indexed tokenId, uint32 indexed styleTokenId ); event RoyaltiesUpdated(uint8 royalties); event BeneficiaryChanged(address newBeneficiary); function initialize( string memory baseUri_, SpliceStyleNFT initializedStyleNFT_ ) public initializer { __ERC721_init('Splice', 'SPLICE'); __Ownable_init(); __Pausable_init(); __ReentrancyGuard_init(); ROYALTY_PERCENT = 10; platformBeneficiary = msg.sender; baseUri = baseUri_; styleNFT = initializedStyleNFT_; } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function setBaseUri(string memory newBaseUri) external onlyOwner { baseUri = newBaseUri; } function _baseURI() internal view override returns (string memory) { return baseUri; } //todo: the platform benef. should be the only one to name a new beneficiary, not the owner. function setPlatformBeneficiary(address payable newAddress) external onlyOwner { require(address(0) != newAddress, 'must be a real address'); platformBeneficiary = newAddress; emit BeneficiaryChanged(newAddress); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * in case anything drops ETH/ERC20/ERC721 on us accidentally, * this will help us withdraw it. */ function withdrawEth() external nonReentrant onlyOwner { AddressUpgradeable.sendValue( payable(platformBeneficiary), address(this).balance ); } function withdrawERC20(IERC20 token) external nonReentrant onlyOwner { bool result = token.transfer( platformBeneficiary, token.balanceOf(address(this)) ); if (!result) revert('the transfer failed'); } function withdrawERC721(IERC721 nftContract, uint256 tokenId) external nonReentrant onlyOwner { nftContract.transferFrom(address(this), platformBeneficiary, tokenId); } function styleAndTokenByTokenId(uint256 tokenId) public pure returns (uint32 styleTokenId, uint32 token_tokenId) { bytes memory tokenIdBytes = abi.encode(tokenId); styleTokenId = BytesLib.toUint32(tokenIdBytes, 24); token_tokenId = BytesLib.toUint32(tokenIdBytes, 28); } // for OpenSea function contractURI() public pure returns (string memory) { return 'https://getsplice.io/contract-metadata'; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require( _exists(tokenId), 'ERC721Metadata: URI query for nonexistent token' ); (uint32 styleTokenId, uint32 spliceTokenId) = styleAndTokenByTokenId( tokenId ); if (styleNFT.isFrozen(styleTokenId)) { StyleSettings memory settings = styleNFT.getSettings(styleTokenId); return string( abi.encodePacked( 'ipfs://', settings.styleCID, '/', spliceTokenId.toString() ) ); } else { return super.tokenURI(tokenId); } } function quote( uint32 styleTokenId, IERC721[] memory nfts, uint256[] memory originTokenIds ) external view returns (uint256 fee) { return styleNFT.quoteFee(styleTokenId, nfts, originTokenIds); } /** * @notice this will only have an effect for new styles */ function updateRoyalties(uint8 royaltyPercentage) external onlyOwner { require(royaltyPercentage <= 10, 'royalties must never exceed 10%'); ROYALTY_PERCENT = royaltyPercentage; emit RoyaltiesUpdated(royaltyPercentage); } // https://eips.ethereum.org/EIPS/eip-2981 // https://docs.openzeppelin.com/contracts/4.x/api/interfaces#IERC2981 // https://forum.openzeppelin.com/t/how-do-eip-2891-royalties-work/17177 /** * potentially (hopefully) called by marketplaces to find a target address where to send royalties * @notice the returned address will be a payment splitting instance */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view returns (address receiver, uint256 royaltyAmount) { (uint32 styleTokenId, ) = styleAndTokenByTokenId(tokenId); receiver = styleNFT.getSettings(styleTokenId).paymentSplitter; royaltyAmount = (ROYALTY_PERCENT * salePrice).div(100); } function mint( IERC721[] memory originCollections, uint256[] memory originTokenIds, uint32 styleTokenId, bytes32[] memory allowlistProof, bytes calldata inputParams ) external payable whenNotPaused nonReentrant returns (uint64 tokenId) { //CHECKS require( styleNFT.isMintable( styleTokenId, originCollections, originTokenIds, msg.sender ) ); if (styleNFT.availableForPublicMinting(styleTokenId) == 0) { if ( allowlistProof.length == 0 || !styleNFT.verifyAllowlistEntryProof( styleTokenId, allowlistProof, msg.sender ) ) { revert NotAllowedToMint('no reservations left or proof failed'); } else { styleNFT.decreaseAllowance(styleTokenId, msg.sender); } } uint256 fee = styleNFT.quoteFee( styleTokenId, originCollections, originTokenIds ); if (msg.value < fee) revert InsufficientFees(); bytes32 _provenanceHash = keccak256( abi.encodePacked(originCollections, originTokenIds, styleTokenId) ); if (provenanceToTokenId[_provenanceHash] != 0x0) { revert ProvenanceAlreadyUsed(); } //EFFECTS uint32 nextStyleMintId = styleNFT.incrementMintedPerStyle(styleTokenId); tokenId = BytesLib.toUint64( abi.encodePacked(styleTokenId, nextStyleMintId), 0 ); provenanceToTokenId[_provenanceHash] = tokenId; //INTERACTIONS with external contracts for (uint256 i = 0; i < originCollections.length; i++) { //https://github.com/crytic/building-secure-contracts/blob/master/development-guidelines/token_integration.md address _owner = originCollections[i].ownerOf(originTokenIds[i]); if (_owner != msg.sender || _owner == address(0)) { revert NotOwningOrigin(); } } AddressUpgradeable.sendValue( payable(styleNFT.getSettings(styleTokenId).paymentSplitter), fee ); _safeMint(msg.sender, tokenId); emit Minted( keccak256(abi.encode(originCollections, originTokenIds)), tokenId, styleTokenId ); //if someone sent slightly too much, we're sending it back to them uint256 surplus = msg.value.sub(fee); if (surplus > 0 && surplus < 100_000_000 gwei) { AddressUpgradeable.sendValue(payable(msg.sender), surplus); } return tokenId; } }
/// @title Splice is a protocol to mint NFTs out of origin NFTs /// @author Stefan Adolf @elmariachi111
NatSpecSingleLine
updateRoyalties
function updateRoyalties(uint8 royaltyPercentage) external onlyOwner { require(royaltyPercentage <= 10, 'royalties must never exceed 10%'); ROYALTY_PERCENT = royaltyPercentage; emit RoyaltiesUpdated(royaltyPercentage); }
/** * @notice this will only have an effect for new styles */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 4771, 5007 ] }
56,564
SplicePriceStrategyStatic
contracts/Splice.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
Splice
contract Splice is ERC721Upgradeable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable, IERC2981Upgradeable { using SafeMathUpgradeable for uint256; using StringsUpgradeable for uint32; /// @notice you didn't send sufficient fees along error InsufficientFees(); /// @notice The combination of origin and style already has been minted error ProvenanceAlreadyUsed(); /// @notice only reserved mints are left or not on allowlist error NotAllowedToMint(string reason); error NotOwningOrigin(); uint8 public ROYALTY_PERCENT; string private baseUri; //lookup table //keccak(0xcollection + origin_tokenId + styleTokenId) => tokenId mapping(bytes32 => uint64) public provenanceToTokenId; /** * @notice the contract that manages all styles as NFTs. * Styles are owned by artists and manage fee quoting. * Style NFTs are transferrable (you can sell your style to others) */ SpliceStyleNFT public styleNFT; /** * @notice the splice platform account, i.e. a Gnosis Safe / DAO Treasury etc. */ address public platformBeneficiary; event Withdrawn(address indexed user, uint256 amount); event Minted( bytes32 indexed origin_hash, uint64 indexed tokenId, uint32 indexed styleTokenId ); event RoyaltiesUpdated(uint8 royalties); event BeneficiaryChanged(address newBeneficiary); function initialize( string memory baseUri_, SpliceStyleNFT initializedStyleNFT_ ) public initializer { __ERC721_init('Splice', 'SPLICE'); __Ownable_init(); __Pausable_init(); __ReentrancyGuard_init(); ROYALTY_PERCENT = 10; platformBeneficiary = msg.sender; baseUri = baseUri_; styleNFT = initializedStyleNFT_; } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } function setBaseUri(string memory newBaseUri) external onlyOwner { baseUri = newBaseUri; } function _baseURI() internal view override returns (string memory) { return baseUri; } //todo: the platform benef. should be the only one to name a new beneficiary, not the owner. function setPlatformBeneficiary(address payable newAddress) external onlyOwner { require(address(0) != newAddress, 'must be a real address'); platformBeneficiary = newAddress; emit BeneficiaryChanged(newAddress); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * in case anything drops ETH/ERC20/ERC721 on us accidentally, * this will help us withdraw it. */ function withdrawEth() external nonReentrant onlyOwner { AddressUpgradeable.sendValue( payable(platformBeneficiary), address(this).balance ); } function withdrawERC20(IERC20 token) external nonReentrant onlyOwner { bool result = token.transfer( platformBeneficiary, token.balanceOf(address(this)) ); if (!result) revert('the transfer failed'); } function withdrawERC721(IERC721 nftContract, uint256 tokenId) external nonReentrant onlyOwner { nftContract.transferFrom(address(this), platformBeneficiary, tokenId); } function styleAndTokenByTokenId(uint256 tokenId) public pure returns (uint32 styleTokenId, uint32 token_tokenId) { bytes memory tokenIdBytes = abi.encode(tokenId); styleTokenId = BytesLib.toUint32(tokenIdBytes, 24); token_tokenId = BytesLib.toUint32(tokenIdBytes, 28); } // for OpenSea function contractURI() public pure returns (string memory) { return 'https://getsplice.io/contract-metadata'; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require( _exists(tokenId), 'ERC721Metadata: URI query for nonexistent token' ); (uint32 styleTokenId, uint32 spliceTokenId) = styleAndTokenByTokenId( tokenId ); if (styleNFT.isFrozen(styleTokenId)) { StyleSettings memory settings = styleNFT.getSettings(styleTokenId); return string( abi.encodePacked( 'ipfs://', settings.styleCID, '/', spliceTokenId.toString() ) ); } else { return super.tokenURI(tokenId); } } function quote( uint32 styleTokenId, IERC721[] memory nfts, uint256[] memory originTokenIds ) external view returns (uint256 fee) { return styleNFT.quoteFee(styleTokenId, nfts, originTokenIds); } /** * @notice this will only have an effect for new styles */ function updateRoyalties(uint8 royaltyPercentage) external onlyOwner { require(royaltyPercentage <= 10, 'royalties must never exceed 10%'); ROYALTY_PERCENT = royaltyPercentage; emit RoyaltiesUpdated(royaltyPercentage); } // https://eips.ethereum.org/EIPS/eip-2981 // https://docs.openzeppelin.com/contracts/4.x/api/interfaces#IERC2981 // https://forum.openzeppelin.com/t/how-do-eip-2891-royalties-work/17177 /** * potentially (hopefully) called by marketplaces to find a target address where to send royalties * @notice the returned address will be a payment splitting instance */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view returns (address receiver, uint256 royaltyAmount) { (uint32 styleTokenId, ) = styleAndTokenByTokenId(tokenId); receiver = styleNFT.getSettings(styleTokenId).paymentSplitter; royaltyAmount = (ROYALTY_PERCENT * salePrice).div(100); } function mint( IERC721[] memory originCollections, uint256[] memory originTokenIds, uint32 styleTokenId, bytes32[] memory allowlistProof, bytes calldata inputParams ) external payable whenNotPaused nonReentrant returns (uint64 tokenId) { //CHECKS require( styleNFT.isMintable( styleTokenId, originCollections, originTokenIds, msg.sender ) ); if (styleNFT.availableForPublicMinting(styleTokenId) == 0) { if ( allowlistProof.length == 0 || !styleNFT.verifyAllowlistEntryProof( styleTokenId, allowlistProof, msg.sender ) ) { revert NotAllowedToMint('no reservations left or proof failed'); } else { styleNFT.decreaseAllowance(styleTokenId, msg.sender); } } uint256 fee = styleNFT.quoteFee( styleTokenId, originCollections, originTokenIds ); if (msg.value < fee) revert InsufficientFees(); bytes32 _provenanceHash = keccak256( abi.encodePacked(originCollections, originTokenIds, styleTokenId) ); if (provenanceToTokenId[_provenanceHash] != 0x0) { revert ProvenanceAlreadyUsed(); } //EFFECTS uint32 nextStyleMintId = styleNFT.incrementMintedPerStyle(styleTokenId); tokenId = BytesLib.toUint64( abi.encodePacked(styleTokenId, nextStyleMintId), 0 ); provenanceToTokenId[_provenanceHash] = tokenId; //INTERACTIONS with external contracts for (uint256 i = 0; i < originCollections.length; i++) { //https://github.com/crytic/building-secure-contracts/blob/master/development-guidelines/token_integration.md address _owner = originCollections[i].ownerOf(originTokenIds[i]); if (_owner != msg.sender || _owner == address(0)) { revert NotOwningOrigin(); } } AddressUpgradeable.sendValue( payable(styleNFT.getSettings(styleTokenId).paymentSplitter), fee ); _safeMint(msg.sender, tokenId); emit Minted( keccak256(abi.encode(originCollections, originTokenIds)), tokenId, styleTokenId ); //if someone sent slightly too much, we're sending it back to them uint256 surplus = msg.value.sub(fee); if (surplus > 0 && surplus < 100_000_000 gwei) { AddressUpgradeable.sendValue(payable(msg.sender), surplus); } return tokenId; } }
/// @title Splice is a protocol to mint NFTs out of origin NFTs /// @author Stefan Adolf @elmariachi111
NatSpecSingleLine
royaltyInfo
function royaltyInfo(uint256 tokenId, uint256 salePrice) public view returns (address receiver, uint256 royaltyAmount) { (uint32 styleTokenId, ) = styleAndTokenByTokenId(tokenId); receiver = styleNFT.getSettings(styleTokenId).paymentSplitter; royaltyAmount = (ROYALTY_PERCENT * salePrice).div(100); }
/** * potentially (hopefully) called by marketplaces to find a target address where to send royalties * @notice the returned address will be a payment splitting instance */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 5386, 5716 ] }
56,565
SplicePriceStrategyStatic
contracts/PaymentSplitterController.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
PaymentSplitterController
contract PaymentSplitterController is Initializable, ReentrancyGuardUpgradeable { /** * @dev each style tokens' payment splitter instance */ mapping(uint256 => ReplaceablePaymentSplitter) public splitters; address[] private PAYMENT_TOKENS; /** * @dev the base instance that minimal proxies are cloned from */ address private _splitterTemplate; address private _owner; function initialize(address owner_, address[] memory paymentTokens_) public initializer { __ReentrancyGuard_init(); require(owner_ != address(0), 'initial owner mustnt be 0'); _owner = owner_; PAYMENT_TOKENS = paymentTokens_; _splitterTemplate = address(new ReplaceablePaymentSplitter()); } modifier onlyOwner() { require(msg.sender == _owner, 'only callable by owner'); _; } function createSplit( uint256 tokenId, address[] memory payees_, uint256[] memory shares_ ) external onlyOwner returns (address ps_address) { require(payees_.length == shares_.length, 'p and s len mismatch'); require(payees_.length > 0, 'no payees'); require(address(splitters[tokenId]) == address(0), 'ps exists'); // ReplaceablePaymentSplitter ps = new ReplaceablePaymentSplitter(); ps_address = Clones.clone(_splitterTemplate); ReplaceablePaymentSplitter ps = ReplaceablePaymentSplitter( payable(ps_address) ); splitters[tokenId] = ps; ps.initialize(address(this), payees_, shares_); } /** * @notice when splitters_ is [], we try to get *all* of your funds out * to withdraw individual tokens or in case some external call fails, * one can still call the payment splitter's release methods directly. */ function withdrawAll(address payable payee, address[] memory splitters_) external nonReentrant { for (uint256 i = 0; i < splitters_.length; i++) { releaseAll(ReplaceablePaymentSplitter(payable(splitters_[i])), payee); } } function releaseAll(ReplaceablePaymentSplitter ps, address payable account) internal { try ps.release(account) { /*empty*/ } catch { /*empty*/ } for (uint256 i = 0; i < PAYMENT_TOKENS.length; i++) { try ps.release(IERC20(PAYMENT_TOKENS[i]), account) { /*empty*/ } catch { /*empty*/ } } } function replaceShareholder( uint256 styleTokenId, address payable from, address to ) external onlyOwner nonReentrant { ReplaceablePaymentSplitter ps = splitters[styleTokenId]; releaseAll(ps, from); ps.replacePayee(from, to); } }
withdrawAll
function withdrawAll(address payable payee, address[] memory splitters_) external nonReentrant { for (uint256 i = 0; i < splitters_.length; i++) { releaseAll(ReplaceablePaymentSplitter(payable(splitters_[i])), payee); } }
/** * @notice when splitters_ is [], we try to get *all* of your funds out * to withdraw individual tokens or in case some external call fails, * one can still call the payment splitter's release methods directly. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 1707, 1956 ] }
56,566
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }
// ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // ----------------------------------------------------------------------------
LineComment
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 94, 154 ] }
56,567
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
BXB
contract BXB is IERC20, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() { symbol = "BXB"; name = "BLK BLOX COIN"; decimals = 18; _totalSupply = 40000000000e18; // 40,000,000,000 BXB address owner = owner; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view override returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // 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-token-standard.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 virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // 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 view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ receive () external payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
totalSupply
function totalSupply() public view override returns (uint) { return _totalSupply; }
// ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------
LineComment
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 937, 1039 ] }
56,568
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
BXB
contract BXB is IERC20, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() { symbol = "BXB"; name = "BLK BLOX COIN"; decimals = 18; _totalSupply = 40000000000e18; // 40,000,000,000 BXB address owner = owner; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view override returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // 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-token-standard.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 virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // 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 view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ receive () external payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
balanceOf
function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; }
// ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------
LineComment
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 1259, 1393 ] }
56,569
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
BXB
contract BXB is IERC20, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() { symbol = "BXB"; name = "BLK BLOX COIN"; decimals = 18; _totalSupply = 40000000000e18; // 40,000,000,000 BXB address owner = owner; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view override returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // 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-token-standard.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 virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // 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 view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ receive () external payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transfer
function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; }
// ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 1737, 2023 ] }
56,570
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
BXB
contract BXB is IERC20, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() { symbol = "BXB"; name = "BLK BLOX COIN"; decimals = 18; _totalSupply = 40000000000e18; // 40,000,000,000 BXB address owner = owner; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view override returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // 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-token-standard.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 virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // 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 view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ receive () external payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approve
function approve(address spender, uint tokens) public virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; }
// ------------------------------------------------------------------------ // 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-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------
LineComment
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 2531, 2756 ] }
56,571
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
BXB
contract BXB is IERC20, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() { symbol = "BXB"; name = "BLK BLOX COIN"; decimals = 18; _totalSupply = 40000000000e18; // 40,000,000,000 BXB address owner = owner; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view override returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // 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-token-standard.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 virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // 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 view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ receive () external payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferFrom
function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; }
// ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------
LineComment
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 3285, 3660 ] }
56,572
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
BXB
contract BXB is IERC20, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() { symbol = "BXB"; name = "BLK BLOX COIN"; decimals = 18; _totalSupply = 40000000000e18; // 40,000,000,000 BXB address owner = owner; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view override returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // 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-token-standard.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 virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // 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 view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ receive () external payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
allowance
function allowance(address tokenOwner, address spender) public view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; }
// ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------
LineComment
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 3943, 4113 ] }
56,573
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
BXB
contract BXB is IERC20, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() { symbol = "BXB"; name = "BLK BLOX COIN"; decimals = 18; _totalSupply = 40000000000e18; // 40,000,000,000 BXB address owner = owner; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view override returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // 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-token-standard.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 virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // 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 view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ receive () external payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
approveAndCall
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; }
// ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------
LineComment
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 4468, 4801 ] }
56,574
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
BXB
contract BXB is IERC20, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() { symbol = "BXB"; name = "BLK BLOX COIN"; decimals = 18; _totalSupply = 40000000000e18; // 40,000,000,000 BXB address owner = owner; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view override returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // 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-token-standard.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 virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // 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 view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ receive () external payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
// ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------
LineComment
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 4993, 5053 ] }
56,575
BXB
BXB.sol
0x1bf4e14bbb74dd4f31e740b521203f1e0eeb21f3
Solidity
BXB
contract BXB is IERC20, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() { symbol = "BXB"; name = "BLK BLOX COIN"; decimals = 18; _totalSupply = 40000000000e18; // 40,000,000,000 BXB address owner = owner; balances[owner] = _totalSupply; emit Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view override returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view override returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public override returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // 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-token-standard.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 virtual override returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // 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 // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public virtual override returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // 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 view virtual override returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ receive () external payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); } }
// ---------------------------------------------------------------------------- // ERC20 Token, with the addition of symbol, name and decimals and assisted // token transfers // ----------------------------------------------------------------------------
LineComment
transferAnyERC20Token
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return IERC20(tokenAddress).transfer(owner, tokens); }
// ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------
LineComment
v0.8.3+commit.8d00100c
MIT
ipfs://cdd8b84e43247731fef454781ba07d9c7b2f0af4c06441f256dd3d19c525da15
{ "func_code_index": [ 5286, 5467 ] }
56,576
GiftCrowdsale
contracts/BurnableToken.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
BurnableToken
contract BurnableToken is StandardToken, Ownable { event Burn(address indexed burner, uint256 amount); /** * @dev Anybody can burn a specific amount of their tokens. * @param _amount The amount of token to be burned. */ function burn(uint256 _amount) public { burnInternal(msg.sender, _amount); } /** * @dev Owner can burn a specific amount of tokens of other token holders. * @param _from The address of token holder whose tokens to be burned. * @param _amount The amount of token to be burned. */ function burnFrom(address _from, uint256 _amount) public onlyOwner { burnInternal(_from, _amount); } /** * @dev Burns a specific amount of tokens of a token holder. * @param _from The address of token holder whose tokens are to be burned. * @param _amount The amount of token to be burned. */ function burnInternal(address _from, uint256 _amount) internal { require(_from != address(0)); require(_amount > 0); require(_amount <= balances[_from]); // no need to require _amount <= totalSupply, since that would imply the // sender's balance is greater than the totalSupply, which *should* be an assertion failure balances[_from] = balances[_from].sub(_amount); totalSupply_ = totalSupply_.sub(_amount); Transfer(_from, address(0), _amount); Burn(_from, _amount); } }
/** * @title Customized Burnable Token * @dev Token that can be irreversibly burned (destroyed). */
NatSpecMultiLine
burn
function burn(uint256 _amount) public { burnInternal(msg.sender, _amount); }
/** * @dev Anybody can burn a specific amount of their tokens. * @param _amount The amount of token to be burned. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 250, 345 ] }
56,577
GiftCrowdsale
contracts/BurnableToken.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
BurnableToken
contract BurnableToken is StandardToken, Ownable { event Burn(address indexed burner, uint256 amount); /** * @dev Anybody can burn a specific amount of their tokens. * @param _amount The amount of token to be burned. */ function burn(uint256 _amount) public { burnInternal(msg.sender, _amount); } /** * @dev Owner can burn a specific amount of tokens of other token holders. * @param _from The address of token holder whose tokens to be burned. * @param _amount The amount of token to be burned. */ function burnFrom(address _from, uint256 _amount) public onlyOwner { burnInternal(_from, _amount); } /** * @dev Burns a specific amount of tokens of a token holder. * @param _from The address of token holder whose tokens are to be burned. * @param _amount The amount of token to be burned. */ function burnInternal(address _from, uint256 _amount) internal { require(_from != address(0)); require(_amount > 0); require(_amount <= balances[_from]); // no need to require _amount <= totalSupply, since that would imply the // sender's balance is greater than the totalSupply, which *should* be an assertion failure balances[_from] = balances[_from].sub(_amount); totalSupply_ = totalSupply_.sub(_amount); Transfer(_from, address(0), _amount); Burn(_from, _amount); } }
/** * @title Customized Burnable Token * @dev Token that can be irreversibly burned (destroyed). */
NatSpecMultiLine
burnFrom
function burnFrom(address _from, uint256 _amount) public onlyOwner { burnInternal(_from, _amount); }
/** * @dev Owner can burn a specific amount of tokens of other token holders. * @param _from The address of token holder whose tokens to be burned. * @param _amount The amount of token to be burned. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 575, 694 ] }
56,578
GiftCrowdsale
contracts/BurnableToken.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
BurnableToken
contract BurnableToken is StandardToken, Ownable { event Burn(address indexed burner, uint256 amount); /** * @dev Anybody can burn a specific amount of their tokens. * @param _amount The amount of token to be burned. */ function burn(uint256 _amount) public { burnInternal(msg.sender, _amount); } /** * @dev Owner can burn a specific amount of tokens of other token holders. * @param _from The address of token holder whose tokens to be burned. * @param _amount The amount of token to be burned. */ function burnFrom(address _from, uint256 _amount) public onlyOwner { burnInternal(_from, _amount); } /** * @dev Burns a specific amount of tokens of a token holder. * @param _from The address of token holder whose tokens are to be burned. * @param _amount The amount of token to be burned. */ function burnInternal(address _from, uint256 _amount) internal { require(_from != address(0)); require(_amount > 0); require(_amount <= balances[_from]); // no need to require _amount <= totalSupply, since that would imply the // sender's balance is greater than the totalSupply, which *should* be an assertion failure balances[_from] = balances[_from].sub(_amount); totalSupply_ = totalSupply_.sub(_amount); Transfer(_from, address(0), _amount); Burn(_from, _amount); } }
/** * @title Customized Burnable Token * @dev Token that can be irreversibly burned (destroyed). */
NatSpecMultiLine
burnInternal
function burnInternal(address _from, uint256 _amount) internal { require(_from != address(0)); require(_amount > 0); require(_amount <= balances[_from]); // no need to require _amount <= totalSupply, since that would imply the // sender's balance is greater than the totalSupply, which *should* be an assertion failure balances[_from] = balances[_from].sub(_amount); totalSupply_ = totalSupply_.sub(_amount); Transfer(_from, address(0), _amount); Burn(_from, _amount); }
/** * @dev Burns a specific amount of tokens of a token holder. * @param _from The address of token holder whose tokens are to be burned. * @param _amount The amount of token to be burned. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 914, 1477 ] }
56,579
GiftCrowdsale
contracts/GiftToken.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftToken
contract GiftToken is BurnableToken, Pausable { string public name = "Giftcoin"; string public symbol = "GIFT"; uint8 public decimals = 18; uint256 public initialTotalSupply = uint256(1e8) * (uint256(10) ** decimals); address private addressIco; modifier onlyIco() { require(msg.sender == addressIco); _; } /** * @dev Create GiftToken contract and set pause * @param _ico The address of ICO contract. */ function GiftToken(address _ico) public { pause(); setIcoAddress(_ico); totalSupply_ = initialTotalSupply; balances[_ico] = balances[_ico].add(initialTotalSupply); Transfer(address(0), _ico, initialTotalSupply); } function setIcoAddress(address _ico) public onlyOwner { require(_ico != address(0)); // to change the ICO address firstly transfer the tokens to the new ICO require(balanceOf(addressIco) == 0); addressIco = _ico; // the ownership of the token needs to be transferred to the crowdsale contract // but it can be reclaimed using transferTokenOwnership() function // or along withdrawal of the funds transferOwnership(_ico); } /** * @dev Transfer token for a specified address with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } /** * @dev Transfer tokens from one address to another with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @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 whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } /** * @dev Transfer tokens from ICO address to another address. * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transferFromIco(address _to, uint256 _value) public onlyIco returns (bool) { return super.transfer(_to, _value); } }
GiftToken
function GiftToken(address _ico) public { pause(); setIcoAddress(_ico); totalSupply_ = initialTotalSupply; balances[_ico] = balances[_ico].add(initialTotalSupply); Transfer(address(0), _ico, initialTotalSupply); }
/** * @dev Create GiftToken contract and set pause * @param _ico The address of ICO contract. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 490, 760 ] }
56,580
GiftCrowdsale
contracts/GiftToken.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftToken
contract GiftToken is BurnableToken, Pausable { string public name = "Giftcoin"; string public symbol = "GIFT"; uint8 public decimals = 18; uint256 public initialTotalSupply = uint256(1e8) * (uint256(10) ** decimals); address private addressIco; modifier onlyIco() { require(msg.sender == addressIco); _; } /** * @dev Create GiftToken contract and set pause * @param _ico The address of ICO contract. */ function GiftToken(address _ico) public { pause(); setIcoAddress(_ico); totalSupply_ = initialTotalSupply; balances[_ico] = balances[_ico].add(initialTotalSupply); Transfer(address(0), _ico, initialTotalSupply); } function setIcoAddress(address _ico) public onlyOwner { require(_ico != address(0)); // to change the ICO address firstly transfer the tokens to the new ICO require(balanceOf(addressIco) == 0); addressIco = _ico; // the ownership of the token needs to be transferred to the crowdsale contract // but it can be reclaimed using transferTokenOwnership() function // or along withdrawal of the funds transferOwnership(_ico); } /** * @dev Transfer token for a specified address with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } /** * @dev Transfer tokens from one address to another with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @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 whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } /** * @dev Transfer tokens from ICO address to another address. * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transferFromIco(address _to, uint256 _value) public onlyIco returns (bool) { return super.transfer(_to, _value); } }
transfer
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); }
/** * @dev Transfer token for a specified address with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 1539, 1680 ] }
56,581
GiftCrowdsale
contracts/GiftToken.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftToken
contract GiftToken is BurnableToken, Pausable { string public name = "Giftcoin"; string public symbol = "GIFT"; uint8 public decimals = 18; uint256 public initialTotalSupply = uint256(1e8) * (uint256(10) ** decimals); address private addressIco; modifier onlyIco() { require(msg.sender == addressIco); _; } /** * @dev Create GiftToken contract and set pause * @param _ico The address of ICO contract. */ function GiftToken(address _ico) public { pause(); setIcoAddress(_ico); totalSupply_ = initialTotalSupply; balances[_ico] = balances[_ico].add(initialTotalSupply); Transfer(address(0), _ico, initialTotalSupply); } function setIcoAddress(address _ico) public onlyOwner { require(_ico != address(0)); // to change the ICO address firstly transfer the tokens to the new ICO require(balanceOf(addressIco) == 0); addressIco = _ico; // the ownership of the token needs to be transferred to the crowdsale contract // but it can be reclaimed using transferTokenOwnership() function // or along withdrawal of the funds transferOwnership(_ico); } /** * @dev Transfer token for a specified address with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } /** * @dev Transfer tokens from one address to another with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @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 whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } /** * @dev Transfer tokens from ICO address to another address. * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transferFromIco(address _to, uint256 _value) public onlyIco returns (bool) { return super.transfer(_to, _value); } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); }
/** * @dev Transfer tokens from one address to another with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @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 */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 2065, 2236 ] }
56,582
GiftCrowdsale
contracts/GiftToken.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftToken
contract GiftToken is BurnableToken, Pausable { string public name = "Giftcoin"; string public symbol = "GIFT"; uint8 public decimals = 18; uint256 public initialTotalSupply = uint256(1e8) * (uint256(10) ** decimals); address private addressIco; modifier onlyIco() { require(msg.sender == addressIco); _; } /** * @dev Create GiftToken contract and set pause * @param _ico The address of ICO contract. */ function GiftToken(address _ico) public { pause(); setIcoAddress(_ico); totalSupply_ = initialTotalSupply; balances[_ico] = balances[_ico].add(initialTotalSupply); Transfer(address(0), _ico, initialTotalSupply); } function setIcoAddress(address _ico) public onlyOwner { require(_ico != address(0)); // to change the ICO address firstly transfer the tokens to the new ICO require(balanceOf(addressIco) == 0); addressIco = _ico; // the ownership of the token needs to be transferred to the crowdsale contract // but it can be reclaimed using transferTokenOwnership() function // or along withdrawal of the funds transferOwnership(_ico); } /** * @dev Transfer token for a specified address with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } /** * @dev Transfer tokens from one address to another with pause feature for owner. * @dev Only applies when the transfer is allowed by the owner. * @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 whenNotPaused returns (bool) { return super.transferFrom(_from, _to, _value); } /** * @dev Transfer tokens from ICO address to another address. * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transferFromIco(address _to, uint256 _value) public onlyIco returns (bool) { return super.transfer(_to, _value); } }
transferFromIco
function transferFromIco(address _to, uint256 _value) public onlyIco returns (bool) { return super.transfer(_to, _value); }
/** * @dev Transfer tokens from ICO address to another address. * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 2418, 2560 ] }
56,583
GiftCrowdsale
contracts/Whitelist.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
Whitelist
contract Whitelist is Ownable { struct WalletInfo { string data; bool whitelisted; uint256 createdTimestamp; } address public backendAddress; mapping(address => WalletInfo) public whitelist; uint256 public whitelistLength = 0; /** * @dev Sets the backend address for automated operations. * @param _backendAddress The backend address to allow. */ function setBackendAddress(address _backendAddress) public onlyOwner { require(_backendAddress != address(0)); backendAddress = _backendAddress; } /** * @dev Allows the function to be called only by the owner and backend. */ modifier onlyPrivilegedAddresses() { require(msg.sender == owner || msg.sender == backendAddress); _; } /** * @dev Add wallet to whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of wallet to add. * @param _data The checksum of additional wallet data. */ function addWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet].data = _data; whitelist[_wallet].whitelisted = true; whitelist[_wallet].createdTimestamp = now; whitelistLength++; } /** * @dev Update additional data for whitelisted wallet. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to update. * @param _data The checksum of new additional wallet data. */ function updateWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet].data = _data; } /** * @dev Remove wallet from whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to remove. */ function removeWallet(address _wallet) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); delete whitelist[_wallet]; whitelistLength--; } /** * @dev Check the specified wallet whether it is in the whitelist. * @param _wallet The address of wallet to check. */ function isWhitelisted(address _wallet) public view returns (bool) { return whitelist[_wallet].whitelisted; } /** * @dev Get the checksum of additional data for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletData(address _wallet) public view returns (string) { return whitelist[_wallet].data; } /** * @dev Get the creation timestamp for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletCreatedTimestamp(address _wallet) public view returns (uint256) { return whitelist[_wallet].createdTimestamp; } }
/** * @title Whitelist contract * @dev Whitelist for wallets, with additional data for every wallet. */
NatSpecMultiLine
setBackendAddress
function setBackendAddress(address _backendAddress) public onlyOwner { require(_backendAddress != address(0)); backendAddress = _backendAddress; }
/** * @dev Sets the backend address for automated operations. * @param _backendAddress The backend address to allow. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 428, 602 ] }
56,584
GiftCrowdsale
contracts/Whitelist.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
Whitelist
contract Whitelist is Ownable { struct WalletInfo { string data; bool whitelisted; uint256 createdTimestamp; } address public backendAddress; mapping(address => WalletInfo) public whitelist; uint256 public whitelistLength = 0; /** * @dev Sets the backend address for automated operations. * @param _backendAddress The backend address to allow. */ function setBackendAddress(address _backendAddress) public onlyOwner { require(_backendAddress != address(0)); backendAddress = _backendAddress; } /** * @dev Allows the function to be called only by the owner and backend. */ modifier onlyPrivilegedAddresses() { require(msg.sender == owner || msg.sender == backendAddress); _; } /** * @dev Add wallet to whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of wallet to add. * @param _data The checksum of additional wallet data. */ function addWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet].data = _data; whitelist[_wallet].whitelisted = true; whitelist[_wallet].createdTimestamp = now; whitelistLength++; } /** * @dev Update additional data for whitelisted wallet. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to update. * @param _data The checksum of new additional wallet data. */ function updateWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet].data = _data; } /** * @dev Remove wallet from whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to remove. */ function removeWallet(address _wallet) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); delete whitelist[_wallet]; whitelistLength--; } /** * @dev Check the specified wallet whether it is in the whitelist. * @param _wallet The address of wallet to check. */ function isWhitelisted(address _wallet) public view returns (bool) { return whitelist[_wallet].whitelisted; } /** * @dev Get the checksum of additional data for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletData(address _wallet) public view returns (string) { return whitelist[_wallet].data; } /** * @dev Get the creation timestamp for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletCreatedTimestamp(address _wallet) public view returns (uint256) { return whitelist[_wallet].createdTimestamp; } }
/** * @title Whitelist contract * @dev Whitelist for wallets, with additional data for every wallet. */
NatSpecMultiLine
addWallet
function addWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet].data = _data; whitelist[_wallet].whitelisted = true; whitelist[_wallet].createdTimestamp = now; whitelistLength++; }
/** * @dev Add wallet to whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of wallet to add. * @param _data The checksum of additional wallet data. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 1057, 1405 ] }
56,585
GiftCrowdsale
contracts/Whitelist.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
Whitelist
contract Whitelist is Ownable { struct WalletInfo { string data; bool whitelisted; uint256 createdTimestamp; } address public backendAddress; mapping(address => WalletInfo) public whitelist; uint256 public whitelistLength = 0; /** * @dev Sets the backend address for automated operations. * @param _backendAddress The backend address to allow. */ function setBackendAddress(address _backendAddress) public onlyOwner { require(_backendAddress != address(0)); backendAddress = _backendAddress; } /** * @dev Allows the function to be called only by the owner and backend. */ modifier onlyPrivilegedAddresses() { require(msg.sender == owner || msg.sender == backendAddress); _; } /** * @dev Add wallet to whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of wallet to add. * @param _data The checksum of additional wallet data. */ function addWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet].data = _data; whitelist[_wallet].whitelisted = true; whitelist[_wallet].createdTimestamp = now; whitelistLength++; } /** * @dev Update additional data for whitelisted wallet. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to update. * @param _data The checksum of new additional wallet data. */ function updateWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet].data = _data; } /** * @dev Remove wallet from whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to remove. */ function removeWallet(address _wallet) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); delete whitelist[_wallet]; whitelistLength--; } /** * @dev Check the specified wallet whether it is in the whitelist. * @param _wallet The address of wallet to check. */ function isWhitelisted(address _wallet) public view returns (bool) { return whitelist[_wallet].whitelisted; } /** * @dev Get the checksum of additional data for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletData(address _wallet) public view returns (string) { return whitelist[_wallet].data; } /** * @dev Get the creation timestamp for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletCreatedTimestamp(address _wallet) public view returns (uint256) { return whitelist[_wallet].createdTimestamp; } }
/** * @title Whitelist contract * @dev Whitelist for wallets, with additional data for every wallet. */
NatSpecMultiLine
updateWallet
function updateWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet].data = _data; }
/** * @dev Update additional data for whitelisted wallet. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to update. * @param _data The checksum of new additional wallet data. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 1678, 1900 ] }
56,586
GiftCrowdsale
contracts/Whitelist.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
Whitelist
contract Whitelist is Ownable { struct WalletInfo { string data; bool whitelisted; uint256 createdTimestamp; } address public backendAddress; mapping(address => WalletInfo) public whitelist; uint256 public whitelistLength = 0; /** * @dev Sets the backend address for automated operations. * @param _backendAddress The backend address to allow. */ function setBackendAddress(address _backendAddress) public onlyOwner { require(_backendAddress != address(0)); backendAddress = _backendAddress; } /** * @dev Allows the function to be called only by the owner and backend. */ modifier onlyPrivilegedAddresses() { require(msg.sender == owner || msg.sender == backendAddress); _; } /** * @dev Add wallet to whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of wallet to add. * @param _data The checksum of additional wallet data. */ function addWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet].data = _data; whitelist[_wallet].whitelisted = true; whitelist[_wallet].createdTimestamp = now; whitelistLength++; } /** * @dev Update additional data for whitelisted wallet. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to update. * @param _data The checksum of new additional wallet data. */ function updateWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet].data = _data; } /** * @dev Remove wallet from whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to remove. */ function removeWallet(address _wallet) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); delete whitelist[_wallet]; whitelistLength--; } /** * @dev Check the specified wallet whether it is in the whitelist. * @param _wallet The address of wallet to check. */ function isWhitelisted(address _wallet) public view returns (bool) { return whitelist[_wallet].whitelisted; } /** * @dev Get the checksum of additional data for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletData(address _wallet) public view returns (string) { return whitelist[_wallet].data; } /** * @dev Get the creation timestamp for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletCreatedTimestamp(address _wallet) public view returns (uint256) { return whitelist[_wallet].createdTimestamp; } }
/** * @title Whitelist contract * @dev Whitelist for wallets, with additional data for every wallet. */
NatSpecMultiLine
removeWallet
function removeWallet(address _wallet) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); delete whitelist[_wallet]; whitelistLength--; }
/** * @dev Remove wallet from whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to remove. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 2088, 2318 ] }
56,587
GiftCrowdsale
contracts/Whitelist.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
Whitelist
contract Whitelist is Ownable { struct WalletInfo { string data; bool whitelisted; uint256 createdTimestamp; } address public backendAddress; mapping(address => WalletInfo) public whitelist; uint256 public whitelistLength = 0; /** * @dev Sets the backend address for automated operations. * @param _backendAddress The backend address to allow. */ function setBackendAddress(address _backendAddress) public onlyOwner { require(_backendAddress != address(0)); backendAddress = _backendAddress; } /** * @dev Allows the function to be called only by the owner and backend. */ modifier onlyPrivilegedAddresses() { require(msg.sender == owner || msg.sender == backendAddress); _; } /** * @dev Add wallet to whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of wallet to add. * @param _data The checksum of additional wallet data. */ function addWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet].data = _data; whitelist[_wallet].whitelisted = true; whitelist[_wallet].createdTimestamp = now; whitelistLength++; } /** * @dev Update additional data for whitelisted wallet. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to update. * @param _data The checksum of new additional wallet data. */ function updateWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet].data = _data; } /** * @dev Remove wallet from whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to remove. */ function removeWallet(address _wallet) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); delete whitelist[_wallet]; whitelistLength--; } /** * @dev Check the specified wallet whether it is in the whitelist. * @param _wallet The address of wallet to check. */ function isWhitelisted(address _wallet) public view returns (bool) { return whitelist[_wallet].whitelisted; } /** * @dev Get the checksum of additional data for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletData(address _wallet) public view returns (string) { return whitelist[_wallet].data; } /** * @dev Get the creation timestamp for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletCreatedTimestamp(address _wallet) public view returns (uint256) { return whitelist[_wallet].createdTimestamp; } }
/** * @title Whitelist contract * @dev Whitelist for wallets, with additional data for every wallet. */
NatSpecMultiLine
isWhitelisted
function isWhitelisted(address _wallet) public view returns (bool) { return whitelist[_wallet].whitelisted; }
/** * @dev Check the specified wallet whether it is in the whitelist. * @param _wallet The address of wallet to check. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 2464, 2592 ] }
56,588
GiftCrowdsale
contracts/Whitelist.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
Whitelist
contract Whitelist is Ownable { struct WalletInfo { string data; bool whitelisted; uint256 createdTimestamp; } address public backendAddress; mapping(address => WalletInfo) public whitelist; uint256 public whitelistLength = 0; /** * @dev Sets the backend address for automated operations. * @param _backendAddress The backend address to allow. */ function setBackendAddress(address _backendAddress) public onlyOwner { require(_backendAddress != address(0)); backendAddress = _backendAddress; } /** * @dev Allows the function to be called only by the owner and backend. */ modifier onlyPrivilegedAddresses() { require(msg.sender == owner || msg.sender == backendAddress); _; } /** * @dev Add wallet to whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of wallet to add. * @param _data The checksum of additional wallet data. */ function addWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet].data = _data; whitelist[_wallet].whitelisted = true; whitelist[_wallet].createdTimestamp = now; whitelistLength++; } /** * @dev Update additional data for whitelisted wallet. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to update. * @param _data The checksum of new additional wallet data. */ function updateWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet].data = _data; } /** * @dev Remove wallet from whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to remove. */ function removeWallet(address _wallet) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); delete whitelist[_wallet]; whitelistLength--; } /** * @dev Check the specified wallet whether it is in the whitelist. * @param _wallet The address of wallet to check. */ function isWhitelisted(address _wallet) public view returns (bool) { return whitelist[_wallet].whitelisted; } /** * @dev Get the checksum of additional data for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletData(address _wallet) public view returns (string) { return whitelist[_wallet].data; } /** * @dev Get the creation timestamp for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletCreatedTimestamp(address _wallet) public view returns (uint256) { return whitelist[_wallet].createdTimestamp; } }
/** * @title Whitelist contract * @dev Whitelist for wallets, with additional data for every wallet. */
NatSpecMultiLine
walletData
function walletData(address _wallet) public view returns (string) { return whitelist[_wallet].data; }
/** * @dev Get the checksum of additional data for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 2751, 2871 ] }
56,589
GiftCrowdsale
contracts/Whitelist.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
Whitelist
contract Whitelist is Ownable { struct WalletInfo { string data; bool whitelisted; uint256 createdTimestamp; } address public backendAddress; mapping(address => WalletInfo) public whitelist; uint256 public whitelistLength = 0; /** * @dev Sets the backend address for automated operations. * @param _backendAddress The backend address to allow. */ function setBackendAddress(address _backendAddress) public onlyOwner { require(_backendAddress != address(0)); backendAddress = _backendAddress; } /** * @dev Allows the function to be called only by the owner and backend. */ modifier onlyPrivilegedAddresses() { require(msg.sender == owner || msg.sender == backendAddress); _; } /** * @dev Add wallet to whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of wallet to add. * @param _data The checksum of additional wallet data. */ function addWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet].data = _data; whitelist[_wallet].whitelisted = true; whitelist[_wallet].createdTimestamp = now; whitelistLength++; } /** * @dev Update additional data for whitelisted wallet. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to update. * @param _data The checksum of new additional wallet data. */ function updateWallet(address _wallet, string _data) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); whitelist[_wallet].data = _data; } /** * @dev Remove wallet from whitelist. * @dev Accept request from privilege adresses only. * @param _wallet The address of whitelisted wallet to remove. */ function removeWallet(address _wallet) public onlyPrivilegedAddresses { require(_wallet != address(0)); require(isWhitelisted(_wallet)); delete whitelist[_wallet]; whitelistLength--; } /** * @dev Check the specified wallet whether it is in the whitelist. * @param _wallet The address of wallet to check. */ function isWhitelisted(address _wallet) public view returns (bool) { return whitelist[_wallet].whitelisted; } /** * @dev Get the checksum of additional data for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletData(address _wallet) public view returns (string) { return whitelist[_wallet].data; } /** * @dev Get the creation timestamp for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */ function walletCreatedTimestamp(address _wallet) public view returns (uint256) { return whitelist[_wallet].createdTimestamp; } }
/** * @title Whitelist contract * @dev Whitelist for wallets, with additional data for every wallet. */
NatSpecMultiLine
walletCreatedTimestamp
function walletCreatedTimestamp(address _wallet) public view returns (uint256) { return whitelist[_wallet].createdTimestamp; }
/** * @dev Get the creation timestamp for the specified whitelisted wallet. * @param _wallet The address of wallet to get. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 3020, 3165 ] }
56,590
SeekerCoin
SeekerCoin.sol
0xe3b7176a221919a2331c4b529b4d39fce04cfb75
Solidity
Ownable
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
Ownable
function Ownable() public { owner = msg.sender; }
/** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */
NatSpecMultiLine
v0.4.18+commit.9cf6e910
bzzr://78d5474f0d32328c623d5d768843c649324d633a3fd4bef4299824d5947229b3
{ "func_code_index": [ 261, 321 ] }
56,591
SeekerCoin
SeekerCoin.sol
0xe3b7176a221919a2331c4b529b4d39fce04cfb75
Solidity
Ownable
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } }
/** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */
NatSpecMultiLine
transferOwnership
function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; }
/** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.18+commit.9cf6e910
bzzr://78d5474f0d32328c623d5d768843c649324d633a3fd4bef4299824d5947229b3
{ "func_code_index": [ 644, 820 ] }
56,592
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
totalShares
function totalShares() public view returns (uint256) { return _totalShares; }
/** * @dev Getter for the total shares held by payees. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 1526, 1611 ] }
56,593
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
totalReleased
function totalReleased() public view returns (uint256) { return _totalReleased; }
/** * @dev Getter for the total amount of Ether already released. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 1690, 1779 ] }
56,594
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
totalReleased
function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; }
/** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 1918, 2031 ] }
56,595
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
shares
function shares(address account) public view returns (uint256) { return _shares[account]; }
/** * @dev Getter for the amount of shares held by an account. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 2107, 2206 ] }
56,596
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
released
function released(address account) public view returns (uint256) { return _released[account]; }
/** * @dev Getter for the amount of Ether already released to a payee. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 2290, 2393 ] }
56,597
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
released
function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; }
/** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 2544, 2687 ] }
56,598
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
payee
function payee(uint256 index) public view returns (address) { return _payees[index]; }
/** * @dev Getter for the address of the payee number `index`. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 2763, 2857 ] }
56,599
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
release
function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); }
/** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 3039, 3597 ] }
56,600
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
release
function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); }
/** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 3844, 4472 ] }
56,601
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
_pendingPayment
function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; }
/** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 4632, 4856 ] }
56,602
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
_addPayee
function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); }
/** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 5027, 5456 ] }
56,603
SplicePriceStrategyStatic
contracts/ReplaceablePaymentSplitter.sol
0xee25f9e9f3fe1015e1f695ab50bca299aaf4dcf1
Solidity
ReplaceablePaymentSplitter
contract ReplaceablePaymentSplitter is Context, Initializable { event PayeeAdded(address indexed account, uint256 shares); event PayeeReplaced( address indexed old, address indexed new_, uint256 shares ); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; address private _controller; modifier onlyController() { require(msg.sender == address(_controller), 'only callable by controller'); _; } function initialize( address controller, address[] memory payees_, uint256[] memory shares_ ) external payable initializer { require(controller != address(0), 'controller mustnt be 0'); _controller = controller; uint256 len = payees_.length; uint256 __totalShares = _totalShares; for (uint256 i = 0; i < len; i++) { _addPayee(payees_[i], shares_[i]); __totalShares += shares_[i]; } _totalShares = __totalShares; } receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _released[account] += payment; _totalReleased += payment; AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) external virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); uint256 payment = _pendingPayment( account, totalReceived, released(token, account) ); require(payment != 0, 'PaymentSplitter: account is not due payment'); _erc20Released[token][account] += payment; _erc20TotalReleased[token] += payment; SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; emit PayeeAdded(account, shares_); } /** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */ function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } } function due(address account) external view returns (uint256 pending) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } function due(IERC20 token, address account) external view returns (uint256 pending) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } }
/** * @notice this is an initializeable OZ PaymentSplitter with an additional replace function to * update the payees when the owner of the underlying royalty bearing asset has * changed. Cannot extend PaymentSplitter because its members are private. */
NatSpecMultiLine
replacePayee
function replacePayee(address old, address new_) external onlyController { uint256 oldShares = _shares[old]; require(oldShares > 0, 'PaymentSplitter: old account has no shares'); require( new_ != address(0), 'PaymentSplitter: new account is the zero address' ); require( _shares[new_] == 0, 'PaymentSplitter: new account already has shares' ); uint256 idx = 0; while (idx < _payees.length) { if (_payees[idx] == old) { _payees[idx] = new_; _shares[old] = 0; _shares[new_] = oldShares; _released[new_] = _released[old]; emit PayeeReplaced(old, new_, oldShares); return; } idx++; } }
/** * @dev the new_ payee will receive splits at the same rate as _old did before. * all pending payouts of _old can be withdrawn by _new. */
NatSpecMultiLine
v0.8.10+commit.fc410830
{ "func_code_index": [ 5616, 6328 ] }
56,604
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
GiftCrowdsale
function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); }
/** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 1319, 1993 ] }
56,605
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
sellTokens
function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); }
/** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 2674, 3186 ] }
56,606
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
function() public payable { sellTokens(); }
/** * @dev Fallback function allowing the contract to receive funds */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 3275, 3337 ] }
56,607
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
withdrawal
function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); }
/** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 3548, 3764 ] }
56,608
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
assignTokens
function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); }
/** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 4012, 4188 ] }
56,609
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
addInvestment
function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); }
/** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 4388, 4526 ] }
56,610
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
refundPayment
function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); }
/** * @dev Function to return money to one customer, if mincap has not been reached */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 4631, 5016 ] }
56,611
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
transferTokenOwnership
function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); }
/** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 5201, 5327 ] }
56,612
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
unpause
function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); }
/** * @dev Owner can't unpause the crowdsale before calling init(). */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 6139, 6291 ] }
56,613
GiftCrowdsale
contracts/GiftCrowdsale.sol
0x0f72b988c30a4e4472607703c3363dcfe0f58e0d
Solidity
GiftCrowdsale
contract GiftCrowdsale is Pausable { using SafeMath for uint256; uint256 public startTimestamp = 0; uint256 public endTimestamp = 0; uint256 public exchangeRate = 0; uint256 public tokensSold = 0; uint256 constant public minimumInvestment = 25e16; // 0.25 ETH uint256 public minCap = 0; uint256 public endFirstPeriodTimestamp = 0; uint256 public endSecondPeriodTimestamp = 0; uint256 public endThirdPeriodTimestamp = 0; GiftToken public token; Whitelist public whitelist; mapping(address => uint256) public investments; modifier beforeSaleOpens() { require(now < startTimestamp); _; } modifier whenSaleIsOpen() { require(now >= startTimestamp && now < endTimestamp); _; } modifier whenSaleHasEnded() { require(now >= endTimestamp); _; } /** * @dev Constructor for GiftCrowdsale contract. * @dev Set first owner who can manage whitelist. * @param _startTimestamp uint256 The start time ico. * @param _endTimestamp uint256 The end time ico. * @param _exchangeRate uint256 The price of the Gift token. * @param _minCap The minimum amount of tokens sold required for the ICO to be considered successful. */ function GiftCrowdsale ( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _exchangeRate, uint256 _minCap ) public { require(_startTimestamp >= now && _endTimestamp > _startTimestamp); require(_exchangeRate > 0); startTimestamp = _startTimestamp; endTimestamp = _endTimestamp; exchangeRate = _exchangeRate; endFirstPeriodTimestamp = _startTimestamp.add(1 days); endSecondPeriodTimestamp = _startTimestamp.add(1 weeks); endThirdPeriodTimestamp = _startTimestamp.add(2 weeks); minCap = _minCap; pause(); } function discount() public view returns (uint256) { if (now > endThirdPeriodTimestamp) return 0; if (now > endSecondPeriodTimestamp) return 5; if (now > endFirstPeriodTimestamp) return 15; return 25; } function bonus(address _wallet) public view returns (uint256) { uint256 _created = whitelist.walletCreatedTimestamp(_wallet); if (_created > 0 && _created < startTimestamp) { return 10; } return 0; } /** * @dev Function for sell tokens. * @dev Sells tokens only for wallets from Whitelist while ICO lasts */ function sellTokens() public payable whenSaleIsOpen whenWhitelisted(msg.sender) whenNotPaused { require(msg.value > minimumInvestment); uint256 _bonus = bonus(msg.sender); uint256 _discount = discount(); uint256 tokensAmount = (msg.value).mul(exchangeRate).mul(_bonus.add(100)).div((100 - _discount)); token.transferFromIco(msg.sender, tokensAmount); tokensSold = tokensSold.add(tokensAmount); addInvestment(msg.sender, msg.value); } /** * @dev Fallback function allowing the contract to receive funds */ function() public payable { sellTokens(); } /** * @dev Function for funds withdrawal * @dev transfers funds to specified wallet once ICO is ended * @param _wallet address wallet address, to which funds will be transferred */ function withdrawal(address _wallet) external onlyOwner whenSaleHasEnded { require(_wallet != address(0)); _wallet.transfer(this.balance); token.transferOwnership(msg.sender); } /** * @dev Function for manual token assignment (token transfer from ICO to requested wallet) * @param _to address The address which you want transfer to * @param _value uint256 the amount of tokens to be transferred */ function assignTokens(address _to, uint256 _value) external onlyOwner { token.transferFromIco(_to, _value); tokensSold = tokensSold.add(_value); } /** * @dev Add new investment to the ICO investments storage. * @param _from The address of a ICO investor. * @param _value The investment received from a ICO investor. */ function addInvestment(address _from, uint256 _value) internal { investments[_from] = investments[_from].add(_value); } /** * @dev Function to return money to one customer, if mincap has not been reached */ function refundPayment() external whenWhitelisted(msg.sender) whenSaleHasEnded { require(tokensSold < minCap); require(investments[msg.sender] > 0); token.burnFrom(msg.sender, token.balanceOf(msg.sender)); uint256 investment = investments[msg.sender]; investments[msg.sender] = 0; (msg.sender).transfer(investment); } /** * @dev Allows the current owner to transfer control of the token contract from ICO to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferTokenOwnership(address _newOwner) public onlyOwner { token.transferOwnership(_newOwner); } function updateIcoEnding(uint256 _endTimestamp) public onlyOwner { endTimestamp = _endTimestamp; } modifier whenWhitelisted(address _wallet) { require(whitelist.isWhitelisted(_wallet)); _; } function init(address _token, address _whitelist) public onlyOwner { require(_token != address(0) && _whitelist != address(0)); // function callable only once require(token == address(0) && whitelist == address(0)); // required for refund purposes (token.burnFrom()) require(Ownable(_token).owner() == address(this)); token = GiftToken(_token); whitelist = Whitelist(_whitelist); unpause(); } /** * @dev Owner can't unpause the crowdsale before calling init(). */ function unpause() public onlyOwner whenPaused { require(token != address(0) && whitelist != address(0)); super.unpause(); } /** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */ function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; } }
setExchangeRate
function setExchangeRate(uint256 _exchangeRate) public onlyOwner beforeSaleOpens { require(_exchangeRate > 0); exchangeRate = _exchangeRate; }
/** * @dev Owner can change the exchange rate before ICO begins * @param _exchangeRate new exchange rate */
NatSpecMultiLine
v0.4.19+commit.c4cbbb05
bzzr://ba470fb4262e60a5f05afd619d0d9bc91844d6d20fc112f9b080dc4749f84dd5
{ "func_code_index": [ 6422, 6594 ] }
56,614
MartianMarketWL
MartianMarketWL.sol
0xd60917e1abde5c9e3395cfba5688c735a89b3281
Solidity
MartianMarketWL
contract MartianMarketWL is Ownable { // Events event TreasuryManaged(address indexed contract_, address treasury_); event OperatorManaged(address indexed contract_, address operator_, bool bool_); event GovernorUnstuckOwner(address indexed contract_, address indexed operator_, address stuckOwner_, address unstuckOwner_); event WLVendingItemAdded(address indexed contract_, string title_, string imageUri_, string projectUri_, string description_, uint32 amountAvailable_, uint32 deadline_, uint256 price_); event WLVendingItemRemoved(address indexed contract_, address operator_, WLVendingItem item_); event WLVendingItemPurchased(address indexed contract_, uint256 index_, address buyer_, WLVendingItem item_); event ContractRegistered(address indexed contract_, address registerer_, uint256 registrationPrice_); event ContractAdministered(address indexed contract_, address registerer_, bool bool_); event ProjectInfoPushed(address indexed contract_, address registerer_, string projectName_, string tokenImage_); event WLVendingItemModified(address indexed contract_, WLVendingItem before_, WLVendingItem after_); // Governance IERC20 public MES = IERC20(0x3C2Eb40D25a4b2B5A068a959a40d57D63Dc98B95); function setMES(address address_) external onlyOwner { MES = IERC20(address_); } // Setting the Governor address public superGovernorAddress; address public governorAddress; address public registrationCollector; constructor() { superGovernorAddress = msg.sender; governorAddress = msg.sender; registrationCollector = address(this); } // Ownable Governance Setup function setSuperGovernorAddress(address superGovernor_) external onlyOwner { // If superGovernor has been renounced, it is never enabled again. require(superGovernorAddress != address(0), "Super Governor Access has been renounced"); superGovernorAddress = superGovernor_; } modifier onlySuperGovernor { require(msg.sender == superGovernorAddress, "You are not the contract super governor!"); _; } function setGovernorAddress(address governor_) external onlyOwner { governorAddress = governor_; } modifier onlyGovernor { require(msg.sender == governorAddress, "You are not the contract governor!"); _; } // Project Control (Super Governor) mapping(address => address) contractToUnstuckOwner; function SG_SetContractToVending(address contract_, bool bool_) external onlySuperGovernor { require(contractToEnabled[contract_] != bool_, "Contract Already Set as Boolean!"); // Enum Tracking on bool_ statement contractToEnabled[contract_] = bool_; bool_ ? _addContractToEnum(contract_) : _removeContractFromEnum(contract_); emit ContractAdministered(contract_, msg.sender, bool_); } function SG_SetContractToProjectInfo(address contract_, string calldata projectName_, string calldata tokenImage_) external onlySuperGovernor { contractToProjectInfo[contract_] = ProjectInfo(projectName_, tokenImage_); emit ProjectInfoPushed(contract_, msg.sender, projectName_, tokenImage_); } function SG_SetStuckOwner(address contract_, address unstuckOwner_) external onlySuperGovernor { // Onboarding for ERC20 of non-initialized contracts // In case of renounced or unretrievable owners // I the contract was not enabled by the super governor, but // through user registration by paying $MES, this function // is forever disabled for them. require(!contractToMESRegistry[contract_], "Ownership has been proven through registration."); // For maximum trustlessness, this can only be used if there has never been // an item created in their store. Once they create an item, this effectively // proves ownership is intact and disables this ability forever. require(contractToWLVendingItems[contract_].length == 0, "Ownership has been proven."); contractToUnstuckOwner[contract_] = unstuckOwner_; emit GovernorUnstuckOwner(contract_, msg.sender, IERC20(contract_).owner(), unstuckOwner_); } // Registry Control (Governor) uint256 public registrationPrice = 2000 ether; // 2000 $MES function G_setRegistrationPrice(uint256 price_) external onlyGovernor { registrationPrice = price_; } function G_setRegistrationCollector(address collector_) external onlyGovernor { registrationCollector = collector_; } function G_withdrawMESfromContract(address receiver_) external onlyGovernor { MES.transferFrom(address(this), receiver_, MES.balanceOf(address(this))); } // Registry Logic // Database Entry for Enabled Addresses + Enumeration System // mapping(address => bool) public contractToEnabled; // Enumeration Tools address[] public enabledContracts; mapping(address => uint256) public enabledContractsIndex; function getAllEnabledContracts() external view returns (address[] memory) { return enabledContracts; } function _addContractToEnum(address contract_) internal { enabledContractsIndex[contract_] = enabledContracts.length; enabledContracts.push(contract_); } function _removeContractFromEnum(address contract_) internal { uint256 _lastIndex = enabledContracts.length - 1; uint256 _currentIndex = enabledContractsIndex[contract_]; // If the contract is not the last contract in the array if (_currentIndex != _lastIndex) { // Replace the to-be-deleted address with the last address address _lastAddress = enabledContracts[_lastIndex]; enabledContracts[_currentIndex] = _lastAddress; } // Remove the last item enabledContracts.pop(); // Delete the index delete enabledContractsIndex[contract_]; } // Registry (Contract Owner) mapping(address => bool) public contractToMESRegistry; function registerContractToVending(address contract_) external { require(msg.sender == IERC20(contract_).owner(), "You are not the Contract Owner!"); require(!contractToEnabled[contract_], "Your contract has already been registered!"); require(MES.balanceOf(msg.sender) >= registrationPrice, "You don't have enough $MES!"); MES.transferFrom(msg.sender, registrationCollector, registrationPrice); contractToEnabled[contract_] = true; contractToMESRegistry[contract_] = true; _addContractToEnum(contract_); emit ContractRegistered(contract_, msg.sender, registrationPrice); } // Contract Owner Governance Control modifier onlyContractOwner (address contract_) { address _owner = contractToUnstuckOwner[contract_] != address(0) ? contractToUnstuckOwner[contract_] : IERC20(contract_).owner(); require(msg.sender == _owner, "You are not the Contract Owner!"); require(contractToEnabled[contract_], "Please register your Contract first!"); _; } modifier onlyAuthorized (address contract_, address operator_) { require(contractToControllersApproved[contract_][operator_] || msg.sender == (contractToUnstuckOwner[contract_] != address(0) ? contractToUnstuckOwner[contract_] : IERC20(contract_).owner()), "You are not Authorized for this ERC20 Contract!"); _; } // Project Control (Contract Owner) struct ProjectInfo { string projectName; string tokenImageUri; } mapping(address => ProjectInfo) public contractToProjectInfo; function registerProjectInfo(address contract_, string calldata projectName_, string calldata tokenImage_) external onlyContractOwner(contract_) { contractToProjectInfo[contract_] = ProjectInfo(projectName_, tokenImage_); emit ProjectInfoPushed(contract_, msg.sender, projectName_, tokenImage_); } mapping(address => mapping(address => bool)) public contractToControllersApproved; function manageController(address contract_, address operator_, bool bool_) external onlyContractOwner(contract_) { contractToControllersApproved[contract_][operator_] = bool_; emit OperatorManaged(contract_, operator_, bool_); } address internal burnAddress = 0x000000000000000000000000000000000000dEaD; mapping(address => address) public contractToTreasuryAddress; function _getTreasury(address contract_) internal view returns (address) { return contractToTreasuryAddress[contract_] != address(0) ? contractToTreasuryAddress[contract_] : burnAddress; } function setTreasuryAddress(address contract_, address treasury_) external onlyContractOwner(contract_) { contractToTreasuryAddress[contract_] = treasury_; emit TreasuryManaged(contract_, treasury_); } // Whitelist Marketplace struct WLVendingItem { string title; string imageUri; string projectUri; string description; uint32 amountAvailable; uint32 amountPurchased; uint32 deadline; uint256 price; } // Database of Vending Items for each ERC20 mapping(address => WLVendingItem[]) public contractToWLVendingItems; // Database of Vending Items Purchasers for each ERC20 mapping(address => mapping(uint256 => address[])) public contractToWLPurchasers; mapping(address => mapping(uint256 => mapping(address => bool))) public contractToWLPurchased; function addWLVendingItem(address contract_, string calldata title_, string calldata imageUri_, string calldata projectUri_, string calldata description_, uint32 amountAvailable_, uint32 deadline_, uint256 price_) external onlyAuthorized(contract_, msg.sender) { require(bytes(title_).length > 0, "You must specify a Title!"); require(uint256(deadline_) > block.timestamp, "Already expired timestamp!"); contractToWLVendingItems[contract_].push( WLVendingItem( title_, imageUri_, projectUri_, description_, amountAvailable_, 0, deadline_, price_ ) ); emit WLVendingItemAdded(contract_, title_, imageUri_, projectUri_, description_, amountAvailable_, deadline_, price_); } function modifyWLVendingItem(address contract_, uint256 index_, WLVendingItem memory WLVendingItem_) external onlyAuthorized(contract_, msg.sender) { WLVendingItem memory _item = contractToWLVendingItems[contract_][index_]; require(bytes(_item.title).length > 0, "This WLVendingItem does not exist!"); require(WLVendingItem_.amountAvailable >= _item.amountPurchased, "Amount Available must be >= Amount Purchased!"); contractToWLVendingItems[contract_][index_] = WLVendingItem_; emit WLVendingItemModified(contract_, _item, WLVendingItem_); } function deleteMostRecentWLVendingItem(address contract_) external onlyAuthorized(contract_, msg.sender) { uint256 _lastIndex = contractToWLVendingItems[contract_].length - 1; WLVendingItem memory _item = contractToWLVendingItems[contract_][_lastIndex]; require(_item.amountPurchased == 0, "Cannot delete item with already bought goods!"); contractToWLVendingItems[contract_].pop(); emit WLVendingItemRemoved(contract_, msg.sender, _item); } // Core Function of WL Vending (User) function purchaseWLVendingItem(address contract_, uint256 index_) external { // Load the WLVendingItem to Memory WLVendingItem memory _item = contractToWLVendingItems[contract_][index_]; // Check the necessary requirements to purchase require(bytes(_item.title).length > 0, "This WLVendingItem does not exist!"); require(_item.amountAvailable > _item.amountPurchased, "No more WL remaining!"); require(_item.deadline >= block.timestamp, "Passed deadline!"); require(!contractToWLPurchased[contract_][index_][msg.sender], "Already purchased!"); require(IERC20(contract_).balanceOf(msg.sender) >= _item.price, "Not enough tokens!"); // Pay for the WL IERC20(contract_).transferFrom( msg.sender, _getTreasury(contract_), _item.price); // Add the address into the WL List contractToWLPurchased[contract_][index_][msg.sender] = true; contractToWLPurchasers[contract_][index_].push(msg.sender); // Increment Amount Purchased contractToWLVendingItems[contract_][index_].amountPurchased++; emit WLVendingItemPurchased(contract_, index_, msg.sender, _item); } // Read Functions function getWLPurchasersOf(address contract_, uint256 index_) external view returns (address[] memory) { return contractToWLPurchasers[contract_][index_]; } function getWLVendingItemsAll(address contract_) external view returns (WLVendingItem[] memory) { return contractToWLVendingItems[contract_]; } function getWLVendingItemsLength(address contract_) external view returns (uint256) { return contractToWLVendingItems[contract_].length; } function getWLVendingItemsPaginated(address contract_, uint256 start_, uint256 end_) external view returns (WLVendingItem[] memory) { uint256 _arrayLength = end_ - start_ + 1; WLVendingItem[] memory _items = new WLVendingItem[] (_arrayLength); uint256 _index; for (uint256 i = 0; i < _arrayLength; i++) { _items[_index++] = contractToWLVendingItems[contract_][start_ + i]; } return _items; } }
setSuperGovernorAddress
function setSuperGovernorAddress(address superGovernor_) external onlyOwner { // If superGovernor has been renounced, it is never enabled again. require(superGovernorAddress != address(0), "Super Governor Access has been renounced"); superGovernorAddress = superGovernor_; }
// Ownable Governance Setup
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://08214d9cc81f6078b879cb8408c62eff112d8ed47a9e56b36c9cd73db1793a7d
{ "func_code_index": [ 1813, 2139 ] }
56,615
MartianMarketWL
MartianMarketWL.sol
0xd60917e1abde5c9e3395cfba5688c735a89b3281
Solidity
MartianMarketWL
contract MartianMarketWL is Ownable { // Events event TreasuryManaged(address indexed contract_, address treasury_); event OperatorManaged(address indexed contract_, address operator_, bool bool_); event GovernorUnstuckOwner(address indexed contract_, address indexed operator_, address stuckOwner_, address unstuckOwner_); event WLVendingItemAdded(address indexed contract_, string title_, string imageUri_, string projectUri_, string description_, uint32 amountAvailable_, uint32 deadline_, uint256 price_); event WLVendingItemRemoved(address indexed contract_, address operator_, WLVendingItem item_); event WLVendingItemPurchased(address indexed contract_, uint256 index_, address buyer_, WLVendingItem item_); event ContractRegistered(address indexed contract_, address registerer_, uint256 registrationPrice_); event ContractAdministered(address indexed contract_, address registerer_, bool bool_); event ProjectInfoPushed(address indexed contract_, address registerer_, string projectName_, string tokenImage_); event WLVendingItemModified(address indexed contract_, WLVendingItem before_, WLVendingItem after_); // Governance IERC20 public MES = IERC20(0x3C2Eb40D25a4b2B5A068a959a40d57D63Dc98B95); function setMES(address address_) external onlyOwner { MES = IERC20(address_); } // Setting the Governor address public superGovernorAddress; address public governorAddress; address public registrationCollector; constructor() { superGovernorAddress = msg.sender; governorAddress = msg.sender; registrationCollector = address(this); } // Ownable Governance Setup function setSuperGovernorAddress(address superGovernor_) external onlyOwner { // If superGovernor has been renounced, it is never enabled again. require(superGovernorAddress != address(0), "Super Governor Access has been renounced"); superGovernorAddress = superGovernor_; } modifier onlySuperGovernor { require(msg.sender == superGovernorAddress, "You are not the contract super governor!"); _; } function setGovernorAddress(address governor_) external onlyOwner { governorAddress = governor_; } modifier onlyGovernor { require(msg.sender == governorAddress, "You are not the contract governor!"); _; } // Project Control (Super Governor) mapping(address => address) contractToUnstuckOwner; function SG_SetContractToVending(address contract_, bool bool_) external onlySuperGovernor { require(contractToEnabled[contract_] != bool_, "Contract Already Set as Boolean!"); // Enum Tracking on bool_ statement contractToEnabled[contract_] = bool_; bool_ ? _addContractToEnum(contract_) : _removeContractFromEnum(contract_); emit ContractAdministered(contract_, msg.sender, bool_); } function SG_SetContractToProjectInfo(address contract_, string calldata projectName_, string calldata tokenImage_) external onlySuperGovernor { contractToProjectInfo[contract_] = ProjectInfo(projectName_, tokenImage_); emit ProjectInfoPushed(contract_, msg.sender, projectName_, tokenImage_); } function SG_SetStuckOwner(address contract_, address unstuckOwner_) external onlySuperGovernor { // Onboarding for ERC20 of non-initialized contracts // In case of renounced or unretrievable owners // I the contract was not enabled by the super governor, but // through user registration by paying $MES, this function // is forever disabled for them. require(!contractToMESRegistry[contract_], "Ownership has been proven through registration."); // For maximum trustlessness, this can only be used if there has never been // an item created in their store. Once they create an item, this effectively // proves ownership is intact and disables this ability forever. require(contractToWLVendingItems[contract_].length == 0, "Ownership has been proven."); contractToUnstuckOwner[contract_] = unstuckOwner_; emit GovernorUnstuckOwner(contract_, msg.sender, IERC20(contract_).owner(), unstuckOwner_); } // Registry Control (Governor) uint256 public registrationPrice = 2000 ether; // 2000 $MES function G_setRegistrationPrice(uint256 price_) external onlyGovernor { registrationPrice = price_; } function G_setRegistrationCollector(address collector_) external onlyGovernor { registrationCollector = collector_; } function G_withdrawMESfromContract(address receiver_) external onlyGovernor { MES.transferFrom(address(this), receiver_, MES.balanceOf(address(this))); } // Registry Logic // Database Entry for Enabled Addresses + Enumeration System // mapping(address => bool) public contractToEnabled; // Enumeration Tools address[] public enabledContracts; mapping(address => uint256) public enabledContractsIndex; function getAllEnabledContracts() external view returns (address[] memory) { return enabledContracts; } function _addContractToEnum(address contract_) internal { enabledContractsIndex[contract_] = enabledContracts.length; enabledContracts.push(contract_); } function _removeContractFromEnum(address contract_) internal { uint256 _lastIndex = enabledContracts.length - 1; uint256 _currentIndex = enabledContractsIndex[contract_]; // If the contract is not the last contract in the array if (_currentIndex != _lastIndex) { // Replace the to-be-deleted address with the last address address _lastAddress = enabledContracts[_lastIndex]; enabledContracts[_currentIndex] = _lastAddress; } // Remove the last item enabledContracts.pop(); // Delete the index delete enabledContractsIndex[contract_]; } // Registry (Contract Owner) mapping(address => bool) public contractToMESRegistry; function registerContractToVending(address contract_) external { require(msg.sender == IERC20(contract_).owner(), "You are not the Contract Owner!"); require(!contractToEnabled[contract_], "Your contract has already been registered!"); require(MES.balanceOf(msg.sender) >= registrationPrice, "You don't have enough $MES!"); MES.transferFrom(msg.sender, registrationCollector, registrationPrice); contractToEnabled[contract_] = true; contractToMESRegistry[contract_] = true; _addContractToEnum(contract_); emit ContractRegistered(contract_, msg.sender, registrationPrice); } // Contract Owner Governance Control modifier onlyContractOwner (address contract_) { address _owner = contractToUnstuckOwner[contract_] != address(0) ? contractToUnstuckOwner[contract_] : IERC20(contract_).owner(); require(msg.sender == _owner, "You are not the Contract Owner!"); require(contractToEnabled[contract_], "Please register your Contract first!"); _; } modifier onlyAuthorized (address contract_, address operator_) { require(contractToControllersApproved[contract_][operator_] || msg.sender == (contractToUnstuckOwner[contract_] != address(0) ? contractToUnstuckOwner[contract_] : IERC20(contract_).owner()), "You are not Authorized for this ERC20 Contract!"); _; } // Project Control (Contract Owner) struct ProjectInfo { string projectName; string tokenImageUri; } mapping(address => ProjectInfo) public contractToProjectInfo; function registerProjectInfo(address contract_, string calldata projectName_, string calldata tokenImage_) external onlyContractOwner(contract_) { contractToProjectInfo[contract_] = ProjectInfo(projectName_, tokenImage_); emit ProjectInfoPushed(contract_, msg.sender, projectName_, tokenImage_); } mapping(address => mapping(address => bool)) public contractToControllersApproved; function manageController(address contract_, address operator_, bool bool_) external onlyContractOwner(contract_) { contractToControllersApproved[contract_][operator_] = bool_; emit OperatorManaged(contract_, operator_, bool_); } address internal burnAddress = 0x000000000000000000000000000000000000dEaD; mapping(address => address) public contractToTreasuryAddress; function _getTreasury(address contract_) internal view returns (address) { return contractToTreasuryAddress[contract_] != address(0) ? contractToTreasuryAddress[contract_] : burnAddress; } function setTreasuryAddress(address contract_, address treasury_) external onlyContractOwner(contract_) { contractToTreasuryAddress[contract_] = treasury_; emit TreasuryManaged(contract_, treasury_); } // Whitelist Marketplace struct WLVendingItem { string title; string imageUri; string projectUri; string description; uint32 amountAvailable; uint32 amountPurchased; uint32 deadline; uint256 price; } // Database of Vending Items for each ERC20 mapping(address => WLVendingItem[]) public contractToWLVendingItems; // Database of Vending Items Purchasers for each ERC20 mapping(address => mapping(uint256 => address[])) public contractToWLPurchasers; mapping(address => mapping(uint256 => mapping(address => bool))) public contractToWLPurchased; function addWLVendingItem(address contract_, string calldata title_, string calldata imageUri_, string calldata projectUri_, string calldata description_, uint32 amountAvailable_, uint32 deadline_, uint256 price_) external onlyAuthorized(contract_, msg.sender) { require(bytes(title_).length > 0, "You must specify a Title!"); require(uint256(deadline_) > block.timestamp, "Already expired timestamp!"); contractToWLVendingItems[contract_].push( WLVendingItem( title_, imageUri_, projectUri_, description_, amountAvailable_, 0, deadline_, price_ ) ); emit WLVendingItemAdded(contract_, title_, imageUri_, projectUri_, description_, amountAvailable_, deadline_, price_); } function modifyWLVendingItem(address contract_, uint256 index_, WLVendingItem memory WLVendingItem_) external onlyAuthorized(contract_, msg.sender) { WLVendingItem memory _item = contractToWLVendingItems[contract_][index_]; require(bytes(_item.title).length > 0, "This WLVendingItem does not exist!"); require(WLVendingItem_.amountAvailable >= _item.amountPurchased, "Amount Available must be >= Amount Purchased!"); contractToWLVendingItems[contract_][index_] = WLVendingItem_; emit WLVendingItemModified(contract_, _item, WLVendingItem_); } function deleteMostRecentWLVendingItem(address contract_) external onlyAuthorized(contract_, msg.sender) { uint256 _lastIndex = contractToWLVendingItems[contract_].length - 1; WLVendingItem memory _item = contractToWLVendingItems[contract_][_lastIndex]; require(_item.amountPurchased == 0, "Cannot delete item with already bought goods!"); contractToWLVendingItems[contract_].pop(); emit WLVendingItemRemoved(contract_, msg.sender, _item); } // Core Function of WL Vending (User) function purchaseWLVendingItem(address contract_, uint256 index_) external { // Load the WLVendingItem to Memory WLVendingItem memory _item = contractToWLVendingItems[contract_][index_]; // Check the necessary requirements to purchase require(bytes(_item.title).length > 0, "This WLVendingItem does not exist!"); require(_item.amountAvailable > _item.amountPurchased, "No more WL remaining!"); require(_item.deadline >= block.timestamp, "Passed deadline!"); require(!contractToWLPurchased[contract_][index_][msg.sender], "Already purchased!"); require(IERC20(contract_).balanceOf(msg.sender) >= _item.price, "Not enough tokens!"); // Pay for the WL IERC20(contract_).transferFrom( msg.sender, _getTreasury(contract_), _item.price); // Add the address into the WL List contractToWLPurchased[contract_][index_][msg.sender] = true; contractToWLPurchasers[contract_][index_].push(msg.sender); // Increment Amount Purchased contractToWLVendingItems[contract_][index_].amountPurchased++; emit WLVendingItemPurchased(contract_, index_, msg.sender, _item); } // Read Functions function getWLPurchasersOf(address contract_, uint256 index_) external view returns (address[] memory) { return contractToWLPurchasers[contract_][index_]; } function getWLVendingItemsAll(address contract_) external view returns (WLVendingItem[] memory) { return contractToWLVendingItems[contract_]; } function getWLVendingItemsLength(address contract_) external view returns (uint256) { return contractToWLVendingItems[contract_].length; } function getWLVendingItemsPaginated(address contract_, uint256 start_, uint256 end_) external view returns (WLVendingItem[] memory) { uint256 _arrayLength = end_ - start_ + 1; WLVendingItem[] memory _items = new WLVendingItem[] (_arrayLength); uint256 _index; for (uint256 i = 0; i < _arrayLength; i++) { _items[_index++] = contractToWLVendingItems[contract_][start_ + i]; } return _items; } }
G_setRegistrationPrice
function G_setRegistrationPrice(uint256 price_) external onlyGovernor { registrationPrice = price_; }
// 2000 $MES
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://08214d9cc81f6078b879cb8408c62eff112d8ed47a9e56b36c9cd73db1793a7d
{ "func_code_index": [ 4653, 4773 ] }
56,616
MartianMarketWL
MartianMarketWL.sol
0xd60917e1abde5c9e3395cfba5688c735a89b3281
Solidity
MartianMarketWL
contract MartianMarketWL is Ownable { // Events event TreasuryManaged(address indexed contract_, address treasury_); event OperatorManaged(address indexed contract_, address operator_, bool bool_); event GovernorUnstuckOwner(address indexed contract_, address indexed operator_, address stuckOwner_, address unstuckOwner_); event WLVendingItemAdded(address indexed contract_, string title_, string imageUri_, string projectUri_, string description_, uint32 amountAvailable_, uint32 deadline_, uint256 price_); event WLVendingItemRemoved(address indexed contract_, address operator_, WLVendingItem item_); event WLVendingItemPurchased(address indexed contract_, uint256 index_, address buyer_, WLVendingItem item_); event ContractRegistered(address indexed contract_, address registerer_, uint256 registrationPrice_); event ContractAdministered(address indexed contract_, address registerer_, bool bool_); event ProjectInfoPushed(address indexed contract_, address registerer_, string projectName_, string tokenImage_); event WLVendingItemModified(address indexed contract_, WLVendingItem before_, WLVendingItem after_); // Governance IERC20 public MES = IERC20(0x3C2Eb40D25a4b2B5A068a959a40d57D63Dc98B95); function setMES(address address_) external onlyOwner { MES = IERC20(address_); } // Setting the Governor address public superGovernorAddress; address public governorAddress; address public registrationCollector; constructor() { superGovernorAddress = msg.sender; governorAddress = msg.sender; registrationCollector = address(this); } // Ownable Governance Setup function setSuperGovernorAddress(address superGovernor_) external onlyOwner { // If superGovernor has been renounced, it is never enabled again. require(superGovernorAddress != address(0), "Super Governor Access has been renounced"); superGovernorAddress = superGovernor_; } modifier onlySuperGovernor { require(msg.sender == superGovernorAddress, "You are not the contract super governor!"); _; } function setGovernorAddress(address governor_) external onlyOwner { governorAddress = governor_; } modifier onlyGovernor { require(msg.sender == governorAddress, "You are not the contract governor!"); _; } // Project Control (Super Governor) mapping(address => address) contractToUnstuckOwner; function SG_SetContractToVending(address contract_, bool bool_) external onlySuperGovernor { require(contractToEnabled[contract_] != bool_, "Contract Already Set as Boolean!"); // Enum Tracking on bool_ statement contractToEnabled[contract_] = bool_; bool_ ? _addContractToEnum(contract_) : _removeContractFromEnum(contract_); emit ContractAdministered(contract_, msg.sender, bool_); } function SG_SetContractToProjectInfo(address contract_, string calldata projectName_, string calldata tokenImage_) external onlySuperGovernor { contractToProjectInfo[contract_] = ProjectInfo(projectName_, tokenImage_); emit ProjectInfoPushed(contract_, msg.sender, projectName_, tokenImage_); } function SG_SetStuckOwner(address contract_, address unstuckOwner_) external onlySuperGovernor { // Onboarding for ERC20 of non-initialized contracts // In case of renounced or unretrievable owners // I the contract was not enabled by the super governor, but // through user registration by paying $MES, this function // is forever disabled for them. require(!contractToMESRegistry[contract_], "Ownership has been proven through registration."); // For maximum trustlessness, this can only be used if there has never been // an item created in their store. Once they create an item, this effectively // proves ownership is intact and disables this ability forever. require(contractToWLVendingItems[contract_].length == 0, "Ownership has been proven."); contractToUnstuckOwner[contract_] = unstuckOwner_; emit GovernorUnstuckOwner(contract_, msg.sender, IERC20(contract_).owner(), unstuckOwner_); } // Registry Control (Governor) uint256 public registrationPrice = 2000 ether; // 2000 $MES function G_setRegistrationPrice(uint256 price_) external onlyGovernor { registrationPrice = price_; } function G_setRegistrationCollector(address collector_) external onlyGovernor { registrationCollector = collector_; } function G_withdrawMESfromContract(address receiver_) external onlyGovernor { MES.transferFrom(address(this), receiver_, MES.balanceOf(address(this))); } // Registry Logic // Database Entry for Enabled Addresses + Enumeration System // mapping(address => bool) public contractToEnabled; // Enumeration Tools address[] public enabledContracts; mapping(address => uint256) public enabledContractsIndex; function getAllEnabledContracts() external view returns (address[] memory) { return enabledContracts; } function _addContractToEnum(address contract_) internal { enabledContractsIndex[contract_] = enabledContracts.length; enabledContracts.push(contract_); } function _removeContractFromEnum(address contract_) internal { uint256 _lastIndex = enabledContracts.length - 1; uint256 _currentIndex = enabledContractsIndex[contract_]; // If the contract is not the last contract in the array if (_currentIndex != _lastIndex) { // Replace the to-be-deleted address with the last address address _lastAddress = enabledContracts[_lastIndex]; enabledContracts[_currentIndex] = _lastAddress; } // Remove the last item enabledContracts.pop(); // Delete the index delete enabledContractsIndex[contract_]; } // Registry (Contract Owner) mapping(address => bool) public contractToMESRegistry; function registerContractToVending(address contract_) external { require(msg.sender == IERC20(contract_).owner(), "You are not the Contract Owner!"); require(!contractToEnabled[contract_], "Your contract has already been registered!"); require(MES.balanceOf(msg.sender) >= registrationPrice, "You don't have enough $MES!"); MES.transferFrom(msg.sender, registrationCollector, registrationPrice); contractToEnabled[contract_] = true; contractToMESRegistry[contract_] = true; _addContractToEnum(contract_); emit ContractRegistered(contract_, msg.sender, registrationPrice); } // Contract Owner Governance Control modifier onlyContractOwner (address contract_) { address _owner = contractToUnstuckOwner[contract_] != address(0) ? contractToUnstuckOwner[contract_] : IERC20(contract_).owner(); require(msg.sender == _owner, "You are not the Contract Owner!"); require(contractToEnabled[contract_], "Please register your Contract first!"); _; } modifier onlyAuthorized (address contract_, address operator_) { require(contractToControllersApproved[contract_][operator_] || msg.sender == (contractToUnstuckOwner[contract_] != address(0) ? contractToUnstuckOwner[contract_] : IERC20(contract_).owner()), "You are not Authorized for this ERC20 Contract!"); _; } // Project Control (Contract Owner) struct ProjectInfo { string projectName; string tokenImageUri; } mapping(address => ProjectInfo) public contractToProjectInfo; function registerProjectInfo(address contract_, string calldata projectName_, string calldata tokenImage_) external onlyContractOwner(contract_) { contractToProjectInfo[contract_] = ProjectInfo(projectName_, tokenImage_); emit ProjectInfoPushed(contract_, msg.sender, projectName_, tokenImage_); } mapping(address => mapping(address => bool)) public contractToControllersApproved; function manageController(address contract_, address operator_, bool bool_) external onlyContractOwner(contract_) { contractToControllersApproved[contract_][operator_] = bool_; emit OperatorManaged(contract_, operator_, bool_); } address internal burnAddress = 0x000000000000000000000000000000000000dEaD; mapping(address => address) public contractToTreasuryAddress; function _getTreasury(address contract_) internal view returns (address) { return contractToTreasuryAddress[contract_] != address(0) ? contractToTreasuryAddress[contract_] : burnAddress; } function setTreasuryAddress(address contract_, address treasury_) external onlyContractOwner(contract_) { contractToTreasuryAddress[contract_] = treasury_; emit TreasuryManaged(contract_, treasury_); } // Whitelist Marketplace struct WLVendingItem { string title; string imageUri; string projectUri; string description; uint32 amountAvailable; uint32 amountPurchased; uint32 deadline; uint256 price; } // Database of Vending Items for each ERC20 mapping(address => WLVendingItem[]) public contractToWLVendingItems; // Database of Vending Items Purchasers for each ERC20 mapping(address => mapping(uint256 => address[])) public contractToWLPurchasers; mapping(address => mapping(uint256 => mapping(address => bool))) public contractToWLPurchased; function addWLVendingItem(address contract_, string calldata title_, string calldata imageUri_, string calldata projectUri_, string calldata description_, uint32 amountAvailable_, uint32 deadline_, uint256 price_) external onlyAuthorized(contract_, msg.sender) { require(bytes(title_).length > 0, "You must specify a Title!"); require(uint256(deadline_) > block.timestamp, "Already expired timestamp!"); contractToWLVendingItems[contract_].push( WLVendingItem( title_, imageUri_, projectUri_, description_, amountAvailable_, 0, deadline_, price_ ) ); emit WLVendingItemAdded(contract_, title_, imageUri_, projectUri_, description_, amountAvailable_, deadline_, price_); } function modifyWLVendingItem(address contract_, uint256 index_, WLVendingItem memory WLVendingItem_) external onlyAuthorized(contract_, msg.sender) { WLVendingItem memory _item = contractToWLVendingItems[contract_][index_]; require(bytes(_item.title).length > 0, "This WLVendingItem does not exist!"); require(WLVendingItem_.amountAvailable >= _item.amountPurchased, "Amount Available must be >= Amount Purchased!"); contractToWLVendingItems[contract_][index_] = WLVendingItem_; emit WLVendingItemModified(contract_, _item, WLVendingItem_); } function deleteMostRecentWLVendingItem(address contract_) external onlyAuthorized(contract_, msg.sender) { uint256 _lastIndex = contractToWLVendingItems[contract_].length - 1; WLVendingItem memory _item = contractToWLVendingItems[contract_][_lastIndex]; require(_item.amountPurchased == 0, "Cannot delete item with already bought goods!"); contractToWLVendingItems[contract_].pop(); emit WLVendingItemRemoved(contract_, msg.sender, _item); } // Core Function of WL Vending (User) function purchaseWLVendingItem(address contract_, uint256 index_) external { // Load the WLVendingItem to Memory WLVendingItem memory _item = contractToWLVendingItems[contract_][index_]; // Check the necessary requirements to purchase require(bytes(_item.title).length > 0, "This WLVendingItem does not exist!"); require(_item.amountAvailable > _item.amountPurchased, "No more WL remaining!"); require(_item.deadline >= block.timestamp, "Passed deadline!"); require(!contractToWLPurchased[contract_][index_][msg.sender], "Already purchased!"); require(IERC20(contract_).balanceOf(msg.sender) >= _item.price, "Not enough tokens!"); // Pay for the WL IERC20(contract_).transferFrom( msg.sender, _getTreasury(contract_), _item.price); // Add the address into the WL List contractToWLPurchased[contract_][index_][msg.sender] = true; contractToWLPurchasers[contract_][index_].push(msg.sender); // Increment Amount Purchased contractToWLVendingItems[contract_][index_].amountPurchased++; emit WLVendingItemPurchased(contract_, index_, msg.sender, _item); } // Read Functions function getWLPurchasersOf(address contract_, uint256 index_) external view returns (address[] memory) { return contractToWLPurchasers[contract_][index_]; } function getWLVendingItemsAll(address contract_) external view returns (WLVendingItem[] memory) { return contractToWLVendingItems[contract_]; } function getWLVendingItemsLength(address contract_) external view returns (uint256) { return contractToWLVendingItems[contract_].length; } function getWLVendingItemsPaginated(address contract_, uint256 start_, uint256 end_) external view returns (WLVendingItem[] memory) { uint256 _arrayLength = end_ - start_ + 1; WLVendingItem[] memory _items = new WLVendingItem[] (_arrayLength); uint256 _index; for (uint256 i = 0; i < _arrayLength; i++) { _items[_index++] = contractToWLVendingItems[contract_][start_ + i]; } return _items; } }
purchaseWLVendingItem
function purchaseWLVendingItem(address contract_, uint256 index_) external { // Load the WLVendingItem to Memory WLVendingItem memory _item = contractToWLVendingItems[contract_][index_]; // Check the necessary requirements to purchase require(bytes(_item.title).length > 0, "This WLVendingItem does not exist!"); require(_item.amountAvailable > _item.amountPurchased, "No more WL remaining!"); require(_item.deadline >= block.timestamp, "Passed deadline!"); require(!contractToWLPurchased[contract_][index_][msg.sender], "Already purchased!"); require(IERC20(contract_).balanceOf(msg.sender) >= _item.price, "Not enough tokens!"); // Pay for the WL IERC20(contract_).transferFrom( msg.sender, _getTreasury(contract_), _item.price); // Add the address into the WL List contractToWLPurchased[contract_][index_][msg.sender] = true; contractToWLPurchasers[contract_][index_].push(msg.sender); // Increment Amount Purchased contractToWLVendingItems[contract_][index_].amountPurchased++; emit WLVendingItemPurchased(contract_, index_, msg.sender, _item); }
// Core Function of WL Vending (User)
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://08214d9cc81f6078b879cb8408c62eff112d8ed47a9e56b36c9cd73db1793a7d
{ "func_code_index": [ 12369, 13681 ] }
56,617
MartianMarketWL
MartianMarketWL.sol
0xd60917e1abde5c9e3395cfba5688c735a89b3281
Solidity
MartianMarketWL
contract MartianMarketWL is Ownable { // Events event TreasuryManaged(address indexed contract_, address treasury_); event OperatorManaged(address indexed contract_, address operator_, bool bool_); event GovernorUnstuckOwner(address indexed contract_, address indexed operator_, address stuckOwner_, address unstuckOwner_); event WLVendingItemAdded(address indexed contract_, string title_, string imageUri_, string projectUri_, string description_, uint32 amountAvailable_, uint32 deadline_, uint256 price_); event WLVendingItemRemoved(address indexed contract_, address operator_, WLVendingItem item_); event WLVendingItemPurchased(address indexed contract_, uint256 index_, address buyer_, WLVendingItem item_); event ContractRegistered(address indexed contract_, address registerer_, uint256 registrationPrice_); event ContractAdministered(address indexed contract_, address registerer_, bool bool_); event ProjectInfoPushed(address indexed contract_, address registerer_, string projectName_, string tokenImage_); event WLVendingItemModified(address indexed contract_, WLVendingItem before_, WLVendingItem after_); // Governance IERC20 public MES = IERC20(0x3C2Eb40D25a4b2B5A068a959a40d57D63Dc98B95); function setMES(address address_) external onlyOwner { MES = IERC20(address_); } // Setting the Governor address public superGovernorAddress; address public governorAddress; address public registrationCollector; constructor() { superGovernorAddress = msg.sender; governorAddress = msg.sender; registrationCollector = address(this); } // Ownable Governance Setup function setSuperGovernorAddress(address superGovernor_) external onlyOwner { // If superGovernor has been renounced, it is never enabled again. require(superGovernorAddress != address(0), "Super Governor Access has been renounced"); superGovernorAddress = superGovernor_; } modifier onlySuperGovernor { require(msg.sender == superGovernorAddress, "You are not the contract super governor!"); _; } function setGovernorAddress(address governor_) external onlyOwner { governorAddress = governor_; } modifier onlyGovernor { require(msg.sender == governorAddress, "You are not the contract governor!"); _; } // Project Control (Super Governor) mapping(address => address) contractToUnstuckOwner; function SG_SetContractToVending(address contract_, bool bool_) external onlySuperGovernor { require(contractToEnabled[contract_] != bool_, "Contract Already Set as Boolean!"); // Enum Tracking on bool_ statement contractToEnabled[contract_] = bool_; bool_ ? _addContractToEnum(contract_) : _removeContractFromEnum(contract_); emit ContractAdministered(contract_, msg.sender, bool_); } function SG_SetContractToProjectInfo(address contract_, string calldata projectName_, string calldata tokenImage_) external onlySuperGovernor { contractToProjectInfo[contract_] = ProjectInfo(projectName_, tokenImage_); emit ProjectInfoPushed(contract_, msg.sender, projectName_, tokenImage_); } function SG_SetStuckOwner(address contract_, address unstuckOwner_) external onlySuperGovernor { // Onboarding for ERC20 of non-initialized contracts // In case of renounced or unretrievable owners // I the contract was not enabled by the super governor, but // through user registration by paying $MES, this function // is forever disabled for them. require(!contractToMESRegistry[contract_], "Ownership has been proven through registration."); // For maximum trustlessness, this can only be used if there has never been // an item created in their store. Once they create an item, this effectively // proves ownership is intact and disables this ability forever. require(contractToWLVendingItems[contract_].length == 0, "Ownership has been proven."); contractToUnstuckOwner[contract_] = unstuckOwner_; emit GovernorUnstuckOwner(contract_, msg.sender, IERC20(contract_).owner(), unstuckOwner_); } // Registry Control (Governor) uint256 public registrationPrice = 2000 ether; // 2000 $MES function G_setRegistrationPrice(uint256 price_) external onlyGovernor { registrationPrice = price_; } function G_setRegistrationCollector(address collector_) external onlyGovernor { registrationCollector = collector_; } function G_withdrawMESfromContract(address receiver_) external onlyGovernor { MES.transferFrom(address(this), receiver_, MES.balanceOf(address(this))); } // Registry Logic // Database Entry for Enabled Addresses + Enumeration System // mapping(address => bool) public contractToEnabled; // Enumeration Tools address[] public enabledContracts; mapping(address => uint256) public enabledContractsIndex; function getAllEnabledContracts() external view returns (address[] memory) { return enabledContracts; } function _addContractToEnum(address contract_) internal { enabledContractsIndex[contract_] = enabledContracts.length; enabledContracts.push(contract_); } function _removeContractFromEnum(address contract_) internal { uint256 _lastIndex = enabledContracts.length - 1; uint256 _currentIndex = enabledContractsIndex[contract_]; // If the contract is not the last contract in the array if (_currentIndex != _lastIndex) { // Replace the to-be-deleted address with the last address address _lastAddress = enabledContracts[_lastIndex]; enabledContracts[_currentIndex] = _lastAddress; } // Remove the last item enabledContracts.pop(); // Delete the index delete enabledContractsIndex[contract_]; } // Registry (Contract Owner) mapping(address => bool) public contractToMESRegistry; function registerContractToVending(address contract_) external { require(msg.sender == IERC20(contract_).owner(), "You are not the Contract Owner!"); require(!contractToEnabled[contract_], "Your contract has already been registered!"); require(MES.balanceOf(msg.sender) >= registrationPrice, "You don't have enough $MES!"); MES.transferFrom(msg.sender, registrationCollector, registrationPrice); contractToEnabled[contract_] = true; contractToMESRegistry[contract_] = true; _addContractToEnum(contract_); emit ContractRegistered(contract_, msg.sender, registrationPrice); } // Contract Owner Governance Control modifier onlyContractOwner (address contract_) { address _owner = contractToUnstuckOwner[contract_] != address(0) ? contractToUnstuckOwner[contract_] : IERC20(contract_).owner(); require(msg.sender == _owner, "You are not the Contract Owner!"); require(contractToEnabled[contract_], "Please register your Contract first!"); _; } modifier onlyAuthorized (address contract_, address operator_) { require(contractToControllersApproved[contract_][operator_] || msg.sender == (contractToUnstuckOwner[contract_] != address(0) ? contractToUnstuckOwner[contract_] : IERC20(contract_).owner()), "You are not Authorized for this ERC20 Contract!"); _; } // Project Control (Contract Owner) struct ProjectInfo { string projectName; string tokenImageUri; } mapping(address => ProjectInfo) public contractToProjectInfo; function registerProjectInfo(address contract_, string calldata projectName_, string calldata tokenImage_) external onlyContractOwner(contract_) { contractToProjectInfo[contract_] = ProjectInfo(projectName_, tokenImage_); emit ProjectInfoPushed(contract_, msg.sender, projectName_, tokenImage_); } mapping(address => mapping(address => bool)) public contractToControllersApproved; function manageController(address contract_, address operator_, bool bool_) external onlyContractOwner(contract_) { contractToControllersApproved[contract_][operator_] = bool_; emit OperatorManaged(contract_, operator_, bool_); } address internal burnAddress = 0x000000000000000000000000000000000000dEaD; mapping(address => address) public contractToTreasuryAddress; function _getTreasury(address contract_) internal view returns (address) { return contractToTreasuryAddress[contract_] != address(0) ? contractToTreasuryAddress[contract_] : burnAddress; } function setTreasuryAddress(address contract_, address treasury_) external onlyContractOwner(contract_) { contractToTreasuryAddress[contract_] = treasury_; emit TreasuryManaged(contract_, treasury_); } // Whitelist Marketplace struct WLVendingItem { string title; string imageUri; string projectUri; string description; uint32 amountAvailable; uint32 amountPurchased; uint32 deadline; uint256 price; } // Database of Vending Items for each ERC20 mapping(address => WLVendingItem[]) public contractToWLVendingItems; // Database of Vending Items Purchasers for each ERC20 mapping(address => mapping(uint256 => address[])) public contractToWLPurchasers; mapping(address => mapping(uint256 => mapping(address => bool))) public contractToWLPurchased; function addWLVendingItem(address contract_, string calldata title_, string calldata imageUri_, string calldata projectUri_, string calldata description_, uint32 amountAvailable_, uint32 deadline_, uint256 price_) external onlyAuthorized(contract_, msg.sender) { require(bytes(title_).length > 0, "You must specify a Title!"); require(uint256(deadline_) > block.timestamp, "Already expired timestamp!"); contractToWLVendingItems[contract_].push( WLVendingItem( title_, imageUri_, projectUri_, description_, amountAvailable_, 0, deadline_, price_ ) ); emit WLVendingItemAdded(contract_, title_, imageUri_, projectUri_, description_, amountAvailable_, deadline_, price_); } function modifyWLVendingItem(address contract_, uint256 index_, WLVendingItem memory WLVendingItem_) external onlyAuthorized(contract_, msg.sender) { WLVendingItem memory _item = contractToWLVendingItems[contract_][index_]; require(bytes(_item.title).length > 0, "This WLVendingItem does not exist!"); require(WLVendingItem_.amountAvailable >= _item.amountPurchased, "Amount Available must be >= Amount Purchased!"); contractToWLVendingItems[contract_][index_] = WLVendingItem_; emit WLVendingItemModified(contract_, _item, WLVendingItem_); } function deleteMostRecentWLVendingItem(address contract_) external onlyAuthorized(contract_, msg.sender) { uint256 _lastIndex = contractToWLVendingItems[contract_].length - 1; WLVendingItem memory _item = contractToWLVendingItems[contract_][_lastIndex]; require(_item.amountPurchased == 0, "Cannot delete item with already bought goods!"); contractToWLVendingItems[contract_].pop(); emit WLVendingItemRemoved(contract_, msg.sender, _item); } // Core Function of WL Vending (User) function purchaseWLVendingItem(address contract_, uint256 index_) external { // Load the WLVendingItem to Memory WLVendingItem memory _item = contractToWLVendingItems[contract_][index_]; // Check the necessary requirements to purchase require(bytes(_item.title).length > 0, "This WLVendingItem does not exist!"); require(_item.amountAvailable > _item.amountPurchased, "No more WL remaining!"); require(_item.deadline >= block.timestamp, "Passed deadline!"); require(!contractToWLPurchased[contract_][index_][msg.sender], "Already purchased!"); require(IERC20(contract_).balanceOf(msg.sender) >= _item.price, "Not enough tokens!"); // Pay for the WL IERC20(contract_).transferFrom( msg.sender, _getTreasury(contract_), _item.price); // Add the address into the WL List contractToWLPurchased[contract_][index_][msg.sender] = true; contractToWLPurchasers[contract_][index_].push(msg.sender); // Increment Amount Purchased contractToWLVendingItems[contract_][index_].amountPurchased++; emit WLVendingItemPurchased(contract_, index_, msg.sender, _item); } // Read Functions function getWLPurchasersOf(address contract_, uint256 index_) external view returns (address[] memory) { return contractToWLPurchasers[contract_][index_]; } function getWLVendingItemsAll(address contract_) external view returns (WLVendingItem[] memory) { return contractToWLVendingItems[contract_]; } function getWLVendingItemsLength(address contract_) external view returns (uint256) { return contractToWLVendingItems[contract_].length; } function getWLVendingItemsPaginated(address contract_, uint256 start_, uint256 end_) external view returns (WLVendingItem[] memory) { uint256 _arrayLength = end_ - start_ + 1; WLVendingItem[] memory _items = new WLVendingItem[] (_arrayLength); uint256 _index; for (uint256 i = 0; i < _arrayLength; i++) { _items[_index++] = contractToWLVendingItems[contract_][start_ + i]; } return _items; } }
getWLPurchasersOf
function getWLPurchasersOf(address contract_, uint256 index_) external view returns (address[] memory) { return contractToWLPurchasers[contract_][index_]; }
// Read Functions
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://08214d9cc81f6078b879cb8408c62eff112d8ed47a9e56b36c9cd73db1793a7d
{ "func_code_index": [ 13707, 13889 ] }
56,618
FabFourGear
contracts/FabFour.sol
0x42412d4f9007102d64cc6b56ed4439a6d31f4ad9
Solidity
FabFourGear
contract FabFourGear is ERC721Enumerable, Ownable{ using Strings for uint256; // Constant variables // ------------------------------------------------------------------------ uint256 public constant SUPPLY_HARD_CAP = 4444; // Total amount of FAB uint256 public constant PRESALE_SUPPLY = 444; // Total amount of FAB available for presale uint256 public constant MAX_CLAIM_PER_WALLET_PRESALE = 2; // Max each address can purchase during presale uint256 public constant MAX_CLAIM_PER_WALLET_PUBLIC = 4; // Max amount of FAB per wallet during public sale. uint256 public constant MAX_PER_TX_PRESALE = 2; // Max amount of FAB per tx presale uint256 public constant MAX_PER_TX_PUBLIC = 4; // Max amount of FAB per tx public sale uint256 public constant PRESALE_PRICE = .02 ether; uint256 public constant PRICE = 0.04 ether; //Variable variables // ------------------------------------------------------------------------ uint256 public reservedSupply = 125; // Amount of FAB reserved for the team and fans uint256 public presaleMinted = 0; // Team addresses // ------------------------------------------------------------------------ address private constant _a1 = 0x9D11BD2eca5f42eE8bed9db5D11f66cffB868927; address private constant _a2 = 0x62A10BF70c9eA5c5350A1a0016C273875DD44263; address private constant _a3 = 0x1346e5B390AD61C4Bb7B1d58b53157f95B3Ee893; address private constant _a4 = 0x52Ea2a1A5FC76cEc50F5616C263F49292102Af64; address private constant _a5 = 0xce550745Cfd4F4C85338908670CD6311F7dAb44a; address private constant _a6 = 0x4dbDa0BC6C9acf197333847b4d6C052a179b4F24; address private constant _a7 = 0xDB2214Ed07d122f11c4d1b89cD002F1f6eA79e4c; address private constant _a8 = 0x73FF3b28216C3bea994787A845b202fAC40c92cE; address private constant _a9 = 0xFb77701BA36363b750d628bDFbE8C1259aFa95cb; address private constant _a10 = 0x8c39F90513B43A21418513eA484d7CBd8261421b; // State variables // ------------------------------------------------------------------------ bool public isPresaleActive = false; bool public isPublicSaleActive = false; // Mappings // ------------------------------------------------------------------------ mapping(address => uint256) private _presaleClaimed; mapping(address => uint256) private _totalClaimed; mapping(address => bool) private _trustedParties; // URI variables // ------------------------------------------------------------------------ string private _contractURI; string private _baseTokenURI; // Events // ------------------------------------------------------------------------ event BaseTokenURIChanged(string baseTokenURI); event ContractURIChanged(string contractURI); // Constructor // ------------------------------------------------------------------------ constructor( string memory _initBaseURI, string memory _initContractURI ) ERC721("Fab Four Gear Genesis VIP Pass", "FAB") { _contractURI = _initContractURI; _baseTokenURI = _initBaseURI; } // Modifiers // ------------------------------------------------------------------------ modifier onlyPresale() { require(isPresaleActive, "PRESALE_NOT_ACTIVE"); _; } modifier onlyPublicSale() { require(isPublicSaleActive, "PUBLIC_SALE_NOT_ACTIVE"); _; } modifier onlyTrustedParties(address addr) { require(_trustedParties[addr], "NOT_A_TRUSTED_PARTY"); _; } // Permissions functions // ------------------------------------------------------------------------ function addToTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(!_trustedParties[addresses[i]], "DUPLICATE_ENTRY"); _trustedParties[addresses[i]] = true; } } function removeFromTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(_trustedParties[addresses[i]], "NOT_IN_PRESALE"); _trustedParties[addresses[i]] = false; } } // Presale functions // ------------------------------------------------------------------------ function hasClaimedPresale(address addr) external view returns (bool) { require(addr != address(0), "NULL_ADDRESS"); return _presaleClaimed[addr] == MAX_CLAIM_PER_WALLET_PRESALE; } function togglePresaleStatus() external onlyOwner { isPresaleActive = !isPresaleActive; } function togglePublicSaleStatus() external onlyOwner { isPublicSaleActive = !isPublicSaleActive; } // Mint functions // ------------------------------------------------------------------------ function claimReserveNFTs(uint256 quantity, address addr) external onlyOwner { require(totalSupply() < SUPPLY_HARD_CAP, "SOLD_OUT"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP, "EXCEEDS_TOTAL_SUPPLY"); require(quantity <= reservedSupply, "NO_MORE_RESERVED_TOKENS_AVAILABLE"); require(quantity > 0, "MUST_MINT_AT_LEAST_ONE_TOKEN"); for (uint256 i = 0; i < quantity; i++) { _safeMint(addr, totalSupply() + 1); reservedSupply -= 1; } } function claimPresaleNFTs(uint256 quantity) external payable onlyPresale { require(_presaleClaimed[msg.sender] < MAX_CLAIM_PER_WALLET_PRESALE, "ALREADY_CLAIMED"); require(_presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PRESALE, "EXCEEDS_ALLOCATION"); require(presaleMinted < PRESALE_SUPPLY, "PRESALE_SOLD_OUT"); require(presaleMinted + quantity <= PRESALE_SUPPLY, "EXCEEDS_PRESALE_SUPPLY"); require(PRESALE_PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(quantity <= MAX_PER_TX_PRESALE, "EXCEEDS_MAX_MINT"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); for (uint256 i = 0; i < quantity; i++) { _presaleClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); presaleMinted += 1; } } function mint(uint256 quantity) external payable onlyPublicSale { require(tx.origin == msg.sender, "GO_AWAY_BOT_ORIGIN"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP - reservedSupply, "EXCEEDS_MAX_SUPPLY"); require(quantity <= MAX_PER_TX_PUBLIC, "EXCEEDS_MAX_MINT"); require(_totalClaimed[msg.sender] + _presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PUBLIC, "EXCEEDS_MAX_ALLOWANCE"); require(PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); for (uint256 i = 0; i < quantity; i++) { _totalClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); } } // Base URI Functions // ------------------------------------------------------------------------ function setContractURI(string calldata URI) external onlyOwner { _contractURI = URI; emit ContractURIChanged(URI); } function contractURI() public view returns (string memory) { return _contractURI; } function setBaseTokenURI(string calldata URI) external onlyOwner { _baseTokenURI = URI; emit BaseTokenURIChanged(URI); } function baseTokenURI() public view returns (string memory) { return _baseTokenURI; } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require(_exists(tokenId), "Cannot query non-existent token"); string memory uniqueId = string(abi.encodePacked(tokenId.toString(), ".json")); return string(abi.encodePacked(_baseTokenURI, uniqueId)); } //Withdrawal functions // ------------------------------------------------------------------------ function withdrawAll() external onlyTrustedParties(msg.sender) { uint _a1amount = address(this).balance * 26/100; uint _a2amount = address(this).balance * 15/100; uint _a3amount = address(this).balance * 15/100; uint _a4amount = address(this).balance * 10/100; uint _a5amount = address(this).balance * 7/100; uint _a6amount = address(this).balance * 7/100; uint _a7amount = address(this).balance * 5/100; uint _a8amount = address(this).balance * 5/100; uint _a9amount = address(this).balance * 5/100; uint _a10amount = address(this).balance * 5/100; require(payable(_a1).send(_a1amount), "FAILED_TO_SEND_TO_A1"); require(payable(_a2).send(_a2amount), "FAILED_TO_SEND_TO_A2"); require(payable(_a3).send(_a3amount), "FAILED_TO_SEND_TO_A3"); require(payable(_a4).send(_a4amount), "FAILED_TO_SEND_TO_A4"); require(payable(_a5).send(_a5amount), "FAILED_TO_SEND_TO_A5"); require(payable(_a6).send(_a6amount), "FAILED_TO_SEND_TO_A6"); require(payable(_a7).send(_a7amount), "FAILED_TO_SEND_TO_A7"); require(payable(_a8).send(_a8amount), "FAILED_TO_SEND_TO_A8"); require(payable(_a9).send(_a9amount), "FAILED_TO_SEND_TO_A9"); require(payable(_a10).send(_a10amount), "FAILED_TO_SEND_TO_A10"); } function emergencyWithdraw() external onlyTrustedParties(msg.sender) { payable(_a1).transfer(address(this).balance); } }
addToTrustedParties
function addToTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(!_trustedParties[addresses[i]], "DUPLICATE_ENTRY"); _trustedParties[addresses[i]] = true; } }
// Permissions functions // ------------------------------------------------------------------------
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://dbfc5f54ef450100d1eca69226ef749d32ee1627c4286935914b8ea9f9d1d655
{ "func_code_index": [ 3821, 4172 ] }
56,619
FabFourGear
contracts/FabFour.sol
0x42412d4f9007102d64cc6b56ed4439a6d31f4ad9
Solidity
FabFourGear
contract FabFourGear is ERC721Enumerable, Ownable{ using Strings for uint256; // Constant variables // ------------------------------------------------------------------------ uint256 public constant SUPPLY_HARD_CAP = 4444; // Total amount of FAB uint256 public constant PRESALE_SUPPLY = 444; // Total amount of FAB available for presale uint256 public constant MAX_CLAIM_PER_WALLET_PRESALE = 2; // Max each address can purchase during presale uint256 public constant MAX_CLAIM_PER_WALLET_PUBLIC = 4; // Max amount of FAB per wallet during public sale. uint256 public constant MAX_PER_TX_PRESALE = 2; // Max amount of FAB per tx presale uint256 public constant MAX_PER_TX_PUBLIC = 4; // Max amount of FAB per tx public sale uint256 public constant PRESALE_PRICE = .02 ether; uint256 public constant PRICE = 0.04 ether; //Variable variables // ------------------------------------------------------------------------ uint256 public reservedSupply = 125; // Amount of FAB reserved for the team and fans uint256 public presaleMinted = 0; // Team addresses // ------------------------------------------------------------------------ address private constant _a1 = 0x9D11BD2eca5f42eE8bed9db5D11f66cffB868927; address private constant _a2 = 0x62A10BF70c9eA5c5350A1a0016C273875DD44263; address private constant _a3 = 0x1346e5B390AD61C4Bb7B1d58b53157f95B3Ee893; address private constant _a4 = 0x52Ea2a1A5FC76cEc50F5616C263F49292102Af64; address private constant _a5 = 0xce550745Cfd4F4C85338908670CD6311F7dAb44a; address private constant _a6 = 0x4dbDa0BC6C9acf197333847b4d6C052a179b4F24; address private constant _a7 = 0xDB2214Ed07d122f11c4d1b89cD002F1f6eA79e4c; address private constant _a8 = 0x73FF3b28216C3bea994787A845b202fAC40c92cE; address private constant _a9 = 0xFb77701BA36363b750d628bDFbE8C1259aFa95cb; address private constant _a10 = 0x8c39F90513B43A21418513eA484d7CBd8261421b; // State variables // ------------------------------------------------------------------------ bool public isPresaleActive = false; bool public isPublicSaleActive = false; // Mappings // ------------------------------------------------------------------------ mapping(address => uint256) private _presaleClaimed; mapping(address => uint256) private _totalClaimed; mapping(address => bool) private _trustedParties; // URI variables // ------------------------------------------------------------------------ string private _contractURI; string private _baseTokenURI; // Events // ------------------------------------------------------------------------ event BaseTokenURIChanged(string baseTokenURI); event ContractURIChanged(string contractURI); // Constructor // ------------------------------------------------------------------------ constructor( string memory _initBaseURI, string memory _initContractURI ) ERC721("Fab Four Gear Genesis VIP Pass", "FAB") { _contractURI = _initContractURI; _baseTokenURI = _initBaseURI; } // Modifiers // ------------------------------------------------------------------------ modifier onlyPresale() { require(isPresaleActive, "PRESALE_NOT_ACTIVE"); _; } modifier onlyPublicSale() { require(isPublicSaleActive, "PUBLIC_SALE_NOT_ACTIVE"); _; } modifier onlyTrustedParties(address addr) { require(_trustedParties[addr], "NOT_A_TRUSTED_PARTY"); _; } // Permissions functions // ------------------------------------------------------------------------ function addToTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(!_trustedParties[addresses[i]], "DUPLICATE_ENTRY"); _trustedParties[addresses[i]] = true; } } function removeFromTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(_trustedParties[addresses[i]], "NOT_IN_PRESALE"); _trustedParties[addresses[i]] = false; } } // Presale functions // ------------------------------------------------------------------------ function hasClaimedPresale(address addr) external view returns (bool) { require(addr != address(0), "NULL_ADDRESS"); return _presaleClaimed[addr] == MAX_CLAIM_PER_WALLET_PRESALE; } function togglePresaleStatus() external onlyOwner { isPresaleActive = !isPresaleActive; } function togglePublicSaleStatus() external onlyOwner { isPublicSaleActive = !isPublicSaleActive; } // Mint functions // ------------------------------------------------------------------------ function claimReserveNFTs(uint256 quantity, address addr) external onlyOwner { require(totalSupply() < SUPPLY_HARD_CAP, "SOLD_OUT"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP, "EXCEEDS_TOTAL_SUPPLY"); require(quantity <= reservedSupply, "NO_MORE_RESERVED_TOKENS_AVAILABLE"); require(quantity > 0, "MUST_MINT_AT_LEAST_ONE_TOKEN"); for (uint256 i = 0; i < quantity; i++) { _safeMint(addr, totalSupply() + 1); reservedSupply -= 1; } } function claimPresaleNFTs(uint256 quantity) external payable onlyPresale { require(_presaleClaimed[msg.sender] < MAX_CLAIM_PER_WALLET_PRESALE, "ALREADY_CLAIMED"); require(_presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PRESALE, "EXCEEDS_ALLOCATION"); require(presaleMinted < PRESALE_SUPPLY, "PRESALE_SOLD_OUT"); require(presaleMinted + quantity <= PRESALE_SUPPLY, "EXCEEDS_PRESALE_SUPPLY"); require(PRESALE_PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(quantity <= MAX_PER_TX_PRESALE, "EXCEEDS_MAX_MINT"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); for (uint256 i = 0; i < quantity; i++) { _presaleClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); presaleMinted += 1; } } function mint(uint256 quantity) external payable onlyPublicSale { require(tx.origin == msg.sender, "GO_AWAY_BOT_ORIGIN"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP - reservedSupply, "EXCEEDS_MAX_SUPPLY"); require(quantity <= MAX_PER_TX_PUBLIC, "EXCEEDS_MAX_MINT"); require(_totalClaimed[msg.sender] + _presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PUBLIC, "EXCEEDS_MAX_ALLOWANCE"); require(PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); for (uint256 i = 0; i < quantity; i++) { _totalClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); } } // Base URI Functions // ------------------------------------------------------------------------ function setContractURI(string calldata URI) external onlyOwner { _contractURI = URI; emit ContractURIChanged(URI); } function contractURI() public view returns (string memory) { return _contractURI; } function setBaseTokenURI(string calldata URI) external onlyOwner { _baseTokenURI = URI; emit BaseTokenURIChanged(URI); } function baseTokenURI() public view returns (string memory) { return _baseTokenURI; } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require(_exists(tokenId), "Cannot query non-existent token"); string memory uniqueId = string(abi.encodePacked(tokenId.toString(), ".json")); return string(abi.encodePacked(_baseTokenURI, uniqueId)); } //Withdrawal functions // ------------------------------------------------------------------------ function withdrawAll() external onlyTrustedParties(msg.sender) { uint _a1amount = address(this).balance * 26/100; uint _a2amount = address(this).balance * 15/100; uint _a3amount = address(this).balance * 15/100; uint _a4amount = address(this).balance * 10/100; uint _a5amount = address(this).balance * 7/100; uint _a6amount = address(this).balance * 7/100; uint _a7amount = address(this).balance * 5/100; uint _a8amount = address(this).balance * 5/100; uint _a9amount = address(this).balance * 5/100; uint _a10amount = address(this).balance * 5/100; require(payable(_a1).send(_a1amount), "FAILED_TO_SEND_TO_A1"); require(payable(_a2).send(_a2amount), "FAILED_TO_SEND_TO_A2"); require(payable(_a3).send(_a3amount), "FAILED_TO_SEND_TO_A3"); require(payable(_a4).send(_a4amount), "FAILED_TO_SEND_TO_A4"); require(payable(_a5).send(_a5amount), "FAILED_TO_SEND_TO_A5"); require(payable(_a6).send(_a6amount), "FAILED_TO_SEND_TO_A6"); require(payable(_a7).send(_a7amount), "FAILED_TO_SEND_TO_A7"); require(payable(_a8).send(_a8amount), "FAILED_TO_SEND_TO_A8"); require(payable(_a9).send(_a9amount), "FAILED_TO_SEND_TO_A9"); require(payable(_a10).send(_a10amount), "FAILED_TO_SEND_TO_A10"); } function emergencyWithdraw() external onlyTrustedParties(msg.sender) { payable(_a1).transfer(address(this).balance); } }
hasClaimedPresale
function hasClaimedPresale(address addr) external view returns (bool) { require(addr != address(0), "NULL_ADDRESS"); return _presaleClaimed[addr] == MAX_CLAIM_PER_WALLET_PRESALE; }
// Presale functions // ------------------------------------------------------------------------
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://dbfc5f54ef450100d1eca69226ef749d32ee1627c4286935914b8ea9f9d1d655
{ "func_code_index": [ 4640, 4850 ] }
56,620
FabFourGear
contracts/FabFour.sol
0x42412d4f9007102d64cc6b56ed4439a6d31f4ad9
Solidity
FabFourGear
contract FabFourGear is ERC721Enumerable, Ownable{ using Strings for uint256; // Constant variables // ------------------------------------------------------------------------ uint256 public constant SUPPLY_HARD_CAP = 4444; // Total amount of FAB uint256 public constant PRESALE_SUPPLY = 444; // Total amount of FAB available for presale uint256 public constant MAX_CLAIM_PER_WALLET_PRESALE = 2; // Max each address can purchase during presale uint256 public constant MAX_CLAIM_PER_WALLET_PUBLIC = 4; // Max amount of FAB per wallet during public sale. uint256 public constant MAX_PER_TX_PRESALE = 2; // Max amount of FAB per tx presale uint256 public constant MAX_PER_TX_PUBLIC = 4; // Max amount of FAB per tx public sale uint256 public constant PRESALE_PRICE = .02 ether; uint256 public constant PRICE = 0.04 ether; //Variable variables // ------------------------------------------------------------------------ uint256 public reservedSupply = 125; // Amount of FAB reserved for the team and fans uint256 public presaleMinted = 0; // Team addresses // ------------------------------------------------------------------------ address private constant _a1 = 0x9D11BD2eca5f42eE8bed9db5D11f66cffB868927; address private constant _a2 = 0x62A10BF70c9eA5c5350A1a0016C273875DD44263; address private constant _a3 = 0x1346e5B390AD61C4Bb7B1d58b53157f95B3Ee893; address private constant _a4 = 0x52Ea2a1A5FC76cEc50F5616C263F49292102Af64; address private constant _a5 = 0xce550745Cfd4F4C85338908670CD6311F7dAb44a; address private constant _a6 = 0x4dbDa0BC6C9acf197333847b4d6C052a179b4F24; address private constant _a7 = 0xDB2214Ed07d122f11c4d1b89cD002F1f6eA79e4c; address private constant _a8 = 0x73FF3b28216C3bea994787A845b202fAC40c92cE; address private constant _a9 = 0xFb77701BA36363b750d628bDFbE8C1259aFa95cb; address private constant _a10 = 0x8c39F90513B43A21418513eA484d7CBd8261421b; // State variables // ------------------------------------------------------------------------ bool public isPresaleActive = false; bool public isPublicSaleActive = false; // Mappings // ------------------------------------------------------------------------ mapping(address => uint256) private _presaleClaimed; mapping(address => uint256) private _totalClaimed; mapping(address => bool) private _trustedParties; // URI variables // ------------------------------------------------------------------------ string private _contractURI; string private _baseTokenURI; // Events // ------------------------------------------------------------------------ event BaseTokenURIChanged(string baseTokenURI); event ContractURIChanged(string contractURI); // Constructor // ------------------------------------------------------------------------ constructor( string memory _initBaseURI, string memory _initContractURI ) ERC721("Fab Four Gear Genesis VIP Pass", "FAB") { _contractURI = _initContractURI; _baseTokenURI = _initBaseURI; } // Modifiers // ------------------------------------------------------------------------ modifier onlyPresale() { require(isPresaleActive, "PRESALE_NOT_ACTIVE"); _; } modifier onlyPublicSale() { require(isPublicSaleActive, "PUBLIC_SALE_NOT_ACTIVE"); _; } modifier onlyTrustedParties(address addr) { require(_trustedParties[addr], "NOT_A_TRUSTED_PARTY"); _; } // Permissions functions // ------------------------------------------------------------------------ function addToTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(!_trustedParties[addresses[i]], "DUPLICATE_ENTRY"); _trustedParties[addresses[i]] = true; } } function removeFromTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(_trustedParties[addresses[i]], "NOT_IN_PRESALE"); _trustedParties[addresses[i]] = false; } } // Presale functions // ------------------------------------------------------------------------ function hasClaimedPresale(address addr) external view returns (bool) { require(addr != address(0), "NULL_ADDRESS"); return _presaleClaimed[addr] == MAX_CLAIM_PER_WALLET_PRESALE; } function togglePresaleStatus() external onlyOwner { isPresaleActive = !isPresaleActive; } function togglePublicSaleStatus() external onlyOwner { isPublicSaleActive = !isPublicSaleActive; } // Mint functions // ------------------------------------------------------------------------ function claimReserveNFTs(uint256 quantity, address addr) external onlyOwner { require(totalSupply() < SUPPLY_HARD_CAP, "SOLD_OUT"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP, "EXCEEDS_TOTAL_SUPPLY"); require(quantity <= reservedSupply, "NO_MORE_RESERVED_TOKENS_AVAILABLE"); require(quantity > 0, "MUST_MINT_AT_LEAST_ONE_TOKEN"); for (uint256 i = 0; i < quantity; i++) { _safeMint(addr, totalSupply() + 1); reservedSupply -= 1; } } function claimPresaleNFTs(uint256 quantity) external payable onlyPresale { require(_presaleClaimed[msg.sender] < MAX_CLAIM_PER_WALLET_PRESALE, "ALREADY_CLAIMED"); require(_presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PRESALE, "EXCEEDS_ALLOCATION"); require(presaleMinted < PRESALE_SUPPLY, "PRESALE_SOLD_OUT"); require(presaleMinted + quantity <= PRESALE_SUPPLY, "EXCEEDS_PRESALE_SUPPLY"); require(PRESALE_PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(quantity <= MAX_PER_TX_PRESALE, "EXCEEDS_MAX_MINT"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); for (uint256 i = 0; i < quantity; i++) { _presaleClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); presaleMinted += 1; } } function mint(uint256 quantity) external payable onlyPublicSale { require(tx.origin == msg.sender, "GO_AWAY_BOT_ORIGIN"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP - reservedSupply, "EXCEEDS_MAX_SUPPLY"); require(quantity <= MAX_PER_TX_PUBLIC, "EXCEEDS_MAX_MINT"); require(_totalClaimed[msg.sender] + _presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PUBLIC, "EXCEEDS_MAX_ALLOWANCE"); require(PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); for (uint256 i = 0; i < quantity; i++) { _totalClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); } } // Base URI Functions // ------------------------------------------------------------------------ function setContractURI(string calldata URI) external onlyOwner { _contractURI = URI; emit ContractURIChanged(URI); } function contractURI() public view returns (string memory) { return _contractURI; } function setBaseTokenURI(string calldata URI) external onlyOwner { _baseTokenURI = URI; emit BaseTokenURIChanged(URI); } function baseTokenURI() public view returns (string memory) { return _baseTokenURI; } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require(_exists(tokenId), "Cannot query non-existent token"); string memory uniqueId = string(abi.encodePacked(tokenId.toString(), ".json")); return string(abi.encodePacked(_baseTokenURI, uniqueId)); } //Withdrawal functions // ------------------------------------------------------------------------ function withdrawAll() external onlyTrustedParties(msg.sender) { uint _a1amount = address(this).balance * 26/100; uint _a2amount = address(this).balance * 15/100; uint _a3amount = address(this).balance * 15/100; uint _a4amount = address(this).balance * 10/100; uint _a5amount = address(this).balance * 7/100; uint _a6amount = address(this).balance * 7/100; uint _a7amount = address(this).balance * 5/100; uint _a8amount = address(this).balance * 5/100; uint _a9amount = address(this).balance * 5/100; uint _a10amount = address(this).balance * 5/100; require(payable(_a1).send(_a1amount), "FAILED_TO_SEND_TO_A1"); require(payable(_a2).send(_a2amount), "FAILED_TO_SEND_TO_A2"); require(payable(_a3).send(_a3amount), "FAILED_TO_SEND_TO_A3"); require(payable(_a4).send(_a4amount), "FAILED_TO_SEND_TO_A4"); require(payable(_a5).send(_a5amount), "FAILED_TO_SEND_TO_A5"); require(payable(_a6).send(_a6amount), "FAILED_TO_SEND_TO_A6"); require(payable(_a7).send(_a7amount), "FAILED_TO_SEND_TO_A7"); require(payable(_a8).send(_a8amount), "FAILED_TO_SEND_TO_A8"); require(payable(_a9).send(_a9amount), "FAILED_TO_SEND_TO_A9"); require(payable(_a10).send(_a10amount), "FAILED_TO_SEND_TO_A10"); } function emergencyWithdraw() external onlyTrustedParties(msg.sender) { payable(_a1).transfer(address(this).balance); } }
claimReserveNFTs
function claimReserveNFTs(uint256 quantity, address addr) external onlyOwner { require(totalSupply() < SUPPLY_HARD_CAP, "SOLD_OUT"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP, "EXCEEDS_TOTAL_SUPPLY"); require(quantity <= reservedSupply, "NO_MORE_RESERVED_TOKENS_AVAILABLE"); require(quantity > 0, "MUST_MINT_AT_LEAST_ONE_TOKEN"); for (uint256 i = 0; i < quantity; i++) { _safeMint(addr, totalSupply() + 1); reservedSupply -= 1; } }
// Mint functions // ------------------------------------------------------------------------
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://dbfc5f54ef450100d1eca69226ef749d32ee1627c4286935914b8ea9f9d1d655
{ "func_code_index": [ 5190, 5723 ] }
56,621
FabFourGear
contracts/FabFour.sol
0x42412d4f9007102d64cc6b56ed4439a6d31f4ad9
Solidity
FabFourGear
contract FabFourGear is ERC721Enumerable, Ownable{ using Strings for uint256; // Constant variables // ------------------------------------------------------------------------ uint256 public constant SUPPLY_HARD_CAP = 4444; // Total amount of FAB uint256 public constant PRESALE_SUPPLY = 444; // Total amount of FAB available for presale uint256 public constant MAX_CLAIM_PER_WALLET_PRESALE = 2; // Max each address can purchase during presale uint256 public constant MAX_CLAIM_PER_WALLET_PUBLIC = 4; // Max amount of FAB per wallet during public sale. uint256 public constant MAX_PER_TX_PRESALE = 2; // Max amount of FAB per tx presale uint256 public constant MAX_PER_TX_PUBLIC = 4; // Max amount of FAB per tx public sale uint256 public constant PRESALE_PRICE = .02 ether; uint256 public constant PRICE = 0.04 ether; //Variable variables // ------------------------------------------------------------------------ uint256 public reservedSupply = 125; // Amount of FAB reserved for the team and fans uint256 public presaleMinted = 0; // Team addresses // ------------------------------------------------------------------------ address private constant _a1 = 0x9D11BD2eca5f42eE8bed9db5D11f66cffB868927; address private constant _a2 = 0x62A10BF70c9eA5c5350A1a0016C273875DD44263; address private constant _a3 = 0x1346e5B390AD61C4Bb7B1d58b53157f95B3Ee893; address private constant _a4 = 0x52Ea2a1A5FC76cEc50F5616C263F49292102Af64; address private constant _a5 = 0xce550745Cfd4F4C85338908670CD6311F7dAb44a; address private constant _a6 = 0x4dbDa0BC6C9acf197333847b4d6C052a179b4F24; address private constant _a7 = 0xDB2214Ed07d122f11c4d1b89cD002F1f6eA79e4c; address private constant _a8 = 0x73FF3b28216C3bea994787A845b202fAC40c92cE; address private constant _a9 = 0xFb77701BA36363b750d628bDFbE8C1259aFa95cb; address private constant _a10 = 0x8c39F90513B43A21418513eA484d7CBd8261421b; // State variables // ------------------------------------------------------------------------ bool public isPresaleActive = false; bool public isPublicSaleActive = false; // Mappings // ------------------------------------------------------------------------ mapping(address => uint256) private _presaleClaimed; mapping(address => uint256) private _totalClaimed; mapping(address => bool) private _trustedParties; // URI variables // ------------------------------------------------------------------------ string private _contractURI; string private _baseTokenURI; // Events // ------------------------------------------------------------------------ event BaseTokenURIChanged(string baseTokenURI); event ContractURIChanged(string contractURI); // Constructor // ------------------------------------------------------------------------ constructor( string memory _initBaseURI, string memory _initContractURI ) ERC721("Fab Four Gear Genesis VIP Pass", "FAB") { _contractURI = _initContractURI; _baseTokenURI = _initBaseURI; } // Modifiers // ------------------------------------------------------------------------ modifier onlyPresale() { require(isPresaleActive, "PRESALE_NOT_ACTIVE"); _; } modifier onlyPublicSale() { require(isPublicSaleActive, "PUBLIC_SALE_NOT_ACTIVE"); _; } modifier onlyTrustedParties(address addr) { require(_trustedParties[addr], "NOT_A_TRUSTED_PARTY"); _; } // Permissions functions // ------------------------------------------------------------------------ function addToTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(!_trustedParties[addresses[i]], "DUPLICATE_ENTRY"); _trustedParties[addresses[i]] = true; } } function removeFromTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(_trustedParties[addresses[i]], "NOT_IN_PRESALE"); _trustedParties[addresses[i]] = false; } } // Presale functions // ------------------------------------------------------------------------ function hasClaimedPresale(address addr) external view returns (bool) { require(addr != address(0), "NULL_ADDRESS"); return _presaleClaimed[addr] == MAX_CLAIM_PER_WALLET_PRESALE; } function togglePresaleStatus() external onlyOwner { isPresaleActive = !isPresaleActive; } function togglePublicSaleStatus() external onlyOwner { isPublicSaleActive = !isPublicSaleActive; } // Mint functions // ------------------------------------------------------------------------ function claimReserveNFTs(uint256 quantity, address addr) external onlyOwner { require(totalSupply() < SUPPLY_HARD_CAP, "SOLD_OUT"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP, "EXCEEDS_TOTAL_SUPPLY"); require(quantity <= reservedSupply, "NO_MORE_RESERVED_TOKENS_AVAILABLE"); require(quantity > 0, "MUST_MINT_AT_LEAST_ONE_TOKEN"); for (uint256 i = 0; i < quantity; i++) { _safeMint(addr, totalSupply() + 1); reservedSupply -= 1; } } function claimPresaleNFTs(uint256 quantity) external payable onlyPresale { require(_presaleClaimed[msg.sender] < MAX_CLAIM_PER_WALLET_PRESALE, "ALREADY_CLAIMED"); require(_presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PRESALE, "EXCEEDS_ALLOCATION"); require(presaleMinted < PRESALE_SUPPLY, "PRESALE_SOLD_OUT"); require(presaleMinted + quantity <= PRESALE_SUPPLY, "EXCEEDS_PRESALE_SUPPLY"); require(PRESALE_PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(quantity <= MAX_PER_TX_PRESALE, "EXCEEDS_MAX_MINT"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); for (uint256 i = 0; i < quantity; i++) { _presaleClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); presaleMinted += 1; } } function mint(uint256 quantity) external payable onlyPublicSale { require(tx.origin == msg.sender, "GO_AWAY_BOT_ORIGIN"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP - reservedSupply, "EXCEEDS_MAX_SUPPLY"); require(quantity <= MAX_PER_TX_PUBLIC, "EXCEEDS_MAX_MINT"); require(_totalClaimed[msg.sender] + _presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PUBLIC, "EXCEEDS_MAX_ALLOWANCE"); require(PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); for (uint256 i = 0; i < quantity; i++) { _totalClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); } } // Base URI Functions // ------------------------------------------------------------------------ function setContractURI(string calldata URI) external onlyOwner { _contractURI = URI; emit ContractURIChanged(URI); } function contractURI() public view returns (string memory) { return _contractURI; } function setBaseTokenURI(string calldata URI) external onlyOwner { _baseTokenURI = URI; emit BaseTokenURIChanged(URI); } function baseTokenURI() public view returns (string memory) { return _baseTokenURI; } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require(_exists(tokenId), "Cannot query non-existent token"); string memory uniqueId = string(abi.encodePacked(tokenId.toString(), ".json")); return string(abi.encodePacked(_baseTokenURI, uniqueId)); } //Withdrawal functions // ------------------------------------------------------------------------ function withdrawAll() external onlyTrustedParties(msg.sender) { uint _a1amount = address(this).balance * 26/100; uint _a2amount = address(this).balance * 15/100; uint _a3amount = address(this).balance * 15/100; uint _a4amount = address(this).balance * 10/100; uint _a5amount = address(this).balance * 7/100; uint _a6amount = address(this).balance * 7/100; uint _a7amount = address(this).balance * 5/100; uint _a8amount = address(this).balance * 5/100; uint _a9amount = address(this).balance * 5/100; uint _a10amount = address(this).balance * 5/100; require(payable(_a1).send(_a1amount), "FAILED_TO_SEND_TO_A1"); require(payable(_a2).send(_a2amount), "FAILED_TO_SEND_TO_A2"); require(payable(_a3).send(_a3amount), "FAILED_TO_SEND_TO_A3"); require(payable(_a4).send(_a4amount), "FAILED_TO_SEND_TO_A4"); require(payable(_a5).send(_a5amount), "FAILED_TO_SEND_TO_A5"); require(payable(_a6).send(_a6amount), "FAILED_TO_SEND_TO_A6"); require(payable(_a7).send(_a7amount), "FAILED_TO_SEND_TO_A7"); require(payable(_a8).send(_a8amount), "FAILED_TO_SEND_TO_A8"); require(payable(_a9).send(_a9amount), "FAILED_TO_SEND_TO_A9"); require(payable(_a10).send(_a10amount), "FAILED_TO_SEND_TO_A10"); } function emergencyWithdraw() external onlyTrustedParties(msg.sender) { payable(_a1).transfer(address(this).balance); } }
setContractURI
function setContractURI(string calldata URI) external onlyOwner { _contractURI = URI; emit ContractURIChanged(URI); }
// Base URI Functions // ------------------------------------------------------------------------
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://dbfc5f54ef450100d1eca69226ef749d32ee1627c4286935914b8ea9f9d1d655
{ "func_code_index": [ 7619, 7764 ] }
56,622
FabFourGear
contracts/FabFour.sol
0x42412d4f9007102d64cc6b56ed4439a6d31f4ad9
Solidity
FabFourGear
contract FabFourGear is ERC721Enumerable, Ownable{ using Strings for uint256; // Constant variables // ------------------------------------------------------------------------ uint256 public constant SUPPLY_HARD_CAP = 4444; // Total amount of FAB uint256 public constant PRESALE_SUPPLY = 444; // Total amount of FAB available for presale uint256 public constant MAX_CLAIM_PER_WALLET_PRESALE = 2; // Max each address can purchase during presale uint256 public constant MAX_CLAIM_PER_WALLET_PUBLIC = 4; // Max amount of FAB per wallet during public sale. uint256 public constant MAX_PER_TX_PRESALE = 2; // Max amount of FAB per tx presale uint256 public constant MAX_PER_TX_PUBLIC = 4; // Max amount of FAB per tx public sale uint256 public constant PRESALE_PRICE = .02 ether; uint256 public constant PRICE = 0.04 ether; //Variable variables // ------------------------------------------------------------------------ uint256 public reservedSupply = 125; // Amount of FAB reserved for the team and fans uint256 public presaleMinted = 0; // Team addresses // ------------------------------------------------------------------------ address private constant _a1 = 0x9D11BD2eca5f42eE8bed9db5D11f66cffB868927; address private constant _a2 = 0x62A10BF70c9eA5c5350A1a0016C273875DD44263; address private constant _a3 = 0x1346e5B390AD61C4Bb7B1d58b53157f95B3Ee893; address private constant _a4 = 0x52Ea2a1A5FC76cEc50F5616C263F49292102Af64; address private constant _a5 = 0xce550745Cfd4F4C85338908670CD6311F7dAb44a; address private constant _a6 = 0x4dbDa0BC6C9acf197333847b4d6C052a179b4F24; address private constant _a7 = 0xDB2214Ed07d122f11c4d1b89cD002F1f6eA79e4c; address private constant _a8 = 0x73FF3b28216C3bea994787A845b202fAC40c92cE; address private constant _a9 = 0xFb77701BA36363b750d628bDFbE8C1259aFa95cb; address private constant _a10 = 0x8c39F90513B43A21418513eA484d7CBd8261421b; // State variables // ------------------------------------------------------------------------ bool public isPresaleActive = false; bool public isPublicSaleActive = false; // Mappings // ------------------------------------------------------------------------ mapping(address => uint256) private _presaleClaimed; mapping(address => uint256) private _totalClaimed; mapping(address => bool) private _trustedParties; // URI variables // ------------------------------------------------------------------------ string private _contractURI; string private _baseTokenURI; // Events // ------------------------------------------------------------------------ event BaseTokenURIChanged(string baseTokenURI); event ContractURIChanged(string contractURI); // Constructor // ------------------------------------------------------------------------ constructor( string memory _initBaseURI, string memory _initContractURI ) ERC721("Fab Four Gear Genesis VIP Pass", "FAB") { _contractURI = _initContractURI; _baseTokenURI = _initBaseURI; } // Modifiers // ------------------------------------------------------------------------ modifier onlyPresale() { require(isPresaleActive, "PRESALE_NOT_ACTIVE"); _; } modifier onlyPublicSale() { require(isPublicSaleActive, "PUBLIC_SALE_NOT_ACTIVE"); _; } modifier onlyTrustedParties(address addr) { require(_trustedParties[addr], "NOT_A_TRUSTED_PARTY"); _; } // Permissions functions // ------------------------------------------------------------------------ function addToTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(!_trustedParties[addresses[i]], "DUPLICATE_ENTRY"); _trustedParties[addresses[i]] = true; } } function removeFromTrustedParties(address[] calldata addresses) external onlyOwner { for(uint256 i = 0; i < addresses.length; i++) { require(addresses[i] != address(0), "NULL_ADDRESS"); require(_trustedParties[addresses[i]], "NOT_IN_PRESALE"); _trustedParties[addresses[i]] = false; } } // Presale functions // ------------------------------------------------------------------------ function hasClaimedPresale(address addr) external view returns (bool) { require(addr != address(0), "NULL_ADDRESS"); return _presaleClaimed[addr] == MAX_CLAIM_PER_WALLET_PRESALE; } function togglePresaleStatus() external onlyOwner { isPresaleActive = !isPresaleActive; } function togglePublicSaleStatus() external onlyOwner { isPublicSaleActive = !isPublicSaleActive; } // Mint functions // ------------------------------------------------------------------------ function claimReserveNFTs(uint256 quantity, address addr) external onlyOwner { require(totalSupply() < SUPPLY_HARD_CAP, "SOLD_OUT"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP, "EXCEEDS_TOTAL_SUPPLY"); require(quantity <= reservedSupply, "NO_MORE_RESERVED_TOKENS_AVAILABLE"); require(quantity > 0, "MUST_MINT_AT_LEAST_ONE_TOKEN"); for (uint256 i = 0; i < quantity; i++) { _safeMint(addr, totalSupply() + 1); reservedSupply -= 1; } } function claimPresaleNFTs(uint256 quantity) external payable onlyPresale { require(_presaleClaimed[msg.sender] < MAX_CLAIM_PER_WALLET_PRESALE, "ALREADY_CLAIMED"); require(_presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PRESALE, "EXCEEDS_ALLOCATION"); require(presaleMinted < PRESALE_SUPPLY, "PRESALE_SOLD_OUT"); require(presaleMinted + quantity <= PRESALE_SUPPLY, "EXCEEDS_PRESALE_SUPPLY"); require(PRESALE_PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(quantity <= MAX_PER_TX_PRESALE, "EXCEEDS_MAX_MINT"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); for (uint256 i = 0; i < quantity; i++) { _presaleClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); presaleMinted += 1; } } function mint(uint256 quantity) external payable onlyPublicSale { require(tx.origin == msg.sender, "GO_AWAY_BOT_ORIGIN"); require(totalSupply() < SUPPLY_HARD_CAP - reservedSupply, "SOLD_OUT"); require(quantity > 0, "QUANTITY_CANNOT_BE_ZERO"); require(totalSupply() + quantity <= SUPPLY_HARD_CAP - reservedSupply, "EXCEEDS_MAX_SUPPLY"); require(quantity <= MAX_PER_TX_PUBLIC, "EXCEEDS_MAX_MINT"); require(_totalClaimed[msg.sender] + _presaleClaimed[msg.sender] + quantity <= MAX_CLAIM_PER_WALLET_PUBLIC, "EXCEEDS_MAX_ALLOWANCE"); require(PRICE * quantity == msg.value, "INVALID_ETH_AMOUNT"); for (uint256 i = 0; i < quantity; i++) { _totalClaimed[msg.sender] += 1; _safeMint(msg.sender, totalSupply() + 1); } } // Base URI Functions // ------------------------------------------------------------------------ function setContractURI(string calldata URI) external onlyOwner { _contractURI = URI; emit ContractURIChanged(URI); } function contractURI() public view returns (string memory) { return _contractURI; } function setBaseTokenURI(string calldata URI) external onlyOwner { _baseTokenURI = URI; emit BaseTokenURIChanged(URI); } function baseTokenURI() public view returns (string memory) { return _baseTokenURI; } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require(_exists(tokenId), "Cannot query non-existent token"); string memory uniqueId = string(abi.encodePacked(tokenId.toString(), ".json")); return string(abi.encodePacked(_baseTokenURI, uniqueId)); } //Withdrawal functions // ------------------------------------------------------------------------ function withdrawAll() external onlyTrustedParties(msg.sender) { uint _a1amount = address(this).balance * 26/100; uint _a2amount = address(this).balance * 15/100; uint _a3amount = address(this).balance * 15/100; uint _a4amount = address(this).balance * 10/100; uint _a5amount = address(this).balance * 7/100; uint _a6amount = address(this).balance * 7/100; uint _a7amount = address(this).balance * 5/100; uint _a8amount = address(this).balance * 5/100; uint _a9amount = address(this).balance * 5/100; uint _a10amount = address(this).balance * 5/100; require(payable(_a1).send(_a1amount), "FAILED_TO_SEND_TO_A1"); require(payable(_a2).send(_a2amount), "FAILED_TO_SEND_TO_A2"); require(payable(_a3).send(_a3amount), "FAILED_TO_SEND_TO_A3"); require(payable(_a4).send(_a4amount), "FAILED_TO_SEND_TO_A4"); require(payable(_a5).send(_a5amount), "FAILED_TO_SEND_TO_A5"); require(payable(_a6).send(_a6amount), "FAILED_TO_SEND_TO_A6"); require(payable(_a7).send(_a7amount), "FAILED_TO_SEND_TO_A7"); require(payable(_a8).send(_a8amount), "FAILED_TO_SEND_TO_A8"); require(payable(_a9).send(_a9amount), "FAILED_TO_SEND_TO_A9"); require(payable(_a10).send(_a10amount), "FAILED_TO_SEND_TO_A10"); } function emergencyWithdraw() external onlyTrustedParties(msg.sender) { payable(_a1).transfer(address(this).balance); } }
withdrawAll
function withdrawAll() external onlyTrustedParties(msg.sender) { uint _a1amount = address(this).balance * 26/100; uint _a2amount = address(this).balance * 15/100; uint _a3amount = address(this).balance * 15/100; uint _a4amount = address(this).balance * 10/100; uint _a5amount = address(this).balance * 7/100; uint _a6amount = address(this).balance * 7/100; uint _a7amount = address(this).balance * 5/100; uint _a8amount = address(this).balance * 5/100; uint _a9amount = address(this).balance * 5/100; uint _a10amount = address(this).balance * 5/100; require(payable(_a1).send(_a1amount), "FAILED_TO_SEND_TO_A1"); require(payable(_a2).send(_a2amount), "FAILED_TO_SEND_TO_A2"); require(payable(_a3).send(_a3amount), "FAILED_TO_SEND_TO_A3"); require(payable(_a4).send(_a4amount), "FAILED_TO_SEND_TO_A4"); require(payable(_a5).send(_a5amount), "FAILED_TO_SEND_TO_A5"); require(payable(_a6).send(_a6amount), "FAILED_TO_SEND_TO_A6"); require(payable(_a7).send(_a7amount), "FAILED_TO_SEND_TO_A7"); require(payable(_a8).send(_a8amount), "FAILED_TO_SEND_TO_A8"); require(payable(_a9).send(_a9amount), "FAILED_TO_SEND_TO_A9"); require(payable(_a10).send(_a10amount), "FAILED_TO_SEND_TO_A10"); }
//Withdrawal functions // ------------------------------------------------------------------------
LineComment
v0.8.7+commit.e28d00a7
MIT
ipfs://dbfc5f54ef450100d1eca69226ef749d32ee1627c4286935914b8ea9f9d1d655
{ "func_code_index": [ 8582, 9964 ] }
56,623
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
redeem
function redeem(uint256 _amount) external returns (uint256 massetReturned);
// DEPRECATED but still backwards compatible
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 82, 162 ] }
56,624
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
depositInterest
function depositInterest(uint256 _amount) external; // V1 & V2
// V1 & V2 (use balanceOf) // --------------------------------------------
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 320, 387 ] }
56,625
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
depositSavings
function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2
// V1 & V2
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 390, 488 ] }
56,626
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
depositSavings
function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2
// V1 & V2
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 491, 624 ] }
56,627
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
redeemCredits
function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2
// V2
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 627, 724 ] }
56,628
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
redeemUnderlying
function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2
// V2
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 727, 822 ] }
56,629
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
exchangeRate
function exchangeRate() external view returns (uint256); // V1 & V2
// V2
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 825, 897 ] }
56,630
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
balanceOfUnderlying
function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2
// V1 & V2
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 900, 995 ] }
56,631
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
underlyingToCredits
function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2
// V2
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 998, 1099 ] }
56,632
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
ISavingsContractV2
interface ISavingsContractV2 { // DEPRECATED but still backwards compatible function redeem(uint256 _amount) external returns (uint256 massetReturned); function creditBalances(address) external view returns (uint256); // V1 & V2 (use balanceOf) // -------------------------------------------- function depositInterest(uint256 _amount) external; // V1 & V2 function depositSavings(uint256 _amount) external returns (uint256 creditsIssued); // V1 & V2 function depositSavings(uint256 _amount, address _beneficiary) external returns (uint256 creditsIssued); // V2 function redeemCredits(uint256 _amount) external returns (uint256 underlyingReturned); // V2 function redeemUnderlying(uint256 _amount) external returns (uint256 creditsBurned); // V2 function exchangeRate() external view returns (uint256); // V1 & V2 function balanceOfUnderlying(address _user) external view returns (uint256 balance); // V2 function underlyingToCredits(uint256 _credits) external view returns (uint256 underlying); // V2 function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2 }
creditsToUnderlying
function creditsToUnderlying(uint256 _underlying) external view returns (uint256 credits); // V2
// V2
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 1102, 1203 ] }
56,633
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IMasset
abstract contract IMasset { // Mint function mint( address _input, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function mintMulti( address[] calldata _inputs, uint256[] calldata _inputQuantities, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function getMintOutput(address _input, uint256 _inputQuantity) external view virtual returns (uint256 mintOutput); function getMintMultiOutput(address[] calldata _inputs, uint256[] calldata _inputQuantities) external view virtual returns (uint256 mintOutput); // Swaps function swap( address _input, address _output, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 swapOutput); function getSwapOutput( address _input, address _output, uint256 _inputQuantity ) external view virtual returns (uint256 swapOutput); // Redemption function redeem( address _output, uint256 _mAssetQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 outputQuantity); function redeemMasset( uint256 _mAssetQuantity, uint256[] calldata _minOutputQuantities, address _recipient ) external virtual returns (uint256[] memory outputQuantities); function redeemExactBassets( address[] calldata _outputs, uint256[] calldata _outputQuantities, uint256 _maxMassetQuantity, address _recipient ) external virtual returns (uint256 mAssetRedeemed); function getRedeemOutput(address _output, uint256 _mAssetQuantity) external view virtual returns (uint256 bAssetOutput); function getRedeemExactBassetsOutput( address[] calldata _outputs, uint256[] calldata _outputQuantities ) external view virtual returns (uint256 mAssetAmount); // Views function getBasket() external view virtual returns (bool, bool); function getBasset(address _token) external view virtual returns (BassetPersonal memory personal, BassetData memory data); function getBassets() external view virtual returns (BassetPersonal[] memory personal, BassetData[] memory data); function bAssetIndexes(address) external view virtual returns (uint8); // SavingsManager function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply); function collectPlatformInterest() external virtual returns (uint256 mintAmount, uint256 newSupply); // Admin function setCacheSize(uint256 _cacheSize) external virtual; function upgradeForgeValidator(address _newForgeValidator) external virtual; function setFees(uint256 _swapFee, uint256 _redemptionFee) external virtual; function setTransferFeesFlag(address _bAsset, bool _flag) external virtual; function migrateBassets(address[] calldata _bAssets, address _newIntegration) external virtual; }
mint
function mint( address _input, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput);
// Mint
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 42, 238 ] }
56,634
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IMasset
abstract contract IMasset { // Mint function mint( address _input, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function mintMulti( address[] calldata _inputs, uint256[] calldata _inputQuantities, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function getMintOutput(address _input, uint256 _inputQuantity) external view virtual returns (uint256 mintOutput); function getMintMultiOutput(address[] calldata _inputs, uint256[] calldata _inputQuantities) external view virtual returns (uint256 mintOutput); // Swaps function swap( address _input, address _output, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 swapOutput); function getSwapOutput( address _input, address _output, uint256 _inputQuantity ) external view virtual returns (uint256 swapOutput); // Redemption function redeem( address _output, uint256 _mAssetQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 outputQuantity); function redeemMasset( uint256 _mAssetQuantity, uint256[] calldata _minOutputQuantities, address _recipient ) external virtual returns (uint256[] memory outputQuantities); function redeemExactBassets( address[] calldata _outputs, uint256[] calldata _outputQuantities, uint256 _maxMassetQuantity, address _recipient ) external virtual returns (uint256 mAssetRedeemed); function getRedeemOutput(address _output, uint256 _mAssetQuantity) external view virtual returns (uint256 bAssetOutput); function getRedeemExactBassetsOutput( address[] calldata _outputs, uint256[] calldata _outputQuantities ) external view virtual returns (uint256 mAssetAmount); // Views function getBasket() external view virtual returns (bool, bool); function getBasset(address _token) external view virtual returns (BassetPersonal memory personal, BassetData memory data); function getBassets() external view virtual returns (BassetPersonal[] memory personal, BassetData[] memory data); function bAssetIndexes(address) external view virtual returns (uint8); // SavingsManager function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply); function collectPlatformInterest() external virtual returns (uint256 mintAmount, uint256 newSupply); // Admin function setCacheSize(uint256 _cacheSize) external virtual; function upgradeForgeValidator(address _newForgeValidator) external virtual; function setFees(uint256 _swapFee, uint256 _redemptionFee) external virtual; function setTransferFeesFlag(address _bAsset, bool _flag) external virtual; function migrateBassets(address[] calldata _bAssets, address _newIntegration) external virtual; }
swap
function swap( address _input, address _output, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 swapOutput);
// Swaps
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 830, 1052 ] }
56,635
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IMasset
abstract contract IMasset { // Mint function mint( address _input, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function mintMulti( address[] calldata _inputs, uint256[] calldata _inputQuantities, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function getMintOutput(address _input, uint256 _inputQuantity) external view virtual returns (uint256 mintOutput); function getMintMultiOutput(address[] calldata _inputs, uint256[] calldata _inputQuantities) external view virtual returns (uint256 mintOutput); // Swaps function swap( address _input, address _output, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 swapOutput); function getSwapOutput( address _input, address _output, uint256 _inputQuantity ) external view virtual returns (uint256 swapOutput); // Redemption function redeem( address _output, uint256 _mAssetQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 outputQuantity); function redeemMasset( uint256 _mAssetQuantity, uint256[] calldata _minOutputQuantities, address _recipient ) external virtual returns (uint256[] memory outputQuantities); function redeemExactBassets( address[] calldata _outputs, uint256[] calldata _outputQuantities, uint256 _maxMassetQuantity, address _recipient ) external virtual returns (uint256 mAssetRedeemed); function getRedeemOutput(address _output, uint256 _mAssetQuantity) external view virtual returns (uint256 bAssetOutput); function getRedeemExactBassetsOutput( address[] calldata _outputs, uint256[] calldata _outputQuantities ) external view virtual returns (uint256 mAssetAmount); // Views function getBasket() external view virtual returns (bool, bool); function getBasset(address _token) external view virtual returns (BassetPersonal memory personal, BassetData memory data); function getBassets() external view virtual returns (BassetPersonal[] memory personal, BassetData[] memory data); function bAssetIndexes(address) external view virtual returns (uint8); // SavingsManager function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply); function collectPlatformInterest() external virtual returns (uint256 mintAmount, uint256 newSupply); // Admin function setCacheSize(uint256 _cacheSize) external virtual; function upgradeForgeValidator(address _newForgeValidator) external virtual; function setFees(uint256 _swapFee, uint256 _redemptionFee) external virtual; function setTransferFeesFlag(address _bAsset, bool _flag) external virtual; function migrateBassets(address[] calldata _bAssets, address _newIntegration) external virtual; }
redeem
function redeem( address _output, uint256 _mAssetQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 outputQuantity);
// Redemption
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 1247, 1451 ] }
56,636
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IMasset
abstract contract IMasset { // Mint function mint( address _input, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function mintMulti( address[] calldata _inputs, uint256[] calldata _inputQuantities, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function getMintOutput(address _input, uint256 _inputQuantity) external view virtual returns (uint256 mintOutput); function getMintMultiOutput(address[] calldata _inputs, uint256[] calldata _inputQuantities) external view virtual returns (uint256 mintOutput); // Swaps function swap( address _input, address _output, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 swapOutput); function getSwapOutput( address _input, address _output, uint256 _inputQuantity ) external view virtual returns (uint256 swapOutput); // Redemption function redeem( address _output, uint256 _mAssetQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 outputQuantity); function redeemMasset( uint256 _mAssetQuantity, uint256[] calldata _minOutputQuantities, address _recipient ) external virtual returns (uint256[] memory outputQuantities); function redeemExactBassets( address[] calldata _outputs, uint256[] calldata _outputQuantities, uint256 _maxMassetQuantity, address _recipient ) external virtual returns (uint256 mAssetRedeemed); function getRedeemOutput(address _output, uint256 _mAssetQuantity) external view virtual returns (uint256 bAssetOutput); function getRedeemExactBassetsOutput( address[] calldata _outputs, uint256[] calldata _outputQuantities ) external view virtual returns (uint256 mAssetAmount); // Views function getBasket() external view virtual returns (bool, bool); function getBasset(address _token) external view virtual returns (BassetPersonal memory personal, BassetData memory data); function getBassets() external view virtual returns (BassetPersonal[] memory personal, BassetData[] memory data); function bAssetIndexes(address) external view virtual returns (uint8); // SavingsManager function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply); function collectPlatformInterest() external virtual returns (uint256 mintAmount, uint256 newSupply); // Admin function setCacheSize(uint256 _cacheSize) external virtual; function upgradeForgeValidator(address _newForgeValidator) external virtual; function setFees(uint256 _swapFee, uint256 _redemptionFee) external virtual; function setTransferFeesFlag(address _bAsset, bool _flag) external virtual; function migrateBassets(address[] calldata _bAssets, address _newIntegration) external virtual; }
getBasket
function getBasket() external view virtual returns (bool, bool);
// Views
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 2277, 2346 ] }
56,637
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IMasset
abstract contract IMasset { // Mint function mint( address _input, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function mintMulti( address[] calldata _inputs, uint256[] calldata _inputQuantities, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function getMintOutput(address _input, uint256 _inputQuantity) external view virtual returns (uint256 mintOutput); function getMintMultiOutput(address[] calldata _inputs, uint256[] calldata _inputQuantities) external view virtual returns (uint256 mintOutput); // Swaps function swap( address _input, address _output, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 swapOutput); function getSwapOutput( address _input, address _output, uint256 _inputQuantity ) external view virtual returns (uint256 swapOutput); // Redemption function redeem( address _output, uint256 _mAssetQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 outputQuantity); function redeemMasset( uint256 _mAssetQuantity, uint256[] calldata _minOutputQuantities, address _recipient ) external virtual returns (uint256[] memory outputQuantities); function redeemExactBassets( address[] calldata _outputs, uint256[] calldata _outputQuantities, uint256 _maxMassetQuantity, address _recipient ) external virtual returns (uint256 mAssetRedeemed); function getRedeemOutput(address _output, uint256 _mAssetQuantity) external view virtual returns (uint256 bAssetOutput); function getRedeemExactBassetsOutput( address[] calldata _outputs, uint256[] calldata _outputQuantities ) external view virtual returns (uint256 mAssetAmount); // Views function getBasket() external view virtual returns (bool, bool); function getBasset(address _token) external view virtual returns (BassetPersonal memory personal, BassetData memory data); function getBassets() external view virtual returns (BassetPersonal[] memory personal, BassetData[] memory data); function bAssetIndexes(address) external view virtual returns (uint8); // SavingsManager function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply); function collectPlatformInterest() external virtual returns (uint256 mintAmount, uint256 newSupply); // Admin function setCacheSize(uint256 _cacheSize) external virtual; function upgradeForgeValidator(address _newForgeValidator) external virtual; function setFees(uint256 _swapFee, uint256 _redemptionFee) external virtual; function setTransferFeesFlag(address _bAsset, bool _flag) external virtual; function migrateBassets(address[] calldata _bAssets, address _newIntegration) external virtual; }
collectInterest
function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply);
// SavingsManager
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 2773, 2874 ] }
56,638
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IMasset
abstract contract IMasset { // Mint function mint( address _input, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function mintMulti( address[] calldata _inputs, uint256[] calldata _inputQuantities, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 mintOutput); function getMintOutput(address _input, uint256 _inputQuantity) external view virtual returns (uint256 mintOutput); function getMintMultiOutput(address[] calldata _inputs, uint256[] calldata _inputQuantities) external view virtual returns (uint256 mintOutput); // Swaps function swap( address _input, address _output, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 swapOutput); function getSwapOutput( address _input, address _output, uint256 _inputQuantity ) external view virtual returns (uint256 swapOutput); // Redemption function redeem( address _output, uint256 _mAssetQuantity, uint256 _minOutputQuantity, address _recipient ) external virtual returns (uint256 outputQuantity); function redeemMasset( uint256 _mAssetQuantity, uint256[] calldata _minOutputQuantities, address _recipient ) external virtual returns (uint256[] memory outputQuantities); function redeemExactBassets( address[] calldata _outputs, uint256[] calldata _outputQuantities, uint256 _maxMassetQuantity, address _recipient ) external virtual returns (uint256 mAssetRedeemed); function getRedeemOutput(address _output, uint256 _mAssetQuantity) external view virtual returns (uint256 bAssetOutput); function getRedeemExactBassetsOutput( address[] calldata _outputs, uint256[] calldata _outputQuantities ) external view virtual returns (uint256 mAssetAmount); // Views function getBasket() external view virtual returns (bool, bool); function getBasset(address _token) external view virtual returns (BassetPersonal memory personal, BassetData memory data); function getBassets() external view virtual returns (BassetPersonal[] memory personal, BassetData[] memory data); function bAssetIndexes(address) external view virtual returns (uint8); // SavingsManager function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply); function collectPlatformInterest() external virtual returns (uint256 mintAmount, uint256 newSupply); // Admin function setCacheSize(uint256 _cacheSize) external virtual; function upgradeForgeValidator(address _newForgeValidator) external virtual; function setFees(uint256 _swapFee, uint256 _redemptionFee) external virtual; function setTransferFeesFlag(address _bAsset, bool _flag) external virtual; function migrateBassets(address[] calldata _bAssets, address _newIntegration) external virtual; }
setCacheSize
function setCacheSize(uint256 _cacheSize) external virtual;
// Admin
LineComment
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 3026, 3090 ] }
56,639
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @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); }
totalSupply
function totalSupply() external view returns (uint256);
/** * @dev Returns the amount of tokens in existence. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 94, 154 ] }
56,640
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @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); }
balanceOf
function balanceOf(address account) external view returns (uint256);
/** * @dev Returns the amount of tokens owned by `account`. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 237, 310 ] }
56,641
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @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); }
transfer
function transfer(address recipient, uint256 amount) external returns (bool);
/** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 534, 616 ] }
56,642
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @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); }
allowance
function allowance(address owner, address spender) external view returns (uint256);
/** * @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. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 895, 983 ] }
56,643
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @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); }
approve
function approve(address spender, uint256 amount) external returns (bool);
/** * @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. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 1647, 1726 ] }
56,644
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
IERC20
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @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); }
transferFrom
function transferFrom(address sender, address recipient, 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. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 2039, 2141 ] }
56,645
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
isContract
function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; }
/** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 606, 1033 ] }
56,646
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
sendValue
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); }
/** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 1963, 2365 ] }
56,647
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
/** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 3121, 3299 ] }
56,648
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 3524, 3724 ] }
56,649
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 4094, 4325 ] }
56,650
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); }
/** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 4576, 5111 ] }
56,651
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionStaticCall
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 5291, 5495 ] }
56,652
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionStaticCall
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 5682, 6109 ] }
56,653
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionDelegateCall
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 6291, 6496 ] }
56,654
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionDelegateCall
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 6685, 7113 ] }
56,655
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
SafeERC20
library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @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 { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @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 { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
safeApprove
function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); }
/** * @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. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 714, 1341 ] }
56,656
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
SafeERC20
library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @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 { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @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 { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
_callOptionalReturn
function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } }
/** * @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). */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 2489, 3255 ] }
56,657
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Ownable
abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
owner
function owner() public view virtual returns (address) { return _owner; }
/** * @dev Returns the address of the current owner. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 497, 589 ] }
56,658
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Ownable
abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
renounceOwnership
function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
/** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 1148, 1301 ] }
56,659
SaveWrapper
SaveWrapper.sol
0xd082363752d08c54ab47c248fd5a11f8ee634bb9
Solidity
Ownable
abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
transferOwnership
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
/** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */
NatSpecMultiLine
v0.8.2+commit.661d1103
MIT
ipfs://41f8902acf27ffe8ff89ce6a7ba9aa9a5d6e95217982e5456b7a917e0bf3b42a
{ "func_code_index": [ 1451, 1700 ] }
56,660