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
10
// Returns the hash of the fully encoded EIP-712 message for this domain,/ given `structHash`, as defined in/ https:eips.ethereum.org/EIPS/eip-712definition-of-hashstruct./
/// The hash can be used together with {ECDSA-recover} to obtain the signer of a message: /// ``` /// bytes32 digest = _hashTypedData(keccak256(abi.encode( /// keccak256("Mail(address to,string contents)"), /// mailTo, /// keccak256(bytes(mailContents)) /// ))); /// address signer = ECDSA.recover(digest, signature); /// ``` function _hashTypedData(bytes32 structHash) internal view virtual returns (bytes32 digest) { bytes32 separator = _cachedDomainSeparator; if (_cachedDomainSeparatorInvalidated()) { separator = _buildDomainSeparator(); } /// @solidity memory-safe-assembly assembly { // Compute the digest. mstore(0x00, 0x1901000000000000) // Store "\x19\x01". mstore(0x1a, separator) // Store the domain separator. mstore(0x3a, structHash) // Store the struct hash. digest := keccak256(0x18, 0x42) // Restore the part of the free memory slot that was overwritten. mstore(0x3a, 0) } }
/// The hash can be used together with {ECDSA-recover} to obtain the signer of a message: /// ``` /// bytes32 digest = _hashTypedData(keccak256(abi.encode( /// keccak256("Mail(address to,string contents)"), /// mailTo, /// keccak256(bytes(mailContents)) /// ))); /// address signer = ECDSA.recover(digest, signature); /// ``` function _hashTypedData(bytes32 structHash) internal view virtual returns (bytes32 digest) { bytes32 separator = _cachedDomainSeparator; if (_cachedDomainSeparatorInvalidated()) { separator = _buildDomainSeparator(); } /// @solidity memory-safe-assembly assembly { // Compute the digest. mstore(0x00, 0x1901000000000000) // Store "\x19\x01". mstore(0x1a, separator) // Store the domain separator. mstore(0x3a, structHash) // Store the struct hash. digest := keccak256(0x18, 0x42) // Restore the part of the free memory slot that was overwritten. mstore(0x3a, 0) } }
18,224
21
// Swap NFT and receive tokens excluding swap feenftId id of nft to swap Caller must have approved this contract to transfer `nftId` beforehand Transfers `nftToTokenExchangeRate` amount of tokens excluding fee to caller If contract has sufficient tokens available, then those are used for the swap Otherwise new tokens will be minted and sent to caller/
function swapNftForToken(uint nftId) external { nft.transferFrom(msg.sender, address(this), nftId); _tokenIds.push(nftId); uint fee = ( nftToTokenExchangeRate * swapFee ) / 100; if(token.balanceOf(address(this)) >= nftToTokenExchangeRate) { token.transfer(msg.sender, nftToTokenExchangeRate - fee); token.transfer(devWallet, fee); } else { token.mint(msg.sender, nftToTokenExchangeRate - fee); token.mint(owner(), fee); } }
function swapNftForToken(uint nftId) external { nft.transferFrom(msg.sender, address(this), nftId); _tokenIds.push(nftId); uint fee = ( nftToTokenExchangeRate * swapFee ) / 100; if(token.balanceOf(address(this)) >= nftToTokenExchangeRate) { token.transfer(msg.sender, nftToTokenExchangeRate - fee); token.transfer(devWallet, fee); } else { token.mint(msg.sender, nftToTokenExchangeRate - fee); token.mint(owner(), fee); } }
36,979
6
// After calling, the order can not be filled anymore./order Order struct containing order specifications.
function cancelOrder(LibOrder.Order memory order) public payable;
function cancelOrder(LibOrder.Order memory order) public payable;
11,933
51
// NOTE: We don't use SafeMath (or similar) in this function becauseall of our public functions carefully cap the maximum values fortime (at 64-bits) and currency (at 128-bits). _duration isalso known to be non-zero (see the require() statement in_addAuction())
if (_secondsPassed >= _duration) {
if (_secondsPassed >= _duration) {
23,973
21
// Allow boss to attack player.
if (randomInt(10) > 3) { player.hp = player.hp - bigBoss.attackDamage; if (player.hp < 0) { player.hp = 0; }
if (randomInt(10) > 3) { player.hp = player.hp - bigBoss.attackDamage; if (player.hp < 0) { player.hp = 0; }
13,710
13
// Mint
function mint( address _input, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external returns (uint256 mintOutput); function mintMulti( address[] calldata _inputs, uint256[] calldata _inputQuantities,
function mint( address _input, uint256 _inputQuantity, uint256 _minOutputQuantity, address _recipient ) external returns (uint256 mintOutput); function mintMulti( address[] calldata _inputs, uint256[] calldata _inputQuantities,
6,500
6
// withdraw a magnitude of dividend producing tokens to a provided destination destination where to send tokens when they have been amount the amount to withdraw against a debt /
function withdraw(address destination, uint256 amount) external { uint256 limit = depositOf[msg.sender]; amount = _clamp(amount, limit); unchecked { depositOf[msg.sender] = limit - amount; totalDeposited -= amount; } destination = destination == address(0) ? msg.sender : destination; IERC20(producer).safeTransfer(destination, amount); emit Withdraw(msg.sender, amount); }
function withdraw(address destination, uint256 amount) external { uint256 limit = depositOf[msg.sender]; amount = _clamp(amount, limit); unchecked { depositOf[msg.sender] = limit - amount; totalDeposited -= amount; } destination = destination == address(0) ? msg.sender : destination; IERC20(producer).safeTransfer(destination, amount); emit Withdraw(msg.sender, amount); }
16,951
15
// Total ETH managed over the lifetime of the contract
uint256 throughput;
uint256 throughput;
3,109
326
// Need to set all tokenIDs with a random level using the random number from chainlink
require(randomRequest.fulfilled == true, "Random number request has not been filled"); for (uint256 i = setLevelFrom; i < setLevelTo; i++) {
require(randomRequest.fulfilled == true, "Random number request has not been filled"); for (uint256 i = setLevelFrom; i < setLevelTo; i++) {
42,050
45
// Issue team tokens
balances[teamTokensWallet] = balanceOf(teamTokensWallet).add(teamTokens); Transfer(address(0), teamTokensWallet, teamTokens);
balances[teamTokensWallet] = balanceOf(teamTokensWallet).add(teamTokens); Transfer(address(0), teamTokensWallet, teamTokens);
49,903
10
// Initial checks:- User has a non zero deposit- User has an open trove- User has some ETH gain---- Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between all depositors and front ends- Sends all depositor's LQTY gain todepositor- Sends all tagged front end's LQTY gain to the tagged front end- Transfers the depositor's entire ETH gain from the Stability Pool to the caller's trove- Leaves their compounded deposit in the Stability Pool- Updates snapshots for deposit and tagged front end stake /
function withdrawETHGainToTrove(address _upperHint, address _lowerHint) external;
function withdrawETHGainToTrove(address _upperHint, address _lowerHint) external;
43,629
8
// Voting starter and finisher
bool votingIsOpen;
bool votingIsOpen;
15,374
32
// The multiplication in the next line is necessary because when slicing multiples of 32 bytes (lengthmod == 0) the following copy loop was copying the origin's length and then ending prematurely not copying everything it should.
let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for {
let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for {
20,813
2
// No need to specify the IntegrationManager
constructor(address _integratee) public AdapterBase(address(0)) { INTEGRATEE = _integratee; }
constructor(address _integratee) public AdapterBase(address(0)) { INTEGRATEE = _integratee; }
82,768
32
// swaps `amount` `token` in `fromChainID` to `to` on this chainID with `to` receiving `underlying` if possible
function SwapInAuto(bytes32 txs, address token, address to, uint amount, uint fromChainID,uint fee) external onlyMPC { _crosschainSwapIn(txs, token, to, amount, fromChainID, fee); CrosschainERC20 _crosschainToken = CrosschainERC20(token); address _underlying = _crosschainToken.underlying(); if (_underlying != address(0) && IERC20(_underlying).balanceOf(token) >= amount) { _crosschainToken.withdrawVault(to, amount-fee, to); _crosschainToken.withdrawVault(mpc(), fee, mpc()); } }
function SwapInAuto(bytes32 txs, address token, address to, uint amount, uint fromChainID,uint fee) external onlyMPC { _crosschainSwapIn(txs, token, to, amount, fromChainID, fee); CrosschainERC20 _crosschainToken = CrosschainERC20(token); address _underlying = _crosschainToken.underlying(); if (_underlying != address(0) && IERC20(_underlying).balanceOf(token) >= amount) { _crosschainToken.withdrawVault(to, amount-fee, to); _crosschainToken.withdrawVault(mpc(), fee, mpc()); } }
32,617
79
// Validates that `_tokenOwner` owns and has approved Market to transfer NFTs.
function validateOwnershipAndApproval( address _tokenOwner, address _assetContract, uint256 _tokenId, uint256 _quantity, TokenType _tokenType ) internal view { address market = address(this); bool isValid;
function validateOwnershipAndApproval( address _tokenOwner, address _assetContract, uint256 _tokenId, uint256 _quantity, TokenType _tokenType ) internal view { address market = address(this); bool isValid;
573
33
// CRV SWAP HERE from steth -> eth 0 = ETH, 1 = STETH We are setting 1, which is the smallest possible value for the _minAmountOut parameter However it is fine because we check that the totalETHOut >= minETHOut at the end which makes sandwich attacks not possible
uint256 ethAmountOutFromSwap = ICRV(crvPool).exchange(1, 0, stEthAmount, 1); return ethAmountOutFromSwap;
uint256 ethAmountOutFromSwap = ICRV(crvPool).exchange(1, 0, stEthAmount, 1); return ethAmountOutFromSwap;
28,337
50
// Transfer specified NFT tokenId
tokenId );
tokenId );
40,077
152
// require(etheria.getOwner(col, row) != msg.sender);uint index = _index(col, row);
uint globalbidid = increaseGlobalBidCounter(); require(msg.value > 0, "BID::Value is 0");
uint globalbidid = increaseGlobalBidCounter(); require(msg.value > 0, "BID::Value is 0");
38,131
158
// Set TransferRoot on recipient Bridge
if (chainId == getChainId()) {
if (chainId == getChainId()) {
46,355
0
// ERC1155 Inventory with support for ERC721, optional extension: Deliverable.Provides a minting function which can be used to deliver tokens to several recipients. /
interface IERC1155721InventoryDeliverable { /** * Safely mints some tokens to a list of recipients. * @dev Reverts if `recipients`, `ids` and `values` have different lengths. * @dev Reverts if one of `recipients` is the zero address. * @dev Reverts if one of `ids` is not a token. * @dev Reverts if one of `ids` represents a Non-Fungible Token and its `value` is not 1. * @dev Reverts if one of `ids` represents a Non-Fungible Token which has already been minted. * @dev Reverts if one of `ids` represents a Fungible Token and its `value` is 0. * @dev Reverts if one of `ids` represents a Fungible Token and there is an overflow of supply. * @dev Reverts if one of `recipients` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails or is refused. * @dev Emits an {IERC721-Transfer} event from the zero address for each `id` representing a Non-Fungible Token. * @dev Emits an {IERC1155-TransferSingle} event from the zero address. * @param recipients Addresses of the new token owners. * @param ids Identifiers of the tokens to mint. * @param values Amounts of tokens to mint. * @param data Optional data to send along to the receiver contract(s), if any. All receivers receive the same data. */ function safeDeliver( address[] calldata recipients, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
interface IERC1155721InventoryDeliverable { /** * Safely mints some tokens to a list of recipients. * @dev Reverts if `recipients`, `ids` and `values` have different lengths. * @dev Reverts if one of `recipients` is the zero address. * @dev Reverts if one of `ids` is not a token. * @dev Reverts if one of `ids` represents a Non-Fungible Token and its `value` is not 1. * @dev Reverts if one of `ids` represents a Non-Fungible Token which has already been minted. * @dev Reverts if one of `ids` represents a Fungible Token and its `value` is 0. * @dev Reverts if one of `ids` represents a Fungible Token and there is an overflow of supply. * @dev Reverts if one of `recipients` is a contract and the call to {IERC1155TokenReceiver-onERC1155Received} fails or is refused. * @dev Emits an {IERC721-Transfer} event from the zero address for each `id` representing a Non-Fungible Token. * @dev Emits an {IERC1155-TransferSingle} event from the zero address. * @param recipients Addresses of the new token owners. * @param ids Identifiers of the tokens to mint. * @param values Amounts of tokens to mint. * @param data Optional data to send along to the receiver contract(s), if any. All receivers receive the same data. */ function safeDeliver( address[] calldata recipients, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
11,999
10
// find the current winning rates
function winningRates() public view returns (uint256) { uint256 increment = 0; for (uint8 i = 0; i < MAX_SLOT; i++) { Slot storage slot = list[i]; if (slot.locked && slot.pendingWinnerToClaim == false) { increment += slot.randomnessChance; } } return increment; }
function winningRates() public view returns (uint256) { uint256 increment = 0; for (uint8 i = 0; i < MAX_SLOT; i++) { Slot storage slot = list[i]; if (slot.locked && slot.pendingWinnerToClaim == false) { increment += slot.randomnessChance; } } return increment; }
25,484
21
// MINT
function Mint( Voucher memory voucher, uint256 count, bytes memory Signature
function Mint( Voucher memory voucher, uint256 count, bytes memory Signature
10,047
3
// A running count of project IDs.
uint256 public override count = 0;
uint256 public override count = 0;
14,709
137
// if user does not want to stake
IERC20(OHM).transfer(_recipient, _amount); // send payout
IERC20(OHM).transfer(_recipient, _amount); // send payout
7,599
645
// For storing overall details
mapping(uint256 => EpochInvestmentDetails) public epochAmounts; function _returnEpochAmountIncludingShare( EpochInvestmentDetails memory epochInvestmentDetails
mapping(uint256 => EpochInvestmentDetails) public epochAmounts; function _returnEpochAmountIncludingShare( EpochInvestmentDetails memory epochInvestmentDetails
46,532
1
// Loot contract is available at https:etherscan.io/address/0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7.
IERC721Enumerable public lootContract = IERC721Enumerable(0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7);
IERC721Enumerable public lootContract = IERC721Enumerable(0xFF9C1b15B16263C61d017ee9F65C50e4AE0113D7);
15,692
31
// Ensure the specified item type indicates criteria usage.
if (!_isItemWithCriteria(itemType)) { revert CriteriaNotEnabledForItem(); }
if (!_isItemWithCriteria(itemType)) { revert CriteriaNotEnabledForItem(); }
33,569
21
// Returns true if current user's pending withdrawal is ready. /
function hasWithdrawalReady(address _address) public view returns (bool) { uint256 ts = withdrawals[_address].timestamp; // This is ok because even if a validator messes with timestamp, // spCELO tokens are still being burned during withdraw to prevent // double-dipping on withdraws. Worst case is that someone taps // into the staged CELO on this contract earlier than they're supposed // to, but they shouldn't be able to withdraw more than their tokens // entitle them to. The limitation that there can only be 1 outstanding // withdrawal at a time and a significant unlocking period also means // that one would have to spoof the block time quite significantly // to the point where other validators would accept these blocks (~3 days). // // slither-disable-next-line timestamp return ts != 0 && block.timestamp >= ts; }
function hasWithdrawalReady(address _address) public view returns (bool) { uint256 ts = withdrawals[_address].timestamp; // This is ok because even if a validator messes with timestamp, // spCELO tokens are still being burned during withdraw to prevent // double-dipping on withdraws. Worst case is that someone taps // into the staged CELO on this contract earlier than they're supposed // to, but they shouldn't be able to withdraw more than their tokens // entitle them to. The limitation that there can only be 1 outstanding // withdrawal at a time and a significant unlocking period also means // that one would have to spoof the block time quite significantly // to the point where other validators would accept these blocks (~3 days). // // slither-disable-next-line timestamp return ts != 0 && block.timestamp >= ts; }
23,560
6
// Function to create the metadata json string for the nft edition/name Name of NFT in metadata/description Description of NFT in metadata/mediaData Data for media to include in json object/tokenOfEdition Token ID for specific token/seriesSize Size of entire edition to show
function createMetadataJSON( string memory name, string memory description, string memory mediaData, uint256 tokenOfEdition, uint256 seriesSize
function createMetadataJSON( string memory name, string memory description, string memory mediaData, uint256 tokenOfEdition, uint256 seriesSize
13,185
42
// Performs a set of Pool balance operations, which may be either withdrawals, deposits or updates. Pool Balance management features batching, which means a single contract call can be used to perform multipleoperations of different kinds, with different Pools and tokens, at once. For each operation, the caller must be registered as the Asset Manager for `token` in `poolId`. /
function managePoolBalance(PoolBalanceOp[] memory ops) external;
function managePoolBalance(PoolBalanceOp[] memory ops) external;
13,084
24
// This is what we will call KIMs
name = "KimJongCrypto"; symbol = "KJC";
name = "KimJongCrypto"; symbol = "KJC";
16,463
87
// convert ether to com
function _etherToCom(uint256 amount) private view returns (uint256) { (uint256 k1, uint256 k2) = _com.getScale(); return amount.mul(k1).div(k2); }
function _etherToCom(uint256 amount) private view returns (uint256) { (uint256 k1, uint256 k2) = _com.getScale(); return amount.mul(k1).div(k2); }
48,326
112
// tracks all current bondings (time)
mapping(address => mapping(address => uint)) public bondings;
mapping(address => mapping(address => uint)) public bondings;
11,238
103
// Total amounts
uint256 public totalCollateralShare; // Total collateral supplied Rebase public totalAsset; // elastic = BentoBox shares held by the KashiPair, base = Total fractions held by asset suppliers Rebase public totalBorrow; // elastic = Total token amount to be repayed by borrowers, base = Total parts of the debt held by borrowers
uint256 public totalCollateralShare; // Total collateral supplied Rebase public totalAsset; // elastic = BentoBox shares held by the KashiPair, base = Total fractions held by asset suppliers Rebase public totalBorrow; // elastic = Total token amount to be repayed by borrowers, base = Total parts of the debt held by borrowers
20,089
16
// Starts a new calculation epoch Because averge since start will not be accurate
function startNewEpoch() public { require( epochCalculationStartBlock + 50000 < block.number, "New epoch not ready yet" ); // About a week epochRewards[epoch] = rewardsInThisEpoch; cumulativeRewardsSinceStart = cumulativeRewardsSinceStart.add( rewardsInThisEpoch ); rewardsInThisEpoch = 0; epochCalculationStartBlock = block.number; ++epoch; }
function startNewEpoch() public { require( epochCalculationStartBlock + 50000 < block.number, "New epoch not ready yet" ); // About a week epochRewards[epoch] = rewardsInThisEpoch; cumulativeRewardsSinceStart = cumulativeRewardsSinceStart.add( rewardsInThisEpoch ); rewardsInThisEpoch = 0; epochCalculationStartBlock = block.number; ++epoch; }
13,886
10
// Returns all functions that belong to the given extension contract.
function getAllFunctionsOfExtension(string memory _extensionName) external view returns (ExtensionFunction[] memory)
function getAllFunctionsOfExtension(string memory _extensionName) external view returns (ExtensionFunction[] memory)
10,196
8
// Repeatedly supplies and borrows {want} following the configured {borrowRate} and {borrowDepth} _amount amount of {want} to leverage /
function _leverage(uint256 _amount) internal { if (_amount < minLeverage) { return; }
function _leverage(uint256 _amount) internal { if (_amount < minLeverage) { return; }
28,410
11
// Remove the lock of `creator`./ If no lock present, do nothing.
function releaseLock(LockSet storage self, address _creator) internal { uint256 positionPlusOne = self.positions[_creator]; if (positionPlusOne != 0) { uint256 lockCount = self.locks.length; if (positionPlusOne != lockCount) { // Not the last lock, // so we need to move the last lock into the emptied position. Lock memory lastLock = self.locks[lockCount - 1]; self.locks[positionPlusOne - 1] = lastLock; self.positions[lastLock.creator] = positionPlusOne; } self.locks.length--; self.positions[_creator] = 0; } }
function releaseLock(LockSet storage self, address _creator) internal { uint256 positionPlusOne = self.positions[_creator]; if (positionPlusOne != 0) { uint256 lockCount = self.locks.length; if (positionPlusOne != lockCount) { // Not the last lock, // so we need to move the last lock into the emptied position. Lock memory lastLock = self.locks[lockCount - 1]; self.locks[positionPlusOne - 1] = lastLock; self.positions[lastLock.creator] = positionPlusOne; } self.locks.length--; self.positions[_creator] = 0; } }
24,878
227
// Deposits core coin into the fund and allocates a number of shares to the sender depending on the current number of shares, the funds value, and amount deposited return The amount of shares allocated to the depositor/
function deposit(uint256 depositAmount) external returns (uint256) { verifyDWSender(); // Check if the sender is allowed to deposit into the fund if (onlyWhitelist) require(whitelist[msg.sender]); // Require that the amount sent is not 0 require(depositAmount > 0, "ZERO_DEPOSIT"); // Transfer core ERC20 coin from sender require(IERC20(coreFundAsset).transferFrom(msg.sender, address(this), depositAmount), "TRANSFER_FROM_ISSUE"); // Calculate number of shares uint256 shares = calculateDepositToShares(depositAmount); // reset latest Oracle Caller for protect from double call latestOracleCaller = address(0); totalWeiDeposited += depositAmount; // If user would receive 0 shares, don't continue with deposit require(shares != 0, "ZERO_SHARES"); // Add shares to total totalShares = totalShares.add(shares); // Add shares to address addressToShares[msg.sender] = addressToShares[msg.sender].add(shares); addressesNetDeposit[msg.sender] += int256(depositAmount); emit Deposit(msg.sender, depositAmount, shares, totalShares); return shares; }
function deposit(uint256 depositAmount) external returns (uint256) { verifyDWSender(); // Check if the sender is allowed to deposit into the fund if (onlyWhitelist) require(whitelist[msg.sender]); // Require that the amount sent is not 0 require(depositAmount > 0, "ZERO_DEPOSIT"); // Transfer core ERC20 coin from sender require(IERC20(coreFundAsset).transferFrom(msg.sender, address(this), depositAmount), "TRANSFER_FROM_ISSUE"); // Calculate number of shares uint256 shares = calculateDepositToShares(depositAmount); // reset latest Oracle Caller for protect from double call latestOracleCaller = address(0); totalWeiDeposited += depositAmount; // If user would receive 0 shares, don't continue with deposit require(shares != 0, "ZERO_SHARES"); // Add shares to total totalShares = totalShares.add(shares); // Add shares to address addressToShares[msg.sender] = addressToShares[msg.sender].add(shares); addressesNetDeposit[msg.sender] += int256(depositAmount); emit Deposit(msg.sender, depositAmount, shares, totalShares); return shares; }
43,558
12
// Authorizes new vote signer that can manage voting for all of contract's locked
/// CELO. {v, r, s} constitutes proof-of-key-possession signature of signer for this /// contract address. /// @dev Vote Signer authorization exists only as a means of a potential escape-hatch if /// some sort of really unexpected issue occurs. By default, it is expected that there /// will be no authorized vote signer, and a voting contract will be configured using /// .authorizeVoterProxy call instead. /// @param signer address to authorize as a signer. /// @param v {v, r, s} proof-of-key possession signature. /// @param r {v, r, s} proof-of-key possession signature. /// @param s {v, r, s} proof-of-key possession signature. function authorizeVoteSigner( address signer, uint8 v, bytes32 r, bytes32 s) onlyOwner external { getAccounts().authorizeVoteSigner(signer, v, r, s); }
/// CELO. {v, r, s} constitutes proof-of-key-possession signature of signer for this /// contract address. /// @dev Vote Signer authorization exists only as a means of a potential escape-hatch if /// some sort of really unexpected issue occurs. By default, it is expected that there /// will be no authorized vote signer, and a voting contract will be configured using /// .authorizeVoterProxy call instead. /// @param signer address to authorize as a signer. /// @param v {v, r, s} proof-of-key possession signature. /// @param r {v, r, s} proof-of-key possession signature. /// @param s {v, r, s} proof-of-key possession signature. function authorizeVoteSigner( address signer, uint8 v, bytes32 r, bytes32 s) onlyOwner external { getAccounts().authorizeVoteSigner(signer, v, r, s); }
26,434
26
// even though this is constant we want to make sure that it's actually callable on Ethereum so we don't accidentally package the constant code in with an SC using BBLib. This function _must_ be external.
return BB_VERSION;
return BB_VERSION;
47,090
197
// User redeems cTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be zero) redeemAmountIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be zero)return uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function redeemFresh( address payable redeemer, uint256 redeemTokensIn, uint256 redeemAmountIn
function redeemFresh( address payable redeemer, uint256 redeemTokensIn, uint256 redeemAmountIn
37,352
6
// SafeMathMath operations with safety checks that throw on error /
library SafeMath { function mul(uint256 a, uint256 b) internal returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function add(uint256 a, uint256 b) internal returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function div(uint256 a, uint256 b) internal returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal returns (uint256) { assert(b <= a); return a - b; } }
library SafeMath { function mul(uint256 a, uint256 b) internal returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function add(uint256 a, uint256 b) internal returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function div(uint256 a, uint256 b) internal returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal returns (uint256) { assert(b <= a); return a - b; } }
41,808
38
// just increase imbalance
currentBlockData.lastBlockBuyUnitsImbalance += recordedBuyAmount; currentBlockData.totalBuyUnitsImbalance += recordedBuyAmount;
currentBlockData.lastBlockBuyUnitsImbalance += recordedBuyAmount; currentBlockData.totalBuyUnitsImbalance += recordedBuyAmount;
41,135
62
// Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer.If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. /
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4);
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4);
3,777
59
// Default to a max supply of 100 million tokens available.
maxCrowdsaleSupplyInWholeTokens = 100000000;
maxCrowdsaleSupplyInWholeTokens = 100000000;
50,782
19
// transfer ownership
function changeOwner(address payable _newOwner) external onlyOwner { require( _newOwner != address(0), "Ownable: new owner is the zero address" ); address _oldOwner = owner; owner = _newOwner; emit OwnershipTransferred(_oldOwner, _newOwner); }
function changeOwner(address payable _newOwner) external onlyOwner { require( _newOwner != address(0), "Ownable: new owner is the zero address" ); address _oldOwner = owner; owner = _newOwner; emit OwnershipTransferred(_oldOwner, _newOwner); }
170
19
// sell all LP wPowerPerp amounts to WETH and send back to user _params ControllerHelperDataType.ReduceLiquidityAndSellParams struct /
function reduceLiquidityAndSell(ControllerHelperDataType.ReduceLiquidityAndSellParams calldata _params) external { INonfungiblePositionManager(nonfungiblePositionManager).safeTransferFrom( msg.sender, address(this), _params.tokenId ); // close LP NFT and get Weth and WPowerPerp amounts (uint256 wPowerPerpAmountInLp, ) = ControllerHelperUtil.closeUniLp( nonfungiblePositionManager, ControllerHelperDataType.CloseUniLpParams({ tokenId: _params.tokenId, liquidity: _params.liquidity, liquidityPercentage: _params.liquidityPercentage, amount0Min: uint128(_params.amount0Min), amount1Min: uint128(_params.amount1Min) }), isWethToken0 ); ControllerHelperUtil.checkClosedLp( msg.sender, controller, nonfungiblePositionManager, 0, _params.tokenId, _params.liquidityPercentage ); if (wPowerPerpAmountInLp > 0) { _exactInFlashSwap( wPowerPerp, weth, _params.poolFee, wPowerPerpAmountInLp, _params.limitPriceEthPerPowerPerp.mul(wPowerPerpAmountInLp).div(1e18), uint8(ControllerHelperDataType.CALLBACK_SOURCE.SWAP_EXACTIN_WPOWERPERP_ETH), "" ); } ControllerHelperUtil.sendBack(weth, wPowerPerp); }
function reduceLiquidityAndSell(ControllerHelperDataType.ReduceLiquidityAndSellParams calldata _params) external { INonfungiblePositionManager(nonfungiblePositionManager).safeTransferFrom( msg.sender, address(this), _params.tokenId ); // close LP NFT and get Weth and WPowerPerp amounts (uint256 wPowerPerpAmountInLp, ) = ControllerHelperUtil.closeUniLp( nonfungiblePositionManager, ControllerHelperDataType.CloseUniLpParams({ tokenId: _params.tokenId, liquidity: _params.liquidity, liquidityPercentage: _params.liquidityPercentage, amount0Min: uint128(_params.amount0Min), amount1Min: uint128(_params.amount1Min) }), isWethToken0 ); ControllerHelperUtil.checkClosedLp( msg.sender, controller, nonfungiblePositionManager, 0, _params.tokenId, _params.liquidityPercentage ); if (wPowerPerpAmountInLp > 0) { _exactInFlashSwap( wPowerPerp, weth, _params.poolFee, wPowerPerpAmountInLp, _params.limitPriceEthPerPowerPerp.mul(wPowerPerpAmountInLp).div(1e18), uint8(ControllerHelperDataType.CALLBACK_SOURCE.SWAP_EXACTIN_WPOWERPERP_ETH), "" ); } ControllerHelperUtil.sendBack(weth, wPowerPerp); }
32,238
15
// The initial PIE index for a market
uint224 public constant pieInitialIndex = 1e36;
uint224 public constant pieInitialIndex = 1e36;
3,134
10
// Modifier that requires vote for the airline to be registered /
modifier requireVoting() { require( flightSuretyData.getAirlineTotal() > 4, "Airline don't need votes to register" ); _; }
modifier requireVoting() { require( flightSuretyData.getAirlineTotal() > 4, "Airline don't need votes to register" ); _; }
28,631
70
// Gets actual proxy address
address proxy = ProxyRegistryLike(proxyRegistry).proxies(dst);
address proxy = ProxyRegistryLike(proxyRegistry).proxies(dst);
6,928
289
// Set the starting index block for the collection, essentially unblockingsetting starting index /
// function emergencySetStartingIndexBlock() public onlyOwner { // require(startingIndex == 0, "Starting index is already set"); // startingIndexBlock = block.number; // }
// function emergencySetStartingIndexBlock() public onlyOwner { // require(startingIndex == 0, "Starting index is already set"); // startingIndexBlock = block.number; // }
6,225
16
// Modulo of a game.
uint8 modulo;
uint8 modulo;
5,741
13
// Treasury funds receiver
address public treasuryHolder;
address public treasuryHolder;
13,579
272
// This function sends tokens to the user (sender). Requires a calculation first using the getTokensToClaimByAddress() function and tokensToClaim has to be greater than 0./
function claimTokens() public { uint256 claimedTokens = tokensClaimedByAddress[msg.sender]; uint256 tokensToClaim = tokensToClaimByAddress[msg.sender].sub(claimedTokens); require(tokensToClaim > 0); _transfer(address(this), msg.sender, tokensToClaim); tokensClaimedByAddress[msg.sender] = tokensToClaimByAddress[msg.sender]; emit TokensClaimedEvent(msg.sender, tokensToClaim); }
function claimTokens() public { uint256 claimedTokens = tokensClaimedByAddress[msg.sender]; uint256 tokensToClaim = tokensToClaimByAddress[msg.sender].sub(claimedTokens); require(tokensToClaim > 0); _transfer(address(this), msg.sender, tokensToClaim); tokensClaimedByAddress[msg.sender] = tokensToClaimByAddress[msg.sender]; emit TokensClaimedEvent(msg.sender, tokensToClaim); }
3,108
7
// Emit events so our Oracle can keep track of a list of validators in the pool.
emit ValidatorJoined(validatorPubKey, depositor, joinTime);
emit ValidatorJoined(validatorPubKey, depositor, joinTime);
25,135
2
// CreditDesk
function migrateV1CreditLine( address _clToMigrate, address borrower, uint256 termEndTime, uint256 nextDueTime, uint256 interestAccruedAsOf, uint256 lastFullPaymentTime, uint256 totalInterestPaid ) public virtual returns (address, address);
function migrateV1CreditLine( address _clToMigrate, address borrower, uint256 termEndTime, uint256 nextDueTime, uint256 interestAccruedAsOf, uint256 lastFullPaymentTime, uint256 totalInterestPaid ) public virtual returns (address, address);
11,386
122
// pragma solidity ^0.6.0;
// contract IRewardDistributionRecipient is Ownable { // address public rewardDistribution; // function notifyRewardAmount(uint256 reward) external; // modifier onlyRewardDistribution() { // require(_msgSender() == rewardDistribution, "Caller is not reward distribution"); // _; // } // function setRewardDistribution(address _rewardDistribution) // external // onlyOwner // { // rewardDistribution = _rewardDistribution; // } // }
// contract IRewardDistributionRecipient is Ownable { // address public rewardDistribution; // function notifyRewardAmount(uint256 reward) external; // modifier onlyRewardDistribution() { // require(_msgSender() == rewardDistribution, "Caller is not reward distribution"); // _; // } // function setRewardDistribution(address _rewardDistribution) // external // onlyOwner // { // rewardDistribution = _rewardDistribution; // } // }
37,492
36
// This is the actual transfer function in the token contract, it can/only be called by other functions in this contract./_from The address holding the tokens being transferred/_to The address of the recipient/_amount The amount of tokens to be transferred/ return True if the transfer was successful
function doTransfer(address _from, address _to, uint _amount
function doTransfer(address _from, address _to, uint _amount
29,544
25
// Checking if proposal exists.
if (kks.proposalExists(votes[i])) {
if (kks.proposalExists(votes[i])) {
27,108
219
// Return the buy price of 1 individual token. /
function sellPrice() public view returns(uint256)
function sellPrice() public view returns(uint256)
31,594
57
// Internal function to burn a specific tokenReverts if the token does not exist tokenId uint256 ID of the token being burned by the msg.sender /
function _burn(address owner, uint256 tokenId) internal { _clearApproval(owner, tokenId); _removeTokenFrom(owner, tokenId); emit Transfer(owner, address(0), tokenId); }
function _burn(address owner, uint256 tokenId) internal { _clearApproval(owner, tokenId); _removeTokenFrom(owner, tokenId); emit Transfer(owner, address(0), tokenId); }
26,878
7
// Returns 0000000
function getPosition6() public view returns(uint256){ return ((value % (10 ** 42)) - (value % (10 ** (42 - 7)))) / (10 ** (42 - 7)); }
function getPosition6() public view returns(uint256){ return ((value % (10 ** 42)) - (value % (10 ** (42 - 7)))) / (10 ** (42 - 7)); }
12,527
329
// NOMINATE OWNERSHIP back to owner for aforementioned contracts
addressresolver_i.nominateNewOwner(owner); proxyerc20_i.nominateNewOwner(owner); proxysynthetix_i.nominateNewOwner(owner); exchangestate_i.nominateNewOwner(owner); systemstatus_i.nominateNewOwner(owner); tokenstatesynthetix_i.nominateOwner(owner); rewardescrow_i.nominateNewOwner(owner); rewardsdistribution_i.nominateNewOwner(owner);
addressresolver_i.nominateNewOwner(owner); proxyerc20_i.nominateNewOwner(owner); proxysynthetix_i.nominateNewOwner(owner); exchangestate_i.nominateNewOwner(owner); systemstatus_i.nominateNewOwner(owner); tokenstatesynthetix_i.nominateOwner(owner); rewardescrow_i.nominateNewOwner(owner); rewardsdistribution_i.nominateNewOwner(owner);
71,347
25
// The ERC721 tokens must match
require(sellOrder.nft == buyOrder.nft, "ERC721_TOKEN_MISMATCH_ERROR"); LibNFTOrder.OrderInfo memory sellOrderInfo = _getOrderInfo(sellOrder); LibNFTOrder.OrderInfo memory buyOrderInfo = _getOrderInfo(buyOrder); _validateSellOrder(sellOrder, sellOrderSignature, sellOrderInfo, buyOrder.maker); _validateBuyOrder(buyOrder, buyOrderSignature, buyOrderInfo, sellOrder.maker, sellOrder.nftId);
require(sellOrder.nft == buyOrder.nft, "ERC721_TOKEN_MISMATCH_ERROR"); LibNFTOrder.OrderInfo memory sellOrderInfo = _getOrderInfo(sellOrder); LibNFTOrder.OrderInfo memory buyOrderInfo = _getOrderInfo(buyOrder); _validateSellOrder(sellOrder, sellOrderSignature, sellOrderInfo, buyOrder.maker); _validateBuyOrder(buyOrder, buyOrderSignature, buyOrderInfo, sellOrder.maker, sellOrder.nftId);
43,123
29
// calculate the amount of tokens to transfer for the given eth
uint256 tokenAmount = getTokensPerEth(msg.value); require(IToken(tokenAddress).transfer(msg.sender, tokenAmount), "Insufficient balance of presale contract!"); usersInvestments[msg.sender] = usersInvestments[msg.sender].add(msg.value);
uint256 tokenAmount = getTokensPerEth(msg.value); require(IToken(tokenAddress).transfer(msg.sender, tokenAmount), "Insufficient balance of presale contract!"); usersInvestments[msg.sender] = usersInvestments[msg.sender].add(msg.value);
4,394
91
// this should never trigger if we have a good security model - entropy for 13 bytes ~ 2^(813) ~ 10^31
assert(democPrefixToHash[bytes13(democHash)] == bytes32(0)); democPrefixToHash[bytes13(democHash)] = democHash; erc20ToDemocs[erc20].push(democHash); _setDOwner(democHash, initOwner); emit NewDemoc(democHash);
assert(democPrefixToHash[bytes13(democHash)] == bytes32(0)); democPrefixToHash[bytes13(democHash)] = democHash; erc20ToDemocs[erc20].push(democHash); _setDOwner(democHash, initOwner); emit NewDemoc(democHash);
38,458
36
// Unpausing requires a higher permission level than pausing, which is optimized for speed of action. The manager or affiliate can unpause
function unpause() external { require(msg.sender == manager || msg.sender == affiliate, "only-authorized-unpausers"); _unpause(); }
function unpause() external { require(msg.sender == manager || msg.sender == affiliate, "only-authorized-unpausers"); _unpause(); }
53,379
147
// Allows liquidity providers to submit jobs liquidity the liquidity being added job the job to assign credit to amount the amount of liquidity tokens to use /
function addLiquidityToJob(address liquidity, address job, uint amount) external nonReentrant { require(liquidityAccepted[liquidity], "addLiquidityToJob: !pair"); IERC20(liquidity).safeTransferFrom(msg.sender, address(this), amount); liquidityProvided[msg.sender][liquidity][job] = liquidityProvided[msg.sender][liquidity][job].add(amount); liquidityApplied[msg.sender][liquidity][job] = now.add(LIQUIDITYBOND); liquidityAmount[msg.sender][liquidity][job] = liquidityAmount[msg.sender][liquidity][job].add(amount); if (!jobs[job] && jobProposalDelay[job] < now) { IGovernance(governance).proposeJob(job); jobProposalDelay[job] = now.add(UNBOND); } emit SubmitJob(job, liquidity, msg.sender, block.number, amount); }
function addLiquidityToJob(address liquidity, address job, uint amount) external nonReentrant { require(liquidityAccepted[liquidity], "addLiquidityToJob: !pair"); IERC20(liquidity).safeTransferFrom(msg.sender, address(this), amount); liquidityProvided[msg.sender][liquidity][job] = liquidityProvided[msg.sender][liquidity][job].add(amount); liquidityApplied[msg.sender][liquidity][job] = now.add(LIQUIDITYBOND); liquidityAmount[msg.sender][liquidity][job] = liquidityAmount[msg.sender][liquidity][job].add(amount); if (!jobs[job] && jobProposalDelay[job] < now) { IGovernance(governance).proposeJob(job); jobProposalDelay[job] = now.add(UNBOND); } emit SubmitJob(job, liquidity, msg.sender, block.number, amount); }
16,819
94
// deduct 0.2% tokens from each transactions (for rewards).
uint256 pointTwoPercent = amount.mul(2).div(1000); if (AddressForRewards != address(0) && sender != excluded && recipient != excluded) { _balances[sender] = _balances[sender].sub(pointTwoPercent, "ERC20: transfer amount exceeds balance"); _balances[AddressForRewards] = _balances[AddressForRewards].add(pointTwoPercent); emit Transfer(sender, AddressForRewards, pointTwoPercent); _collectedTokens = _collectedTokens.add(pointTwoPercent); realAmount = amount.sub(pointTwoPercent); }
uint256 pointTwoPercent = amount.mul(2).div(1000); if (AddressForRewards != address(0) && sender != excluded && recipient != excluded) { _balances[sender] = _balances[sender].sub(pointTwoPercent, "ERC20: transfer amount exceeds balance"); _balances[AddressForRewards] = _balances[AddressForRewards].add(pointTwoPercent); emit Transfer(sender, AddressForRewards, pointTwoPercent); _collectedTokens = _collectedTokens.add(pointTwoPercent); realAmount = amount.sub(pointTwoPercent); }
10,109
195
// Now handle user history
uint user_epoch = user_point_epoch[_tokenId] + 1; user_point_epoch[_tokenId] = user_epoch; u_new.ts = block.timestamp; u_new.blk = block.number; user_point_history[_tokenId][user_epoch] = u_new;
uint user_epoch = user_point_epoch[_tokenId] + 1; user_point_epoch[_tokenId] = user_epoch; u_new.ts = block.timestamp; u_new.blk = block.number; user_point_history[_tokenId][user_epoch] = u_new;
72,175
74
// Create a new array with the matching items
InsuranceData[] memory result = new InsuranceData[](count); uint256 index = 0;
InsuranceData[] memory result = new InsuranceData[](count); uint256 index = 0;
22,855
346
// expmods_and_points.points[51] = -(g^161z).
mstore(add(expmodsAndPoints, 0x9a0), point)
mstore(add(expmodsAndPoints, 0x9a0), point)
29,026
24
// When moving quote token `HTP` must stay below `LUP`.When removing quote token `HTP` must stay below `LUP`. /
error LUPBelowHTP();
error LUPBelowHTP();
39,872
131
// reserve
address[] reserveWallet;
address[] reserveWallet;
21,216
11
// Sets the record for a subnode. node The parent node. label The hash of the label specifying the subnode. owner The address of the new owner. resolver The address of the resolver. ttl The TTL in seconds. /
function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external { bytes32 subnode = setSubnodeOwner(node, label, owner); _setResolverAndTTL(subnode, resolver, ttl); }
function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external { bytes32 subnode = setSubnodeOwner(node, label, owner); _setResolverAndTTL(subnode, resolver, ttl); }
24,194
256
// Transfer fees will change token deposit behavior
bool hasTransferFee; TokenType tokenType; uint8 decimalPlaces;
bool hasTransferFee; TokenType tokenType; uint8 decimalPlaces;
2,205
16
// ------------------------------------------------------------------------ SELFDESTRUCT ------------------------------------------------------------------------
function shutdown() public onlyOwner { selfdestruct(owner); }
function shutdown() public onlyOwner { selfdestruct(owner); }
74,806
5
// This Function toggle between presale and normal sale/
function toggleSale() public onlyOwner { saleOn = !saleOn; emit ToggleSale(saleOn, preSaleOn); }
function toggleSale() public onlyOwner { saleOn = !saleOn; emit ToggleSale(saleOn, preSaleOn); }
38,137
4
// If nothing is unlocked, processExpiredLocks will revert
bool public processLocksOnReinvest = false; bool public processLocksOnRebalance = false;
bool public processLocksOnReinvest = false; bool public processLocksOnRebalance = false;
80,471
111
// require(incubations[newId].id == newId, "Sanity check for using id as arr index");
emit IncubationStarted(msg.sender, block.timestamp, endTime);
emit IncubationStarted(msg.sender, block.timestamp, endTime);
18,096
25
// Extracts the part of the balance that corresponds to token B. This function can be used to decode bothshared cash and managed balances. /
function _decodeBalanceB(bytes32 sharedBalance) private pure returns (uint256) { uint256 mask = 2**(112) - 1; return uint256(sharedBalance >> 112) & mask; }
function _decodeBalanceB(bytes32 sharedBalance) private pure returns (uint256) { uint256 mask = 2**(112) - 1; return uint256(sharedBalance >> 112) & mask; }
24,886
9
// Maximum value that can be safely used as a multiplication operator. Calculated as sqrt(maxUint256()fixed1()).Test multiply(maxFixedMul(),maxFixedMul()) is around maxFixedMul()maxFixedMul()Test multiply(maxFixedMul(),maxFixedMul()+1) throws /
function maxFixedMul() internal pure returns (uint256) { return 340282366920938463463374607431768211455999999999999; }
function maxFixedMul() internal pure returns (uint256) { return 340282366920938463463374607431768211455999999999999; }
26,312
10
// Transfer tokens to the beneficiary account /to The beneficiary account /value The amount of tokens to be transfered
function transfer(address to, uint value) returns (bool success){ require( balances[msg.sender] >= value && value > 0 ); balances[msg.sender] = balances[msg.sender].sub(value); balances[to] = balances[to].add(value); return true; }
function transfer(address to, uint value) returns (bool success){ require( balances[msg.sender] >= value && value > 0 ); balances[msg.sender] = balances[msg.sender].sub(value); balances[to] = balances[to].add(value); return true; }
3,638
65
// Give the reciever the sender's swap balance index for this swap
self.swap_balances_index[from_swaps[i]][_to] = self.swap_balances_index[from_swaps[i]][_from];
self.swap_balances_index[from_swaps[i]][_to] = self.swap_balances_index[from_swaps[i]][_from];
18,030
2
// external functions (views)
function setPubkey( bytes32 node, bytes32 x, bytes32 y ) external onlyNodeOwner(node)
function setPubkey( bytes32 node, bytes32 x, bytes32 y ) external onlyNodeOwner(node)
14,505
1
// Verification expiration date (0 means "never expires")
uint exp;
uint exp;
38,263
156
// The EGG TOKEN!
EggToken public egg;
EggToken public egg;
1,368
0
// BTC/USD
string name;
string name;
17,461
1
// disableFlags = FLAG_DISABLE_UNISWAP + FLAG_DISABLE_KYBER + ...
uint256 public constant FLAG_DISABLE_UNISWAP = 0x01; uint256 public constant FLAG_DISABLE_KYBER = 0x02; uint256 public constant FLAG_ENABLE_KYBER_UNISWAP_RESERVE = 0x100000000; // Turned off by default uint256 public constant FLAG_ENABLE_KYBER_OASIS_RESERVE = 0x200000000; // Turned off by default uint256 public constant FLAG_ENABLE_KYBER_BANCOR_RESERVE = 0x400000000; // Turned off by default uint256 public constant FLAG_DISABLE_BANCOR = 0x04; uint256 public constant FLAG_DISABLE_OASIS = 0x08; uint256 public constant FLAG_DISABLE_COMPOUND = 0x10; uint256 public constant FLAG_DISABLE_FULCRUM = 0x20; uint256 public constant FLAG_DISABLE_CHAI = 0x40;
uint256 public constant FLAG_DISABLE_UNISWAP = 0x01; uint256 public constant FLAG_DISABLE_KYBER = 0x02; uint256 public constant FLAG_ENABLE_KYBER_UNISWAP_RESERVE = 0x100000000; // Turned off by default uint256 public constant FLAG_ENABLE_KYBER_OASIS_RESERVE = 0x200000000; // Turned off by default uint256 public constant FLAG_ENABLE_KYBER_BANCOR_RESERVE = 0x400000000; // Turned off by default uint256 public constant FLAG_DISABLE_BANCOR = 0x04; uint256 public constant FLAG_DISABLE_OASIS = 0x08; uint256 public constant FLAG_DISABLE_COMPOUND = 0x10; uint256 public constant FLAG_DISABLE_FULCRUM = 0x20; uint256 public constant FLAG_DISABLE_CHAI = 0x40;
13,879
19
// withdraw reserve
LENDING_POOL.withdraw(reserve, amount, address(this));
LENDING_POOL.withdraw(reserve, amount, address(this));
24,939
40
// update global stats
totalStakes = totalStakes.add(_amount);
totalStakes = totalStakes.add(_amount);
4,385
89
// entropy limit
if (needKills > entropy.length) { needKills = entropy.length; }
if (needKills > entropy.length) { needKills = entropy.length; }
41,796
8
// Multiplication.
function fMul(uint x, uint y) internal pure returns (uint) { return (x.mul(y)).div(DECMULT); }
function fMul(uint x, uint y) internal pure returns (uint) { return (x.mul(y)).div(DECMULT); }
64,834
63
// return array of strings is not supported by solidity, we return ids & prices /
function viewNFTProfilesPrices() external view returns( uint32[] memory, uint256[] memory, uint256[] memory){ uint32[] memory ids = new uint32[](nftProfiles.length); uint256[] memory prices = new uint256[](nftProfiles.length); uint256[] memory sell_prices = new uint256[](nftProfiles.length); for (uint i = 0; i < nftProfiles.length; i++){ ids[i] = nftProfiles[i].id; prices[i] = nftProfiles[i].price; sell_prices[i] = nftProfiles[i].sell_price; } return (ids, prices, sell_prices); }
function viewNFTProfilesPrices() external view returns( uint32[] memory, uint256[] memory, uint256[] memory){ uint32[] memory ids = new uint32[](nftProfiles.length); uint256[] memory prices = new uint256[](nftProfiles.length); uint256[] memory sell_prices = new uint256[](nftProfiles.length); for (uint i = 0; i < nftProfiles.length; i++){ ids[i] = nftProfiles[i].id; prices[i] = nftProfiles[i].price; sell_prices[i] = nftProfiles[i].sell_price; } return (ids, prices, sell_prices); }
35,568
3
// wallet address to send allocated mints to
address AllocationWallet = 0xb6643B8a7686dfA3120524F2F36b5946807BA1b1;
address AllocationWallet = 0xb6643B8a7686dfA3120524F2F36b5946807BA1b1;
13,022
446
// Check with Opium.SyntheticAggregator if syntheticId is not a pool
require(!vars.syntheticAggregator.isPool(derivativeHash, _derivative), ERROR_CORE_CANT_BE_POOL);
require(!vars.syntheticAggregator.isPool(derivativeHash, _derivative), ERROR_CORE_CANT_BE_POOL);
47,163
3
// can support to trade with Uniswap or its clone, for example: Sushiswap, SashimiSwap
function updateUniswapRouters( IUniswapV2Router02[] calldata _uniswapRouters, bool isAdded ) external onlyAdmin
function updateUniswapRouters( IUniswapV2Router02[] calldata _uniswapRouters, bool isAdded ) external onlyAdmin
16,885
39
// if `to` is a contract then trigger its callback
if (dst.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(dst).onERC1155Received( msg.sender, msg.sender, id, quantity, "" ); require( callbackReturnValue == ERC1155_RECEIVED,
if (dst.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(dst).onERC1155Received( msg.sender, msg.sender, id, quantity, "" ); require( callbackReturnValue == ERC1155_RECEIVED,
14,365