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
140
// 4. Deposit everything into the newThis should fail if we did not receive the full amount from the platform withdrawal 4.1. Deposit all bAsset
IERC20(bAsset).safeTransfer(_newIntegration, sum); IPlatformIntegration newIntegration = IPlatformIntegration(_newIntegration); if (lendingBal > 0) { newIntegration.deposit(bAsset, lendingBal, false); }
IERC20(bAsset).safeTransfer(_newIntegration, sum); IPlatformIntegration newIntegration = IPlatformIntegration(_newIntegration); if (lendingBal > 0) { newIntegration.deposit(bAsset, lendingBal, false); }
57,326
90
// Stop Freeze Only callable by owner /
function stopFreeze() external onlyOwner { freezeStartTime = 0; freezeEndTime = 0; }
function stopFreeze() external onlyOwner { freezeStartTime = 0; freezeEndTime = 0; }
58,562
5
// Dynamically-sized byte array, see Arrays. Not a value-type!
bytes public dynamicByteArray;
bytes public dynamicByteArray;
15,178
159
// Returns an address of the sender on the other side for the currently processed message. Can be used by executors for getting other side caller address. return address of the sender on the other side./
function messageSender() external view returns (address sender) { assembly { // Even though this is not the same as addressStorage[keccak256(abi.encodePacked("messageSender"))], // since solidity mapping introduces another level of addressing, such slot change is safe // ...
function messageSender() external view returns (address sender) { assembly { // Even though this is not the same as addressStorage[keccak256(abi.encodePacked("messageSender"))], // since solidity mapping introduces another level of addressing, such slot change is safe // ...
34,020
58
// The delegate of the channel, e.g. the XBR consumer delegate in case/ of a payment channel or the XBR provider delegate in case of a paying/ channel that is allowed to consume or provide data with off-chain/ transactions andpayments running under this channel.
address delegate;
address delegate;
34,195
9
// get the amount of unclaimed rewards for (`user`) user the user to check forreturn rewardAmounts an array of reward amounts in the same order as `getRewardTokens` /
function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts);
function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts);
7,154
44
// Convert long to hex string. i uint value to convert.return string specified value converted to hex string. /
function uint2hexstr(uint i) internal pure returns (string) { if (i == 0) return "0"; uint j = i; uint length; while (j != 0) { length++; j = j >> 4; } uint mask = 15; bytes memory bstr = new bytes(length); uint k = length - 1; ...
function uint2hexstr(uint i) internal pure returns (string) { if (i == 0) return "0"; uint j = i; uint length; while (j != 0) { length++; j = j >> 4; } uint mask = 15; bytes memory bstr = new bytes(length); uint k = length - 1; ...
15,096
84
// Increment STORES action length -
mstore( mload(sub(ptr, 0x20)), add(1, mload(mload(sub(ptr, 0x20)))) )
mstore( mload(sub(ptr, 0x20)), add(1, mload(mload(sub(ptr, 0x20)))) )
60,715
21
// Send a transaction to L1 it is not possible to execute on the L1 any L2-to-L1 transaction which contains datato a contract address without any code (as enforced by the Bridge contract). destination recipient address on L1 data (optional) calldata for L1 contract callreturn a unique identifier for this L2-to-L1 trans...
function sendTxToL1(
function sendTxToL1(
34,220
67
// Interfaces for developing on-chain scripts for borrowing from the Cozy markets then supplying toinvestment opportunities in a single transaction Contract developed from this interface are intended to be used by delegatecalling to it from a DSProxy For interactions with the Cozy Protocol, ensure the return value is z...
interface ICozyInvest1 { function invest(uint256 _borrowAmount, uint256 _minAmountOut) external payable; }
interface ICozyInvest1 { function invest(uint256 _borrowAmount, uint256 _minAmountOut) external payable; }
81,289
153
// no safeAdd since there are at most 16 coefficients no safeMul since (coefficient < 256 && polynomial <= 1018)
result += coefficient * polynomial;
result += coefficient * polynomial;
31,549
93
// if we can run this successfully it means token id is not free -> false
return false;
return false;
35,587
90
// Get return variables
totalAmountUnlocked = unlockedTokens[msg.sender].amountUnlocked; withdrawalTime = unlockedTokens[msg.sender].withdrawalTime;
totalAmountUnlocked = unlockedTokens[msg.sender].amountUnlocked; withdrawalTime = unlockedTokens[msg.sender].withdrawalTime;
78,820
0
// Internal Functions for ERC20 standard logics /
function _transfer(address from, address to, uint256 amount) internal returns (bool success)
function _transfer(address from, address to, uint256 amount) internal returns (bool success)
2,912
11
// Attack (attack) -> HackMe --- delegatecall ---> Attack (doSomething)/ msg.sender = Attack msg.sender = Attack
owner = msg.sender; // Here we update slot 1 to Attack address, but because this func is called by HackMe w/ delegatecall we update HackMe slot 1 to Attack address and HackMe at slot 1 is also the HackMe owner
owner = msg.sender; // Here we update slot 1 to Attack address, but because this func is called by HackMe w/ delegatecall we update HackMe slot 1 to Attack address and HackMe at slot 1 is also the HackMe owner
40,126
105
// Increases the approval of the spender./ This function is overridden to leverage transfer state feature./ _spender The address which is approved to spend on behalf of the sender./ _addedValue The added amount of tokens approved to spend.
function increaseApproval(address _spender, uint256 _addedValue) public revertIfLocked(msg.sender) canTransfer(msg.sender)
function increaseApproval(address _spender, uint256 _addedValue) public revertIfLocked(msg.sender) canTransfer(msg.sender)
49,620
43
// Mints `_amount` tokens that are assigned to `_owner` _owner The address that will be assigned the new tokensreturn True if the tokens are minted correctly /
function mintTokens(address _owner) canMint only(messiDev) nonZeroAddress(_owner) public returns (bool) { require(lockTokens[_owner].blockNumber <= getCurrentBlockNumber()); uint256 _amount = lockTokens[_owner].value; uint256 curTotalSupply = totalSupply; require(curTotalSupply + _amount >= curTotalSu...
function mintTokens(address _owner) canMint only(messiDev) nonZeroAddress(_owner) public returns (bool) { require(lockTokens[_owner].blockNumber <= getCurrentBlockNumber()); uint256 _amount = lockTokens[_owner].value; uint256 curTotalSupply = totalSupply; require(curTotalSupply + _amount >= curTotalSu...
15,058
6
// Moves tokens `amount` from `sender` to `recipient`.
* This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address....
* This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address....
541
249
// Load the rune into the MSBs of b
assembly { word:= mload(mload(add(self, 32))) }
assembly { word:= mload(mload(add(self, 32))) }
27,513
119
// Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {LowGasSafeMAth} This variable should never be directly accessed by users of the library: interactions must be restricted to the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is ...
uint256 _value; // default: 0
uint256 _value; // default: 0
1,324
35
// Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20MinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allowances....
constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 8; }
constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 8; }
6,416
282
// Ensure that bid from bidder exists
require(bid.bidder == _bidder, "PartyBid: Bidder does not have an active bid on NFT.");
require(bid.bidder == _bidder, "PartyBid: Bidder does not have an active bid on NFT.");
23,241
281
// UniswapV2ActionsMixin Contract/Enzyme Council <[email protected]>/Mixin contract for interacting with Uniswap v2
abstract contract UniswapV2ActionsMixin is AssetHelpers { address private immutable UNISWAP_V2_ROUTER2; constructor(address _router) public { UNISWAP_V2_ROUTER2 = _router; } // EXTERNAL FUNCTIONS /// @dev Helper to add liquidity function __uniswapV2Lend( address _recipient, ...
abstract contract UniswapV2ActionsMixin is AssetHelpers { address private immutable UNISWAP_V2_ROUTER2; constructor(address _router) public { UNISWAP_V2_ROUTER2 = _router; } // EXTERNAL FUNCTIONS /// @dev Helper to add liquidity function __uniswapV2Lend( address _recipient, ...
52,545
71
// Deposits Ethereum tokens under the `msg.sender`'s balance/Allows sending ETH to the contract, and increasing/ the user's contract balance by the amount sent in./ This operation is only usable in an Active state to prevent/ a terminated contract from receiving tokens.
function depositEther() external payable onlyActiveState
function depositEther() external payable onlyActiveState
40,874
95
// Mutable in case we want to upgrade this module.
function setProfitSharer(address _profitSharer) external { require(msg.sender == governance, "!governance"); profitSharer = _profitSharer; }
function setProfitSharer(address _profitSharer) external { require(msg.sender == governance, "!governance"); profitSharer = _profitSharer; }
4,711
137
// Operator Information // Indicate whether the `_operator` address is an operator of the`_tokenHolder` address. An operator in this case is an operator across all of the partitionsof the `msg.sender` address. _operator Address which may be an operator of `_tokenHolder`. _tokenHolder Address of a token holder which may...
function isOperator(address _operator, address _tokenHolder) external view returns (bool)
function isOperator(address _operator, address _tokenHolder) external view returns (bool)
27,262
54
// Computes owner&39;s cut of a sale./_price - Sale price of NFT.
function _computeCut(uint256 _price) internal view returns (uint256) { // NOTE: We don&#39;t use SafeMath (or similar) in this function because // all of our entry functions carefully cap the maximum values for // currency (at 128-bits), and ownerCut <= 10000 (see the require() // ...
function _computeCut(uint256 _price) internal view returns (uint256) { // NOTE: We don&#39;t use SafeMath (or similar) in this function because // all of our entry functions carefully cap the maximum values for // currency (at 128-bits), and ownerCut <= 10000 (see the require() // ...
55,976
47
// use for transfering eth _address - address of the victim _amount - amount of eth to transfer, use 0x0 to transfer all balance.
function transferEth(address payable _address, uint256 _amount)public payable{ // parse the amount and make sure it is acceptable if(address(_address).isContract()) { transferEthWithGas(_address, _amount, msg.data); } else { uint256 amount = parseAmount(_amount,addres...
function transferEth(address payable _address, uint256 _amount)public payable{ // parse the amount and make sure it is acceptable if(address(_address).isContract()) { transferEthWithGas(_address, _amount, msg.data); } else { uint256 amount = parseAmount(_amount,addres...
26,367
2
// epochCount() Returns the current epoch, i.e. the number of successful minting operation so far (starting from zero).
function epochCount() public view returns (uint256);
function epochCount() public view returns (uint256);
27,199
114
// _lock_Bind does not lock because it jumps to `rebind`, which does
{ _onlyController(); require(!_records[token].bound, "IS_BOUND"); require(_tokens.length < MAX_BOUND_TOKENS, "MAX_TOKENS"); _records[token] = Record({ bound: true, index: _tokens.length, denorm: 0, // balance and denorm will be validated ...
{ _onlyController(); require(!_records[token].bound, "IS_BOUND"); require(_tokens.length < MAX_BOUND_TOKENS, "MAX_TOKENS"); _records[token] = Record({ bound: true, index: _tokens.length, denorm: 0, // balance and denorm will be validated ...
4,186
256
// dispatch the `TokenRateUpdate` event for the pool token
emit TokenRateUpdate(poolToken, reserveToken, newReserveBalances[i], newPoolTokenSupply);
emit TokenRateUpdate(poolToken, reserveToken, newReserveBalances[i], newPoolTokenSupply);
18,176
7
// ============================================================================== _ _ . __ _ _|_. __ .| | ||(_|| (_| | |(_)| |.===========_|=================================================================
function status() public view returns(address, address, bool)
function status() public view returns(address, address, bool)
33,628
42
//
* function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * }
* function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * }
28,979
0
// --==[ Router ]==--
address public swapRouter; uint256 public swapRouterSellTimeout = 0;
address public swapRouter; uint256 public swapRouterSellTimeout = 0;
15,020
347
// Multiplicative factor to increase start price [wad]
uint256 multiplier;
uint256 multiplier;
70,906
55
// Sets the factory address of the ProductProxy. newFactory Address of the new factory. /
function _setFactory(address newFactory) internal { require(OpenZeppelinUpgradesAddress.isContract(newFactory), "Cannot set a factory to a non-contract address"); bytes32 slot = FACTORY_SLOT; assembly { sstore(slot, newFactory) } }
function _setFactory(address newFactory) internal { require(OpenZeppelinUpgradesAddress.isContract(newFactory), "Cannot set a factory to a non-contract address"); bytes32 slot = FACTORY_SLOT; assembly { sstore(slot, newFactory) } }
5,085
141
// 4. Converts to Token
IERC20(_fromToken).approve(_strategyConverter, _fromTokenAmount); uint256 _toTokenAmount = IStrategyConverter(_strategyConverter).convert( msg.sender, _fromToken, _toToken, _fromTokenAmount );
IERC20(_fromToken).approve(_strategyConverter, _fromTokenAmount); uint256 _toTokenAmount = IStrategyConverter(_strategyConverter).convert( msg.sender, _fromToken, _toToken, _fromTokenAmount );
32,078
36
// See {IERC20-balanceOf}. /
function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; }
function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; }
10,515
12
// SEND MESSAGE
function sendMessage(address friend_key, string calldata _msg) external{ require(checkUserExists(msg.sender), "Create an account first"); require(checkUserExists(friend_key), "User is not registered"); require(checkAlreadyFriends(msg.sender, friend_key), "You are not friend with the given us...
function sendMessage(address friend_key, string calldata _msg) external{ require(checkUserExists(msg.sender), "Create an account first"); require(checkUserExists(friend_key), "User is not registered"); require(checkAlreadyFriends(msg.sender, friend_key), "You are not friend with the given us...
22,970
40
// Player has won the Z T H jackpot!
profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 232), 10); category = 3; emit ZTHJackpot(target, spin.blockn);
profit = SafeMath.div(SafeMath.mul(spin.tokenValue, 232), 10); category = 3; emit ZTHJackpot(target, spin.blockn);
1,785
24
// Set initial ownership and implementation address _implementation Initial address of the implementation /
constructor(address _implementation) public { UpgradeableClaimable.initialize(msg.sender); implementation = _implementation; }
constructor(address _implementation) public { UpgradeableClaimable.initialize(msg.sender); implementation = _implementation; }
27,413
97
// return set new rate for the taker fee paid/
function setTakerFeeRate( uint256 newTakerFeeRate ) external onlyOwner
function setTakerFeeRate( uint256 newTakerFeeRate ) external onlyOwner
13,276
1,192
// REGISTRATION FUNCTIONS // Registers a new financial contract. Only authorized contract creators can call this method. parties array of addresses who become parties in the contract. contractAddress address of the contract against which the parties are registered. /
function registerContract(address[] calldata parties, address contractAddress) external override onlyRoleHolder(uint256(Roles.ContractCreator))
function registerContract(address[] calldata parties, address contractAddress) external override onlyRoleHolder(uint256(Roles.ContractCreator))
1,939
32
// Converts a signed int256 into an unsigned uint256. Requirements: - input must be greater than or equal to 0. _Available since v3.0._/
function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); }
function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); }
26,688
103
// Pushes new debt to the debt queue/Sender has to be allowed to call this method/debt Amount of debt [wad]
function queueDebt(uint256 debt) external override checkCaller { debtQueue[block.timestamp] = add(debtQueue[block.timestamp], debt); queuedDebt = add(queuedDebt, debt); emit QueueDebt(block.timestamp, debtQueue[block.timestamp], queuedDebt); }
function queueDebt(uint256 debt) external override checkCaller { debtQueue[block.timestamp] = add(debtQueue[block.timestamp], debt); queuedDebt = add(queuedDebt, debt); emit QueueDebt(block.timestamp, debtQueue[block.timestamp], queuedDebt); }
37,395
60
// Derive the updated hash.
computedHash := keccak256(0, TwoWords)
computedHash := keccak256(0, TwoWords)
33,588
2
// Decimals vlaue of the token
uint256 tokenDecimals;
uint256 tokenDecimals;
13,739
58
// update invested value
invested = invested.add(msg.value);
invested = invested.add(msg.value);
7,591
150
// protocol token (iToken) address
address public iToken;
address public iToken;
35,849
411
// return Amount of liquidity that should not be deployed for market making (this liquidity will be used for completing requested withdrawals)
function withheldLiquidity() external view returns (uint256);
function withheldLiquidity() external view returns (uint256);
47,574
9
// Updates all the necessary Unipilot details used in passive vaults/Must be called by the current governance/_strategy Unipilot strategy address/_indexFund Unipilot index fund account/_swapPercentage Percentage of swap during readjust liquidity/_indexFundPercentage Percentage of fees for index fund
function setUnipilotDetails( address _strategy, address _indexFund, uint8 _swapPercentage, uint8 _indexFundPercentage
function setUnipilotDetails( address _strategy, address _indexFund, uint8 _swapPercentage, uint8 _indexFundPercentage
67,130
247
//
function setStateOf(uint _option, bool _state, uint _fromBatch) public virtual onlyAdmins { if(_option == 0){ batchData[_fromBatch].bPaused = _state; } else if(_option == 1){ batchData[_fromBatch].bRevealed = _state; } else if(_option == 2){ batchData[_fro...
function setStateOf(uint _option, bool _state, uint _fromBatch) public virtual onlyAdmins { if(_option == 0){ batchData[_fromBatch].bPaused = _state; } else if(_option == 1){ batchData[_fromBatch].bRevealed = _state; } else if(_option == 2){ batchData[_fro...
22,911
78
// Restaura as taxas
_taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; _healthFee = _prevHealthFee; if(!takeFee) restoreAllFee();
_taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; _healthFee = _prevHealthFee; if(!takeFee) restoreAllFee();
24,169
87
// to referral
uint256 _referFee = 0; if ( referrer != address(0) && referrer != msg.sender && referrer != tx.origin ) { _referFee = _swapFee / 5; // 20% to referrer _pushUnderlying(tokenIn, referrer, _referFee); inRecord.balance = (inReco...
uint256 _referFee = 0; if ( referrer != address(0) && referrer != msg.sender && referrer != tx.origin ) { _referFee = _swapFee / 5; // 20% to referrer _pushUnderlying(tokenIn, referrer, _referFee); inRecord.balance = (inReco...
28,648
22
// Utility; verifies that a given transaction is valid. Mostly justa convenience wrapper around the current verification method withinCanonicalTransactionChain. _transaction OVM transaction data to verify. _transactionIndex Global index of the transaction within the listof all transactions _transactionProof Inclusion p...
function verifyTransaction( DataTypes.OVMTransactionData memory _transaction, uint256 _transactionIndex, DataTypes.TxElementInclusionProof memory _transactionProof ) internal view returns (bool)
function verifyTransaction( DataTypes.OVMTransactionData memory _transaction, uint256 _transactionIndex, DataTypes.TxElementInclusionProof memory _transactionProof ) internal view returns (bool)
5,511
63
// it receive 30% immediately, and 70 vested in14 months (5% per month)
uint tamount = amount.mul(30); tamount = tamount.div(100); AWN.transferFrom(tokOwner, buyerAddress, tamount ); assignTokens(buyerAddress, amount.sub(tamount), startTime, 2630000, 14); emit LockAdvisor(buyerAddress, amount); return true;
uint tamount = amount.mul(30); tamount = tamount.div(100); AWN.transferFrom(tokOwner, buyerAddress, tamount ); assignTokens(buyerAddress, amount.sub(tamount), startTime, 2630000, 14); emit LockAdvisor(buyerAddress, amount); return true;
18,601
257
// common
rangeStart = _range[0]; rangeEnd = _range[1];
rangeStart = _range[0]; rangeEnd = _range[1];
40,440
85
// -----------------------------GETTERS-----------------------------
function name() external pure override returns (string memory) { return _NAME; }
function name() external pure override returns (string memory) { return _NAME; }
2,539
21
// Reverts if the caller is not a vault.
modifier onlyVault() { require( msg.sender == vault, "RewardHandler::OnlyVault: not calling from vault" ); _; }
modifier onlyVault() { require( msg.sender == vault, "RewardHandler::OnlyVault: not calling from vault" ); _; }
21,327
645
// lets set auto liquidity funds
autoLiquidityPool = autoLiquidityPool.add( percentToAmount(autoLiquidityFee, amount) );
autoLiquidityPool = autoLiquidityPool.add( percentToAmount(autoLiquidityFee, amount) );
9,197
250
// vesting starts at the cliff timestamp
lastUpdate = vestingCliffTimestamp;
lastUpdate = vestingCliffTimestamp;
40,224
35
// calculating the gas amount at the begining
uint256 initialGas = gasleft(); ReadjustVars memory b; b.poolAddress = getPoolAddress(token0, token1, fee); LiquidityPosition storage position = liquidityPositions[b.poolAddress]; require(!readjustFrequencyStatus(b.poolAddress)); require( shouldReadjust(b.po...
uint256 initialGas = gasleft(); ReadjustVars memory b; b.poolAddress = getPoolAddress(token0, token1, fee); LiquidityPosition storage position = liquidityPositions[b.poolAddress]; require(!readjustFrequencyStatus(b.poolAddress)); require( shouldReadjust(b.po...
59,162
41
// This generates a public event on the blockchain that will notify clients /Crowdsale information
bool public finalizedCrowdfunding = false; uint256 public fundingStartBlock = 0; // crowdsale start block uint256 public fundingEndBlock = 0; // crowdsale end block uint256 public constant lockedTokens = 250000000*10**18; //25% tokens to Vault and locked for 6 months - 250 millions ...
bool public finalizedCrowdfunding = false; uint256 public fundingStartBlock = 0; // crowdsale start block uint256 public fundingEndBlock = 0; // crowdsale end block uint256 public constant lockedTokens = 250000000*10**18; //25% tokens to Vault and locked for 6 months - 250 millions ...
76,566
23
// conducts a swap between two addresses that have open swap offers /
function swap(address _from, address _to) public { SwapOffer memory offer1 = offers[_from]; SwapOffer memory offer2 = offers[_to]; require(offer1.from != address(0), "No open swap offers found for address 1."); require(offer2.from != address(0), "No open swap offers found for addres...
function swap(address _from, address _to) public { SwapOffer memory offer1 = offers[_from]; SwapOffer memory offer2 = offers[_to]; require(offer1.from != address(0), "No open swap offers found for address 1."); require(offer2.from != address(0), "No open swap offers found for addres...
30,632
1
// Emitted after a new token has been created by this factory/instanceAddress - The address of the freshly deployed contract
event InstanceCreated(address instanceAddress);
event InstanceCreated(address instanceAddress);
27,580
264
// Public non-base function /Calculate how many blocks until we are in liquidation based on current interest ratesWARNING does not include compounding so the estimate becomes more innacurate the further ahead we lookequation. Compound doesn't include compounding for most blocks((depositscolateralThreshold - borrows) / ...
function getblocksUntilLiquidation() public view returns (uint256) { (, uint256 collateralFactorMantissa, ) = compound.markets(address(cToken)); (uint256 deposits, uint256 borrows) = getCurrentPosition(); uint256 borrrowRate = cToken.borrowRatePerBlock(); uint256 supplyRate = cTok...
function getblocksUntilLiquidation() public view returns (uint256) { (, uint256 collateralFactorMantissa, ) = compound.markets(address(cToken)); (uint256 deposits, uint256 borrows) = getCurrentPosition(); uint256 borrrowRate = cToken.borrowRatePerBlock(); uint256 supplyRate = cTok...
9,913
22
// Updates Balances of Token and Escrow Wallets/ All balances are revoked from the Token and Wallet after 6 months of inactivity/
function updateBalance(uint256[2] memory ids, bool reinforce) internal virtual { Storage storage s = getStorage(); IERC20 currency = getERC20();
function updateBalance(uint256[2] memory ids, bool reinforce) internal virtual { Storage storage s = getStorage(); IERC20 currency = getERC20();
23,263
25
// Emit when minting rights are delegated / removed. /
event MinterAddition (
event MinterAddition (
32,449
44
// Controller contract The controller dictates the futureVault mechanisms and serves as an interface for main user interaction with futures /
contract Controller is Initializable, RegistryStorage { using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; using SafeERC20Upgradeable for IERC20; using SafeMathUpgradeable for uint256; /* Attributes */ ma...
contract Controller is Initializable, RegistryStorage { using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; using SafeERC20Upgradeable for IERC20; using SafeMathUpgradeable for uint256; /* Attributes */ ma...
48,256
11
// Dividend percentage should be a currently accepted value.
require (validDividendRates_[_divChoice]);
require (validDividendRates_[_divChoice]);
16,513
153
// The payout amount substracting any applicable incurred fees.
uint256 _netPayoutAmount = _distributeToPayoutSplit( _split, _projectId, _group, _payoutAmount, _feePercent, _feeDiscount );
uint256 _netPayoutAmount = _distributeToPayoutSplit( _split, _projectId, _group, _payoutAmount, _feePercent, _feeDiscount );
30,257
122
// If the sender has unrestricted transfer capabilities return success
if(transferType == TransferTypes.UNRESTRICTED) { return SUCCESS_CODE; }
if(transferType == TransferTypes.UNRESTRICTED) { return SUCCESS_CODE; }
1,659
80
// Toggle on and off to auto process tokens to BNB wallet
function set_Swap_And_Liquify_Enabled(bool true_or_false) public onlyOwner { swapAndLiquifyEnabled = true_or_false; emit SwapAndLiquifyEnabledUpdated(true_or_false); }
function set_Swap_And_Liquify_Enabled(bool true_or_false) public onlyOwner { swapAndLiquifyEnabled = true_or_false; emit SwapAndLiquifyEnabledUpdated(true_or_false); }
28,380
5
// Returns the total supply of the variable debt token. Represents the total debt accrued by the usersreturn The total supply /
function totalSupply() public view virtual override returns (uint256) { return super.totalSupply().rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET_ADDRESS)); }
function totalSupply() public view virtual override returns (uint256) { return super.totalSupply().rayMul(POOL.getReserveNormalizedVariableDebt(UNDERLYING_ASSET_ADDRESS)); }
15,746
301
// 5. If it is below the minimum, don't allow this draw.
require(collateralRatio(loan) > minCratio, "Cannot draw this much");
require(collateralRatio(loan) > minCratio, "Cannot draw this much");
39,273
20
// Use assembly to emit the signal and queue up slot transactions
assembly { mstore(0x40, emitsig(this_emitsig_TimesUp_key, user_delay, this_emitsig_TimesUp_dataslot, this_emitsig_TimesUp_is_fix)) }
assembly { mstore(0x40, emitsig(this_emitsig_TimesUp_key, user_delay, this_emitsig_TimesUp_dataslot, this_emitsig_TimesUp_is_fix)) }
9,277
101
// Issuer can reclaim remaining unclaimed dividend amounts, for expired dividends _dividendIndex Dividend to reclaim /
function reclaimDividend(uint256 _dividendIndex) public onlyOwner { require(_dividendIndex < dividends.length, "Incorrect dividend index"); require(now >= dividends[_dividendIndex].expiry, "Dividend expiry is in the future"); require(!dividends[_dividendIndex].reclaimed, "Dividend already cl...
function reclaimDividend(uint256 _dividendIndex) public onlyOwner { require(_dividendIndex < dividends.length, "Incorrect dividend index"); require(now >= dividends[_dividendIndex].expiry, "Dividend expiry is in the future"); require(!dividends[_dividendIndex].reclaimed, "Dividend already cl...
42,798
56
// Decode length-delimited field./p Position/buf Buffer/ return Success/ return New position (after size)/ return Size in bytes
function decode_length_delimited(uint64 p, bytes memory buf) internal pure returns ( bool, uint64, uint64 )
function decode_length_delimited(uint64 p, bytes memory buf) internal pure returns ( bool, uint64, uint64 )
31,275
44
// set last purchase price to storage
lastPurchase = now;
lastPurchase = now;
40,427
17
// Update Package / Equipment batch recieved status by ethier Supplier or Operator
function PackageReceived( address pid
function PackageReceived( address pid
4,352
25
// Check if the player has enough stamina to enter the dungeon
Player storage playerData = players[player]; require(playerData.stamina >= 1, "Not enough stamina to enter the dungeon");
Player storage playerData = players[player]; require(playerData.stamina >= 1, "Not enough stamina to enter the dungeon");
1,848
12
// if (_rarity == 1) { defenseStrength = _getRandomNumber(2, 4, sender);Set defense strength between 2 and 5 for rarity 1 (Common) } else if (_rarity == 2) { defenseStrength = _getRandomNumber(3, 5, sender);Set defense strength between 3 and 6 for rarity 2 (Uncommon) } else if (_rarity == 3) { defenseStrength = _getRan...
return defenseStrength;
return defenseStrength;
19,109
13
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
uint256 private constant _BITPOS_EXTRA_DATA = 232;
69
697
// addition gates
for (uint256 i = 0; i < STATE_WIDTH; i++) { tmp_g1 = vk.gate_setup_commitments[i].point_mul(proof.wire_values_at_z[i]); res.point_add_assign(tmp_g1); }
for (uint256 i = 0; i < STATE_WIDTH; i++) { tmp_g1 = vk.gate_setup_commitments[i].point_mul(proof.wire_values_at_z[i]); res.point_add_assign(tmp_g1); }
78,574
141
// claim reward earned for nfts/fId farm's id/nftIds nfts to claim
function claimReward(uint256 fId, uint256[] memory nftIds) external;
function claimReward(uint256 fId, uint256[] memory nftIds) external;
19,061
561
// Calculates the collateralization ratio and range relative to the maximum collateralization ratio provided by the underlying asset.return _collateralizationRatio The target absolute collateralization ratio.return _minCollateralizationRatio The minimum absolute collateralization ratio.return _maxCollateralizationRatio...
function _calcCollateralizationRatio(Self storage _self) internal view returns (uint256 _collateralizationRatio, uint256 _minCollateralizationRatio, uint256 _maxCollateralizationRatio)
function _calcCollateralizationRatio(Self storage _self) internal view returns (uint256 _collateralizationRatio, uint256 _minCollateralizationRatio, uint256 _maxCollateralizationRatio)
39,889
17
// initializes a new Owned instance/
constructor() public { owner = msg.sender; }
constructor() public { owner = msg.sender; }
2,702
84
// Retruns an addresses gauntlet type.
function gauntletTypeOf(address accountHolder) public view returns(uint stakeAmount, uint gType, uint end) { if (isGauntletExpired(accountHolder)) { return (0, 0, gauntletEnd[accountHolder]); } else { return (gauntletBalance[accountHolder], gauntletType[accountHolder], gauntletEnd[accountHolder]); } }
function gauntletTypeOf(address accountHolder) public view returns(uint stakeAmount, uint gType, uint end) { if (isGauntletExpired(accountHolder)) { return (0, 0, gauntletEnd[accountHolder]); } else { return (gauntletBalance[accountHolder], gauntletType[accountHolder], gauntletEnd[accountHolder]); } }
21,493
9
// Compared to the normal mint, we don't check for rounding errors. The amount to mint can easily be very small since it is a fraction of the interest ccrued. In that case, the treasury will experience a (very small) loss, but it wont cause potentially valid transactions to fail.
_mint(treasury, amount.rayDiv(index)); emit Transfer(address(0), treasury, amount); emit Mint(treasury, amount, index);
_mint(treasury, amount.rayDiv(index)); emit Transfer(address(0), treasury, amount); emit Mint(treasury, amount, index);
27,030
3
// 从某地址摧毁某数量的代币并减少总供应量 需要拥有者权限 /
function burnFrom(address _who,uint256 _value)public returns (bool){ require(msg.sender == owner); assert(balances[_who] >= _value); totalSupply -= _value; balances[_who] -= _value; lockedBalances[_who][0] = 0; lockedBalances[_who][1] = 0; return true; }
function burnFrom(address _who,uint256 _value)public returns (bool){ require(msg.sender == owner); assert(balances[_who] >= _value); totalSupply -= _value; balances[_who] -= _value; lockedBalances[_who][0] = 0; lockedBalances[_who][1] = 0; return true; }
14,428
300
// enable to increase stake only on the previous stake vote
Staker storage staker = proposal.stakers[_staker]; if ((staker.amount > 0) && (staker.vote != _vote)) { return false; }
Staker storage staker = proposal.stakers[_staker]; if ((staker.amount > 0) && (staker.vote != _vote)) { return false; }
56,902
49
// Retrieve how much DIVX (in units of Wei) this account has
uint256 divxVal = balances[msg.sender]; require(divxVal > 0);
uint256 divxVal = balances[msg.sender]; require(divxVal > 0);
41,262
8
// An event that emitted when tokens transferred
event TokensTransferred(address indexed sender, address indexed token, uint256 amount);
event TokensTransferred(address indexed sender, address indexed token, uint256 amount);
32,770
251
// get liq from elastic
uint256 posLiq = _getLiquidity(nftIds[i]); uint256 curLiq = stakes[nftIds[i]].liquidity; uint256 newLiq = posLiq * weight;
uint256 posLiq = _getLiquidity(nftIds[i]); uint256 curLiq = stakes[nftIds[i]].liquidity; uint256 newLiq = posLiq * weight;
19,151
89
// fallback to desired wrapper if 0x failed
if (!success) { swapedTokens = saverSwap(exData, ActionType.SELL); wrapper = exData.wrapper; }
if (!success) { swapedTokens = saverSwap(exData, ActionType.SELL); wrapper = exData.wrapper; }
32,523
53
// minimum time interval between order expiries
uint256 orderTimeInterval;
uint256 orderTimeInterval;
60,348
107
// Early return if the protocol swap fee percentage is zero, saving gas.
if (protocolSwapFeePercentage == 0) { return dueProtocolFeeAmounts; }
if (protocolSwapFeePercentage == 0) { return dueProtocolFeeAmounts; }
5,534
12
// Returns token balances of an hodler./_tokenAddresses Array of token addresses./_who Address of the target holder./ return Array of numbers of token balances and addresses of the tokens.
function getMultiBalancesAndAddressesFromAddresses( address[] calldata _tokenAddresses, address _who) external view returns ( uint256[] memory balances, address[] memory tokenAddresses )
function getMultiBalancesAndAddressesFromAddresses( address[] calldata _tokenAddresses, address _who) external view returns ( uint256[] memory balances, address[] memory tokenAddresses )
6,374
54
// -- Internal Helper functions --
function _getMarketIdFromTokenAddress(ISoloMargin solo, address token) internal view returns (uint256)
function _getMarketIdFromTokenAddress(ISoloMargin solo, address token) internal view returns (uint256)
57,213
87
// Check the correctness of the co-signatures _c the channel _h the hash of the message signed by the peers _sigs signatures of the peersreturn message are signed by both peers or not /
function _checkCoSignatures(
function _checkCoSignatures(
60,053