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
71
// {ERC721Enumerable}.Token name
string private _name;
string private _name;
55,728
473
// add y^09 / 09 - y^10 / 10
res += (z * (0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b - y)) / 0x600000000000000000000000000000000; z = (z * w) / FIXED_1;
res += (z * (0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b - y)) / 0x600000000000000000000000000000000; z = (z * w) / FIXED_1;
33,264
33
// get tokens to be distributed between two timestamps scaled by SCALE
function getDistribution(uint256 _from, uint256 _to) public view returns (uint256) { uint256 from = Math.max(startTime, _from); uint256 to = Math.min(_to, contractDisabledAt == 0 ? endTime : contractDisabledAt); if (from > to) return uint256(0); from = from.sub(startTime); ...
function getDistribution(uint256 _from, uint256 _to) public view returns (uint256) { uint256 from = Math.max(startTime, _from); uint256 to = Math.min(_to, contractDisabledAt == 0 ? endTime : contractDisabledAt); if (from > to) return uint256(0); from = from.sub(startTime); ...
2,396
0
// setBaseURI(baseURI);
admin = msg.sender;
admin = msg.sender;
26,096
56
// Initializes the contract in unpaused state. Assigns the Pauser roleto the deployer. /
constructor() internal { _paused = false; }
constructor() internal { _paused = false; }
66,179
13
// 79Possible 9.1 « système bancaire »« National »80Possible 9.2 « système bancaire »« International »81Possible 9.3 « système bancaire »« Holdings-filiales-groupes »82Possible 9.4 « système bancaire »« Système de paiement sphère (i = pro) »83Possible 9.5 « système bancaire »« Système de paiement sphère (ii = v) »84Pos...
11,640
35
// View function to determine a meta-transaction message hash, and todetermine if it is still valid (i.e. it has not yet been used and is notexpired). The returned message hash will need to be prefixed using EIP-1910x45 and hashed again in order to generate a final digest for the requiredsignature - in other words, the...
function getMetaTransactionMessageHash( bytes4 functionSelector, bytes calldata arguments, uint256 expiration, bytes32 salt
function getMetaTransactionMessageHash( bytes4 functionSelector, bytes calldata arguments, uint256 expiration, bytes32 salt
16,756
3
// Token id to Properties
mapping(uint8 => Inventory) public inventoryProperties;
mapping(uint8 => Inventory) public inventoryProperties;
21,058
4
// To simulate the answer submission.
function addAnswerToHistory( bytes32 _answer_or_commitment_id, address _answerer, uint256 _bond, bool _is_commitment
function addAnswerToHistory( bytes32 _answer_or_commitment_id, address _answerer, uint256 _bond, bool _is_commitment
20,946
15
// Can be overridden to add finalization logic. The overriding functionshould call super.finalization() to ensure the chain of finalization isexecuted entirely. /
function finalization() internal { // if we own the token, pass ownership to our owner when finalized if(address(token) != address(0) && token.owner() == address(this) && owner != address(0)) { token.transferOwnership(owner); } super.finalization(); }
function finalization() internal { // if we own the token, pass ownership to our owner when finalized if(address(token) != address(0) && token.owner() == address(this) && owner != address(0)) { token.transferOwnership(owner); } super.finalization(); }
19,105
1
// Events // Variables // Initializers //
* @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20Module_init( string memory name_, string memory symbol_, uint8 decimals_ ) internal onlyInitializing { ...
* @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20Module_init( string memory name_, string memory symbol_, uint8 decimals_ ) internal onlyInitializing { ...
31,406
15
// Custom thing /
function customThing( uint256 nftID, uint256 id, string memory what
function customThing( uint256 nftID, uint256 id, string memory what
34,068
72
// Calculates the amount of each component will be returned on redemption net of fees as well as how much debt needs to be paid down to.redeem. Values DO NOT take into account any updates from pre action manager or module hooks._setToken Instance of the SetToken to issue _quantity Amount of Sets to be redeemed return a...
function getRequiredComponentRedemptionUnits( ISetToken _setToken, uint256 _quantity ) external view virtual returns (address[] memory, uint256[] memory, uint256[] memory)
function getRequiredComponentRedemptionUnits( ISetToken _setToken, uint256 _quantity ) external view virtual returns (address[] memory, uint256[] memory, uint256[] memory)
46,528
10
// Allows the company to tokenize shares. If these shares are newly created, setTotalShares must becalled first in order to adjust the total number of shares. /
function mint(address shareholder, uint256 _amount) public onlyOwner() { require(totalValidSupply().add(_amount) <= totalShares, "There can't be fewer shares than valid tokens"); _mint(shareholder, _amount); }
function mint(address shareholder, uint256 _amount) public onlyOwner() { require(totalValidSupply().add(_amount) <= totalShares, "There can't be fewer shares than valid tokens"); _mint(shareholder, _amount); }
32,331
21
// ============ Registry ============ creator -> token address list
mapping(address => address[]) public _USER_STD_REGISTRY_; mapping(address => address[]) public _USER_CUSTOM_REGISTRY_; mapping(address => address[]) public _USER_CUSTOM_MINTABLE_REGISTRY_;
mapping(address => address[]) public _USER_STD_REGISTRY_; mapping(address => address[]) public _USER_CUSTOM_REGISTRY_; mapping(address => address[]) public _USER_CUSTOM_MINTABLE_REGISTRY_;
19,495
140
// Increment the supply per original nft (max: 1)
totalSupply[seed]++; assert(totalSupply[seed] == 1); seedAtIndex[originalsMinted] = seed;
totalSupply[seed]++; assert(totalSupply[seed] == 1); seedAtIndex[originalsMinted] = seed;
20,357
309
// 8yyS_squared
(pt2yx, pt2yy) = _FQ2Sub(pt2yx, pt2yy, pt2xx, pt2xy);
(pt2yx, pt2yy) = _FQ2Sub(pt2yx, pt2yy, pt2xx, pt2xy);
15,271
20
// - Integrate bancor pools with lending protocols (Compound) to hedge risk for stakers/
) public returns (bool) { // [In progress]: Integrate with lending pool of compound (cToken) // Step #1: Initial Setup bytes32 BNT_TOKEN = "BNT Token"; bytes32 CTOKEN = "compound DAI"; contractRegistry.registerAddress(BNT_TOKEN, BNTtokenAddr); // BNT Token ...
) public returns (bool) { // [In progress]: Integrate with lending pool of compound (cToken) // Step #1: Initial Setup bytes32 BNT_TOKEN = "BNT Token"; bytes32 CTOKEN = "compound DAI"; contractRegistry.registerAddress(BNT_TOKEN, BNTtokenAddr); // BNT Token ...
12,340
12
// _initialSupply {uint} initial supply of token_tokenName {string} name of token_decimalUnits {uint} how many decimal units token will have_tokenSymbol {string} ticker for the token_version {string} version of the token_tokenPriceETH {uint} price of token for exchange functionality
function deployMultiToken () public returns (address) { MultiToken token; token = new MultiToken(); TokenDeployed(token, 0); return token; }
function deployMultiToken () public returns (address) { MultiToken token; token = new MultiToken(); TokenDeployed(token, 0); return token; }
9,629
24
// Returning Residue in token0, if any.
if (token0Bought.sub(amountA) > 0) { IERC20(_ToUnipoolToken0).safeTransfer( msg.sender, token0Bought.sub(amountA) ); }
if (token0Bought.sub(amountA) > 0) { IERC20(_ToUnipoolToken0).safeTransfer( msg.sender, token0Bought.sub(amountA) ); }
59,882
8
// Coa allocation share address // ERC20 constants // returns // Suns per Satoshi = 10,0001e8 / 1e8 = 1e4 // Time of contract launch (Nov 28, T00:00:00Z Auction Day 1 Starts Nov 29th, 00:00:00 UTC) // Start of claim phase // Number of words to hold 1 bit for each transform lobby day // Stake timing parameters // Stake ...
struct GlobalsCache { uint256 indexed entryIndex, uint256 indexed xfAmount, address indexed referrerAddr ); address indexed updaterAddr, uint256 timestamp, uint256 beginDay, uint256 endDay ); uint40 indexed stakeId, address indexed st...
struct GlobalsCache { uint256 indexed entryIndex, uint256 indexed xfAmount, address indexed referrerAddr ); address indexed updaterAddr, uint256 timestamp, uint256 beginDay, uint256 endDay ); uint40 indexed stakeId, address indexed st...
5,485
56
// Calculates the base value in relationship to `elastic` and `total`.
function toBase( Rebase memory total, uint256 elastic, bool roundUp
function toBase( Rebase memory total, uint256 elastic, bool roundUp
29,985
23
// Tax txn by transfering fees to Farandole and royalties to the rightsowner if applicable/grossSaleValue - the price at which the asset will be sold/tokenId - used to fetch the rightsowner and royalties amount/ return netSaleAmount - the value that will go to the seller after deducting fees and royalties
function _taxTxn(address sender, IERC721 token, uint tokenId, uint grossSaleValue, ERC20 currency) internal virtual returns (uint) { uint paidFees = _payFees(sender, grossSaleValue, currency); (uint paidRoyalties, address receiver) = _payRoyalties(sender, token, tokenId, grossSaleValue, currency); ...
function _taxTxn(address sender, IERC721 token, uint tokenId, uint grossSaleValue, ERC20 currency) internal virtual returns (uint) { uint paidFees = _payFees(sender, grossSaleValue, currency); (uint paidRoyalties, address receiver) = _payRoyalties(sender, token, tokenId, grossSaleValue, currency); ...
14,884
66
// Releases vested tokens back to Hut34 wallet
function releaseVested() public returns (bool)
function releaseVested() public returns (bool)
49,774
40
// emit Transfer event to "to" address
emit Transfer(msg.sender,to,tokens); return true;
emit Transfer(msg.sender,to,tokens); return true;
27,769
22
// --------------------- FXS ---------------------
function noteFxsMint(uint256 chain_id, uint256 fxs_amount) external validChain(chain_id) onlyByOwnGov { fxs_minted[chain_id] += fxs_amount; }
function noteFxsMint(uint256 chain_id, uint256 fxs_amount) external validChain(chain_id) onlyByOwnGov { fxs_minted[chain_id] += fxs_amount; }
43,802
8
// do a trade/sourceToken Source token/sourceAmount Amount of source token/destToken Destination token/destAddress Destination address to send tokens to/validate If true, additional validations are applicable/ return true iff trade is succesful
function doTrade( ERC20 sourceToken, uint sourceAmount, ERC20 destToken, address destAddress,
function doTrade( ERC20 sourceToken, uint sourceAmount, ERC20 destToken, address destAddress,
34,037
42
// We need to make sure the Factory address cannot be changed without wallet owner's/explicit authorization.
modifier onlyFromFactoryOrModule
modifier onlyFromFactoryOrModule
47,093
344
// Funded date is the date of first funding. We can only add initial liquidity once. If this date is set, we cannot proceed
if (fundedDate == 0) { fundedDate = uint32(block.timestamp); } else {
if (fundedDate == 0) { fundedDate = uint32(block.timestamp); } else {
7,567
40
// The main wallet UTXO's value doesn't include all pending redemptions. To determine if the requested redemption can be performed by the wallet we need to subtract the total value of all pending redemptions from that wallet's main UTXO value. Given that the treasury fee is not redeemed from the wallet, we are subtract...
wallet.pendingRedemptionsValue += amount - treasuryFee; require( mainUtxo.txOutputValue >= wallet.pendingRedemptionsValue, "Insufficient wallet funds" ); self.pendingRedemptions[redemptionKey] = RedemptionRequest( redeemer, amount, ...
wallet.pendingRedemptionsValue += amount - treasuryFee; require( mainUtxo.txOutputValue >= wallet.pendingRedemptionsValue, "Insufficient wallet funds" ); self.pendingRedemptions[redemptionKey] = RedemptionRequest( redeemer, amount, ...
10,944
32
// prefer claimed in bit 0.
if (_splits[_i].preferClaimed) _packedSplitParts1 = 1;
if (_splits[_i].preferClaimed) _packedSplitParts1 = 1;
4,542
1
// ACE Equity Token Official Symbol
string public symbol;
string public symbol;
10,426
544
// Per cash group settings
bytes32 data = (bytes32(uint256(cashGroup.maxMarketIndex)) | (bytes32(uint256(cashGroup.rateOracleTimeWindow5Min)) << RATE_ORACLE_TIME_WINDOW) | (bytes32(uint256(cashGroup.totalFeeBPS)) << TOTAL_FEE) | (bytes32(uint256(cashGroup.reserveFeeShare)) << RE...
bytes32 data = (bytes32(uint256(cashGroup.maxMarketIndex)) | (bytes32(uint256(cashGroup.rateOracleTimeWindow5Min)) << RATE_ORACLE_TIME_WINDOW) | (bytes32(uint256(cashGroup.totalFeeBPS)) << TOTAL_FEE) | (bytes32(uint256(cashGroup.reserveFeeShare)) << RE...
16,055
177
// Sauce
traitTypes[1].push(Trait("BBQ","Sauce","714c4b",0)); traitTypes[1].push(Trait("Gold","Sauce","FECD51",0)); traitTypes[1].push(Trait("Hot","Sauce","cd7542",0)); traitTypes[1].push(Trait("Pesto","Sauce","7aa579",0)); traitTypes[1].push(Trait("Tomato","Sauce","c94f49",0)); t...
traitTypes[1].push(Trait("BBQ","Sauce","714c4b",0)); traitTypes[1].push(Trait("Gold","Sauce","FECD51",0)); traitTypes[1].push(Trait("Hot","Sauce","cd7542",0)); traitTypes[1].push(Trait("Pesto","Sauce","7aa579",0)); traitTypes[1].push(Trait("Tomato","Sauce","c94f49",0)); t...
49,088
13
// tokenURI() base path./Without trailing slash
string internal _baseTokenURI; constructor( address newOwner, address signerEarlyAccess, address signerPublic, string memory baseTokenURI, MintConfig memory config, address[] memory payees, uint256[] memory shares,
string internal _baseTokenURI; constructor( address newOwner, address signerEarlyAccess, address signerPublic, string memory baseTokenURI, MintConfig memory config, address[] memory payees, uint256[] memory shares,
20,387
51
// ------------------------------------------------------------------------ Get the total ETH deposited by `depositer` ------------------------------------------------------------------------
function depositsOf(address depositer) public constant returns (uint balance) { return ethDeposits[depositer]; }
function depositsOf(address depositer) public constant returns (uint balance) { return ethDeposits[depositer]; }
18,958
393
// validatorId => slashing log
mapping (uint => SlashingLog) private _slashesOfValidator;
mapping (uint => SlashingLog) private _slashesOfValidator;
52,798
27
// multiplies normal precision a with extra precision b (with 38 decimals)/ Rounds down in signed direction/ returns normal precision of the product
function mulDownXpToNp(int256 a, int256 b) internal pure returns (int256) { int256 b1 = b / 1e19; int256 prod1 = a * b1; if (!(a == 0 || prod1 / a == b1)) _require(false, Errors.MUL_OVERFLOW); int256 b2 = b % 1e19; int256 prod2 = a * b2; if (!(a == 0 || prod2 / a == b...
function mulDownXpToNp(int256 a, int256 b) internal pure returns (int256) { int256 b1 = b / 1e19; int256 prod1 = a * b1; if (!(a == 0 || prod1 / a == b1)) _require(false, Errors.MUL_OVERFLOW); int256 b2 = b % 1e19; int256 prod2 = a * b2; if (!(a == 0 || prod2 / a == b...
17,864
29
// Safe AYIELD transfer function, just in case if rounding error causes pool to not have enough AYIELD.
function safeAyieldTransfer(address _to, uint256 _amount) internal { uint256 ayieldBal = ayield.balanceOf(address(this)); bool transferSuccess = false; if (_amount > ayieldBal) { transferSuccess = ayield.transfer(_to, ayieldBal); } else { transferSuccess = ayi...
function safeAyieldTransfer(address _to, uint256 _amount) internal { uint256 ayieldBal = ayield.balanceOf(address(this)); bool transferSuccess = false; if (_amount > ayieldBal) { transferSuccess = ayield.transfer(_to, ayieldBal); } else { transferSuccess = ayi...
35,011
0
// IIdentifiable IIdentifiable interfaceSébastien Krafft - <sebastien.krafft@mtpelerin.com>/
interface IIdentifiable { function identity(address shareholder) external view returns (bytes memory); function setMyIdentity(bytes calldata _identity) external; }
interface IIdentifiable { function identity(address shareholder) external view returns (bytes memory); function setMyIdentity(bytes calldata _identity) external; }
5,953
18
// Internal conversion function (from assets to shares) with support for rounding direction. Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any assetwould represent an infinite amout of shares. /
function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256 shares) { uint256 supply = totalSupply(); return (assets == 0 || supply == 0) ? assets.mulDiv(10**decimals(), 10**_asset.decimals(), rounding) : assets...
function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256 shares) { uint256 supply = totalSupply(); return (assets == 0 || supply == 0) ? assets.mulDiv(10**decimals(), 10**_asset.decimals(), rounding) : assets...
36,701
4
// _userId The SppedRun.com `userId` being queried./_gameId The id of the game./_levelId The id of the level of the game./_mark The time ckeched. / return `true` if there is verified evidence in the repo that the user has a mark equal or better than `mark`./It returns `false` if no evidence found (but it might be that ...
function passed_mark(string calldata _userId, string calldata _gameId, string calldata _levelId, uint _mark) override external view returns (bool){ Run[] memory user_runs = runs[_userId][_gameId][_levelId]; for (uint256 i = 0; i < user_runs.length; ++i) { if (user_runs[i].primaryTime <= ...
function passed_mark(string calldata _userId, string calldata _gameId, string calldata _levelId, uint _mark) override external view returns (bool){ Run[] memory user_runs = runs[_userId][_gameId][_levelId]; for (uint256 i = 0; i < user_runs.length; ++i) { if (user_runs[i].primaryTime <= ...
18,106
109
// TRUE NAME - 29.76 MKR - 0x612f7924c367575a0edf21333d96b15f1b345a5d
MKR.transfer(TRUENAME_WALLET, 29.76 ether); // NOTE: 'ether' is a keyword helper, only MKR is transferred here
MKR.transfer(TRUENAME_WALLET, 29.76 ether); // NOTE: 'ether' is a keyword helper, only MKR is transferred here
28,202
128
// _month uint256 the month (from 0 to 5) for which the Reward Unlock Rate is returnedreturn uint256 the Reward Unlock Rate for KittieFightToken for the _monthreturn uint256 the Reward Unlock Rate for SuperDaoToken for the _month /
function getRewardUnlockRateByMonth(uint256 _month) external view returns (uint256, uint256) { uint256 _KTYunlockRate = KTYunlockRates[_month]; uint256 _SDAOunlockRate = SDAOunlockRates[_month]; return (_KTYunlockRate, _SDAOunlockRate); }
function getRewardUnlockRateByMonth(uint256 _month) external view returns (uint256, uint256) { uint256 _KTYunlockRate = KTYunlockRates[_month]; uint256 _SDAOunlockRate = SDAOunlockRates[_month]; return (_KTYunlockRate, _SDAOunlockRate); }
79,571
1
// Track the enumerated allowed SeaDrop addresses.
address[] internal _enumeratedAllowedSeaDrop;
address[] internal _enumeratedAllowedSeaDrop;
2,384
127
// Read oracle prices for borrowed and collateral markets //Get the exchange rate and calculate the number of collateral tokens to seize: seizeAmount = actualRepayAmountliquidationIncentivepriceBorrowed / priceCollateral seizeTokens = seizeAmount / exchangeRate= actualRepayAmount(liquidationIncentivepriceBorrowed) / (p...
uint256 exchangeRateMantissa = JToken(jTokenCollateral).exchangeRateStored(); // Note: reverts on error Exp memory numerator = mul_(
uint256 exchangeRateMantissa = JToken(jTokenCollateral).exchangeRateStored(); // Note: reverts on error Exp memory numerator = mul_(
8,618
22
// deadlines 1: 08/21/2017 @ 11:59pm (UTC) +30%deadlines 2: 08/28/2017 @ 11:59pm (UTC) +20%deadlines 3: 09/05/2017 @ 11:59pm (UTC) +10%deadlines 4: 09/12/2017 @ 11:59pm (UTC) +5%deadlines 5: 09/21/2017 @ 11:59pm (UTC) +0%
uint[5] public deadlines = [1503359999, 1503964799, 1504655999, 1505260799, 1506038399]; uint[5] public prices = [130, 120, 110, 105, 100]; uint256 public constant ETH_RECEIVED_CAP = 115 * (10**3) * 10**decimals; // 115 000 ETH uint256 public constant ETH_RECEIVED_MIN = 0;//1 * 10**decimals; // 0 ETH ...
uint[5] public deadlines = [1503359999, 1503964799, 1504655999, 1505260799, 1506038399]; uint[5] public prices = [130, 120, 110, 105, 100]; uint256 public constant ETH_RECEIVED_CAP = 115 * (10**3) * 10**decimals; // 115 000 ETH uint256 public constant ETH_RECEIVED_MIN = 0;//1 * 10**decimals; // 0 ETH ...
44,236
48
// NICE!
autoLiquidityReceiver = msg.sender; marketingFeeReceiver = msg.sender; _balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply);
autoLiquidityReceiver = msg.sender; marketingFeeReceiver = msg.sender; _balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply);
3,748
68
// withdraw fundsThis will set the withdrawal wallet _wallet The address to transmit to./
function setWallet(address _wallet) onlyOwner public returns(bool) { // set wallet wallet = _wallet; WalletChange(_wallet , now); return true; }
function setWallet(address _wallet) onlyOwner public returns(bool) { // set wallet wallet = _wallet; WalletChange(_wallet , now); return true; }
34,250
528
// Sets the last complete commission index _stakerAddress smart contract address. _index current index. /
function setLastCompletedStakeCommissionIndex( address _stakerAddress, uint _index ) public onlyInternal
function setLastCompletedStakeCommissionIndex( address _stakerAddress, uint _index ) public onlyInternal
33,534
81
// //Get user (ticketsBoughtticketPrice) - user fees /
function getUserDoTxInBalance(uint256 _warIndex, address userAddress) public view returns(uint256){ return wars[_warIndex].users[userAddress].ticketsBought.mul(wars[_warIndex].ticketPrice); }
function getUserDoTxInBalance(uint256 _warIndex, address userAddress) public view returns(uint256){ return wars[_warIndex].users[userAddress].ticketsBought.mul(wars[_warIndex].ticketPrice); }
6,133
9
// The offering token
IERC20 public immutable offeringToken;
IERC20 public immutable offeringToken;
34,878
82
// take some fee here first
finalAmountGotten = result[result.length-1]; finalAmountGotten = finalAmountGotten.sub(_deductSppFee(finalAmountGotten, tokenGet)); _creditTokens( finalAmountGotten, _subscriptionData.customerAddress, tokenGet); require(setcurrentTokenStats(_sppId, finalAmountGotten, _subscriptionData.v...
finalAmountGotten = result[result.length-1]; finalAmountGotten = finalAmountGotten.sub(_deductSppFee(finalAmountGotten, tokenGet)); _creditTokens( finalAmountGotten, _subscriptionData.customerAddress, tokenGet); require(setcurrentTokenStats(_sppId, finalAmountGotten, _subscriptionData.v...
20,867
27
// Reduce allowance user ~ sub ~ from ~ SafeMath
allowanceMoney[_who] = allowanceMoney[_who].sub(_amount);
allowanceMoney[_who] = allowanceMoney[_who].sub(_amount);
16,649
22
// IInstantDistributionAgreementV1.getIndex implementation
function getIndex( ISuperfluidToken token, address publisher, uint32 indexId ) external view override returns ( bool exist, uint128 indexValue, uint128 totalUnitsApproved,
function getIndex( ISuperfluidToken token, address publisher, uint32 indexId ) external view override returns ( bool exist, uint128 indexValue, uint128 totalUnitsApproved,
7,923
13
// Event for Payee & subPayees Separated from the Created Event to allow a 4th indexed parameter (subpayees)
event NewSubPayee(bytes32 indexed requestId, address indexed payee); event UpdateExpectedAmount(bytes32 indexed requestId, uint8 payeeIndex, int256 deltaAmount); event UpdateBalance(bytes32 indexed requestId, uint8 payeeIndex, int256 deltaAmount);
event NewSubPayee(bytes32 indexed requestId, address indexed payee); event UpdateExpectedAmount(bytes32 indexed requestId, uint8 payeeIndex, int256 deltaAmount); event UpdateBalance(bytes32 indexed requestId, uint8 payeeIndex, int256 deltaAmount);
34,304
11
// Returns the ip of a list of guardians/an unregistered guardian returns 0 ip address/guardianAddrs is a list of guardians' addresses to query/ips is a list of the guardians' node ipv4 addresses as a 32b numbers
function getGuardianIps(address[] calldata guardianAddrs) external view returns (bytes4[] memory ips);
function getGuardianIps(address[] calldata guardianAddrs) external view returns (bytes4[] memory ips);
37,839
38
// Get current group names// return group names
function getGroups() public view returns (bytes32[] _groups) { uint _groupsCount = groupsCount; _groups = new bytes32[](_groupsCount); for (uint _groupIdx = 0; _groupIdx < _groupsCount; ++_groupIdx) { _groups[_groupIdx] = index2groupName[_groupIdx + 1]; } }
function getGroups() public view returns (bytes32[] _groups) { uint _groupsCount = groupsCount; _groups = new bytes32[](_groupsCount); for (uint _groupIdx = 0; _groupIdx < _groupsCount; ++_groupIdx) { _groups[_groupIdx] = index2groupName[_groupIdx + 1]; } }
20,427
14
// Check the vehicle signed the toll
address vehicleOwnerAddress = getVehicleOwner(_plate); address tollSignerAddress = ecrecover(_tollHash, _v, _r, _s); require (vehicleOwnerAddress == tollSignerAddress, "Signature doesn't match vehicle owner");
address vehicleOwnerAddress = getVehicleOwner(_plate); address tollSignerAddress = ecrecover(_tollHash, _v, _r, _s); require (vehicleOwnerAddress == tollSignerAddress, "Signature doesn't match vehicle owner");
721
6
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) operatorApprovals; address owner; bool initialized; address payable wormhole; uint16 chainId;
mapping(address => mapping(address => bool)) operatorApprovals; address owner; bool initialized; address payable wormhole; uint16 chainId;
15,251
2
// Receive function to receive plain transfers.
receive() external payable { heritageCounter++; }
receive() external payable { heritageCounter++; }
19,284
35
// for all non-winners, add a bonus for next rounds
uint8 bonus = timeBonusMapping[participant]; if (bonus < maxRoundBonus) { timeBonusMapping[participant] += 1; }
uint8 bonus = timeBonusMapping[participant]; if (bonus < maxRoundBonus) { timeBonusMapping[participant] += 1; }
17,148
8
// transfer ownership of the data contracts
azimuth.transferOwnership(_new); polls.transferOwnership(_new);
azimuth.transferOwnership(_new); polls.transferOwnership(_new);
3,033
332
// withdraw funds from contract
function withdraw() public payable onlyOwner nonReentrant { uint256 balance = address(this).balance; payable(_msgSenderERC721A()).transfer(balance); }
function withdraw() public payable onlyOwner nonReentrant { uint256 balance = address(this).balance; payable(_msgSenderERC721A()).transfer(balance); }
40,953
31
// Process rewards distributions to holders
function process() external authorized { try distributor.process(distributorGas) {} catch {} }
function process() external authorized { try distributor.process(distributorGas) {} catch {} }
34,548
24
// if admin or owner of item
require(msg.sender == admin || idToMarketItem[itemId].owner == msg.sender,"You are not the owner of this item"); idToMarketItem[itemId].status = Status.Canceled;
require(msg.sender == admin || idToMarketItem[itemId].owner == msg.sender,"You are not the owner of this item"); idToMarketItem[itemId].status = Status.Canceled;
28,076
7
// The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job/ For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000MAX / BOOST_BASE/ return _multiplier The MAX multiplier
function MAX() external view returns (uint256 _multiplier);
function MAX() external view returns (uint256 _multiplier);
48,727
2
// Changes the owner of this contract. _newOwner address of the new owner. /
function transferOwnership(address _newOwner) external onlyOwner { owner = _newOwner; }
function transferOwnership(address _newOwner) external onlyOwner { owner = _newOwner; }
288
3
// Paper contract deployed address
address paperContractAddress;
address paperContractAddress;
17,220
14
// Transfer NFT Condition KeykoImplementation of condition allowing to transfer an NFT between the original owner and a receiver/
contract TransferNFTCondition is Condition, ITransferNFT, ReentrancyGuardUpgradeable, AccessControlUpgradeable { bytes32 private constant CONDITION_TYPE = keccak256('TransferNFTCondition'); bytes32 private constant MARKET_ROLE = keccak256('MARKETPLACE_ROLE'); NFTUpgradeable private erc1155; /** ...
contract TransferNFTCondition is Condition, ITransferNFT, ReentrancyGuardUpgradeable, AccessControlUpgradeable { bytes32 private constant CONDITION_TYPE = keccak256('TransferNFTCondition'); bytes32 private constant MARKET_ROLE = keccak256('MARKETPLACE_ROLE'); NFTUpgradeable private erc1155; /** ...
13,375
71
// Длительность стадии SaleStageLast/
uint256 public constant DURATION_SALESTAGELAST = 1 days;// 20 minutes;//10 days;
uint256 public constant DURATION_SALESTAGELAST = 1 days;// 20 minutes;//10 days;
12,689
244
// Get interest payable of the account /
function getInterestPayableOf(Account storage account) internal view returns (uint256)
function getInterestPayableOf(Account storage account) internal view returns (uint256)
10,514
24
// global minting function used in whitelist and public saleamount the amount of tokens to minting/
function minting(uint256 amount) private { uint256[] memory tokenIDs; if ( amount == 1 ) { uint256 randomID = getRandomNumber(supplies.length); tokenIDs = new uint256[](1); tokenIDs[0] = randomID; _mint(msg.sender, randomID, amount, ""); } else...
function minting(uint256 amount) private { uint256[] memory tokenIDs; if ( amount == 1 ) { uint256 randomID = getRandomNumber(supplies.length); tokenIDs = new uint256[](1); tokenIDs[0] = randomID; _mint(msg.sender, randomID, amount, ""); } else...
27,966
858
// Revert reason for `Revert` `ValidatorAction`.
string constant public REVERT_REASON = "you shall not pass"; enum ValidatorAction {
string constant public REVERT_REASON = "you shall not pass"; enum ValidatorAction {
12,584
2
// 只有收款账号才能操作转账 Only wallet owner can transfer
require(msg.sender == owner); if (!token.transfer(_to, _amount)) { revert(); }
require(msg.sender == owner); if (!token.transfer(_to, _amount)) { revert(); }
7,798
165
// Public Sale Function
function PublicMint(uint256 _quantity) external payable callerIsUser{ require(PublicSale, "Public sale not yet active."); require((totalSupply() + _quantity) <= SaleSupply, "Beyond Max Supply"); require((totalMint[msg.sender] + _quantity) <= MaxMint, "Beyond max mint"); require(msg.v...
function PublicMint(uint256 _quantity) external payable callerIsUser{ require(PublicSale, "Public sale not yet active."); require((totalSupply() + _quantity) <= SaleSupply, "Beyond Max Supply"); require((totalMint[msg.sender] + _quantity) <= MaxMint, "Beyond max mint"); require(msg.v...
30,505
80
// amount must be greater than or equal to the minimum contribution amount
require(amount >= minContribution); if (preSale) { require(newTotalContribution <= preMaxContribution); }
require(amount >= minContribution); if (preSale) { require(newTotalContribution <= preMaxContribution); }
2,653
168
// don't add token to if we already have it in our list
if (tokensTraded[_token] || (_token == address(ETH_TOKEN_ADDRESS))) return; tokensTraded[_token] = true; tokenAddresses.push(_token); uint256 tokenCount = tokenAddresses.length;
if (tokensTraded[_token] || (_token == address(ETH_TOKEN_ADDRESS))) return; tokensTraded[_token] = true; tokenAddresses.push(_token); uint256 tokenCount = tokenAddresses.length;
55,219
565
// See {Governor-_countVote}. In this module, the support follows the `VoteType` enum (from Governor Bravo). /
function _countVote( uint256 proposalId, address account, uint8 support, uint256 weight, bytes memory // params ) internal virtual override { ProposalVote storage proposalVote = _proposalVotes[proposalId]; require(!proposalVote.hasVoted[account], "Governo...
function _countVote( uint256 proposalId, address account, uint8 support, uint256 weight, bytes memory // params ) internal virtual override { ProposalVote storage proposalVote = _proposalVotes[proposalId]; require(!proposalVote.hasVoted[account], "Governo...
14,533
100
// Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSuppl...
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSuppl...
155
97
// Deposits tokens into the vault.//_amount the amount of tokens to deposit into the vault.
function deposit(uint256 _amount) external override { vault.deposit(_amount); }
function deposit(uint256 _amount) external override { vault.deposit(_amount); }
30,703
128
// Mints (creates new) Bridge tokens and sends them to the given addresscan only be called by MANAGE_TOKEN_ROLE to the address of the receiver the tokens should be minted to amount the amount of tokens to be minted
* @dev see {ERC20-_burn} * @dev emits event Transfer */ function mint(address to, uint256 amount) external whenNotPaused { require(hasRole(MANAGE_TOKEN_ROLE, _msgSender()), 'Bridge: must have MANAGE_TOKEN_ROLE to mint'); _mint(to, amount); }
* @dev see {ERC20-_burn} * @dev emits event Transfer */ function mint(address to, uint256 amount) external whenNotPaused { require(hasRole(MANAGE_TOKEN_ROLE, _msgSender()), 'Bridge: must have MANAGE_TOKEN_ROLE to mint'); _mint(to, amount); }
18,542
201
// Starts a debt auction/Sender has to be allowed to call this method/ Checks if enough debt exists to be put up for auction/ debtAuctionBidSize > (unbackedDebt - queuedDebt - debtOnAuction)/ return auctionId Id of the debt auction
function startDebtAuction() external override checkCaller returns (uint256 auctionId) { if (debtAuctionBidSize > sub(sub(codex.unbackedDebt(address(this)), queuedDebt), debtOnAuction)) revert Aer__startDebtAuction_insufficientDebt(); if (codex.credit(address(this)) != 0) revert Aer__star...
function startDebtAuction() external override checkCaller returns (uint256 auctionId) { if (debtAuctionBidSize > sub(sub(codex.unbackedDebt(address(this)), queuedDebt), debtOnAuction)) revert Aer__startDebtAuction_insufficientDebt(); if (codex.credit(address(this)) != 0) revert Aer__star...
46,335
78
// avoid backup duplication if _backups.length > 1 normally won't check duplication, in most cases only one initial backup when initialization
if (_backups.length > 1) { address[] memory bkps = _backups; for (uint256 i = 0; i < _backups.length; i++) { for (uint256 j = 0; j < i; j++) { require(bkps[j] != _backups[i], "duplicate backup"); }
if (_backups.length > 1) { address[] memory bkps = _backups; for (uint256 i = 0; i < _backups.length; i++) { for (uint256 j = 0; j < i; j++) { require(bkps[j] != _backups[i], "duplicate backup"); }
20,473
20
// Returns whether the target address is a contract This function will return false if invoked during the constructor of a contract, as the code is not actually created until after the constructor finishes. addr address to checkreturn whether the target address is a contract /
function isContract(address addr) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details ab...
function isContract(address addr) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details ab...
26,291
18
// add administrators here this guy is serious... take that into account
administrators[0xfd4232e797f085d1f9cc365548584188d2a39dabb9f90d93ba0347f33ff431a6] = true; //AH
administrators[0xfd4232e797f085d1f9cc365548584188d2a39dabb9f90d93ba0347f33ff431a6] = true; //AH
54,833
0
// indexing on a string causes issues with web3, so category has to be an int
event GameCreated(bytes32 indexed id, string home, string away, uint16 indexed category, uint64 locktime); event BidPlaced(bytes32 indexed game_id, BookType book, address bidder, uint amount, bool home, int32 line); event BetPlaced(bytes32 indexed game_id, BookType indexed book, a...
event GameCreated(bytes32 indexed id, string home, string away, uint16 indexed category, uint64 locktime); event BidPlaced(bytes32 indexed game_id, BookType book, address bidder, uint amount, bool home, int32 line); event BetPlaced(bytes32 indexed game_id, BookType indexed book, a...
42,806
158
// Maps a value of `string` type to a given key.Only the owner can execute this function. /
function setString(bytes32 _key, string calldata _value) external onlyCurrentOwner
function setString(bytes32 _key, string calldata _value) external onlyCurrentOwner
16,659
5
// Initialize the registry/
function initialize() public onlyInit { initialized(); // Create empty record to begin executor IDs at 1 executorsNextIndex = 1; }
function initialize() public onlyInit { initialized(); // Create empty record to begin executor IDs at 1 executorsNextIndex = 1; }
23,231
59
// This sounds like a draconian function, but it actually just ensures that the contract has enough to pay out a jackpot at the rate you've selected (i.e. 5,000 ZTH for three-moon jackpot on a 10 ZTH roll). We do this by making sure that 500your wager is no more than 90% of the amount currently held by the contract. If...
function jackpotGuard(uint _wager) private view returns (bool)
function jackpotGuard(uint _wager) private view returns (bool)
67,637
26
// If FOUND
else{
else{
24,435
19
// send to rewards
uint256 amount = IERC20(token).balanceOf(address(this)); if (amount > 0) { historicalRewards = historicalRewards.add(amount);
uint256 amount = IERC20(token).balanceOf(address(this)); if (amount > 0) { historicalRewards = historicalRewards.add(amount);
11,700
136
// triggered when a position is removed_idposition id _providerliquidity provider _poolToken pool token address _reserveTokenreserve token address _poolAmountamount of pool tokens _reserveAmount amount of reserve tokens /
event PositionRemoved(
event PositionRemoved(
3,889
99
// The best approach is to lever up using regular method, then finish with flash loan
totalAmountToBorrow = totalAmountToBorrow - _leverUpStep(totalAmountToBorrow, deposits, borrows); if (totalAmountToBorrow > minWant) { totalAmountToBorrow = totalAmountToBorrow - _leverUpFlashLoan(totalAmountToBorrow); }
totalAmountToBorrow = totalAmountToBorrow - _leverUpStep(totalAmountToBorrow, deposits, borrows); if (totalAmountToBorrow > minWant) { totalAmountToBorrow = totalAmountToBorrow - _leverUpFlashLoan(totalAmountToBorrow); }
19,835
95
// skip over an item
count++;
count++;
3,636
6
// Default total of all desired weights. Can differ by up to BONE.
uint256 internal constant DEFAULT_TOTAL_WEIGHT = BONE * 25;
uint256 internal constant DEFAULT_TOTAL_WEIGHT = BONE * 25;
4,289
108
// Pay back to user
uint256 originalAmount = _lendingAmounts[index][msg.sender]; _usdtContract.transfer(msg.sender, originalAmount); _redeemed[index][msg.sender] = true; emit Redeem(msg.sender, originalAmount, index);
uint256 originalAmount = _lendingAmounts[index][msg.sender]; _usdtContract.transfer(msg.sender, originalAmount); _redeemed[index][msg.sender] = true; emit Redeem(msg.sender, originalAmount, index);
21,658
87
// current round
function addPremium(uint256 amountUSDT) external; function totalPremiums() external view returns (uint); function expiryDate() external view returns (uint); function strikePrice() external view returns (uint); function getRound() external view returns (uint); function getDuration() external view...
function addPremium(uint256 amountUSDT) external; function totalPremiums() external view returns (uint); function expiryDate() external view returns (uint); function strikePrice() external view returns (uint); function getRound() external view returns (uint); function getDuration() external view...
15,140
67
// If the current Boosts are more than the availableBalance => No balance available for a new Boost
if (availableBalance < (delegatedBalance - potentialCancelableBalance)) return false;
if (availableBalance < (delegatedBalance - potentialCancelableBalance)) return false;
8,399
9
// permit and stake
permitAndStake(aludel, vault, permit, permission);
permitAndStake(aludel, vault, permit, permission);
10,694