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
293
// point = g^2.
point := mulmod(point, /*traceGenerator^2*/ mload(expmodsAndPoints), PRIME)
point := mulmod(point, /*traceGenerator^2*/ mload(expmodsAndPoints), PRIME)
28,993
174
// assert there is message to retry
FailedMessages storage failedMsg = failedMessages[_srcChainId][_srcAddress][_nonce]; require(failedMsg.payloadHash != bytes32(0), "NonblockingReceiver: no stored message"); require(_payload.length == failedMsg.payloadLength && keccak256(_payload) == failedMsg.payloadHash, "LayerZero: invalid pay...
FailedMessages storage failedMsg = failedMessages[_srcChainId][_srcAddress][_nonce]; require(failedMsg.payloadHash != bytes32(0), "NonblockingReceiver: no stored message"); require(_payload.length == failedMsg.payloadLength && keccak256(_payload) == failedMsg.payloadHash, "LayerZero: invalid pay...
2,924
7
// emit Event
emit PhotoNFTCreated(msg.sender, currentPhotoId); currentPhotoId++;
emit PhotoNFTCreated(msg.sender, currentPhotoId); currentPhotoId++;
31,186
104
// Total staked cards by user /
function balanceOf(uint256 tokenId, address account) external view returns (uint256) { return nftTokenMap[tokenId].balances[account]; }
function balanceOf(uint256 tokenId, address account) external view returns (uint256) { return nftTokenMap[tokenId].balances[account]; }
39,131
19
// Initialize the core with an initial node initialNode Initial node to start the chain with /
function initializeCore(INode initialNode) internal { _nodes[0] = initialNode; _firstUnresolvedNode = 1; }
function initializeCore(INode initialNode) internal { _nodes[0] = initialNode; _firstUnresolvedNode = 1; }
19,646
79
// Update the current timestamp.
self.limitTimestamp = now;
self.limitTimestamp = now;
16,923
14
// Deri Protocol migratable pool implementation /
abstract contract MigratablePool is IMigratablePool { // Controller address address _controller; // Migration timestamp of this pool, zero means not set // Migration timestamp can only be set with a grace period at least 3 days, and the // `migrationDestination` pool address must be also set when ...
abstract contract MigratablePool is IMigratablePool { // Controller address address _controller; // Migration timestamp of this pool, zero means not set // Migration timestamp can only be set with a grace period at least 3 days, and the // `migrationDestination` pool address must be also set when ...
51,685
90
// Function to recover any ERC20 Tokens sent to Contract by Mistake./
function recoverAnyERC20TokensFromContract(address _tokenAddr, address _to, uint _amount) public onlyOwner { IERC20(_tokenAddr).transfer(_to, _amount); }
function recoverAnyERC20TokensFromContract(address _tokenAddr, address _to, uint _amount) public onlyOwner { IERC20(_tokenAddr).transfer(_to, _amount); }
18,090
26
// 0 => withdraw1 => predefinedCall2 => uniswap//Gets the detail of a specific locked amount created for a pool._callData (optional) Contains customized instructions such as "external call to uniswap smart contract"._lockAddress The address that created the lock._predefinedCall Some predefined instructions available._c...
function fulfillLock( bytes memory _callData, //deposit,addresses address _lockAddress, uint256 _predefinedCall, address _callContractAddress, string memory _indexStr, // to be reviewed uint256 _index // to be reviewed ) public onlyLoker(_lockAddress, _ind...
function fulfillLock( bytes memory _callData, //deposit,addresses address _lockAddress, uint256 _predefinedCall, address _callContractAddress, string memory _indexStr, // to be reviewed uint256 _index // to be reviewed ) public onlyLoker(_lockAddress, _ind...
7,823
23
// Tells whether the msg.sender is approved for the given token ID or not _asker address of asking for approval _tokenId uint256 ID of the token to query the approval ofreturn bool whether the msg.sender is approved for the given token ID or not /
function isSpecificallyApprovedFor(address _asker, uint256 _tokenId) internal view returns (bool) { return getApproved(_tokenId) == _asker; }
function isSpecificallyApprovedFor(address _asker, uint256 _tokenId) internal view returns (bool) { return getApproved(_tokenId) == _asker; }
35,198
35
// Return the total amount of tokens that are being escrowed for a specific accountwho The address for which we calculate the amount of tokens that are still waiting to be unlocked/
function getTokensBeingEscrowed(address who) public view returns (uint256) { if (oldestEscrowSlot[who] >= currentEscrowSlot[who]) return 0; EscrowSlot memory escrowReward; uint256 totalEscrowed; uint256 endDate; for (uint i = oldestEscrowSlot[who]; i <= currentEscrowSlot[w...
function getTokensBeingEscrowed(address who) public view returns (uint256) { if (oldestEscrowSlot[who] >= currentEscrowSlot[who]) return 0; EscrowSlot memory escrowReward; uint256 totalEscrowed; uint256 endDate; for (uint i = oldestEscrowSlot[who]; i <= currentEscrowSlot[w...
34,611
596
// Returns the normalized weight of `token`. Weights are fixed point numbers that sum to FixedPoint.ONE. /
function _getNormalizedWeight(IERC20 token) internal view virtual returns (uint256);
function _getNormalizedWeight(IERC20 token) internal view virtual returns (uint256);
7,375
22
// Contract address that can override globalFixedNativeFee
address public feeContractUpdater;
address public feeContractUpdater;
71,799
26
// make sure m_numOwners is equal to the number of owners and always points to the last owner
reorganizeOwners(); assertOwnersAreConsistent(); emit OwnerRemoved(_owner);
reorganizeOwners(); assertOwnersAreConsistent(); emit OwnerRemoved(_owner);
40,794
37
// Returns the current block number.Using a function rather than `block.number` allows us to easily mock the block number intests./
function getBlockNumber() internal view returns (uint256) { return block.number; }
function getBlockNumber() internal view returns (uint256) { return block.number; }
13,046
1
// the oracle can transfer tokens to any address sender is the address in the child chain for which the tokens were burned recipient is the address which will get the tokens on the parent chain/
function transfer(address from, address to, uint256 amount, address token, uint256 nonce, uint8 v, bytes32 r, bytes32 s)
function transfer(address from, address to, uint256 amount, address token, uint256 nonce, uint8 v, bytes32 r, bytes32 s)
31,374
19
// tax is 0.225% above 60,000 trades
taxNumerator = 225;
taxNumerator = 225;
37,781
41
// Generic proxy
function execute( address _to, uint256 _value, bytes calldata _data
function execute( address _to, uint256 _value, bytes calldata _data
35,023
7
// Changes the multiplier for challengers' deposit._challengeMultiplier A new value of the multiplier for calculating challenger's deposit. In basis points. /
function changeChallengeMultiplier(uint256 _challengeMultiplier) public onlyOwner { challengeMultiplier = _challengeMultiplier; }
function changeChallengeMultiplier(uint256 _challengeMultiplier) public onlyOwner { challengeMultiplier = _challengeMultiplier; }
45,478
319
// Allow users to sign a message authorizing a sell
function permitSell( address _from, address payable _to, uint _quantityToSell, uint _minCurrencyReturned, uint _deadline, uint8 _v, bytes32 _r, bytes32 _s ) external
function permitSell( address _from, address payable _to, uint _quantityToSell, uint _minCurrencyReturned, uint _deadline, uint8 _v, bytes32 _r, bytes32 _s ) external
29,741
11
// wizards earn 12000 $GP per day
uint256 public constant DAILY_GP_RATE = 12000 ether;
uint256 public constant DAILY_GP_RATE = 12000 ether;
13,293
42
// Determines how many Patrons are issues per donation
uint256 public donationMultiplier;
uint256 public donationMultiplier;
34,492
140
// we are paying out the stake
exitStake.paid = true; totalWithdraw = totalWithdraw.add(_totalExpected(exitStake));
exitStake.paid = true; totalWithdraw = totalWithdraw.add(_totalExpected(exitStake));
9,929
103
// place creation code and constructor args of contract to spawn in memory.
initCode = abi.encodePacked( type(Spawn).creationCode, abi.encode(logicContract, initializationCalldata) );
initCode = abi.encodePacked( type(Spawn).creationCode, abi.encode(logicContract, initializationCalldata) );
39,183
25
// Auto-generated via 'PrintMaxExpArray.py'
uint256[128] private maxExpArray;
uint256[128] private maxExpArray;
14,292
87
// Name and symbol were updated. // Minimum ammount of tokens every buyer can buy. //Construct the token. This token must be created through a team multisig wallet, so that it is owned by that wallet._name Token name _symbol Token symbol - should be all caps _initialSupply How many tokens we start with _decimals Number...
function CrowdsaleTokenExt(string _name, string _symbol, uint _initialSupply, uint _decimals, bool _mintable, uint _globalMinCap)
function CrowdsaleTokenExt(string _name, string _symbol, uint _initialSupply, uint _decimals, bool _mintable, uint _globalMinCap)
5,026
144
// require(addresses[i].isContract(), "Role address need contract only");
if (setTo[i]) { grantRole(roleType, addresses[i]); } else {
if (setTo[i]) { grantRole(roleType, addresses[i]); } else {
41,390
179
// The Prepaid Aggregator contract Handles aggregating data pushed in from off-chain, and unlockspayment for oracles as they report. Oracles' submissions are gathered inrounds, with each round aggregating the submissions for each oracle into asingle answer. The latest aggregated answer is exposed as well as historicala...
contract FluxAggregator is AggregatorV2V3Interface, Owned { using SafeMath for uint256; using SafeMath128 for uint128; using SafeMath64 for uint64; using SafeMath32 for uint32; struct Round { int256 answer; uint64 startedAt; uint64 updatedAt; uint32 answeredInRound; } struct RoundDetails...
contract FluxAggregator is AggregatorV2V3Interface, Owned { using SafeMath for uint256; using SafeMath128 for uint128; using SafeMath64 for uint64; using SafeMath32 for uint32; struct Round { int256 answer; uint64 startedAt; uint64 updatedAt; uint32 answeredInRound; } struct RoundDetails...
14,405
168
// OVERRIDEadd account to whitelist & create a snapshot of current balanceaccount address/
function addWhitelisted(address account) public { super.addWhitelisted(account); uint256 balance = balanceOf(account); _createAccountSnapshot(account, balance); uint256 newSupplyValue = totalSupplyAt(now).add(balance); _createTotalSupplySnapshot(account, newSupplyValue); ...
function addWhitelisted(address account) public { super.addWhitelisted(account); uint256 balance = balanceOf(account); _createAccountSnapshot(account, balance); uint256 newSupplyValue = totalSupplyAt(now).add(balance); _createTotalSupplySnapshot(account, newSupplyValue); ...
4,125
26
// Calculates the price of a VRF request with the given callbackGasLimit at the current block.This function relies on the transaction gas price which is not automatically set during simulation. To estimate the price at a specific gas price, use the estimatePrice function._callbackGasLimit is the gas limit used to estim...
function calculateRequestPrice(uint32 _callbackGasLimit) external view returns (uint256);
function calculateRequestPrice(uint32 _callbackGasLimit) external view returns (uint256);
3,156
0
// ISafeGnosis interface.
ISafeGnosis public safeGnosis;
ISafeGnosis public safeGnosis;
42,111
35
// Internal function that mints an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted._account The account that will receive the created tokens._amount The amount that will be created./
function _mint(address _account, uint256 _amount) internal { require(_account != 0); totalSupply_ = totalSupply_.add(_amount); balances[_account] = balances[_account].add(_amount); emit Transfer(address(0), _account, _amount); }
function _mint(address _account, uint256 _amount) internal { require(_account != 0); totalSupply_ = totalSupply_.add(_amount); balances[_account] = balances[_account].add(_amount); emit Transfer(address(0), _account, _amount); }
30,113
4
// store accounts that have voted
mapping(address => Voter) private voters;
mapping(address => Voter) private voters;
13,637
16
// transfer token from reward contract to lock contract
token.safeTransferFrom(msg.sender, address(this), quantity);
token.safeTransferFrom(msg.sender, address(this), quantity);
13,648
177
// Update Public Sale Cost
function setPublicPrice(uint256 _newPublicPrice) public onlyOwner { PublicPrice = _newPublicPrice; }
function setPublicPrice(uint256 _newPublicPrice) public onlyOwner { PublicPrice = _newPublicPrice; }
30,512
10
// Event emitted upon a withdrawal with timelock
event TimelockedWithdrawal( address indexed operator, address indexed from, address indexed token, uint256 amount, uint256 unlockTimestamp ); event ReserveWithdrawal( address indexed to,
event TimelockedWithdrawal( address indexed operator, address indexed from, address indexed token, uint256 amount, uint256 unlockTimestamp ); event ReserveWithdrawal( address indexed to,
14,328
11
// Broadcast deposit event
emit DepositMade(msg.sender, msg.value); // fire event return balances[msg.sender];
emit DepositMade(msg.sender, msg.value); // fire event return balances[msg.sender];
33,193
194
// Emit batch mint event
emit TransferBatch(operator, origin, _to, _ids, _amounts);
emit TransferBatch(operator, origin, _to, _ids, _amounts);
27,327
63
// add addresses to the whitelist _operators addressesreturn true if at least one address was added to the whitelist,false if all addresses were already in the whitelist /
function addAddressesToWhitelist(address[] _operators) public onlyOwner { for (uint256 i = 0; i < _operators.length; i++) { addAddressToWhitelist(_operators[i]); } }
function addAddressesToWhitelist(address[] _operators) public onlyOwner { for (uint256 i = 0; i < _operators.length; i++) { addAddressToWhitelist(_operators[i]); } }
32,848
3
// ---------------------- MODIFIERS ----------------------
modifier onlyExistsTicket(uint256 tier, uint256 amount) { require(amount > 0, "Amount of tickets must be higher than 0"); Ticket memory _ticket = _tierToTicket[tier]; require(_ticket.tier != 0, "Ticket is not exist"); _; }
modifier onlyExistsTicket(uint256 tier, uint256 amount) { require(amount > 0, "Amount of tickets must be higher than 0"); Ticket memory _ticket = _tierToTicket[tier]; require(_ticket.tier != 0, "Ticket is not exist"); _; }
5,393
12
// ------------------------------------------------------------------------ Get the token balance for account tokenOwner ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; }
function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; }
2,008
21
// _link is the address of LinkToken _vrfV2Wrapper is the address of the VRFV2Wrapper contract /
constructor(address _link, address _vrfV2Wrapper) { LINK = LinkTokenInterface(_link); VRF_V2_WRAPPER = VRFV2WrapperInterface(_vrfV2Wrapper); }
constructor(address _link, address _vrfV2Wrapper) { LINK = LinkTokenInterface(_link); VRF_V2_WRAPPER = VRFV2WrapperInterface(_vrfV2Wrapper); }
23,477
45
// Internal function to add a token ID to the list of a given address_to address representing the new owner of the given token ID_tokenId uint256 ID of the token to be added to the tokens list of the given address/
function addToken(address _to, uint256 _tokenId) private { require(tokenOwner[_tokenId] == address(0)); tokenOwner[_tokenId] = _to; uint256 length = balanceOf(_to); ownedTokens[_to].push(_tokenId); ownedTokensIndex[_tokenId] = length; totalTokens = totalTokens.add(1); }
function addToken(address _to, uint256 _tokenId) private { require(tokenOwner[_tokenId] == address(0)); tokenOwner[_tokenId] = _to; uint256 length = balanceOf(_to); ownedTokens[_to].push(_tokenId); ownedTokensIndex[_tokenId] = length; totalTokens = totalTokens.add(1); }
82,252
130
// When block number more than endReleaseBlock, all locked ALPACAs can be unlocked
else if (block.number >= endReleaseBlock) { return _locks[_account]; }
else if (block.number >= endReleaseBlock) { return _locks[_account]; }
11,197
54
// Sets the protocol management fee percentage/_managementFee The new management fee/Only Governance; base 1000, 1% = 10
function setManagementFee(uint256 _managementFee) external onlyGovernance { require(_managementFee > MIN_MANAGEMENT_FEE, "Registry: Invalid Mgmt"); require(_managementFee < MAX_MANAGEMENT_FEE, "Registry: Mgmt Too High"); managementFee = _managementFee; }
function setManagementFee(uint256 _managementFee) external onlyGovernance { require(_managementFee > MIN_MANAGEMENT_FEE, "Registry: Invalid Mgmt"); require(_managementFee < MAX_MANAGEMENT_FEE, "Registry: Mgmt Too High"); managementFee = _managementFee; }
8,741
96
// list of payees
address[] public payees; address private constant ETHER_ASSET = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address[] public payees; address private constant ETHER_ASSET = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
19,269
17
// for from, withdraw the revenue on the amount of token transferd
from.transfer(fromBonus); emit Transfer(from, to, amount); emit Withdraw(from, fromBonus);
from.transfer(fromBonus); emit Transfer(from, to, amount); emit Withdraw(from, fromBonus);
6,228
60
// distribute the Tokens
C4FToken C4F = C4FToken(owner);
C4FToken C4F = C4FToken(owner);
39,079
105
// Contains the functionality to transition the token to the open market using the market transtition contract.Requires that the market has reached the transition state. Transfers collateral into the market transition contract which then creates the uniswap market./
function _transition() internal { require( transitionConditionsMet, "Token has not met requirements for free market transition" ); address router = marketTransfterInstance.getRouterAddress(); uint256 tokensToMint = marketTransfterInstance.getTokensToMint(); ...
function _transition() internal { require( transitionConditionsMet, "Token has not met requirements for free market transition" ); address router = marketTransfterInstance.getRouterAddress(); uint256 tokensToMint = marketTransfterInstance.getTokensToMint(); ...
2,132
7
// A boolean for use in other contracts to halt execution if the oraclebecomes at of sync by (delay + 120) seconds. Throwing based on this function should be safe as the 120 second bufferaccounts for network congestion so it should always be true unless theoracle is unfunded. /
function priceNeedsUpdate() public constant returns (bool) { return block.timestamp > lastUpdated + delay + 120; }
function priceNeedsUpdate() public constant returns (bool) { return block.timestamp > lastUpdated + delay + 120; }
246
303
// Admin owned tokens can be rolled while paused for testing purposes, but no chance of jackpot
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || tokens[tid].level < paused_level,"Rolling paused"); require(num> 0 && num <= 10,"Number of rolls must be in range 1 - 10"); require(msg.value >= roll_price*num, "Must send minimum value to purchase!"); require(LINK.balanceOf(address(this...
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || tokens[tid].level < paused_level,"Rolling paused"); require(num> 0 && num <= 10,"Number of rolls must be in range 1 - 10"); require(msg.value >= roll_price*num, "Must send minimum value to purchase!"); require(LINK.balanceOf(address(this...
75,114
31
// address of additional reward token accured from investing via different strategies like wmatic.
IERC20[] public rewardTokens;
IERC20[] public rewardTokens;
24,776
201
// Overloaded method to enable short term backwards compatibility. Will be deprecated in the next DVM version.
function requestPrice(bytes32 identifier, uint256 time) public override { requestPrice(identifier, time, ""); }
function requestPrice(bytes32 identifier, uint256 time) public override { requestPrice(identifier, time, ""); }
21,302
1
// The address that is authorized to manage a validator or validator group and sign consensus messages on behalf of the account. The account can manage the validator, whether or not a validator signing key has been specified. However, if a validator signing key has been specified, only that key may actually participate...
address validator;
address validator;
15,168
16
// Returns index of non-fungible token
function getNonFungibleIndex(uint256 id) public pure returns (uint256) { return id & NF_INDEX; }
function getNonFungibleIndex(uint256 id) public pure returns (uint256) { return id & NF_INDEX; }
44,867
27
// END RESTRICTIONS//This function withdrawals assets to the target Ethereum address/asset_source Contract address for given ERC20 token/amount Amount of ERC20 tokens to withdraw/target Target Ethereum address to receive withdrawn ERC20 tokens/creation Timestamp of when requestion was created RESTRICTION FEATURE/nonce ...
function withdraw_asset(address asset_source, uint256 amount, address target, uint256 creation, uint256 nonce, bytes memory signatures) public override{ require(!is_stopped, "bridge stopped"); require(withdraw_thresholds[asset_source] > amount || creation + default_withdraw_delay <= block.timestamp,...
function withdraw_asset(address asset_source, uint256 amount, address target, uint256 creation, uint256 nonce, bytes memory signatures) public override{ require(!is_stopped, "bridge stopped"); require(withdraw_thresholds[asset_source] > amount || creation + default_withdraw_delay <= block.timestamp,...
31,478
14
// Defining addresses that have custom lockups periods
mapping(address => uint256) public lockupExpirations;
mapping(address => uint256) public lockupExpirations;
42,125
14
// get the send() LayerZero messaging library version_userApplication - the contract address of the user application
function getSendVersion( address _userApplication ) external view returns (uint16);
function getSendVersion( address _userApplication ) external view returns (uint16);
18,460
350
// if the current round does not exist create it
if(currentRound >= roundsPerCK.length) { roundsPerCK.push(); }
if(currentRound >= roundsPerCK.length) { roundsPerCK.push(); }
49,357
64
// --- Views ---
function isMaster(bytes32 network) public view returns (bool) { if (networks.length() == 0) return false; return network == networks.at((block.number / window) % networks.length()); }
function isMaster(bytes32 network) public view returns (bool) { if (networks.length() == 0) return false; return network == networks.at((block.number / window) % networks.length()); }
76,055
108
// Used to change `profitFactor`. `profitFactor` is used to determine if it's worthwhile to harvest, given gas costs. (See `harvestTrigger()` for more details.)This may only be called by governance or the strategist. _profitFactor A ratio to multiply anticipated`harvest()` gas cost against. /
function setProfitFactor(uint256 _profitFactor) external onlyAuthorized { profitFactor = _profitFactor; emit UpdatedProfitFactor(_profitFactor); }
function setProfitFactor(uint256 _profitFactor) external onlyAuthorized { profitFactor = _profitFactor; emit UpdatedProfitFactor(_profitFactor); }
9,192
41
// Functions based on Q64.96 sqrt price and liquidity/Aperture Finance/Modified from Uniswap (https:github.com/uniswap/v3-core/blob/main/contracts/libraries/SqrtPriceMath.sol)/Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas
library SqrtPriceMath { using UnsafeMath for *; using SafeCast for uint256; /// @notice Gets the next sqrt price given a delta of token0 /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least /// far enough to get the desired output amount,...
library SqrtPriceMath { using UnsafeMath for *; using SafeCast for uint256; /// @notice Gets the next sqrt price given a delta of token0 /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least /// far enough to get the desired output amount,...
23,850
19
// public variables for DAPP
uint public counterDeposits; uint public counterPercents; uint public counterBeneficiaries; uint public timeLastayment;
uint public counterDeposits; uint public counterPercents; uint public counterBeneficiaries; uint public timeLastayment;
53,669
156
// If there's no funding cycle, track this payment as having been made before a configuration.
if (_fundingCycle.number == 0) {
if (_fundingCycle.number == 0) {
16,952
148
// Variables changing during day to day interaction.
uint public session = 1; // Current session of the court. uint public lastPeriodChange; // The last time we changed of period (seconds). uint public segmentSize; // Size of the segment of activated tokens. uint public rnBlock; // The block linked with the RN which is requested. ui...
uint public session = 1; // Current session of the court. uint public lastPeriodChange; // The last time we changed of period (seconds). uint public segmentSize; // Size of the segment of activated tokens. uint public rnBlock; // The block linked with the RN which is requested. ui...
76,081
9
// Structure that defines the return data for a given call
struct ReturnData { // Whether the call should be successful bool success; // The data to return // If the call is unsuccessful, this is the reason for failure bytes data; }
struct ReturnData { // Whether the call should be successful bool success; // The data to return // If the call is unsuccessful, this is the reason for failure bytes data; }
46,787
54
// Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution ```solidity uint256 count = 5; console.log('count: %d', count); console.log('count:', count); ``` See `util.format()` for more information./
function log(string memory value1, address value2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address)", value1, value2)); }
function log(string memory value1, address value2) internal view { _sendLogPayload(abi.encodeWithSignature("log(string,address)", value1, value2)); }
22,169
7
// sanity check to ensure we don't overflow arithmetic (this big number is 2^128-1).
require(avePrice < 340282366920938463463374607431768211455); uint256 nextPrice = avePrice + (avePrice / 2);
require(avePrice < 340282366920938463463374607431768211455); uint256 nextPrice = avePrice + (avePrice / 2);
48,837
84
// Delegate votes from `msg.sender` to `delegatee` delegatee The address to delegate votes to /
function delegate(address delegatee) public { return _delegate(msg.sender, delegatee); }
function delegate(address delegatee) public { return _delegate(msg.sender, delegatee); }
672
110
// Reverts if the sender is not the auction's curator.
modifier onlyCurator(uint256 tokenId) { require( auctions[tokenId].curator == msg.sender, "Can only be called by auction curator" ); _; }
modifier onlyCurator(uint256 tokenId) { require( auctions[tokenId].curator == msg.sender, "Can only be called by auction curator" ); _; }
24,457
71
// AttendanceTokenControllerTEST Test various way to validate signatures in order to optimize gas consumption /
contract ParticipationTokenControllerTEST is Ownable { using SafeMath for uint256; //Variables mapping (address => bool) admin; // Who can sign messages mapping (address => mapping (uint256 => bool)) redeemedTokens; // Whether tokens where redeemed for an ID FrozenMintBurnToke...
contract ParticipationTokenControllerTEST is Ownable { using SafeMath for uint256; //Variables mapping (address => bool) admin; // Who can sign messages mapping (address => mapping (uint256 => bool)) redeemedTokens; // Whether tokens where redeemed for an ID FrozenMintBurnToke...
49,079
4
// this contract has an internal balance which can only be withdrawn by the owner of the contract.if you manage to pull all the value out of this contract you can trigger the winnerAnnounced event anddeclare yourself a winner! /
contract Honeypot is OwnablePausable { constructor() public payable { require(msg.value != 0); balance = msg.value; } uint public balance; event winnerAnnounced(address winner, string yourName); /** * @dev The transferBalance function sends the current balance of this contract to the owner, ...
contract Honeypot is OwnablePausable { constructor() public payable { require(msg.value != 0); balance = msg.value; } uint public balance; event winnerAnnounced(address winner, string yourName); /** * @dev The transferBalance function sends the current balance of this contract to the owner, ...
13,438
2
// : function to intiate a new auction Warning: In case the auction is expected to raise more than 2^96 units of the biddingToken, don't start the auction, as it will not be settlable. This corresponds to about 79 billion DAI. Prices between biddingToken and auctioningToken are expressed by a fraction whose components ...
function initiateAuction( address _auctioningToken, address _biddingToken, uint256 orderCancellationEndDate, uint256 auctionEndDate, uint96 _auctionedSellAmount, uint96 _minBuyAmount, uint256 minimumBiddingAmountPerOrder, uint256 minFundingThreshold, bool isAtomicClosureAllowed,
function initiateAuction( address _auctioningToken, address _biddingToken, uint256 orderCancellationEndDate, uint256 auctionEndDate, uint96 _auctionedSellAmount, uint96 _minBuyAmount, uint256 minimumBiddingAmountPerOrder, uint256 minFundingThreshold, bool isAtomicClosureAllowed,
10,430
118
// Update brrAndEpochData
updateBRRData(rewardBps, rebateBps, expiryTimestamp, epoch);
updateBRRData(rewardBps, rebateBps, expiryTimestamp, epoch);
11,913
6
// Token in which a reward is paid out with
address tokenAddress;
address tokenAddress;
48,395
19
// Returns true if the index has been marked claimed.
function isClaimed(uint256 index) external view returns (bool);
function isClaimed(uint256 index) external view returns (bool);
20,534
103
// Calculate final MILK tokens amount to transfer to the holder
undistributed = (undistributedCow.add(undistributedCowLP).add(undistributedMilkLP)).sub(devTeamFee);
undistributed = (undistributedCow.add(undistributedCowLP).add(undistributedMilkLP)).sub(devTeamFee);
48,077
103
// Allowes access to the uint variables saved in the apiUintVars under the requestDetails structfor the requestId specified _requestId to look up _data the variable to pull from the mapping. _data = keccak256("variable_name") where variable_name is the variables/strings used to save the data in the mapping. The variabl...
// function getRequestUintVars(uint _requestId,bytes32 _data) external view returns(uint){ // return tellor.getRequestUintVars(_requestId,_data); // }
// function getRequestUintVars(uint _requestId,bytes32 _data) external view returns(uint){ // return tellor.getRequestUintVars(_requestId,_data); // }
2,321
76
// given genes of current floor and dungeon seed, return a genetic combination - may have a random factor. _floorGenes Genes of floor. _seedGenes Seed genes of dungeon.return The resulting genes. /
function calculateResult(uint _floorGenes, uint _seedGenes) external returns (uint);
function calculateResult(uint _floorGenes, uint _seedGenes) external returns (uint);
42,777
7
// see{Accesscontrol}. emits {OwnershipTransferred} event.
function transferOwnership(address newOwner) external onlyRole("ADMIN_ROLE") returns (bool) { require( newOwner != address(0), "Ownable: new owner is the zero address" );
function transferOwnership(address newOwner) external onlyRole("ADMIN_ROLE") returns (bool) { require( newOwner != address(0), "Ownable: new owner is the zero address" );
26,785
40
// Fix the unlock time of each stage
uint256[] public unlockStage = [ 1624982400, // 2021-06-30 1632931200, // 2021-09-30 1640880000, // 2021-12-31 1648569600, // 2022-03-30 1656518400, // 2022-06-30 1664467200, // 2022-09-30 1672416000, // 2022-12-31 1680105600 // 2023-03-30 ];
uint256[] public unlockStage = [ 1624982400, // 2021-06-30 1632931200, // 2021-09-30 1640880000, // 2021-12-31 1648569600, // 2022-03-30 1656518400, // 2022-06-30 1664467200, // 2022-09-30 1672416000, // 2022-12-31 1680105600 // 2023-03-30 ];
49,140
36
// Get airline status from Adress
function getAirlineStatus(address airlineAddress ) external view isCallerAuthorized returns (bool status)
function getAirlineStatus(address airlineAddress ) external view isCallerAuthorized returns (bool status)
44,623
47
// owner can drain tokens that are sent here by mistake
function emergencyERC20Drain(IERC20 tokenDrained, uint amount) external onlyOwner { tokenDrained.transfer(owner, amount); }
function emergencyERC20Drain(IERC20 tokenDrained, uint amount) external onlyOwner { tokenDrained.transfer(owner, amount); }
33,530
30
// Perform the elliptic curve recover operation
bytes32 check = keccak256(header, message); return ecrecover(check, v, r, s);
bytes32 check = keccak256(header, message); return ecrecover(check, v, r, s);
8,235
7
// Emit when `ifQualified` is called to decide if the given `address`is `qualified` according to the preset rule by the contract creator and the current block `number` and the current block `timestamp`. /
event Qualification(address account, bool qualified, uint256 blockNumber, uint256 timestamp);
event Qualification(address account, bool qualified, uint256 blockNumber, uint256 timestamp);
6,583
0
// Directly deposits a certain amount of surplus collateral to a user'saccount. This call can be used both for token and native Ether collateral. Fortokens, each call initiates a token transfer call to the ERC20 contract,and it's safe to call repeatedly in the same transaction even for the sametoken. For native Ether d...
function depositSurplus (address recv, uint128 value, address token) internal { debitTransfer(lockHolder_, value, token, popMsgVal()); bytes32 key = tokenKey(recv, token); userBals_[key].surplusCollateral_ += value; }
function depositSurplus (address recv, uint128 value, address token) internal { debitTransfer(lockHolder_, value, token, popMsgVal()); bytes32 key = tokenKey(recv, token); userBals_[key].surplusCollateral_ += value; }
13,289
40
// States the total number of authorized payments in this contract/ return The number of payments ever authorized even if they were canceled
function numberOfAuthorizedPayments() public view returns (uint) { return authorizedPayments.length; }
function numberOfAuthorizedPayments() public view returns (uint) { return authorizedPayments.length; }
83,365
5
// Relay entry callback gas limit. This is the gas limit with which/ callback function provided in the relay request transaction is/ executed. The callback is executed with a new relay entry value/ in the same transaction the relay entry is submitted.
uint256 public callbackGasLimit;
uint256 public callbackGasLimit;
35,377
44
// Create `mintedAmount` tokens and send it to `target`/target Address to receive the tokens/mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public returns(bool) { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; emit Transfer(address(0x0), address(this), mintedAmount); emit Transfer(address(this), target, mintedAmount); emit mylog(0...
function mintToken(address target, uint256 mintedAmount) onlyOwner public returns(bool) { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; emit Transfer(address(0x0), address(this), mintedAmount); emit Transfer(address(this), target, mintedAmount); emit mylog(0...
37,475
65
// Sets the values for `name`, `symbol`, and `decimals`. All three ofthese values are immutable: they can only be set once duringconstruction. /
constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; }
constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; }
576
275
// Getter Functions ///
function BPTVal( address _bPool, address _liquidityAsset, address _staker, address _stakeLocker
function BPTVal( address _bPool, address _liquidityAsset, address _staker, address _stakeLocker
60,232
13
// listener when a video is updated./_oldViewCount old view count./_newViewCount new view count./_tokenId whose the video is associated to.
function onVideoUpdated( uint256 _oldViewCount, uint256 _newViewCount, uint256 _tokenId)
function onVideoUpdated( uint256 _oldViewCount, uint256 _newViewCount, uint256 _tokenId)
9,589
325
// Get the borrower's pending accumulated ETH reward, earned by their stake
function getPendingETHReward(address _borrower) public view override returns (uint) { uint snapshotETH = rewardSnapshots[_borrower].ETH; uint rewardPerUnitStaked = L_ETH.sub(snapshotETH); if ( rewardPerUnitStaked == 0 || Troves[_borrower].status != Status.active) { return 0; } uint...
function getPendingETHReward(address _borrower) public view override returns (uint) { uint snapshotETH = rewardSnapshots[_borrower].ETH; uint rewardPerUnitStaked = L_ETH.sub(snapshotETH); if ( rewardPerUnitStaked == 0 || Troves[_borrower].status != Status.active) { return 0; } uint...
28,121
97
// Prevent overflow when dividing INT256_MIN by -1 https:github.com/RequestNetwork/requestNetwork/issues/43
require(!(a == - 2**255 && b == -1) && (b > 0)); return a / b;
require(!(a == - 2**255 && b == -1) && (b > 0)); return a / b;
16,900
23
// address -> permission -> flag
mapping (address=>mapping(bytes32=>bool)) byAddress;
mapping (address=>mapping(bytes32=>bool)) byAddress;
12,008
130
// Get a reference to the tier.
JB721Tier memory _tier = store.tierOfTokenId(address(this), _tokenId);
JB721Tier memory _tier = store.tierOfTokenId(address(this), _tokenId);
25,358
15
// TODO - existing investment? 3, 1 to change
investments.push(Investment(msg.sender, msg.value, 0, 3, 1, sectorList)); for(uint x = 0; x < sectorList.length; x++) { blackList[sectorList[x]] = sectorList[x]; }
investments.push(Investment(msg.sender, msg.value, 0, 3, 1, sectorList)); for(uint x = 0; x < sectorList.length; x++) { blackList[sectorList[x]] = sectorList[x]; }
33,654
20
// TOKEN DATA /
IRule[] memory rules) { TokenData storage tokenData = tokens[_token]; mintingFinished = tokenData.mintingFinished; allTimeMinted = tokenData.allTimeMinted; allTimeBurned = tokenData.allTimeBurned; allTimeSeized = tokenData.allTimeSeized; lock = [ tokenData.lock.startAt, tokenData.lock.endAt...
IRule[] memory rules) { TokenData storage tokenData = tokens[_token]; mintingFinished = tokenData.mintingFinished; allTimeMinted = tokenData.allTimeMinted; allTimeBurned = tokenData.allTimeBurned; allTimeSeized = tokenData.allTimeSeized; lock = [ tokenData.lock.startAt, tokenData.lock.endAt...
10,235
48
// Contracts that should be able to recover tokens SylTi This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner.This will prevent any accidental loss of tokens. /
contract CanReclaimToken is Ownable { using SafeERC20 for ERC20Basic; /** * @dev Reclaim all ERC20Basic compatible tokens * @param _token ERC20Basic The address of the token contract */ function reclaimToken(ERC20Basic _token) external onlyOwner { uint256 balance = _token.balanceOf(this); _token...
contract CanReclaimToken is Ownable { using SafeERC20 for ERC20Basic; /** * @dev Reclaim all ERC20Basic compatible tokens * @param _token ERC20Basic The address of the token contract */ function reclaimToken(ERC20Basic _token) external onlyOwner { uint256 balance = _token.balanceOf(this); _token...
10,915
21
// how much is being swapped out
uint256 amountOut;
uint256 amountOut;
50,469