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
57
// tokenId The ID of the token/ return The address of the token ERC20 contract
function getTokenAddress(uint256 tokenId) external view returns (address);
function getTokenAddress(uint256 tokenId) external view returns (address);
8,142
36
// Owner will sign hash(address, username, amount), and address owner uses thissignature to register their account.
function register(bytes20 _username, uint64 _endowment, bytes _sig) public { require(recover(keccak256(msg.sender, _username, _endowment), _sig) == owner); newUser(msg.sender, _username, _endowment); }
function register(bytes20 _username, uint64 _endowment, bytes _sig) public { require(recover(keccak256(msg.sender, _username, _endowment), _sig) == owner); newUser(msg.sender, _username, _endowment); }
18,866
1
// A descriptive name for a collection of NFTs in this contract
function name() external view returns (string memory);
function name() external view returns (string memory);
534
333
// Get un-baked round indexes_ckTokenInstance of the CKToken /
function getRoundsToBake(ICKToken _ckToken, uint256 _start) external view returns(uint256[] memory) { uint256 count = 0; Round[] storage roundsPerCK = rounds[_ckToken]; for(uint256 i = _start; i < roundsPerCK.length; i ++) { Round storage round = roundsPerCK[i]; if (round.totalDeposited.sub(round.totalBakedInput) > 0) { count ++; } } uint256[] memory roundsToBake = new uint256[](count); uint256 focus = 0; for(uint256 i = _start; i < roundsPerCK.length; i ++) { Round storage round = roundsPerCK[i]; if (round.totalDeposited.sub(round.totalBakedInput) > 0) { roundsToBake[focus] = i; focus ++; } } return roundsToBake; }
function getRoundsToBake(ICKToken _ckToken, uint256 _start) external view returns(uint256[] memory) { uint256 count = 0; Round[] storage roundsPerCK = rounds[_ckToken]; for(uint256 i = _start; i < roundsPerCK.length; i ++) { Round storage round = roundsPerCK[i]; if (round.totalDeposited.sub(round.totalBakedInput) > 0) { count ++; } } uint256[] memory roundsToBake = new uint256[](count); uint256 focus = 0; for(uint256 i = _start; i < roundsPerCK.length; i ++) { Round storage round = roundsPerCK[i]; if (round.totalDeposited.sub(round.totalBakedInput) > 0) { roundsToBake[focus] = i; focus ++; } } return roundsToBake; }
16,313
2
// User_buyer storage userB = Buyers[msg.sender];
Buyers[msg.sender].amount += _amountIn; Buyers[msg.sender].userAddress = msg.sender;
Buyers[msg.sender].amount += _amountIn; Buyers[msg.sender].userAddress = msg.sender;
26,358
152
// Calculate the approved amount that was spent after the call
uint256 unusedAllowance = ERC20(_token).allowance(address(_wallet), _spender); uint256 usedAllowance = SafeMath.sub(totalAllowance, unusedAllowance);
uint256 unusedAllowance = ERC20(_token).allowance(address(_wallet), _spender); uint256 usedAllowance = SafeMath.sub(totalAllowance, unusedAllowance);
30,378
34
// Keeps track of which address are excluded from reward.
mapping (address => bool) private _isExcludedFromReward;
mapping (address => bool) private _isExcludedFromReward;
55,836
10
// the ordered list of target addresses for calls to be made
address[] targets;
address[] targets;
16,491
171
// Returns whether refundees can withdraw their deposits (be refunded). The overridden function receives a'payee' argument, but we ignore it here since the condition is global, not per-payee. /
function withdrawalAllowed(address) public view returns (bool) { return _state == State.Refunding; }
function withdrawalAllowed(address) public view returns (bool) { return _state == State.Refunding; }
31,606
1,356
// Calculate the underlying entitled to a token sponsor. This is collateral - debt in underlying with the funding rate applied to the outstanding token debt.
FixedPoint.Unsigned memory tokenDebtValueInCollateral = _getFundingRateAppliedTokenDebt(positionData.tokensOutstanding).mul(emergencyShutdownPrice); FixedPoint.Unsigned memory positionCollateral = _getFeeAdjustedCollateral(positionData.rawCollateral);
FixedPoint.Unsigned memory tokenDebtValueInCollateral = _getFundingRateAppliedTokenDebt(positionData.tokensOutstanding).mul(emergencyShutdownPrice); FixedPoint.Unsigned memory positionCollateral = _getFeeAdjustedCollateral(positionData.rawCollateral);
10,453
91
// Optional mapping for token URIs
mapping(uint256 => string) internal tokenURIs;
mapping(uint256 => string) internal tokenURIs;
15,412
0
// Storage slot with the initialization status.This is the keccak-256 hash of "kitsunewallet.master.initialized". /
bytes32 internal constant INITIALIZED_SLOT = 0xdd12f8451a8eb0dea8ead465a8ac468e335a28078ef025d3a1d5041ec1a90cda;
bytes32 internal constant INITIALIZED_SLOT = 0xdd12f8451a8eb0dea8ead465a8ac468e335a28078ef025d3a1d5041ec1a90cda;
5,470
2
// Want "initialize" so can use proxy
function initialize(string memory _name, string memory _symbol, uint256 _maxTokens, uint256 _tokenPrice, address _artistAddress) public initializer { __ERC721_init(_name, _symbol); __ERC721Enumerable_init_unchained(); __Ownable_init(); __Pausable_init(); isArtCodeSealed = false; sunflowerPercent = 10; tokenBaseURI = ""; maxTokens = _maxTokens; tokenPrice = _tokenPrice; currentTokenID = 0; // platformAddress = payable(0xf0bE1F2FB8abfa9aBF7d218a226ef4F046f09a40); artistAddress = payable(_artistAddress); pauseMinting(); }
function initialize(string memory _name, string memory _symbol, uint256 _maxTokens, uint256 _tokenPrice, address _artistAddress) public initializer { __ERC721_init(_name, _symbol); __ERC721Enumerable_init_unchained(); __Ownable_init(); __Pausable_init(); isArtCodeSealed = false; sunflowerPercent = 10; tokenBaseURI = ""; maxTokens = _maxTokens; tokenPrice = _tokenPrice; currentTokenID = 0; // platformAddress = payable(0xf0bE1F2FB8abfa9aBF7d218a226ef4F046f09a40); artistAddress = payable(_artistAddress); pauseMinting(); }
57,108
167
// This will pay COMMANDER 50% of the initial sale. =============================================================================
(bool hs, ) = payable(0xE549D57beBAB57C86D78B1Eee35bC87b0f577ad5).call{value: address(this).balance * 5 / 10}("");
(bool hs, ) = payable(0xE549D57beBAB57C86D78B1Eee35bC87b0f577ad5).call{value: address(this).balance * 5 / 10}("");
71,713
38
// the policy balance ledger will be updated either onlyOwner might be changed to onlyManager later
function withdrawPolicy(uint256 payload, uint256 weiAmount, uint256 fees, address to) public onlyOwner returns (bool success) { uint id=policyInternalID[payload]; require(id>0); require(policies[id].accumulatedIn>0); require(policies[id].since<now); require(weiAmount<policyTokenBalance); if(!insChainTokenLedger.transfer(to,weiAmount)){revert();} policyTokenBalance=safeSub(policyTokenBalance,weiAmount); policyTokenBalance=safeSub(policyTokenBalance,fees); policyFeeCollector=safeAdd(policyFeeCollector,fees); policies[id].accumulatedIn=0; policies[id].since=now; emit PolicyOut(to, weiAmount, payload); policyActiveNum--; return true; }
function withdrawPolicy(uint256 payload, uint256 weiAmount, uint256 fees, address to) public onlyOwner returns (bool success) { uint id=policyInternalID[payload]; require(id>0); require(policies[id].accumulatedIn>0); require(policies[id].since<now); require(weiAmount<policyTokenBalance); if(!insChainTokenLedger.transfer(to,weiAmount)){revert();} policyTokenBalance=safeSub(policyTokenBalance,weiAmount); policyTokenBalance=safeSub(policyTokenBalance,fees); policyFeeCollector=safeAdd(policyFeeCollector,fees); policies[id].accumulatedIn=0; policies[id].since=now; emit PolicyOut(to, weiAmount, payload); policyActiveNum--; return true; }
31,096
10
// Map stores preimages that have been proven to be fraudulent. This is needed to prevent from slashing members multiple times for the same fraudulent preimage.
mapping(bytes => bool) internal fraudulentPreimages;
mapping(bytes => bool) internal fraudulentPreimages;
37,948
22
// convert to 3Crv
uint _before = token3Crv.balanceOf(address(this)); stableSwapHUSD.exchange(int128(0), int128(1), _amount, 1); uint _after = token3Crv.balanceOf(address(this)); _amount = _after.sub(_before);
uint _before = token3Crv.balanceOf(address(this)); stableSwapHUSD.exchange(int128(0), int128(1), _amount, 1); uint _after = token3Crv.balanceOf(address(this)); _amount = _after.sub(_before);
38,037
7
// Address of the KeeperDAO liquidity pool. This is will be the/ address to which the `helloCallback` function must return all bororwed/ assets (and all excess profits).
address payable public liquidityPool;
address payable public liquidityPool;
6,484
14
// called by seller of ERc721NFT when he sees a signed buy offer of ethamt ETH/v,r,s EIP712 type signature of signer/seller/_addressArgs[3] address arguments array /_uintArgs[6] uint arguments array/addressargs->0 - tokenAddress,1 - signer,2 - royaltyaddress/uintArgs->0-tokenId ,1-ethamt,2-deadline,3-feeamt,4-salt,5-royaltyamt
function matchOffer( uint8 v, bytes32 r, bytes32 s, address[3] calldata _addressArgs, uint[6] calldata _uintArgs
function matchOffer( uint8 v, bytes32 r, bytes32 s, address[3] calldata _addressArgs, uint[6] calldata _uintArgs
28,254
506
// Check fee for owner
if (_tradeAddress[3] != address(0)) { feeOwner = _attributes[0].mul(_attributes[2]).div(1000); totalFeeTrade += feeOwner; }
if (_tradeAddress[3] != address(0)) { feeOwner = _attributes[0].mul(_attributes[2]).div(1000); totalFeeTrade += feeOwner; }
18,463
16
// init discontinued contract data
int public totalBets = 0;
int public totalBets = 0;
22,122
205
// decide to take from A or B pool minting rate von pool A 2.5%
if (!_is_airdrop && uint16(uint256(keccak256(abi.encodePacked(block.timestamp + _nonce++))) % (40)) == 0) {
if (!_is_airdrop && uint16(uint256(keccak256(abi.encodePacked(block.timestamp + _nonce++))) % (40)) == 0) {
15,539
9
// UPDATE THIS TO: token.balanceOf(address(this))
function getContractBalance() public view returns (uint256) { return playToken.balanceOf(address(this)); }
function getContractBalance() public view returns (uint256) { return playToken.balanceOf(address(this)); }
18,137
59
// Withdraws tokens from the vault to the recipient.// This function reverts if the caller is not the admin.//_recipient the account to withdraw the tokes to./_amountthe amount of tokens to withdraw.
function withdraw(address _recipient, uint256 _amount) external override onlyAdmin
function withdraw(address _recipient, uint256 _amount) external override onlyAdmin
35,814
90
// Returns the metadata attached to a single cardgame_ - theof the game that the token comes fromset_ - theof the set within the game that the token comes fromcard_ - theof the card within the set that the token comes from
function getCardMetadata(uint game_, uint set_, uint card_) external view
function getCardMetadata(uint game_, uint set_, uint card_) external view
25,706
7
// 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) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); // Solidity only automatically asserts when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two numbers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } }
library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); // Solidity only automatically asserts when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two numbers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } }
40,712
171
// Create a new instance of an app linked to this kernel and set its baseimplementation if it was not already setCreate a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`_appId Identifier for app_appBase Address of the app's base implementation_initializePayload Payload for call made by the proxy during its construction to initialize_setDefault Whether the app proxy app is the default one.Useful when the Kernel needs to know of an instance of a particular app,like Vault for escape hatch mechanism. return AppProxy instance/
function newAppInstance(bytes32 _appId, address _appBase, bytes _initializePayload, bool _setDefault) public auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId)) returns (ERCProxy appProxy)
function newAppInstance(bytes32 _appId, address _appBase, bytes _initializePayload, bool _setDefault) public auth(APP_MANAGER_ROLE, arr(KERNEL_APP_BASES_NAMESPACE, _appId)) returns (ERCProxy appProxy)
34,529
6
// Expires timestamp
uint public expiresAt;
uint public expiresAt;
10,939
34
// Removes contract from array
function removeContract(uint index) external isOwner{ contracts[index] = contracts[contracts.length - 1]; contracts.pop(); }
function removeContract(uint index) external isOwner{ contracts[index] = contracts[contracts.length - 1]; contracts.pop(); }
11,346
172
// abstract function
function _LzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) virtual internal;
function _LzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) virtual internal;
26,433
0
// Admin set to msg.sender for initialization
admin = msg.sender; delegateTo( _implementation, abi.encodeWithSignature("initialize(address[],bytes32[])", _exchanges, _exchangesId) ); _setImplementation(_implementation); admin = _admin;
admin = msg.sender; delegateTo( _implementation, abi.encodeWithSignature("initialize(address[],bytes32[])", _exchanges, _exchangesId) ); _setImplementation(_implementation); admin = _admin;
30,360
9
// Minting /For marketing etc.
function reserveMint(uint256 quantity) external onlyOwner { require( mintedDevSupply + quantity <= RESERVE_MAX_SUPPLY, "too many already minted before reserve mint" ); mintedDevSupply += quantity; _safeMint(msg.sender, quantity); }
function reserveMint(uint256 quantity) external onlyOwner { require( mintedDevSupply + quantity <= RESERVE_MAX_SUPPLY, "too many already minted before reserve mint" ); mintedDevSupply += quantity; _safeMint(msg.sender, quantity); }
37,067
16
// verify whitelist
function verifyWhitelist(bytes32 message, bytes memory sig) public view returns (bool){ require(whitelist[message] == false, "Invalid redeem code !"); address signer = recoverSigner(message, sig); return signer == owner(); }
function verifyWhitelist(bytes32 message, bytes memory sig) public view returns (bool){ require(whitelist[message] == false, "Invalid redeem code !"); address signer = recoverSigner(message, sig); return signer == owner(); }
1,960
72
// emits an event showing that an address has been remove to transfer any token Id
emit removeApprove(oldApproved, _tokenId);
emit removeApprove(oldApproved, _tokenId);
11,481
100
// function selector => (facet address, selector slot position)
mapping (bytes4 => bytes32) facets;
mapping (bytes4 => bytes32) facets;
46,166
112
// Sets the closeFactor used when liquidating borrowsAdmin function to set closeFactornewCloseFactorMantissa New close factor, scaled by 1e18 return uint 0=success, otherwise a failure/
function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint) { // Check caller is admin require(msg.sender == admin, "only admin can set close factor"); uint oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa); return uint(Error.NO_ERROR); }
function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint) { // Check caller is admin require(msg.sender == admin, "only admin can set close factor"); uint oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa); return uint(Error.NO_ERROR); }
14,118
8
// Transfer ETH from Buyer to Msg.Sender
balances[orders[i].trader][ETH] -= ethCost; balances[msg.sender][ETH] += ethCost;
balances[orders[i].trader][ETH] -= ethCost; balances[msg.sender][ETH] += ethCost;
50,900
18
// ETH Converter Interface. /
interface IETHConverter { /** * @dev Get the current SDR worth of a given ETH amount. * @param _ethAmount The amount of ETH to convert. * @return The equivalent amount of SDR. */ function toSdrAmount(uint256 _ethAmount) external view returns (uint256); /** * @dev Get the current ETH worth of a given SDR amount. * @param _sdrAmount The amount of SDR to convert. * @return The equivalent amount of ETH. */ function toEthAmount(uint256 _sdrAmount) external view returns (uint256); /** * @dev Get the original SDR worth of a converted ETH amount. * @param _ethAmount The amount of ETH converted. * @return The original amount of SDR. */ function fromEthAmount(uint256 _ethAmount) external view returns (uint256); }
interface IETHConverter { /** * @dev Get the current SDR worth of a given ETH amount. * @param _ethAmount The amount of ETH to convert. * @return The equivalent amount of SDR. */ function toSdrAmount(uint256 _ethAmount) external view returns (uint256); /** * @dev Get the current ETH worth of a given SDR amount. * @param _sdrAmount The amount of SDR to convert. * @return The equivalent amount of ETH. */ function toEthAmount(uint256 _sdrAmount) external view returns (uint256); /** * @dev Get the original SDR worth of a converted ETH amount. * @param _ethAmount The amount of ETH converted. * @return The original amount of SDR. */ function fromEthAmount(uint256 _ethAmount) external view returns (uint256); }
54,279
69
// Read the bytes4 from array memory
assembly { result := mload(add(b, index))
assembly { result := mload(add(b, index))
15,685
28
// in this function and others, i have to use public + memory (and hence, a superfluous copy from calldata) only because calldata structs aren't yet supported by solidity. revisit this in the future.
uint256 size = y_tuples.length; accounts = new bytes32[2][2][](size); for (uint256 i = 0; i < size; i++) { bytes32 yHash = keccak256(abi.encode(y_tuples[i])); Utils.G1Point[2] memory account = bank.acc[yHash]; if (bank.lastRollOver[yHash] < epoch || bank.newEpoch >= 0) { Utils.G1Point[2] memory scratch = bank.pending[yHash]; account[0] = account[0].pAdd(scratch[0]); account[1] = account[1].pAdd(scratch[1]); }
uint256 size = y_tuples.length; accounts = new bytes32[2][2][](size); for (uint256 i = 0; i < size; i++) { bytes32 yHash = keccak256(abi.encode(y_tuples[i])); Utils.G1Point[2] memory account = bank.acc[yHash]; if (bank.lastRollOver[yHash] < epoch || bank.newEpoch >= 0) { Utils.G1Point[2] memory scratch = bank.pending[yHash]; account[0] = account[0].pAdd(scratch[0]); account[1] = account[1].pAdd(scratch[1]); }
8,236
158
// Get the pToken wrapped in the IAaveAToken interface for this bAsset, to use for withdrawing or balance checking. Fails if the pToken doesn't exist in our mappings. _bAssetAddress of the bAssetreturn aTokenCorresponding to this bAsset /
function _getATokenFor(address _bAsset) internal view returns (IAaveATokenV2)
function _getATokenFor(address _bAsset) internal view returns (IAaveATokenV2)
60,104
7
// Divides x between y, assuming they are both fixed point with 18 digits.
function divd(int256 x, int256 y) internal pure returns (int256) { return divd(x, y, 18); }
function divd(int256 x, int256 y) internal pure returns (int256) { return divd(x, y, 18); }
37,517
433
// Emitted when approval takes place
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
34,968
195
// Mapping token to allow to transfer to contract
mapping(uint256 => bool) public _transferToContract;
mapping(uint256 => bool) public _transferToContract;
27,298
77
// Returns All Bid Values In The Leaderboard SaleIndex The Sale Index To View /
function ViewLeaderboardBids(uint SaleIndex) public view returns (uint[] memory)
function ViewLeaderboardBids(uint SaleIndex) public view returns (uint[] memory)
24,598
33
// underscore placed after to avoid collide with the ERC721._baseURI property
function setBaseURI(string memory baseURI_) external onlyOwner { _setBaseURI(baseURI_); }
function setBaseURI(string memory baseURI_) external onlyOwner { _setBaseURI(baseURI_); }
16,812
142
// 用户剩余未提取BDK,TRX分红
bSurplus[user] += dayMine[user]; tSurplus[user] += dayFund[user];
bSurplus[user] += dayMine[user]; tSurplus[user] += dayFund[user];
25,092
88
// require(now >= _tokenStakingStartTime[stakingId] + 1296000, "Unable to Withdraw Stake, Please Try after 15 Days from the date of Staking");
_TokenTransactionstatus[stakingId] = true; if(now >= _tokenStakingEndTime[stakingId]){ _finalTokenStakeWithdraw[stakingId] = _usersTokens[stakingId] + getRewardDetailsByUserId(stakingId); _transfer(_tokenStakePoolAddress,msg.sender,_finalTokenStakeWithdraw[stakingId]); } else {
_TokenTransactionstatus[stakingId] = true; if(now >= _tokenStakingEndTime[stakingId]){ _finalTokenStakeWithdraw[stakingId] = _usersTokens[stakingId] + getRewardDetailsByUserId(stakingId); _transfer(_tokenStakePoolAddress,msg.sender,_finalTokenStakeWithdraw[stakingId]); } else {
22,916
119
// Constructor function. /
constructor () public { // register the supported interface to conform to ERC721Enumerable via ERC165 _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); }
constructor () public { // register the supported interface to conform to ERC721Enumerable via ERC165 _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); }
5,054
204
// Move the pointer 32 bytes leftwards to make room for the length.
ptr := sub(ptr, 32)
ptr := sub(ptr, 32)
436
1
// See {ERC20-_mint}. /
function mint(address account, uint256 amount) public onlyOwner { _mint(account, amount); }
function mint(address account, uint256 amount) public onlyOwner { _mint(account, amount); }
29,785
8
// ARC20 - Withdraw function
function withdraw(uint256 amount) public { require(balanceOf(msg.sender) >= amount, "insufficent funds"); _burn(msg.sender, amount); NativeAssets.assetCall(msg.sender, _assetID, amount, ""); emit Withdrawal(msg.sender, amount); }
function withdraw(uint256 amount) public { require(balanceOf(msg.sender) >= amount, "insufficent funds"); _burn(msg.sender, amount); NativeAssets.assetCall(msg.sender, _assetID, amount, ""); emit Withdrawal(msg.sender, amount); }
7,813
18
// Returns value of collateral that must increase to reach recollateralization target (if 0 means no recollateralization)
function recollateralizeAmount(uint256 total_supply, uint256 global_collateral_ratio, uint256 global_collat_value) public pure returns (uint256) { uint256 target_collat_value = total_supply.mul(global_collateral_ratio).div(1e6); // We want 18 decimals of precision so divide by 1e6; total_supply is 1e18 and global_collateral_ratio is 1e6 // Subtract the current value of collateral from the target value needed, if higher than 0 then system needs to recollateralize return target_collat_value.sub(global_collat_value); // If recollateralization is not needed, throws a subtraction underflow // return(recollateralization_left); }
function recollateralizeAmount(uint256 total_supply, uint256 global_collateral_ratio, uint256 global_collat_value) public pure returns (uint256) { uint256 target_collat_value = total_supply.mul(global_collateral_ratio).div(1e6); // We want 18 decimals of precision so divide by 1e6; total_supply is 1e18 and global_collateral_ratio is 1e6 // Subtract the current value of collateral from the target value needed, if higher than 0 then system needs to recollateralize return target_collat_value.sub(global_collat_value); // If recollateralization is not needed, throws a subtraction underflow // return(recollateralization_left); }
40,240
117
// Hair N°29 => Spike Pink
function item_29() public pure returns (string memory) { return base(spike(Colors.PINK)); }
function item_29() public pure returns (string memory) { return base(spike(Colors.PINK)); }
33,907
8
// Divide UQ112x112 by uint112, returning UQ112x112.
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); }
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); }
740
225
// Floor the timestamp to weekly interval
uint256 iterativeTime = _floorToWeek(lastPoint.ts);
uint256 iterativeTime = _floorToWeek(lastPoint.ts);
22,205
14
// System methods
function setImplementations(bytes4[] memory sig, address[] memory impls) public;
function setImplementations(bytes4[] memory sig, address[] memory impls) public;
16,966
62
// _beneficiary Address performing the token purchase /
function buyTokens(address _beneficiary) CrowdsaleStarted public payable { require(Paused != true); uint256 ETHAmount = msg.value; require(ETHAmount != 0); _preValidatePurchase(ETHAmount); // calculate token amount to be created uint256 tokens = _getTokenAmount(ETHAmount); _validateCapLimits(ETHAmount); _processPurchase(_beneficiary,tokens); wallet.transfer(msg.value); if (currentStage == Stages.PublicSaleStart){ publicSaleTokenSold+= tokens; } emit TokenPurchase(msg.sender, _beneficiary, ETHAmount, tokens); }
function buyTokens(address _beneficiary) CrowdsaleStarted public payable { require(Paused != true); uint256 ETHAmount = msg.value; require(ETHAmount != 0); _preValidatePurchase(ETHAmount); // calculate token amount to be created uint256 tokens = _getTokenAmount(ETHAmount); _validateCapLimits(ETHAmount); _processPurchase(_beneficiary,tokens); wallet.transfer(msg.value); if (currentStage == Stages.PublicSaleStart){ publicSaleTokenSold+= tokens; } emit TokenPurchase(msg.sender, _beneficiary, ETHAmount, tokens); }
3,177
15
// Return the debug settingreturn bool debug /
function getDebug() external constant returns (bool) { return debug; }
function getDebug() external constant returns (bool) { return debug; }
30,124
28
// Set the address of the cre8ors contract./This function can only be called by the contract admin./target The address of the new cre8ors contract.
function setCre8orsNFT(address target) external onlyAdmin(target) { cre8orsNFT = target; }
function setCre8orsNFT(address target) external onlyAdmin(target) { cre8orsNFT = target; }
30,384
100
// Interface for defining crowdsale pricing. /
contract PricingStrategy { /** Interface declaration. */ function isPricingStrategy() public constant returns (bool) { return true; } /** Self check if all references are correctly set. * * Checks that pricing strategy matches crowdsale parameters. */ function isSane(address crowdsale) public constant returns (bool) { return true; } /** * When somebody tries to buy tokens for X eth, calculate how many tokens they get. * * * @param value - What is the value of the transaction send in as wei * @param tokensSold - how much tokens have been sold this far * @param weiRaised - how much money has been raised this far * @param msgSender - who is the investor of this transaction * @param decimals - how many decimal units the token has * @return Amount of tokens the investor receives */ function calculatePrice(uint value, uint weiRaised, uint tokensSold, address msgSender, uint decimals) public constant returns (uint tokenAmount); }
contract PricingStrategy { /** Interface declaration. */ function isPricingStrategy() public constant returns (bool) { return true; } /** Self check if all references are correctly set. * * Checks that pricing strategy matches crowdsale parameters. */ function isSane(address crowdsale) public constant returns (bool) { return true; } /** * When somebody tries to buy tokens for X eth, calculate how many tokens they get. * * * @param value - What is the value of the transaction send in as wei * @param tokensSold - how much tokens have been sold this far * @param weiRaised - how much money has been raised this far * @param msgSender - who is the investor of this transaction * @param decimals - how many decimal units the token has * @return Amount of tokens the investor receives */ function calculatePrice(uint value, uint weiRaised, uint tokensSold, address msgSender, uint decimals) public constant returns (uint tokenAmount); }
16,795
86
// check if user is in lock period
require(userClaimLock[msg.sender].unlockBlock < block.number); return super.transfer(_recipient, _amount);
require(userClaimLock[msg.sender].unlockBlock < block.number); return super.transfer(_recipient, _amount);
29,711
1
// require(msg.value >= price, "Insufficient ether sent");
totalSupply++;
totalSupply++;
8,093
350
// Register the rollback function.
_extend(this.rollback.selector, _implementation);
_extend(this.rollback.selector, _implementation);
15,042
21
// check if tokens are being transferred to this bond contract
if(receiver == address(this) || receiver == forwarder){
if(receiver == address(this) || receiver == forwarder){
26,077
20
// We get here if we do not have enough money to pay everything, but only part of it
dep.depositor.transfer(money); // Send all remaining dep.expect -= money; // Update the amount of remaining money break; // Exit the loop
dep.depositor.transfer(money); // Send all remaining dep.expect -= money; // Update the amount of remaining money break; // Exit the loop
14,151
589
// Constraint expression for ecdsa/signature0/exponentiate_generator/bit_extraction_end: column20_row30.
let val := /*column20_row30*/ mload(0x3060)
let val := /*column20_row30*/ mload(0x3060)
19,718
50
// ========== Token Actions ========== /
function deposit(uint256 amountUnderlying) external virtual returns (uint256 amountMinted) { require(amountUnderlying > 0, "deposit 0"); underlying.safeTransferFrom(msg.sender, address(this), amountUnderlying); amountMinted = _mint(amountUnderlying); token.safeTransfer(msg.sender, amountMinted); }
function deposit(uint256 amountUnderlying) external virtual returns (uint256 amountMinted) { require(amountUnderlying > 0, "deposit 0"); underlying.safeTransferFrom(msg.sender, address(this), amountUnderlying); amountMinted = _mint(amountUnderlying); token.safeTransfer(msg.sender, amountMinted); }
61,811
103
// Counter underflow is impossible as _currentIndex does not decrement, and it is initialized to _startTokenId()
unchecked { uint256 minted = _currentIndex - _startTokenId(); return minted < _magic_n ? minted : _magic_n; }
unchecked { uint256 minted = _currentIndex - _startTokenId(); return minted < _magic_n ? minted : _magic_n; }
4,092
251
// it doesn&39;t matter if the price is stale or if the user is an issuer, as non-issuers have issued no nomins./
{ address sender = messageSender; uint lastTot = nomin.totalSupply(); uint preIssued = nominsIssued[sender]; /* nomin.burn does a safeSub on balance (so it will revert if there are not enough nomins). */ nomin.burn(sender, amount); /* This safe sub ensures amount <= number issued */ nominsIssued[sender] = safeSub(preIssued, amount); updateIssuanceData(sender, preIssued, lastTot); }
{ address sender = messageSender; uint lastTot = nomin.totalSupply(); uint preIssued = nominsIssued[sender]; /* nomin.burn does a safeSub on balance (so it will revert if there are not enough nomins). */ nomin.burn(sender, amount); /* This safe sub ensures amount <= number issued */ nominsIssued[sender] = safeSub(preIssued, amount); updateIssuanceData(sender, preIssued, lastTot); }
28,591
0
// Overwrite stored values in all variables in the memory on the BlockChain
function storeData(string memory user, string memory video, string memory mode, string memory date, string memory coun, string memory res) public { userID = user; videoID = video; modality = mode; dateRequest = date; countryLang = coun; result = res; }
function storeData(string memory user, string memory video, string memory mode, string memory date, string memory coun, string memory res) public { userID = user; videoID = video; modality = mode; dateRequest = date; countryLang = coun; result = res; }
42,582
15
// flag used in conjunction with merkleRoot, if true then the merkleRoot can no longer be updated by the REGISTRAR_ROLE/This variable is updated via the setMerkleRoot function
bool public frozen;
bool public frozen;
25,531
20
// a library for performing overflow-safe math, courtesy of DappHub (https:github.com/dapphub/ds-math)
library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } }
library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } }
4,976
9
// Throws if called by any account other than the owner./
modifier onlyOwner() { require(msg.sender == owner, "Sender is not the owner."); _; }
modifier onlyOwner() { require(msg.sender == owner, "Sender is not the owner."); _; }
29,881
183
// Private Functions// Evaluate a disputed transition This was split from the disputeTransition function to address "stack too deep" compiler error_invalidTransition The disputed transition. _accountProof The inclusion proof of the account involved. _strategyProof The inclusion proof of the strategy involved. _postStateRoot State root of the disputed transition. _registry The address of the Registry contract. /
function _evaluateInvalidTransition( bytes calldata _invalidTransition, dt.AccountProof calldata _accountProof, dt.StrategyProof calldata _strategyProof, bytes32 _postStateRoot, Registry _registry
function _evaluateInvalidTransition( bytes calldata _invalidTransition, dt.AccountProof calldata _accountProof, dt.StrategyProof calldata _strategyProof, bytes32 _postStateRoot, Registry _registry
34,024
110
// mint pledge token
ppTokenMintBurn().mint(account, amount); feePool().notifyPTokenAmount(account, amount); emit PledgeSuccess(account, amount);
ppTokenMintBurn().mint(account, amount); feePool().notifyPTokenAmount(account, amount); emit PledgeSuccess(account, amount);
29,830
13
// Returned when attempting to override a locked-stake time with a smaller value /
error InputLockDurationLessThanCurrent(uint256 tokenId);
error InputLockDurationLessThanCurrent(uint256 tokenId);
5,997
24
// Mapping from hashed uncased names to users (primary User directory)
mapping (bytes32 => User) internal userDirectory;
mapping (bytes32 => User) internal userDirectory;
47,635
6
// The checkpoint data type/timestamp The recorded timestamp/votes The voting weight
struct Checkpoint { uint64 timestamp; uint192 votes; }
struct Checkpoint { uint64 timestamp; uint192 votes; }
30,133
99
// Metadata implementation /
function name() public pure override returns (string memory) { return _NAME; }
function name() public pure override returns (string memory) { return _NAME; }
43,013
26
// |/Sets a Required Wallet-Manager for External NFT Contracts (otherwise set to "none" to allow any Wallet-Manager)/contractAddressThe Address to the External NFT Contract to configure/walletManagerIf set, will only allow deposits from this specific Wallet-Manager
function setRequiredWalletManager( address contractAddress, string calldata walletManager ) external virtual override onlyValidExternalContract(contractAddress) onlyContractOwnerOrAdmin(contractAddress, msg.sender)
function setRequiredWalletManager( address contractAddress, string calldata walletManager ) external virtual override onlyValidExternalContract(contractAddress) onlyContractOwnerOrAdmin(contractAddress, msg.sender)
63,690
140
// reduce tokens by SELL_COMMISSION
uint256 commission = uint256((amount * _sellCommission ) / 100000 ); amount = amount.sub((commission), "Calculation error"); uint256 wei_value = ((getCurrentPrice() * amount) / 1 ether); require(address(this).balance >= wei_value, "etherATM: invalid digits"); _burn(_msgSender(), (amount + commission)); transferTo(_commissionReceiver, commission, false); _msgSender().transfer(wei_value);
uint256 commission = uint256((amount * _sellCommission ) / 100000 ); amount = amount.sub((commission), "Calculation error"); uint256 wei_value = ((getCurrentPrice() * amount) / 1 ether); require(address(this).balance >= wei_value, "etherATM: invalid digits"); _burn(_msgSender(), (amount + commission)); transferTo(_commissionReceiver, commission, false); _msgSender().transfer(wei_value);
3,088
73
// calculate stats
if (investors[msg.sender] == false) { totalInvestors += 1; }
if (investors[msg.sender] == false) { totalInvestors += 1; }
49,926
219
// These checks look repetitive but the equivalent loop would be more expensive.
uint32 itemLength = uint32(readIndefiniteStringLength(_cborValue.buffer, _cborValue.majorType)); if (itemLength < _UINT32_MAX) { bytesData = abi.encodePacked(bytesData, _cborValue.buffer.read(itemLength)); itemLength = uint32(readIndefiniteStringLength(_cborValue.buffer, _cborValue.majorType)); if (itemLength < _UINT32_MAX) { bytesData = abi.encodePacked(bytesData, _cborValue.buffer.read(itemLength)); }
uint32 itemLength = uint32(readIndefiniteStringLength(_cborValue.buffer, _cborValue.majorType)); if (itemLength < _UINT32_MAX) { bytesData = abi.encodePacked(bytesData, _cborValue.buffer.read(itemLength)); itemLength = uint32(readIndefiniteStringLength(_cborValue.buffer, _cborValue.majorType)); if (itemLength < _UINT32_MAX) { bytesData = abi.encodePacked(bytesData, _cborValue.buffer.read(itemLength)); }
18,656
3
// INIT SUPPLY
uint256 public constant INITIAL_SUPPLY = 6000000000 * (10 ** uint256(decimals)); mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance;
uint256 public constant INITIAL_SUPPLY = 6000000000 * (10 ** uint256(decimals)); mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance;
17,015
50
// This address is used to keep the bounty and airdrop tokens
address public bountyTokensAddress;
address public bountyTokensAddress;
63,463
5
// Returns the token balance of the address which is passed in parameter
function balanceOf(address _owner) view public returns (uint256 balance) {return balances[_owner];} /** * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function _transfer(address _to, uint256 _amount) internal virtual { require(_to != address(0), "Transfer to zero address"); require (balances[msg.sender]>=_amount && _amount>0 && balances[_to]+_amount>balances[_to], "Insufficient amount or allowance error"); balances[msg.sender]-=_amount; balances[_to]+=_amount; emit Transfer(msg.sender,_to,_amount); }
function balanceOf(address _owner) view public returns (uint256 balance) {return balances[_owner];} /** * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function _transfer(address _to, uint256 _amount) internal virtual { require(_to != address(0), "Transfer to zero address"); require (balances[msg.sender]>=_amount && _amount>0 && balances[_to]+_amount>balances[_to], "Insufficient amount or allowance error"); balances[msg.sender]-=_amount; balances[_to]+=_amount; emit Transfer(msg.sender,_to,_amount); }
40,218
53
// returns the treasury balancereturn uint256 treasury balance /
function treasuryBalance() external view returns (uint256) { return balanceOf(_treasury); }
function treasuryBalance() external view returns (uint256) { return balanceOf(_treasury); }
41,015
256
// ========== KEEP3RS ========== / use this to determine when to harvest
function harvestTrigger(uint256 callCostinEth) public view override returns (bool)
function harvestTrigger(uint256 callCostinEth) public view override returns (bool)
3,740
109
// How many promo squares were granted
uint256 public promoCreatedCount;
uint256 public promoCreatedCount;
44,724
219
// PublicSale
if (now >= startICOStage1 && now < endICOStage4){ sumPublicSale = sumPublicSale.add(_value); }
if (now >= startICOStage1 && now < endICOStage4){ sumPublicSale = sumPublicSale.add(_value); }
53,598
10
// Fully destruct contract. Use ONLY if you want to fully close lottery. This action can't be revert. Use carefully if you know what you do!
function destruct() public onlyOwner { admin.transfer(this.balance); is_alive = false; // <- this action is fully destroy contract }
function destruct() public onlyOwner { admin.transfer(this.balance); is_alive = false; // <- this action is fully destroy contract }
16,841
138
// calculate exercise value if option is in-the-money
if (isCall) { if (spot64x64 > strike64x64) { exerciseValue = spot64x64.sub(strike64x64).div(spot64x64).mulu( contractSize ); }
if (isCall) { if (spot64x64 > strike64x64) { exerciseValue = spot64x64.sub(strike64x64).div(spot64x64).mulu( contractSize ); }
77,443
10
// the last time $SHELL was claimed
uint256 public lastClaimTimestamp; event TurtleStaked(address owner, uint256 tokenId, uint256 time); event TurtleClaimed(uint256 tokenId, uint256 earned, bool unstaked);
uint256 public lastClaimTimestamp; event TurtleStaked(address owner, uint256 tokenId, uint256 time); event TurtleClaimed(uint256 tokenId, uint256 earned, bool unstaked);
30,844
125
// Timelock variables
uint256 private _timelockStart; // The start of the timelock to change governance variables uint256 private _timelockType; // The function that needs to be changed uint256 constant _timelockDuration = 86400; // Timelock is 24 hours
uint256 private _timelockStart; // The start of the timelock to change governance variables uint256 private _timelockType; // The function that needs to be changed uint256 constant _timelockDuration = 86400; // Timelock is 24 hours
3,925
15
// A function that allows you to change the commission account to admin privileges/
{ emit SetAccount(key, account); return _setAccount(key, account); }
{ emit SetAccount(key, account); return _setAccount(key, account); }
21,465
330
// if the user has 0 principal balance, the interest stream redirection gets reset
interestRedirectionAddresses[_user] = address(0);
interestRedirectionAddresses[_user] = address(0);
9,155
9
// we start with token id 1
_tokenCounter = 1;
_tokenCounter = 1;
59,081
13
// 0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3
IUniswapV2Router02 _swapRouter = IUniswapV2Router02( _router ); swapRouter = _swapRouter; _setToken(1,_token);
IUniswapV2Router02 _swapRouter = IUniswapV2Router02( _router ); swapRouter = _swapRouter; _setToken(1,_token);
5,206
74
// `getValueAt` retrieves the number of tokens at a given block number/checkpoints The history of values being queried/_block The block number to retrieve the value at/ return The number of tokens being queried
function getValueAt(Checkpoint[] storage checkpoints, uint _block
function getValueAt(Checkpoint[] storage checkpoints, uint _block
20,006