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
84
// remove address of ERC20 token to top token regitry & sell it for DAI
function removeTopTopen(uint _index) public isOwner { require(_index >= 0 && _index < topTokensLength()); _sellERCToken(topTokens[_index], topTokens[_index].balanceOf(address(this)), address(this)); // sell token for dai topTokens[_index] = topTokens[topTokensLength() - 1]; // remove token from top tokens (ovverride with token in last place) topTokens.pop(); // remove last token from array }
function removeTopTopen(uint _index) public isOwner { require(_index >= 0 && _index < topTokensLength()); _sellERCToken(topTokens[_index], topTokens[_index].balanceOf(address(this)), address(this)); // sell token for dai topTokens[_index] = topTokens[topTokensLength() - 1]; // remove token from top tokens (ovverride with token in last place) topTokens.pop(); // remove last token from array }
9,910
8
// Set the URI of a token.
function setTokenUri(uint256 tokenId, string memory tokenUri) external onlyOwner nonReentrant { tokenInfo[tokenId].uri = tokenUri; }
function setTokenUri(uint256 tokenId, string memory tokenUri) external onlyOwner nonReentrant { tokenInfo[tokenId].uri = tokenUri; }
5,478
10
// Notifies the controller about an approval allowing the/controller to react if desired/_owner The address that calls `approve()`/_spender The spender in the `approve()` call/_amount_old The current allowed amount in the `approve()` call/_amount_new The amount in the `approve()` call/ return False if the controller does not authorize the approval
function onApprove(address _owner, address _spender, uint _amount_old, uint _amount_new) public returns(bool);
function onApprove(address _owner, address _spender, uint _amount_old, uint _amount_new) public returns(bool);
35,675
12
// once we reach the end of the total period, we stop increasing the daily price (and therefore the profit from withdrawing)
stake_price_by_day.push(prev_price);
stake_price_by_day.push(prev_price);
2,342
6
// user structure
struct UserStruct { bool isExist; //unique id uint256 id; //person who referred unique id uint256 referrerID; //user current level uint256 currentLevel; //total eraning for user uint256 totalEarningEth; //persons referred address[] referral; //time for every level uint256 levelExpiresAt; }
struct UserStruct { bool isExist; //unique id uint256 id; //person who referred unique id uint256 referrerID; //user current level uint256 currentLevel; //total eraning for user uint256 totalEarningEth; //persons referred address[] referral; //time for every level uint256 levelExpiresAt; }
24,659
7
// total alpha scores staked
uint256 public totalAlphaStaked = 0;
uint256 public totalAlphaStaked = 0;
33,104
172
// marketId => Market
mapping(uint256 => Market) markets;
mapping(uint256 => Market) markets;
25,571
71
// Decode a CBOR value into a Result instance. _cborValue An instance of `CBOR.Value`.return A `Result` instance. /
function resultFromCborValue(CBOR.Value memory _cborValue) public pure returns(Result memory) { // Witnet uses CBOR tag 39 to represent RADON error code identifiers. // [CBOR tag 39] Identifiers for CBOR: https://github.com/lucas-clemente/cbor-specs/blob/master/id.md bool success = _cborValue.tag != 39; return Result(success, _cborValue); }
function resultFromCborValue(CBOR.Value memory _cborValue) public pure returns(Result memory) { // Witnet uses CBOR tag 39 to represent RADON error code identifiers. // [CBOR tag 39] Identifiers for CBOR: https://github.com/lucas-clemente/cbor-specs/blob/master/id.md bool success = _cborValue.tag != 39; return Result(success, _cborValue); }
6,704
0
// Check if the forwarder is trusted /
function isTrustedForwarder(address forwarder) public view virtual override returns(bool);
function isTrustedForwarder(address forwarder) public view virtual override returns(bool);
17,830
32
// Internal function to get a valid option price on a quote.The minimum option price restriction is applied. price Calculated option price. underlyingPrice The current underlying price. quoteData The quote data.return The valid option price considering the minimum price allowed. /
function _getValidPriceForQuote(uint256 price, uint256 underlyingPrice, OptionQuote memory quoteData) internal view returns(uint256) { uint256 basePrice = quoteData.isCallOption ? underlyingPrice : quoteData.strikePrice; uint256 minPrice = basePrice.mul(minOptionPricePercentage).div(PERCENTAGE_PRECISION); if (minPrice > price) { return minPrice; } return price; }
function _getValidPriceForQuote(uint256 price, uint256 underlyingPrice, OptionQuote memory quoteData) internal view returns(uint256) { uint256 basePrice = quoteData.isCallOption ? underlyingPrice : quoteData.strikePrice; uint256 minPrice = basePrice.mul(minOptionPricePercentage).div(PERCENTAGE_PRECISION); if (minPrice > price) { return minPrice; } return price; }
35,206
23
// update variables
totalCollected = safeAdd(totalCollected, msg.value); tokensIssued = safeAdd(tokensIssued, numTokens);
totalCollected = safeAdd(totalCollected, msg.value); tokensIssued = safeAdd(tokensIssued, numTokens);
50,022
95
// Amount to unstake each time.
uint256[] private amounts;
uint256[] private amounts;
2,568
48
// if the transfer delay is enabled at launch
if (transferDelayEnabled) { if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)) { require(_holderLastTransferTimestamp[tx.origin] < block.number, "Only one purchase per block allowed."); _holderLastTransferTimestamp[tx.origin] = block.number; }
if (transferDelayEnabled) { if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)) { require(_holderLastTransferTimestamp[tx.origin] < block.number, "Only one purchase per block allowed."); _holderLastTransferTimestamp[tx.origin] = block.number; }
42,634
9
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ C O N S T R U C T O R @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/
{ contractOwner = msg.sender; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ASSET VALUE TRACKING: TOKEN <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ name = "Token"; symbol = "TKN"; decimals = 18; // // Multiplier to convert to smallest unit UNIT_MULTIPLIER = 10 ** uint256(decimals); uint256 supply = 1000; total = supply.mul(UNIT_MULTIPLIER); initialSupply = total; // // Assign entire initial supply to contract owner balances[contractOwner] = total; }
{ contractOwner = msg.sender; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ASSET VALUE TRACKING: TOKEN <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ name = "Token"; symbol = "TKN"; decimals = 18; // // Multiplier to convert to smallest unit UNIT_MULTIPLIER = 10 ** uint256(decimals); uint256 supply = 1000; total = supply.mul(UNIT_MULTIPLIER); initialSupply = total; // // Assign entire initial supply to contract owner balances[contractOwner] = total; }
19,888
72
// Register the investor on the list of investors to keep them in order.
_whitelistInvestors.push(investor);
_whitelistInvestors.push(investor);
19,654
103
// calculate fee numerator
uint256 numerator = FEE_DIVISOR.sub(marketingFee).sub(stakingFee);
uint256 numerator = FEE_DIVISOR.sub(marketingFee).sub(stakingFee);
33,943
84
// Moves `amount` tokens from the caller's account to `recipient`./ return True if the operation succeeded, reverts otherwise./Requirements:/ - `recipient` cannot be the zero address,/ - the caller must have a balance of at least `amount`.
function transfer(address recipient, uint256 amount) external override returns (bool)
function transfer(address recipient, uint256 amount) external override returns (bool)
61,508
329
// returns the default flash-loan fee (in units of PPM) /
function defaultFlashLoanFeePPM() external view returns (uint32);
function defaultFlashLoanFeePPM() external view returns (uint32);
17,374
12
// send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferredreturn Whether the transfer was successful or not /
function transfer(address _to, uint256 _value) returns (bool);
function transfer(address _to, uint256 _value) returns (bool);
32,975
26
// Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0)return block number as int /
function arbBlockNumber() external view returns (uint256);
function arbBlockNumber() external view returns (uint256);
59,440
91
// Calculate the exchange fee for a given source and destination currency key/sourceCurrencyKey The source currency key/destinationCurrencyKey The destination currency key/ return The exchange fee rate/ return The exchange dynamic fee rate and if rates are too volatile
function _feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) internal view returns (uint feeRate, bool tooVolatile)
function _feeRateForExchange(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) internal view returns (uint feeRate, bool tooVolatile)
23,446
6
// Autogenerated - DO NOT EDIT
return "https://ipfs.io/ipfs/QmehvpF3vWWMQTt4wc5D9i9UD1QLYJBFuyHMLsfYLJbXUh";
return "https://ipfs.io/ipfs/QmehvpF3vWWMQTt4wc5D9i9UD1QLYJBFuyHMLsfYLJbXUh";
17,195
11
// ------------------------------------------------------------------------ Transfer tokens from sender account to receiver accountThe calling account must already have sufficient tokens approve(...)-d for spending from sender account and - From account must have sufficient balance to transfer - Spender must have sufficient allowance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------
function transferFrom(address sender, address receiver, uint tokens) public override returns (bool success) { balances[sender] = safeSub(balances[sender], tokens); allowed[sender][msg.sender] = safeSub(allowed[sender][msg.sender], tokens); balances[receiver] = safeAdd(balances[receiver], tokens); emit Transfer(sender, receiver, tokens); return true; }
function transferFrom(address sender, address receiver, uint tokens) public override returns (bool success) { balances[sender] = safeSub(balances[sender], tokens); allowed[sender][msg.sender] = safeSub(allowed[sender][msg.sender], tokens); balances[receiver] = safeAdd(balances[receiver], tokens); emit Transfer(sender, receiver, tokens); return true; }
23,043
38
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
7,954
19
// Mint an allocated token, every token must be allocated before minting /
function mintAllocated(uint256 allocatedTokenId, string calldata tokenURI) external { require(allocatedTokenId < _tokenId, ""); // Restrict to currently allocated tokens address to = _tokenAllocation[allocatedTokenId]; require(to != address(0), ""); // Prevent minting to 0x0 address require(mintWithTokenURI(to, allocatedTokenId, tokenURI), ""); }
function mintAllocated(uint256 allocatedTokenId, string calldata tokenURI) external { require(allocatedTokenId < _tokenId, ""); // Restrict to currently allocated tokens address to = _tokenAllocation[allocatedTokenId]; require(to != address(0), ""); // Prevent minting to 0x0 address require(mintWithTokenURI(to, allocatedTokenId, tokenURI), ""); }
10,263
3
// Instantiate a new Fundraiser contract and add its address to the _fundraisers collection.
function createFundraiser( string memory name, string memory url, string memory imageUrl, string memory description, address payable beneficiary ) public
function createFundraiser( string memory name, string memory url, string memory imageUrl, string memory description, address payable beneficiary ) public
40,091
15
// guobin卖出通证/
function sell(uint256 amount,uint256 eth_amount) public payable { _sell(amount,eth_amount); }
function sell(uint256 amount,uint256 eth_amount) public payable { _sell(amount,eth_amount); }
9,458
13
// return balances[addr];
}*/
}*/
8,327
287
// calculate amount of FEI and TRIBE received if the Genesis Group ended now./amountIn amount of FGEN held or equivalently amount of ETH purchasing with/inclusive if true, assumes the `amountIn` is part of the existing FGEN supply. Set to false to simulate a new purchase./ return feiAmount the amount of FEI received by the user/ return tribeAmount the amount of TRIBE received by the user
function getAmountOut(uint256 amountIn, bool inclusive) public view override returns (uint256 feiAmount, uint256 tribeAmount)
function getAmountOut(uint256 amountIn, bool inclusive) public view override returns (uint256 feiAmount, uint256 tribeAmount)
15,194
0
// {ERC721} token that contains an id token tracker for/ Creates a new token for `to`. Its token ID will be automaticallyassigned (and available on the emitted {IERC721-Transfer} event). See {ERC721Minter-mint}. /
function mint(address to) public virtual returns (uint256 id){ id = _tokenIdTracker.current(); _mint(to, id); _tokenIdTracker.increment(); return id; }
function mint(address to) public virtual returns (uint256 id){ id = _tokenIdTracker.current(); _mint(to, id); _tokenIdTracker.increment(); return id; }
25,738
34
// New Balance = Total Borrow Bal. - repayAmount
uint accountBorrowsNew = amountToRepay - repayAmount; accountBorrows[borrower].principal = accountBorrowsNew; totalBorrows = totalBorrows - repayAmount; emit RepayBorrow(borrower, repayAmount, accountBorrowsNew, totalBorrows); return true;
uint accountBorrowsNew = amountToRepay - repayAmount; accountBorrows[borrower].principal = accountBorrowsNew; totalBorrows = totalBorrows - repayAmount; emit RepayBorrow(borrower, repayAmount, accountBorrowsNew, totalBorrows); return true;
52,748
87
// check if flow exists
(bool exist, FlowData memory oldFlowData) = _getAgreementData(token, _generateFlowId(sender, receiver)); {
(bool exist, FlowData memory oldFlowData) = _getAgreementData(token, _generateFlowId(sender, receiver)); {
34,584
62
// Grants `role` to `account`.
* If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); }
* If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); }
28,135
34
// The allocated (underlying) tokens of the Allocator
IERC20[] internal _tokens;
IERC20[] internal _tokens;
8,953
58
// Upgrade a wallet to a new version. _wallet the wallet to upgrade _toVersion the new version /
function upgradeWallet(address _wallet, uint256 _toVersion) external;
function upgradeWallet(address _wallet, uint256 _toVersion) external;
26,209
1
// Emitted when an associated system is set. kind The type of associated system (managed ERC20, managed ERC721, unmanaged, etc - See the AssociatedSystem util). id The bytes32 identifier of the associated system. proxy The main external contract address of the associated system. impl The address of the implementation of the associated system (if not behind a proxy, will equal `proxy`). /
event AssociatedSystemSet( bytes32 indexed kind, bytes32 indexed id, address proxy, address impl );
event AssociatedSystemSet( bytes32 indexed kind, bytes32 indexed id, address proxy, address impl );
26,288
45
// Constructor. /
constructor () public { contractOwner = msg.sender; stopped = false; }
constructor () public { contractOwner = msg.sender; stopped = false; }
25,084
175
// Fallback function to execute swaps directly on 0x for users that don't pay a fee/params as of API documentation from 0x API (https:0x.org/docs/apiresponse-1)
fallback() external payable { bytes4 selector = msg.data.readBytes4(0); address impl = IZerox(zeroEx).getFunctionImplementation(selector); require(impl != address(0), "FloozRouter: NO_IMPLEMENTATION"); (bool success, ) = impl.delegatecall(msg.data); require(success, "FloozRouter: REVERTED"); } /// @dev Executes a swap on 0x API /// @param data calldata expected by data field on 0x API (https://0x.org/docs/api#response-1) /// @param tokenOut the address of currency to sell - 0x address for ETH /// @param tokenIn the address of currency to buy - 0x address for ETH /// @param referee address of referee for msg.sender, 0x adress if none /// @param fee boolean if fee should be applied or not function executeZeroExSwap( bytes calldata data, address tokenOut, address tokenIn, address referee, bool fee ) external payable nonReentrant whenNotPaused isValidReferee(referee) { referee = _getReferee(referee); bytes4 selector = data.readBytes4(0); address impl = IZerox(zeroEx).getFunctionImplementation(selector); require(impl != address(0), "FloozRouter: NO_IMPLEMENTATION"); if (!fee) { (bool success, ) = impl.delegatecall(data); require(success, "FloozRouter: REVERTED"); } else { // if ETH in execute trade as router & distribute funds & fees if (msg.value > 0) { (uint256 swapAmount, uint256 feeAmount, uint256 referralReward) = _calculateFeesAndRewards( fee, msg.value, referee, false ); (bool success, ) = impl.call{value: swapAmount}(data); require(success, "FloozRouter: REVERTED"); TransferHelper.safeTransfer(tokenIn, msg.sender, IERC20(tokenIn).balanceOf(address(this))); _withdrawFeesAndRewards(address(0), tokenIn, referee, feeAmount, referralReward); } else { uint256 balanceBefore = IERC20(tokenOut).balanceOf(msg.sender); (bool success, ) = impl.delegatecall(data); require(success, "FloozRouter: REVERTED"); uint256 balanceAfter = IERC20(tokenOut).balanceOf(msg.sender); require(balanceBefore > balanceAfter, "INVALID_TOKEN"); (, uint256 feeAmount, uint256 referralReward) = _calculateFeesAndRewards( fee, balanceBefore.sub(balanceAfter), referee, true ); _withdrawFeesAndRewards(tokenOut, tokenIn, referee, feeAmount, referralReward); }
fallback() external payable { bytes4 selector = msg.data.readBytes4(0); address impl = IZerox(zeroEx).getFunctionImplementation(selector); require(impl != address(0), "FloozRouter: NO_IMPLEMENTATION"); (bool success, ) = impl.delegatecall(msg.data); require(success, "FloozRouter: REVERTED"); } /// @dev Executes a swap on 0x API /// @param data calldata expected by data field on 0x API (https://0x.org/docs/api#response-1) /// @param tokenOut the address of currency to sell - 0x address for ETH /// @param tokenIn the address of currency to buy - 0x address for ETH /// @param referee address of referee for msg.sender, 0x adress if none /// @param fee boolean if fee should be applied or not function executeZeroExSwap( bytes calldata data, address tokenOut, address tokenIn, address referee, bool fee ) external payable nonReentrant whenNotPaused isValidReferee(referee) { referee = _getReferee(referee); bytes4 selector = data.readBytes4(0); address impl = IZerox(zeroEx).getFunctionImplementation(selector); require(impl != address(0), "FloozRouter: NO_IMPLEMENTATION"); if (!fee) { (bool success, ) = impl.delegatecall(data); require(success, "FloozRouter: REVERTED"); } else { // if ETH in execute trade as router & distribute funds & fees if (msg.value > 0) { (uint256 swapAmount, uint256 feeAmount, uint256 referralReward) = _calculateFeesAndRewards( fee, msg.value, referee, false ); (bool success, ) = impl.call{value: swapAmount}(data); require(success, "FloozRouter: REVERTED"); TransferHelper.safeTransfer(tokenIn, msg.sender, IERC20(tokenIn).balanceOf(address(this))); _withdrawFeesAndRewards(address(0), tokenIn, referee, feeAmount, referralReward); } else { uint256 balanceBefore = IERC20(tokenOut).balanceOf(msg.sender); (bool success, ) = impl.delegatecall(data); require(success, "FloozRouter: REVERTED"); uint256 balanceAfter = IERC20(tokenOut).balanceOf(msg.sender); require(balanceBefore > balanceAfter, "INVALID_TOKEN"); (, uint256 feeAmount, uint256 referralReward) = _calculateFeesAndRewards( fee, balanceBefore.sub(balanceAfter), referee, true ); _withdrawFeesAndRewards(tokenOut, tokenIn, referee, feeAmount, referralReward); }
58,737
10
// UpgradeabilityProxy This contract represents a proxy where the implementation address to which it will delegate can be upgraded /
contract UpgradeabilityProxy is Proxy { /** * @dev This event will be emitted every time the implementation gets upgraded * @param implementation representing the address of the upgraded implementation */ event Upgraded(address indexed implementation, uint256 version); // Storage position of the address of the current implementation bytes32 private constant implementationPosition = keccak256("angry.app.proxy.implementation"); /** * @dev Constructor function */ constructor() {} function implementation() public view override returns (address impl) { bytes32 position = implementationPosition; address tmp; assembly { tmp := sload(position) } impl = tmp; } /** * @dev Sets the address of the current implementation * @param _newImplementation address representing the new implementation to be set */ function _setImplementation(address _newImplementation) internal { bytes32 position = implementationPosition; assembly { sstore(position, _newImplementation) } } /** * @dev Upgrades the implementation address * @param _newImplementation representing the address of the new implementation to be set */ function _upgradeTo(address _newImplementation, uint256 _newVersion) internal { address currentImplementation = implementation(); require(currentImplementation != _newImplementation, "Same Implementation!"); _setImplementation(_newImplementation); emit Upgraded( _newImplementation, _newVersion); } }
contract UpgradeabilityProxy is Proxy { /** * @dev This event will be emitted every time the implementation gets upgraded * @param implementation representing the address of the upgraded implementation */ event Upgraded(address indexed implementation, uint256 version); // Storage position of the address of the current implementation bytes32 private constant implementationPosition = keccak256("angry.app.proxy.implementation"); /** * @dev Constructor function */ constructor() {} function implementation() public view override returns (address impl) { bytes32 position = implementationPosition; address tmp; assembly { tmp := sload(position) } impl = tmp; } /** * @dev Sets the address of the current implementation * @param _newImplementation address representing the new implementation to be set */ function _setImplementation(address _newImplementation) internal { bytes32 position = implementationPosition; assembly { sstore(position, _newImplementation) } } /** * @dev Upgrades the implementation address * @param _newImplementation representing the address of the new implementation to be set */ function _upgradeTo(address _newImplementation, uint256 _newVersion) internal { address currentImplementation = implementation(); require(currentImplementation != _newImplementation, "Same Implementation!"); _setImplementation(_newImplementation); emit Upgraded( _newImplementation, _newVersion); } }
12,298
12
// SpacesAvailables Parking Spaces. Key: space name, Value: the parking space
mapping(string => uint256) private parkingSpaces; ParkingSpace[] private spaces; using Counters for Counters.Counter; Counters.Counter private spaceCount;
mapping(string => uint256) private parkingSpaces; ParkingSpace[] private spaces; using Counters for Counters.Counter; Counters.Counter private spaceCount;
9,270
237
// Check for sanity and depositability
require((nDays < 2000) && ClipperExchangeInterface(theExchange.exchangeInterfaceContract()).approvalContract().approveDeposit(msg.sender, nDays), "Clipper: Deposit rejected"); uint256 beforeDepositInvariant = theExchange.exchangeInterfaceContract().invariant(); uint256 initialFullyDilutedSupply = theExchange.fullyDilutedSupply();
require((nDays < 2000) && ClipperExchangeInterface(theExchange.exchangeInterfaceContract()).approvalContract().approveDeposit(msg.sender, nDays), "Clipper: Deposit rejected"); uint256 beforeDepositInvariant = theExchange.exchangeInterfaceContract().invariant(); uint256 initialFullyDilutedSupply = theExchange.fullyDilutedSupply();
14,377
57
// 如果拍卖已结束,撤销函数的调用。
require(block.timestamp <= record.endTime && record.AuctionStatus == 0,"Auction already ended.");
require(block.timestamp <= record.endTime && record.AuctionStatus == 0,"Auction already ended.");
33,326
79
// vanishing_denominator = (z - w^{n-1})(z - w^{n-2})(z - w^{n-3})(z - w^{n-4}) we need to cut 4 roots of unity out of the vanishing poly, the last 4 constraints are not satisfied due to randomness added to ensure the proving system is zero-knowledge
vanishing_denominator := addmod(z, sub(p, work_root), p) work_root := mulmod(work_root, accumulating_root, p) vanishing_denominator := mulmod(vanishing_denominator, addmod(z, sub(p, work_root), p), p) work_root := mulmod(work_root, accumulating_root, p) vanishing_denominator := mulmod(vanishing_denominator, addmod(z, sub(p, work_root), p), p) work_root := mulmod(work_root, accumulating_root, p) vanishing_denominator := mulmod(vanishing_denominator, addmod(z, sub(p, work_root), p), p)
vanishing_denominator := addmod(z, sub(p, work_root), p) work_root := mulmod(work_root, accumulating_root, p) vanishing_denominator := mulmod(vanishing_denominator, addmod(z, sub(p, work_root), p), p) work_root := mulmod(work_root, accumulating_root, p) vanishing_denominator := mulmod(vanishing_denominator, addmod(z, sub(p, work_root), p), p) work_root := mulmod(work_root, accumulating_root, p) vanishing_denominator := mulmod(vanishing_denominator, addmod(z, sub(p, work_root), p), p)
59,037
135
// delete an order from storage
function _deleteOrder(bool isBuy, uint32 id) internal { if(isBuy) { delete _buyOrders[id]; } else { delete _sellOrders[id]; } }
function _deleteOrder(bool isBuy, uint32 id) internal { if(isBuy) { delete _buyOrders[id]; } else { delete _sellOrders[id]; } }
33,034
289
// Gets current transaction price.
function _getGasPrice() internal view virtual returns (uint256);
function _getGasPrice() internal view virtual returns (uint256);
22,480
16
// Compute the keccak256 hash of an interface given its name./_interfaceName Name of the interface./ return The keccak256 hash of an interface name.
function interfaceHash(string calldata _interfaceName) external pure returns(bytes32) { return keccak256(abi.encodePacked(_interfaceName)); }
function interfaceHash(string calldata _interfaceName) external pure returns(bytes32) { return keccak256(abi.encodePacked(_interfaceName)); }
37,502
26
// ---------------------------------------------------------------------------- ERC20 Token, with the addition of symbol, name and decimals and assisted token transfers ----------------------------------------------------------------------------
contract ADZbuzzCommunityToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function ADZbuzzCommunityToken() public { symbol = "ACT81575"; name = "ADZbuzz Slowthecookdown.com Community Token"; decimals = 8; _totalSupply = 200000000000000; balances[0x3f70c0B02879c36162C2C902ECfe9Ac0a8a8a187] = _totalSupply; emit Transfer(address(0), 0x3f70c0B02879c36162C2C902ECfe9Ac0a8a8a187, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
contract ADZbuzzCommunityToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function ADZbuzzCommunityToken() public { symbol = "ACT81575"; name = "ADZbuzz Slowthecookdown.com Community Token"; decimals = 8; _totalSupply = 200000000000000; balances[0x3f70c0B02879c36162C2C902ECfe9Ac0a8a8a187] = _totalSupply; emit Transfer(address(0), 0x3f70c0B02879c36162C2C902ECfe9Ac0a8a8a187, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
45,728
780
// Unpause drawdowns /
function unpauseDrawdowns() public onlyAdmin { drawdownsPaused = false; emit DrawdownsUnpaused(address(this)); }
function unpauseDrawdowns() public onlyAdmin { drawdownsPaused = false; emit DrawdownsUnpaused(address(this)); }
72,912
17
// The list of rewards token.
RewardInfo[] public rewards;
RewardInfo[] public rewards;
15,038
22
// Deregisters `tokens` for the `poolId` Pool. Must be called by the Pool's contract. Only registered tokens (via `registerTokens`) can be deregistered. Additionally, they must have zero totalbalance. For Pools with the Two Token specialization, `tokens` must have a length of two, that is, both tokensmust be deregistered in the same `deregisterTokens` call. A deregistered token can be re-registered later on, possibly with a different Asset Manager. Emits a `TokensDeregistered` event. /
function deregisterTokens(bytes32 poolId, IERC20[] memory tokens) external;
function deregisterTokens(bytes32 poolId, IERC20[] memory tokens) external;
25,830
603
// Optional mapping for device IDs and and device roots.
mapping(uint256 => Device) private _devices; event UpdateRegistry(address registryAddress); event DeviceSet( uint256 tokenId, bytes32 publicKeyHash, bytes32 merkleRoot );
mapping(uint256 => Device) private _devices; event UpdateRegistry(address registryAddress); event DeviceSet( uint256 tokenId, bytes32 publicKeyHash, bytes32 merkleRoot );
63,763
6
// mapping(uint256 => mapping(uint256 => TokenPair)) public auctionNfts; delete
mapping(IERC721 => bool) public nftBlacklist; mapping(address => bool) public nftForAccrualRB; //add tokens on which RobiBoost is accrual mapping(IERC20 => bool) public dealTokensWhitelist; mapping(IERC721 => mapping(uint256 => uint256)) public auctionNftIndex; // nft -> tokenId -> id mapping(address => uint256) public userFee; //User auction fee. if Zero - default fee mapping(address => RoyaltyStr) public royalty; //Royalty for NFT creator. NFTToken => royalty (base 10000) uint256 constant MAX_DEFAULT_FEE = 1000; // max fee 10%
mapping(IERC721 => bool) public nftBlacklist; mapping(address => bool) public nftForAccrualRB; //add tokens on which RobiBoost is accrual mapping(IERC20 => bool) public dealTokensWhitelist; mapping(IERC721 => mapping(uint256 => uint256)) public auctionNftIndex; // nft -> tokenId -> id mapping(address => uint256) public userFee; //User auction fee. if Zero - default fee mapping(address => RoyaltyStr) public royalty; //Royalty for NFT creator. NFTToken => royalty (base 10000) uint256 constant MAX_DEFAULT_FEE = 1000; // max fee 10%
13,815
732
// Checks limit for minimum ratio and if minRatio is bigger than max
function checkParams(bytes32 _ilk, uint128 _minRatio, uint128 _maxRatio) internal view returns (bool) { if (_minRatio < minLimits[_ilk]) { return false; } if (_minRatio > _maxRatio) { return false; } return true; }
function checkParams(bytes32 _ilk, uint128 _minRatio, uint128 _maxRatio) internal view returns (bool) { if (_minRatio < minLimits[_ilk]) { return false; } if (_minRatio > _maxRatio) { return false; } return true; }
55,090
94
// 5
_lock(holder,totalLocked.sub(value),releaseTime); return true;
_lock(holder,totalLocked.sub(value),releaseTime); return true;
257
18
// Funding View Functions
function fundsOf(address owner) external view returns (uint256); function lastSettlementTime() external view returns (uint256); function keeperSolvent() external view returns (bool); function keeperTaxNumerator() external view returns (uint256); function feeDenominator() external view returns (uint256); function keeperTaxPeriod() external view returns (uint256);
function fundsOf(address owner) external view returns (uint256); function lastSettlementTime() external view returns (uint256); function keeperSolvent() external view returns (bool); function keeperTaxNumerator() external view returns (uint256); function feeDenominator() external view returns (uint256); function keeperTaxPeriod() external view returns (uint256);
37,353
36
// return Returns index and ok of the first occurrence starting from index 0
function index(address[] addresses, address a) internal pure returns (uint, bool) { for (uint i = 0; i < addresses.length; i++) { if (addresses[i] == a) { return (i, true); } } return (0, false); }
function index(address[] addresses, address a) internal pure returns (uint, bool) { for (uint i = 0; i < addresses.length; i++) { if (addresses[i] == a) { return (i, true); } } return (0, false); }
57,136
59
// Allows the owner to transfer out external ERC20 tokens/Used to transfer out tokens held by the Prize Pool.Could be liquidated, or anything./to The address that receives the tokens/externalToken The address of the external asset token being transferred/amount The amount of external assets to be transferred
function transferExternalERC20( address to, address externalToken, uint256 amount ) external onlyOwner requireAwardNotInProgress
function transferExternalERC20( address to, address externalToken, uint256 amount ) external onlyOwner requireAwardNotInProgress
41,765
327
// mint for each protocol and update currentTokensUsed
uint256[] memory protocolAmounts = _amountsFromAllocations(allocations, total); uint256 currAmount; address protWrapper; address[] memory _tokens = allAvailableTokens; for (uint256 i = 0; i < protocolAmounts.length; i++) { currAmount = protocolAmounts[i]; if (currAmount != 0) { protWrapper = protocolWrappers[_tokens[i]];
uint256[] memory protocolAmounts = _amountsFromAllocations(allocations, total); uint256 currAmount; address protWrapper; address[] memory _tokens = allAvailableTokens; for (uint256 i = 0; i < protocolAmounts.length; i++) { currAmount = protocolAmounts[i]; if (currAmount != 0) { protWrapper = protocolWrappers[_tokens[i]];
72,657
153
// Withdraw a token amount in excess of the borrowed balance, or an amount approved by the GUARDIAN_ROLE.The contract may hold an excess balance if, for example, additional funds were added by the contract owner for use with the same exchange account, or if profits were earned from activity on the exchange. recipientThe recipient to receive tokens. Must be authorized by OWNER_ROLE. /
function externalWithdrawToken( address recipient, uint256 amount ) external nonReentrant onlyRole(WITHDRAWAL_OPERATOR_ROLE) onlyAllowedRecipient(recipient)
function externalWithdrawToken( address recipient, uint256 amount ) external nonReentrant onlyRole(WITHDRAWAL_OPERATOR_ROLE) onlyAllowedRecipient(recipient)
4,637
151
// Enters the Compound market so it can be deposited/borrowed/Markets can be entered multiple times, without the code reverting/_cTokenAddr CToken address of the token
function enterMarket(address _cTokenAddr) public { address[] memory markets = new address[](1); markets[0] = _cTokenAddr; uint256[] memory errCodes = IComptroller(COMPTROLLER_ADDR).enterMarkets(markets); if (errCodes[0] != NO_ERROR){ revert CompEnterMarketError(); } }
function enterMarket(address _cTokenAddr) public { address[] memory markets = new address[](1); markets[0] = _cTokenAddr; uint256[] memory errCodes = IComptroller(COMPTROLLER_ADDR).enterMarkets(markets); if (errCodes[0] != NO_ERROR){ revert CompEnterMarketError(); } }
6,017
7
// Check if we have enough remaining funds
if (oraclize_getPrice("URL") > address(this).balance) { emit LogInfo("Oraclize query was NOT sent, please add some ETH to cover for the query fee"); } else {
if (oraclize_getPrice("URL") > address(this).balance) { emit LogInfo("Oraclize query was NOT sent, please add some ETH to cover for the query fee"); } else {
11,917
73
// swap contract's tokens for ETH
uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance > 0) { swapTokens(contractTokenBalance); }
uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance > 0) { swapTokens(contractTokenBalance); }
5,693
545
// Emitted when `to` accound executes redeem ipTokens
event Redeem(
event Redeem(
31,418
73
// token constants
string public constant name = "Discoperi Token"; // solium-disable-line uppercase string public constant symbol = "DISC"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase
string public constant name = "Discoperi Token"; // solium-disable-line uppercase string public constant symbol = "DISC"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase
69,837
38
// Fetches a PoolUI struct (poolId, stakedAmount, currentTimeRange) for each reward poolreturn PoolUI for FoldToken. /
function getPoolsUI() public view returns (PoolUI memory) { Pool memory foldTokenPool = pools[0]; uint256 current = getCurrentTimeRangeIndex(foldTokenPool); return (PoolUI(0,foldTokenPool.stakedAmount, foldTokenPool.timeRanges[current])); }
function getPoolsUI() public view returns (PoolUI memory) { Pool memory foldTokenPool = pools[0]; uint256 current = getCurrentTimeRangeIndex(foldTokenPool); return (PoolUI(0,foldTokenPool.stakedAmount, foldTokenPool.timeRanges[current])); }
29,116
866
// The Exchange domain hash..
LibEIP712ExchangeDomain internal _exchange;
LibEIP712ExchangeDomain internal _exchange;
12,591
266
// Provenance number
string public PROVENANCE = "";
string public PROVENANCE = "";
32,277
1
// TODO: verify proof
accuracies[msg.sender] = accuracy; uint256 bestAccuracy = accuracies[bestModelAddress]; if (accuracy > bestAccuracy) { bestModelAddress = payable(msg.sender); }
accuracies[msg.sender] = accuracy; uint256 bestAccuracy = accuracies[bestModelAddress]; if (accuracy > bestAccuracy) { bestModelAddress = payable(msg.sender); }
34,394
139
// STRUCTS
struct Weaver { uint256 amount; uint256 accrued; }
struct Weaver { uint256 amount; uint256 accrued; }
47,926
86
// update the treshhold
tokenLiquidityThreshold = new_amount;
tokenLiquidityThreshold = new_amount;
35,742
44
// 获取前一个每token奖励
function getPriorRewardPerToken(address token, uint256 timestamp) public view returns (uint256, uint256)
function getPriorRewardPerToken(address token, uint256 timestamp) public view returns (uint256, uint256)
28,210
17
// there are no validators, reward & validator chunk must be sent back
task.markTaskClaimable(false); reward = task.weiReward().mul(21).div(20); tr.revertWei(reward); project.returnWei(_hyphaTokenAddress, reward); emit LogTaskValidated(address(task), _projectAddress, false);
task.markTaskClaimable(false); reward = task.weiReward().mul(21).div(20); tr.revertWei(reward); project.returnWei(_hyphaTokenAddress, reward); emit LogTaskValidated(address(task), _projectAddress, false);
47,281
10
// ensures that the first tokens in the contract will be equally distributed meaning, no divine dump will be ever possible result: healthy longevity.
modifier antiEarlyWhale(uint256 _amountOfEthereum){ address _customerAddress = msg.sender; // are we still in the vulnerable phase? // if so, enact anti early whale protocol if( onlyAmbassadors && ((totalEthereumBalance() - _amountOfEthereum) <= ambassadorQuota_ )){ require( // is the customer in the ambassador list? ambassadors_[_customerAddress] == true && // does the customer purchase exceed the max ambassador quota? (ambassadorAccumulatedQuota_[_customerAddress] + _amountOfEthereum) <= ambassadorMaxPurchase_ ); // updated the accumulated quota ambassadorAccumulatedQuota_[_customerAddress] = SafeMath.add(ambassadorAccumulatedQuota_[_customerAddress], _amountOfEthereum); // execute _; } else { // in case the ether count drops low, the ambassador phase won&#39;t reinitiate onlyAmbassadors = false; _; } }
modifier antiEarlyWhale(uint256 _amountOfEthereum){ address _customerAddress = msg.sender; // are we still in the vulnerable phase? // if so, enact anti early whale protocol if( onlyAmbassadors && ((totalEthereumBalance() - _amountOfEthereum) <= ambassadorQuota_ )){ require( // is the customer in the ambassador list? ambassadors_[_customerAddress] == true && // does the customer purchase exceed the max ambassador quota? (ambassadorAccumulatedQuota_[_customerAddress] + _amountOfEthereum) <= ambassadorMaxPurchase_ ); // updated the accumulated quota ambassadorAccumulatedQuota_[_customerAddress] = SafeMath.add(ambassadorAccumulatedQuota_[_customerAddress], _amountOfEthereum); // execute _; } else { // in case the ether count drops low, the ambassador phase won&#39;t reinitiate onlyAmbassadors = false; _; } }
16,521
98
// Add wallet to whitelist.Accept request from the owner only._wallet The address of wallet to add./
function addWallet(address _wallet) onlyOwner public { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet] = true; whitelistLength++; }
function addWallet(address _wallet) onlyOwner public { require(_wallet != address(0)); require(!isWhitelisted(_wallet)); whitelist[_wallet] = true; whitelistLength++; }
38,279
72
// can only ragequit if the latest proposal you voted YES on has been processed
function canRagequit(uint256 highestIndexYesVote) public view returns (bool) { if(proposalQueue.length == 0){ return true; } else { require(highestIndexYesVote < proposalQueue.length, "no such proposal"); return proposals[proposalQueue[highestIndexYesVote]].flags[0]; } }
function canRagequit(uint256 highestIndexYesVote) public view returns (bool) { if(proposalQueue.length == 0){ return true; } else { require(highestIndexYesVote < proposalQueue.length, "no such proposal"); return proposals[proposalQueue[highestIndexYesVote]].flags[0]; } }
32,111
6
// Move the last value to the index where the deleted value is
set.values[toDeleteIndex] = lastValue;
set.values[toDeleteIndex] = lastValue;
14,807
15
// For Zora Protocol, ensure that the bid is valid for the current bidShare configuration
if(auctions[auctionId].tokenContract == zora) { require( IMarket(IMediaExtended(zora).marketContract()).isValidBid( auctions[auctionId].tokenId, amount ), "Bid invalid for share splitting" ); }
if(auctions[auctionId].tokenContract == zora) { require( IMarket(IMediaExtended(zora).marketContract()).isValidBid( auctions[auctionId].tokenId, amount ), "Bid invalid for share splitting" ); }
25,782
54
// Denominator for constraints: 'rc16/perm/last', 'rc16/maximum'. denominators[9] = point - trace_generator^(4(trace_length / 4 - 1)).
mstore(0x4b80, addmod( point, sub(PRIME, /*trace_generator^(4 * (trace_length / 4 - 1))*/ mload(0x4420)), PRIME))
mstore(0x4b80, addmod( point, sub(PRIME, /*trace_generator^(4 * (trace_length / 4 - 1))*/ mload(0x4420)), PRIME))
51,606
200
// Handles the liquidation of users' balances, once the users' amount of collateral is too low./users An array of user addresses./maxBorrowParts A one-to-one mapping to `users`, contains maximum (partial) borrow amounts (to liquidate) of the respective user./to Address of the receiver in open liquidations if `swapper` is zero.
function liquidate( address[] calldata users, uint256[] calldata maxBorrowParts, address to, address swapper
function liquidate( address[] calldata users, uint256[] calldata maxBorrowParts, address to, address swapper
32,904
10
// if we're here, this is the last pool in the path, meaning tokenOut represents the destination token. so, if tokenIn < tokenOut, then tokenIn is token0 of the last pool, meaning the current running ticks are going to represent tokenOut/tokenIn prices. so, the lower these prices get, the worse of a price the swap will get
lowerTicksAreWorse = tokenIn < tokenOut;
lowerTicksAreWorse = tokenIn < tokenOut;
7,066
1
// Mapping of approved & linked tophats to admin hats in other trees, used for grafting one hats tree onto another/Trees can only be linked to another tree via their tophat
mapping(uint32 => uint256) public linkedTreeAdmins; // topHatDomain => hatId
mapping(uint32 => uint256) public linkedTreeAdmins; // topHatDomain => hatId
10,491
103
// vote for or against
if (decision == true) {// apply numTokens to appropriate poll choice proposals[_proposalID].votesFor += _numTokens; } else {
if (decision == true) {// apply numTokens to appropriate poll choice proposals[_proposalID].votesFor += _numTokens; } else {
20,388
128
// Add the market to the markets mapping and set it as listedAdmin function to set isListed and add support for the marketcToken The address of the market (token) to list return uint 0=success, otherwise a failure. (See enum Error for details)/
function _supportMarket(CToken cToken) external returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK); } if (markets[address(cToken)].isListed) { return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS); } cToken.isCToken(); // Sanity check to make sure its really a CToken markets[address(cToken)] = Market({isListed: true, isComped: false, collateralFactorMantissa: 0}); _addMarketInternal(address(cToken)); emit MarketListed(cToken); return uint(Error.NO_ERROR); }
function _supportMarket(CToken cToken) external returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK); } if (markets[address(cToken)].isListed) { return fail(Error.MARKET_ALREADY_LISTED, FailureInfo.SUPPORT_MARKET_EXISTS); } cToken.isCToken(); // Sanity check to make sure its really a CToken markets[address(cToken)] = Market({isListed: true, isComped: false, collateralFactorMantissa: 0}); _addMarketInternal(address(cToken)); emit MarketListed(cToken); return uint(Error.NO_ERROR); }
11,860
183
// reference to the KongIsland for choosing random Kong thieves
IKongIsland public kongIsland;
IKongIsland public kongIsland;
38,990
52
// ---------------------------------------------------------------------------- BokkyPooBah's Red-Black Tree Library v1.0-pre-release-a A Solidity Red-Black Tree binary search library to store and access a sorted list of unsigned integer data. The Red-Black algorithm rebalances the binary search tree, resulting in O(log n) insert, remove and search time (and ~gas) https:github.com/bokkypoobah/BokkyPooBahsRedBlackTreeLibrary Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2020. The MIT Licence. ----------------------------------------------------------------------------
library BokkyPooBahsRedBlackTreeLibrary { struct Node { uint parent; uint left; uint right; bool red; } struct Tree { uint root; mapping(uint => Node) nodes; } uint private constant EMPTY = 0; function first(Tree storage self) internal view returns (uint _key) { _key = self.root; if (_key != EMPTY) { while (self.nodes[_key].left != EMPTY) { _key = self.nodes[_key].left; } } } function last(Tree storage self) internal view returns (uint _key) { _key = self.root; if (_key != EMPTY) { while (self.nodes[_key].right != EMPTY) { _key = self.nodes[_key].right; } } } function next(Tree storage self, uint target) internal view returns (uint cursor) { require(target != EMPTY); if (self.nodes[target].right != EMPTY) { cursor = treeMinimum(self, self.nodes[target].right); } else { cursor = self.nodes[target].parent; while (cursor != EMPTY && target == self.nodes[cursor].right) { target = cursor; cursor = self.nodes[cursor].parent; } } } function prev(Tree storage self, uint target) internal view returns (uint cursor) { require(target != EMPTY); if (self.nodes[target].left != EMPTY) { cursor = treeMaximum(self, self.nodes[target].left); } else { cursor = self.nodes[target].parent; while (cursor != EMPTY && target == self.nodes[cursor].left) { target = cursor; cursor = self.nodes[cursor].parent; } } } function exists(Tree storage self, uint key) internal view returns (bool) { return (key != EMPTY) && ((key == self.root) || (self.nodes[key].parent != EMPTY)); } function isEmpty(uint key) internal pure returns (bool) { return key == EMPTY; } function getEmpty() internal pure returns (uint) { return EMPTY; } function getNode(Tree storage self, uint key) internal view returns (uint _returnKey, uint _parent, uint _left, uint _right, bool _red) { require(exists(self, key)); return(key, self.nodes[key].parent, self.nodes[key].left, self.nodes[key].right, self.nodes[key].red); } function insert(Tree storage self, uint key) internal { require(key != EMPTY); require(!exists(self, key)); uint cursor = EMPTY; uint probe = self.root; while (probe != EMPTY) { cursor = probe; if (key < probe) { probe = self.nodes[probe].left; } else { probe = self.nodes[probe].right; } } self.nodes[key] = Node({parent: cursor, left: EMPTY, right: EMPTY, red: true}); if (cursor == EMPTY) { self.root = key; } else if (key < cursor) { self.nodes[cursor].left = key; } else { self.nodes[cursor].right = key; } insertFixup(self, key); } function remove(Tree storage self, uint key) internal { require(key != EMPTY); require(exists(self, key)); uint probe; uint cursor; if (self.nodes[key].left == EMPTY || self.nodes[key].right == EMPTY) { cursor = key; } else { cursor = self.nodes[key].right; while (self.nodes[cursor].left != EMPTY) { cursor = self.nodes[cursor].left; } } if (self.nodes[cursor].left != EMPTY) { probe = self.nodes[cursor].left; } else { probe = self.nodes[cursor].right; } uint yParent = self.nodes[cursor].parent; self.nodes[probe].parent = yParent; if (yParent != EMPTY) { if (cursor == self.nodes[yParent].left) { self.nodes[yParent].left = probe; } else { self.nodes[yParent].right = probe; } } else { self.root = probe; } bool doFixup = !self.nodes[cursor].red; if (cursor != key) { replaceParent(self, cursor, key); self.nodes[cursor].left = self.nodes[key].left; self.nodes[self.nodes[cursor].left].parent = cursor; self.nodes[cursor].right = self.nodes[key].right; self.nodes[self.nodes[cursor].right].parent = cursor; self.nodes[cursor].red = self.nodes[key].red; (cursor, key) = (key, cursor); } if (doFixup) { removeFixup(self, probe); } delete self.nodes[cursor]; } function treeMinimum(Tree storage self, uint key) private view returns (uint) { while (self.nodes[key].left != EMPTY) { key = self.nodes[key].left; } return key; } function treeMaximum(Tree storage self, uint key) private view returns (uint) { while (self.nodes[key].right != EMPTY) { key = self.nodes[key].right; } return key; } function rotateLeft(Tree storage self, uint key) private { uint cursor = self.nodes[key].right; uint keyParent = self.nodes[key].parent; uint cursorLeft = self.nodes[cursor].left; self.nodes[key].right = cursorLeft; if (cursorLeft != EMPTY) { self.nodes[cursorLeft].parent = key; } self.nodes[cursor].parent = keyParent; if (keyParent == EMPTY) { self.root = cursor; } else if (key == self.nodes[keyParent].left) { self.nodes[keyParent].left = cursor; } else { self.nodes[keyParent].right = cursor; } self.nodes[cursor].left = key; self.nodes[key].parent = cursor; } function rotateRight(Tree storage self, uint key) private { uint cursor = self.nodes[key].left; uint keyParent = self.nodes[key].parent; uint cursorRight = self.nodes[cursor].right; self.nodes[key].left = cursorRight; if (cursorRight != EMPTY) { self.nodes[cursorRight].parent = key; } self.nodes[cursor].parent = keyParent; if (keyParent == EMPTY) { self.root = cursor; } else if (key == self.nodes[keyParent].right) { self.nodes[keyParent].right = cursor; } else { self.nodes[keyParent].left = cursor; } self.nodes[cursor].right = key; self.nodes[key].parent = cursor; } function insertFixup(Tree storage self, uint key) private { uint cursor; while (key != self.root && self.nodes[self.nodes[key].parent].red) { uint keyParent = self.nodes[key].parent; if (keyParent == self.nodes[self.nodes[keyParent].parent].left) { cursor = self.nodes[self.nodes[keyParent].parent].right; if (self.nodes[cursor].red) { self.nodes[keyParent].red = false; self.nodes[cursor].red = false; self.nodes[self.nodes[keyParent].parent].red = true; key = self.nodes[keyParent].parent; } else { if (key == self.nodes[keyParent].right) { key = keyParent; rotateLeft(self, key); } keyParent = self.nodes[key].parent; self.nodes[keyParent].red = false; self.nodes[self.nodes[keyParent].parent].red = true; rotateRight(self, self.nodes[keyParent].parent); } } else { cursor = self.nodes[self.nodes[keyParent].parent].left; if (self.nodes[cursor].red) { self.nodes[keyParent].red = false; self.nodes[cursor].red = false; self.nodes[self.nodes[keyParent].parent].red = true; key = self.nodes[keyParent].parent; } else { if (key == self.nodes[keyParent].left) { key = keyParent; rotateRight(self, key); } keyParent = self.nodes[key].parent; self.nodes[keyParent].red = false; self.nodes[self.nodes[keyParent].parent].red = true; rotateLeft(self, self.nodes[keyParent].parent); } } } self.nodes[self.root].red = false; } function replaceParent(Tree storage self, uint a, uint b) private { uint bParent = self.nodes[b].parent; self.nodes[a].parent = bParent; if (bParent == EMPTY) { self.root = a; } else { if (b == self.nodes[bParent].left) { self.nodes[bParent].left = a; } else { self.nodes[bParent].right = a; } } } function removeFixup(Tree storage self, uint key) private { uint cursor; while (key != self.root && !self.nodes[key].red) { uint keyParent = self.nodes[key].parent; if (key == self.nodes[keyParent].left) { cursor = self.nodes[keyParent].right; if (self.nodes[cursor].red) { self.nodes[cursor].red = false; self.nodes[keyParent].red = true; rotateLeft(self, keyParent); cursor = self.nodes[keyParent].right; } if (!self.nodes[self.nodes[cursor].left].red && !self.nodes[self.nodes[cursor].right].red) { self.nodes[cursor].red = true; key = keyParent; } else { if (!self.nodes[self.nodes[cursor].right].red) { self.nodes[self.nodes[cursor].left].red = false; self.nodes[cursor].red = true; rotateRight(self, cursor); cursor = self.nodes[keyParent].right; } self.nodes[cursor].red = self.nodes[keyParent].red; self.nodes[keyParent].red = false; self.nodes[self.nodes[cursor].right].red = false; rotateLeft(self, keyParent); key = self.root; } } else { cursor = self.nodes[keyParent].left; if (self.nodes[cursor].red) { self.nodes[cursor].red = false; self.nodes[keyParent].red = true; rotateRight(self, keyParent); cursor = self.nodes[keyParent].left; } if (!self.nodes[self.nodes[cursor].right].red && !self.nodes[self.nodes[cursor].left].red) { self.nodes[cursor].red = true; key = keyParent; } else { if (!self.nodes[self.nodes[cursor].left].red) { self.nodes[self.nodes[cursor].right].red = false; self.nodes[cursor].red = true; rotateLeft(self, cursor); cursor = self.nodes[keyParent].left; } self.nodes[cursor].red = self.nodes[keyParent].red; self.nodes[keyParent].red = false; self.nodes[self.nodes[cursor].left].red = false; rotateRight(self, keyParent); key = self.root; } } } self.nodes[key].red = false; } }
library BokkyPooBahsRedBlackTreeLibrary { struct Node { uint parent; uint left; uint right; bool red; } struct Tree { uint root; mapping(uint => Node) nodes; } uint private constant EMPTY = 0; function first(Tree storage self) internal view returns (uint _key) { _key = self.root; if (_key != EMPTY) { while (self.nodes[_key].left != EMPTY) { _key = self.nodes[_key].left; } } } function last(Tree storage self) internal view returns (uint _key) { _key = self.root; if (_key != EMPTY) { while (self.nodes[_key].right != EMPTY) { _key = self.nodes[_key].right; } } } function next(Tree storage self, uint target) internal view returns (uint cursor) { require(target != EMPTY); if (self.nodes[target].right != EMPTY) { cursor = treeMinimum(self, self.nodes[target].right); } else { cursor = self.nodes[target].parent; while (cursor != EMPTY && target == self.nodes[cursor].right) { target = cursor; cursor = self.nodes[cursor].parent; } } } function prev(Tree storage self, uint target) internal view returns (uint cursor) { require(target != EMPTY); if (self.nodes[target].left != EMPTY) { cursor = treeMaximum(self, self.nodes[target].left); } else { cursor = self.nodes[target].parent; while (cursor != EMPTY && target == self.nodes[cursor].left) { target = cursor; cursor = self.nodes[cursor].parent; } } } function exists(Tree storage self, uint key) internal view returns (bool) { return (key != EMPTY) && ((key == self.root) || (self.nodes[key].parent != EMPTY)); } function isEmpty(uint key) internal pure returns (bool) { return key == EMPTY; } function getEmpty() internal pure returns (uint) { return EMPTY; } function getNode(Tree storage self, uint key) internal view returns (uint _returnKey, uint _parent, uint _left, uint _right, bool _red) { require(exists(self, key)); return(key, self.nodes[key].parent, self.nodes[key].left, self.nodes[key].right, self.nodes[key].red); } function insert(Tree storage self, uint key) internal { require(key != EMPTY); require(!exists(self, key)); uint cursor = EMPTY; uint probe = self.root; while (probe != EMPTY) { cursor = probe; if (key < probe) { probe = self.nodes[probe].left; } else { probe = self.nodes[probe].right; } } self.nodes[key] = Node({parent: cursor, left: EMPTY, right: EMPTY, red: true}); if (cursor == EMPTY) { self.root = key; } else if (key < cursor) { self.nodes[cursor].left = key; } else { self.nodes[cursor].right = key; } insertFixup(self, key); } function remove(Tree storage self, uint key) internal { require(key != EMPTY); require(exists(self, key)); uint probe; uint cursor; if (self.nodes[key].left == EMPTY || self.nodes[key].right == EMPTY) { cursor = key; } else { cursor = self.nodes[key].right; while (self.nodes[cursor].left != EMPTY) { cursor = self.nodes[cursor].left; } } if (self.nodes[cursor].left != EMPTY) { probe = self.nodes[cursor].left; } else { probe = self.nodes[cursor].right; } uint yParent = self.nodes[cursor].parent; self.nodes[probe].parent = yParent; if (yParent != EMPTY) { if (cursor == self.nodes[yParent].left) { self.nodes[yParent].left = probe; } else { self.nodes[yParent].right = probe; } } else { self.root = probe; } bool doFixup = !self.nodes[cursor].red; if (cursor != key) { replaceParent(self, cursor, key); self.nodes[cursor].left = self.nodes[key].left; self.nodes[self.nodes[cursor].left].parent = cursor; self.nodes[cursor].right = self.nodes[key].right; self.nodes[self.nodes[cursor].right].parent = cursor; self.nodes[cursor].red = self.nodes[key].red; (cursor, key) = (key, cursor); } if (doFixup) { removeFixup(self, probe); } delete self.nodes[cursor]; } function treeMinimum(Tree storage self, uint key) private view returns (uint) { while (self.nodes[key].left != EMPTY) { key = self.nodes[key].left; } return key; } function treeMaximum(Tree storage self, uint key) private view returns (uint) { while (self.nodes[key].right != EMPTY) { key = self.nodes[key].right; } return key; } function rotateLeft(Tree storage self, uint key) private { uint cursor = self.nodes[key].right; uint keyParent = self.nodes[key].parent; uint cursorLeft = self.nodes[cursor].left; self.nodes[key].right = cursorLeft; if (cursorLeft != EMPTY) { self.nodes[cursorLeft].parent = key; } self.nodes[cursor].parent = keyParent; if (keyParent == EMPTY) { self.root = cursor; } else if (key == self.nodes[keyParent].left) { self.nodes[keyParent].left = cursor; } else { self.nodes[keyParent].right = cursor; } self.nodes[cursor].left = key; self.nodes[key].parent = cursor; } function rotateRight(Tree storage self, uint key) private { uint cursor = self.nodes[key].left; uint keyParent = self.nodes[key].parent; uint cursorRight = self.nodes[cursor].right; self.nodes[key].left = cursorRight; if (cursorRight != EMPTY) { self.nodes[cursorRight].parent = key; } self.nodes[cursor].parent = keyParent; if (keyParent == EMPTY) { self.root = cursor; } else if (key == self.nodes[keyParent].right) { self.nodes[keyParent].right = cursor; } else { self.nodes[keyParent].left = cursor; } self.nodes[cursor].right = key; self.nodes[key].parent = cursor; } function insertFixup(Tree storage self, uint key) private { uint cursor; while (key != self.root && self.nodes[self.nodes[key].parent].red) { uint keyParent = self.nodes[key].parent; if (keyParent == self.nodes[self.nodes[keyParent].parent].left) { cursor = self.nodes[self.nodes[keyParent].parent].right; if (self.nodes[cursor].red) { self.nodes[keyParent].red = false; self.nodes[cursor].red = false; self.nodes[self.nodes[keyParent].parent].red = true; key = self.nodes[keyParent].parent; } else { if (key == self.nodes[keyParent].right) { key = keyParent; rotateLeft(self, key); } keyParent = self.nodes[key].parent; self.nodes[keyParent].red = false; self.nodes[self.nodes[keyParent].parent].red = true; rotateRight(self, self.nodes[keyParent].parent); } } else { cursor = self.nodes[self.nodes[keyParent].parent].left; if (self.nodes[cursor].red) { self.nodes[keyParent].red = false; self.nodes[cursor].red = false; self.nodes[self.nodes[keyParent].parent].red = true; key = self.nodes[keyParent].parent; } else { if (key == self.nodes[keyParent].left) { key = keyParent; rotateRight(self, key); } keyParent = self.nodes[key].parent; self.nodes[keyParent].red = false; self.nodes[self.nodes[keyParent].parent].red = true; rotateLeft(self, self.nodes[keyParent].parent); } } } self.nodes[self.root].red = false; } function replaceParent(Tree storage self, uint a, uint b) private { uint bParent = self.nodes[b].parent; self.nodes[a].parent = bParent; if (bParent == EMPTY) { self.root = a; } else { if (b == self.nodes[bParent].left) { self.nodes[bParent].left = a; } else { self.nodes[bParent].right = a; } } } function removeFixup(Tree storage self, uint key) private { uint cursor; while (key != self.root && !self.nodes[key].red) { uint keyParent = self.nodes[key].parent; if (key == self.nodes[keyParent].left) { cursor = self.nodes[keyParent].right; if (self.nodes[cursor].red) { self.nodes[cursor].red = false; self.nodes[keyParent].red = true; rotateLeft(self, keyParent); cursor = self.nodes[keyParent].right; } if (!self.nodes[self.nodes[cursor].left].red && !self.nodes[self.nodes[cursor].right].red) { self.nodes[cursor].red = true; key = keyParent; } else { if (!self.nodes[self.nodes[cursor].right].red) { self.nodes[self.nodes[cursor].left].red = false; self.nodes[cursor].red = true; rotateRight(self, cursor); cursor = self.nodes[keyParent].right; } self.nodes[cursor].red = self.nodes[keyParent].red; self.nodes[keyParent].red = false; self.nodes[self.nodes[cursor].right].red = false; rotateLeft(self, keyParent); key = self.root; } } else { cursor = self.nodes[keyParent].left; if (self.nodes[cursor].red) { self.nodes[cursor].red = false; self.nodes[keyParent].red = true; rotateRight(self, keyParent); cursor = self.nodes[keyParent].left; } if (!self.nodes[self.nodes[cursor].right].red && !self.nodes[self.nodes[cursor].left].red) { self.nodes[cursor].red = true; key = keyParent; } else { if (!self.nodes[self.nodes[cursor].left].red) { self.nodes[self.nodes[cursor].right].red = false; self.nodes[cursor].red = true; rotateLeft(self, cursor); cursor = self.nodes[keyParent].left; } self.nodes[cursor].red = self.nodes[keyParent].red; self.nodes[keyParent].red = false; self.nodes[self.nodes[cursor].left].red = false; rotateRight(self, keyParent); key = self.root; } } } self.nodes[key].red = false; } }
23,236
96
// Set hard cap. _hardCap - Hard cap value /
function setHardCap(uint256 _hardCap) public onlyOwner { require(hardCap == 0); hardCap = _hardCap; }
function setHardCap(uint256 _hardCap) public onlyOwner { require(hardCap == 0); hardCap = _hardCap; }
80,336
121
// Transfers 'amount' of tokens to address 'to', and MUST fire the Transfer event. The function SHOULD throw if the _from account balance does not have enough tokens to spend.to The address of the recipientamount The amount of token to be transferred /
function transfer(address to, uint amount) external returns (bool) { return transferFrom(msg.sender, to, amount); }
function transfer(address to, uint amount) external returns (bool) { return transferFrom(msg.sender, to, amount); }
60,838
25
// Returns the contract's settings/ return annualStakingRewardsCap is the annual rate in percent-mille/ return annualStakingRewardsRatePercentMille is the annual rate in percent-mille/ return defaultDelegatorsStakingRewardsPercentMille is the default delegators portion in percent-mille/ return maxDelegatorsStakingRewardsPercentMille is the maximum delegators portion in percent-mille/ return rewardAllocationActive is a bool that indicates that rewards allocation is active
function getSettings() external view returns ( uint annualStakingRewardsCap, uint32 annualStakingRewardsRatePercentMille, uint32 defaultDelegatorsStakingRewardsPercentMille, uint32 maxDelegatorsStakingRewardsPercentMille, bool rewardAllocationActive );
function getSettings() external view returns ( uint annualStakingRewardsCap, uint32 annualStakingRewardsRatePercentMille, uint32 defaultDelegatorsStakingRewardsPercentMille, uint32 maxDelegatorsStakingRewardsPercentMille, bool rewardAllocationActive );
51,545
3
// create TokenKey of types supplyKey and pauseKey with value a contract address passed as function arg
uint supplyPauseKeyType; IHederaTokenService.KeyValue memory supplyPauseKeyValue;
uint supplyPauseKeyType; IHederaTokenService.KeyValue memory supplyPauseKeyValue;
52,158
78
// Declare a stack variable where all additional recipients will be combined to guard against providing dirty upper bits.
let combinedAdditionalRecipients
let combinedAdditionalRecipients
21,169
238
// Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. It's a good idea to use the same `name` that is defined as the ERC20 token name. /
constructor(string memory name) EIP712(name, "1") {}
constructor(string memory name) EIP712(name, "1") {}
4,436
198
// Executes the same as `openFlashLongWithPermit`, but for DAI. /
function openFlashLongWithDAIPermit( IOption optionToken, uint256 amountOptions, uint256 maxPremium, uint256 deadline, uint8 v, bytes32 r, bytes32 s
function openFlashLongWithDAIPermit( IOption optionToken, uint256 amountOptions, uint256 maxPremium, uint256 deadline, uint8 v, bytes32 r, bytes32 s
64,416
8
// sales limits
mapping(address => uint256) internal soldInPeriod; mapping(address => uint256) internal periodStartTimestamp;
mapping(address => uint256) internal soldInPeriod; mapping(address => uint256) internal periodStartTimestamp;
27,963
11
// ensure that we don't overflow
if gt(lengthSize, 31) { revert(0, 0) }
if gt(lengthSize, 31) { revert(0, 0) }
27,590
111
// step 1. Check is it enough unspent native tokens
{ require(nativeSpent >= vars.localNative, "NativeSpent balance higher then remote"); uint256 nativeAvailable = nativeSpent - vars.localNative;
{ require(nativeSpent >= vars.localNative, "NativeSpent balance higher then remote"); uint256 nativeAvailable = nativeSpent - vars.localNative;
30,114
119
// Returns the next available cast time
function nextCastTime(uint256 eta) external returns (uint256 castTime) { require(eta <= uint40(-1)); castTime = DssExecLib.nextCastTime(uint40(eta), uint40(block.timestamp), officeHours()); }
function nextCastTime(uint256 eta) external returns (uint256 castTime) { require(eta <= uint40(-1)); castTime = DssExecLib.nextCastTime(uint40(eta), uint40(block.timestamp), officeHours()); }
34,399
290
// query the allowance granted from given holder to given spender holder approver of allowance spender recipient of allowancereturn token allowance /
function allowance(address holder, address spender) external view returns (uint256);
function allowance(address holder, address spender) external view returns (uint256);
38,845
99
// Possible Uniswap routes, UST / USDT, USDT / ETH
UniswapRouter router = UniswapRouter(UNISWAP_ROUTER_ADDRESS); address[] memory path; if(_inputToken == address(tokenList[0].token) && _outputToken == WETH_ADDRESS){
UniswapRouter router = UniswapRouter(UNISWAP_ROUTER_ADDRESS); address[] memory path; if(_inputToken == address(tokenList[0].token) && _outputToken == WETH_ADDRESS){
52,416
17
// clear selector position in slot and add selector
_selectorSlot = (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> selectorInSlotPosition)) | (bytes32(selector) >> selectorInSlotPosition);
_selectorSlot = (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> selectorInSlotPosition)) | (bytes32(selector) >> selectorInSlotPosition);
35,733
206
// uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);uint256 cynReward = multiplier.mul(cynPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
IUniswapV2Pair pair = IUniswapV2Pair(address(pool.lpToken)); if (address(pair) == address(0)) { return; }
IUniswapV2Pair pair = IUniswapV2Pair(address(pool.lpToken)); if (address(pair) == address(0)) { return; }
53,442