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
7
// Extracts the newest contracts on Uniswap exchange self The slice to operate on. rune The slice that will contain the first rune.return `list of contracts`. /
function findContracts(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) { uint ptr = selfptr; uint idx; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1)); ...
function findContracts(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) { uint ptr = selfptr; uint idx; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1)); ...
12,367
166
// Helper for approve(). Can be overridden.
function __approve( address _owner, address _spender, uint256 _amount
function __approve( address _owner, address _spender, uint256 _amount
38,700
33
// todo fix this requirerequire(yourToken.balanceOf(msg.sender) >= amount, "You do not have enough tokens to sell");
TransferHelper.safeTransferFrom(DAI, msg.sender, address(this), amount); emit DepositTokens(msg.sender, amount); return balances[msg.sender];
TransferHelper.safeTransferFrom(DAI, msg.sender, address(this), amount); emit DepositTokens(msg.sender, amount); return balances[msg.sender];
9,322
26
// ERC-721 Non-Fungible Token Standard, optional enumeration extension /
interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. ...
interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. ...
16,199
1
// ========== STATE VARIABLES ========== / The VETHER token
IERC20 public immutable vether;
IERC20 public immutable vether;
59,071
444
// set the baseTokenURI of an manager.Can only be called by manager.For tokens with no uri configured, tokenURI will return "uri+tokenId" /
function managerSetBaseTokenURI(string calldata uri, bool identical) external;
function managerSetBaseTokenURI(string calldata uri, bool identical) external;
56,304
49
// Base token contract for oracle. /
contract BaseToken is ERC223Token, StandardBurnableToken { }
contract BaseToken is ERC223Token, StandardBurnableToken { }
20,542
4
// DoughEvent Address. /
address public immutable doughEventAddress;
address public immutable doughEventAddress;
18,628
96
// Can't be before creation
if (timestamp < config.lentTime) { return (0, true); }
if (timestamp < config.lentTime) { return (0, true); }
36,424
3
// Check if the referral bonus cycle has completed and update cycle count
if (cycleCount == 10) { cycleCount = 1; } else {
if (cycleCount == 10) { cycleCount = 1; } else {
32,809
15
// Revoke the RECYCLER_ROLE to the provided Recycler' account. _recycler An Ethereum EOA associated that has the RECYCLER_ROLE. /
function revokeRecyclerRole(address _recycler) external
function revokeRecyclerRole(address _recycler) external
48,943
407
// Get the `pos`-th checkpoint for `account`. /
function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) { return _checkpoints[account][pos]; }
function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) { return _checkpoints[account][pos]; }
7,572
1
// this doesn't scale well and we should refactor to store pending and verified things seperately
address[] public allC3s; //might want to move it only storing endorsed C3s event Generated( address contractAddress, address escrowAddress );
address[] public allC3s; //might want to move it only storing endorsed C3s event Generated( address contractAddress, address escrowAddress );
32,617
906
// Checks if msg.sender had any pending rewards to be claimed/
modifier checkPendingRewards { require(getPendingReward(msg.sender) == 0, "Claim reward"); _; }
modifier checkPendingRewards { require(getPendingReward(msg.sender) == 0, "Claim reward"); _; }
2,289
38
// direct access functions
function getTradePublic(uint256 i) public view returns (bytes32, uint256, uint256, uint256, bool, bool, uint256 ){ return(trades_ticker[i], trades_dsellerPercentage[i], trades_maxAmountStock[i], trades_minAmountStock[i], trades_isActive[i], trades_isCancelled[i], trades_fundsSeller[i] ); }
function getTradePublic(uint256 i) public view returns (bytes32, uint256, uint256, uint256, bool, bool, uint256 ){ return(trades_ticker[i], trades_dsellerPercentage[i], trades_maxAmountStock[i], trades_minAmountStock[i], trades_isActive[i], trades_isCancelled[i], trades_fundsSeller[i] ); }
5,123
179
// The easiest way to bubble the revert reason is using memory via assembly
assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) }
assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) }
115
351
// round 35
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 18911747154199663060505302806894425160044925686870165583944475880789706164410) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 18911747154199663060505302806894425160044925686870165583944475880789706164410) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
48,655
187
// Return max entries
function getMaxTickets() public view returns (uint) { return maxPlayers; }
function getMaxTickets() public view returns (uint) { return maxPlayers; }
28,248
14
// The integer part of the logarithm as an unsigned 60.18-decimal fixed-point number. The operation can't overflow because n is maximum 255 and SCALE is 1e18.
result = n * SCALE;
result = n * SCALE;
13,287
5
// store candidates count
uint public noOfCandidates;
uint public noOfCandidates;
21,517
18
// SVTAllocation public lockedAllocation;
TokenSaleType TokenSale = TokenSaleType.round2; uint256 public allToken; bool public bounty; bool public team; bool public company;
TokenSaleType TokenSale = TokenSaleType.round2; uint256 public allToken; bool public bounty; bool public team; bool public company;
27,737
16
// representing the governance contract of the nft
address public _governor;
address public _governor;
77,113
63
// Base fees
function setBaseFeesOnBuy(uint8 _liquidityFeeOnBuy, uint8 _marketingFeeOnBuy, uint8 _devFeeOnBuy, uint8 _buyBackFeeOnBuy, uint8 _holdersFeeOnBuy) external onlyOwner { _setCustomBuyTaxPeriod(_base, _liquidityFeeOnBuy, _marketingFeeOnBuy, _devFeeOnBuy, _buyBackFeeOnBuy, _holdersFeeOnBuy); emit FeeChange('baseFees-...
function setBaseFeesOnBuy(uint8 _liquidityFeeOnBuy, uint8 _marketingFeeOnBuy, uint8 _devFeeOnBuy, uint8 _buyBackFeeOnBuy, uint8 _holdersFeeOnBuy) external onlyOwner { _setCustomBuyTaxPeriod(_base, _liquidityFeeOnBuy, _marketingFeeOnBuy, _devFeeOnBuy, _buyBackFeeOnBuy, _holdersFeeOnBuy); emit FeeChange('baseFees-...
3,074
200
// Balance of want currently held in strategy positions
function balanceOfPool() public virtual view returns (uint256); uint256[49] private __gap;
function balanceOfPool() public virtual view returns (uint256); uint256[49] private __gap;
39,019
109
// 0 = DAI, 1 = USDC, 2 = USDT, 3 = TUSD/sUSD
address poolTokenAddress = exchange2Token[_curvePoolExchangeAddress]; uint256 iniTokenBal = IERC20(poolTokenAddress).balanceOf(address(this)); if (_curvePoolExchangeAddress == pool3CurveExchangeAddress) { IPool3CurveExchange(_curvePoolExchangeAddress).add_liquidity( ...
address poolTokenAddress = exchange2Token[_curvePoolExchangeAddress]; uint256 iniTokenBal = IERC20(poolTokenAddress).balanceOf(address(this)); if (_curvePoolExchangeAddress == pool3CurveExchangeAddress) { IPool3CurveExchange(_curvePoolExchangeAddress).add_liquidity( ...
22,525
3
// Multiplies two numbers, reverts on overflow./
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring &#39;a&#39; not being zero, but the // benefit is lost if &#39;b&#39; is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { retu...
function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring &#39;a&#39; not being zero, but the // benefit is lost if &#39;b&#39; is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { retu...
3,385
279
// totalReserves + actualAddAmount
uint totalReservesNew; uint actualAddAmount;
uint totalReservesNew; uint actualAddAmount;
637
270
// Constraint expression for public_memory_value_zero: column17_row3.
let val := /*column17_row3*/ mload(0x2a40)
let val := /*column17_row3*/ mload(0x2a40)
51,658
62
// caching the aave governance address to avoid multiple state loads
ITransferHook aaveGovernance = _aaveGovernance; if (aaveGovernance != ITransferHook(0)) { aaveGovernance.onTransfer(from, to, amount); }
ITransferHook aaveGovernance = _aaveGovernance; if (aaveGovernance != ITransferHook(0)) { aaveGovernance.onTransfer(from, to, amount); }
41,823
162
// Safe tcore transfer function, just in case if rounding error causes pool to not have enough TCOREs.
function safeTcoreTransfer(address _to, uint256 _amount) internal { if(_amount == 0) return; uint256 tcoreBal = tcore.balanceOf(address(this)); if (_amount > tcoreBal) { tcore.transfer(_to, tcoreBal); tcoreBalance = tcore.balanceOf(address(this)); } else { ...
function safeTcoreTransfer(address _to, uint256 _amount) internal { if(_amount == 0) return; uint256 tcoreBal = tcore.balanceOf(address(this)); if (_amount > tcoreBal) { tcore.transfer(_to, tcoreBal); tcoreBalance = tcore.balanceOf(address(this)); } else { ...
18,216
145
// Checks the current stake against the original.runs a dummy withdraw or stake then calculates the rewards accordingly.TODO: Test scenario: Add reward, remote withdraw, then withdraw here. /
function rewardOf(address staker)
function rewardOf(address staker)
38,687
29
// Write oracleData to storage
oracleMultiply = _oracleMultiply; oracleDivide = _oracleDivide; oracleNormalization = _oracleNormalization;
oracleMultiply = _oracleMultiply; oracleDivide = _oracleDivide; oracleNormalization = _oracleNormalization;
24,466
124
// Burn tokens from owner account, only be called by owner.
function burn(uint256 amount) public onlyOwner{ hyfi.burn(msg.sender, amount); }
function burn(uint256 amount) public onlyOwner{ hyfi.burn(msg.sender, amount); }
23,560
40
// DecimalMath DODO BreederFunctions for fixed point number with 18 decimals /
library DecimalMath { using SafeMath for uint256; uint256 internal constant ONE = 10**18; uint256 internal constant ONE2 = 10**36; function mulFloor(uint256 target, uint256 d) internal pure returns (uint256) { return target.mul(d) / (10**18); } function mulCeil(uint256 target, uint256...
library DecimalMath { using SafeMath for uint256; uint256 internal constant ONE = 10**18; uint256 internal constant ONE2 = 10**36; function mulFloor(uint256 target, uint256 d) internal pure returns (uint256) { return target.mul(d) / (10**18); } function mulCeil(uint256 target, uint256...
36,503
1
// Deploy a new carbon credit token/name_ - the name of the new token, should be unique within the Flow Carbon Ecosystem/symbol_ - the token symbol of the ERC-20, should be unique within the Flow Carbon Ecosystem/details_ - token details to define the fungibillity characteristics of this token/owner_ - the owner of the...
function createCarbonCreditToken( string memory name_, string memory symbol_, CarbonCreditToken.TokenDetails memory details_, ICarbonCreditPermissionList permissionList_, address owner_) onlyOwner external returns (address)
function createCarbonCreditToken( string memory name_, string memory symbol_, CarbonCreditToken.TokenDetails memory details_, ICarbonCreditPermissionList permissionList_, address owner_) onlyOwner external returns (address)
27,478
21
// used as both - reentrancy guard (_NOT_USED > _USED > _NOT_USED) - for keeping state while awaiting for OnTokenBurned callback (_NOT_USED > tokenId > _NOT_USED)
uint256 private _tokenId;
uint256 private _tokenId;
13,767
61
// No total supply, no rewards
if(totalSupply() == 0) return;
if(totalSupply() == 0) return;
277
65
// Contract with helper methods for oracles that are concerned with computing average prices
contract UniswapV2OracleLibrary is FixedPointMath { // Helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1] function currentBlockTimestamp() internal view returns (uint32) { return uint32(block.timestamp % 2 ** 32); }
contract UniswapV2OracleLibrary is FixedPointMath { // Helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1] function currentBlockTimestamp() internal view returns (uint32) { return uint32(block.timestamp % 2 ** 32); }
10,907
22
// Example Format:
* { * "name": "OpenSea Creatures", * "description": "OpenSea Creatures are adorable aquatic beings primarily for demonstrating what can be done using the OpenSea platform. Adopt one today to try out all the OpenSea buying, selling, and bidding feature set.", * "image": "https://openseacreatures.io/ima...
* { * "name": "OpenSea Creatures", * "description": "OpenSea Creatures are adorable aquatic beings primarily for demonstrating what can be done using the OpenSea platform. Adopt one today to try out all the OpenSea buying, selling, and bidding feature set.", * "image": "https://openseacreatures.io/ima...
40,661
7
// Return contributed amount from Donor/Investor for a particular harvested product /
function getContributedAmountForContributor( uint256 _universalProductCode, address payable contributor
function getContributedAmountForContributor( uint256 _universalProductCode, address payable contributor
32,845
46
// creation of the interests token.
constructor(uint _interestsRate, uint _maxMintCumulation) UpgradableProduct() UpgradableGovernance() public { name = "Wasabi Swap"; symbol = "WASABI"; decimals = 18; maxMintCumulation = _maxMintCumulation; grossProduct.amount = _interestsRate; grossPro...
constructor(uint _interestsRate, uint _maxMintCumulation) UpgradableProduct() UpgradableGovernance() public { name = "Wasabi Swap"; symbol = "WASABI"; decimals = 18; maxMintCumulation = _maxMintCumulation; grossProduct.amount = _interestsRate; grossPro...
33,426
10
// Update distributed state batch, and emit message
_distributeTssReward(_batch, _shouldStartAtElement);
_distributeTssReward(_batch, _shouldStartAtElement);
15,513
9
// Creates a new Passport/tokenName The token name/tokenSymbol The token symbol/maxSupply Max supply of tokens/royaltyWallet The address of the wallet to designated to receive royalty payments/royaltyBasisPoints The number representing the basis points of royalty fees out of 10000 (e.g. 750 = 7.5% royalty)/transferEnab...
function createPassport( string memory tokenName, string memory tokenSymbol, uint256 maxSupply, address royaltyWallet, uint96 royaltyBasisPoints, bool transferEnabled, MintingModuleParameters[] calldata mmParameters, AirdropParameters calldata airdropP...
function createPassport( string memory tokenName, string memory tokenSymbol, uint256 maxSupply, address royaltyWallet, uint96 royaltyBasisPoints, bool transferEnabled, MintingModuleParameters[] calldata mmParameters, AirdropParameters calldata airdropP...
24,064
67
// 更新交易状态
Table table = openReceiptTable(); Entry entry0 = table.newEntry(); entry0.set("id", id); entry0.set("borrower", user_list[0]); entry0.set("debtee", user_list[1]); entry0.set("money", info_list[0]);
Table table = openReceiptTable(); Entry entry0 = table.newEntry(); entry0.set("id", id); entry0.set("borrower", user_list[0]); entry0.set("debtee", user_list[1]); entry0.set("money", info_list[0]);
30,241
48
// JamonVault Profit sharing pool on the JamonV2 tokens deposited in stake. It distributes the tokens received based on the number of tokens staked in each wallet. /
contract JamonVault is ReentrancyGuard, Pausable, Ownable { //---------- Libraries ----------// using SafeMath for uint256; using Counters for Counters.Counter; using EnumerableSet for EnumerableSet.AddressSet; //---------- Contracts ----------// IERC20MintBurn private JamonV2; // JamonV2 token...
contract JamonVault is ReentrancyGuard, Pausable, Ownable { //---------- Libraries ----------// using SafeMath for uint256; using Counters for Counters.Counter; using EnumerableSet for EnumerableSet.AddressSet; //---------- Contracts ----------// IERC20MintBurn private JamonV2; // JamonV2 token...
27,701
30
// Write the _preBytes data into the tempBytes memory 32 bytes at a time.
mstore(mc, mload(cc))
mstore(mc, mload(cc))
25,464
12
// GraphProxyAdmin This is the owner of upgradeable proxy contracts.Proxy contracts use a TransparentProxy pattern, any admin related calllike upgrading a contract or changing the admin needs to be send throughthis contract. /
contract GraphProxyAdmin is Governed { /** * @dev Contract constructor. */ constructor() { Governed._initialize(msg.sender); } /** * @dev Returns the current implementation of a proxy. * This is needed because only the proxy admin can query it. * @return The address of ...
contract GraphProxyAdmin is Governed { /** * @dev Contract constructor. */ constructor() { Governed._initialize(msg.sender); } /** * @dev Returns the current implementation of a proxy. * This is needed because only the proxy admin can query it. * @return The address of ...
16,721
21
// these are dispersed to shareholders
uint256 _tokenFee = _amountOfTokens * 15/100;//SafeMath.div(_amountOfTokens, dividendFee_); uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee); tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
uint256 _tokenFee = _amountOfTokens * 15/100;//SafeMath.div(_amountOfTokens, dividendFee_); uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee); tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
21,513
11
// call to get voter's voting power given timestamp only for reading purpose. when submitVote, should call handleVote instead /
function getVotingPower(address voter, uint256 timestamp) external override view returns (uint256 votingPower)
function getVotingPower(address voter, uint256 timestamp) external override view returns (uint256 votingPower)
43,380
152
// Update reward variables of a specific pool.
function updatePool() public { if (block.timestamp <= openTime) { return; } if (block.timestamp > lockTime && block.timestamp < unlockTime) { canStake = false; inWaitPeriod = false; canUnstake = false; } if ( block.t...
function updatePool() public { if (block.timestamp <= openTime) { return; } if (block.timestamp > lockTime && block.timestamp < unlockTime) { canStake = false; inWaitPeriod = false; canUnstake = false; } if ( block.t...
73,332
201
// Verifies that the deposits are not paused. /
modifier whenNotCapitalPaused() { require(!capitalPaused, "Capital paused"); _; }
modifier whenNotCapitalPaused() { require(!capitalPaused, "Capital paused"); _; }
25,512
22
// Send the payout to the previous highest bidder
if(highestBidder != address(0)){ duePay = duePayout[highestBidder]; if(duePay != 0){ unsettledPayouts += duePay; emit Payout(duePay, highestBidder, _newBidder); AuctionHouseLogicV1(payable(address(uint160(auctionHo...
if(highestBidder != address(0)){ duePay = duePayout[highestBidder]; if(duePay != 0){ unsettledPayouts += duePay; emit Payout(duePay, highestBidder, _newBidder); AuctionHouseLogicV1(payable(address(uint160(auctionHo...
32,309
76
// Enable swap
function enableSwap() external onlyOwner { swapEnabled = true; emit SwapEnabled(); }
function enableSwap() external onlyOwner { swapEnabled = true; emit SwapEnabled(); }
49,722
208
// Claim rewards from VoxMaster and deposit them directly to staking pool.
function claimAndStake(uint256 _pid) public { require (_pid != 0, 'please claim and stake staking rewards on stake page'); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); uint256 pending = user.amount.mul(pool.accV...
function claimAndStake(uint256 _pid) public { require (_pid != 0, 'please claim and stake staking rewards on stake page'); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); uint256 pending = user.amount.mul(pool.accV...
26,673
199
// Innherited from Open Zeppelin AccessControl.sol /
function getRoleAdmin(
function getRoleAdmin(
13,466
54
// Mints batches of NFTs. Limited to maximum number of NFTs that can be minted for this drop. Needs to be called in tokenId sequence. creatorWallet The wallet address of the NFT creator. startId The tokenId from which to start batch mint. length The total number of NFTs to mint starting from the startId. recipient Opti...
function batchMint( address creatorWallet, uint256 startId, uint256 length, address recipient
function batchMint( address creatorWallet, uint256 startId, uint256 length, address recipient
45,921
51
// Determine the prior number of votes for an account as of a block number/Block number must be a finalized block or else this function will revert to prevent misinformation./account The address of the account to check/blockNumber The block number to get the vote balance at/ return The number of votes the account had a...
function getPriorVotes(address account, uint blockNumber) public view returns (uint) { require(blockNumber < block.number, "getPriorVotes:not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check mos...
function getPriorVotes(address account, uint blockNumber) public view returns (uint) { require(blockNumber < block.number, "getPriorVotes:not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check mos...
28,322
36
// 4 bytes for signature
if (msgData.length > 4) { assembly { refererAddress := mload(add(msgData, 20)) }
if (msgData.length > 4) { assembly { refererAddress := mload(add(msgData, 20)) }
52,867
28
// update balances
vUSDCreserve = vUSDCreserveNew; vXAUreserve = vXAUreserveNew; emit NewReserves(vUSDCreserveNew, vXAUreserveNew);
vUSDCreserve = vUSDCreserveNew; vXAUreserve = vXAUreserveNew; emit NewReserves(vUSDCreserveNew, vXAUreserveNew);
3,387
176
// So we add 32 to make it lowercase
bLower[i] = bytes1(uint8(bStr[i]) + 32);
bLower[i] = bytes1(uint8(bStr[i]) + 32);
24,616
27
// Denominator for constraints: 'cpu/decode/opcode_rc/bit', 'rc16/perm/step0', 'rc16/diff_is_bit', 'pedersen/hash0/ec_subset_sum/booleanity_test', 'pedersen/hash0/ec_subset_sum/add_points/slope', 'pedersen/hash0/ec_subset_sum/add_points/x', 'pedersen/hash0/ec_subset_sum/add_points/y', 'pedersen/hash0/ec_subset_sum/copy...
mstore(0x53a0, addmod(/*point^trace_length*/ mload(0x4e40), sub(PRIME, 1), PRIME))
mstore(0x53a0, addmod(/*point^trace_length*/ mload(0x4e40), sub(PRIME, 1), PRIME))
24,602
0
// mapping
mapping( address => uint) private balances; mapping (uint => Progesteron) private intensity; mapping(uint => Estrogen) private intensify; mapping(uint => Type) private types; mapping (uint => Surgery) public Surgeries; mapping (address => bool) public enrolled; address public owner; eve...
mapping( address => uint) private balances; mapping (uint => Progesteron) private intensity; mapping(uint => Estrogen) private intensify; mapping(uint => Type) private types; mapping (uint => Surgery) public Surgeries; mapping (address => bool) public enrolled; address public owner; eve...
20,295
13
// Returns an TokenType for a given token ID.Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query /
function getTokenType(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: TokenType query for nonexistent token"); return _tokenType[tokenId]; }
function getTokenType(uint256 tokenId) external view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: TokenType query for nonexistent token"); return _tokenType[tokenId]; }
12,995
25
// Sets the address of the proxy admin.newAdmin Address of the new proxy admin./
function _setAdmin(address newAdmin) internal { bytes32 slot = ADMIN_SLOT; /* solium-disable-next-line */ assembly { sstore(slot, newAdmin) } }
function _setAdmin(address newAdmin) internal { bytes32 slot = ADMIN_SLOT; /* solium-disable-next-line */ assembly { sstore(slot, newAdmin) } }
17,254
57
// Switch dynamic emission rate, only owner
function setEmissionBool(bool _input) external onlyOwner { dynamicEmissionOn = _input; }
function setEmissionBool(bool _input) external onlyOwner { dynamicEmissionOn = _input; }
5,414
19
// check expiration date
require(_expirationDate >= block.timestamp);
require(_expirationDate >= block.timestamp);
31,794
117
// Calculate the amount to share post-treasury fee
uint256 amountToShareToWinners = ( ((_lotteries[_lotteryId].amountCollectedInAlmanack) * (10000 - _lotteries[_lotteryId].treasuryFee)) ) / 10000;
uint256 amountToShareToWinners = ( ((_lotteries[_lotteryId].amountCollectedInAlmanack) * (10000 - _lotteries[_lotteryId].treasuryFee)) ) / 10000;
10,116
61
// Returns the domain separator for the current chain. /
function _domainSeparatorV4() internal view returns (bytes32) { uint256 chainID; assembly { chainID := chainid() } if (chainID == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASH...
function _domainSeparatorV4() internal view returns (bytes32) { uint256 chainID; assembly { chainID := chainid() } if (chainID == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASH...
2,236
63
// unsuccess:
success := 0 cb := 0
success := 0 cb := 0
6,812
9
// Collects DODO token
IDodoMine(rewards).claimAllRewards();
IDodoMine(rewards).claimAllRewards();
43,551
1
// returns the smallest integer larger than or equal to the square root of a positive integer /
function ceilSqrt(uint256 num) internal pure returns (uint256) { uint256 x = floorSqrt(num); return x * x == num ? x : x + 1; }
function ceilSqrt(uint256 num) internal pure returns (uint256) { uint256 x = floorSqrt(num); return x * x == num ? x : x + 1; }
29,439
195
// parts[16] = '</text></svg>';
string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8])); output = string(abi.encodePacked(output, parts[9], parts[10], parts[11], parts[12], parts[13], parts[14], parts[15], parts[16]));
string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8])); output = string(abi.encodePacked(output, parts[9], parts[10], parts[11], parts[12], parts[13], parts[14], parts[15], parts[16]));
1,893
24
// Remove re-investor from the renumeration
if (reInvestorsIndex[msg.sender] != 0) { uint256 index = reInvestorsIndex[msg.sender]; address lastReinvestor = reInvestors[reInvestorsCount];
if (reInvestorsIndex[msg.sender] != 0) { uint256 index = reInvestorsIndex[msg.sender]; address lastReinvestor = reInvestors[reInvestorsCount];
20,741
62
// transfer wei to receiver
function forward() public payable { require(msg.value > 0, ERROR_WRONG_AMOUNT); weiCollected = weiCollected.add(msg.value); internalForward(); }
function forward() public payable { require(msg.value > 0, ERROR_WRONG_AMOUNT); weiCollected = weiCollected.add(msg.value); internalForward(); }
32,471
161
// transfer nft to winner
NFTAddress.safeTransferFrom(address(this), highestBidder, NFTId);
NFTAddress.safeTransferFrom(address(this), highestBidder, NFTId);
7,761
11
// return one wad, 1e18/
function wad() internal pure returns (uint256) { return WAD; }
function wad() internal pure returns (uint256) { return WAD; }
11,913
20
// Storage slot with the admin of the contract.This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and isvalidated in the constructor. /
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
7,768
33
// According to the app basic law, we should never revert in a termination callback
if (!_isSameToken(_superToken) || !_isCFAv1(_agreementClass)) return _ctx; userData = "";
if (!_isSameToken(_superToken) || !_isCFAv1(_agreementClass)) return _ctx; userData = "";
10,758
24
// Function to check permissions of a manager _manageraddress Manager`s address _permissionName stringPermission namereturn True if manager has been granted needed permission /
function isPermissionGranted( address _manager, string _permissionName ) public constant onlyValidManagerAddress(_manager) onlyValidPermissionName(_permissionName) returns (bool)
function isPermissionGranted( address _manager, string _permissionName ) public constant onlyValidManagerAddress(_manager) onlyValidPermissionName(_permissionName) returns (bool)
47,205
20
// Authorise a single conditional order params The parameters of the conditional order dispatch Whether to dispatch the `ConditionalOrderCreated` event /
function create(IConditionalOrder.ConditionalOrderParams calldata params, bool dispatch) public { if (!(address(params.handler) != address(0))) { revert InvalidHandler(); } singleOrders[msg.sender][hash(params)] = true; if (dispatch) { emit ConditionalOrderCr...
function create(IConditionalOrder.ConditionalOrderParams calldata params, bool dispatch) public { if (!(address(params.handler) != address(0))) { revert InvalidHandler(); } singleOrders[msg.sender][hash(params)] = true; if (dispatch) { emit ConditionalOrderCr...
20,114
1
// Pass in the address of the Access keys collection
address _accessKeysCollection
address _accessKeysCollection
12,075
18
// 检查帐户余额是否大于要减去的值
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
33,469
670
// Allows a rewarder to be explicitly added to an allowlist of rewarders /
function allowlistRewarder( IERC20 pool, IERC20 rewardsToken, address rewarder
function allowlistRewarder( IERC20 pool, IERC20 rewardsToken, address rewarder
13,991
1,261
// EVENTS // MODIFIERS/ This is overridden to both pay fees (which is done by applyFundingRate()) and apply the funding rate.
modifier fees override { // Note: the funding rate is applied on every fee-accruing transaction, where the total change is simply the // rate applied linearly since the last update. This implies that the compounding rate depends on the frequency // of update transactions that have this modif...
modifier fees override { // Note: the funding rate is applied on every fee-accruing transaction, where the total change is simply the // rate applied linearly since the last update. This implies that the compounding rate depends on the frequency // of update transactions that have this modif...
12,485
60
// aave interface functions
function _supplyAave(address _underlyingToken, uint256 amount) internal { Aave(aaveLendingPool).deposit(_underlyingToken, amount, aaveCode); }
function _supplyAave(address _underlyingToken, uint256 amount) internal { Aave(aaveLendingPool).deposit(_underlyingToken, amount, aaveCode); }
6,659
0
// IModuleGlobals Lens ProtocolThis is the interface for the ModuleGlobals contract, a data providing contract to be queried by modulesfor the most up-to-date parameters. /
interface IModuleGlobals { /** * @notice Sets the governance address. This function can only be called by governance. * * @param newGovernance The new governance address to set. */ function setGovernance(address newGovernance) external; /** * @notice Sets the treasury address. This...
interface IModuleGlobals { /** * @notice Sets the governance address. This function can only be called by governance. * * @param newGovernance The new governance address to set. */ function setGovernance(address newGovernance) external; /** * @notice Sets the treasury address. This...
25,130
17
// Notify callback contract of failed verification
IVerifiable(controller.getContract(keccak256("JobsManager"))).receiveVerification(oc.jobId, oc.claimId, oc.segmentNumber, false); OraclizeCallback(oc.jobId, oc.claimId, oc.segmentNumber, _proof, false);
IVerifiable(controller.getContract(keccak256("JobsManager"))).receiveVerification(oc.jobId, oc.claimId, oc.segmentNumber, false); OraclizeCallback(oc.jobId, oc.claimId, oc.segmentNumber, _proof, false);
41,031
12
// Name: modifyCustomer Description : This function allows a bank to modify a customer's data. This will remove the customer from the kyc request list and set the number of downvote and upvote to zero. Parameters:
* @param {string} custName : The name of the customer * @param {string} custData : The hash of the customer data as a string. * *******************************************************************************************************************/ function modifyCustomer( str...
* @param {string} custName : The name of the customer * @param {string} custData : The hash of the customer data as a string. * *******************************************************************************************************************/ function modifyCustomer( str...
33,800
86
// Get the balance of an account's Tokens ownerThe address of the token holder tokenId ID of the Tokenreturn The _owner's balance of the token type requested /
function balanceOf(address owner, uint256 tokenId)
function balanceOf(address owner, uint256 tokenId)
41,234
0
// Interface for a sweepable airdrop contract based on merkle tree The airdrop has an expiration time. Once this expiration timeis reached the contract owner can sweep all unclaimed funds.As long as the contract has funds, claiming will continue towork after expiration time.Michael Bauer <michael@m-bauer.org> /
interface IMerkleDistributor { /** * Returns the address of the token distributed by this contract. */ function token() external view returns (address); /** * Returns the expiration time of the airdrop as unix timestamp * (Seconds since unix epoch) */ function expireTimestamp()...
interface IMerkleDistributor { /** * Returns the address of the token distributed by this contract. */ function token() external view returns (address); /** * Returns the expiration time of the airdrop as unix timestamp * (Seconds since unix epoch) */ function expireTimestamp()...
2,408
96
// set's development address /
function setDevelopmentFeeAddress(address payable wallet) external onlyOwner { developmentAddress = wallet; }
function setDevelopmentFeeAddress(address payable wallet) external onlyOwner { developmentAddress = wallet; }
27,457
183
// Set yvault tax enable
function setTaxEnable(bool taxEnabled_) public onlyOwner { yvaultBalance = yvault.balanceOf(address(this)); yvault.setTaxEnable(taxEnabled_); }
function setTaxEnable(bool taxEnabled_) public onlyOwner { yvaultBalance = yvault.balanceOf(address(this)); yvault.setTaxEnable(taxEnabled_); }
17,645
32
// Helper function
function _shiftAndAdd(uint256[] memory slots, uint256 tokenId) internal virtual pure returns (uint256[] memory)
function _shiftAndAdd(uint256[] memory slots, uint256 tokenId) internal virtual pure returns (uint256[] memory)
9,491
199
// The total nft staked amount
uint256 public totalNftStaked;
uint256 public totalNftStaked;
72,521
17
// 2^192 doesn't fit within the 192.64-bit format used internally in this function.
if (x >= 192e18) { revert PRBMathUD60x18__Exp2InputTooBig(x); }
if (x >= 192e18) { revert PRBMathUD60x18__Exp2InputTooBig(x); }
41,729
164
// this will be the balance on the smart contract private account
uint256 cBalance = getCombinedAccountBalance(_spender); uint256 total = cBalance + walletBalance ; require(_amount <= total, "Not enough tokens to spend");
uint256 cBalance = getCombinedAccountBalance(_spender); uint256 total = cBalance + walletBalance ; require(_amount <= total, "Not enough tokens to spend");
35,615
88
// calculate gas used
uint256 gasUsed = startGas.sub(gasleft());
uint256 gasUsed = startGas.sub(gasleft());
32,493
0
// Model a consumer
struct Consumer
struct Consumer
13,950
43
// Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. /
function transfer(address recipient, uint256 amount) Governance(msg.sender) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
function transfer(address recipient, uint256 amount) Governance(msg.sender) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
14,688
5
// freeze account
mapping(address=>bool) public frozenAccount;
mapping(address=>bool) public frozenAccount;
25,152