Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
36
// Returns success if address is in investor WL or liquidity WL is not active
function isLiquidityAddressActive(address _addr) external view returns (bool);
function isLiquidityAddressActive(address _addr) external view returns (bool);
28,544
261
// Check that the sender can mint
if (msg.sender != owner()) { require(_maxSupply >= totalSupply() + _mintAmount, string(abi.encodePacked('Minting would exceed total supply!'))); require(_projectPhase.current() == _mintPhase, string(abi.encodePacked('Minting is disabled for this phase, ', Strings.toString(_mintPhase)))); uint256 ownerMintedCount = addressMintedBalance[msg.sender]; require(ownerMintedCount + _mintAmount <= nftPerAddressLimit, 'Max NFT per address exceeded'); require(msg.value >= _cost * _mintAmount, string(abi.encodePacked('This mint costs ', Strings.toString(_cost / 1e18), ' ether per token.'))); }
if (msg.sender != owner()) { require(_maxSupply >= totalSupply() + _mintAmount, string(abi.encodePacked('Minting would exceed total supply!'))); require(_projectPhase.current() == _mintPhase, string(abi.encodePacked('Minting is disabled for this phase, ', Strings.toString(_mintPhase)))); uint256 ownerMintedCount = addressMintedBalance[msg.sender]; require(ownerMintedCount + _mintAmount <= nftPerAddressLimit, 'Max NFT per address exceeded'); require(msg.value >= _cost * _mintAmount, string(abi.encodePacked('This mint costs ', Strings.toString(_cost / 1e18), ' ether per token.'))); }
59,538
10
// unwrap wrapped native tokens and transfer the native tokens from this contract to a receivertoken the token to transferamount the amount to transferreceiver the address to transfer to
function _transferOutNativeToken( address token, address receiver, uint256 amount
function _transferOutNativeToken( address token, address receiver, uint256 amount
30,705
71
// not allow to bid when activity is paused
require(!isPause);
require(!isPause);
23,966
1
// Public functions //@inheritdoc IERC725Y /
function getData(bytes32[] memory keys) public view virtual override returns (bytes[] memory values)
function getData(bytes32[] memory keys) public view virtual override returns (bytes[] memory values)
30,809
15
// Decrement ownership of Set token in the vault
state.vaultInstance.decrementTokenOwner( _set, msg.sender, _quantity ); redeemInternal( state.vault, msg.sender, _set,
state.vaultInstance.decrementTokenOwner( _set, msg.sender, _quantity ); redeemInternal( state.vault, msg.sender, _set,
13,035
226
// The recipient must not be empty. Better validation is possible, but would need to be customized for each destination ledger.
require(_to.length != 0, "Gateway: to address is empty");
require(_to.length != 0, "Gateway: to address is empty");
31,551
27
// Cancel an auction. Transfers the NFT back to the auction creator and emits an AuctionCanceled event /
function cancelAuction(uint256 auctionId) external override nonReentrant auctionExists(auctionId) { require( auctions[auctionId].tokenOwner == msg.sender || auctions[auctionId].curator == msg.sender, "Can only be called by auction creator or curator" ); require( uint256(auctions[auctionId].firstBidTime) == 0, "Can't cancel an auction once it's begun" ); _cancelAuction(auctionId); }
function cancelAuction(uint256 auctionId) external override nonReentrant auctionExists(auctionId) { require( auctions[auctionId].tokenOwner == msg.sender || auctions[auctionId].curator == msg.sender, "Can only be called by auction creator or curator" ); require( uint256(auctions[auctionId].firstBidTime) == 0, "Can't cancel an auction once it's begun" ); _cancelAuction(auctionId); }
2,158
16
// The amount of currency available to be lended. token The loan currency.return The amount of `token` that can be borrowed. /
function maxFlashLoan( address token ) external view returns (uint256);
function maxFlashLoan( address token ) external view returns (uint256);
57,602
99
// Get status of pending undelegate request for a given address _delegator - address of the delegator /
function getPendingUndelegateRequest(address _delegator) external view returns (address target, uint256 amount, uint256 lockupExpiryBlock)
function getPendingUndelegateRequest(address _delegator) external view returns (address target, uint256 amount, uint256 lockupExpiryBlock)
17,917
21
// Query if an address is an authorized operator for another address. owner The address that owns the records. operator The address that acts on behalf of the owner.return True if `operator` is an approved operator for `owner`, false otherwise. /
function isApprovedForAll(address owner, address operator) external view returns (bool) { return operators[owner][operator]; }
function isApprovedForAll(address owner, address operator) external view returns (bool) { return operators[owner][operator]; }
24,204
6
// At this moment staking is only possible from a certain address (usually a smart contract). This is because in almost all cases you want another contract to perform custom logic on lock and unlock operations,without allowing users to directly unlock their tokens and sell them, for example. /
function _lock(uint256 tokenId) internal virtual { require(!lockedTokens.get(tokenId), "ERC721/ALREADY_LOCKED"); lockedTokens.set(tokenId); }
function _lock(uint256 tokenId) internal virtual { require(!lockedTokens.get(tokenId), "ERC721/ALREADY_LOCKED"); lockedTokens.set(tokenId); }
34,504
260
// Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
* queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
333
58
// Deposit an amount of `token` represented in either `amount` or `share`./token_ The ERC-20 token to deposit./from which account to pull the tokens./to which account to push the tokens./amount Token amount in native representation to deposit./share Token amount represented in shares to deposit. Takes precedence over `amount`./ return amountOut The amount deposited./ return shareOut The deposited amount repesented in shares.
function deposit( address token_, address from, address to, uint256 amount, uint256 share ) external payable returns (uint256 amountOut, uint256 shareOut);
function deposit( address token_, address from, address to, uint256 amount, uint256 share ) external payable returns (uint256 amountOut, uint256 shareOut);
32,940
147
// `Info` keeps participation inforamtion of given tournament /
struct Info { address participant; // Owner address of participated memeNFT uint256 tokenId; // TokenId of participated memeNFT uint256 fee; // Fees paid in MCFT to parcipate }
struct Info { address participant; // Owner address of participated memeNFT uint256 tokenId; // TokenId of participated memeNFT uint256 fee; // Fees paid in MCFT to parcipate }
43,059
26
// to query of allowance of one user to the other
// @param _owner {address} of the owner of the account // @param _spender {address} of the spender of the account // @return remaining {uint} amount of remaining allowance function allowance(address _owner, address _spender) public view returns(uint remaining) { return allowed[_owner][_spender]; }
// @param _owner {address} of the owner of the account // @param _spender {address} of the spender of the account // @return remaining {uint} amount of remaining allowance function allowance(address _owner, address _spender) public view returns(uint remaining) { return allowed[_owner][_spender]; }
13,295
320
// Create a new instance of an app linked to this kernelCreate a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`_appId Identifier for app_appBase Address of the app's base implementation return AppProxy instance/
function newAppInstance(bytes32 _appId, address _appBase) public auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId)) returns (ERCProxy appProxy)
function newAppInstance(bytes32 _appId, address _appBase) public auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId)) returns (ERCProxy appProxy)
19,132
86
// Returns xy in precision
function mulInPrecision(uint256 x, uint256 y) internal pure returns (uint256) { return x.mul(y) / PRECISION; }
function mulInPrecision(uint256 x, uint256 y) internal pure returns (uint256) { return x.mul(y) / PRECISION; }
38,363
33
// Addresses of portals
address public poolPortalAddress; address public exchangePortalAddress; address public defiPortalAddress;
address public poolPortalAddress; address public exchangePortalAddress; address public defiPortalAddress;
12,665
15
// `StaticOrder` extension including variable-sized additional order meta information
struct Order { uint256 salt; address makerAsset; address takerAsset; address maker; address receiver; address allowedSender; // equals to Zero address on public orders uint256 makingAmount; uint256 takingAmount; bytes makerAssetData; bytes takerAssetData; bytes getMakerAmount; // this.staticcall(abi.encodePacked(bytes, swapTakerAmount)) => (swapMakerAmount) bytes getTakerAmount; // this.staticcall(abi.encodePacked(bytes, swapMakerAmount)) => (swapTakerAmount) bytes predicate; // this.staticcall(bytes) => (bool) bytes permit; // On first fill: permit.1.call(abi.encodePacked(permit.selector, permit.2)) bytes interaction; }
struct Order { uint256 salt; address makerAsset; address takerAsset; address maker; address receiver; address allowedSender; // equals to Zero address on public orders uint256 makingAmount; uint256 takingAmount; bytes makerAssetData; bytes takerAssetData; bytes getMakerAmount; // this.staticcall(abi.encodePacked(bytes, swapTakerAmount)) => (swapMakerAmount) bytes getTakerAmount; // this.staticcall(abi.encodePacked(bytes, swapMakerAmount)) => (swapTakerAmount) bytes predicate; // this.staticcall(bytes) => (bool) bytes permit; // On first fill: permit.1.call(abi.encodePacked(permit.selector, permit.2)) bytes interaction; }
18,662
15
// Returns the vesting schedule id at the given index. return the vesting id/
function getVestingIdAtIndex(uint256 index) external view
function getVestingIdAtIndex(uint256 index) external view
26,305
140
// Event emitted when interest is awarded to a winner
event Awarded(address indexed winner, ITicket indexed token, uint256 amount);
event Awarded(address indexed winner, ITicket indexed token, uint256 amount);
69,777
104
// called by the owner on end of emergency, returns to normal state
function unhalt() external onlyOwner onlyInEmergency { halted = false; }
function unhalt() external onlyOwner onlyInEmergency { halted = false; }
5,403
7
// Returns the amount contributed so far by a specific beneficiary. beneficiary Address of contributorreturn Beneficiary contribution so far /
function getContribution(address beneficiary) public view returns (uint256) { return _contributions[beneficiary]; }
function getContribution(address beneficiary) public view returns (uint256) { return _contributions[beneficiary]; }
34,844
355
// sig is to prove the address received as stated by the account
event Redeem(address indexed customer, uint256 tokenId, bytes32 sig);
event Redeem(address indexed customer, uint256 tokenId, bytes32 sig);
42,029
2
// New pools will check on deployment that the durations given are within the bounds specified by `TemporarilyPausable`. Since it is now possible for a factory to pass in arbitrary values here, pre-emptively verify that these durations are valid for pool creation. (Otherwise, you would be able to deploy a useless factory where `create` would always revert.)
_require( initialPauseWindowDuration <= PausableConstants.MAX_PAUSE_WINDOW_DURATION, Errors.MAX_PAUSE_WINDOW_DURATION ); _require( bufferPeriodDuration <= PausableConstants.MAX_BUFFER_PERIOD_DURATION, Errors.MAX_BUFFER_PERIOD_DURATION );
_require( initialPauseWindowDuration <= PausableConstants.MAX_PAUSE_WINDOW_DURATION, Errors.MAX_PAUSE_WINDOW_DURATION ); _require( bufferPeriodDuration <= PausableConstants.MAX_BUFFER_PERIOD_DURATION, Errors.MAX_BUFFER_PERIOD_DURATION );
18,935
189
// james foley http:github.com/realisation/view how much target amount a fixed origin amount will swap for/_origin the address of the origin/_target the address of the target/_originAmount the origin amount/ return targetAmount_ the target amount that would have been swapped for the origin amount
function viewOriginSwap ( address _origin, address _target, uint _originAmount ) external view transactable returns ( uint targetAmount_
function viewOriginSwap ( address _origin, address _target, uint _originAmount ) external view transactable returns ( uint targetAmount_
26,861
40
// Withdraws Ether in contract (Owner only)/ return Status of withdrawal
function withdraw() onlyOwner public
function withdraw() onlyOwner public
15,875
111
// Sets the initial price for the pool/Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value/sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
function initialize(uint160 sqrtPriceX96) external;
function initialize(uint160 sqrtPriceX96) external;
9,759
153
// Deletes price IDV address._id The price ID./
function deletePriceIdv(bytes32 _id) internal { // delete prices[_id].idv; delete addressStorage[keccak256(abi.encodePacked("prices.", _id, ".idv"))]; }
function deletePriceIdv(bytes32 _id) internal { // delete prices[_id].idv; delete addressStorage[keccak256(abi.encodePacked("prices.", _id, ".idv"))]; }
61,233
33
// Start the ICO period, is required the waitingForICO state of the contract
function startICO() public onlyOwner returns (bool success) { require(contract_state == State.waitingForICO); contract_state = State.ICO; NewState(contract_state); return true; }
function startICO() public onlyOwner returns (bool success) { require(contract_state == State.waitingForICO); contract_state = State.ICO; NewState(contract_state); return true; }
44,989
90
// ========== EXTERNAL MUTATIVE FUNCTIONS ========== // allow owner to mint _to mint token to address _amount amount of ALPA to mint /
function mint(address _to, uint256 _amount) external override onlyOwner { _mint(_to, _amount); }
function mint(address _to, uint256 _amount) external override onlyOwner { _mint(_to, _amount); }
19,925
8
// An item has been disowned. This cannot be undone. itemId itemId of the item. /
event Disown(bytes32 indexed itemId, address indexed owner);
event Disown(bytes32 indexed itemId, address indexed owner);
13,220
3
// level fire scale /10
function getFireScBylevel(uint level) public view returns(uint){ if(level == 1){ return 3; }if(level == 2){ return 6; }if(level == 3) { return 10; }return 0; }
function getFireScBylevel(uint level) public view returns(uint){ if(level == 1){ return 3; }if(level == 2){ return 6; }if(level == 3) { return 10; }return 0; }
16,991
24
// DSProxy Allows code execution using a persistant identity This can be very useful to execute a sequence of atomic actions. Since the owner of the proxy can be changed, this allows for dynamic ownership models i.e. a multisig
contract DSProxy is DSAuth, DSNote { DSProxyCache public cache; // global cache for contracts constructor(address _cacheAddr) public { setCache(_cacheAddr); } function() external payable { } // use the proxy to execute calldata _data on contract _code function execute(bytes memory _code, bytes memory _data) public payable returns (address target, bytes memory response) { target = cache.read(_code); if (target == address(0)) { // deploy contract & store its address in cache target = cache.write(_code); } response = execute(target, _data); } function execute(address _target, bytes memory _data) public auth note payable returns (bytes memory response) { require(_target != address(0), "ds-proxy-target-address-required"); // call contract in current context assembly { let succeeded := delegatecall(sub(gas, 5000), _target, add(_data, 0x20), mload(_data), 0, 0) let size := returndatasize response := mload(0x40) mstore(0x40, add(response, and(add(add(size, 0x20), 0x1f), not(0x1f)))) mstore(response, size) returndatacopy(add(response, 0x20), 0, size) switch iszero(succeeded) case 1 { // throw if delegatecall failed revert(add(response, 0x20), size) } } } //set new cache function setCache(address _cacheAddr) public auth note returns (bool) { require(_cacheAddr != address(0), "ds-proxy-cache-address-required"); cache = DSProxyCache(_cacheAddr); // overwrite cache return true; } }
contract DSProxy is DSAuth, DSNote { DSProxyCache public cache; // global cache for contracts constructor(address _cacheAddr) public { setCache(_cacheAddr); } function() external payable { } // use the proxy to execute calldata _data on contract _code function execute(bytes memory _code, bytes memory _data) public payable returns (address target, bytes memory response) { target = cache.read(_code); if (target == address(0)) { // deploy contract & store its address in cache target = cache.write(_code); } response = execute(target, _data); } function execute(address _target, bytes memory _data) public auth note payable returns (bytes memory response) { require(_target != address(0), "ds-proxy-target-address-required"); // call contract in current context assembly { let succeeded := delegatecall(sub(gas, 5000), _target, add(_data, 0x20), mload(_data), 0, 0) let size := returndatasize response := mload(0x40) mstore(0x40, add(response, and(add(add(size, 0x20), 0x1f), not(0x1f)))) mstore(response, size) returndatacopy(add(response, 0x20), 0, size) switch iszero(succeeded) case 1 { // throw if delegatecall failed revert(add(response, 0x20), size) } } } //set new cache function setCache(address _cacheAddr) public auth note returns (bool) { require(_cacheAddr != address(0), "ds-proxy-cache-address-required"); cache = DSProxyCache(_cacheAddr); // overwrite cache return true; } }
18,045
240
// Safely mints `tokenId` and transfers it to `to`. Requirements:- `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); }
421
187
// ============ State Variables ============ // ============ Modifier ============ //This modifier must be used in conjunction with timeLockUpgrade AND must be called beforetimeLockUpgrade is called. UpgradeAddress must also be part of the msg.data. /
modifier limitOneUpgrade(address _upgradeAddress) { if (block.timestamp > 0) { //injected CONTRACT AFFECTED BY MINERS // Get upgradeHash bytes32 upgradeHash = keccak256(msg.data); if (blockhash(block.number) != 0) { //injected CONTRACT AFFECTED BY MINERS // If upgrade hash has no record then revert since must be second upgrade require( upgradeIdentifier[_upgradeAddress] == upgradeHash, "Another update already in progress." ); upgradeIdentifier[_upgradeAddress] = 0; } else { upgradeIdentifier[_upgradeAddress] = upgradeHash; } } _; }
modifier limitOneUpgrade(address _upgradeAddress) { if (block.timestamp > 0) { //injected CONTRACT AFFECTED BY MINERS // Get upgradeHash bytes32 upgradeHash = keccak256(msg.data); if (blockhash(block.number) != 0) { //injected CONTRACT AFFECTED BY MINERS // If upgrade hash has no record then revert since must be second upgrade require( upgradeIdentifier[_upgradeAddress] == upgradeHash, "Another update already in progress." ); upgradeIdentifier[_upgradeAddress] = 0; } else { upgradeIdentifier[_upgradeAddress] = upgradeHash; } } _; }
44,719
122
// Allows contract owner to set base URI for specific collection. collectionId_ collection ID baseUri_ base URI /
function setCollectionBaseUri(uint256 collectionId_, string memory baseUri_) public onlyOwner
function setCollectionBaseUri(uint256 collectionId_, string memory baseUri_) public onlyOwner
34,434
4
// --------- STRUCTS --------------------
struct UserData { uint256 stake; uint256 liquidity; uint256 lastTimestamp; int256 RTRewardModifier; int256 NFTXRewardModifier; uint256 NFTXRewardWithdrawn; }
struct UserData { uint256 stake; uint256 liquidity; uint256 lastTimestamp; int256 RTRewardModifier; int256 NFTXRewardModifier; uint256 NFTXRewardWithdrawn; }
3,024
124
// bytes[] memory
)
)
21,911
54
// Has the contract got a balance?
uint256 currentBalance = erc677.balanceOf(this) - tokenBalance[token]; require(currentBalance > ethWei * distributionMinimum);
uint256 currentBalance = erc677.balanceOf(this) - tokenBalance[token]; require(currentBalance > ethWei * distributionMinimum);
43,151
5
// save tranformation level three information by token id
mapping(uint256 => TransformInfoLevelThree) public transformInfoLevelThreeByTokenId;
mapping(uint256 => TransformInfoLevelThree) public transformInfoLevelThreeByTokenId;
17,919
57
// auction off some vBTC
vBtc.approve(address(auctionFactory), vBtcAmount); currentAuction = IDutchAuction( auctionFactory.deployDutchAuction( address(vBtc), vBtcAmount, now, now + auctionDuration, address(strudel), imbalance.mul(ACCURACY.add(priceSpan)).div(ACCURACY), // startPrice imbalance.mul(ACCURACY.sub(priceSpan)).div(ACCURACY), // minPrice
vBtc.approve(address(auctionFactory), vBtcAmount); currentAuction = IDutchAuction( auctionFactory.deployDutchAuction( address(vBtc), vBtcAmount, now, now + auctionDuration, address(strudel), imbalance.mul(ACCURACY.add(priceSpan)).div(ACCURACY), // startPrice imbalance.mul(ACCURACY.sub(priceSpan)).div(ACCURACY), // minPrice
27,785
161
// edge case, should be impossible, but this is defi
totalVotes = 0;
totalVotes = 0;
52,227
18
// Same as getSourceAmount, but factors in the redemption feefor specific retirements._sourceToken The contract address of the token being supplied. _poolToken The contract address of the pool token being retired. _amount The amount being supplied. Expressed in either the total carbon to offset or the total source to spend. See _amountInCarbon. _amountInCarbon Bool indicating if _amount is in carbon or source.return Returns both the source amount and carbon amount as a result of swaps. /
function getSourceAmountSpecific( address _sourceToken, address _poolToken, uint256 _amount, bool _amountInCarbon
function getSourceAmountSpecific( address _sourceToken, address _poolToken, uint256 _amount, bool _amountInCarbon
14,313
51
// See {ERC1155Upgradeable._mint}. /
function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal override { super._mint(account, id, amount, data);
function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal override { super._mint(account, id, amount, data);
22,955
1
// @custom:salt StakingPositionDescriptor/ @custom:deploy-type deployUpgradeable
contract StakingPositionDescriptor is IStakingNFTDescriptor { function tokenURI(IStakingNFT _stakingNFT, uint256 tokenId) external view override returns (string memory) { ( uint256 shares, uint256 freeAfter, uint256 withdrawFreeAfter, uint256 accumulatorEth, uint256 accumulatorToken ) = _stakingNFT.getPosition(tokenId); return StakingDescriptor.constructTokenURI( StakingDescriptor.ConstructTokenURIParams({ tokenId: tokenId, shares: shares, freeAfter: freeAfter, withdrawFreeAfter: withdrawFreeAfter, accumulatorEth: accumulatorEth, accumulatorToken: accumulatorToken }) ); } }
contract StakingPositionDescriptor is IStakingNFTDescriptor { function tokenURI(IStakingNFT _stakingNFT, uint256 tokenId) external view override returns (string memory) { ( uint256 shares, uint256 freeAfter, uint256 withdrawFreeAfter, uint256 accumulatorEth, uint256 accumulatorToken ) = _stakingNFT.getPosition(tokenId); return StakingDescriptor.constructTokenURI( StakingDescriptor.ConstructTokenURIParams({ tokenId: tokenId, shares: shares, freeAfter: freeAfter, withdrawFreeAfter: withdrawFreeAfter, accumulatorEth: accumulatorEth, accumulatorToken: accumulatorToken }) ); } }
14,636
35
// Linkedlist of newly registered ungrouped nodes, with HEAD points to the earliest and pendingNodeTail points to the latest. Initial state: pendingNodeList[HEAD_A] == HEAD_A && pendingNodeTail == HEAD_A.
mapping(address => address) public pendingNodeList; address public pendingNodeTail; uint public numPendingNodes;
mapping(address => address) public pendingNodeList; address public pendingNodeTail; uint public numPendingNodes;
44,305
7
// Returns the number of unique item sales. 유니크 아이템 판매 횟수를 반환합니다.
function getUniqueItemSaleCount() external view returns (uint);
function getUniqueItemSaleCount() external view returns (uint);
2,732
66
// Remove stake from user's stakeIds array
uint256[] storage userStakeIds = users[msg.sender].stakeIds; for (uint256 i = 0; i < userStakeIds.length; i++) { if (userStakeIds[i] == stakeId) { userStakeIds[i] = userStakeIds[userStakeIds.length - 1]; userStakeIds.pop(); break; }
uint256[] storage userStakeIds = users[msg.sender].stakeIds; for (uint256 i = 0; i < userStakeIds.length; i++) { if (userStakeIds[i] == stakeId) { userStakeIds[i] = userStakeIds[userStakeIds.length - 1]; userStakeIds.pop(); break; }
25,392
44
// individual lock
if(isLocked == true && from != address(0)){ require(_getStakeInfo(startTokenId) == false,"this tokenId is locked"); }
if(isLocked == true && from != address(0)){ require(_getStakeInfo(startTokenId) == false,"this tokenId is locked"); }
26,178
13
// Check if the candidate ID is authorized
if (!authorizedCandidates[_candidateId]) { return false; }
if (!authorizedCandidates[_candidateId]) { return false; }
38,838
20
// Sets an Operator as Approved to Break Covalent Bonds on a specific Token/ This allows an operator to withdraw Basket NFTs/contractAddressThe Address to the Contract of the Token/tokenIdThe ID of the Token/operator The Address of the Operator to Approve
function setBreakBondApproval( address contractAddress, uint256 tokenId, address operator ) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender())
function setBreakBondApproval( address contractAddress, uint256 tokenId, address operator ) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender())
21,018
84
// get a handle for the corresponding cToken contract
CERC20 _cToken = CERC20(token);
CERC20 _cToken = CERC20(token);
11,968
107
// Extracts withdrawal data from the supplied parameters _partition Source partition of the withdrawal _value Number of tokens to be transferred _operatorData Contains the withdrawal authorization data, including the withdrawaloperation flag, supplier, maximum authorized account nonce, and Merkle proof.return supplier, the address whose account is authorizedreturn maxAuthorizedAccountNonce, the maximum existing used withdrawal nonce for thesupplier and partitionreturn withdrawalRootNonce, the active withdrawal root nonce found based on the supplieddata and Merkle proof /
function _getWithdrawalData( bytes32 _partition, uint256 _value, bytes memory _operatorData ) internal view returns ( address, /* supplier */ uint256, /* maxAuthorizedAccountNonce */
function _getWithdrawalData( bytes32 _partition, uint256 _value, bytes memory _operatorData ) internal view returns ( address, /* supplier */ uint256, /* maxAuthorizedAccountNonce */
9,175
0
// Initializes acBTCx contract. /
function initialize(IERC20Upgradeable _acBTC) public initializer { __ERC20_init("ACoconut Maker", "acBTCx"); __ReentrancyGuard_init(); acBTC = _acBTC; }
function initialize(IERC20Upgradeable _acBTC) public initializer { __ERC20_init("ACoconut Maker", "acBTCx"); __ReentrancyGuard_init(); acBTC = _acBTC; }
17,668
14
// Disconnects `msg.sender` from `pool`./This is used to disconnect a pool from the GDA./pool The pool address/ctx Context bytes (see ISuperfluidPoolAdmin for Context struct)/ return newCtx the new context bytes
function disconnectPool(ISuperfluidPool pool, bytes calldata ctx) external virtual returns (bytes memory newCtx);
function disconnectPool(ISuperfluidPool pool, bytes calldata ctx) external virtual returns (bytes memory newCtx);
4,375
83
// calculate the dividend between a time range start start of dividend phase end end of dividend phase USDPerSecondInRay dividend accrual ratereturn amount of USD accrued per second in 1e27 /
function calculatePhaseDividend(uint256 start, uint256 end, uint256 USDPerSecondInRay) public pure returns (uint256) { return end .sub(start, "Phase start end mismatch") .mul(USDPerSecondInRay); }
function calculatePhaseDividend(uint256 start, uint256 end, uint256 USDPerSecondInRay) public pure returns (uint256) { return end .sub(start, "Phase start end mismatch") .mul(USDPerSecondInRay); }
12,885
2
// inheritdoc IERC721Metadata /
function tokenURI(uint256 tokenId) public view virtual returns (string memory) { TokenMetadataStorage.Layout storage l = TokenMetadataStorage.layout(); string memory _tokenIdURI = l.tokenURIs[tokenId]; string memory _baseURI = l.baseURI; if (bytes(_tokenIdURI).length > 0) { return _tokenIdURI; } else if (bytes(l.fallbackURI).length > 0) { return l.fallbackURI; } else if (bytes(_baseURI).length > 0) { return string(abi.encodePacked(_baseURI, Strings.toString(tokenId), l.uriSuffix)); } else { return ""; } }
function tokenURI(uint256 tokenId) public view virtual returns (string memory) { TokenMetadataStorage.Layout storage l = TokenMetadataStorage.layout(); string memory _tokenIdURI = l.tokenURIs[tokenId]; string memory _baseURI = l.baseURI; if (bytes(_tokenIdURI).length > 0) { return _tokenIdURI; } else if (bytes(l.fallbackURI).length > 0) { return l.fallbackURI; } else if (bytes(_baseURI).length > 0) { return string(abi.encodePacked(_baseURI, Strings.toString(tokenId), l.uriSuffix)); } else { return ""; } }
31,370
47
// Returns how long a two-step ownership handover is valid for in seconds.
function ownershipHandoverValidFor() public view virtual returns (uint64) { return 48 * 3600; }
function ownershipHandoverValidFor() public view virtual returns (uint64) { return 48 * 3600; }
34,766
233
// pay out team
adminAddress.transfer(_com); return(_eventData_);
adminAddress.transfer(_com); return(_eventData_);
31,839
171
// public
function mint(address _to, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { if(whitelisted[msg.sender] != true) { require(msg.value >= cost * _mintAmount); } } for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(_to, supply + i); } }
function mint(address _to, uint256 _mintAmount) public payable { uint256 supply = totalSupply(); require(!paused); require(_mintAmount > 0); require(_mintAmount <= maxMintAmount); require(supply + _mintAmount <= maxSupply); if (msg.sender != owner()) { if(whitelisted[msg.sender] != true) { require(msg.value >= cost * _mintAmount); } } for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(_to, supply + i); } }
4,442
78
// Adds list of addresses to blacklist. Not overloaded due to limitations with truffle testing. _villains Addresses to be added to the blacklist /
function addManyToBlacklist(address[] _villains) external onlyOwner { for (uint256 i = 0; i < _villains.length; i++) { blacklist[_villains[i]] = true; } }
function addManyToBlacklist(address[] _villains) external onlyOwner { for (uint256 i = 0; i < _villains.length; i++) { blacklist[_villains[i]] = true; } }
50,544
82
// Get the order info for an NFT order./order The NFT order./ return orderInfo Info about the order.
function _getOrderInfo(LibNFTOrder.NFTOrder memory order) internal override view returns (LibNFTOrder.OrderInfo memory orderInfo)
function _getOrderInfo(LibNFTOrder.NFTOrder memory order) internal override view returns (LibNFTOrder.OrderInfo memory orderInfo)
29,400
9
// stored password is hashed
return keccak256(passcode) == passcode_actually;
return keccak256(passcode) == passcode_actually;
21,667
32
// calculate maximum amount of token repaid given USD input
function calculateRepayMax(address token) external view returns (uint) { return calculateRepayMaxOf(msg.sender, token); }
function calculateRepayMax(address token) external view returns (uint) { return calculateRepayMaxOf(msg.sender, token); }
53,665
12
// prevents duplicate deposit calls being made for the same bank transaction which would issue more tokens than what's held in the bank account
modifier duplcateDepositChecker(string bankTransactionId)
modifier duplcateDepositChecker(string bankTransactionId)
34,815
35
// Getters/ to get retired details by retiredAddress _retiredAddress is the address of the retired /
function getRetired( address _retiredAddress
function getRetired( address _retiredAddress
13,469
67
// create the position id
positionId = uint256(keccak256(abi.encode(uniqueOwner, request.setupIndex, block.number)));
positionId = uint256(keccak256(abi.encode(uniqueOwner, request.setupIndex, block.number)));
55,038
22
// solium-disable-next-line security/no-send
require(receiver.send(payment), "Could not pay gas costs with ether");
require(receiver.send(payment), "Could not pay gas costs with ether");
29,053
32
// function getInfo() public view
// returns (address sender, address admin) { // return (msg.sender, _admin()); // }
// returns (address sender, address admin) { // return (msg.sender, _admin()); // }
47,470
56
// All joins, exits and swaps are disabled (except recovery mode exits).
_ensureNotPaused();
_ensureNotPaused();
25,871
79
// onlyOwner function to change the price of calling the whack() function
function setPrice(uint256 _newPrice) public onlyOwner { price = _newPrice; }
function setPrice(uint256 _newPrice) public onlyOwner { price = _newPrice; }
1,289
3
// Percentage of the trading amount to be shared
mapping(bytes32 => uint256[]) private _pct;
mapping(bytes32 => uint256[]) private _pct;
4,398
52
// Set contract addressesdbAddress new database contract addressbnuStoreAddress new BNU contract addressbnfAddress new BNF contract address/
function setContracts(address dbAddress, address bnuStoreAddress, address bnfAddress) external onlyOwner contractActive{ _setDbContract(dbAddress); _setBNUStoreContract(bnuStoreAddress); _setBnfTokenContract(bnfAddress); }
function setContracts(address dbAddress, address bnuStoreAddress, address bnfAddress) external onlyOwner contractActive{ _setDbContract(dbAddress); _setBNUStoreContract(bnuStoreAddress); _setBnfTokenContract(bnfAddress); }
41,463
40
// address[] memory watchers = userContract.watchersAddresses;
address watcher1 = userContract.watchersAddresses(0); address watcher2 = userContract.watchersAddresses(1); for (uint256 i = 0; i < wassessments[watcher1].length; i++) { W1TotalAssessment += Assessments[wassessments[watcher1][i]].all; }
address watcher1 = userContract.watchersAddresses(0); address watcher2 = userContract.watchersAddresses(1); for (uint256 i = 0; i < wassessments[watcher1].length; i++) { W1TotalAssessment += Assessments[wassessments[watcher1][i]].all; }
12,746
75
// Transfer the tokens to the investor address._investorAddress The address of investor. /
function buyTokens(address _investorAddress) public payable returns(bool)
function buyTokens(address _investorAddress) public payable returns(bool)
43,114
20
// Burn specified number of DXG tokens _value The amount of tokens to be burned /
function burn(uint256 _value) onlyOwner public returns (bool)
function burn(uint256 _value) onlyOwner public returns (bool)
12,872
27
// @inheritdoc IFlowNFTBase
function getTokenId( address superToken, address sender, address receiver
function getTokenId( address superToken, address sender, address receiver
23,317
21
// don't be greedy - you can only get at most limit tokens
swapped_tokens = packed2.limit;
swapped_tokens = packed2.limit;
84,686
2
// Synchronously executes multiple calls of fillOrder until total amount of WETH has been sold by taker./Returns false if the transaction would otherwise revert./orders Array of order specifications./wethSellAmount Desired amount of WETH to sell./signatures Proofs that orders have been signed by makers./ return Amounts filled and fees paid by makers and taker.
function marketSellWeth( LibOrder.Order[] memory orders, uint256 wethSellAmount, bytes[] memory signatures ) internal returns (LibFillResults.FillResults memory totalFillResults);
function marketSellWeth( LibOrder.Order[] memory orders, uint256 wethSellAmount, bytes[] memory signatures ) internal returns (LibFillResults.FillResults memory totalFillResults);
10,519
26
// Read prizeStrategy variable /
function getPrizeStrategy() external view returns (address);
function getPrizeStrategy() external view returns (address);
24,707
9
// Sending to ZKitty
(bool successZKitty, ) = ZKitty.call{value: ZKittyAmount}("");
(bool successZKitty, ) = ZKitty.call{value: ZKittyAmount}("");
27,916
98
// An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
16,914
142
// return if minting is finished or not. /
function mintingFinished() external view returns (bool) { return _mintingFinished; }
function mintingFinished() external view returns (bool) { return _mintingFinished; }
2,177
25
// see Spigot.claimOwnerTokens /
function claimOwnerTokens(SpigotState storage self, address token) external returns (uint256 claimed) { if (msg.sender != self.owner) { revert CallerAccessDenied(); } claimed = self.ownerTokens[token]; if (claimed == 0) { revert ClaimFailed(); } self.ownerTokens[token] = 0; // reset before send to prevent reentrancy LineLib.sendOutTokenOrETH(token, self.owner, claimed); emit ClaimOwnerTokens(token, claimed, self.owner); return claimed; }
function claimOwnerTokens(SpigotState storage self, address token) external returns (uint256 claimed) { if (msg.sender != self.owner) { revert CallerAccessDenied(); } claimed = self.ownerTokens[token]; if (claimed == 0) { revert ClaimFailed(); } self.ownerTokens[token] = 0; // reset before send to prevent reentrancy LineLib.sendOutTokenOrETH(token, self.owner, claimed); emit ClaimOwnerTokens(token, claimed, self.owner); return claimed; }
29,624
26
// ChubbyHippos contract Extends ERC721 Non-Fungible Token Standard basic interface /
contract ChubbyHipposNFT is ERC721Upgradeable, OwnableUpgradeable { using SafeMath for uint256; using Strings for uint256; uint oneMintPrice; uint twoMintPrice; uint threeMintPrice; uint fourMintPrice; uint16 maxSupply; uint16 totalMinted; uint16 totalReserved; uint16 maxMintable; bool PAUSED; bool REVEALED; string baseExtension; string baseUri; string notRevealedUri; IWatermelonToken watermelonToken; function init() initializer public { __Ownable_init(); __ERC721_init("ChubbyHippos", "CHUBBY"); oneMintPrice = 0.08 ether; twoMintPrice = 0.14 ether; threeMintPrice = 0.18 ether; fourMintPrice = 0.2 ether; maxSupply = 4444; totalReserved = 144; PAUSED = false; REVEALED = false; baseExtension = ".json"; notRevealedUri = "https://chubbyhippos.mypinata.cloud/ipfs/QmTXZXXYXWiQHAo7jcqoKJeak5xFAqjsTU9tv9RK2fvAp1"; } /*************************************** * * * Contract funds * * * ***************************************/ /* * Withdraw eth from the contract */ function withdraw() public payable onlyOwner { uint balance = address(this).balance; payable(msg.sender).transfer(balance); } /* * Check balance of the contract */ function checkBalance() public view onlyOwner returns (uint) { return address(this).balance; } /*************************************** * * * Contract settings * * * ***************************************/ // function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, ERC165Upgradeable, IERC165Upgradeable) returns (bool) { // return interfaceId == type(IERC721Upgradeable).interfaceId || // interfaceId == type(IERC721MetadataUpgradeable).interfaceId || // super.supportsInterface(interfaceId); // } /* * Set's the URI in case there's a need to be changed */ function setBaseUri(string memory URIParam) public onlyOwner { baseUri = URIParam; } function _baseURI() internal view virtual override returns (string memory) { return baseUri; } /* * Set's the notRevealedUri in case there's a need to be changed */ function setNotRevealedURI(string memory notRevealedURIParam) public onlyOwner { notRevealedUri = notRevealedURIParam; } /* * Toggle of token URI's reveal */ function toggleReveal() public onlyOwner { REVEALED = !REVEALED; } /* * Toggle of token URI's reveal */ function togglePause() public onlyOwner { PAUSED = !PAUSED; } /*************************************** * * * Emergency settings * * * ***************************************/ /* * Set's the mint price in case the eth price fluctuates too much */ function setMintPrice(uint onePrice, uint twoPrice, uint threePrice, uint fourPrice) public onlyOwner { oneMintPrice = onePrice; twoMintPrice = twoPrice; threeMintPrice = threePrice; fourMintPrice = fourPrice; } /* * Set's the max supply, this really shouldn't be used but it's here in case there are some community needs. */ function setMaxSupply(uint maxSupplyParam) public onlyOwner { maxSupply = uint16(maxSupplyParam); } /* * Get's the max supply. */ function getMaxSupply() public view returns (uint) { return maxSupply; } /* * Set's the max mintable, this really shouldn't be used but it's here in case there are some community needs. */ function setMaxReserved(uint maxReservedParam) public onlyOwner { totalReserved = uint16(maxReservedParam); } /* * Get's the max mintable. */ function getMaxReserved() public view returns (uint) { return totalReserved; } function setWatermelonTokenAddress(address _address) external onlyOwner { watermelonToken = IWatermelonToken(_address); } /*************************************** * * * Contract Logic * * * ***************************************/ /** * Reserve some tokens */ function reserveTokens(uint amount) public onlyOwner { require(uint256(totalMinted).add(amount) <= uint256(maxSupply), "Purchase exceeds max supply of Mintable Tokens"); totalReserved -= uint16(amount); safeMint(amount); } /** * Mint */ function mintOne() public payable { mint(1, oneMintPrice); } function mintTwo() public payable { mint(2, twoMintPrice); } function mintThree() public payable { mint(3, threeMintPrice); } function mintFour() public payable { mint(4, fourMintPrice); } function mint(uint amount, uint cost) internal { require(!PAUSED, "Minting is currently paused. Check later."); require(uint256(totalMinted).add(totalReserved).add(amount) <= uint256(maxSupply), "Purchase exceeds max supply of Mintable Tokens"); require(cost <= msg.value, "Ether value sent is not correct."); safeMint(amount); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); if (REVEALED == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } /*************************************** * * * Underlying structure * * * ***************************************/ function totalSupply() external view returns (uint256){ return totalMinted; } function calculatedSupply() external view returns (uint256) { return totalMinted + totalReserved; } /** * Send mint to sender's account. */ function safeMint(uint amount) private { for (uint i = 0; i < amount; i++) { uint mintIndex = totalMinted + i; if (totalMinted < maxSupply) { _safeMint(msg.sender, mintIndex); } } totalMinted += uint16(amount); } /*************************************** * * * Overrides * * * ***************************************/ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); watermelonToken.updateRewards(from, to); } }
contract ChubbyHipposNFT is ERC721Upgradeable, OwnableUpgradeable { using SafeMath for uint256; using Strings for uint256; uint oneMintPrice; uint twoMintPrice; uint threeMintPrice; uint fourMintPrice; uint16 maxSupply; uint16 totalMinted; uint16 totalReserved; uint16 maxMintable; bool PAUSED; bool REVEALED; string baseExtension; string baseUri; string notRevealedUri; IWatermelonToken watermelonToken; function init() initializer public { __Ownable_init(); __ERC721_init("ChubbyHippos", "CHUBBY"); oneMintPrice = 0.08 ether; twoMintPrice = 0.14 ether; threeMintPrice = 0.18 ether; fourMintPrice = 0.2 ether; maxSupply = 4444; totalReserved = 144; PAUSED = false; REVEALED = false; baseExtension = ".json"; notRevealedUri = "https://chubbyhippos.mypinata.cloud/ipfs/QmTXZXXYXWiQHAo7jcqoKJeak5xFAqjsTU9tv9RK2fvAp1"; } /*************************************** * * * Contract funds * * * ***************************************/ /* * Withdraw eth from the contract */ function withdraw() public payable onlyOwner { uint balance = address(this).balance; payable(msg.sender).transfer(balance); } /* * Check balance of the contract */ function checkBalance() public view onlyOwner returns (uint) { return address(this).balance; } /*************************************** * * * Contract settings * * * ***************************************/ // function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, ERC165Upgradeable, IERC165Upgradeable) returns (bool) { // return interfaceId == type(IERC721Upgradeable).interfaceId || // interfaceId == type(IERC721MetadataUpgradeable).interfaceId || // super.supportsInterface(interfaceId); // } /* * Set's the URI in case there's a need to be changed */ function setBaseUri(string memory URIParam) public onlyOwner { baseUri = URIParam; } function _baseURI() internal view virtual override returns (string memory) { return baseUri; } /* * Set's the notRevealedUri in case there's a need to be changed */ function setNotRevealedURI(string memory notRevealedURIParam) public onlyOwner { notRevealedUri = notRevealedURIParam; } /* * Toggle of token URI's reveal */ function toggleReveal() public onlyOwner { REVEALED = !REVEALED; } /* * Toggle of token URI's reveal */ function togglePause() public onlyOwner { PAUSED = !PAUSED; } /*************************************** * * * Emergency settings * * * ***************************************/ /* * Set's the mint price in case the eth price fluctuates too much */ function setMintPrice(uint onePrice, uint twoPrice, uint threePrice, uint fourPrice) public onlyOwner { oneMintPrice = onePrice; twoMintPrice = twoPrice; threeMintPrice = threePrice; fourMintPrice = fourPrice; } /* * Set's the max supply, this really shouldn't be used but it's here in case there are some community needs. */ function setMaxSupply(uint maxSupplyParam) public onlyOwner { maxSupply = uint16(maxSupplyParam); } /* * Get's the max supply. */ function getMaxSupply() public view returns (uint) { return maxSupply; } /* * Set's the max mintable, this really shouldn't be used but it's here in case there are some community needs. */ function setMaxReserved(uint maxReservedParam) public onlyOwner { totalReserved = uint16(maxReservedParam); } /* * Get's the max mintable. */ function getMaxReserved() public view returns (uint) { return totalReserved; } function setWatermelonTokenAddress(address _address) external onlyOwner { watermelonToken = IWatermelonToken(_address); } /*************************************** * * * Contract Logic * * * ***************************************/ /** * Reserve some tokens */ function reserveTokens(uint amount) public onlyOwner { require(uint256(totalMinted).add(amount) <= uint256(maxSupply), "Purchase exceeds max supply of Mintable Tokens"); totalReserved -= uint16(amount); safeMint(amount); } /** * Mint */ function mintOne() public payable { mint(1, oneMintPrice); } function mintTwo() public payable { mint(2, twoMintPrice); } function mintThree() public payable { mint(3, threeMintPrice); } function mintFour() public payable { mint(4, fourMintPrice); } function mint(uint amount, uint cost) internal { require(!PAUSED, "Minting is currently paused. Check later."); require(uint256(totalMinted).add(totalReserved).add(amount) <= uint256(maxSupply), "Purchase exceeds max supply of Mintable Tokens"); require(cost <= msg.value, "Ether value sent is not correct."); safeMint(amount); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); if (REVEALED == false) { return notRevealedUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } /*************************************** * * * Underlying structure * * * ***************************************/ function totalSupply() external view returns (uint256){ return totalMinted; } function calculatedSupply() external view returns (uint256) { return totalMinted + totalReserved; } /** * Send mint to sender's account. */ function safeMint(uint amount) private { for (uint i = 0; i < amount; i++) { uint mintIndex = totalMinted + i; if (totalMinted < maxSupply) { _safeMint(msg.sender, mintIndex); } } totalMinted += uint16(amount); } /*************************************** * * * Overrides * * * ***************************************/ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); watermelonToken.updateRewards(from, to); } }
44,533
0
// ITokenConfiguration Aave Common interface between aTokens and debt tokens to fetch thetoken configuration /
interface ITokenConfiguration { function UNDERLYING_ASSET_ADDRESS() external view returns (address); function POOL() external view returns (address); }
interface ITokenConfiguration { function UNDERLYING_ASSET_ADDRESS() external view returns (address); function POOL() external view returns (address); }
32,752
6
// get this Endpoint's immutable source identifier
function getChainId() external view returns (uint16);
function getChainId() external view returns (uint16);
25,079
67
// Run a spender approval, if needed.
if (collateralDepositAmount > IERC20(collateralTokenAddress).allowance(address(this), poolAddress)) { require(IERC20(collateralTokenAddress).approve(poolAddress, collateralDepositAmount), "Collateral approval failed"); }
if (collateralDepositAmount > IERC20(collateralTokenAddress).allowance(address(this), poolAddress)) { require(IERC20(collateralTokenAddress).approve(poolAddress, collateralDepositAmount), "Collateral approval failed"); }
16,248
54
// Check the validity of the symbol _symbol token symbol _owner address of the owner _tokenName Name of the tokenreturn bool /
function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool) { string memory symbol = upper(_symbol); require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract"); require(registeredSymbols[symbol].status != true, "Symbol status should not equal to true"); require(registeredSymbols[symbol].owner == _owner, "Owner of the symbol should matched with the requested issuer address"); require(registeredSymbols[symbol].timestamp.add(expiryLimit) >= now, "Ticker should not be expired"); registeredSymbols[symbol].tokenName = _tokenName; registeredSymbols[symbol].status = true; return true; }
function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool) { string memory symbol = upper(_symbol); require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract"); require(registeredSymbols[symbol].status != true, "Symbol status should not equal to true"); require(registeredSymbols[symbol].owner == _owner, "Owner of the symbol should matched with the requested issuer address"); require(registeredSymbols[symbol].timestamp.add(expiryLimit) >= now, "Ticker should not be expired"); registeredSymbols[symbol].tokenName = _tokenName; registeredSymbols[symbol].status = true; return true; }
9,859
18
// prove that outputs hash is represented in a finalized epoch
require( keccak256( abi.encodePacked( _v.vouchersEpochRootHash, _v.noticesEpochRootHash, _v.machineStateHash ) ) == _epochHash, "epochHash incorrect" );
require( keccak256( abi.encodePacked( _v.vouchersEpochRootHash, _v.noticesEpochRootHash, _v.machineStateHash ) ) == _epochHash, "epochHash incorrect" );
7,066
125
// Reward per second given to the staking contract, split among the staked tokens
uint256 public rewardRate;
uint256 public rewardRate;
50,898
6
// Function for the owner to refill the
function refillPriceMoney() public isOwner payable returns(uint){ require(msg.value > 0, "Cannot refund with nothing"); balance += msg.value; emit fundingHappened(msg.sender, msg.value); return balance; }
function refillPriceMoney() public isOwner payable returns(uint){ require(msg.value > 0, "Cannot refund with nothing"); balance += msg.value; emit fundingHappened(msg.sender, msg.value); return balance; }
18,695
26
// Member unlocks all from a pool
function unlock(address pool) public nonReentrant { uint256 balance = mapMemberPool_Balance[msg.sender][pool]; require(balance > 0, "Must have a balance to weight"); reduceWeight(pool, msg.sender); if(mapMember_Weight[msg.sender] == 0 && iERC20(BASE).balanceOf(address(this)) > 0){ harvest(); } require(iERC20(pool).transfer(msg.sender, balance), "Must transfer"); // Then transfer emit MemberUnlocks(msg.sender, pool, balance); }
function unlock(address pool) public nonReentrant { uint256 balance = mapMemberPool_Balance[msg.sender][pool]; require(balance > 0, "Must have a balance to weight"); reduceWeight(pool, msg.sender); if(mapMember_Weight[msg.sender] == 0 && iERC20(BASE).balanceOf(address(this)) > 0){ harvest(); } require(iERC20(pool).transfer(msg.sender, balance), "Must transfer"); // Then transfer emit MemberUnlocks(msg.sender, pool, balance); }
27,491
206
// Check if the dungeon is not in preparation period.
require(creationTime + dungeonPreparationTime <= now); _;
require(creationTime + dungeonPreparationTime <= now); _;
42,887
401
// Base Pools are expected to be deployed using factories. By using the factory address as the action disambiguator, we make all Pools deployed by the same factory share action identifiers. This allows for simpler management of permissions (such as being able to manage granting the 'set fee percentage' action in any Pool created by the same factory), while still making action identifiers unique among different factories if the selectors match, preventing accidental errors.
Authentication(bytes32(uint256(msg.sender))) BalancerPoolToken(name, symbol) BasePoolAuthorization(owner) TemporarilyPausable(pauseWindowDuration, bufferPeriodDuration)
Authentication(bytes32(uint256(msg.sender))) BalancerPoolToken(name, symbol) BasePoolAuthorization(owner) TemporarilyPausable(pauseWindowDuration, bufferPeriodDuration)
5,733
34
// Mint a public drop.nftContractThe nft contract to mint. feeRecipient The fee recipient. minterIfNotPayer The mint recipient if different than the payer. quantity The number of tokens to mint. /
function mintPublic( address nftContract, address feeRecipient, address minterIfNotPayer, uint256 quantity
function mintPublic( address nftContract, address feeRecipient, address minterIfNotPayer, uint256 quantity
30,189
5
// WrappedERC20 WrappedERC20 Cyril Lapinte - <cyril@openfiz.com>SPDX-License-Identifier: MIT Error messagesWE01: Allowance is too low to depositWE02: Unable to deposit the base tokenWE03: Too many tokens to withdrawWE04: Unable to withdraw the base token /
contract WrappedERC20 is TokenERC20, IWrappedERC20 { IERC20 internal base_; /** * @dev constructor */ constructor( string memory _name, string memory _symbol, IERC20 _base ) public TokenERC20(_name, _symbol, _base.decimals(), address(0), 0) { base_ = _base; } /** * @dev base token */ function base() public view override returns (IERC20) { return base_; } /** * @dev deposit */ function deposit(uint256 _value) public override returns (bool) { require(base_.allowance(msg.sender, address(this)) >= _value, "WE01"); require(base_.transferFrom(msg.sender, address(this), _value), "WE02"); balances[msg.sender] = balances[msg.sender].add(_value); totalSupply_ = totalSupply_.add(_value); emit Transfer(address(0), msg.sender, _value); return true; } /** * @dev withdraw */ function withdraw(uint256 _value) public override returns (bool) { require(balances[msg.sender] >= _value, "WE03"); balances[msg.sender] = balances[msg.sender].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Transfer(msg.sender, address(0), _value); require(base_.transfer(msg.sender, _value), "WE04"); return true; } }
contract WrappedERC20 is TokenERC20, IWrappedERC20 { IERC20 internal base_; /** * @dev constructor */ constructor( string memory _name, string memory _symbol, IERC20 _base ) public TokenERC20(_name, _symbol, _base.decimals(), address(0), 0) { base_ = _base; } /** * @dev base token */ function base() public view override returns (IERC20) { return base_; } /** * @dev deposit */ function deposit(uint256 _value) public override returns (bool) { require(base_.allowance(msg.sender, address(this)) >= _value, "WE01"); require(base_.transferFrom(msg.sender, address(this), _value), "WE02"); balances[msg.sender] = balances[msg.sender].add(_value); totalSupply_ = totalSupply_.add(_value); emit Transfer(address(0), msg.sender, _value); return true; } /** * @dev withdraw */ function withdraw(uint256 _value) public override returns (bool) { require(balances[msg.sender] >= _value, "WE03"); balances[msg.sender] = balances[msg.sender].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Transfer(msg.sender, address(0), _value); require(base_.transfer(msg.sender, _value), "WE04"); return true; } }
14,858
53
// Authorized function to set a new exchange rate when wraps anchored asset to GOLDx. /
function setUnit(uint256 _newUnit) external auth { require(_newUnit > 0, "setUnit: New unit should be greater than 0!"); require(_newUnit != unit, "setUnit: New unit should be different!"); unit = _newUnit; }
function setUnit(uint256 _newUnit) external auth { require(_newUnit > 0, "setUnit: New unit should be greater than 0!"); require(_newUnit != unit, "setUnit: New unit should be different!"); unit = _newUnit; }
33,400