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
5
// Expensive and ONLY CALLABLE EXTERNALLY because it returns a dynamic array.
function tokensOfOwner(address _owner) external view returns(uint256[] memory ownerTokens) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](...
function tokensOfOwner(address _owner) external view returns(uint256[] memory ownerTokens) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](...
37,725
312
// Prepare update of target allocation (with time delay enforced). newTargetAllocation New target allocation.return `true` if successful. /
function prepareTargetAllocation(uint256 newTargetAllocation) external onlyGovernance returns (bool)
function prepareTargetAllocation(uint256 newTargetAllocation) external onlyGovernance returns (bool)
23,390
172
// Mint tokens for dev address
MyToken.mint(devAddress, devReward)
MyToken.mint(devAddress, devReward)
22,277
24
// escrow[msg.sender] += bids[nftAddress][tokenID[i]].price;
emit AcceptBid({ nft: nftAddress, tokenID: tokenID[i], price: bids[nftAddress][tokenID[i]].price });
emit AcceptBid({ nft: nftAddress, tokenID: tokenID[i], price: bids[nftAddress][tokenID[i]].price });
34,033
85
// Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.The call is not executed if the target address is not a contract.from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _data...
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
31,744
6
// Description: Used to initialize all variables when contract is launched. Only ever run at launch. /
function initialize() public { require(!_initialized); _owner = _msgSender(); _tax = 0xefe5bb8529b6bF478EF8c18cd115746F162C9C2d; _banner = _msgSender(); _treasury = _msgSender(); _tradeIsOpen = false; _buyIsOpen = true; _sellIsOpen = false; _blockRestricti...
function initialize() public { require(!_initialized); _owner = _msgSender(); _tax = 0xefe5bb8529b6bF478EF8c18cd115746F162C9C2d; _banner = _msgSender(); _treasury = _msgSender(); _tradeIsOpen = false; _buyIsOpen = true; _sellIsOpen = false; _blockRestricti...
50,582
98
// Sets Operator
function setOperator(address _operator) external onlyOperator { operator = _operator; }
function setOperator(address _operator) external onlyOperator { operator = _operator; }
26,872
2,078
// 1041
entry "intreatingly" : ENG_ADVERB
entry "intreatingly" : ENG_ADVERB
21,877
10
// Internal function to preview how many base tokens will be received when unwrapping a given amount of shares./shares The amount of shares to preview a redemption./ return base_ The amount of base tokens that would be returned from redeeming.
function _unwrapPreview( uint256 shares
function _unwrapPreview( uint256 shares
41,631
9
// Sends a move with a given name, optionally attaching a WCHI paymentto the given receiver.For no payment, amount and receiver should beset to zero. If a nonce other than uint256.max is passed, then the move is validonly if it matches exactly the account's next nonce.The nonce usedis returned. /
function move (string memory ns, string memory name, string memory mv,
function move (string memory ns, string memory name, string memory mv,
6,466
289
// transfer tokens to the data contract
require(auditData.token().transferFrom(msg.sender, address(auditData), price));
require(auditData.token().transferFrom(msg.sender, address(auditData), price));
36,234
69
// StakeManager call this function to deposit for user. - Must update pool info - Must give pending reward to user. - Emit `BalanceAdded` event. _user User address. _protocol Protocol address. _amount Stake amount. _nftId NftId./
) external override onlyModule("STAKE") { PoolInfo storage pool = poolInfo[_protocol]; UserInfo storage user = userInfo[_protocol][_user]; if (pool.protocol == address(0)) { initPool(_protocol); } else { updatePool(_protocol); if (user.amount > 0) ...
) external override onlyModule("STAKE") { PoolInfo storage pool = poolInfo[_protocol]; UserInfo storage user = userInfo[_protocol][_user]; if (pool.protocol == address(0)) { initPool(_protocol); } else { updatePool(_protocol); if (user.amount > 0) ...
47,042
101
// use EIP 191 0x1900 + this logic address + data + nonce of signing key
bytes32 msgHash ; //inject UNINIT LOCAL/STATE VAR bytes32 prefixedHash ; //inject UNINIT LOCAL/STATE VAR return prefixedHash;
bytes32 msgHash ; //inject UNINIT LOCAL/STATE VAR bytes32 prefixedHash ; //inject UNINIT LOCAL/STATE VAR return prefixedHash;
23,702
18
// Call smart contract from vault/Only manager can do this/Only smart contracts and functions whitelisted in the filters can be called/_contract smart contract address/_value ETH to send with the call/_args function signature and parameters
function managerCall(address _contract, uint256 _value, bytes memory _args) external nonReentrant onlyManager { if (address(config.filterMapper) == address(0)) revert FilterMapperNotAssigned(); _internalManagerCall(_contract, _value, _args); }
function managerCall(address _contract, uint256 _value, bytes memory _args) external nonReentrant onlyManager { if (address(config.filterMapper) == address(0)) revert FilterMapperNotAssigned(); _internalManagerCall(_contract, _value, _args); }
32,106
23
// considering fee as a separate input
require(ticketData[utxoPos].reservedAmount == outputData.amount, "Wrong amount sent to quasar owner"); require(ticketData[utxoPos].token == outputData.token, "Wrong token sent to quasar owner");
require(ticketData[utxoPos].reservedAmount == outputData.amount, "Wrong amount sent to quasar owner"); require(ticketData[utxoPos].token == outputData.token, "Wrong token sent to quasar owner");
27,001
51
// Query if a contract implements an interface _interfaceId The interface identifier, as specified in ERC-165 Interface identification is specified in ERC-165. This functionuses less than 30,000 gas. /
function supportsInterface(bytes4 _interfaceId) external view returns (bool);
function supportsInterface(bytes4 _interfaceId) external view returns (bool);
40,433
272
// flip the fraction
price = (1e24 / price) / 1e12;
price = (1e24 / price) / 1e12;
39,876
53
// Max wallet holding (% at launch)
uint256 public _maxWalletToken = _tTotal.mul(1).div(100); uint256 private _previousMaxWalletToken = _maxWalletToken;
uint256 public _maxWalletToken = _tTotal.mul(1).div(100); uint256 private _previousMaxWalletToken = _maxWalletToken;
75,471
78
// console.log("about to transfer tokens async");
_asyncTransfer(sale.recipient, nativeFee);
_asyncTransfer(sale.recipient, nativeFee);
27,947
173
// At main sale bonuses will be available only during the first 48 hours.
uint public mainSaleBonusEndTime;
uint public mainSaleBonusEndTime;
44,635
150
// Send to the treasury
retirementYeldTreasury.transfer(retirementYeld);
retirementYeldTreasury.transfer(retirementYeld);
14,550
194
// need to add up since the range could be in the middle somewheretraverse inversely to make more current queries more gas efficient
for (uint i = locks.length - 1; i + 1 != 0; i--) { uint256 lockEpoch = uint256(locks[i].unlockTime).sub(lockDuration);
for (uint i = locks.length - 1; i + 1 != 0; i--) { uint256 lockEpoch = uint256(locks[i].unlockTime).sub(lockDuration);
31,491
76
// NOTE leave game in playable state when possible TODO deal with leaving after start TODO deal with game-ending exits TODO reveal all player cards TODO consider stake sacrifice as penalty
function leaveGame() external { uint256 gameId = player_to_game[msg.sender]; if (gameId != 0) { require(games[gameId].turn == 0, 'Leaving after start not yet supported'); player_to_game[msg.sender] = 0; // remove from list of game's players uint256 numPlayers = getNumPlayers(gameId); ...
function leaveGame() external { uint256 gameId = player_to_game[msg.sender]; if (gameId != 0) { require(games[gameId].turn == 0, 'Leaving after start not yet supported'); player_to_game[msg.sender] = 0; // remove from list of game's players uint256 numPlayers = getNumPlayers(gameId); ...
41,300
105
// @nonce Sends premiums to the liquidity pool /
receive() external payable {} /** * @notice Used for changing the lockup period * @param value New period value */ function setLockupPeriod(uint256 value) external override onlyOwner { require(value <= 60 days, "Lockup period is too large"); lockupPeriod = value; }
receive() external payable {} /** * @notice Used for changing the lockup period * @param value New period value */ function setLockupPeriod(uint256 value) external override onlyOwner { require(value <= 60 days, "Lockup period is too large"); lockupPeriod = value; }
9,859
19
// transfer token for a specified address_to The address to transfer to._value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = b...
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = b...
19,967
293
// Indicates whether the given address can mint more tokens./
function addressMintAvailable(address to) public view virtual returns (bool) { return _mintCounts[to] < MAX_MINTS_PER_ADDRESS; }
function addressMintAvailable(address to) public view virtual returns (bool) { return _mintCounts[to] < MAX_MINTS_PER_ADDRESS; }
20,500
43
// +---------------------------------------------------------------------------------------+ Private Functions+---------------------------------------------------------------------------------------+
function transferReferralTokens(address referrer, uint256 bonusPercent, uint purchaseAmountBig) private { uint256 referralAmountBig = purchaseAmountBig.mul(bonusPercent).div(10**2); _token.transfer(referrer, (referralAmountBig)); }
function transferReferralTokens(address referrer, uint256 bonusPercent, uint purchaseAmountBig) private { uint256 referralAmountBig = purchaseAmountBig.mul(bonusPercent).div(10**2); _token.transfer(referrer, (referralAmountBig)); }
45,280
43
// Create a list of orders/_orders Orders to create/_amounts Amounts of options to buy / sell for each order/ return The hashes of the orders
function createOrders(Order[] memory _orders, uint256[] memory _amounts) external returns(bytes32[] memory) { require(_orders.length == _amounts.length, "Arrays must have same length"); bytes32[] memory result = new bytes32[](_orders.length); for (uint256 i=0; i < _orders.length; i++) { ...
function createOrders(Order[] memory _orders, uint256[] memory _amounts) external returns(bytes32[] memory) { require(_orders.length == _amounts.length, "Arrays must have same length"); bytes32[] memory result = new bytes32[](_orders.length); for (uint256 i=0; i < _orders.length; i++) { ...
50,521
117
// get the new reserve weights
(uint32 primaryReserveWeight, uint32 secondaryReserveWeight) = effectiveReserveWeights(referenceRate);
(uint32 primaryReserveWeight, uint32 secondaryReserveWeight) = effectiveReserveWeights(referenceRate);
50,032
100
// Checks if the msg.sender is the admin address /
modifier onlyAdmin() { require(msg.sender == admin, "admin: wut?"); _; }
modifier onlyAdmin() { require(msg.sender == admin, "admin: wut?"); _; }
41,103
5
// Emitted on successful vested token claim when the number of tokens claimed/ is 1 or more. Does not fire for 0 claims./to recipient of claim/amt of tokens claimed
event VestClaim(address indexed to, uint256 amt);
event VestClaim(address indexed to, uint256 amt);
6,381
163
// The VaultChef is a vault management contract that manages vaults, their strategies and the share positions of investors in these vaults. Positions are not hardcoded into the contract like traditional staking contracts, instead they are managed as ERC-1155 receipt tokens. This receipt-token mechanism is supposed to s...
interface IVaultChefCore is IERC1155 { /// @notice A vault is a strategy users can stake underlying tokens in to receive a share of the vault value. struct Vault { /// @notice The token this strategy will compound. IERC20 underlyingToken; /// @notice The timestamp of the last harvest, se...
interface IVaultChefCore is IERC1155 { /// @notice A vault is a strategy users can stake underlying tokens in to receive a share of the vault value. struct Vault { /// @notice The token this strategy will compound. IERC20 underlyingToken; /// @notice The timestamp of the last harvest, se...
40,660
101
// copy curLine into result
assembly { for { let j := 0 } lt(j, numloops) { j := add(1, j) } { mstore(add(resPosition, mul(32, j)), mload(add(strToCopy, mul(32, add(1, j))))) }
assembly { for { let j := 0 } lt(j, numloops) { j := add(1, j) } { mstore(add(resPosition, mul(32, j)), mload(add(strToCopy, mul(32, add(1, j))))) }
35,958
142
// Setup the post-process. _to The handler of post-process. /
function _setPostProcess(address _to) internal { // If the stack length equals 0, just skip // If the top is a custom post-process, replace it with the handler // address. if (stack.length == 0) { return; } else if ( stack.peek() == bytes32(bytes12(uin...
function _setPostProcess(address _to) internal { // If the stack length equals 0, just skip // If the top is a custom post-process, replace it with the handler // address. if (stack.length == 0) { return; } else if ( stack.peek() == bytes32(bytes12(uin...
8,325
219
// AggregatorV3Interface / Chainlink compatibility
function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound
function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound
22,683
41
// User must approve this contract to transfer the given amount
cargoGems.transferFrom(msg.sender, address(this), amountToStake);
cargoGems.transferFrom(msg.sender, address(this), amountToStake);
25,883
5
// Returns `true` if `account` has been granted `permission`. /
function hasPermission(bytes32 permission, address account) external view returns (bool);
function hasPermission(bytes32 permission, address account) external view returns (bool);
62,381
405
// Percent of oraclePrice paid to disputer in the Disputed state (i.e. following a successful dispute) Represented as a multiplier, see above.
FixedPoint.Unsigned public disputerDisputeRewardPct;
FixedPoint.Unsigned public disputerDisputeRewardPct;
34,708
41
// A mapping from hero ID to its current health.
mapping(uint => uint) public heroIdToHealth;
mapping(uint => uint) public heroIdToHealth;
32,217
53
// Minimal amount of Parsecs to cover all rewards
uint256 public constant MINIMAL_AMOUNT_OF_PARSECS = 290563097000000; // 290,563,097.000000 PRSC
uint256 public constant MINIMAL_AMOUNT_OF_PARSECS = 290563097000000; // 290,563,097.000000 PRSC
36,757
97
// ========== INTERNAL CHECKS ========== /
function _onlyGovernor() internal view { if (msg.sender != authority.governor()) revert UNAUTHORIZED(); }
function _onlyGovernor() internal view { if (msg.sender != authority.governor()) revert UNAUTHORIZED(); }
46,901
23
// allows to transfer ERC20 token to specific TravelPlan by anyoneID TravelPlan existing UUID amount ERC20 token value defined by its decimals
* Emits a {ContributeToTravelPlan, Transfer} event. */ function contributeToTravelPlan(uint256 ID, uint256 amount) external { TravelPlan storage plan = travelPlans[ID]; require(plan.ID == ID, "doesn't exist"); plan.contributedAmount += amount; token.safeTransferFrom(msg.s...
* Emits a {ContributeToTravelPlan, Transfer} event. */ function contributeToTravelPlan(uint256 ID, uint256 amount) external { TravelPlan storage plan = travelPlans[ID]; require(plan.ID == ID, "doesn't exist"); plan.contributedAmount += amount; token.safeTransferFrom(msg.s...
25,939
73
// Extend activation series
extendActivation(msg.sender); if (users[msg.sender].info.line == 2) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toFund(msg.value / 100 * 30 + msg.value / 100 * 20 + msg.value / 100 * 10); }
extendActivation(msg.sender); if (users[msg.sender].info.line == 2) { toReferrer(users[msg.sender].info.referrer, msg.value / 100 * 40, 1); toFund(msg.value / 100 * 30 + msg.value / 100 * 20 + msg.value / 100 * 10); }
38,170
302
// Free daily summon.
function payWithDailyFreePoint() whenNotPaused public
function payWithDailyFreePoint() whenNotPaused public
51,958
95
// Withdraw functions
function _withdraw(bytes memory _proof, uint256 amount, bytes32 _root, bytes32 _nullifierHash, address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund,
function _withdraw(bytes memory _proof, uint256 amount, bytes32 _root, bytes32 _nullifierHash, address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund,
79,475
35
// Recovers ERC2O tokens sent by mistake to the contractRecovers ERC2O tokens sent by mistake to the contracttoken Address tof the EC2O token return bool: success/
function recoverERC20(address token) external onlyOwner nonReentrant returns(bool) { if(rewardTokens[token]) revert Errors.CannotRecoverToken(); uint256 amount = IERC20(token).balanceOf(address(this)); if(amount == 0) revert Errors.NullAmount(); IERC20(token).safeTransfer(owner(), am...
function recoverERC20(address token) external onlyOwner nonReentrant returns(bool) { if(rewardTokens[token]) revert Errors.CannotRecoverToken(); uint256 amount = IERC20(token).balanceOf(address(this)); if(amount == 0) revert Errors.NullAmount(); IERC20(token).safeTransfer(owner(), am...
24,074
3
// sends the unlocked amount of TRIBE to the stakingRewards contract/ return amount of TRIBE sent
function drip() public override postGenesis whenNotPaused nonContract returns(uint256) { require(isDripAvailable(), "FeiRewardsDistributor: Not passed drip frequency"); // solhint-disable-next-line not-rely-on-time lastDistributionTime = block.timestamp; uint amount = releasedReward...
function drip() public override postGenesis whenNotPaused nonContract returns(uint256) { require(isDripAvailable(), "FeiRewardsDistributor: Not passed drip frequency"); // solhint-disable-next-line not-rely-on-time lastDistributionTime = block.timestamp; uint amount = releasedReward...
3,558
48
// after tokenLockEndTime owner Token
function withdrawTokenToInvestorOwner(address _investorAddr) public onlyOwner returns(bool){ require(_investorAddr != address(0), ""); require(now > tokenLockEndTime, ""); Investor memory investor = investorMap[_investorAddr]; if(investor.isLocked && now > investor.endTime && !freeze...
function withdrawTokenToInvestorOwner(address _investorAddr) public onlyOwner returns(bool){ require(_investorAddr != address(0), ""); require(now > tokenLockEndTime, ""); Investor memory investor = investorMap[_investorAddr]; if(investor.isLocked && now > investor.endTime && !freeze...
43,527
3
// Permissions mapping system
struct Perms { bool Grantee; bool Burner; }
struct Perms { bool Grantee; bool Burner; }
60,201
19
// This method relies in extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution.
uint256 size;
uint256 size;
3,947
12
// ,address _serviceFeeAddress, uint256 _serviceCost
) /*payable*/ { nftCollection = _nftCollection; rewardsToken = _rewardsToken; rewardsPerHour = _StakingReward; // payable(_serviceFeeAddress).transfer(_serviceCost); }
) /*payable*/ { nftCollection = _nftCollection; rewardsToken = _rewardsToken; rewardsPerHour = _StakingReward; // payable(_serviceFeeAddress).transfer(_serviceCost); }
33,656
192
// Get the current challenge of the given staker staker Staker address to lookupreturn Current challenge of the staker /
function currentChallenge(address staker) public view override returns (address) { return _stakerMap[staker].currentChallenge; }
function currentChallenge(address staker) public view override returns (address) { return _stakerMap[staker].currentChallenge; }
47,645
90
// } else { return; } } }
13,653
8
// generate random from block number
uint randomIndex = (block.number / currentItem.itemTokens.length)% currentItem.itemTokens.length;
uint randomIndex = (block.number / currentItem.itemTokens.length)% currentItem.itemTokens.length;
40,640
12
// Check if number of Lemon Tokens to issue is higher than coins remaining for airdrop (last transaction of airdrop)
if (tokensIssued > lemonsRemainingToDrop) tokensIssued = lemonsRemainingToDrop;
if (tokensIssued > lemonsRemainingToDrop) tokensIssued = lemonsRemainingToDrop;
70,682
193
// Order must be targeted at this protocol version (this Exchange contract). /
if (order.exchange != address(this)) { return false; }
if (order.exchange != address(this)) { return false; }
4,789
2
// Claim an erc20 claim token for a single ticket token
function claim(uint256 ticketTokenId, address claimToken) external;
function claim(uint256 ticketTokenId, address claimToken) external;
22,252
142
// All we care about is the ratio of each coin
function balances(int128 arg0) external returns (uint256 out);
function balances(int128 arg0) external returns (uint256 out);
48,296
102
// array of PoolStake contracts
address[] private _poolStakes;
address[] private _poolStakes;
61,460
61
// Check submission count & set minipool withdrawable
RocketDAONodeTrustedInterface rocketDAONodeTrusted = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted")); if (calcBase.mul(submissionCount).div(rocketDAONodeTrusted.getMemberCount()) >= rocketDAOProtocolSettingsNetwork.getNodeConsensusThreshold()) { setMinipoolWithdrawa...
RocketDAONodeTrustedInterface rocketDAONodeTrusted = RocketDAONodeTrustedInterface(getContractAddress("rocketDAONodeTrusted")); if (calcBase.mul(submissionCount).div(rocketDAONodeTrusted.getMemberCount()) >= rocketDAOProtocolSettingsNetwork.getNodeConsensusThreshold()) { setMinipoolWithdrawa...
69,001
11
// message unnecessarily. For custom revert reasons use {trySub}. Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow. /
function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; }
function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; }
23,773
11
// 4.Butta
balanceOf[0x3CB617913C6Ab9b4bc0CF17C2fAEBe3149E58dC6] = TOKEN_FOR_INDIVIDUAL * 10 ** uint256(decimals) * 2 / 100; balanceOf[0x39535CfC26F74F73C2508922140c5859B733ec67] = TOKEN_FOR_INDIVIDUAL * 10 ** uint256(decimals) * 2 / 100; balanceOf[0x7906A41853dA81E0e1bC122687C47fc4fb02e1e8] = TOKEN_FOR_INDIVIDUAL * 10 ** u...
balanceOf[0x3CB617913C6Ab9b4bc0CF17C2fAEBe3149E58dC6] = TOKEN_FOR_INDIVIDUAL * 10 ** uint256(decimals) * 2 / 100; balanceOf[0x39535CfC26F74F73C2508922140c5859B733ec67] = TOKEN_FOR_INDIVIDUAL * 10 ** uint256(decimals) * 2 / 100; balanceOf[0x7906A41853dA81E0e1bC122687C47fc4fb02e1e8] = TOKEN_FOR_INDIVIDUAL * 10 ** u...
16,926
23
// Modifier to check if the caller is the owner of the nftAddress
modifier onlyNFTOwner(address nftAddress) { ICaptrizERC1155 nftContract = ICaptrizERC1155(nftAddress); require( nftContract.owner() == msg.sender, "Not the owner of this NFT address" ); _; }
modifier onlyNFTOwner(address nftAddress) { ICaptrizERC1155 nftContract = ICaptrizERC1155(nftAddress); require( nftContract.owner() == msg.sender, "Not the owner of this NFT address" ); _; }
20,170
156
// GET - The address of the Smart Contract whose code will serve as a model for all the Native EthItems.Every EthItem will have its own address, but the code will be cloned from this one. /
function nativeModel() external view returns (address nativeModelAddress, uint256 nativeModelVersion);
function nativeModel() external view returns (address nativeModelAddress, uint256 nativeModelVersion);
18,613
0
// Interface declaration from: https:github.com/ethereum/eips/issues/20
contract ERC20Interface { //from: https://github.com/OpenZeppelin/zeppelin-solidity/blob/b395b06b65ce35cac155c13d01ab3fc9d42c5cfb/contracts/token/ERC20Basic.sol uint256 public totalSupply; //tokens that can vote, transfer, receive dividend function balanceOf(address who) public constant returns (uint256); ...
contract ERC20Interface { //from: https://github.com/OpenZeppelin/zeppelin-solidity/blob/b395b06b65ce35cac155c13d01ab3fc9d42c5cfb/contracts/token/ERC20Basic.sol uint256 public totalSupply; //tokens that can vote, transfer, receive dividend function balanceOf(address who) public constant returns (uint256); ...
8,369
4
// Numerical approximation of the tangent function,using the fact that sin(x)/cos(x) = tan(x). theta: angle in radians digits: digits of precision of the anglereturn tan(x) Example input:tan(11,1) => tan(1.1) tan(3,0) => tan(3) /
function tan(int256 theta, uint8 digits) public pure returns(int256) { return (FixidityLib.divide(sin(theta, digits), cos(theta, digits))); /** Taylor series approximation of tan(x), but is poor near asymptotes. * int256 x = FixidityLib.newFixed(theta, digits); int256 _2pi ...
function tan(int256 theta, uint8 digits) public pure returns(int256) { return (FixidityLib.divide(sin(theta, digits), cos(theta, digits))); /** Taylor series approximation of tan(x), but is poor near asymptotes. * int256 x = FixidityLib.newFixed(theta, digits); int256 _2pi ...
32,787
68
// Check initialize parameters
if ( initializePackedParameters.pendingStateTimeout > _HALT_AGGREGATION_TIMEOUT ) { revert PendingStateTimeoutExceedHaltAggregationTimeout(); }
if ( initializePackedParameters.pendingStateTimeout > _HALT_AGGREGATION_TIMEOUT ) { revert PendingStateTimeoutExceedHaltAggregationTimeout(); }
6,221
337
// config event mint parameters.
function setMintEventConfig( uint256 _eventID, address _mintFeeToken, uint256 _mintFeeAmount, uint256 _mintMaxCount, uint256 _mintTimeStart,uint256 _mintTimeEnd, uint256 _oneTimeMaxCount,
function setMintEventConfig( uint256 _eventID, address _mintFeeToken, uint256 _mintFeeAmount, uint256 _mintMaxCount, uint256 _mintTimeStart,uint256 _mintTimeEnd, uint256 _oneTimeMaxCount,
18,199
314
// return l2Block return L2 block when the L2 tx was initiated or 0 if no L2 to L1 transaction is active
function l2ToL1Block() external view returns (uint256);
function l2ToL1Block() external view returns (uint256);
11,419
9
// Ensures the caller is authorized to upgrade the contract/This function is called in `upgradeTo` & `upgradeToAndCall`/_newImpl The new implementation address
function _authorizeUpgrade(address _newImpl) internal override onlyOwner {} }
function _authorizeUpgrade(address _newImpl) internal override onlyOwner {} }
4,624
98
// address(this),adds no entropy
blockhash(blockn), entropy) ));
blockhash(blockn), entropy) ));
29,010
2
// emitted every time a user is added to the leaderboard
event LogAddToLeaderboard(address _user, address _market, uint256 _card);
event LogAddToLeaderboard(address _user, address _market, uint256 _card);
28,318
33
// AllowanceTarget contract /
contract AllowanceTarget is IAllowanceTarget { using Address for address; uint256 constant private TIME_LOCK_DURATION = 1 days; address public spender; address public newSpender; uint256 public timelockExpirationTime; modifier onlySpender() { require(spender == msg.sender, "AllowanceT...
contract AllowanceTarget is IAllowanceTarget { using Address for address; uint256 constant private TIME_LOCK_DURATION = 1 days; address public spender; address public newSpender; uint256 public timelockExpirationTime; modifier onlySpender() { require(spender == msg.sender, "AllowanceT...
26,388
2
// working day shift feature, to make YMD shifted of block.timestamp cases:Paris local time from block.timestamp (GMT) + 1 hourlocalShift = truepositiveShift = 16060 NewYork local time from block.timestamp (GMT) - 5 hourlocalShift = falsepositiveShift = 56060 Tokyo local time from block.timestamp (GMT) + 9 hourlocalShi...
bool public positiveShift; uint256 public localShift;
bool public positiveShift; uint256 public localShift;
17,728
71
// Get pool total supply
uint256 poolTotalSupply = pool.totalSupply();
uint256 poolTotalSupply = pool.totalSupply();
24,801
26
// existing token address
address public tokenAddress;
address public tokenAddress;
81,001
291
// https:docs.pynthetix.io/contracts/source/contracts/pynthetix
contract Perifi is BasePynthetix { // ========== CONSTRUCTOR ========== constructor( address payable _proxy, TokenState _tokenState, address _owner, uint _totalSupply, address _resolver ) public BasePynthetix(_proxy, _tokenState, _owner, _totalSupply, _resolver) {} ...
contract Perifi is BasePynthetix { // ========== CONSTRUCTOR ========== constructor( address payable _proxy, TokenState _tokenState, address _owner, uint _totalSupply, address _resolver ) public BasePynthetix(_proxy, _tokenState, _owner, _totalSupply, _resolver) {} ...
1,752
14
// OnlyOnTime only if the call of the function is within the auction time, the transaction will be executed
modifier OnlyOnTime(string memory name) { require(now < NameToOwner[name].TimeLimit, "The auction has finished."); _; }
modifier OnlyOnTime(string memory name) { require(now < NameToOwner[name].TimeLimit, "The auction has finished."); _; }
16,304
6
// returns the number of settleable invocations for project `_projectId`.
function getNumSettleableInvocations( uint256 _projectId ) external view returns (uint256 numSettleableInvocations);
function getNumSettleableInvocations( uint256 _projectId ) external view returns (uint256 numSettleableInvocations);
37,874
0
// constants
uint256 public constant FULL_VESTING = 1e18;
uint256 public constant FULL_VESTING = 1e18;
19,217
63
// Returns the substraction of two unsigned integers, with an overflow flag. _Available since v3.4._/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } }
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } }
24,494
11
// Computes the token0 and token1 value for a given amount of liquidity, the current/ pool prices and the prices at the tick boundaries/sqrtRatioX96 A sqrt price representing the current pool prices/sqrtRatioAX96 A sqrt price representing the first tick boundary/sqrtRatioBX96 A sqrt price representing the second tick b...
function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity
function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity
14,957
1
// Event for tracking updated maintainer fee.maintainerFee - new maintainer fee./
event MaintainerFeeUpdated(uint256 maintainerFee);
event MaintainerFeeUpdated(uint256 maintainerFee);
16,091
87
// ---------- INTERNAL FUNCTIONS ---------- /
{ require( _msgSender() != address(0), "caller is the zero address" ); require(_weiAmount != 0, "weiAmount is 0"); require( block.timestamp >= startDate && block.timestamp <= endDate, "sale period is ended" ); if (_buyT...
{ require( _msgSender() != address(0), "caller is the zero address" ); require(_weiAmount != 0, "weiAmount is 0"); require( block.timestamp >= startDate && block.timestamp <= endDate, "sale period is ended" ); if (_buyT...
10,139
2
// Must be a positive supply of the Set
require( totalSupply() > 0, "Invalid supply" );
require( totalSupply() > 0, "Invalid supply" );
51,218
2
// uint256[] memory items;
for (uint256 i = 0; i < players.length; i++) { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _mint(players[i], newItemId); _setTokenURI(newItemId, tokenURI);
for (uint256 i = 0; i < players.length; i++) { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _mint(players[i], newItemId); _setTokenURI(newItemId, tokenURI);
2,263
16
// Custom Transaction Context/ See more: https:remix-ide.readthedocs.io/en/latest/unittesting.htmlcustomization/ sender: account-0/ value: 1375748393000
function checkBasicTransactionSafemoonStyle() public { uint256 transferAmount = 1375748393000; uint256 originalBalance0 = balanceOf(TestsAccounts.getAccount(0)); uint256 originalBalance1 = balanceOf(TestsAccounts.getAccount(1)); transferTaxFree(TestsAccounts.getAccount(1),tr...
function checkBasicTransactionSafemoonStyle() public { uint256 transferAmount = 1375748393000; uint256 originalBalance0 = balanceOf(TestsAccounts.getAccount(0)); uint256 originalBalance1 = balanceOf(TestsAccounts.getAccount(1)); transferTaxFree(TestsAccounts.getAccount(1),tr...
50,888
36
// Set Recommend Lock position Reward and unlock rate RecomReward Recommend Lock position Reward rate RecomReward Recommend Lock position unlock rate /
function setRecommendReward(uint RecomReward,uint RecomUnlock)public onlyOwner RateLimit(RecomReward) RateLimit(RecomUnlock)
function setRecommendReward(uint RecomReward,uint RecomUnlock)public onlyOwner RateLimit(RecomReward) RateLimit(RecomUnlock)
46,651
2
// Returns the SECP256k1 public key associated with an ENS node.Defined in EIP 619. node The ENS node to queryreturn x The X coordinate of the curve point for the public key.return y The Y coordinate of the curve point for the public key. /
function pubkey(bytes32 node) virtual override external view returns (bytes32 x, bytes32 y) { return (pubkeys[node].x, pubkeys[node].y); }
function pubkey(bytes32 node) virtual override external view returns (bytes32 x, bytes32 y) { return (pubkeys[node].x, pubkeys[node].y); }
6,728
74
// If the delegator orders their entire stake, remove the delegator from delegator list of the pool
_removePoolDelegator(_poolStakingAddress, staker);
_removePoolDelegator(_poolStakingAddress, staker);
25,615
3
// Emitted when the implementation returned by the beacon is changed.implementation address /
event Upgraded(address indexed implementation); uint256 public nonce;
event Upgraded(address indexed implementation); uint256 public nonce;
42,360
8
// Getter for the amount of Ether already released to a payee. /
function released(address account) public view returns (uint256) { return _released[account]; }
function released(address account) public view returns (uint256) { return _released[account]; }
23,185
819
// Reads the uint40 at `mPtr` in memory.
function readUint40(MemoryPointer mPtr) internal pure returns (uint40 value) { assembly { value := mload(mPtr) } }
function readUint40(MemoryPointer mPtr) internal pure returns (uint40 value) { assembly { value := mload(mPtr) } }
23,752
5
// Make a forked token to dispute a claim. This avoid creating a token all the time, since most milestones should not be disputed._milestoneID The ID of the milestone. /
function makeVoteToken(uint _milestoneID) public { Milestone storage milestone=milestones[_milestoneID]; if( ousterID != _milestoneID ) { require(milestone.claimTime!=0); } // The milestone is currently claimed by the team, unless this is the ouster. require(address(milestone.voteToken)==0x0...
function makeVoteToken(uint _milestoneID) public { Milestone storage milestone=milestones[_milestoneID]; if( ousterID != _milestoneID ) { require(milestone.claimTime!=0); } // The milestone is currently claimed by the team, unless this is the ouster. require(address(milestone.voteToken)==0x0...
39,883
244
// reverts if the caller does not have access /
modifier checkAccess() { require(hasAccess(msg.sender, msg.data), "No access"); _; }
modifier checkAccess() { require(hasAccess(msg.sender, msg.data), "No access"); _; }
44,748
30
// check that the value sent with the function is at least the token price
require(msg.value >= tokenPrices[tokenId] + fee, string(abi.encodePacked("Payment is not enough. Don't forget the fee which is of 10% of the sale price")));
require(msg.value >= tokenPrices[tokenId] + fee, string(abi.encodePacked("Payment is not enough. Don't forget the fee which is of 10% of the sale price")));
20,509
1
// Minting constants
uint256 public maxMintPerTransaction; uint256 public MINT_SUPPLY_PER_FACTION; uint256 public TEAM_SUPPLY_PER_FACTION;
uint256 public maxMintPerTransaction; uint256 public MINT_SUPPLY_PER_FACTION; uint256 public TEAM_SUPPLY_PER_FACTION;
27,153
47
// модификатор onlyOwnerOf гарантирует, что owner = msg.senderaddress owner = ownerOf(_unicornId);
require(_to != msg.sender); if (approvedFor(_unicornId) != address(0) || _to != address(0)) { unicornApprovals[_unicornId] = _to; emit Approval(msg.sender, _to, _unicornId); }
require(_to != msg.sender); if (approvedFor(_unicornId) != address(0) || _to != address(0)) { unicornApprovals[_unicornId] = _to; emit Approval(msg.sender, _to, _unicornId); }
28,116
9
// Add battle request
BattleRequest memory newRequest; newRequest.pepeId = _pepeId; newRequest.amount = _amount; newRequest.player = msg.sender; battleRequests.push(newRequest); emit StakedForBattle(_pepeId, _amount, msg.sender);
BattleRequest memory newRequest; newRequest.pepeId = _pepeId; newRequest.amount = _amount; newRequest.player = msg.sender; battleRequests.push(newRequest); emit StakedForBattle(_pepeId, _amount, msg.sender);
19,766
43
// Holders can redeem their tokens to claim the project's overflowed tokens, or to trigger rules determined by the project's current funding cycle's data source./Only a token holder or a designated operator can redeem its tokens./_holder The account to redeem tokens for./_projectId The ID of the project to which the to...
function redeemTokensOf( address _holder, uint256 _projectId, uint256 _tokenCount, address _token, uint256 _minReturnedTokens, address payable _beneficiary, string memory _memo, bytes memory _metadata )
function redeemTokensOf( address _holder, uint256 _projectId, uint256 _tokenCount, address _token, uint256 _minReturnedTokens, address payable _beneficiary, string memory _memo, bytes memory _metadata )
30,169