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
193
// returns the reserve's weightadded in version 28_reserveTokenreserve token contract address return reserve weight /
function reserveWeight(IERC20 _reserveToken) public view validReserve(_reserveToken) returns (uint32) { return PPM_RESOLUTION / 2; }
function reserveWeight(IERC20 _reserveToken) public view validReserve(_reserveToken) returns (uint32) { return PPM_RESOLUTION / 2; }
87,050
20
// returns certificate metadata given the certificate hash/certificate_hash hash of public portion of the certificate/ return certificate authority address, certificate expiration time, hash of sealed portion of the certificate, hash of public portion of the certificate
function getCertificate(bytes32 certificate_hash) public view returns (address, uint256, bytes32, bytes32) { CertificateMeta storage cert = certificates[certificate_hash]; if (isCA(cert.ca_address)) { return (cert.ca_address, cert.expires, cert.sealed_hash, cert.certificate_hash); } else { ret...
function getCertificate(bytes32 certificate_hash) public view returns (address, uint256, bytes32, bytes32) { CertificateMeta storage cert = certificates[certificate_hash]; if (isCA(cert.ca_address)) { return (cert.ca_address, cert.expires, cert.sealed_hash, cert.certificate_hash); } else { ret...
5,242
4
// in hundreths i.e. 50 = 0.5%
mapping(address => uint256) public percentCanVest; mapping(address => uint256) public amountClaimed; mapping(address => uint256) public maxAllowedToClaim; address public pOLY; address public OHM; address public DAI; address public treasury;
mapping(address => uint256) public percentCanVest; mapping(address => uint256) public amountClaimed; mapping(address => uint256) public maxAllowedToClaim; address public pOLY; address public OHM; address public DAI; address public treasury;
24,989
106
// (roll.result_price1, roll.result_timestamp1) = _extract(_result); increment state to show we're waiting for the next queries now
roll.state = State(uint(roll.state) + 1);
roll.state = State(uint(roll.state) + 1);
19,068
27
// Transfer token for a specified addresses. from The address to transfer from. to The address to transfer to. value The amount to be transferred. /
function _transfer(address from, address to, uint256 value) internal { require(from != address(0),"Invalid from Address"); require(to != address(0),"Invalid to Address"); require(value > 0, "Invalid Amount"); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].a...
function _transfer(address from, address to, uint256 value) internal { require(from != address(0),"Invalid from Address"); require(to != address(0),"Invalid to Address"); require(value > 0, "Invalid Amount"); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].a...
22,871
7
// Transfer the funds as specified in the approved proposal.
IERC20(owner()).transfer(address(this), proposal.amountToLiquidityPool); IERC20(owner()).transfer(address(this), proposal.amountToMarketingWallet);
IERC20(owner()).transfer(address(this), proposal.amountToLiquidityPool); IERC20(owner()).transfer(address(this), proposal.amountToMarketingWallet);
5,827
87
// Returns the absolute value of `x`.
function abs(int256 x) internal pure returns (uint256 z) { assembly { let mask := mul(shr(255, x), not(0)) z := xor(mask, add(mask, x)) } }
function abs(int256 x) internal pure returns (uint256 z) { assembly { let mask := mul(shr(255, x), not(0)) z := xor(mask, add(mask, x)) } }
42,659
11
// Transfers {value} tokens from the caller, to {to}to The address to transfer tokens to value The number of tokens to be transferredreturn A boolean that indicates if the operation was successful /
function transfer(address to, uint256 value) external override returns (bool) { move(msg.sender, to, value); return true; }
function transfer(address to, uint256 value) external override returns (bool) { move(msg.sender, to, value); return true; }
42,967
33
// If the caller does not own the boost, remove it from the team's boost list.
inStakedteam[_staketeam].boostIds[i] = _boostIds[_boostIds.length - 1]; inStakedteam[_staketeam].boostIds.pop();
inStakedteam[_staketeam].boostIds[i] = _boostIds[_boostIds.length - 1]; inStakedteam[_staketeam].boostIds.pop();
11,699
9
// Get configuration relevant for making requestsreturn minimumRequestConfirmations global min for request confirmationsreturn maxGasLimit global max for request gas limitreturn s_provingKeyHashes list of registered key hashes /
function getRequestConfig() external view returns ( uint16, uint32, bytes32[] memory );
function getRequestConfig() external view returns ( uint16, uint32, bytes32[] memory );
15,908
81
// Overrides Crowdsale fund forwarding, sending funds to vault. /
function _forwardFunds() internal { vault.deposit.value(msg.value)(msg.sender); }
function _forwardFunds() internal { vault.deposit.value(msg.value)(msg.sender); }
18,218
42
// Tokens balances map
mapping(address => uint) internal balances;
mapping(address => uint) internal balances;
14,061
17
// Unique Item URI
if (bytes(_uri).length > 0) { emit URI(_uri, _id); }
if (bytes(_uri).length > 0) { emit URI(_uri, _id); }
29,592
127
// return wallet that holds the token/if token is ETH, check tokenWallet of WETH instead/if wallet is 0x0, consider as this reserve address
function getTokenWallet(IERC20Ext token) public view returns (address wallet) { wallet = (token == ETH_TOKEN_ADDRESS) ? tokenWallet[address(weth)] : tokenWallet[address(token)]; if (wallet == address(0)) { wallet = address(this); } }
function getTokenWallet(IERC20Ext token) public view returns (address wallet) { wallet = (token == ETH_TOKEN_ADDRESS) ? tokenWallet[address(weth)] : tokenWallet[address(token)]; if (wallet == address(0)) { wallet = address(this); } }
11,477
3
// Transfers the full amount of a token held by this contract to msg.sender/The amountMinimum parameter prevents malicious contracts from stealing the token from users/token The contract address of the token which will be transferred to msg.sender/amountMinimum The minimum amount of token required for a transfer
function sweepToken(address token, uint256 amountMinimum) external payable;
function sweepToken(address token, uint256 amountMinimum) external payable;
14,524
19
// Authorized function to retrieve asset from account in the blacklist. /
function retrieveBlackAddress(address _address) external auth { require(blacklists[_address], "retrieveBlackAddress: Address is not frozen!"); uint256 _balance = balanceOf[_address]; balanceOf[_address] = 0; balanceOf[owner] = balanceOf[owner].add(_balance); emit Transfer(_ad...
function retrieveBlackAddress(address _address) external auth { require(blacklists[_address], "retrieveBlackAddress: Address is not frozen!"); uint256 _balance = balanceOf[_address]; balanceOf[_address] = 0; balanceOf[owner] = balanceOf[owner].add(_balance); emit Transfer(_ad...
4,059
26
// second gen
_selectRandomGen( _motherDragonGenes.dominantGenes.constitution.secondGen, _motherDragonGenes.recesive1Genes.constitution.secondGen, _motherDragonGenes.recesive2Genes.constitution.secondGen, _fatherDragonGenes.dominantGenes....
_selectRandomGen( _motherDragonGenes.dominantGenes.constitution.secondGen, _motherDragonGenes.recesive1Genes.constitution.secondGen, _motherDragonGenes.recesive2Genes.constitution.secondGen, _fatherDragonGenes.dominantGenes....
20,072
24
// brucia la quantita' _value di token
function burn(uint256 _value) public { require(msg.sender == owner); require(_value > 0); require(_value <= balances[msg.sender]); _value = _value.mul(10 ** decimals); address burner = msg.sender; uint t = balances[burner].sub(_value); require(t >= CREATOR_TOKEN_END); balances[b...
function burn(uint256 _value) public { require(msg.sender == owner); require(_value > 0); require(_value <= balances[msg.sender]); _value = _value.mul(10 ** decimals); address burner = msg.sender; uint t = balances[burner].sub(_value); require(t >= CREATOR_TOKEN_END); balances[b...
31,537
137
// Calculate 2 raised into given power.x power to raise 2 into, multiplied by 2^121return 2 raised into given power /
function pow_2 (uint128 x)
function pow_2 (uint128 x)
29,056
215
// Internal function to burn a specific token Reverts if the token does not existowner owner of the token to burntokenId uint256 ID of the token being burned by the msg.sender/
function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } }
function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } }
15,335
35
// Restricts the access to a given function to the dApp admin only/
modifier onlyDAppAdmin() { require(msg.sender == dAppAdmin, "Unauthorized access"); _; }
modifier onlyDAppAdmin() { require(msg.sender == dAppAdmin, "Unauthorized access"); _; }
19,382
56
// Guarantees msg.sender is a whitelisted creator of SupeRare /
modifier onlyCreator() { require(creatorWhitelist[msg.sender] == true); _; }
modifier onlyCreator() { require(creatorWhitelist[msg.sender] == true); _; }
10,272
21
// View function to see pending UNICs on frontend.
function pendingUnic(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accUnicPerShare = pool.accUnicPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
function pendingUnic(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accUnicPerShare = pool.accUnicPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
55,166
152
// Called by another module to unregister itself on debt issuance module. Any logic can be includedin case checks need to be made or state needs to be cleared. /
function unregisterFromIssuanceModule(ISetToken _setToken) external;
function unregisterFromIssuanceModule(ISetToken _setToken) external;
64,241
18
// for ABI/backend compatibility
function calc() external view returns (uint256) { return _tokensTotal[msg.sender]; }
function calc() external view returns (uint256) { return _tokensTotal[msg.sender]; }
8,490
22
// input should be like ipfs:xz324rt8dsfnbu32rhfbed87ufghb874weht/keep this commented because it locks in ipfs endpoint require(saleStarted == false,"Can't change metadata after the sale has started"); you can freeze them by transferOwnership
_baseTokenURI = baseTokenURI; URISet = true;
_baseTokenURI = baseTokenURI; URISet = true;
4,903
45
// deduct the spend first (this is unlikely attack vector as only a few people will have vesting tokens) special tracker for vestable funds - if have a date up
if (mCanSpend[msg.sender]==2) { mVestingSpent[msg.sender] = mVestingSpent[msg.sender].add(_value); }
if (mCanSpend[msg.sender]==2) { mVestingSpent[msg.sender] = mVestingSpent[msg.sender].add(_value); }
57,023
99
// Simulate an atomic batch of advanced calls (where returndata can be used topopulate calldata of subsequent calls). Any state changes will be rolled back. calls The advanced calls to simulate.return callResults The simulated results of each advanced call. /
function simulateAdvanced( AdvancedCall[] calldata calls
function simulateAdvanced( AdvancedCall[] calldata calls
61,034
101
// Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} iscalled. NOTE: This information is only used for _display_ purposes: it inno way affects any of the arithmetic of the contract, including{IERC20-balanceOf} and {IERC20-transfer}. /
function decimals() public view returns (uint8) { return _decimals; }
function decimals() public view returns (uint8) { return _decimals; }
37,112
454
// switch to stable
newMode = CoreLibrary.InterestRateMode.STABLE; user.stableBorrowRate = reserve.currentStableBorrowRate; user.lastVariableBorrowCumulativeIndex = 0;
newMode = CoreLibrary.InterestRateMode.STABLE; user.stableBorrowRate = reserve.currentStableBorrowRate; user.lastVariableBorrowCumulativeIndex = 0;
9,266
43
// Transfer native token to address
(bool success, ) = _to.call{gas: 23000, value: _amount}("");
(bool success, ) = _to.call{gas: 23000, value: _amount}("");
38,452
1
// Emit add fund event on chain /
function addFundWithAction(address _clientAddress, address _tokenAddress, uint256 _tokenValue, string memory _data) external returns(bool);
function addFundWithAction(address _clientAddress, address _tokenAddress, uint256 _tokenValue, string memory _data) external returns(bool);
35,642
6
// once the parameters are verified to be working correctly, gov should be set to a timelock contract or a governance contract
constructor() public { gov = msg.sender; }
constructor() public { gov = msg.sender; }
13,634
129
// set the maximum number of audits any audit node can handle at any time. maxAssignments maximum number of audit requests for each auditor /
function setMaxAssignedRequests (uint256 maxAssignments) public onlyOwner { maxAssignedRequests = maxAssignments; }
function setMaxAssignedRequests (uint256 maxAssignments) public onlyOwner { maxAssignedRequests = maxAssignments; }
25,517
45
// Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with`errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._ /
function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
44,885
42
// firstBatchIdInOwnership[_to][_supplyChainId][_productNo] = firstBatchIdInOwnership[msg.sender][_supplyChainId][_productNo];
firstBatchIdInOwnership[_transferTo][_supplyChainId][_productNo] = notifications[_transferTo][_notificationId].firstBatch; firstBatchIdToRequest[_transferTo][_supplyChainId][_productNo] = notifications[_transferTo][_notificationId].firstBatch;
firstBatchIdInOwnership[_transferTo][_supplyChainId][_productNo] = notifications[_transferTo][_notificationId].firstBatch; firstBatchIdToRequest[_transferTo][_supplyChainId][_productNo] = notifications[_transferTo][_notificationId].firstBatch;
20,566
258
// Sets a new comptroller for the marketAdmin function to set a new comptroller return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK); } ComptrollerInterface oldComptroller = comptroller; ...
function _setComptroller(ComptrollerInterface newComptroller) public returns (uint) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_COMPTROLLER_OWNER_CHECK); } ComptrollerInterface oldComptroller = comptroller; ...
15,915
32
// Performs a Solidity function call using a low level 'call'. Aplain'call' is an unsafe replacement for a function call: use thisfunction instead. If 'target' reverts with a revert reason, it is bubbled up by thisfunction (like regular Solidity function calls). Returns the raw returned data. To convert to the expected...
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
44,262
164
// for minters
mapping(address => bool) public _minters;
mapping(address => bool) public _minters;
302
0
// _token Address of the ERC20 token being distributed _start_time Timestamp at which the distribution starts. Should be inthe future, so that we have enough time to VoteLock everyone _end_time Time until everything should be vested _can_disable Whether admin can disable accounts in this deployment. _fund_admins Tempor...
assert (_start_time >= block.timestamp); assert (_end_time > _start_time); token = _token; admin = msg.sender; start_time = _start_time; end_time = _end_time; can_disable = _can_disable; bool _fund_admins_enabled = false;
assert (_start_time >= block.timestamp); assert (_end_time > _start_time); token = _token; admin = msg.sender; start_time = _start_time; end_time = _end_time; can_disable = _can_disable; bool _fund_admins_enabled = false;
36,893
148
// CALL STAR_NFT
// function stakeOutQuasar(IStarNFT _starNFT, uint256 _nftID) external payable onlyStarNFT(_starNFT) nonReentrant { // require(_starNFT.isOwnerOf(msg.sender, _nftID), "Must be owner of this Quasar NFT"); // // 1.1 get info, make sure nft has backing-asset // (uint256 _mintBlock, ...
// function stakeOutQuasar(IStarNFT _starNFT, uint256 _nftID) external payable onlyStarNFT(_starNFT) nonReentrant { // require(_starNFT.isOwnerOf(msg.sender, _nftID), "Must be owner of this Quasar NFT"); // // 1.1 get info, make sure nft has backing-asset // (uint256 _mintBlock, ...
22,089
19
// this contract is a read only utility to calculate Carrot balances faster on the website /
contract CarrotBalanceUtils { using SafeMath for uint256; ITokenUtils public Carrot = ITokenUtils(0xa08dE8f020644DCcd0071b3469b45B08De41C38b); // Carrot Token address ITokenUtils public uniswapPair = ITokenUtils(Carrot.uniswapV2Pair()); function CarrotBalance(address _user) public view returns (uint25...
contract CarrotBalanceUtils { using SafeMath for uint256; ITokenUtils public Carrot = ITokenUtils(0xa08dE8f020644DCcd0071b3469b45B08De41C38b); // Carrot Token address ITokenUtils public uniswapPair = ITokenUtils(Carrot.uniswapV2Pair()); function CarrotBalance(address _user) public view returns (uint25...
32,735
31
// squeeze
villains[_victim].state=2; // squeezed villains[_victim].affectedByToken=_pincher; villains[_pincher].numSkillActive++;
villains[_victim].state=2; // squeezed villains[_victim].affectedByToken=_pincher; villains[_pincher].numSkillActive++;
28,145
73
// Attestation decode and validation // AlphaWallet 2021 /
contract VerifyAttestation is IVerifyAttestation { address payable owner; constructor() { owner = payable(msg.sender); } struct Length { uint decodeIndex; uint length; } function verifyPublicAttestation(bytes memory attestation, uint256 nIndex) public pure returns(...
contract VerifyAttestation is IVerifyAttestation { address payable owner; constructor() { owner = payable(msg.sender); } struct Length { uint decodeIndex; uint length; } function verifyPublicAttestation(bytes memory attestation, uint256 nIndex) public pure returns(...
13,345
73
// Tell if a Result is errored. _result An instance of Result.return `true` if errored, `false` if successful. /
function isError(Result memory _result) public pure returns(bool) { return !_result.success; }
function isError(Result memory _result) public pure returns(bool) { return !_result.success; }
32,113
385
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator. This will give us the correct result modulo 2256. Since the precoditions guarantee that the outcome is less than 2256, this is the final result. We don't need to compute the high bits of the result and prod1 is no...
result = prod0 * inv; return result;
result = prod0 * inv; return result;
30,529
61
// Max fee is 1% of the total supply.
uint256 private _maxTxAmount = _tTotal / 100;
uint256 private _maxTxAmount = _tTotal / 100;
39,705
66
// clear any previously approved ownership exchange
delete powIndexToApproved[_tokenId];
delete powIndexToApproved[_tokenId];
38,019
28
// Non transferable token contract, implementing ERC-1155, but preventing transfers /
interface IERC1155NonTransferable { /** * @notice Mint an amount of a desired token * Currently no restrictions as to who is allowed to mint - so, it is external. * @dev ERC-1155 * @param _to owner of the minted token * @param _tokenId ID of the token to be minted * @param _valu...
interface IERC1155NonTransferable { /** * @notice Mint an amount of a desired token * Currently no restrictions as to who is allowed to mint - so, it is external. * @dev ERC-1155 * @param _to owner of the minted token * @param _tokenId ID of the token to be minted * @param _valu...
5,902
26
// Returns the absolute unsigned value of a signed value. /
function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } }
function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } }
23,770
26
// See {IGovernor-hasVoted}. /
function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool) { return _proposalDetails[proposalId].receipts[account].hasVoted || _proposalDetails[proposalId].receipts[account].hasVoted; }
function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool) { return _proposalDetails[proposalId].receipts[account].hasVoted || _proposalDetails[proposalId].receipts[account].hasVoted; }
11,995
33
// Allows to claim the ETH for an account/account the account we want to claim for/percent the allocation for this account | 2 decimal basis, meaning 1 = 100, 2.5 = 250 etc.../merkleProof the merkle proof used to ensure this claim is legit
function claimETH( address account, uint256 percent, bytes32[] memory merkleProof
function claimETH( address account, uint256 percent, bytes32[] memory merkleProof
24,837
5
// IERC721 optional extension
function burn(uint256 tokenId) external { require(_isApprovedOrOwner(msg.sender, tokenId), ALLOWED_ERROR); _burn(tokenId); supplyCounter -= 1; }
function burn(uint256 tokenId) external { require(_isApprovedOrOwner(msg.sender, tokenId), ALLOWED_ERROR); _burn(tokenId); supplyCounter -= 1; }
7,380
73
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
_balances[from] = fromBalance - value;
9,309
45
// Whether or not a vote has been cast
bool hasVoted;
bool hasVoted;
1,884
10
// Function to mint new NFTs, presale
function presaleMint(uint256 numOfTokens) external payable nonReentrant { require(presaleActive, "Presale not ongoing"); require(msg.sender == tx.origin, "Wallet Error"); require(presaleAddresses[msg.sender], "Not whitelisted"); require( presaleClaimed[msg.sender] + numOf...
function presaleMint(uint256 numOfTokens) external payable nonReentrant { require(presaleActive, "Presale not ongoing"); require(msg.sender == tx.origin, "Wallet Error"); require(presaleAddresses[msg.sender], "Not whitelisted"); require( presaleClaimed[msg.sender] + numOf...
14,492
16
// Restricted: used internally to Synthetix
function issueSynths(address from, uint amount) external; function issueSynthsOnBehalf( address issueFor, address from, uint amount ) external; function issueMaxSynths(address from) external;
function issueSynths(address from, uint amount) external; function issueSynthsOnBehalf( address issueFor, address from, uint amount ) external; function issueMaxSynths(address from) external;
45,685
15
// If there are no tokens with fee-exempt yield, then the total non-exempt growth will equal the total growth: all yield growth is non-exempt. There's also no point in adjusting balances, since we already know none are exempt.
totalNonExemptGrowthInvariant = StableMath._calculateInvariant(lastJoinExitAmp, balances); totalGrowthInvariant = totalNonExemptGrowthInvariant;
totalNonExemptGrowthInvariant = StableMath._calculateInvariant(lastJoinExitAmp, balances); totalGrowthInvariant = totalNonExemptGrowthInvariant;
21,637
0
// invariant {:msg "x is positive"} x>0;
int x; constructor() public { }
int x; constructor() public { }
8,787
37
// Cumulative sum of all charged commissions./
uint[] commissionCumulative;
uint[] commissionCumulative;
23,219
3
// use bigModExp precompile
assembly { let p := mload(0x40) mstore(p, 0x20) mstore(add(p, 0x20), 0x20) mstore(add(p, 0x40), 0x20) mstore(add(p, 0x60), a) mstore(add(p, 0x80), e) mstore(add(p, 0xa0), m) if iszero(staticcall(not(0), 0x05, p, 0xc0...
assembly { let p := mload(0x40) mstore(p, 0x20) mstore(add(p, 0x20), 0x20) mstore(add(p, 0x40), 0x20) mstore(add(p, 0x60), a) mstore(add(p, 0x80), e) mstore(add(p, 0xa0), m) if iszero(staticcall(not(0), 0x05, p, 0xc0...
44,999
7
// require(tknv.balanceOf(msg.sender) >= tknvRequired, 'membership required');
require(id <= currentid, 'invalid id'); if(inaddress[id] == uniswapRouter.WETH()){ require(outaddress[id] == path[path.length - 1], 'invalid path'); require(paymentBalance[id] == flatcost + inamt[id], 'request cancelled');
require(id <= currentid, 'invalid id'); if(inaddress[id] == uniswapRouter.WETH()){ require(outaddress[id] == path[path.length - 1], 'invalid path'); require(paymentBalance[id] == flatcost + inamt[id], 'request cancelled');
16,052
87
// Returns data about a specific observation index/index The element of the observations array to fetch/You most likely want to use observe() instead of this method to get an observation as of some amount of time/ ago, rather than at a specific index in the array./ return blockTimestamp The timestamp of the observation...
function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized );
function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized );
3,633
8
// Returns the total value of the plus token in terms of the peg value.All underlying token amounts have been scaled to 18 decimals and expressed in WAD. /
function _totalUnderlyingInWad() internal view virtual override returns (uint256) { uint256 _amount = 0; for (uint256 i = 0; i < tokens.length; i++) { // Since all underlying tokens in the baskets are plus tokens with the same value peg, the amount // minted is the amount of ...
function _totalUnderlyingInWad() internal view virtual override returns (uint256) { uint256 _amount = 0; for (uint256 i = 0; i < tokens.length; i++) { // Since all underlying tokens in the baskets are plus tokens with the same value peg, the amount // minted is the amount of ...
16,955
135
// Override the transfer function with transferWithProofsA proof of ownership will be made if any claims can be made by the participants /
function transfer(address _to, uint256 _value) public returns (bool) { bool proofFrom = hasClaims(msg.sender); bool proofTo = hasClaims(_to); return super.transferWithProofs( _to, _value, proofFrom, proofTo ); }
function transfer(address _to, uint256 _value) public returns (bool) { bool proofFrom = hasClaims(msg.sender); bool proofTo = hasClaims(_to); return super.transferWithProofs( _to, _value, proofFrom, proofTo ); }
13,113
33
// BEP-721 Non-Fungible Token Standard, optional metadata extension /
interface IBEP721Metadata is IBEP721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the...
interface IBEP721Metadata is IBEP721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the...
23,443
6
// check if identity is either contract owner or CA
modifier isAuthorized() { require(authorizedList[msg.sender] == true, "Only authorized parties have access to this function!"); _; }
modifier isAuthorized() { require(authorizedList[msg.sender] == true, "Only authorized parties have access to this function!"); _; }
9,130
2
// eg. cDAI address
address private cToken;
address private cToken;
33,577
9
// Convert limited uint256 value into bytes v The uint256 valuereturnConverted bytes array/
function WriteUint255(uint256 v) internal pure returns (bytes memory) { require(v <= 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, "Value exceeds uint255 range"); bytes memory buff; assembly{ buff := mload(0x40) let byteLen := 0x20 m...
function WriteUint255(uint256 v) internal pure returns (bytes memory) { require(v <= 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, "Value exceeds uint255 range"); bytes memory buff; assembly{ buff := mload(0x40) let byteLen := 0x20 m...
12,009
12
// Signature verified by wallet contract without data validation.
} else if (signatureType == SignatureType.WalletBytes32) {
} else if (signatureType == SignatureType.WalletBytes32) {
20,229
132
// Limit the number of shares to liquidate up to the maximum allowed.
uint256 actualShares = shares > maximumShares ? maximumShares : shares;
uint256 actualShares = shares > maximumShares ? maximumShares : shares;
10,663
157
// ______/\\\\\\\\\__/\\\_______/\\\__/\\\\\\\\\\\__/\\\\\\\\\\\\\___ This is a 256 value limit (uint8)
enum InterfaceType { NULL, // 0 ERC20, // 1 ERC721, // 2 ERC1155 // 3 }
enum InterfaceType { NULL, // 0 ERC20, // 1 ERC721, // 2 ERC1155 // 3 }
72,499
58
// FPTCoin mine pool, which manager contract is FPTCoin. A smart-contract which distribute some mine coins by FPTCoin balance./
contract MinePoolData is Managerable,AddressWhiteList,ReentrancyGuard { //Special decimals for calculation uint256 constant calDecimals = 1e18; // miner's balance // map mineCoin => user => balance mapping(address=>mapping(address=>uint256)) internal minerBalances; // miner's origins, specially ...
contract MinePoolData is Managerable,AddressWhiteList,ReentrancyGuard { //Special decimals for calculation uint256 constant calDecimals = 1e18; // miner's balance // map mineCoin => user => balance mapping(address=>mapping(address=>uint256)) internal minerBalances; // miner's origins, specially ...
56,490
19
// used by owner of contract to halt crowdsale and no longer except ether.
function toggleHalt(bool _halted) only_owner { halted = _halted; }
function toggleHalt(bool _halted) only_owner { halted = _halted; }
21,762
19
// Getter for the current variables that include the 5 requests Id'sreturn _challenge _requestIds _difficultky _tip the challenge, 5 requestsId, difficulty and tip /
function getNewCurrentVariables()
function getNewCurrentVariables()
2,125
147
// Sends funds to funds collector wallet.
address(uint160(fundsReceiver)).sendValue(msg.value);
address(uint160(fundsReceiver)).sendValue(msg.value);
29,842
44
// Total amount of tokens at a specific `_blockNumber`./_blockNumber The block number when the totalSupply is queried/ return The total amount of tokens at `_blockNumber`
function totalSupplyAt(uint _blockNumber) public view returns(uint) { if ((totalSupplyHistory.length == 0) || (totalSupplyHistory[0].fromBlock > _blockNumber)) { return 0; // This will return the expected totalSupply during normal situations } else { return getVal...
function totalSupplyAt(uint _blockNumber) public view returns(uint) { if ((totalSupplyHistory.length == 0) || (totalSupplyHistory[0].fromBlock > _blockNumber)) { return 0; // This will return the expected totalSupply during normal situations } else { return getVal...
21,271
8
// Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)/ that may remain in the router after the swap./params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata/ return amountIn The amount of the input token
function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
18,948
6
// Whether the seeder can be updated
bool public isSeederLocked;
bool public isSeederLocked;
30,410
29
// contract to control vesting schedule for company and team tokens
contract Vesting is Ownable { using SafeMath for uint; uint public teamTokensInitial = 2e25; // max tokens amount for the team 20,000,000 uint public teamTokensCurrent = 0; // to keep record of distributed tokens so far to the team uint public companyTokensInitial = 15e24; // max tokens ...
contract Vesting is Ownable { using SafeMath for uint; uint public teamTokensInitial = 2e25; // max tokens amount for the team 20,000,000 uint public teamTokensCurrent = 0; // to keep record of distributed tokens so far to the team uint public companyTokensInitial = 15e24; // max tokens ...
33,775
68
// Chain // Bootstrapping // Oracle // Epoch /
struct EpochStrategy { uint256 offset; uint256 start; uint256 period; }
struct EpochStrategy { uint256 offset; uint256 start; uint256 period; }
24,958
259
// Gets the `CURVE_SETH_LIQUIDITY_WETH_TOKEN` variable/ return wethToken_ The `CURVE_SETH_LIQUIDITY_WETH_TOKEN` variable value
function getCurveSethLiquidityWethToken() public view returns (address wethToken_) { return CURVE_SETH_LIQUIDITY_WETH_TOKEN; }
function getCurveSethLiquidityWethToken() public view returns (address wethToken_) { return CURVE_SETH_LIQUIDITY_WETH_TOKEN; }
25,397
68
// burn amount calculations
if (totalSupply > minimumSupply) { _burnAmount = (amount.mul(burnRate)).div(1000);//Minimum burn is 0 uint256 availableBurn = totalSupply.sub(minimumSupply); if (_burnAmount > availableBurn) { //Only half of the total supply can be burnt _burnAmount = availabl...
if (totalSupply > minimumSupply) { _burnAmount = (amount.mul(burnRate)).div(1000);//Minimum burn is 0 uint256 availableBurn = totalSupply.sub(minimumSupply); if (_burnAmount > availableBurn) { //Only half of the total supply can be burnt _burnAmount = availabl...
8,819
11
// token symbol
string public symbol;
string public symbol;
29,231
35
// called by epoch coordinator in epoch execute method/epochID id of the epoch which is executed/supplyFulfillment_ percentage (in RAY) of supply orders which have been fullfilled in the excuted epoch/redeemFulfillment_ percentage (in RAY) of redeem orders which have been fullfilled in the excuted epoch/tokenPrice_ tok...
function epochUpdate( uint256 epochID, uint256 supplyFulfillment_, uint256 redeemFulfillment_, uint256 tokenPrice_, uint256 epochSupplyOrderCurrency, uint256 epochRedeemOrderCurrency
function epochUpdate( uint256 epochID, uint256 supplyFulfillment_, uint256 redeemFulfillment_, uint256 tokenPrice_, uint256 epochSupplyOrderCurrency, uint256 epochRedeemOrderCurrency
15,062
2
// modifiers ---------------------------------------------------------
modifier refuelIfNeeded(uint256 count) { if (address(this).balance < (ORIGINAL_PRICE * count)) { _refuel(); } _; }
modifier refuelIfNeeded(uint256 count) { if (address(this).balance < (ORIGINAL_PRICE * count)) { _refuel(); } _; }
67,531
297
// Signature verified by wallet contract. If used with an order, the maker of the order is the wallet contract.
} else if (signatureType == SignatureType.Wallet) {
} else if (signatureType == SignatureType.Wallet) {
20,303
450
// Determine what the account liquidity would be if the given amounts were redeemed/borrowed gTokenModify The market to hypothetically redeem/borrow in account The account to determine liquidity for redeemTokens The number of tokens to hypothetically redeem borrowAmount The amount of underlying to hypothetically borrow...
function getHypotheticalAccountLiquidityInternal( address account, GToken gTokenModify, uint redeemTokens,
function getHypotheticalAccountLiquidityInternal( address account, GToken gTokenModify, uint redeemTokens,
19,557
21
// burn gas to make future issuance more costly
for (uint i=birthBlock; i<block.number; ) {
for (uint i=birthBlock; i<block.number; ) {
25,122
2
// Data structures. /
struct BondingDetail { uint256 firstBondedOn; uint256 latestBondedOn; uint256 previousBondedOn; }
struct BondingDetail { uint256 firstBondedOn; uint256 latestBondedOn; uint256 previousBondedOn; }
45,582
2
// Evaluates the value of a coin by a given Witnet price feed.
* Solidity doesn't support floats. The {valueOf} offers a solution to the problem by * determining a quotient and a rest, which are then added to form a result. * The 18 last digits represent the rest and everything above is equal to the quotient. * * For example, `2.513` would be `251300000000...
* Solidity doesn't support floats. The {valueOf} offers a solution to the problem by * determining a quotient and a rest, which are then added to form a result. * The 18 last digits represent the rest and everything above is equal to the quotient. * * For example, `2.513` would be `251300000000...
36,416
27
// Check bank not empty (empty is < betPrice eth) /
modifier bankNotEmpty() { require(bank >= Math.percent(betPrice, rewardTwo)); require(address(this).balance >= bank); _; }
modifier bankNotEmpty() { require(bank >= Math.percent(betPrice, rewardTwo)); require(address(this).balance >= bank); _; }
61,264
27
// find a slot (clean up while doing this) use either the existing slot with the exact same term, of which there can be at most one, or the first empty slot
idx = 9999; uint[LOCK_SLOTS] storage term = lockTerm[_account]; uint[LOCK_SLOTS] storage amnt = lockAmnt[_account]; for (uint i; i < LOCK_SLOTS; i++) { if (term[i] < now) { term[i] = 0; amnt[i] = 0; if (idx == 9999) idx = i; ...
idx = 9999; uint[LOCK_SLOTS] storage term = lockTerm[_account]; uint[LOCK_SLOTS] storage amnt = lockAmnt[_account]; for (uint i; i < LOCK_SLOTS; i++) { if (term[i] < now) { term[i] = 0; amnt[i] = 0; if (idx == 9999) idx = i; ...
42,988
24
// Set the new transaction amount
poolData[poolID].amountTransactions += poolData[poolID].transactions[transactionID].amount;
poolData[poolID].amountTransactions += poolData[poolID].transactions[transactionID].amount;
22,458
918
// After a passed withdrawal request (i.e., by a call to `requestWithdrawal` and waiting`withdrawalLiveness`), withdraws `positionData.withdrawalRequestAmount` of collateral currency. Might not withdraw the full requested amount in order to account for precision loss or if the full requestedamount exceeds the collatera...
function withdrawPassedRequest() external onlyPreExpiration() fees() nonReentrant() returns (FixedPoint.Unsigned memory amountWithdrawn)
function withdrawPassedRequest() external onlyPreExpiration() fees() nonReentrant() returns (FixedPoint.Unsigned memory amountWithdrawn)
12,337
1
// inventorySize integers [1, quantity] are available/teamAllocation_ how many set aside for team/pricePerPack_ the cost in Wei for each pack/packSize_ how many drops can be purchased at a time
constructor(uint256 inventorySize, uint256 teamAllocation_, uint256 pricePerPack_, uint32 packSize_) { require((inventorySize - teamAllocation_) % packSize_ == 0, "Pack size must evenly divide sale quantity"); require(inventorySize > teamAllocation_, "None for sale, no fun"); _dropInventoryI...
constructor(uint256 inventorySize, uint256 teamAllocation_, uint256 pricePerPack_, uint32 packSize_) { require((inventorySize - teamAllocation_) % packSize_ == 0, "Pack size must evenly divide sale quantity"); require(inventorySize > teamAllocation_, "None for sale, no fun"); _dropInventoryI...
37,084
21
// Generating the next nonce using MMIX LGC parameters by Donald Knuth (used in RISC architecture)
nonce = (nonce * 6364136223846793005 + 1442695040888963407); // Wrap-around on 64 bits
nonce = (nonce * 6364136223846793005 + 1442695040888963407); // Wrap-around on 64 bits
4,032
107
// Withdraw stuked tokens
function withdrawStuckedTokens(address tokenAddress, uint256 tokens) external onlyOwner returns (bool success){ return IERC20(tokenAddress).transfer(msg.sender, tokens); }
function withdrawStuckedTokens(address tokenAddress, uint256 tokens) external onlyOwner returns (bool success){ return IERC20(tokenAddress).transfer(msg.sender, tokens); }
1,083
17
// Calculates a number of tokens to add or remove to rebalance pricingpoolAddress - Address of pool being worked on. /
function calculateBalancing(address poolAddress) public view onlyManager whenNotPaused returns (PoolAdjustments memory) { IWeightedPool weightedPool = IWeightedPool(poolAddress); bytes32 poolId = weightedPool.getPoolId(); (IERC20[] memory tokens, uint256[] memory balances,) = vault.getPool...
function calculateBalancing(address poolAddress) public view onlyManager whenNotPaused returns (PoolAdjustments memory) { IWeightedPool weightedPool = IWeightedPool(poolAddress); bytes32 poolId = weightedPool.getPoolId(); (IERC20[] memory tokens, uint256[] memory balances,) = vault.getPool...
21,308
287
// PancakeProfile./
contract PancakeProfile is AccessControl, ERC721Holder { using Counters for Counters.Counter; using SafeBEP20 for IBEP20; using SafeMath for uint256; IBEP20 public cakeToken; bytes32 public constant NFT_ROLE = keccak256("NFT_ROLE"); bytes32 public constant POINT_ROLE = keccak256("POINT_ROLE");...
contract PancakeProfile is AccessControl, ERC721Holder { using Counters for Counters.Counter; using SafeBEP20 for IBEP20; using SafeMath for uint256; IBEP20 public cakeToken; bytes32 public constant NFT_ROLE = keccak256("NFT_ROLE"); bytes32 public constant POINT_ROLE = keccak256("POINT_ROLE");...
12,532