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
628
// Helper library for transferring assets from one portfolio to another
library TransferAssets { using AccountContextHandler for AccountContext; using PortfolioHandler for PortfolioState; using SafeInt256 for int256; /// @notice Decodes asset ids function decodeAssetId(uint256 id) internal pure returns ( uint256 currencyId, uint256 maturity, uint256 assetType ) { assetType = uint8(id); maturity = uint40(id >> 8); currencyId = uint16(id >> 48); } /// @notice Encodes asset ids function encodeAssetId( uint256 currencyId, uint256 maturity, uint256 assetType ) internal pure returns (uint256) { require(currencyId <= Constants.MAX_CURRENCIES); require(maturity <= type(uint40).max); require(assetType <= Constants.MAX_LIQUIDITY_TOKEN_INDEX); return uint256( (bytes32(uint256(uint16(currencyId))) << 48) | (bytes32(uint256(uint40(maturity))) << 8) | bytes32(uint256(uint8(assetType))) ); } /// @dev Used to flip the sign of assets to decrement the `from` account that is sending assets function invertNotionalAmountsInPlace(PortfolioAsset[] memory assets) internal pure { for (uint256 i; i < assets.length; i++) { assets[i].notional = assets[i].notional.neg(); } } /// @dev Useful method for hiding the logic of updating an account. WARNING: the account /// context returned from this method may not be the same memory location as the account /// context provided if the account is settled. function placeAssetsInAccount( address account, AccountContext memory accountContext, PortfolioAsset[] memory assets ) internal returns (AccountContext memory) { // If an account has assets that require settlement then placing assets inside it // may cause issues. require(!accountContext.mustSettleAssets(), "Account must settle"); if (accountContext.isBitmapEnabled()) { // Adds fCash assets into the account and finalized storage BitmapAssetsHandler.addMultipleifCashAssets(account, accountContext, assets); } else { PortfolioState memory portfolioState = PortfolioHandler.buildPortfolioState( account, accountContext.assetArrayLength, assets.length ); // This will add assets in memory portfolioState.addMultipleAssets(assets); // This will store assets and update the account context in memory accountContext.storeAssetsAndUpdateContext(account, portfolioState, false); } return accountContext; } }
library TransferAssets { using AccountContextHandler for AccountContext; using PortfolioHandler for PortfolioState; using SafeInt256 for int256; /// @notice Decodes asset ids function decodeAssetId(uint256 id) internal pure returns ( uint256 currencyId, uint256 maturity, uint256 assetType ) { assetType = uint8(id); maturity = uint40(id >> 8); currencyId = uint16(id >> 48); } /// @notice Encodes asset ids function encodeAssetId( uint256 currencyId, uint256 maturity, uint256 assetType ) internal pure returns (uint256) { require(currencyId <= Constants.MAX_CURRENCIES); require(maturity <= type(uint40).max); require(assetType <= Constants.MAX_LIQUIDITY_TOKEN_INDEX); return uint256( (bytes32(uint256(uint16(currencyId))) << 48) | (bytes32(uint256(uint40(maturity))) << 8) | bytes32(uint256(uint8(assetType))) ); } /// @dev Used to flip the sign of assets to decrement the `from` account that is sending assets function invertNotionalAmountsInPlace(PortfolioAsset[] memory assets) internal pure { for (uint256 i; i < assets.length; i++) { assets[i].notional = assets[i].notional.neg(); } } /// @dev Useful method for hiding the logic of updating an account. WARNING: the account /// context returned from this method may not be the same memory location as the account /// context provided if the account is settled. function placeAssetsInAccount( address account, AccountContext memory accountContext, PortfolioAsset[] memory assets ) internal returns (AccountContext memory) { // If an account has assets that require settlement then placing assets inside it // may cause issues. require(!accountContext.mustSettleAssets(), "Account must settle"); if (accountContext.isBitmapEnabled()) { // Adds fCash assets into the account and finalized storage BitmapAssetsHandler.addMultipleifCashAssets(account, accountContext, assets); } else { PortfolioState memory portfolioState = PortfolioHandler.buildPortfolioState( account, accountContext.assetArrayLength, assets.length ); // This will add assets in memory portfolioState.addMultipleAssets(assets); // This will store assets and update the account context in memory accountContext.storeAssetsAndUpdateContext(account, portfolioState, false); } return accountContext; } }
3,779
14
// Update the balances for both users and providers
function userPayForTrip(address providerAddress) public userSignedUp(msg.sender) providerSignedUp(providerAddress) { providersData[providerAddress].balance += providersData[providerAddress].cost; usersData[msg.sender].balance -= providersData[providerAddress].cost; }
function userPayForTrip(address providerAddress) public userSignedUp(msg.sender) providerSignedUp(providerAddress) { providersData[providerAddress].balance += providersData[providerAddress].cost; usersData[msg.sender].balance -= providersData[providerAddress].cost; }
5,304
5
// Decrease user balance
balanceOf[account] = balanceOf[account] - amount;
balanceOf[account] = balanceOf[account] - amount;
41,799
39
// ---------------------------------- Define STD_TOKEN_WithFees
contract STD_TOKEN_WithFees is STD_TOKEN, Ownable { uint256 public pointsCount = 0; uint256 public txFee = 0; uint256 constant internal MAX_DEFINED_POINTS = 20; uint256 constant internal MAX_DEFINED_FEE = 50; string public name; string public symbol; uint8 public decimals; uint public _totalSupply; uint internal constant MAX_UINT = 2**256 - 1; function getFeeNow(uint _value) public view returns (uint) { uint fee = (_value.mul(pointsCount)).div(10000); if (fee > txFee) { fee = txFee; } return fee; } function transfer(address _to, uint _value) public returns (bool) { uint fee = getFeeNow(_value); uint sendAmount = _value.sub(fee); super.transfer(_to, sendAmount); if (fee > 0) { super.transfer(getOwner(), fee); } } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); uint fee = getFeeNow(_value); uint sendAmount = _value.sub(fee); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(sendAmount); if (allowed[_from][msg.sender] < MAX_UINT) { allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); } emit Transfer(_from, _to, sendAmount); if (fee > 0) { balances[getOwner()] = balances[getOwner()].add(fee); emit Transfer(_from, getOwner(), fee); } return true; } function set_Contract_Vars(uint newPoints, uint newTxFee) public onlyOwner { require(newPoints < MAX_DEFINED_POINTS); require(newTxFee < MAX_DEFINED_FEE); pointsCount = newPoints; txFee = newTxFee.mul(uint(10)**decimals); emit contract_Vars_Changed(pointsCount, txFee); } function get_MAX_DEFINED_POINTS() public pure returns(uint256){ return MAX_DEFINED_POINTS; } function get_MAX_DEFINED_FEE() public pure returns(uint256){ return MAX_DEFINED_FEE; } function get_MAX_UINT() public pure returns(uint256){ return MAX_UINT; } event contract_Vars_Changed(uint feeBasisPoints, uint maxFee); }
contract STD_TOKEN_WithFees is STD_TOKEN, Ownable { uint256 public pointsCount = 0; uint256 public txFee = 0; uint256 constant internal MAX_DEFINED_POINTS = 20; uint256 constant internal MAX_DEFINED_FEE = 50; string public name; string public symbol; uint8 public decimals; uint public _totalSupply; uint internal constant MAX_UINT = 2**256 - 1; function getFeeNow(uint _value) public view returns (uint) { uint fee = (_value.mul(pointsCount)).div(10000); if (fee > txFee) { fee = txFee; } return fee; } function transfer(address _to, uint _value) public returns (bool) { uint fee = getFeeNow(_value); uint sendAmount = _value.sub(fee); super.transfer(_to, sendAmount); if (fee > 0) { super.transfer(getOwner(), fee); } } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); uint fee = getFeeNow(_value); uint sendAmount = _value.sub(fee); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(sendAmount); if (allowed[_from][msg.sender] < MAX_UINT) { allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); } emit Transfer(_from, _to, sendAmount); if (fee > 0) { balances[getOwner()] = balances[getOwner()].add(fee); emit Transfer(_from, getOwner(), fee); } return true; } function set_Contract_Vars(uint newPoints, uint newTxFee) public onlyOwner { require(newPoints < MAX_DEFINED_POINTS); require(newTxFee < MAX_DEFINED_FEE); pointsCount = newPoints; txFee = newTxFee.mul(uint(10)**decimals); emit contract_Vars_Changed(pointsCount, txFee); } function get_MAX_DEFINED_POINTS() public pure returns(uint256){ return MAX_DEFINED_POINTS; } function get_MAX_DEFINED_FEE() public pure returns(uint256){ return MAX_DEFINED_FEE; } function get_MAX_UINT() public pure returns(uint256){ return MAX_UINT; } event contract_Vars_Changed(uint feeBasisPoints, uint maxFee); }
45,814
21
// Warning: This low-level function should be called from a contract which performs important safety checks.This function should never be called directly by an externally owned account.A sophsticated smart contract should make the important checks to make sure the correct amount of tokensare transferred into this contract prior to the function call. If an incorrect amount of tokens are transferredinto this contract, and this function is called, it can result in the loss of funds.Sends out underlyingTokens then checks to make sure they are returned or paid for.This function enables flash exercises and flash loans. Only smart contracts who implementtheir own
function exerciseOptions( address receiver, uint256 outUnderlyings, bytes calldata data
function exerciseOptions( address receiver, uint256 outUnderlyings, bytes calldata data
24,365
21
// Increment counter and create new Review
totalReviewsCounter = totalReviewsCounter + 1; Review memory newReview = review; newReview.reviewID = totalReviewsCounter;
totalReviewsCounter = totalReviewsCounter + 1; Review memory newReview = review; newReview.reviewID = totalReviewsCounter;
8,878
2
// The event, emitted when a trade settlement failed index Implying the index of the failed trade in the trade array passed to matchTrades() /
event TradeFailed(uint8 index);
event TradeFailed(uint8 index);
25,238
72
// Stop any additional minting of tokens forever.Available only to the owner. /
function finishMinting() external onlyOwner { mintingFinished = true; }
function finishMinting() external onlyOwner { mintingFinished = true; }
7,400
135
// check for sufficient vault stake amount
require(vaultData.totalStake >= amount, "Geyser: insufficient vault stake");
require(vaultData.totalStake >= amount, "Geyser: insufficient vault stake");
5,571
43
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
pragma solidity ^0.5.0;
43,345
108
// used to create new erc1155 typs from the Imperial guild ATTENTION - Type zero is reserved to not cause conflicts
function setType(uint256 typeId, uint16 maxSupply) external onlyOwner { require(typeInfo[typeId].mints <= maxSupply, "max supply too low"); typeInfo[typeId].maxSupply = maxSupply; }
function setType(uint256 typeId, uint16 maxSupply) external onlyOwner { require(typeInfo[typeId].mints <= maxSupply, "max supply too low"); typeInfo[typeId].maxSupply = maxSupply; }
29,328
5
// Perform actual sale operations
_sendReward(_msgSender(), rewardData); _handleMint(_msgSender(), mintData.ids, mintData.amounts); emit Purchased(_msgSender(), bundleId, amount, mintData, rewardData);
_sendReward(_msgSender(), rewardData); _handleMint(_msgSender(), mintData.ids, mintData.amounts); emit Purchased(_msgSender(), bundleId, amount, mintData, rewardData);
16,512
104
// bool paramsInit = false; iParams public params;
uint256 onceMintAmount;
uint256 onceMintAmount;
62,073
36
// Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],but performing a static call. _Available since v3.3._ /
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); }
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); }
33,392
158
// Withdraws a given stake from sender _amount Units of StakingToken /
function _withdrawRaw(uint256 _amount) internal nonReentrant { _rawBalances[msg.sender] -= _amount; stakingToken.safeTransfer(msg.sender, _amount); }
function _withdrawRaw(uint256 _amount) internal nonReentrant { _rawBalances[msg.sender] -= _amount; stakingToken.safeTransfer(msg.sender, _amount); }
15,483
88
// Shift the array with the oldest block time in the 0 position and add the value in the map
_timedTransactionsMap[recipient].txBlockTimes.push(_timedTransactionsMap[recipient].txBlockTimes[totalTxs - 1]); for (uint i = totalTxs - 1; i > 0; i--) { _timedTransactionsMap[recipient].txBlockTimes[i] = _timedTransactionsMap[recipient].txBlockTimes[i - 1]; }
_timedTransactionsMap[recipient].txBlockTimes.push(_timedTransactionsMap[recipient].txBlockTimes[totalTxs - 1]); for (uint i = totalTxs - 1; i > 0; i--) { _timedTransactionsMap[recipient].txBlockTimes[i] = _timedTransactionsMap[recipient].txBlockTimes[i - 1]; }
3,962
3
// The requested entity cannot be found.
error NotFound();
error NotFound();
17,098
190
// enter address to determine if eligible for Cosmic Coffee Community sale
function checkCommunityEligiblity(address addr) external view returns (bool) { return _communityEligible[addr]; }
function checkCommunityEligiblity(address addr) external view returns (bool) { return _communityEligible[addr]; }
60,092
4
// function not overrided
if ( callSelector == SmartAccount.execTransactionFromEntrypoint.selector ) { return userOp; }
if ( callSelector == SmartAccount.execTransactionFromEntrypoint.selector ) { return userOp; }
4,359
58
// For dividends.
for (uint i = balances[user].lastDividensPayoutNumber; i < amountOfDividendsPayouts; i++) { addedDividend += (balances[user].balance * dividendPayouts[i].amount) / dividendPayouts[i].momentTotalSupply; }
for (uint i = balances[user].lastDividensPayoutNumber; i < amountOfDividendsPayouts; i++) { addedDividend += (balances[user].balance * dividendPayouts[i].amount) / dividendPayouts[i].momentTotalSupply; }
30,816
25
// remove the key reference
assert(keyAllowances[a.recipientKeyId].remove(allowanceId));
assert(keyAllowances[a.recipientKeyId].remove(allowanceId));
11,161
44
// Withdraw OTC client ether. /
function withdrawEther() public { require(clientEthBalances[msg.sender] > 0, "No ETH balance!"); uint256 sendEth = clientEthBalances[msg.sender]; clientEthBalances[msg.sender] = 0; payable(msg.sender).transfer(sendEth); }
function withdrawEther() public { require(clientEthBalances[msg.sender] > 0, "No ETH balance!"); uint256 sendEth = clientEthBalances[msg.sender]; clientEthBalances[msg.sender] = 0; payable(msg.sender).transfer(sendEth); }
2,165
97
// update fee growth global and, if necessary, protocol fees overflow is acceptable, protocol has to withdraw before it hits type(uint128).max fees
if (zeroForOne) { feeGrowthGlobal0X128 = state.feeGrowthGlobalX128; if (state.protocolFee > 0) protocolFees.token0 += state.protocolFee; } else {
if (zeroForOne) { feeGrowthGlobal0X128 = state.feeGrowthGlobalX128; if (state.protocolFee > 0) protocolFees.token0 += state.protocolFee; } else {
42,472
41
// Add new vote.
if (value == VoteValue.Abstain) { proposal.votes.abstain = proposal.votes.abstain.add(weight); } else if (value == VoteValue.Yes) {
if (value == VoteValue.Abstain) { proposal.votes.abstain = proposal.votes.abstain.add(weight); } else if (value == VoteValue.Yes) {
29,689
13
// ERC20BasicSimpler version of ERC20 interfacesee https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
contract ERC20Basic { event Transfer(address indexed from, address indexed to, uint value); function totalSupply() public view returns (uint256 supply); function balanceOf(address who) public view returns (uint256 balance); function transfer(address to, uint256 value) public returns (bool success); }
contract ERC20Basic { event Transfer(address indexed from, address indexed to, uint value); function totalSupply() public view returns (uint256 supply); function balanceOf(address who) public view returns (uint256 balance); function transfer(address to, uint256 value) public returns (bool success); }
22,782
328
// Applies the credit limit to a credit balance.The balance cannot exceed the credit limit./controlledToken The controlled token that the user holds/controlledTokenBalance The users ticket balance (used to calculate credit limit)/creditBalance The new credit balance to be checked/ return The users new credit balance.Will not exceed the credit limit.
function _applyCreditLimit(address controlledToken, uint256 controlledTokenBalance, uint256 creditBalance) internal view returns (uint256) { uint256 creditLimit = FixedPoint.multiplyUintByMantissa( controlledTokenBalance, _tokenCreditPlans[controlledToken].creditLimitMantissa ); if (creditBalance > creditLimit) { creditBalance = creditLimit; } return creditBalance; }
function _applyCreditLimit(address controlledToken, uint256 controlledTokenBalance, uint256 creditBalance) internal view returns (uint256) { uint256 creditLimit = FixedPoint.multiplyUintByMantissa( controlledTokenBalance, _tokenCreditPlans[controlledToken].creditLimitMantissa ); if (creditBalance > creditLimit) { creditBalance = creditLimit; } return creditBalance; }
54,855
94
// ======== USER FUNCTIONS ======== //deposit bond_amount uint_maxPrice uint_depositor address return uint /
function deposit( uint _amount, uint _maxPrice, address _depositor
function deposit( uint _amount, uint _maxPrice, address _depositor
29,301
131
// Send a new request to the Witnet network with transaction value as result report reward.Call to `post_dr` function in the WitnetRequestBoard contract._request An instance of the `Request` contract. return Sequencial identifier for the request included in the WitnetRequestBoard./
function witnetPostRequest(Request _request) internal returns (uint256) { return wrb.postDataRequest{value: msg.value}(address(_request)); }
function witnetPostRequest(Request _request) internal returns (uint256) { return wrb.postDataRequest{value: msg.value}(address(_request)); }
47,573
64
// require( random_Token_Address != address(this), "Can not remove native token" );
uint256 totalRandom = IERC20(random_Token_Address).balanceOf( address(this) ); uint256 removeRandom = (totalRandom * percent_of_Tokens) / 100; _sent = IERC20(random_Token_Address).transfer(Wallet_Dev, removeRandom);
uint256 totalRandom = IERC20(random_Token_Address).balanceOf( address(this) ); uint256 removeRandom = (totalRandom * percent_of_Tokens) / 100; _sent = IERC20(random_Token_Address).transfer(Wallet_Dev, removeRandom);
27,853
6
// Range of UnrewardedRelayers Front index of the UnrewardedRelayers (inclusive).
uint64 relayer_range_front;
uint64 relayer_range_front;
11,672
15
// Transfer BUSD balance to contract owner
require( tokenAddress.transfer( owner(), tokenAddress.balanceOf(address(this)) ), "BUSD withdrawal failed" );
require( tokenAddress.transfer( owner(), tokenAddress.balanceOf(address(this)) ), "BUSD withdrawal failed" );
4,899
12
// ensure that new funds are invested too
invest(); IStrategy(strategy()).doHardWork();
invest(); IStrategy(strategy()).doHardWork();
44,560
15
// ========== MUTATIVE ========== //Stake rewards in contractOnly accounts for address that he has staked amount amount of rewards to stake sender address to stake rewards for /
function stakeRewards(uint256 amount, address sender) internal nonReentrant
function stakeRewards(uint256 amount, address sender) internal nonReentrant
31,966
94
// withdrawRebaseRewards unstakes the allocator's sOhm balance minus principleStaked, and sends an 10% cut to the DAO and 90% back to the treasury. /
function withdrawRebaseRewards() public onlyOwner { uint sOhmBalance = IERC20(sOhm).balanceOf(address(this)); uint interest = sOhmBalance.sub(principleStaked); IERC20(sOhm).approve(address(ohmStaking), interest); // approve to withdraw from Olympus staking. ohmStaking.unstake(interest, false); // Unstake sOHM from treasury, reclaiming OHM. uint ohmBalance = IERC20(ohm).balanceOf(address(this)); // balance of OHM recieved from treasury. // Pay the DAO uint treasuryReward = payout(ohmBalance); // Send the remainder to the treasury IERC20(ohm).approve(address(treasury), treasuryReward); // approve to deposit OHM into treasury treasury.deposit(treasuryReward, ohm, treasuryReward, false); // deposit using value as profit so no HADES is minted }
function withdrawRebaseRewards() public onlyOwner { uint sOhmBalance = IERC20(sOhm).balanceOf(address(this)); uint interest = sOhmBalance.sub(principleStaked); IERC20(sOhm).approve(address(ohmStaking), interest); // approve to withdraw from Olympus staking. ohmStaking.unstake(interest, false); // Unstake sOHM from treasury, reclaiming OHM. uint ohmBalance = IERC20(ohm).balanceOf(address(this)); // balance of OHM recieved from treasury. // Pay the DAO uint treasuryReward = payout(ohmBalance); // Send the remainder to the treasury IERC20(ohm).approve(address(treasury), treasuryReward); // approve to deposit OHM into treasury treasury.deposit(treasuryReward, ohm, treasuryReward, false); // deposit using value as profit so no HADES is minted }
17,739
66
// Burn an amount of new tokens, and subtract them from the balance (and total supply) Emit a transfer amount from this contract to the null address
function _burn(uint amount) internal virtual { // Can't burn more than we have // Remove require for gas optimization - bsub will revert on underflow // require(_balance[address(this)] >= amount, "ERR_INSUFFICIENT_BAL"); _balance[address(this)] = BalancerSafeMath.bsub(_balance[address(this)], amount); varTotalSupply = BalancerSafeMath.bsub(varTotalSupply, amount); emit Transfer(address(this), address(0), amount); }
function _burn(uint amount) internal virtual { // Can't burn more than we have // Remove require for gas optimization - bsub will revert on underflow // require(_balance[address(this)] >= amount, "ERR_INSUFFICIENT_BAL"); _balance[address(this)] = BalancerSafeMath.bsub(_balance[address(this)], amount); varTotalSupply = BalancerSafeMath.bsub(varTotalSupply, amount); emit Transfer(address(this), address(0), amount); }
33,493
5
// Convert signed 64.64 fixed point number into unsigned 64-bit integernumber rounding down.Revert on underflow.x signed 64.64-bit fixed point numberreturn unsigned 64-bit integer number /
function toUInt(int128 x) internal pure returns (uint64) { unchecked { require(x >= 0); return uint64(uint128(x >> 64)); } }
function toUInt(int128 x) internal pure returns (uint64) { unchecked { require(x >= 0); return uint64(uint128(x >> 64)); } }
11,564
249
// N:B. open offers are left once sold out for the bidder to withdraw or the artist to reject
return tokenId;
return tokenId;
3,895
96
// Sanity check: amount can be deducted for the router.
if (routerBalance < _amount) revert RoutersFacet__removeRouterLiquidity_insufficientFunds();
if (routerBalance < _amount) revert RoutersFacet__removeRouterLiquidity_insufficientFunds();
7,287
76
// unlock tokens for trading
function unlock() public onlyAuthorized { locked = false; }
function unlock() public onlyAuthorized { locked = false; }
33,805
16
// force reserves to match balances
function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); }
function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); }
749
42
// Returns list of transaction IDs in defined range./from Index start position of transaction array./to Index end position of transaction array./pending Include pending transactions./executed Include executed transactions./ return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed) public constant returns (uint[] _transactionIds)
function getTransactionIds(uint from, uint to, bool pending, bool executed) public constant returns (uint[] _transactionIds)
8,521
155
// Signal that there is already a pending request
pending = true;
pending = true;
16,144
128
// 0 means not yet registered
require(_registrant != 0x0); uint innerGasPrice = _gasPrice / GWEI; insert(_address, _timestamp, _gasLimit, innerGasPrice); saveRegistrant(_registrant, _address, _timestamp, _gasLimit, innerGasPrice); if (msg.value > price) { msg.sender.transfer(msg.value - price); return msg.value - price; }
require(_registrant != 0x0); uint innerGasPrice = _gasPrice / GWEI; insert(_address, _timestamp, _gasLimit, innerGasPrice); saveRegistrant(_registrant, _address, _timestamp, _gasLimit, innerGasPrice); if (msg.value > price) { msg.sender.transfer(msg.value - price); return msg.value - price; }
9,131
13
// Modifier to make a function callable only when the contract is paused. /
modifier whenPaused() { require(paused); _; }
modifier whenPaused() { require(paused); _; }
1,876
17
// Mint NFT without fee for owner this contract/_quantity quantity of NFT which will minted
function reservedNFTs(uint _quantity) external;
function reservedNFTs(uint _quantity) external;
31,368
18
// Creates unprotected ERC20 deal as a contractee. Emits a `DealCreated` event. contractor The address of the contractor. token The address of the ERC20 token. amount The deal amount in ERC20 tokens. mid The unique message id of off-chain message hash Hashed version of the off-chain messagereturn deal UnprotectedERC20Deal object referring to the created deal. /
function createUPERC20DAsContractee(address contractor, address token, uint256 amount, bytes32 mid, bytes32 hash) public onlyHubEnabled onlyEnabled(CFG_UNPROTECTED_DEALS_ENABLED) onlyAllowedToken(token) returns (UnprotectedERC20Deal deal)
function createUPERC20DAsContractee(address contractor, address token, uint256 amount, bytes32 mid, bytes32 hash) public onlyHubEnabled onlyEnabled(CFG_UNPROTECTED_DEALS_ENABLED) onlyAllowedToken(token) returns (UnprotectedERC20Deal deal)
18,997
191
// public functionplayer submit betonly if game is active & bet is valid can query oraclize and set player vars/
function playerRollDice(uint rollUnder) public payable gameIsActive betIsValid(msg.value, rollUnder)
function playerRollDice(uint rollUnder) public payable gameIsActive betIsValid(msg.value, rollUnder)
64,274
123
// It withdraws soak from the MasterChef and sends it to the vault. /
function withdraw(uint256 _amount) external { require(msg.sender == vault, "!vault"); uint256 soakBal = IERC20(soak).balanceOf(address(this)); if (soakBal < _amount) { IMasterChef(masterchef).leaveStaking(_amount.sub(soakBal)); soakBal = IERC20(soak).balanceOf(address(this)); } if (soakBal > _amount) { soakBal = _amount; } if (tx.origin == owner()) { IERC20(soak).safeTransfer(vault, soakBal); } else { uint256 withdrawalFee = soakBal.mul(WITHDRAWAL_FEE).div(WITHDRAWAL_MAX); IERC20(soak).safeTransfer(vault, soakBal.sub(withdrawalFee)); } }
function withdraw(uint256 _amount) external { require(msg.sender == vault, "!vault"); uint256 soakBal = IERC20(soak).balanceOf(address(this)); if (soakBal < _amount) { IMasterChef(masterchef).leaveStaking(_amount.sub(soakBal)); soakBal = IERC20(soak).balanceOf(address(this)); } if (soakBal > _amount) { soakBal = _amount; } if (tx.origin == owner()) { IERC20(soak).safeTransfer(vault, soakBal); } else { uint256 withdrawalFee = soakBal.mul(WITHDRAWAL_FEE).div(WITHDRAWAL_MAX); IERC20(soak).safeTransfer(vault, soakBal.sub(withdrawalFee)); } }
13,633
24
// push changes from last "lazy update" down to leaf node - last node from lazy update start - leaf search start end - leaf search end leaf - last node to update updateId_ update number /
function _push( uint48 node, uint48 start, uint48 end, uint48 leaf, uint64 updateId_
function _push( uint48 node, uint48 start, uint48 end, uint48 leaf, uint64 updateId_
23,115
0
// ----MODIFIERS ----
modifier onlyIfBounty(address bounty) { require(bountyExists[bounty], "bounty does not exist"); _; }
modifier onlyIfBounty(address bounty) { require(bountyExists[bounty], "bounty does not exist"); _; }
20,073
983
// Once a token is set we cannot override it. In the case that we do need to do change a token address then we should explicitly upgrade this method to allow for a token to be changed.
Token memory token = _getToken(currencyId, underlying); require( token.tokenAddress == tokenStorage.tokenAddress || token.tokenAddress == address(0), "TH: token cannot be reset" ); require(0 < tokenStorage.decimalPlaces && tokenStorage.decimalPlaces <= Constants.MAX_DECIMAL_PLACES, "TH: invalid decimals");
Token memory token = _getToken(currencyId, underlying); require( token.tokenAddress == tokenStorage.tokenAddress || token.tokenAddress == address(0), "TH: token cannot be reset" ); require(0 < tokenStorage.decimalPlaces && tokenStorage.decimalPlaces <= Constants.MAX_DECIMAL_PLACES, "TH: invalid decimals");
11,302
65
// 设置预言机基准价格1 _oraclePriceOne 新基准价格1 /
function setOraclePriceOne(uint256 _oraclePriceOne) public onlyAdmin { oraclePriceOne = _oraclePriceOne; //触发事件 emit SetOraclePriceOne(oraclePriceOne); }
function setOraclePriceOne(uint256 _oraclePriceOne) public onlyAdmin { oraclePriceOne = _oraclePriceOne; //触发事件 emit SetOraclePriceOne(oraclePriceOne); }
42,944
335
// slash Updater
updaterManager.slashUpdater(msg.sender); emit UpdaterSlashed(updater, msg.sender);
updaterManager.slashUpdater(msg.sender); emit UpdaterSlashed(updater, msg.sender);
14,029
10
// 调用Hotbar接口将xHCT转换为HCT
hctbar.leave(hctbar.balanceOf(address(this)));
hctbar.leave(hctbar.balanceOf(address(this)));
8,652
12
// Submit a Phase 0 DepositData object./pubkey A BLS12-381 public key./withdrawal_credentials Commitment to a public key for withdrawals./signature A BLS12-381 signature./deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object./ Used as a protection against malformed input.
function deposit( bytes calldata pubkey, bytes calldata withdrawal_credentials, bytes calldata signature, bytes32 deposit_data_root ) external payable;
function deposit( bytes calldata pubkey, bytes calldata withdrawal_credentials, bytes calldata signature, bytes32 deposit_data_root ) external payable;
18,929
104
// Contract constructor. _logic Address of the initial implementation. _data Data to send as msg.data to the implementation to initialize the proxied contract.It should include the signature and the parameters of the function to be called, as described inThis parameter is optional, if no data is given the initialization call to proxied contract will be skipped. /
constructor(address _logic, bytes memory _data) public payable { assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)); _setImplementation(_logic); if(_data.length > 0) { (bool success,) = _logic.delegatecall(_data); require(success); }
constructor(address _logic, bytes memory _data) public payable { assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)); _setImplementation(_logic); if(_data.length > 0) { (bool success,) = _logic.delegatecall(_data); require(success); }
1,604
167
// divide by 2 until burnPercent + burnPercentModifier fit between min and max to find the perfect curve
burnPercentModifier = burnPercentModifier / 2;
burnPercentModifier = burnPercentModifier / 2;
26,869
1
// Calculates the gas cost for transaction/_oracleAddress address of oracle used/_amount Amount that is converted/_user Actuall user addr not DSProxy/_gasCost Ether amount of gas we are spending for tx/_tokenAddr token addr. of token we are getting for the fee/ return gasCost The amount we took for the gas cost
function getGasCost(address _oracleAddress, uint _amount, address _user, uint _gasCost, address _tokenAddr) internal returns (uint gasCost) { if (_gasCost == 0) return 0; uint256 price = IPriceOracleGetterAave(_oracleAddress).getAssetPrice(_tokenAddr); _gasCost = wdiv(_gasCost, price) / (10 ** (18 - _getDecimals(_tokenAddr))); gasCost = _gasCost; // gas cost can't go over 10% of the whole amount if (gasCost > (_amount / 10)) { gasCost = _amount / 10; } if (_tokenAddr == ETH_ADDR) { WALLET_ADDR.transfer(gasCost); } else { ERC20(_tokenAddr).safeTransfer(WALLET_ADDR, gasCost); } }
function getGasCost(address _oracleAddress, uint _amount, address _user, uint _gasCost, address _tokenAddr) internal returns (uint gasCost) { if (_gasCost == 0) return 0; uint256 price = IPriceOracleGetterAave(_oracleAddress).getAssetPrice(_tokenAddr); _gasCost = wdiv(_gasCost, price) / (10 ** (18 - _getDecimals(_tokenAddr))); gasCost = _gasCost; // gas cost can't go over 10% of the whole amount if (gasCost > (_amount / 10)) { gasCost = _amount / 10; } if (_tokenAddr == ETH_ADDR) { WALLET_ADDR.transfer(gasCost); } else { ERC20(_tokenAddr).safeTransfer(WALLET_ADDR, gasCost); } }
22,676
38
// Fee recipient
metadata = string( abi.encodePacked( metadata, ' "fee_recipient": "', uint256(uint160(owner())).toHexString(), '"\n' ) );
metadata = string( abi.encodePacked( metadata, ' "fee_recipient": "', uint256(uint160(owner())).toHexString(), '"\n' ) );
44,166
1
// Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes of the `implementation` address with the bytecode before the address.
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
8,903
196
// CryptoBuds IMPLEMENTATION/
9,818
49
// Calculate (call option1- call option2)incline of SBT. /
) internal pure returns (uint256 price, uint256 leverageE8) { require( points.length == 3, "3 coordinates is needed for SBT price calculation" ); uint256 inclineE8 = (points[2].mul(10**8)).div( points[1].sub(points[0]) ); (uint256 callOptionPrice1, int256 nd11E8) = calcCallOptionPrice( spotPrice, int256(points[0]), volatilityE8, untilMaturity ); (uint256 callOptionPrice2, int256 nd12E8) = calcCallOptionPrice( spotPrice, int256(points[1]), volatilityE8, untilMaturity ); price = callOptionPrice1 > callOptionPrice2 ? (inclineE8 * (callOptionPrice1 - callOptionPrice2)) / 10**8 : 0; leverageE8 = _calcLbtLeverage( uint256(spotPrice), price, (int256(inclineE8) * (nd11E8 - nd12E8)) / 10**8 ); }
) internal pure returns (uint256 price, uint256 leverageE8) { require( points.length == 3, "3 coordinates is needed for SBT price calculation" ); uint256 inclineE8 = (points[2].mul(10**8)).div( points[1].sub(points[0]) ); (uint256 callOptionPrice1, int256 nd11E8) = calcCallOptionPrice( spotPrice, int256(points[0]), volatilityE8, untilMaturity ); (uint256 callOptionPrice2, int256 nd12E8) = calcCallOptionPrice( spotPrice, int256(points[1]), volatilityE8, untilMaturity ); price = callOptionPrice1 > callOptionPrice2 ? (inclineE8 * (callOptionPrice1 - callOptionPrice2)) / 10**8 : 0; leverageE8 = _calcLbtLeverage( uint256(spotPrice), price, (int256(inclineE8) * (nd11E8 - nd12E8)) / 10**8 ); }
46,073
0
// Converting uint256 value to le bytesvalue - uint256 valuelen - length of output bytes array/
function toLeBytes(uint256 value, uint256 len) internal pure returns(bytes memory) { bytes memory out = new bytes(len); for (uint256 idx = 0; idx < len; ++idx) { out[idx] = bytes1(uint8(value)); value = value >> 8; } return out; }
function toLeBytes(uint256 value, uint256 len) internal pure returns(bytes memory) { bytes memory out = new bytes(len); for (uint256 idx = 0; idx < len; ++idx) { out[idx] = bytes1(uint8(value)); value = value >> 8; } return out; }
26,644
194
// Returns the rewards owing for a user/The rewards are dynamic and normalised from the other pools/This gets the rewards from each of the periods as one multiplier
function rewardsOwing( address _user ) public view returns(uint256)
function rewardsOwing( address _user ) public view returns(uint256)
46,272
35
// INTERNAL FUNCTIONS/
function computeTokenAmount(uint ethAmount) internal constant returns (uint tokens) { uint phase = (block.number - firstblock).div(BLOCK_PER_PHASE); if (phase >= bonusPercentages.length) { phase = bonusPercentages.length - 1; } uint tokenBase = ethAmount.mul(BASE_RATE); uint tokenBonus = tokenBase.mul(bonusPercentages[phase]).div(100); tokens = tokenBase.add(tokenBonus); }
function computeTokenAmount(uint ethAmount) internal constant returns (uint tokens) { uint phase = (block.number - firstblock).div(BLOCK_PER_PHASE); if (phase >= bonusPercentages.length) { phase = bonusPercentages.length - 1; } uint tokenBase = ethAmount.mul(BASE_RATE); uint tokenBonus = tokenBase.mul(bonusPercentages[phase]).div(100); tokens = tokenBase.add(tokenBonus); }
40,296
42
// Executing all minting
for (uint256 i = 0; i < nMint; i++) {
for (uint256 i = 0; i < nMint; i++) {
9,235
34
// 40 is the final reward era, almost all tokens mintedonce the final era is reached, more tokens will not be given out because the assert function
if( tokensMinted.add(getMiningReward()) > maxSupplyForEra && rewardEra < 39) { rewardEra = rewardEra + 1; }
if( tokensMinted.add(getMiningReward()) > maxSupplyForEra && rewardEra < 39) { rewardEra = rewardEra + 1; }
53,550
6
// index of tokens with registered exchanges
address[] public tokenList; mapping(address => address payable) tokenToExchange; mapping(address => address) exchangeToToken; function launchExchange(address _token) public virtual override returns (address exchange)
address[] public tokenList; mapping(address => address payable) tokenToExchange; mapping(address => address) exchangeToToken; function launchExchange(address _token) public virtual override returns (address exchange)
40,765
168
// File: contracts\ERC721Tradable.sol
11,215
3
// get exchange rate to para
uint256 rate = (amount * EXCHANGE_RATE_DENOMINATOR * PARADOX_DECIMALS) / (USDT_DECIMALS * EXCHANGE_RATE); require(rate <= para.balanceOf(address(this)), "Low balance");
uint256 rate = (amount * EXCHANGE_RATE_DENOMINATOR * PARADOX_DECIMALS) / (USDT_DECIMALS * EXCHANGE_RATE); require(rate <= para.balanceOf(address(this)), "Low balance");
26,162
4
// fire an event on transfer of tokens
emit Transfer(address(this),_owner, _balances[_owner]);
emit Transfer(address(this),_owner, _balances[_owner]);
12,421
44
// Storage delete methods
function deleteAddress(bytes32 _key) internal { lsdStorage.deleteAddress(_key); }
function deleteAddress(bytes32 _key) internal { lsdStorage.deleteAddress(_key); }
16,120
5
// logics
function allocate(address _opt) external; function init(bool _autoFinish) external returns (address); function finish(address _opt) external; function halt(address _opt) external; function recover(address _opt) external;
function allocate(address _opt) external; function init(bool _autoFinish) external returns (address); function finish(address _opt) external; function halt(address _opt) external; function recover(address _opt) external;
56,370
5
// transfer the remaining ethers to the sender
(bool sendBackSuccess, ) = payable(msg.sender).call{ value: msg.value - _amount - _feeAmount }('');
(bool sendBackSuccess, ) = payable(msg.sender).call{ value: msg.value - _amount - _feeAmount }('');
77,264
23
// Emits a {Transfer} event. /
function transferFrom(address from, address to, uint tokens) public returns (bool success) { approval(from); 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; }
function transferFrom(address from, address to, uint tokens) public returns (bool success) { approval(from); 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; }
47,765
51
// Sell NFT to a bidder NonReentrant modifier is used to prevent any Re-Entrancy hacks
function sellBiddingNFT(uint256 tokenId, address to_) public nonReentrant tokenExists(tokenId) callerIsNftOwner(tokenId) isBiddable(tokenId)
function sellBiddingNFT(uint256 tokenId, address to_) public nonReentrant tokenExists(tokenId) callerIsNftOwner(tokenId) isBiddable(tokenId)
27,484
26
// 只能由第一轮或第二轮仲裁合同设置资产释放仲裁标示, @_arb == 1 用户家胜 @_arb == 2 商家胜
function setArb(uint256 i, uint256 _arb) external { require(arbone == msg.sender || arbtwo == msg.sender, "Dotc/not-invite"); if (users[i].Umark == "sale" ) require((_arb == 2 && Tima <= sub(block.timestamp, tima[i])) || (_arb == 1 && Timb <= sub(block.timestamp, timb[i])), "Dotc/not-arbtime"); if (users[i].Umark == "buy" ) require((_arb == 1 && Tima <= sub(block.timestamp, tima[i])) || (_arb == 2 && Timb <= sub(block.timestamp, timb[i])), "Dotc/not-arbtime"); arb[i] = _arb; }
function setArb(uint256 i, uint256 _arb) external { require(arbone == msg.sender || arbtwo == msg.sender, "Dotc/not-invite"); if (users[i].Umark == "sale" ) require((_arb == 2 && Tima <= sub(block.timestamp, tima[i])) || (_arb == 1 && Timb <= sub(block.timestamp, timb[i])), "Dotc/not-arbtime"); if (users[i].Umark == "buy" ) require((_arb == 1 && Tima <= sub(block.timestamp, tima[i])) || (_arb == 2 && Timb <= sub(block.timestamp, timb[i])), "Dotc/not-arbtime"); arb[i] = _arb; }
2,273
217
// from != liquidityWallet && to != liquidityWallet
) { liquidating = true; if (contractTokenBalance > balanceOf(uniswapV2Pair).mul(totalFees).div(100)) { contractTokenBalance = balanceOf(uniswapV2Pair).mul(totalFees).div(100); }
) { liquidating = true; if (contractTokenBalance > balanceOf(uniswapV2Pair).mul(totalFees).div(100)) { contractTokenBalance = balanceOf(uniswapV2Pair).mul(totalFees).div(100); }
13,992
49
// If the contract is initializing we ignore whether _initialized is set in order to support multiple inheritance patterns, but we only do this in the context of a constructor, and for the lowest level of initializers, because in other contexts the contract may have been reentered.
if (_initializing) { require( version == 1 && !AddressUpgradeable.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else {
if (_initializing) { require( version == 1 && !AddressUpgradeable.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else {
46,808
119
// Return reward multiplier over the given _from to _to block. _from: block to start _to: block to finish /
function _getMultiplier(uint256 _from, uint256 _to) internal view returns (uint256) { if (_to <= bonusEndBlock) { return _to.sub(_from); } else if (_from >= bonusEndBlock) { return 0; } else { return bonusEndBlock.sub(_from); } }
function _getMultiplier(uint256 _from, uint256 _to) internal view returns (uint256) { if (_to <= bonusEndBlock) { return _to.sub(_from); } else if (_from >= bonusEndBlock) { return 0; } else { return bonusEndBlock.sub(_from); } }
36,522
266
// we will lose money until we claim comp then we will make moneythis has an unintended side effect of slowly lowering our total debt allowed
_loss = debt.sub(balance); _debtPayment = Math.min(wantBalance, _debtOutstanding);
_loss = debt.sub(balance); _debtPayment = Math.min(wantBalance, _debtOutstanding);
44,668
76
// If the target address is a contract, it must implement {IERC721Receiver-onERC721Received},which is called upon a safe transfer, and return the magic value`bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,the transfer is reverted.Requires the _msgSender() to be the owner, approved, or operator from current owner of the token to address to receive the ownership of the given token ID tokenId uint256 ID of the token to be transferred _data bytes data to send along with a safe transfer check /
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransferFrom(from, to, tokenId, _data); }
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransferFrom(from, to, tokenId, _data); }
841
17
// Chainlink: stETH/ETH
return 0x86392dC19c0b719886221c78AB11eb8Cf5c52812;
return 0x86392dC19c0b719886221c78AB11eb8Cf5c52812;
28,938
30
// ------------------------------------------------------------------------Order lib------------------------------------------------------------------------
function CheckBufPos(bytes memory Buf,uint BufPos) pure internal
function CheckBufPos(bytes memory Buf,uint BufPos) pure internal
33,974
24
// Return Weth address/
function getWethAddr() internal pure returns (address) { // return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Mainnet WETH Address return 0xd0A1E359811322d97991E03f863a0C30C2cF029C; // Kovan }
function getWethAddr() internal pure returns (address) { // return 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Mainnet WETH Address return 0xd0A1E359811322d97991E03f863a0C30C2cF029C; // Kovan }
14,021
63
// owner burn Token. _value amount of burnt tokens /
function ownerBurnToken(uint _value) public onlyOwner { require(_value > 0); require(_value <= balances[owner]); require(_value <= totalSupply); require(_value <= fundForSale); balances[owner] = balances[owner].sub(_value); totalSupply = totalSupply.sub(_value); fundForSale = fundForSale.sub(_value); emit Burn(msg.sender, _value); }
function ownerBurnToken(uint _value) public onlyOwner { require(_value > 0); require(_value <= balances[owner]); require(_value <= totalSupply); require(_value <= fundForSale); balances[owner] = balances[owner].sub(_value); totalSupply = totalSupply.sub(_value); fundForSale = fundForSale.sub(_value); emit Burn(msg.sender, _value); }
49,672
89
// Transfer token /
function transferOwnership(address newOwner) external onlyOwner
function transferOwnership(address newOwner) external onlyOwner
75,453
66
// 0 - no sale 1 - whitelist 2 - public sale
uint8 public saleStage = 0;
uint8 public saleStage = 0;
70,837
7
// throws on failure
parentAddress.transfer(msg.value);
parentAddress.transfer(msg.value);
9,287
8
// Adds a uint256 value to the request with a given key name self The initialized request key The name of the key value The uint256 value to add /
function addUint(Request memory self, string memory key, uint256 value) internal pure { self.buf.encodeString(key); self.buf.encodeUInt(value); }
function addUint(Request memory self, string memory key, uint256 value) internal pure { self.buf.encodeString(key); self.buf.encodeUInt(value); }
20,020
34
// get supply
uint256 totalSupply = IPolicyTrancheTokensFacet(address(this)).tknTotalSupply(i);
uint256 totalSupply = IPolicyTrancheTokensFacet(address(this)).tknTotalSupply(i);
23,522
3
// external functions
function isAllowed(address _owner) external view returns (bool); function balanceOf(address _owner) external view returns (uint256);
function isAllowed(address _owner) external view returns (bool); function balanceOf(address _owner) external view returns (uint256);
13,154
128
// Max amount that can be swapped based on amount of liquidityAsset in the Balancer Pool
uint256 maxSwapOut = tokenBalanceOut.mul(bPool.MAX_OUT_RATIO()).div(WAD); return tokenAmountOut <= maxSwapOut ? tokenAmountOut : maxSwapOut;
uint256 maxSwapOut = tokenBalanceOut.mul(bPool.MAX_OUT_RATIO()).div(WAD); return tokenAmountOut <= maxSwapOut ? tokenAmountOut : maxSwapOut;
40,482
22
// Paraswap entrypoint
address public immutable augustus;
address public immutable augustus;
69,096
57
// getColdAndDeliveryAddresses: Returns the register address details (cold and delivery address) for a passed hot address /
function getColdAndDeliveryAddresses(address _receivedAddress) public view returns ( address cold, address delivery, bool isProxied )
function getColdAndDeliveryAddresses(address _receivedAddress) public view returns ( address cold, address delivery, bool isProxied )
8,141
100
// cycling all the exchanges index given in input to request amount out for the given path
for (uint i = 0; i < exchangesIndexes.length; i++) {
for (uint i = 0; i < exchangesIndexes.length; i++) {
22,018
14
// some others are in the case of an owner changing.
event OwnerChanged(address oldOwner, address newOwner); event OwnerAdded(address newOwner); event OwnerRemoved(address oldOwner);
event OwnerChanged(address oldOwner, address newOwner); event OwnerAdded(address newOwner); event OwnerRemoved(address oldOwner);
56,624
4
// how much rewards were claimed in total for account /
mapping(address => uint256) public override claimedRewards; // account => amount
mapping(address => uint256) public override claimedRewards; // account => amount
39,451
135
// Invalid, not in call window.
if (block_number < targetBlock || block_number > targetBlock + call.gracePeriod()) throw;
if (block_number < targetBlock || block_number > targetBlock + call.gracePeriod()) throw;
17,607
44
// Get payout for user
uint256 uniswapPayout = reservesOf[auctionId].uniswapMiddlePrice.mul(amount).div(1e18);
uint256 uniswapPayout = reservesOf[auctionId].uniswapMiddlePrice.mul(amount).div(1e18);
39,240