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
54
// Minimal safety check for cardano address Address specifications can be found here: https:cips.cardano.org/cips/cip19/ TODO - discuss how indepth this should be do we check it starts with addr1q, addr1v or addr1w do we ensure lowercase alphanumeric (excluding b,i,o and 1 (except for addr1))
function validateCardanoAddress(string memory cardanoAddress) internal pure returns (bool) { bytes memory addressBytes = bytes(cardanoAddress); // No substrings in solidity, and a generic solution would cost extra gas bool startsWithAddr = addressBytes[0] == "a" && addressBytes[1] == "d" && addressBytes[2...
function validateCardanoAddress(string memory cardanoAddress) internal pure returns (bool) { bytes memory addressBytes = bytes(cardanoAddress); // No substrings in solidity, and a generic solution would cost extra gas bool startsWithAddr = addressBytes[0] == "a" && addressBytes[1] == "d" && addressBytes[2...
42,595
9
// The reviewer can approve a completion request from the milestone manager When he does, the milestone's state is set to completed and the funds can be withdrawn by the recipient.
function approveCompleted() isInitialized onlyReviewer external { require(!isCanceled()); require(state == MilestoneState.NEEDS_REVIEW); state = MilestoneState.COMPLETED; emit ApproveCompleted(liquidPledging, idProject); }
function approveCompleted() isInitialized onlyReviewer external { require(!isCanceled()); require(state == MilestoneState.NEEDS_REVIEW); state = MilestoneState.COMPLETED; emit ApproveCompleted(liquidPledging, idProject); }
21,487
68
// If it points to where it's expected.
if (idToThing[idHash] == _oldIndex) {
if (idToThing[idHash] == _oldIndex) {
56,736
9
// A token tracker that limits the token supply and increments token IDs on each new mint.
abstract contract AddLimitedSupply { using Counters for Counters.Counter; // Keeps track of how many we have minted Counters.Counter private _tokenCount; /// @dev The maximum count of tokens this token tracker will hold. uint256 private _totalSupply; /// Instanciate the contract /// @para...
abstract contract AddLimitedSupply { using Counters for Counters.Counter; // Keeps track of how many we have minted Counters.Counter private _tokenCount; /// @dev The maximum count of tokens this token tracker will hold. uint256 private _totalSupply; /// Instanciate the contract /// @para...
31,899
117
// There is (currently) no way of generating a random number in acontract that cannot be seen/used by the miner. Thus a big minercould use information on a rebase for their advantage. We do not want to give any advantage to a big miner over a little trader, thus the traders ability to generate and see a rebase (ahead o...
uint256 odds = uint256(blockhash(block.number - 1)) ^ uint256(block.coinbase); if ((odds % uint256(5)) == uint256(1)) { return internal_rebase(); }
uint256 odds = uint256(blockhash(block.number - 1)) ^ uint256(block.coinbase); if ((odds % uint256(5)) == uint256(1)) { return internal_rebase(); }
27,130
3
// book keeping
uint public playCount; uint public totalEarned; uint public tipCount; uint public totalTipped; uint public licenseVersion; uint public metadataVersion; uint distributionGasEstimate;
uint public playCount; uint public totalEarned; uint public tipCount; uint public totalTipped; uint public licenseVersion; uint public metadataVersion; uint distributionGasEstimate;
41,304
19
// The complete definition of the token
contract Coin is ERC20Interface, SafeMath { string public name = "CrypCoin"; string public symbol = "CPC"; uint8 public decimals = 18; uint256 public _totalSupply = 2000000000000000000000000000; // 2 billion tokens in supply mapping(address => uint256) balances; mapping(address => mapping(addre...
contract Coin is ERC20Interface, SafeMath { string public name = "CrypCoin"; string public symbol = "CPC"; uint8 public decimals = 18; uint256 public _totalSupply = 2000000000000000000000000000; // 2 billion tokens in supply mapping(address => uint256) balances; mapping(address => mapping(addre...
27,007
296
// acceptableCosts should always be > baseVariableBorrowRate If it's not this will revert since the strategist set the wrong acceptableCosts value
if ( vars.utilizationRate < irsVars.optimalRate && acceptableCostsRay < irsVars.baseRate.add(irsVars.slope1) ) {
if ( vars.utilizationRate < irsVars.optimalRate && acceptableCostsRay < irsVars.baseRate.add(irsVars.slope1) ) {
20,645
76
// Multiplies two int256 variables and fails on overflow. /
function mul(int256 a, int256 b) internal pure returns (int256) { int256 c = a * b; // Detect overflow when multiplying MIN_INT256 with -1 require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c; }
function mul(int256 a, int256 b) internal pure returns (int256) { int256 c = a * b; // Detect overflow when multiplying MIN_INT256 with -1 require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256)); require((b == 0) || (c / b == a)); return c; }
1,028
597
// _block.blockVersion = uint8(data.toUint(offset));
offset += 32; uint blockDataOffset = data.toUint(offset); offset += 32; bytes memory blockData;
offset += 32; uint blockDataOffset = data.toUint(offset); offset += 32; bytes memory blockData;
28,399
36
// swaps each time it reaches swapTreshold of pancake pair to avoid large prize impact
uint tokenToSwap=_balances[_pancakePairAddress]*swapTreshold/1000;
uint tokenToSwap=_balances[_pancakePairAddress]*swapTreshold/1000;
29,057
293
// Annual incentive emission rate denominated in WHOLE TOKENS (multiply byINTERNAL_TOKEN_PRECISION to get the actual rate)
uint32 incentiveAnnualEmissionRate;
uint32 incentiveAnnualEmissionRate;
2,235
502
// Gets the token that the adapter accepts.
function token() external view returns (IDetailedERC20);
function token() external view returns (IDetailedERC20);
31,879
5
// Reward user that called update on the Oracle with tokens equal to ther paymentpremium (1.1) queryId ID of the query from Chainlink or Oraclize /
function reward(bytes32 queryId) internal { rewardAmount = wmul(wmul(paymentTokenPrice, asyncRequests[queryId].disbursement), prem); if (asyncRequests[queryId].token.balanceOf(address(this)) >= rewardAmount && asyncRequests[queryId].disbursement > 0) { require(asyncRequests[queryId].toke...
function reward(bytes32 queryId) internal { rewardAmount = wmul(wmul(paymentTokenPrice, asyncRequests[queryId].disbursement), prem); if (asyncRequests[queryId].token.balanceOf(address(this)) >= rewardAmount && asyncRequests[queryId].disbursement > 0) { require(asyncRequests[queryId].toke...
6,267
3
// Maps each validator's public key to its hashed representation of: operator Ids used by the validator and active / inactive flag (uses LSB)
mapping(bytes32 => bytes32) validatorPKs;
mapping(bytes32 => bytes32) validatorPKs;
5,772
19
// Get the number of accounts an item has mentioned. itemId itemId of the item.return The number of accounts. /
function getItemMentionCount(bytes32 itemId) external view returns (uint) { return itemIdMentionAccounts[itemId].length; }
function getItemMentionCount(bytes32 itemId) external view returns (uint) { return itemIdMentionAccounts[itemId].length; }
7,217
302
// Only use the cumulativeRewardFactor for lastRewardRound if lastRewardRound is before _round
if (pool.cumulativeRewardFactor == 0 && lastRewardRound < _round) { pool.cumulativeRewardFactor = _transcoder.earningsPoolPerRound[lastRewardRound].cumulativeRewardFactor; }
if (pool.cumulativeRewardFactor == 0 && lastRewardRound < _round) { pool.cumulativeRewardFactor = _transcoder.earningsPoolPerRound[lastRewardRound].cumulativeRewardFactor; }
35,302
5
// current voting token, voters spend token to vote the amount of token transferred to this contract is the amount of this vote
address public votingToken;
address public votingToken;
39,129
23
// WEENUS IBokky(0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA).drip(); _dump(0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA);
for (uint j = 0; j < compound.length; j++) { fauceteer.drip(compound[j]); _dump(compound[j]); }
for (uint j = 0; j < compound.length; j++) { fauceteer.drip(compound[j]); _dump(compound[j]); }
29,604
8
// Lets a contract admin set the global maximum supply for collection's NFTs.
function setMaxTotalSupply( uint256 _maxTotalSupply
function setMaxTotalSupply( uint256 _maxTotalSupply
5,284
188
// verify input
require(liquidity.provider != address(0), "ERR_INVALID_ID"); require(_removeTimestamp >= liquidity.timestamp, "ERR_INVALID_TIMESTAMP");
require(liquidity.provider != address(0), "ERR_INVALID_ID"); require(_removeTimestamp >= liquidity.timestamp, "ERR_INVALID_TIMESTAMP");
43,208
96
// 36 = 4-byte selector + 32 bytes integer
else if (selector == _PANIC_SELECTOR && data.length == 36) { uint256 code;
else if (selector == _PANIC_SELECTOR && data.length == 36) { uint256 code;
35,554
8
// GETTERS/
function getStorageLength() public view returns (uint32 storageLength) { return _storageLength; } function getStorageIdForPayout() public view returns (uint32 storageIdForPayout) { return _storageIdForPayout; } function getDepositsCount() public view returns (uint64 depositsCount) { return _depositsCount; }...
function getStorageLength() public view returns (uint32 storageLength) { return _storageLength; } function getStorageIdForPayout() public view returns (uint32 storageIdForPayout) { return _storageIdForPayout; } function getDepositsCount() public view returns (uint64 depositsCount) { return _depositsCount; }...
15,375
64
// Extend the unlock time for `msg.sender` to `_unlock_time`_unlock_time New epoch time for unlocking/
function increase_unlock_time(uint256 _unlock_time) external nonReentrant { assert_not_contract(msg.sender); LockedBalance memory _locked = locked[msg.sender]; uint256 unlock_time = (_unlock_time / WEEK) * WEEK; // Locktime is rounded down to weeks require(_locked.end > block.timest...
function increase_unlock_time(uint256 _unlock_time) external nonReentrant { assert_not_contract(msg.sender); LockedBalance memory _locked = locked[msg.sender]; uint256 unlock_time = (_unlock_time / WEEK) * WEEK; // Locktime is rounded down to weeks require(_locked.end > block.timest...
42,840
144
// Finalizable Base contract which allows children to implement a finalization mechanism.inspired by FinalizableCrowdsale from zeppelin /
contract Finalizable is Ownable { event Finalized(); bool public isFinalized = false; /** * @dev Modifier to make a function callable only when the contract is not finalized. */ modifier whenNotFinalized() { require(!isFinalized); _; } /** * @dev called by the owner to finalize */ f...
contract Finalizable is Ownable { event Finalized(); bool public isFinalized = false; /** * @dev Modifier to make a function callable only when the contract is not finalized. */ modifier whenNotFinalized() { require(!isFinalized); _; } /** * @dev called by the owner to finalize */ f...
36,826
41
// Returns true if `account` is a contract. [IMPORTANT]====It is unsafe to assume that an address for which this function returnsfalse is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the followingtypes of addresses:- an externally-owned account - a contract in c...
function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` ...
function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` ...
59
22
// Fulfillment function that receives the horse data in the form of bytes32/this function is called by the oracle contract when data is available/_requestId ID of the previous request sent/_horsedata data retrieved from the oracle
function fulfillHorseData(bytes32 _requestId, bytes32 _horsedata) public allowedAddress recordChainlinkFulfillment(_requestId) { string memory horsedata = bytes32ToString(_horsedata); setHorseFromCSV(horsedata); emit LogFulfillHorseData(horsedata); return; }
function fulfillHorseData(bytes32 _requestId, bytes32 _horsedata) public allowedAddress recordChainlinkFulfillment(_requestId) { string memory horsedata = bytes32ToString(_horsedata); setHorseFromCSV(horsedata); emit LogFulfillHorseData(horsedata); return; }
33,746
11
// Used to calculate yield rewards, keeps track of the tokens weight locked in staking
uint256 public override usersLockingWeight;
uint256 public override usersLockingWeight;
24,517
114
// depositDelegateStake provides users that were not whitelisted to run nodes at the start of theElrond blockchain with the possibility to take part anyway in the genesis of the networkby delegating stake to nodes that will be ran by Elrond. The rewards will be receivedby the user according to the Elrond's delegation s...
function depositDelegateStake(uint256 amount, bytes32 elrondAddressHash) external whenStaking guardMaxDelegationLimit(amount)
function depositDelegateStake(uint256 amount, bytes32 elrondAddressHash) external whenStaking guardMaxDelegationLimit(amount)
7,991
248
// Returns true if `_who` owns token `_tokenId`. /
function isOwner(address _who, uint256 _tokenId) public view returns (bool) { (uint256 index, uint256 mask) = _position(_tokenId); return tokens[_who].data[index] & mask != 0; }
function isOwner(address _who, uint256 _tokenId) public view returns (bool) { (uint256 index, uint256 mask) = _position(_tokenId); return tokens[_who].data[index] & mask != 0; }
28,678
211
// PUBLIC FACING: Enter the tranform lobby for the current round referrerAddr Eth address of referring user (optional; 0x0 for no referrer) /
function xfLobbyEnter(address referrerAddr) external payable
function xfLobbyEnter(address referrerAddr) external payable
37,273
0
// Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements:- Addition cannot overflow. /
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c; unchecked { c = a + b; } require(c >= a, "SafeMath: addition overflow"); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c; unchecked { c = a + b; } require(c >= a, "SafeMath: addition overflow"); return c; }
27,993
18
// Stored root hashes of L2 -> L1 logs
mapping(uint256 => bytes32) l2LogsRootHashes;
mapping(uint256 => bytes32) l2LogsRootHashes;
5,069
372
// ============ Private Functions ============ //Check that the proposed set natural unit is a multiple of current set natural unit, or vice versa.Done to make sure that when calculating token units there will be no rounding errors._currentSet The current base SetToken _nextSetThe proposed SetToken /
function naturalUnitsAreValid( ISetToken _currentSet, ISetToken _nextSet ) private view returns (bool)
function naturalUnitsAreValid( ISetToken _currentSet, ISetToken _nextSet ) private view returns (bool)
33,773
4
// Emitted when token farm is updated by admin
event TokenFarmUpdated(EIP20Interface token, uint oldStart, uint oldEnd, uint newStart, uint newEnd);
event TokenFarmUpdated(EIP20Interface token, uint oldStart, uint oldEnd, uint newStart, uint newEnd);
25,321
166
// Initialize the contract after it has been proxified meant to be called once immediately after deployment /
function initialize( string calldata name_, string calldata symbol_, uint8 decimals_, address childChainManager ) external initializer { setName(name_);
function initialize( string calldata name_, string calldata symbol_, uint8 decimals_, address childChainManager ) external initializer { setName(name_);
22,570
52
// len == 2
address l3 = referrals[l2]; if (l3 == address(0)) { userReferrals = new address[](2); userReferrals[0] = l1; userReferrals[1] = l2; return userReferrals; }
address l3 = referrals[l2]; if (l3 == address(0)) { userReferrals = new address[](2); userReferrals[0] = l1; userReferrals[1] = l2; return userReferrals; }
24,134
27
// Snipers
uint256 private deadblocks = 2; uint256 public launchBlock; uint256 private latestSniperBlock;
uint256 private deadblocks = 2; uint256 public launchBlock; uint256 private latestSniperBlock;
26,175
382
// not mature, partial withdraw
withdrawAmount = stakeObj .interestAmount .mul(uint256(now).sub(stakeObj.stakeTimestamp)) .div(stakeTimeInSeconds) .sub(stakeObj.withdrawnInterestAmount);
withdrawAmount = stakeObj .interestAmount .mul(uint256(now).sub(stakeObj.stakeTimestamp)) .div(stakeTimeInSeconds) .sub(stakeObj.withdrawnInterestAmount);
40,864
64
// Exclude a wallet from fees | Not to be abused
function excludeFromFees(address account, bool excluded) public onlyOwner { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); }
function excludeFromFees(address account, bool excluded) public onlyOwner { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); }
38,574
189
// how much CRV we can claim from the staking contract
return IConvexRewards(rewardsContract).earned(address(this));
return IConvexRewards(rewardsContract).earned(address(this));
30,918
79
// ------ Core Unit MKR Transfers ----- DECO-001 - 125.0 MKR - 0xF482D1031E5b172D42B2DAA1b6e5Cbf6519596f7 https:mips.makerdao.com/mips/details/MIP40c3SP36
MKR.transfer(DECO_WALLET, 125 * WAD);
MKR.transfer(DECO_WALLET, 125 * WAD);
25,855
167
// Tracks the period where users stop earning rewards
uint256 public periodFinish = 0; uint256 public rewardRate = 0;
uint256 public periodFinish = 0; uint256 public rewardRate = 0;
83,537
27
// Checks whether a contract implements an ERC165 interface or not. If the result is not cached a direct lookup on the contract address is performed. If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling {updateERC165Cache} with the contract address.account Addres...
function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);
function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);
6,290
59
// 2 000 000 tokens
uint public constant FOUNDERS_REWARD = 2000000 * (1 ether / 1 wei);
uint public constant FOUNDERS_REWARD = 2000000 * (1 ether / 1 wei);
5,669
42
// require that transfer has not already been pre-filled
require(liquidityProvider[_id] == address(0), "!unfilled");
require(liquidityProvider[_id] == address(0), "!unfilled");
65,598
66
// harvest HXYF from ETHHXYF lp
function HarvestUbaseLp() public
function HarvestUbaseLp() public
38,606
10
// Functions to get the nonce from the entry point
function getNonce() public view virtual returns (uint256) { return entryPoint.getNonce(address(this), 0); }
function getNonce() public view virtual returns (uint256) { return entryPoint.getNonce(address(this), 0); }
26,357
43
// Account context also cannot have negative cash debts
require(accountContext.hasDebt == 0x00, "AC: cannot have debt");
require(accountContext.hasDebt == 0x00, "AC: cannot have debt");
10,656
62
// PRBMathUD60x18/Paul Razvan Berg/Smart contract library for advanced fixed-point math. It works with uint256 numbers considered to have 18/ trailing decimals. We call this number representation unsigned 60.18-decimal fixed-point, since there can be up to 60/ digits in the integer part and up to 18 decimals in the fra...
library PRBMathUD60x18 { /// @dev Half the SCALE number. uint256 internal constant HALF_SCALE = 5e17; /// @dev log2(e) as an unsigned 60.18-decimal fixed-point number. uint256 internal constant LOG2_E = 1442695040888963407; /// @dev The maximum value an unsigned 60.18-decimal fixed-point number ca...
library PRBMathUD60x18 { /// @dev Half the SCALE number. uint256 internal constant HALF_SCALE = 5e17; /// @dev log2(e) as an unsigned 60.18-decimal fixed-point number. uint256 internal constant LOG2_E = 1442695040888963407; /// @dev The maximum value an unsigned 60.18-decimal fixed-point number ca...
48,041
5
// Constructor to create two pictures in its deployment
constructor() public { pictures[1] = Picture(1, "Picture 1", 0); pictures[2] = Picture(2, "Picture 2", 0); }
constructor() public { pictures[1] = Picture(1, "Picture 1", 0); pictures[2] = Picture(2, "Picture 2", 0); }
25,638
403
// Define the contract's constructor parameters as a struct to enable more variables to be specified. This is required to enable more params, over and above Solidity's limits.
struct ConstructorParams { // Params for PricelessPositionManager only. uint256 expirationTimestamp; uint256 withdrawalLiveness; address collateralAddress; address finderAddress; address tokenFactoryAddress; address timerAddress; address excessTokenBen...
struct ConstructorParams { // Params for PricelessPositionManager only. uint256 expirationTimestamp; uint256 withdrawalLiveness; address collateralAddress; address finderAddress; address tokenFactoryAddress; address timerAddress; address excessTokenBen...
37,008
2
// Error for if no tokens are staked.
error NoTokensStaked();
error NoTokensStaked();
29,651
74
// Sends `amount_` of `_collateral` to `destination_`.
function _removeCollateral(uint256 amount_, address destination_) internal { _collateral -= amount_; require(ERC20Helper.transfer(_collateralAsset, destination_, amount_), "MLI:RC:TRANSFER_FAILED"); require(_isCollateralMaintained(), "MLI:RC:INSUFFICIENT_...
function _removeCollateral(uint256 amount_, address destination_) internal { _collateral -= amount_; require(ERC20Helper.transfer(_collateralAsset, destination_, amount_), "MLI:RC:TRANSFER_FAILED"); require(_isCollateralMaintained(), "MLI:RC:INSUFFICIENT_...
1,890
272
// event emitted when DigitalaxAccessControls is updated
event AccessControlsUpdated( address indexed newAdress );
event AccessControlsUpdated( address indexed newAdress );
10,677
2
// User -> Order Id list
mapping(address => uint256[]) public ordersByUser;
mapping(address => uint256[]) public ordersByUser;
24,294
16
// Contract "Ownable"Purpose: Defines Owner for contract and provide functionality to transfer ownership to another account /
contract Ownable { //owner variable to store contract owner account address public owner; //add another owner to transfer ownership address oldOwner; //Constructor for the contract to store owner's account on deployement function Ownable() public { owner = msg.sender; oldOwner = msg.sender; } ...
contract Ownable { //owner variable to store contract owner account address public owner; //add another owner to transfer ownership address oldOwner; //Constructor for the contract to store owner's account on deployement function Ownable() public { owner = msg.sender; oldOwner = msg.sender; } ...
17,320
12
// Max period for which pool can stay not active before it can be closed by governor (in seconds)
uint256 public maxInactivePeriod;
uint256 public maxInactivePeriod;
32,414
51
// timestamp where token release is enabled
uint releaseTime;
uint releaseTime;
19,106
2
// MathUtils library A library to be used in conjunction with SafeMath. Contains functions for calculatingdifferences between two uint256. /
library MathUtils { /** * @notice Compares a and b and returns true if the difference between a and b * is less than 1 or equal to each other. * @param a uint256 to compare with * @param b uint256 to compare with * @return True if the difference between a and b is less than 1 or equal, * ...
library MathUtils { /** * @notice Compares a and b and returns true if the difference between a and b * is less than 1 or equal to each other. * @param a uint256 to compare with * @param b uint256 to compare with * @return True if the difference between a and b is less than 1 or equal, * ...
30,092
18
// ! ],! "expected": [! "1"! ]
//! }, { //! "name": "min_to_negative_ordinar", //! "input": [ //! { //! "entry": "main", //! "calldata": [ //! "-127", "3" //! ] //! }
//! }, { //! "name": "min_to_negative_ordinar", //! "input": [ //! { //! "entry": "main", //! "calldata": [ //! "-127", "3" //! ] //! }
47,895
67
// lib/dss-test/lib/dss-interfaces/src/dss/IlkRegistryAbstract.sol/ pragma solidity >=0.5.12; / https:github.com/makerdao/ilk-registry
interface IlkRegistryAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function vat() external view returns (address); function dog() external view returns (address); function cat() external view returns (address...
interface IlkRegistryAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function vat() external view returns (address); function dog() external view returns (address); function cat() external view returns (address...
10,542
38
// Ask a new question and return the ID/Template data is only stored in the event logs, but its block number is kept in contract storage./template_id The ID number of the template the question will use/question A string containing the parameters that will be passed into the template to make the question/arbitrator The ...
function askQuestionWithMinBondERC20(uint256 template_id, string memory question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce, uint256 min_bond, uint256 tokens)
function askQuestionWithMinBondERC20(uint256 template_id, string memory question, address arbitrator, uint32 timeout, uint32 opening_ts, uint256 nonce, uint256 min_bond, uint256 tokens)
51,710
124
// events
event UpdatedMaxTransaction(uint256 newMax); event UpdatedMaxWallet(uint256 newMax); event SetExemptFromFees(address _address, bool _isExempt); event SetExemptFromLimits(address _address, bool _isExempt); event RemovedLimits(); event UpdatedBuyTax(uint256 newAmt); event UpdatedSellTax(uint2...
event UpdatedMaxTransaction(uint256 newMax); event UpdatedMaxWallet(uint256 newMax); event SetExemptFromFees(address _address, bool _isExempt); event SetExemptFromLimits(address _address, bool _isExempt); event RemovedLimits(); event UpdatedBuyTax(uint256 newAmt); event UpdatedSellTax(uint2...
7,029
9
// Relayed action params relayers List of addresses to be marked as allowed executors and in particular as authorized relayers gasPriceLimit Gas price limit to be used for the relayed action txCostLimit Total transaction cost limit to be used for the relayed action /
struct RelayedActionParams { address[] relayers; uint256 gasPriceLimit; uint256 txCostLimit; }
struct RelayedActionParams { address[] relayers; uint256 gasPriceLimit; uint256 txCostLimit; }
19,257
2
// bytes4(keccak256("SenderNotAuthorizedError(address)"))
bytes4 internal constant SENDER_NOT_AUTHORIZED_ERROR_SELECTOR = 0xb65a25b9;
bytes4 internal constant SENDER_NOT_AUTHORIZED_ERROR_SELECTOR = 0xb65a25b9;
25,149
3
// Verify the block's deadline has passed
node.requirePastDeadline(); getNode(latest).requirePastChildConfirmDeadline(); removeOldZombies(0);
node.requirePastDeadline(); getNode(latest).requirePastChildConfirmDeadline(); removeOldZombies(0);
47,344
20
// Transfer back the nft to the land owner
erc721.safeTransferFrom(address(this), msg.sender, tokenId);
erc721.safeTransferFrom(address(this), msg.sender, tokenId);
19,670
10
// ERC20: Returns the name of the token.ERC20: 토큰의 이름 반환
function name() external view returns (string memory) { return NAME; }
function name() external view returns (string memory) { return NAME; }
49,093
5
// Transfer ETH
uint256 ethBalance = address(this).balance; if (ethBalance > 0) { IWETH weth = IWETH(ethAddress); weth.deposit{value: ethBalance}();
uint256 ethBalance = address(this).balance; if (ethBalance > 0) { IWETH weth = IWETH(ethAddress); weth.deposit{value: ethBalance}();
19,098
36
// Send _value amount of tokens from address _from to address _to Reentry protection prevents attacks upon the state
function transferFrom(address _from, address _to, uint256 _value) public noReentry returns (bool)
function transferFrom(address _from, address _to, uint256 _value) public noReentry returns (bool)
8,485
19
// Calculate Claimable Amount _user userAddress to calculate Tokens /
function calculateTokens(address _user) external view returns (uint256) { UserInfo memory uInfo = userInfo[_user]; if (!uInfo.isDone) { return 0; } if (uInfo.endTime <= uInfo.lastClaimedTime) { return 0; } uint256 _endTime = block.timestamp; ...
function calculateTokens(address _user) external view returns (uint256) { UserInfo memory uInfo = userInfo[_user]; if (!uInfo.isDone) { return 0; } if (uInfo.endTime <= uInfo.lastClaimedTime) { return 0; } uint256 _endTime = block.timestamp; ...
68,893
75
// Increment _totalMintable.
_totalMintable += totalMintableKong;
_totalMintable += totalMintableKong;
2,456
74
// do trade
require(external_call(exchanges[i], etherValues[i], offsets[i], offsets[i + 1] - offsets[i], data), 'External Call Failed');
require(external_call(exchanges[i], etherValues[i], offsets[i], offsets[i + 1] - offsets[i], data), 'External Call Failed');
2,870
56
// Checks whether a storage slot has already been modified, and marks it as modified if not. _contract Address of the contract to check. _key 32 byte storage slot key.return Whether or not the slot was already modified. /
function testAndSetContractStorageChanged( address _contract, bytes32 _key ) override public authenticated returns ( bool )
function testAndSetContractStorageChanged( address _contract, bytes32 _key ) override public authenticated returns ( bool )
67,489
56
// calculate trade amounts and price
_actualDestAmount = getBalance(_destToken, address(this)).sub(beforeDestBalance); _actualSrcAmount = beforeSrcBalance.sub(getBalance(_srcToken, address(this))); require(_actualDestAmount > 0 && _actualSrcAmount > 0); _destPriceInSrc = calcRateFromQty(_actualDestAmount, _actualSrcAmount, getDecimals(_des...
_actualDestAmount = getBalance(_destToken, address(this)).sub(beforeDestBalance); _actualSrcAmount = beforeSrcBalance.sub(getBalance(_srcToken, address(this))); require(_actualDestAmount > 0 && _actualSrcAmount > 0); _destPriceInSrc = calcRateFromQty(_actualDestAmount, _actualSrcAmount, getDecimals(_des...
40,807
18
// Unpauses the contract - allowing minting via the public mint function/Only the owner can call this function
/// Emit handled by {OpenZeppelin Pausable} function unpause() external onlyOwner { _unpause(); }
/// Emit handled by {OpenZeppelin Pausable} function unpause() external onlyOwner { _unpause(); }
7,215
7
// The Ownable constructor sets the original `owner` of the contract to the sender account. /
constructor() public { owner = msg.sender; }
constructor() public { owner = msg.sender; }
10,918
6
// Info of each user that stakes LP tokens
mapping(address => UserInfo) public userInfo; event Deposit(address indexed user, uint256 amount); event Withdraw(address indexed user, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 amount); event UpdateEmissionRate(address indexed user, uint256 _rJoePerSec);
mapping(address => UserInfo) public userInfo; event Deposit(address indexed user, uint256 amount); event Withdraw(address indexed user, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 amount); event UpdateEmissionRate(address indexed user, uint256 _rJoePerSec);
5,471
49
// If the highest bid included ETH: Transfer it to the DAO treasury
if (highestBid != 0) _handleOutgoingTransfer(settings.treasury, highestBid);
if (highestBid != 0) _handleOutgoingTransfer(settings.treasury, highestBid);
14,372
11
// the interest fee percentage in basis points (1/100 of a percent) /
function interestFee() external view returns (uint256);
function interestFee() external view returns (uint256);
2,795
56
// This is internal function is equivalent to {transfer}, and can be used toe.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. /
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _...
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _...
50,642
101
// 查看用户
function Get_User(address userAddress) public view returns (address, uint, bool, uint[8] memory, uint[8] memory, uint, uint[8] memory){ return ( //用户地址 user_Mpping[userAddress].User_Address, //用户抵押数量 user_Mpping[userAddress].Stacking_Amount, //用户是否注册 user_Mppi...
function Get_User(address userAddress) public view returns (address, uint, bool, uint[8] memory, uint[8] memory, uint, uint[8] memory){ return ( //用户地址 user_Mpping[userAddress].User_Address, //用户抵押数量 user_Mpping[userAddress].Stacking_Amount, //用户是否注册 user_Mppi...
7,984
16
// The historical record of all previously set configs by feedId
mapping(bytes32 => Config) s_verificationDataConfigs;
mapping(bytes32 => Config) s_verificationDataConfigs;
19,109
248
// The hero contract.
CryptoSagaHero public heroContract;
CryptoSagaHero public heroContract;
9,399
45
// Function to get applicant details by address
function getApplicantDetails(address applicantAddress) public view returns (string memory, uint, string memory, address) { // Ensure the applicant exists require(applicants[applicantAddress].age > 0, "Applicant does not exist."); // Return the applicant details return (applicants[applicantAddress].name...
function getApplicantDetails(address applicantAddress) public view returns (string memory, uint, string memory, address) { // Ensure the applicant exists require(applicants[applicantAddress].age > 0, "Applicant does not exist."); // Return the applicant details return (applicants[applicantAddress].name...
25,873
151
// Named Templates
mapping(string => address) public templates;
mapping(string => address) public templates;
58,398
8
// Required interface of an ERC721 compliant contract. /
contract IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @de...
contract IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @de...
200
61
// new
uint256 total_income = price;
uint256 total_income = price;
29,122
21
// Uniswap
interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); functi...
interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); functi...
68,393
399
// Calculates the payment for existing and non-existing HEX stake instance (HSI) loans. borrower Address which has mapped ownership the HSI contract. hsiIndex Index of the HSI contract address in the sender's HSI list.(see hsiLists -> HEXStakeInstanceManager.sol) hsiAddress Address of the HSI contract which coinsides w...
function calcLoanPayment ( address borrower, uint256 hsiIndex, address hsiAddress ) external view returns (uint256, uint256)
function calcLoanPayment ( address borrower, uint256 hsiIndex, address hsiAddress ) external view returns (uint256, uint256)
27,402
2
// Uniswap router contract address.
IUniswapV2Router02 public uniswapRouter;
IUniswapV2Router02 public uniswapRouter;
30,597
373
// copy buffer 2 into buffer
for(uint256 j = buf1.length; j < buf2.length; j++) { buf[j] = buf2[j - buf1.length]; }
for(uint256 j = buf1.length; j < buf2.length; j++) { buf[j] = buf2[j - buf1.length]; }
24,945
26
// Total number of disputes ever opened.
uint256 public totalDisputes;
uint256 public totalDisputes;
2,344
28
// As defined in the 'ERC777TokensRecipient And The tokensReceived Hook' section of https:eips.ethereum.org/EIPS/eip-777
interface IERC777Recipient { function tokensReceived(address operator, address from, address to, uint256 amount, bytes calldata data, bytes calldata operatorData) external; }
interface IERC777Recipient { function tokensReceived(address operator, address from, address to, uint256 amount, bytes calldata data, bytes calldata operatorData) external; }
63,840
59
// Overloaded decimal count /
function decimals() public view virtual override returns (uint8) { return 4; }
function decimals() public view virtual override returns (uint8) { return 4; }
67,412
78
// Returns the current balance of the SupraFund contract./ return The current balance of the SupraFund contract.
function checkSupraFund() external view returns (uint256) { require( msg.sender == owner() || msg.sender == developer, "Unauthorized Access: Cannot check supra funds" ); return supraFund; }
function checkSupraFund() external view returns (uint256) { require( msg.sender == owner() || msg.sender == developer, "Unauthorized Access: Cannot check supra funds" ); return supraFund; }
13,093
4
// Quote synth to synth
function quoteSynth(address synthIn, address synthOut, uint amount) external view returns (uint amountReceived) { if (synthIn == synthOut) return amount; (amountReceived,,) = sexViewer.getAmountsForAtomicExchange(amount, synthId(synthIn), synthId(synthOut)); }
function quoteSynth(address synthIn, address synthOut, uint amount) external view returns (uint amountReceived) { if (synthIn == synthOut) return amount; (amountReceived,,) = sexViewer.getAmountsForAtomicExchange(amount, synthId(synthIn), synthId(synthOut)); }
19,924
47
// Do not allow transfer to 0x0 or the token contract itself
require((_to != 0) && (_to != address(this)));
require((_to != 0) && (_to != address(this)));
18,432
602
// Send back excess eth
if (excessETH > 0) { msg.sender.transfer(excessETH); }
if (excessETH > 0) { msg.sender.transfer(excessETH); }
49,408