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
40
// tempAssets += balance;
tempAssets = tempAssets.add(balance);
tempAssets = tempAssets.add(balance);
33,901
86
// 流动性 = 最小值(amount0_totalSupply) / _reserve0,(amount1_totalSupply) / _reserve1)
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
33,216
41
// Validates a set of RRs. data The RR data. typecovered The type covered by the RRSIG record. /
function validateRRs(bytes memory data, uint16 typecovered) internal pure returns (bytes memory name) { // Iterate over all the RRs for (RRUtils.RRIterator memory iter = data.iterateRRs(0); !iter.done(); iter.next()) { // We only support class IN (Internet) require(iter.class...
function validateRRs(bytes memory data, uint16 typecovered) internal pure returns (bytes memory name) { // Iterate over all the RRs for (RRUtils.RRIterator memory iter = data.iterateRRs(0); !iter.done(); iter.next()) { // We only support class IN (Internet) require(iter.class...
18,480
30
// First element will be the first wave of tokens, and so forth
Snapshot[] public snapshots;
Snapshot[] public snapshots;
37,035
63
// For removing this authority, set by using setAuthority(DSAuthority(0));
contract MintAuthority is DSAuthority { address public multisig; address public crowdsale; constructor(address _multisig, address _crowdsale) public { multisig = _multisig; crowdsale = _crowdsale; } function canCall( address _src, address _dst, bytes4 _sig ) constan...
contract MintAuthority is DSAuthority { address public multisig; address public crowdsale; constructor(address _multisig, address _crowdsale) public { multisig = _multisig; crowdsale = _crowdsale; } function canCall( address _src, address _dst, bytes4 _sig ) constan...
29,106
7
// LINK token address on Kovan
LINK = LinkTokenInterface(0xa36085F69e2889c224210F603D836748e7dC0088); contractAddr = payable(address(this));
LINK = LinkTokenInterface(0xa36085F69e2889c224210F603D836748e7dC0088); contractAddr = payable(address(this));
1,379
65
// seting the max fund of presale with eth
uint public PRESALE_ETH_IN_WEI_FUND_MAX = 0 ether;
uint public PRESALE_ETH_IN_WEI_FUND_MAX = 0 ether;
69,237
204
// PolicyManager Interface/Enzyme Council <[email protected]>/Interface for the PolicyManager
interface IPolicyManager { enum PolicyHook { BuySharesSetup, PreBuyShares, PostBuyShares, BuySharesCompleted, PreCallOnIntegration, PostCallOnIntegration } function validatePolicies( address, PolicyHook, bytes calldata ) external; ...
interface IPolicyManager { enum PolicyHook { BuySharesSetup, PreBuyShares, PostBuyShares, BuySharesCompleted, PreCallOnIntegration, PostCallOnIntegration } function validatePolicies( address, PolicyHook, bytes calldata ) external; ...
79,202
170
// Function to claim giveaway a NFT/
function claimGiveaway(uint256 _tokenId) external { require(isClaimActive, "Claim is not active"); require(ownerOf(_tokenId) == msg.sender, "You are not the owner of this NFT"); require(!claimedNFT[_tokenId], "Giveaway already claimed"); claimedNFT[_tokenId] = true; }
function claimGiveaway(uint256 _tokenId) external { require(isClaimActive, "Claim is not active"); require(ownerOf(_tokenId) == msg.sender, "You are not the owner of this NFT"); require(!claimedNFT[_tokenId], "Giveaway already claimed"); claimedNFT[_tokenId] = true; }
20,456
4
// SafeMath Math operations with safety checks that revert on error /
library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); ...
library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); ...
22,935
15
// Private functions
function _stake() private { _stakedAmount += msg.value; _addressToStakedAmount[msg.sender] += msg.value; if (_canBecomeValidator(msg.sender)) { _appendToValidatorSet(msg.sender); } emit Staked(msg.sender, msg.value); }
function _stake() private { _stakedAmount += msg.value; _addressToStakedAmount[msg.sender] += msg.value; if (_canBecomeValidator(msg.sender)) { _appendToValidatorSet(msg.sender); } emit Staked(msg.sender, msg.value); }
16,472
304
// Rainbow can not be minted in a set
_safeMint(to, tokenIndex); _tokenInfos[tokenIndex] = TokenInfo( minPriceBefore, block.number.add(i), minPriceBefore );
_safeMint(to, tokenIndex); _tokenInfos[tokenIndex] = TokenInfo( minPriceBefore, block.number.add(i), minPriceBefore );
37,063
10
// Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to. /
function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; }
function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; }
31,645
158
// TokenProxyHelps to reduces the size of the deployed bytecode for automatically created tokens, by using a proxy contract./
contract TokenProxy is Proxy { // storage layout is copied from PermittableToken.sol string internal name; string internal symbol; uint8 internal decimals; mapping(address => uint256) internal balances; uint256 internal totalSupply; mapping(address => mapping(address => uint256)) internal al...
contract TokenProxy is Proxy { // storage layout is copied from PermittableToken.sol string internal name; string internal symbol; uint8 internal decimals; mapping(address => uint256) internal balances; uint256 internal totalSupply; mapping(address => mapping(address => uint256)) internal al...
49,205
16
// Mint function for public sale/_to mint address/_count token count to mint
function mint(address _to, uint256 _count) external payable { require(block.timestamp >= publicSaleStart, "PS: Public sale is not started"); require(msg.value >= publicSaleMintFee * _count, "PS: Not enough funds sent"); require(mintedTokens[_to] + _count <= maxPublicSaleMintPerWallet, "PS: M...
function mint(address _to, uint256 _count) external payable { require(block.timestamp >= publicSaleStart, "PS: Public sale is not started"); require(msg.value >= publicSaleMintFee * _count, "PS: Not enough funds sent"); require(mintedTokens[_to] + _count <= maxPublicSaleMintPerWallet, "PS: M...
33,411
336
// Amount of token1 held as unused balance.
function _balance1() internal view returns (uint256) { return IERC20(token1).balanceOf(address(this)).sub(protocolFees1); }
function _balance1() internal view returns (uint256) { return IERC20(token1).balanceOf(address(this)).sub(protocolFees1); }
20,624
180
// =============================================================================
18,364
129
// Store admin = pendingAdmin
admin = pendingAdmin;
admin = pendingAdmin;
3,585
41
// This function can only be executed by the owner, it adds an address to the whitelist. To execute, the contract must be in stage 1, the address cannot already be whitelisted, and the address cannot be a contract itself. Blocking contracts from being whitelisted prevents attacks from unexpected contract to contract in...
function authorize (address addr, uint cap) public onlyOwner { require (contractStage == 1); _checkWhitelistContract(addr); require (!whitelist[addr].authorized); require ((cap > 0 && cap < contributionCaps.length) || (cap >= contributionMin && cap <= contributionCaps[0]) ); uint size; assembl...
function authorize (address addr, uint cap) public onlyOwner { require (contractStage == 1); _checkWhitelistContract(addr); require (!whitelist[addr].authorized); require ((cap > 0 && cap < contributionCaps.length) || (cap >= contributionMin && cap <= contributionCaps[0]) ); uint size; assembl...
26,059
16
// Clear the mythic reward pool
mythicRewardPool[_collectionId] = clearedPool;
mythicRewardPool[_collectionId] = clearedPool;
19,123
118
// keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, nameHash, versionHash, ChainId.get(), address(this) ) );
0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f, nameHash, versionHash, ChainId.get(), address(this) ) );
52,741
18
// This is the memory location where the input data resides.
uint data_ptr; assembly { data_ptr := add(data, 32) }
uint data_ptr; assembly { data_ptr := add(data, 32) }
11,080
140
// swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) 'amounts' is an array where [0] is input DAI amount and [1] is the resulting ETH after the conversion even tho we've specified the WETH address, we'll receive ETH since that's how it works on uniswap https:uni...
uint[] memory amounts = Uniswap(uniswapRouter).swapExactTokensForETH(_amount, uint(0), path, address(this), now.add(1800)); return amounts[1];
uint[] memory amounts = Uniswap(uniswapRouter).swapExactTokensForETH(_amount, uint(0), path, address(this), now.add(1800)); return amounts[1];
5,160
194
// Update FAC price
_updateCashPrice();
_updateCashPrice();
19,798
3
// Modifier for checking whether function caller is `_owner`.
modifier onlyOwner() { require(msg.sender == owner, "Only owner can call this function!"); _; }
modifier onlyOwner() { require(msg.sender == owner, "Only owner can call this function!"); _; }
18,244
66
// Guarantees that _tokenId is a valid Token. _tokenId ID of the NFT to validate. /
modifier validNFToken( uint256 _tokenId )
modifier validNFToken( uint256 _tokenId )
8,282
96
// Destroys `amount` tokens from `account`.`amount` is then deductedfrom the caller's allowance.
* See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve( account, _msgSender(), _allowances[account][_msgSender()].sub(amount, 'ERC20: burn amount exceeds allowance') ); ...
* See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve( account, _msgSender(), _allowances[account][_msgSender()].sub(amount, 'ERC20: burn amount exceeds allowance') ); ...
314
9
// Generate hash of the key and offset
bytes32 hash = keccak256(abi.encodePacked(key, i)); bytes32 chunk;
bytes32 hash = keccak256(abi.encodePacked(key, i)); bytes32 chunk;
32,831
10
// テイラー展開を用いて正弦関数を解く
int256 valFixed = radianRangeFixed; int256 sumFixed = valFixed; for (uint i = 1; i < 10; i++) { valFixed = _fixedMul(valFixed, - radianRangeSquaredFixed / int256((2 * i) * (2 * i + 1))); sumFixed = sumFixed + valFixed; }
int256 valFixed = radianRangeFixed; int256 sumFixed = valFixed; for (uint i = 1; i < 10; i++) { valFixed = _fixedMul(valFixed, - radianRangeSquaredFixed / int256((2 * i) * (2 * i + 1))); sumFixed = sumFixed + valFixed; }
59,363
45
// Transfers the spacified number of tokens to the user requesting Makes the allowance equal to zeroTransfers all allowed tokens from contract to the message senderIn case of failure restores the previous allowance amount Requirements: - message sender cannot be address(0) and has to be in AllowanceList /
function claimRemainingTokens() public openClaiming userHasClaimableTokens
function claimRemainingTokens() public openClaiming userHasClaimableTokens
44,939
54
// Getting Liquidity from Liquidity Contract
LiquidityInterface(getLiquidityAddr()).borrowTknAndTransfer(getCDAIAddress(), daiAmt); if (ok && val != 0) { daiEx.tokenToTokenSwapOutput( mkrFee, daiAmt, uint(999000000000000000000), uint(1899063809...
LiquidityInterface(getLiquidityAddr()).borrowTknAndTransfer(getCDAIAddress(), daiAmt); if (ok && val != 0) { daiEx.tokenToTokenSwapOutput( mkrFee, daiAmt, uint(999000000000000000000), uint(1899063809...
9,775
25
// We've hit a leaf node, so our next node should be NULL.
currentNodeID = bytes32(RLP_NULL); break;
currentNodeID = bytes32(RLP_NULL); break;
12,464
17
// changeOperator: update operator by admin
function changeOperator(address _newOperator) public adminOnly { require(_msgSender() == admin, "NOT_ADMIN"); require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "NOT_ADMIN"); address _previousOperator = operator; operator = _newOperator; grantRole(OPERATOR_ROLE, operator); ...
function changeOperator(address _newOperator) public adminOnly { require(_msgSender() == admin, "NOT_ADMIN"); require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "NOT_ADMIN"); address _previousOperator = operator; operator = _newOperator; grantRole(OPERATOR_ROLE, operator); ...
3,661
153
// 删除角色
function deleRoleMinter(address minter) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Caller is not a admin"); revokeRole(MINTER_ROLE, minter); }
function deleRoleMinter(address minter) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Caller is not a admin"); revokeRole(MINTER_ROLE, minter); }
20,159
28
// check claim entitlement
function checkClaimEntitlement() public view returns(uint) { for (uint i = 0; i < claimants.length; i++) { if(msg.sender == claimants[i].claimantAddress) { require(claimants[i].claimantHasClaimed == false); return claimants[i].claimantAmount; } ...
function checkClaimEntitlement() public view returns(uint) { for (uint i = 0; i < claimants.length; i++) { if(msg.sender == claimants[i].claimantAddress) { require(claimants[i].claimantHasClaimed == false); return claimants[i].claimantAmount; } ...
51,630
712
// 357
entry "unsurrendered" : ENG_ADJECTIVE
entry "unsurrendered" : ENG_ADJECTIVE
16,969
28
// Standard ERC20 token Implementation of the basic standard token. Based on: OpenZeppelin /
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to ...
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to ...
14,912
91
// pay card affiliate/does not call _processStakeholderPayment because it works differently
function payCardAffiliate(uint256 _card) external override { _checkState(States.WITHDRAW); require(!card[_card].cardAffiliatePaid, "Card affiliate already paid"); card[_card].cardAffiliatePaid = true; uint256 _cardAffiliatePayment = (card[_card].rentCollectedPerCard * car...
function payCardAffiliate(uint256 _card) external override { _checkState(States.WITHDRAW); require(!card[_card].cardAffiliatePaid, "Card affiliate already paid"); card[_card].cardAffiliatePaid = true; uint256 _cardAffiliatePayment = (card[_card].rentCollectedPerCard * car...
24,958
10
// 管理者
address public owner;
address public owner;
10,457
47
// calculates how much eth would be in contract given a number of shares_shares number of shares "in contract"return eth that would exists/
function eth(uint256 _shares) internal pure returns(uint256)
function eth(uint256 _shares) internal pure returns(uint256)
28,858
185
// an event emitted when the Player is appointed or changed
event AppointedPlayer(address indexed appointedPlayer);
event AppointedPlayer(address indexed appointedPlayer);
9,661
7
// in order to handle tokens that take tax, are burned, etc. when transferring, need to get the user's balance after transferring in order to send the remainder of the tokens instead of the full original supply. Similar to slippage on a DEX
uint256 _updatedSupply = _supply <= _rewToken.balanceOf(address(this)) ? _supply : _rewToken.balanceOf(address(this)); OKLGFaaSToken _contract = new OKLGFaaSToken( 'OKLG Staking Token', 'sOKLG', _updatedSupply, _rewardsTokenAddy, _stakedTokenAddy,
uint256 _updatedSupply = _supply <= _rewToken.balanceOf(address(this)) ? _supply : _rewToken.balanceOf(address(this)); OKLGFaaSToken _contract = new OKLGFaaSToken( 'OKLG Staking Token', 'sOKLG', _updatedSupply, _rewardsTokenAddy, _stakedTokenAddy,
9,318
247
// |unused |global | local | ownership information (address)|
& 0x00000000FFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | uint192(i) << 160;
& 0x00000000FFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | uint192(i) << 160;
3,705
23
// update fees for compounding
zeroBurn(); (, baseToken0Owed,baseToken1Owed) = _position(baseLower, baseUpper); (, limitToken0Owed,limitToken1Owed) = _position(limitLower, limitUpper);
zeroBurn(); (, baseToken0Owed,baseToken1Owed) = _position(baseLower, baseUpper); (, limitToken0Owed,limitToken1Owed) = _position(limitLower, limitUpper);
78,516
48
// Handle Tickets
giveTix(ticketsBought,msg.sender);
giveTix(ticketsBought,msg.sender);
44,862
4
// Check for administrator privileges. /
modifier onlyWhitelistAdmin() { require(_token.isWhitelistAdmin(msg.sender), "WhitelistAdminRole: caller does not have the WhitelistAdmin role"); _; }
modifier onlyWhitelistAdmin() { require(_token.isWhitelistAdmin(msg.sender), "WhitelistAdminRole: caller does not have the WhitelistAdmin role"); _; }
41,789
21
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met if (_value > _allowance) throw;
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(_from, _to, _value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(_from, _to, _value);
12,062
588
// transfer tokens to this address to stake them
totalStaked = totalStaked.add(_amount); balance[msg.sender] = balance[msg.sender].add(_amount); museToken.transferFrom(msg.sender, address(this), _amount); emit Staked(msg.sender, _amount);
totalStaked = totalStaked.add(_amount); balance[msg.sender] = balance[msg.sender].add(_amount); museToken.transferFrom(msg.sender, address(this), _amount); emit Staked(msg.sender, _amount);
42,872
85
// Total amount of tokens at a specific `_blockNumber`._blockNumber The block number when the totalSupply is queriedreturn The total amount of tokens at `_blockNumber` /
function totalSupplyAt(uint256 _blockNumber) public view returns(uint256) { // These next few lines are used when the totalSupply of the token is // requested before a check point was ever created for this token, it // requires that the `parentToken.totalSupplyAt` be queried at the // genesis bloc...
function totalSupplyAt(uint256 _blockNumber) public view returns(uint256) { // These next few lines are used when the totalSupply of the token is // requested before a check point was ever created for this token, it // requires that the `parentToken.totalSupplyAt` be queried at the // genesis bloc...
64,738
21
// Make users be able to swap
function activateTrading() external onlyOwner { require(!tradingEnabled, "Trading already enabled"); tradingEnabled = true; }
function activateTrading() external onlyOwner { require(!tradingEnabled, "Trading already enabled"); tradingEnabled = true; }
13,828
220
// Voting /
function submitVote(uint ballotId, bytes32 vote, bytes extra) req_namespace(ballotId) external { getDb(ballotId).submitVote(vote, extra); emit Vote(ballotId, vote, msg.sender, extra); }
function submitVote(uint ballotId, bytes32 vote, bytes extra) req_namespace(ballotId) external { getDb(ballotId).submitVote(vote, extra); emit Vote(ballotId, vote, msg.sender, extra); }
47,152
15
// When creating new kittens _from is 0x0, but we can't account that address.
if (_from != address(0)) { ownershipTokenCount[_from]--;
if (_from != address(0)) { ownershipTokenCount[_from]--;
3,974
16
// Only manager is able to call this function Grants and revokes manager's status of any address who The target address permit The permission flag /
function setManager(address who, bool permit) external onlyManager { isManager[who] = permit; }
function setManager(address who, bool permit) external onlyManager { isManager[who] = permit; }
40,919
34
// We can't initialize a mutable array in memory, so creating an array with length set as the number of regsitered days
uint32[] memory withdrawableDates = new uint32[](datesLength); uint256 index = 0; uint32 now32 = uint32(now); for (uint256 i = 0; i < datesLength; i++) { uint32 date = dates[i];
uint32[] memory withdrawableDates = new uint32[](datesLength); uint256 index = 0; uint32 now32 = uint32(now); for (uint256 i = 0; i < datesLength; i++) { uint32 date = dates[i];
27,223
178
// Returns the decimals./
function decimals() external view returns (uint256);
function decimals() external view returns (uint256);
21,682
6
// enable/disable public mint /
function setPublicMint(bool _enabled) external onlyOwner() { publicMint = _enabled; }
function setPublicMint(bool _enabled) external onlyOwner() { publicMint = _enabled; }
64,271
11
// return all the tokenIds that composes the givend NFT/
function getChain(uint256 tokenId) external view returns(uint256[] memory);
function getChain(uint256 tokenId) external view returns(uint256[] memory);
4,451
61
// Supplies asset tokens to the yield source./_mintAmount The amount of asset tokens to be supplied
function _supply(uint256 _mintAmount) internal virtual;
function _supply(uint256 _mintAmount) internal virtual;
24,812
0
// Interface of the Loan Contract. /
interface ILoan { event OwnershipTransferred(address indexed previousLender, address indexed newLender); event RoyaltiesSet(address indexed beneficiary, uint256 bps); event RoyaltiesPaid(address indexed beneficiary, address indexed token, uint256 amount); function collateral() external view returns (...
interface ILoan { event OwnershipTransferred(address indexed previousLender, address indexed newLender); event RoyaltiesSet(address indexed beneficiary, uint256 bps); event RoyaltiesPaid(address indexed beneficiary, address indexed token, uint256 amount); function collateral() external view returns (...
13,511
98
// Emit when investor details get modified related to their whitelisting
event ModifyWhitelist( address _investor, uint256 _dateAdded, address _addedBy, uint256 _fromTime, uint256 _toTime, uint256 _expiryTime, bool _canBuyFromSTO );
event ModifyWhitelist( address _investor, uint256 _dateAdded, address _addedBy, uint256 _fromTime, uint256 _toTime, uint256 _expiryTime, bool _canBuyFromSTO );
43,439
119
// Returns the value of the Transaction Count limit that applies to this '_account'/The function makes several steps of verification:/ Checks if the control of Transaction Count limit turned on:
/// the flag {_isEnabledTransactionCountLimit} /// is false - returns {MAX_UINT} /// is true: /// /// * Checks if the `_account` {hasOwnTransactionCountLimit}: /// if true - returns PersonalInfo.individualTransactionCountLimit of `_account` /// ...
/// the flag {_isEnabledTransactionCountLimit} /// is false - returns {MAX_UINT} /// is true: /// /// * Checks if the `_account` {hasOwnTransactionCountLimit}: /// if true - returns PersonalInfo.individualTransactionCountLimit of `_account` /// ...
2,744
2
// can later be changed with {transferOwnership}./ COVER: Initializes the contract setting the deployer as the initial owner. /
function initializeOwner() public { require(_owner == address(0)); _owner = msg.sender; emit OwnershipTransferCompleted(address(0), _owner); }
function initializeOwner() public { require(_owner == address(0)); _owner = msg.sender; emit OwnershipTransferCompleted(address(0), _owner); }
11,946
12
// Remove collection located at _index in collections array
function removeCollection(address _address) external onlyOwner { uint256 _collectionIndex = getCollectionIndex(_address); collections[_collectionIndex] = collections[collections.length - 1]; collections.pop(); collectionConsumptionRate[_collectionIndex] = collectionConsumptionRate[...
function removeCollection(address _address) external onlyOwner { uint256 _collectionIndex = getCollectionIndex(_address); collections[_collectionIndex] = collections[collections.length - 1]; collections.pop(); collectionConsumptionRate[_collectionIndex] = collectionConsumptionRate[...
27,947
282
// MANAGER ONLY: Initializes this module to the SetToken. Only callable by the SetToken's manager. Note: managers can enablecollateral and borrow assets that don't exist as positions on the SetToken_setToken Instance of the SetToken to initialize _collateralAssets Underlying tokens to be enabled as collateral in the Se...
function initialize( ISetToken _setToken, address[] memory _collateralAssets, address[] memory _borrowAssets ) external onlySetManager(_setToken, msg.sender) onlyValidAndPendingSet(_setToken)
function initialize( ISetToken _setToken, address[] memory _collateralAssets, address[] memory _borrowAssets ) external onlySetManager(_setToken, msg.sender) onlyValidAndPendingSet(_setToken)
35,901
10
// Seller releasing funds to the buyer
uint8 constant INSTRUCTION_RELEASE = 0x05;
uint8 constant INSTRUCTION_RELEASE = 0x05;
28,067
42
// Modifier to protect an initializer function from being invoked twice. /
modifier initializer() {
modifier initializer() {
12,585
42
// Moves `amount` of tokens from `sender` to `recipient`.
* This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. ...
* This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. ...
6,472
22
// not a peer address or not unique
if (isPeer[recoveredAddress] != true || uniqueAddresses[recoveredAddress] == true) { continue; }
if (isPeer[recoveredAddress] != true || uniqueAddresses[recoveredAddress] == true) { continue; }
30,162
23
// allow owner 2^256-1 tokens of this contract, the fee of buyBeer will be transfered to this contract
allowance[this][msg.sender] = MAX_UINT;
allowance[this][msg.sender] = MAX_UINT;
28,013
19
// remove from token if resulting quantity is 0
removeToken(swap.from);
removeToken(swap.from);
16,794
50
// Get index of the most significant non-zero bit in binary representation ofx.Reverts if x is zero. return index of the most significant non-zero bit in binary representationof x /
function mostSignificantBit(uint256 x) private pure returns (uint256) { unchecked { require(x > 0, REQUIRE_ERROR); uint256 result = 0; if (x >= 0x100000000000000000000000000000000) { x >>= 128; result += 128; } if ...
function mostSignificantBit(uint256 x) private pure returns (uint256) { unchecked { require(x > 0, REQUIRE_ERROR); uint256 result = 0; if (x >= 0x100000000000000000000000000000000) { x >>= 128; result += 128; } if ...
29,698
31
// This generates a public event on the blockchain that will notify clients // Initializes contract with initial supply tokens to the creator of the contract /
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instea...
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {} /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instea...
5,265
3
// Note: this clause is unreachable if feeRampup == 0 [TODO] Implement int divide '' operator in solidity for return statement below
return transferData.fee * (currentTime - startTime) / transferData.feeRampUp;
return transferData.fee * (currentTime - startTime) / transferData.feeRampUp;
45,340
27
// Remove a seed from both the map and the set/
function removeSeed(uint256 id) internal returns (bool) { if(!seedMap.contains(id)) return false; bytes32 seedHash = seedMap.get(id); if(!removeSeed(seedHash)) return false; if(!seedMap.remove(id)) return false; return true; }
function removeSeed(uint256 id) internal returns (bool) { if(!seedMap.contains(id)) return false; bytes32 seedHash = seedMap.get(id); if(!removeSeed(seedHash)) return false; if(!seedMap.remove(id)) return false; return true; }
18,890
20
// To set the claim start time and sale token address by the owner _claimStart claim start time noOfTokens no of tokens to add to the contract _saleToken sale toke address /
function startClaim( uint256 _claimStart, uint256 noOfTokens, address _saleToken
function startClaim( uint256 _claimStart, uint256 noOfTokens, address _saleToken
25,720
155
// now do the same for your opponent
if (i > 0 && allCards[1][i]._cardType != allCards[1][i - 1]._cardType) { allOfSameType[1] = false; }
if (i > 0 && allCards[1][i]._cardType != allCards[1][i - 1]._cardType) { allOfSameType[1] = false; }
52,386
101
// Include's an address in transactions from cooldowns.Can only be set by owner. /
function includeInTransactionCooldown(address account) external onlyOwner { isExcludedFromTransactionCoolDown[account] = false; }
function includeInTransactionCooldown(address account) external onlyOwner { isExcludedFromTransactionCoolDown[account] = false; }
13,596
184
//
require(games[msg.sender]); // uint toAward = (gamesAmount[msg.sender]*ticketAmount)*1000000000000*factor; // transferFrom(owner, toAddress, toAward); //
require(games[msg.sender]); // uint toAward = (gamesAmount[msg.sender]*ticketAmount)*1000000000000*factor; // transferFrom(owner, toAddress, toAward); //
40,539
20
// indicates weither any token exist with a given id, or not/
function exists(uint256 id) public view override returns (bool) { return potions[id].maxTokensPublic > 0; }
function exists(uint256 id) public view override returns (bool) { return potions[id].maxTokensPublic > 0; }
80,332
2
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public immutable _WETH_; address public immutable _Crosspoly_APPROVE_PROXY_;
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public immutable _WETH_; address public immutable _Crosspoly_APPROVE_PROXY_;
39,302
11
// ========== MUTATIVE FUNCTIONS =========== /
function transfer(address to, uint256 value) public override(IERC20, ERC20) returns (bool) { uint256 gonValue = value.mul(_gonsPerFragment); _gonBalances[msg.sender] = _gonBalances[msg.sender].sub(gonValue); _gonBalances[to] = _gonBalances[to].add(gonValue); require(balanceOf(msg.s...
function transfer(address to, uint256 value) public override(IERC20, ERC20) returns (bool) { uint256 gonValue = value.mul(_gonsPerFragment); _gonBalances[msg.sender] = _gonBalances[msg.sender].sub(gonValue); _gonBalances[to] = _gonBalances[to].add(gonValue); require(balanceOf(msg.s...
24,361
214
// Max Per Wallet
function setMaxMintPerWalletPhase1(uint256 _amount) external onlyOwner { maxMintPerWalletPhase1 = _amount; }
function setMaxMintPerWalletPhase1(uint256 _amount) external onlyOwner { maxMintPerWalletPhase1 = _amount; }
20,827
177
// If `account` had not been already granted `role`, emits a {RoleGranted}event. Requirements: - the caller must have ``role``'s admin role. /
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); }
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); }
1,023
181
// Remove the minimum balance record
_minimumBalances[token] = 0;
_minimumBalances[token] = 0;
12,439
46
// Updates a manager address and emits a corresponding event/governance function called only by the registryAdmin/the managers list is a flexible list of role to the manager's address/role is the managers' role name, for example "functionalManager"/manager is the manager updated address
function setManager(string calldata role, address manager) external /* onlyAdmin */;
function setManager(string calldata role, address manager) external /* onlyAdmin */;
49,799
71
// call this to set a custom reward token (call from token contract only)
function setRewardToken(address holder, address rewardTokenAddress, address ammContractAddress) external onlyOwner { if(userHasCustomRewardToken[holder] == true){ if(rewardTokenSelectionCount[userCurrentRewardToken[holder]] > 0){ rewardTokenSelectionCount[userCurrentRewardToken[holder]] -= 1; ...
function setRewardToken(address holder, address rewardTokenAddress, address ammContractAddress) external onlyOwner { if(userHasCustomRewardToken[holder] == true){ if(rewardTokenSelectionCount[userCurrentRewardToken[holder]] > 0){ rewardTokenSelectionCount[userCurrentRewardToken[holder]] -= 1; ...
25,666
102
// Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement {IERC721Receiver-onERC721Received}, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sen...
* If the target address is a contract, it must implement {IERC721Receiver-onERC721Received}, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sen...
16,334
0
// usr The address to send the minted tokens/amount The amount to be minted
function mint(address usr, uint256 amount) public requiresTrust { _mint(usr, amount); }
function mint(address usr, uint256 amount) public requiresTrust { _mint(usr, amount); }
61,235
24
// Change maxSnail before new div calculation
maxSnail = maxSnail.add(_snailsBought);
maxSnail = maxSnail.add(_snailsBought);
13,603
20
// Enable/disable deposits newValue bool /
function updateDepositsEnabled(bool newValue) public onlyOwner { require(DEPOSITS_ENABLED != newValue); DEPOSITS_ENABLED = newValue; emit DepositsEnabled(newValue); }
function updateDepositsEnabled(bool newValue) public onlyOwner { require(DEPOSITS_ENABLED != newValue); DEPOSITS_ENABLED = newValue; emit DepositsEnabled(newValue); }
11,027
12
// Currency
uint8 private CURRENCY_USD = 0; uint8 private CURRENCY_EUR = 1;
uint8 private CURRENCY_USD = 0; uint8 private CURRENCY_EUR = 1;
52,362
344
// Parse `updateData` and return price feeds of the given `priceIds` if they are all published/ within `minPublishTime` and `maxPublishTime`.// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;/ otherwise, please consider using `updatePriceFeeds`. This method does no...
function parsePriceFeedUpdates( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64 minPublishTime, uint64 maxPublishTime ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);
function parsePriceFeedUpdates( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64 minPublishTime, uint64 maxPublishTime ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);
33,649
16
// Maps an account to the list of groups it's voting for.
mapping(address => address[]) groupsVotedFor;
mapping(address => address[]) groupsVotedFor;
18,177
5,526
// 2764
entry "equivalved" : ENG_ADJECTIVE
entry "equivalved" : ENG_ADJECTIVE
19,376
1
// Verifies that the data encoded has been signedcorrectly by routing to the correct verifier. signedReport The encoded data to be verified.return verifierResponse The encoded response from the verifier. /
function verify(bytes memory signedReport) external returns (bytes memory verifierResponse);
function verify(bytes memory signedReport) external returns (bytes memory verifierResponse);
21,141
6
// : Sets the amount of credits you get per USDC: Amount of credits (18 decimals) /
function setCreditsPerUSDC(uint256 _amount) external onlyOwner { require(_amount > 0, "Credits per USDC cant be zero"); creditsPerUSDC = _amount; emit CreditsPerUSDCUpdated({value: _amount}); }
function setCreditsPerUSDC(uint256 _amount) external onlyOwner { require(_amount > 0, "Credits per USDC cant be zero"); creditsPerUSDC = _amount; emit CreditsPerUSDCUpdated({value: _amount}); }
16,892
90
// gets the amount of SKILL required to enter the arena
function getEntryWager(uint256 characterID) public view returns (uint256) { return getDuelCost(characterID).mul(wageringFactor); }
function getEntryWager(uint256 characterID) public view returns (uint256) { return getDuelCost(characterID).mul(wageringFactor); }
30,860
134
// Displays the amount of LINK that is available for the node operator to withdraw We use `ONE_FOR_CONSISTENT_GAS_COST` in place of 0 in storagereturn The amount of withdrawable LINK on the contract /
function withdrawable() external view override(OracleInterface, WithdrawalInterface) returns (uint256)
function withdrawable() external view override(OracleInterface, WithdrawalInterface) returns (uint256)
14,992
112
// ========== SETTERS ========== /
function setResolverAndSyncCache(AddressResolver _resolver) external onlyOwner { resolver = _resolver; for (uint i = 0; i < resolverAddressesRequired.length; i++) { bytes32 name = resolverAddressesRequired[i]; // Note: can only be invoked once the resolver has all the target...
function setResolverAndSyncCache(AddressResolver _resolver) external onlyOwner { resolver = _resolver; for (uint i = 0; i < resolverAddressesRequired.length; i++) { bytes32 name = resolverAddressesRequired[i]; // Note: can only be invoked once the resolver has all the target...
23,061
13
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
434