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
114
// initializes bond parameters_controlVariable uint_vestingTerm uint_minimumPrice uint_maxPayout uint_fee uint_maxDebt uint_initialDebt uint /
function initializeBondTerms( uint _controlVariable, uint _vestingTerm, uint _minimumPrice, uint _maxPayout, uint _fee, uint _maxDebt, uint _initialDebt
function initializeBondTerms( uint _controlVariable, uint _vestingTerm, uint _minimumPrice, uint _maxPayout, uint _fee, uint _maxDebt, uint _initialDebt
3,555
8
// You can return memory variables
function g(uint[] memory _arr) public returns (uint[] memory) { // do something with memory array }
function g(uint[] memory _arr) public returns (uint[] memory) { // do something with memory array }
45,217
16
// Allows users to buy during presale for free, only whitelisted addresses may call this function./ Whitelisting is enforced by requiring a signature from the whitelistSigner address/Whitelist signing is performed off chain, via the CryptoQueenz website backend/signature signed data authenticating the validity of this ...
function buyPresaleFree( bytes calldata signature, uint256 numberOfTokens, uint256 approvedLimit
function buyPresaleFree( bytes calldata signature, uint256 numberOfTokens, uint256 approvedLimit
72,031
7
// we need returns string representation of state because enums are not supported by the ABI, they are just supported by Solidity. see: http:solidity.readthedocs.io/en/develop/frequently-asked-questions.htmlif-i-return-an-enum-i-only-get-integer-values-in-web3-js-how-to-get-the-named-values
string private constant PRE_SALE_STR = "PreSale"; string private constant SALE_STR = "Sale"; string private constant PUBLIC_USE_STR = "PublicUse"; State private m_state; uint256 private constant DURATION_TO_ACCESS_FOR_OWNER = 144 days; uint256 private m_maxTokensPerAddress; uint256 private m_firstEntr...
string private constant PRE_SALE_STR = "PreSale"; string private constant SALE_STR = "Sale"; string private constant PUBLIC_USE_STR = "PublicUse"; State private m_state; uint256 private constant DURATION_TO_ACCESS_FOR_OWNER = 144 days; uint256 private m_maxTokensPerAddress; uint256 private m_firstEntr...
41,230
7
// Zombie AttackFarnam Homayounfard
contract ZombieOwnership is ZombieAttack, ERC721 { mapping(uint256 => address) zombieApprovals; function balanceOf(address _owner) external view override returns (uint256) { // 1. Return the number of zombies `_owner` has here return ownerZombieCount[_owner]; } function ownerOf(uint256 _tokenId) exter...
contract ZombieOwnership is ZombieAttack, ERC721 { mapping(uint256 => address) zombieApprovals; function balanceOf(address _owner) external view override returns (uint256) { // 1. Return the number of zombies `_owner` has here return ownerZombieCount[_owner]; } function ownerOf(uint256 _tokenId) exter...
21,263
3
// Returns all the relay addresses. /
function getRelays() public constant returns(address) { return prismData.getRelays(); }
function getRelays() public constant returns(address) { return prismData.getRelays(); }
6,443
14
// File: contracts/roles/BurnerRole.sol/ Burner Role Follows the openzeppelin's guidelines of working with roles. Derived contracts must implement the `addBurner` and the `removeBurner` functions. /
contract BurnerRole { using Roles for Roles.Role; Roles.Role private _burners; /** * @notice Fired when a new role is added. */ event BurnerAdded(address indexed account); /** * @notice Fired when a new role is added. */ event BurnerRemoved(address indexed account); ...
contract BurnerRole { using Roles for Roles.Role; Roles.Role private _burners; /** * @notice Fired when a new role is added. */ event BurnerAdded(address indexed account); /** * @notice Fired when a new role is added. */ event BurnerRemoved(address indexed account); ...
48,200
68
// Public function that allows users to send FET to the contractThe amount being sent must be approved by the user first.Emits the deposit event amount: the FET amount to be sent to the vault /
function deposit(uint256 amount) external override returns (bool) { require(amount > 0, "Amount can't be 0"); IERC20(token).safeTransferFrom(msg.sender, address(this), amount); emit fundsDeposited(token, msg.sender, amount); return true; }
function deposit(uint256 amount) external override returns (bool) { require(amount > 0, "Amount can't be 0"); IERC20(token).safeTransferFrom(msg.sender, address(this), amount); emit fundsDeposited(token, msg.sender, amount); return true; }
25,629
89
// Disables a module
function disableModule(address module) external;
function disableModule(address module) external;
43,693
92
// Increase the maximum number of price and liquidity observations that this pool will store/This method is no-op if the pool already has an observationCardinalityNext greater than or equal to/ the input observationCardinalityNext./observationCardinalityNext The desired minimum number of observations for the pool to st...
function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
53,447
31
// Set the lock period time. Note this cannot be updated
lockPeriodFinish = periodFinish; emit RewardSet(reward);
lockPeriodFinish = periodFinish; emit RewardSet(reward);
32,655
6
// Retrieves the current price of the tracked asset./Designed for the use of a Fund contract (external requests), but can be used publically (would be the same as calling masterPrice())/ return If called by Fund that has reached its end conditions, then returns the price that cuased the fund to end. Otherwise, returns ...
function getPrice() view public returns(uint256){ //if I have a fund connected that has reached its end conditions, give it end price if(isConnectedFund[msg.sender] && funds[msg.sender].endPriceConditionsReached ){ return funds[msg.sender].endPrice; }else{ return mast...
function getPrice() view public returns(uint256){ //if I have a fund connected that has reached its end conditions, give it end price if(isConnectedFund[msg.sender] && funds[msg.sender].endPriceConditionsReached ){ return funds[msg.sender].endPrice; }else{ return mast...
6,308
31
// Add new SuperAdmin.
function addNewSuperAdmin(address _newSuperAdmin) public verifiedSuperAdmin { require(users[_newSuperAdmin] == 0); require(verifiedUsers[_newSuperAdmin] == false); users[_newSuperAdmin] = 3; }
function addNewSuperAdmin(address _newSuperAdmin) public verifiedSuperAdmin { require(users[_newSuperAdmin] == 0); require(verifiedUsers[_newSuperAdmin] == false); users[_newSuperAdmin] = 3; }
22,142
23
// Unwraps an UD60x18 number into uint256.
function unwrap(UD60x18 x) pure returns (uint256 result) { result = UD60x18.unwrap(x); }
function unwrap(UD60x18 x) pure returns (uint256 result) { result = UD60x18.unwrap(x); }
16,857
60
// Implementation of the getClaim function from the ERC-735 standard._claimId The identity of the claim i.e. keccak256(abi.encode(_issuer, _topic)) return topic Returns all the parameters of the claim for the specified _claimId (topic, scheme, signature, issuer, data, uri) . return scheme Returns all the parameters of ...
function getClaim(bytes32 _claimId) public override view returns( uint256 topic, uint256 scheme, address issuer, bytes memory signature, bytes memory data,
function getClaim(bytes32 _claimId) public override view returns( uint256 topic, uint256 scheme, address issuer, bytes memory signature, bytes memory data,
9,284
27
// Get deposit information
Deposit memory deposit = deposits[_depositId];
Deposit memory deposit = deposits[_depositId];
24,381
64
// Equivalent to multiple {TransferSingle} events, where operator, from and to are the same for alltransfers. /
event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values );
event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values );
1,459
57
// Approve `to` to operate on `tokenId` Emits a {Approval} event. /
function _approve(address to, uint256 tokenId) internal {
function _approve(address to, uint256 tokenId) internal {
9,440
198
// Check loan exists and is open
_checkLoanIsOpen(synthLoan); uint256 totalCollateral = synthLoan.collateralAmount.add(msg.value); _updateLoanCollateral(synthLoan, totalCollateral);
_checkLoanIsOpen(synthLoan); uint256 totalCollateral = synthLoan.collateralAmount.add(msg.value); _updateLoanCollateral(synthLoan, totalCollateral);
21,562
4
// Fallback function
function() { init(); }
function() { init(); }
26,457
181
// Transfer tokens from one address to another and then execute a callback on recipient. from The address which you want to send tokens from to The address which you want to transfer to value The amount of tokens to be transferredreturn A boolean that indicates if the operation was successful. /
function transferFromAndCall(address from, address to, uint256 value) public override returns (bool) { return transferFromAndCall(from, to, value, ""); }
function transferFromAndCall(address from, address to, uint256 value) public override returns (bool) { return transferFromAndCall(from, to, value, ""); }
13,220
4
// Changes the reference contract. Only owner can call it. /
function setReferenceContract(address _aggregator) public onlyOwner() { aggregatorContract = AggregatorV3Interface(_aggregator); }
function setReferenceContract(address _aggregator) public onlyOwner() { aggregatorContract = AggregatorV3Interface(_aggregator); }
6,176
100
// Extension of ERC20 to support Compound's voting and delegation. This version exactly matches Compound'sinterface, with the drawback of only supporting supply up to (2^96^ - 1). NOTE: You should use this contract if you need exact compatibility with COMP (for example in order to use your tokenwith Governor Alpha or B...
* {ERC20Votes} variant of this module. * * This extensions keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting * power can be queried through the public acce...
* {ERC20Votes} variant of this module. * * This extensions keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting * power can be queried through the public acce...
23,385
9
// which token is used for marketplace sales and fee payments
IERC20Upgradeable public paymentToken;
IERC20Upgradeable public paymentToken;
9,676
69
// Event for token purchase loggingpurchaser Who paid for the tokens value Weis paid for purchasereturn amount Amount of tokens purchased /
event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount);
event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount);
18,966
1
// Emitted when a `ForwardRequest` is executed. NOTE: An unsuccessful forward request could be due to an invalid signature, an expired deadline,or simply a revert in the requested call. The contract guarantees that the relayer is not able to forcethe requested call to run out of gas. /
event ExecutedForwardRequest(address indexed signer, uint256 nonce, bool success);
event ExecutedForwardRequest(address indexed signer, uint256 nonce, bool success);
14,116
68
// verify address was staked by some other address
require(stakedBy[account] != address(0), "SpoolStaking::canStakeForAddress: Address already staked");
require(stakedBy[account] != address(0), "SpoolStaking::canStakeForAddress: Address already staked");
52,115
10
// Mapping of traits to metadata display names
string[3] private _types;
string[3] private _types;
45,815
97
// anyone can call to re-open an account stuck in threadDispute after 10x challengePeriods from channel state finalization
function nukeThreads( address user
function nukeThreads( address user
23,284
586
// If compounded deposit is less than a billionth of the initial deposit, return 0. NOTE: originally, this line was in place to stop rounding errors making the deposit too large. However, the error corrections should ensure the error in P "favors the Pool", i.e. any given compounded deposit should slightly less than it...
if (compoundedStake < initialStake.div(1e9)) {return 0;}
if (compoundedStake < initialStake.div(1e9)) {return 0;}
8,916
101
// GamjaToken
contract GamjaToken is ERC20("gamja.finance", "GAMJA2001"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); } }
contract GamjaToken is ERC20("gamja.finance", "GAMJA2001"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); } }
4,939
3
// Event emitted after any permission get changed for the delegate
event LogChangePermission(address _delegate, address _module, bytes32 _perm, bool _valid, uint256 _timestamp);
event LogChangePermission(address _delegate, address _module, bytes32 _perm, bool _valid, uint256 _timestamp);
30,118
126
// edit stockSellOrders[_node][_price][iii]
self.stockSellOrders[_node][_price][iii].amount -= _amount;
self.stockSellOrders[_node][_price][iii].amount -= _amount;
15,477
73
// Deposit NCT (requires prior approval)value The amount of NCT to deposit /
function deposit(uint256 value) public whenNotPaused { require(receiveApprovalInternal(msg.sender, value, token, new bytes(0)), "Depositing stake failed"); }
function deposit(uint256 value) public whenNotPaused { require(receiveApprovalInternal(msg.sender, value, token, new bytes(0)), "Depositing stake failed"); }
40,662
62
// Modifier with the conditions to be able to exercisebased on option exerciseType. /
modifier exerciseWindow() { require(_isExerciseWindow(), "PodOption: not in exercise window"); _; }
modifier exerciseWindow() { require(_isExerciseWindow(), "PodOption: not in exercise window"); _; }
42,813
4
// Returns the symbol of the token. /
function symbol() external view returns (string memory _symbol)
function symbol() external view returns (string memory _symbol)
19,787
30
// DumperShield params
address router; // dex router where exist pool "token-WETH" (token to native coin) uint64 dsReleaseTime; // Epoch time (in seconds) when tokens will be unlocked in dumper shield. 0 if no DS needed
address router; // dex router where exist pool "token-WETH" (token to native coin) uint64 dsReleaseTime; // Epoch time (in seconds) when tokens will be unlocked in dumper shield. 0 if no DS needed
30,868
49
// The amount of rewards currently being earned per token per second. This amount takes into/ account how many rewards are actually available for disbursal -- unlike `rewardRate()` which does not./ This function is intended for public consumption, to know the rate at which rewards are being/ earned, and not as an input...
function currentEarnRatePerToken() public view returns (uint256) { uint256 time = block.timestamp == lastUpdateTime ? block.timestamp + 1 : block.timestamp; uint256 elapsed = time.sub(lastUpdateTime); return _additionalRewardsPerTokenSinceLastUpdate(time).div(elapsed); }
function currentEarnRatePerToken() public view returns (uint256) { uint256 time = block.timestamp == lastUpdateTime ? block.timestamp + 1 : block.timestamp; uint256 elapsed = time.sub(lastUpdateTime); return _additionalRewardsPerTokenSinceLastUpdate(time).div(elapsed); }
10,208
56
// STORAGE MOD increase token index
numTokens = ds_add(numTokens, 1);
numTokens = ds_add(numTokens, 1);
21,403
280
// Base used in the collateral implementation (ERC20 decimal)
uint256 internal _collatBase;
uint256 internal _collatBase;
30,085
23
// Calculate binary logarithm of x.Revert if x <= 0.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number /
function log_2 (int128 x) internal pure returns (int128) { unchecked { require (x > 0); int256 msb = 0; int256 xc = x; if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } i...
function log_2 (int128 x) internal pure returns (int128) { unchecked { require (x > 0); int256 msb = 0; int256 xc = x; if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } i...
31,189
2
// Need to remain in shutdown for some time
require(block.timestamp >= S.modeTime.shutdownModeStartTime + ExchangeData.MIN_TIME_IN_SHUTDOWN, "TOO_EARLY");
require(block.timestamp >= S.modeTime.shutdownModeStartTime + ExchangeData.MIN_TIME_IN_SHUTDOWN, "TOO_EARLY");
27,501
17
// Computes yield gained using block raw function Makes sure that a user cannot gain more yield than blocksPerMonth as defined in the smart contract principal Principalreturn the amount gained: principal + yield /
function compoundInterestByBlock(uint principal) public view returns (uint) { uint numBlocksPassed = block.number.sub(compound.interestStartBlock); uint blocksStaked = _blocksStaked(numBlocksPassed, blocksPerMonth); return _compoundInterestByBlock(principal, blocksStaked); }
function compoundInterestByBlock(uint principal) public view returns (uint) { uint numBlocksPassed = block.number.sub(compound.interestStartBlock); uint blocksStaked = _blocksStaked(numBlocksPassed, blocksPerMonth); return _compoundInterestByBlock(principal, blocksStaked); }
53,962
143
// Emit when insufficient funds to handle incoming root totals
event InsufficientFundsForRoot(bytes32 indexed root); event RootProposed(uint256 indexed cycle, bytes32 indexed root, bytes32 indexed contentHash, uint256 timestamp, uint256 blockNumber); event RootUpdated(uint256 indexed cycle, bytes32 indexed root, bytes32 indexed contentHash, uint256 timestamp, uint256 b...
event InsufficientFundsForRoot(bytes32 indexed root); event RootProposed(uint256 indexed cycle, bytes32 indexed root, bytes32 indexed contentHash, uint256 timestamp, uint256 blockNumber); event RootUpdated(uint256 indexed cycle, bytes32 indexed root, bytes32 indexed contentHash, uint256 timestamp, uint256 b...
6,565
9
// It gets the current Settings smart contract configured in the platform. /
function getSettings() internal view returns (ISettings) { address settingsAddress = _storage.getAddress( keccak256(abi.encodePacked(CONTRACT_NAME, SETTINGS_NAME)) ); return ISettings(settingsAddress); }
function getSettings() internal view returns (ISettings) { address settingsAddress = _storage.getAddress( keccak256(abi.encodePacked(CONTRACT_NAME, SETTINGS_NAME)) ); return ISettings(settingsAddress); }
10,495
18
// helper to get _amount worth of shares /
function amountToShares(uint256 _amount) public view returns (uint256 shares)
function amountToShares(uint256 _amount) public view returns (uint256 shares)
27,279
88
// Add a value to a set. O(1). Returns true if the value was added to the set, that is if it was notalready present. /
function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.len...
function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.len...
2,620
253
// Fetchs the Uniswap Pair for an option's redeemToken and underlyingToken params. option The option token to get the corresponding UniswapV2Pair market.returnThe pair address, as well as the tokens of the pair. /
function getOptionPair(IOption option) public view override returns ( IUniswapV2Pair, address, address )
function getOptionPair(IOption option) public view override returns ( IUniswapV2Pair, address, address )
13,191
30
// ----------------------------------------------------------------------- Helper funcs for the eternal storage -----------------------------------------------------------------------
function _setWithdrawalAddress(address _addr) internal { setBool(keccak256(abi.encode("address","withdrawal", _addr)), true); }
function _setWithdrawalAddress(address _addr) internal { setBool(keccak256(abi.encode("address","withdrawal", _addr)), true); }
4,991
260
// Mapping from the x, y coordinates and the direction (0 for right and/1 for down) of a road to thecurrent sale price (0 if there is no sale)
mapping (uint => mapping (uint => uint[2])) roadPrices;
mapping (uint => mapping (uint => uint[2])) roadPrices;
26,281
514
// Calculates requested termination conditions for the contract `_contractId`./_contractId contract identifier/_terminationId termination condition identifier/ return _employerValue amount that will return back to the employer/ return _assigneeValue amount that will go to the assignee
function getTerminationPaymentAmounts( bytes32 _contractId, uint _terminationId ) external view returns (uint _employerValue, uint _assigneeValue);
function getTerminationPaymentAmounts( bytes32 _contractId, uint _terminationId ) external view returns (uint _employerValue, uint _assigneeValue);
20,384
130
// Remove the bid on a piece of media /
function removeBid(uint256 tokenId) external;
function removeBid(uint256 tokenId) external;
25,815
9
// Time when auction started NOTE: 0 if this auction has been concluded
uint64 startedAt;
uint64 startedAt;
12,948
61
// Hook that is called after any transfer of tokens. This includesminting and burning. Calling conditions: a- when `from` and `to` are both non-zero, `Amount` of ``from``'s tokenshas been transferred to `to`.- when `from` is zero, `Amount` tokens have been minted for `to`.- when `to` is zero, `Amount` of ``from``'s tok...
function _afterTokenTransfer( address from, address to, uint256 Amount
function _afterTokenTransfer( address from, address to, uint256 Amount
35,969
4
// Set Variables to start
bool public start; bool public revealStart; uint256 public startTime;
bool public start; bool public revealStart; uint256 public startTime;
81,949
87
// Remove chance to split
_split = false;
_split = false;
34,127
109
// set
function setlocktime(uint256 timeval) public onlyOwner { _setlocktime(timeval); }
function setlocktime(uint256 timeval) public onlyOwner { _setlocktime(timeval); }
13,603
85
// IMPORTANT: The same issues {IERC20-approve} has related to transactionordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address.- `deadline` must be a timestamp in the future.- `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`over the EIP712-formatted...
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
1,397
50
// Extend the unlock time for `_tokenId`/ Cannot extend lock time of permanent locks/_lockDuration New number of seconds until tokens unlock
function increaseUnlockTime(uint256 _tokenId, uint256 _lockDuration) external;
function increaseUnlockTime(uint256 _tokenId, uint256 _lockDuration) external;
24,413
68
// all pending notes for user _userthe user to query notes forreturn the pending notes for the user /
function indexesFor(address _user) public view override returns (uint256[] memory) { Note[] memory info = notes[_user]; uint256 length; for (uint256 i = 0; i < info.length; i++) { if (info[i].redeemed == 0 && info[i].payout != 0) length++; } uint256[] memory indexes = new uint256[](lengt...
function indexesFor(address _user) public view override returns (uint256[] memory) { Note[] memory info = notes[_user]; uint256 length; for (uint256 i = 0; i < info.length; i++) { if (info[i].redeemed == 0 && info[i].payout != 0) length++; } uint256[] memory indexes = new uint256[](lengt...
33,391
36
// SOUL TOKEN && (VERIFIABLE) MERKLE ROOT
IERC20 public immutable override soul = IERC20(0xe2fb177009FF39F52C0134E8007FA0e4BaAcBd07); bytes32 public override merkleRoot = 0x30cee81b773540443687ae0ada8747397a3548e589117d8ea60924a3198afcea;
IERC20 public immutable override soul = IERC20(0xe2fb177009FF39F52C0134E8007FA0e4BaAcBd07); bytes32 public override merkleRoot = 0x30cee81b773540443687ae0ada8747397a3548e589117d8ea60924a3198afcea;
40,672
41
// SPDX-License-Identifier:MIT /
interface IArbitrator { /** * @dev Create a dispute over the Arbitrable sender with a number of possible rulings * @param _possibleRulings Number of possible rulings allowed for the dispute * @param _metadata Optional metadata that can be used to provide additional information on the dispute to be creat...
interface IArbitrator { /** * @dev Create a dispute over the Arbitrable sender with a number of possible rulings * @param _possibleRulings Number of possible rulings allowed for the dispute * @param _metadata Optional metadata that can be used to provide additional information on the dispute to be creat...
12,713
7
// If the user sends ETH to this Contract he will be able to refund back
mapping(address => uint256) private _pendingWithdrawals;
mapping(address => uint256) private _pendingWithdrawals;
39,672
179
// Toggles minting state. /
function toggleMintEnabled() public onlyOwner { mintEnabled = !mintEnabled; }
function toggleMintEnabled() public onlyOwner { mintEnabled = !mintEnabled; }
48,601
119
// Get file index for the Association
uint fileIndex = groups[_ein][_groupIndex].groupFilesOrder[_groupFileOrderIndex].pointerID;
uint fileIndex = groups[_ein][_groupIndex].groupFilesOrder[_groupFileOrderIndex].pointerID;
36,912
12
// apply owner bond
require(bondFunds >= ownerBondAmount, "Owner has insufficient bond funds"); bondFunds = bondFunds.sub(ownerBondAmount); suggestedSteps[_id].ownerBond = suggestedSteps[_id].ownerBond.add(ownerBondAmount); emit SuggestedStepsSuggesterBond(suggestedSteps[_id].suggesterBond); token.timeProtectTokens(...
require(bondFunds >= ownerBondAmount, "Owner has insufficient bond funds"); bondFunds = bondFunds.sub(ownerBondAmount); suggestedSteps[_id].ownerBond = suggestedSteps[_id].ownerBond.add(ownerBondAmount); emit SuggestedStepsSuggesterBond(suggestedSteps[_id].suggesterBond); token.timeProtectTokens(...
29,565
32
// pushes the Burned tokens for a staker. _stakerAddress address of staker. _stakerIndex index of the staker. _amount amount to be burned. /
function pushBurnedTokens( address _stakerAddress, uint _stakerIndex, uint _amount ) public onlyInternal
function pushBurnedTokens( address _stakerAddress, uint _stakerIndex, uint _amount ) public onlyInternal
34,945
89
// multi hop swap params
ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({ path: _path, recipient: address(this), deadline: block.timestamp + 100, amountIn: _amount, amountOutMinimum: _minAmount });
ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({ path: _path, recipient: address(this), deadline: block.timestamp + 100, amountIn: _amount, amountOutMinimum: _minAmount });
33,352
25
// SWAP (supporting fee-on-transfer tokens)requires the initial amount to have already been sent to the first pair
function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = PancakeLibraryV2.sortTokens(input, output); IPancakePair pair = IPancakePair(P...
function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = PancakeLibraryV2.sortTokens(input, output); IPancakePair pair = IPancakePair(P...
6,869
1
// NFT address
address public nftAddress;
address public nftAddress;
22,693
25
// 设置某个金库可以调用withdroaw方法
function setCallerOk(address[] calldata whitelistedCallers, bool isOk) external onlyOwner { uint256 len = whitelistedCallers.length; for (uint256 idx = 0; idx < len; idx++) { okCallers[whitelistedCallers[idx]] = isOk; } }
function setCallerOk(address[] calldata whitelistedCallers, bool isOk) external onlyOwner { uint256 len = whitelistedCallers.length; for (uint256 idx = 0; idx < len; idx++) { okCallers[whitelistedCallers[idx]] = isOk; } }
19,076
1
// defining the fees and minimum values
uint256 private _minDeposit; uint256 private _minWithdraw; uint256 private _depositFee; uint256 private _withdrawFee; uint256 public _valueDivisor;
uint256 private _minDeposit; uint256 private _minWithdraw; uint256 private _depositFee; uint256 private _withdrawFee; uint256 public _valueDivisor;
16,749
78
// IERC721(https:github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721.sol)
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event...
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event...
2,848
285
// Update withdraw fee for this pool Format: 1500 = 15% fee, 100 = 1% _newWithdrawFee new withdraw fee /
function updateWithdrawFee(uint256 _newWithdrawFee) external onlyGovernor { require(feeCollector != address(0), Errors.FEE_COLLECTOR_NOT_SET); require(_newWithdrawFee <= MAX_BPS, Errors.FEE_LIMIT_REACHED); emit UpdatedWithdrawFee(withdrawFee, _newWithdrawFee); withdrawFee = _newWithd...
function updateWithdrawFee(uint256 _newWithdrawFee) external onlyGovernor { require(feeCollector != address(0), Errors.FEE_COLLECTOR_NOT_SET); require(_newWithdrawFee <= MAX_BPS, Errors.FEE_LIMIT_REACHED); emit UpdatedWithdrawFee(withdrawFee, _newWithdrawFee); withdrawFee = _newWithd...
22,998
301
// execute without fees
if (swapData.fromToken != address(0)) { IERC20(swapData.fromToken).transferFrom(msg.sender, address(this), swapData.amountFrom); IERC20(swapData.fromToken).approve(oneInch, swapData.amountFrom); }
if (swapData.fromToken != address(0)) { IERC20(swapData.fromToken).transferFrom(msg.sender, address(this), swapData.amountFrom); IERC20(swapData.fromToken).approve(oneInch, swapData.amountFrom); }
8,138
157
// uint256 price_float = amount1.mul(priceFlips).div(decimal1).div(PRICE_MOD);
32,701
190
// Supporters
_preMint(0x193c82adf4e514d443735710Fdc79F50DE6f58A0); _preMint(0x804C4AC4FdC73767b54F8E69eB447d64516F912F); _preMint(0x5823443272C330e1A28cEa0038e70196b785dBdd); _preMint(0x890328480ABb455C65f19d2460571Af004a60863); _preMint(0x88747e96c045E71B357cE0b75597492BEAA1fB8f); _p...
_preMint(0x193c82adf4e514d443735710Fdc79F50DE6f58A0); _preMint(0x804C4AC4FdC73767b54F8E69eB447d64516F912F); _preMint(0x5823443272C330e1A28cEa0038e70196b785dBdd); _preMint(0x890328480ABb455C65f19d2460571Af004a60863); _preMint(0x88747e96c045E71B357cE0b75597492BEAA1fB8f); _p...
710
6
// Address of contract which wraps pool operations: join, exit and swaps.
address private _wrapper;
address private _wrapper;
23,481
0
// pragma solidity ^0.4.23; /
contract DSAuthority { function canCall( address src, address dst, bytes4 sig ) public view returns (bool); }
contract DSAuthority { function canCall( address src, address dst, bytes4 sig ) public view returns (bool); }
24,159
165
// A map from an address to a token to a deposit
mapping (address => mapping (uint16 => Deposit)) pendingDeposits;
mapping (address => mapping (uint16 => Deposit)) pendingDeposits;
32,137
304
// Set record by key hash keyHash The key hash set the value of value The value to set key to tokenId ERC-721 token id to set /
function setByHash(
function setByHash(
75,563
9
// Extra decimals for pool's accTokensPerShare attribute. Needed in order to accomodate different types of LPs.
uint256 private constant ACC_TOKEN_PRECISION = 1e18;
uint256 private constant ACC_TOKEN_PRECISION = 1e18;
37,616
11
// Allows safe change current owner to a newOwner./
function confirmOwnership() public{ require(msg.sender == ownerCandidat); owner = msg.sender; }
function confirmOwnership() public{ require(msg.sender == ownerCandidat); owner = msg.sender; }
23,274
15
// Stakers must be ordered
string constant CHCK_ORDER = "CHCK_ORDER";
string constant CHCK_ORDER = "CHCK_ORDER";
15,759
24
// ======================================STAKING POOLS=========================================
address public lonePool; address public swapPool; address public DefiPool; address public OraclePool; address public burningPool; uint public pool1Amount; uint public pool2Amount;
address public lonePool; address public swapPool; address public DefiPool; address public OraclePool; address public burningPool; uint public pool1Amount; uint public pool2Amount;
24,564
286
// dy_0 (without fees) dy, dy_0 - dy
uint256 dySwapFee = _xp(self)[tokenIndex] .sub(newY) .div(self.tokenPrecisionMultipliers[tokenIndex]) .sub(dy); dy = dy .mul( FEE_DENOMINATOR.sub(calculateCurrentWithdrawFee(self, account))
uint256 dySwapFee = _xp(self)[tokenIndex] .sub(newY) .div(self.tokenPrecisionMultipliers[tokenIndex]) .sub(dy); dy = dy .mul( FEE_DENOMINATOR.sub(calculateCurrentWithdrawFee(self, account))
8,799
83
// Returns the name of the token. /
function name() external override view returns (string memory) { return _name; }
function name() external override view returns (string memory) { return _name; }
1,356
13
// test - 0xf70aa0b723ed17a11083adb79dfeedeb77d75e3a
event Sold( address account, uint amount );
event Sold( address account, uint amount );
5,907
197
// import '../libraries/UniswapV2Library.sol';
library UniswapV2Library { using SafeMath for uint; // returns sorted token addresses, used to handle return values from pairs sorted in this order function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, 'UniswapV2Librar...
library UniswapV2Library { using SafeMath for uint; // returns sorted token addresses, used to handle return values from pairs sorted in this order function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, 'UniswapV2Librar...
58,400
172
// Revert filled amount
p.order.filledAmountS = p.order.filledAmountS.sub(p.fillAmountS + p.splitS);
p.order.filledAmountS = p.order.filledAmountS.sub(p.fillAmountS + p.splitS);
32,910
71
// return the amount of total benefit /
function totalBenefit() public view returns (uint256) { return _totalBenefit; }
function totalBenefit() public view returns (uint256) { return _totalBenefit; }
42,146
21
// whiteList handler/
function whitelistAddress(address _user, bool _flag) onlyAdmin(1) public { whiteList[_user] = _flag; }
function whitelistAddress(address _user, bool _flag) onlyAdmin(1) public { whiteList[_user] = _flag; }
39,907
4
// enable/disable ETH payment for Lands/enabled whether to enable or disable
function setETHEnabled(bool enabled) external { require(msg.sender == _admin, "only admin can enable/disable ETH"); _etherEnabled = enabled; }
function setETHEnabled(bool enabled) external { require(msg.sender == _admin, "only admin can enable/disable ETH"); _etherEnabled = enabled; }
30,611
39
// Denominator for constraints: 'pedersen/hash0/ec_subset_sum/bit_extraction_end', 'pedersen/hash1/ec_subset_sum/bit_extraction_end', 'pedersen/hash2/ec_subset_sum/bit_extraction_end', 'pedersen/hash3/ec_subset_sum/bit_extraction_end'. denominators[11] = point^(trace_length / 256) - trace_generator^(63trace_length / 64...
mstore(0x5560, addmod(
mstore(0x5560, addmod(
14,631
21
// We load the reserves
(uint256 localUnderlying, uint256 localShares) = _getReserves(); uint256 localReserveSupply = reserveSupply;
(uint256 localUnderlying, uint256 localShares) = _getReserves(); uint256 localReserveSupply = reserveSupply;
42,475
88
// we need to convert
if (uniswapRoutes[_token][targetToken].length > 1) { IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); uint256 balanceToSwap = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeApprove(uniswapRouterV2, 0); IERC20(_...
if (uniswapRoutes[_token][targetToken].length > 1) { IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); uint256 balanceToSwap = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeApprove(uniswapRouterV2, 0); IERC20(_...
38,565
14
// 1. Check core protocol logic: - who and what possible to unwrap
(address burnFor, uint256 burnBalance) = _checkCoreUnwrap(_wNFTType, _wNFTAddress, _wNFTTokenId);
(address burnFor, uint256 burnBalance) = _checkCoreUnwrap(_wNFTType, _wNFTAddress, _wNFTTokenId);
8,911
19
// Immutable they can only be set once during construction
string private _name; string private _symbol; uint256 private _maxTokens;
string private _name; string private _symbol; uint256 private _maxTokens;
19,941
6
// Transfers ownership of a node to a new address. May only be called by the currentowner of the node. node The node to transfer ownership of. ownerAddress The address of the new owner. /
function setOwner(bytes32 node, address ownerAddress) public only_owner(node) { emit Transfer(node, ownerAddress); records[node].owner = ownerAddress; }
function setOwner(bytes32 node, address ownerAddress) public only_owner(node) { emit Transfer(node, ownerAddress); records[node].owner = ownerAddress; }
27,542
1
// Calculates the future block timestamp from the current block timestamp given a duration _duration The amount of time in seconds till the future block timestampreturn The future block timestamp /
function getFutureTimestamp(uint256 _duration) public view returns (uint256) { return block.timestamp + _duration / secondsPerBlock; }
function getFutureTimestamp(uint256 _duration) public view returns (uint256) { return block.timestamp + _duration / secondsPerBlock; }
15,749