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
208
// Copy over the first `submod` bytes of the new data as in case 1 above.
let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for {
let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for {
58,159
11
// Schedule a gradual swap fee update. The swap fee will change from the given starting value (which may or may not be the currentvalue) to the given ending fee percentage, over startTime to endTime. Note that calling this with a starting swap fee different from the current value will immediately change thecurrent swap fee to `startSwapFeePercentage`, before commencing the gradual change at `startTime`.Emits the GradualSwapFeeUpdateScheduled event.This is a permissioned function._poolAddress - Address of pool being worked on. _startTime - The timestamp when the swap fee change will begin. _endTime - The timestamp when the swap fee change will end (must
function updateSwapFeeGradually( address _poolAddress, uint256 _startTime, uint256 _endTime, uint256 _startSwapFeePercentage,
function updateSwapFeeGradually( address _poolAddress, uint256 _startTime, uint256 _endTime, uint256 _startSwapFeePercentage,
17,547
12
// Pre-sign hash `_hash`_hash Hash that will be considered signed regardless of the signature checked with 'isValidSignature()'/
function presignHash(bytes32 _hash) external authP(ADD_PRESIGNED_HASH_ROLE, arr(_hash))
function presignHash(bytes32 _hash) external authP(ADD_PRESIGNED_HASH_ROLE, arr(_hash))
18,841
4
// Bulk transfers ownership of subnodes keccak256(node, label) to a new address. May only be called by the owner of the parent node. parentNode The parent node. labelhashes The hashes of the labels specifying the subnodes. owner The address of the new owner. /
function bulkSetSubnodeOwner ( bytes32 parentNode, bytes32[] calldata labelhashes, address owner
function bulkSetSubnodeOwner ( bytes32 parentNode, bytes32[] calldata labelhashes, address owner
10,123
2
// Contract constructor that sets initial supply, buy and sell tax rates. _name The name of the token. _symbol The symbol of the token. _initialSupply The initial supply of the token. _buyTaxRate The tax rate for buying the token. _sellTaxRate The tax rate for selling the token. /
constructor( string memory _name, string memory _symbol, uint256 _initialSupply, uint256 _buyTaxRate, uint256 _sellTaxRate ) ERC20(_name, _symbol, 18) Owned(msg.sender) { _mint(msg.sender, _initialSupply);
constructor( string memory _name, string memory _symbol, uint256 _initialSupply, uint256 _buyTaxRate, uint256 _sellTaxRate ) ERC20(_name, _symbol, 18) Owned(msg.sender) { _mint(msg.sender, _initialSupply);
31,015
269
// Rewards Math
uint256 earnedReward = IERC20Upgradeable(reward).balanceOf(address(this)).sub(_beforeReward); uint256 cvxCrvToGovernance = earnedReward.mul(performanceFeeGovernance).div(MAX_FEE); if(cvxCrvToGovernance > 0){ CVXCRV_VAULT.depositFor(IController(controller).rewards(), cvxCrvToGovernance); emit PerformanceFeeGovernance(IController(controller).rewards(), address(CVXCRV_VAULT), cvxCrvToGovernance, block.number, block.timestamp); }
uint256 earnedReward = IERC20Upgradeable(reward).balanceOf(address(this)).sub(_beforeReward); uint256 cvxCrvToGovernance = earnedReward.mul(performanceFeeGovernance).div(MAX_FEE); if(cvxCrvToGovernance > 0){ CVXCRV_VAULT.depositFor(IController(controller).rewards(), cvxCrvToGovernance); emit PerformanceFeeGovernance(IController(controller).rewards(), address(CVXCRV_VAULT), cvxCrvToGovernance, block.number, block.timestamp); }
16,275
395
// round 41
ark(i, q, 2558302139544901035700544058046419714227464650146159803703499681139469546006); sbox_partial(i, q); mix(i, q);
ark(i, q, 2558302139544901035700544058046419714227464650146159803703499681139469546006); sbox_partial(i, q); mix(i, q);
51,221
3
// mapping(address => uint256) public addressMinNonce;
mapping(bytes32 => Room) public rooms; mapping(address => uint256) private minBetLimit; mapping(address => uint256) public withdrawalDailyLimit; mapping(uint256 => PendingWithdrawal) public pendingWithdrawals; mapping(address => mapping(address => mapping(uint256 => uint256))) public userWithdrawalCount; // userAddress, contractAddress, day, limit mapping(uint256 => uint256) gameBetRoomsArrProcessed; mapping(bytes32 => mapping(uint256 => uint256)) gameBetsArrProcessed; mapping(address => uint256) public gameBetFee; uint256 public pendingWithdrawalId; uint256 public maxOdds;
mapping(bytes32 => Room) public rooms; mapping(address => uint256) private minBetLimit; mapping(address => uint256) public withdrawalDailyLimit; mapping(uint256 => PendingWithdrawal) public pendingWithdrawals; mapping(address => mapping(address => mapping(uint256 => uint256))) public userWithdrawalCount; // userAddress, contractAddress, day, limit mapping(uint256 => uint256) gameBetRoomsArrProcessed; mapping(bytes32 => mapping(uint256 => uint256)) gameBetsArrProcessed; mapping(address => uint256) public gameBetFee; uint256 public pendingWithdrawalId; uint256 public maxOdds;
36,650
15
// Thrown when attempting to mint with MintParameters that have an end time less than the current block time
error MintHasEnded();
error MintHasEnded();
21,415
78
// Constructor function sets the BCDC Multisig address and total number of locked tokens to transfer
function BCDCVault(address _bcdcMultisig,uint256 _numBlocksLockedForDev,uint256 _numBlocksLockedForFounders) { // If it's not bcdcMultisig address then throw if (_bcdcMultisig == 0x0) throw; // Initalized bcdcToken bcdcToken = BCDCToken(msg.sender); // Initalized bcdcMultisig address bcdcMultisig = _bcdcMultisig; // Mark it as BCDCVault isBCDCVault = true; //Initalized numBlocksLockedDev and numBlocksLockedFounders with block number numBlocksLockedDev = _numBlocksLockedForDev; numBlocksLockedFounders = _numBlocksLockedForFounders; // Initalized unlockedBlockForDev with block number // according to current block unlockedBlockForDev = safeAdd(block.number, numBlocksLockedDev); // 30 days of blocks later // Initalized unlockedBlockForFounders with block number // according to current block unlockedBlockForFounders = safeAdd(block.number, numBlocksLockedFounders); // 365 days of blocks later }
function BCDCVault(address _bcdcMultisig,uint256 _numBlocksLockedForDev,uint256 _numBlocksLockedForFounders) { // If it's not bcdcMultisig address then throw if (_bcdcMultisig == 0x0) throw; // Initalized bcdcToken bcdcToken = BCDCToken(msg.sender); // Initalized bcdcMultisig address bcdcMultisig = _bcdcMultisig; // Mark it as BCDCVault isBCDCVault = true; //Initalized numBlocksLockedDev and numBlocksLockedFounders with block number numBlocksLockedDev = _numBlocksLockedForDev; numBlocksLockedFounders = _numBlocksLockedForFounders; // Initalized unlockedBlockForDev with block number // according to current block unlockedBlockForDev = safeAdd(block.number, numBlocksLockedDev); // 30 days of blocks later // Initalized unlockedBlockForFounders with block number // according to current block unlockedBlockForFounders = safeAdd(block.number, numBlocksLockedFounders); // 365 days of blocks later }
45,636
38
// Decode a `CBOR.Value` structure into a native `bool` value. _cborValue An instance of `CBOR.Value`.return The value represented by the input, as a `bool` value. /
function decodeBool(Value memory _cborValue) public pure returns(bool) { _cborValue.len = readLength(_cborValue.buffer, _cborValue.additionalInformation); require(_cborValue.majorType == 7, "Tried to read a `bool` value from a `CBOR.Value` with majorType != 7"); if (_cborValue.len == 20) { return false; } else if (_cborValue.len == 21) { return true; } else { revert("Tried to read `bool` from a `CBOR.Value` with len different than 20 or 21"); } }
function decodeBool(Value memory _cborValue) public pure returns(bool) { _cborValue.len = readLength(_cborValue.buffer, _cborValue.additionalInformation); require(_cborValue.majorType == 7, "Tried to read a `bool` value from a `CBOR.Value` with majorType != 7"); if (_cborValue.len == 20) { return false; } else if (_cborValue.len == 21) { return true; } else { revert("Tried to read `bool` from a `CBOR.Value` with len different than 20 or 21"); } }
6,784
174
// TransferHelper.safeTransfer(token,topAddr,leftReward);
rewards[topAddr] = leftReward;
rewards[topAddr] = leftReward;
1,149
6
// min pay
uint256 public minPayWei;
uint256 public minPayWei;
147
18
// Set client2 address, must be called by owner /
function setClient2Address(address _newClient) public onlyOwner { client2Address = _newClient; }
function setClient2Address(address _newClient) public onlyOwner { client2Address = _newClient; }
19,912
21
// Dispute resolution fund forwarding.
function fundDisputeResolution() public payable { require(_state == State.Dispute, "RefundableTask: can only fund dispute resolution while in dispute"); }
function fundDisputeResolution() public payable { require(_state == State.Dispute, "RefundableTask: can only fund dispute resolution while in dispute"); }
37,965
6
// The total of donations collected per cause/This value is internal in case subclasses wish to withdraw or otherwise access contract balances that are specific to donations
mapping(bytes32 => uint256) internal causesToDonations_;
mapping(bytes32 => uint256) internal causesToDonations_;
41,518
55
// More than this much time must pass between rebase operations.
uint256 public minRebaseTimeIntervalSec;
uint256 public minRebaseTimeIntervalSec;
4,030
56
// RCD - RECORD token contract
RECORDToken public RCD = new RECORDToken(); using SafeMath for uint256;
RECORDToken public RCD = new RECORDToken(); using SafeMath for uint256;
31,995
15
// track addresses that can transfer regardless of whether transfers are enables
mapping(address => bool) public transferAdmins; mapping(address => uint) public balances; mapping(address => mapping(address => uint)) internal allowed; event Burned(address indexed burner, uint256 value);
mapping(address => bool) public transferAdmins; mapping(address => uint) public balances; mapping(address => mapping(address => uint)) internal allowed; event Burned(address indexed burner, uint256 value);
57,845
126
// Place typehash, name hash, and version hash at start of memory.
mstore(0, typehash) mstore(OneWord, nameHash) mstore(TwoWords, versionHash)
mstore(0, typehash) mstore(OneWord, nameHash) mstore(TwoWords, versionHash)
13,655
261
// Since we're only leveraging one asset Supplied = borrowed
uint256 _borrowAndSupply; uint256 supplied = getSupplied(); while (supplied < _supplyAmount) { _borrowAndSupply = getBorrowable(); if (supplied.add(_borrowAndSupply) > _supplyAmount) { _borrowAndSupply = _supplyAmount.sub(supplied); }
uint256 _borrowAndSupply; uint256 supplied = getSupplied(); while (supplied < _supplyAmount) { _borrowAndSupply = getBorrowable(); if (supplied.add(_borrowAndSupply) > _supplyAmount) { _borrowAndSupply = _supplyAmount.sub(supplied); }
33,183
6
// Modifier for checking transfer allownes /
modifier notAllowed(){ require(!transferAllowed); _; }
modifier notAllowed(){ require(!transferAllowed); _; }
32,085
168
// now 1 < x < 4
if (x >= FIXED_2) { x >>= 1;
if (x >= FIXED_2) { x >>= 1;
38,876
9
// Check that only one character is claimed per account.
require(!_exists(index), "already claimed");
require(!_exists(index), "already claimed");
81,027
383
// sampleTimestamp == lookUpDate If we have an exact match, return the sample as both `prev` and `next`.
return (sample, sample);
return (sample, sample);
15,003
160
// This should never be needed. But in case the router ever runs out of an approval
function approveExternal(address externalContract, uint256 amount) external onlyOwner { _approve(address(this), externalContract, amount); }
function approveExternal(address externalContract, uint256 amount) external onlyOwner { _approve(address(this), externalContract, amount); }
14,335
13
// find winner
uint32 participantSize = uint32(participants.length); uint32 longestTimeSpent = 0; address winner;
uint32 participantSize = uint32(participants.length); uint32 longestTimeSpent = 0; address winner;
17,128
87
// A reopening must exactly match the original question, except for the nonce and the creator
require(content_hash == questions[reopens_question_id].content_hash, "content hash mismatch"); require(arbitrator == questions[reopens_question_id].arbitrator, "arbitrator mismatch"); require(timeout == questions[reopens_question_id].timeout, "timeout mismatch"); require(opening_ts == questions[reopens_question_id].opening_ts , "opening_ts mismatch"); require(min_bond == questions[reopens_question_id].min_bond, "min_bond mismatch");
require(content_hash == questions[reopens_question_id].content_hash, "content hash mismatch"); require(arbitrator == questions[reopens_question_id].arbitrator, "arbitrator mismatch"); require(timeout == questions[reopens_question_id].timeout, "timeout mismatch"); require(opening_ts == questions[reopens_question_id].opening_ts , "opening_ts mismatch"); require(min_bond == questions[reopens_question_id].min_bond, "min_bond mismatch");
51,736
137
// Logged with ether was deposited to the smart contract.from address deposited ether came from value amount of ether deposited (may be zero) data transaction data /
event Deposit (address indexed from, uint256 value, bytes data);
event Deposit (address indexed from, uint256 value, bytes data);
11,338
2
// Smallest value of the GDPR
uint256 public constant MIN_TOKEN_UNIT = 10 ** uint256(TOKEN_DECIMALS);
uint256 public constant MIN_TOKEN_UNIT = 10 ** uint256(TOKEN_DECIMALS);
11,525
115
// base class override
regulator = WhitelistedTokenRegulator(_regulator); cusdAddress = _cusd;
regulator = WhitelistedTokenRegulator(_regulator); cusdAddress = _cusd;
22,369
69
// EOA only
require(msg.sender == tx.origin);
require(msg.sender == tx.origin);
10,219
74
// Checks if rounding error >= 0.1% when rounding up./numerator Numerator./denominator Denominator./target Value to multiply with numerator/denominator./ return Rounding error is present.
function isRoundingErrorCeil( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (bool isError)
function isRoundingErrorCeil( uint256 numerator, uint256 denominator, uint256 target ) internal pure returns (bool isError)
32,833
9
// Emitted when a PaymentPlan has ended as scheduled, after last paymentID uniqe plan's ID owner user who created it paymentPlan a plan's details /
event EndPaymentPlan(
event EndPaymentPlan(
25,929
29
// Allows anyone to execute a confirmed transaction./transactionId Transaction ID.
function executeTransaction(uint256 transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId)
function executeTransaction(uint256 transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId)
15,106
358
// Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.newPendingAdmin New pending admin. return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _setPendingAdmin(address newPendingAdmin) public returns (uint) { // Check caller = admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK); } // Save current value, if any, for inclusion in log address oldPendingAdmin = pendingAdmin; // Store pendingAdmin with value newPendingAdmin pendingAdmin = newPendingAdmin; // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin) emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin); return uint(Error.NO_ERROR); }
function _setPendingAdmin(address newPendingAdmin) public returns (uint) { // Check caller = admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK); } // Save current value, if any, for inclusion in log address oldPendingAdmin = pendingAdmin; // Store pendingAdmin with value newPendingAdmin pendingAdmin = newPendingAdmin; // Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin) emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin); return uint(Error.NO_ERROR); }
21,089
2
// Errors // Invalid caller /
error InvalidCaller();
error InvalidCaller();
34,151
55
// The protocol fee is charged using the token with the highest balance in the pool.
uint256 chosenTokenIndex = 0; uint256 maxBalance = balances[0]; for (uint256 i = 1; i < _getTotalTokens(); ++i) { uint256 currentBalance = balances[i]; if (currentBalance > maxBalance) { chosenTokenIndex = i; maxBalance = currentBalance; }
uint256 chosenTokenIndex = 0; uint256 maxBalance = balances[0]; for (uint256 i = 1; i < _getTotalTokens(); ++i) { uint256 currentBalance = balances[i]; if (currentBalance > maxBalance) { chosenTokenIndex = i; maxBalance = currentBalance; }
25,223
73
// total assets transferred to pauser
withdrawAmounts = VaultLib.withdrawWithShares(collaterals, share.totalSupply(address(this)), withdrawShares, pauser);
withdrawAmounts = VaultLib.withdrawWithShares(collaterals, share.totalSupply(address(this)), withdrawShares, pauser);
15,364
16
// round up
uint256 divisor = (KashiPairHelper.getCollateralSharesForBorrowPart(kashiPair, targetBorrowPart) * PREC) / (kashiPair.userCollateralShare(target)) + 1;
uint256 divisor = (KashiPairHelper.getCollateralSharesForBorrowPart(kashiPair, targetBorrowPart) * PREC) / (kashiPair.userCollateralShare(target)) + 1;
16,586
231
// Calculates comission on reward./_user Address of user who harvests reward./_asset Cluster address./totalYield Amount of reward in ETH, collected by user./ return usersPart Amount of reward minus comission.
function _getComissionedAmount( address _user, address _asset, uint256 totalYield
function _getComissionedAmount( address _user, address _asset, uint256 totalYield
33,760
14
// 'contract' has similarities to 'class' in other languages (class variables,
contract SimpleBank { // CapWords // Declare state variables outside function, persist through life of contract // dictionary that maps addresses to balances // always be careful about overflow attacks with numbers mapping (address => uint) private balances; // "private" means that other contracts can't directly query balances // but data is still viewable to other parties on blockchain address public owner; // 'public' makes externally readable (not writeable) by users or contracts // Events - publicize actions to external listeners event LogDepositMade(address accountAddress, uint amount); // Constructor, can receive one or many variables here; only one allowed function SimpleBank() public { // msg provides details about the message that's sent to the contract // msg.sender is contract caller (address of contract creator) owner = msg.sender; } /// @notice Deposit ether into bank /// @return The balance of the user after the deposit is made function deposit() public payable returns (uint) { // Use 'require' to test user inputs, 'assert' for internal invariants // Here we are making sure that there isn't an overflow issue require((balances[msg.sender] + msg.value) >= balances[msg.sender]); balances[msg.sender] += msg.value; // no "this." or "self." required with state variable // all values set to data type's initial value by default LogDepositMade(msg.sender, msg.value); // fire event return balances[msg.sender]; } /// @notice Withdraw ether from bank /// @dev This does not return any excess ether sent to it /// @param withdrawAmount amount you want to withdraw /// @return The balance remaining for the user function withdraw(uint withdrawAmount) public returns (uint remainingBal) { require(withdrawAmount <= balances[msg.sender]); // Note the way we deduct the balance right away, before sending // Every .transfer/.send from this contract can call an external function // This may allow the caller to request an amount greater // than their balance using a recursive call // Aim to commit state before calling external functions, including .transfer/.send balances[msg.sender] -= withdrawAmount; // this automatically throws on a failure, which means the updated balance is reverted msg.sender.transfer(withdrawAmount); return balances[msg.sender]; } /// @notice Get balance /// @return The balance of the user // 'view' (ex: constant) prevents function from editing state variables; // allows function to run locally/off blockchain function balance() view public returns (uint) { return balances[msg.sender]; } }
contract SimpleBank { // CapWords // Declare state variables outside function, persist through life of contract // dictionary that maps addresses to balances // always be careful about overflow attacks with numbers mapping (address => uint) private balances; // "private" means that other contracts can't directly query balances // but data is still viewable to other parties on blockchain address public owner; // 'public' makes externally readable (not writeable) by users or contracts // Events - publicize actions to external listeners event LogDepositMade(address accountAddress, uint amount); // Constructor, can receive one or many variables here; only one allowed function SimpleBank() public { // msg provides details about the message that's sent to the contract // msg.sender is contract caller (address of contract creator) owner = msg.sender; } /// @notice Deposit ether into bank /// @return The balance of the user after the deposit is made function deposit() public payable returns (uint) { // Use 'require' to test user inputs, 'assert' for internal invariants // Here we are making sure that there isn't an overflow issue require((balances[msg.sender] + msg.value) >= balances[msg.sender]); balances[msg.sender] += msg.value; // no "this." or "self." required with state variable // all values set to data type's initial value by default LogDepositMade(msg.sender, msg.value); // fire event return balances[msg.sender]; } /// @notice Withdraw ether from bank /// @dev This does not return any excess ether sent to it /// @param withdrawAmount amount you want to withdraw /// @return The balance remaining for the user function withdraw(uint withdrawAmount) public returns (uint remainingBal) { require(withdrawAmount <= balances[msg.sender]); // Note the way we deduct the balance right away, before sending // Every .transfer/.send from this contract can call an external function // This may allow the caller to request an amount greater // than their balance using a recursive call // Aim to commit state before calling external functions, including .transfer/.send balances[msg.sender] -= withdrawAmount; // this automatically throws on a failure, which means the updated balance is reverted msg.sender.transfer(withdrawAmount); return balances[msg.sender]; } /// @notice Get balance /// @return The balance of the user // 'view' (ex: constant) prevents function from editing state variables; // allows function to run locally/off blockchain function balance() view public returns (uint) { return balances[msg.sender]; } }
11,841
19
// require(isFinished() == false,"释放时间已到");当前释放量 = 锁仓总量curDay/100 - 已经释放量
uint curDay = curDays(); require(curDay <= UNLOCK_DURATION,"释放周期完成!"); for (uint256 i = 0; i < _investors.length; ++i){ address acc = _investors[i]; if(acc == address(0)){ continue; }
uint curDay = curDays(); require(curDay <= UNLOCK_DURATION,"释放周期完成!"); for (uint256 i = 0; i < _investors.length; ++i){ address acc = _investors[i]; if(acc == address(0)){ continue; }
31,245
123
// Returns the owner of the 'tokenId' token. Requirements: - 'tokenId' must exist. /
function ownerOf(uint256 tokenId) external view returns (address owner);
function ownerOf(uint256 tokenId) external view returns (address owner);
20,699
307
// get exchange-specific information
function exchangeIsRegistered(address ofExchange) view returns (bool) { return exchangeInformation[ofExchange].exists; } function getRegisteredExchanges() view returns (address[]) { return registeredExchanges; } function getExchangeInformation(address ofExchange) view returns (address, bool) { Exchange exchange = exchangeInformation[ofExchange]; return ( exchange.adapter, exchange.takesCustody ); }
function exchangeIsRegistered(address ofExchange) view returns (bool) { return exchangeInformation[ofExchange].exists; } function getRegisteredExchanges() view returns (address[]) { return registeredExchanges; } function getExchangeInformation(address ofExchange) view returns (address, bool) { Exchange exchange = exchangeInformation[ofExchange]; return ( exchange.adapter, exchange.takesCustody ); }
8,640
10
// sanity check payload parameters
require( payload.swapFunctionType==swapFunctionType, "incorrect swapFunctionType in payload" ); require( payload.swapCurrencyType==swapCurrencyType, "incorrect swapCurrencyType in payload" );
require( payload.swapFunctionType==swapFunctionType, "incorrect swapFunctionType in payload" ); require( payload.swapCurrencyType==swapCurrencyType, "incorrect swapCurrencyType in payload" );
46,442
20
// Execute swap
IUniswapV2Router(UNISWAP_V2_ROUTER).swapExactTokensForTokens(_amountIn, _amountOutMin, path, _to, block.timestamp + 300);
IUniswapV2Router(UNISWAP_V2_ROUTER).swapExactTokensForTokens(_amountIn, _amountOutMin, path, _to, block.timestamp + 300);
20,226
485
// Load entryId from provided `_data`
uint256 entryId = abi.decode(_data, (uint256));
uint256 entryId = abi.decode(_data, (uint256));
24,117
270
// maker => nonce range => order status bit vector
mapping(address => mapping(uint248 => uint256)) orderStatusByMaker;
mapping(address => mapping(uint248 => uint256)) orderStatusByMaker;
32,162
381
// Verify user credentialsOriginating Address: Has CONTRACT_ADMIN_ROLE role /
modifier isContractAdmin() { require( hasRole(CONTRACT_ADMIN_ROLE, _msgSender()), "RV:MOD:-ICA Caller !CONTRACT_ADMIN_ROLE" ); _; }
modifier isContractAdmin() { require( hasRole(CONTRACT_ADMIN_ROLE, _msgSender()), "RV:MOD:-ICA Caller !CONTRACT_ADMIN_ROLE" ); _; }
74,188
189
// Update maximum amount of NFTs that can be minted at once.
function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; }
function setmaxMintAmount(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmount = _newmaxMintAmount; }
5,500
4
// See {IERC20-totalSupply}./
function totalSupply() public view returns (uint256) { return _applyFactor(_totalSupply.balance, _totalSupply.refactoredCount).add(_totalSupply.remain); }
function totalSupply() public view returns (uint256) { return _applyFactor(_totalSupply.balance, _totalSupply.refactoredCount).add(_totalSupply.remain); }
11,925
71
// Claim pending reward. - Must update pool info - Emit `RewardPaid` event. _protocol Protocol address./
function claimReward(address _protocol) public { PoolInfo storage pool = poolInfo[_protocol]; UserInfo storage user = userInfo[_protocol][msg.sender]; updatePool(_protocol); uint256 pending = user.amount.mul(pool.accEthPerShare).div(1e12).sub( user.rewardDebt ); user.rewardDebt = user.amount.mul(pool.accEthPerShare).div(1e12); if (pending > 0) { safeRewardTransfer(msg.sender, _protocol, pending); } }
function claimReward(address _protocol) public { PoolInfo storage pool = poolInfo[_protocol]; UserInfo storage user = userInfo[_protocol][msg.sender]; updatePool(_protocol); uint256 pending = user.amount.mul(pool.accEthPerShare).div(1e12).sub( user.rewardDebt ); user.rewardDebt = user.amount.mul(pool.accEthPerShare).div(1e12); if (pending > 0) { safeRewardTransfer(msg.sender, _protocol, pending); } }
7,270
153
// Build huffman table for literal/length codes
err = _construct(lencode, lengths, nlen, 0); if ( err != ErrorCode.ERR_NONE && (err == ErrorCode.ERR_NOT_TERMINATED || err == ErrorCode.ERR_OUTPUT_EXHAUSTED || nlen != lencode.counts[0] + lencode.counts[1]) ) {
err = _construct(lencode, lengths, nlen, 0); if ( err != ErrorCode.ERR_NONE && (err == ErrorCode.ERR_NOT_TERMINATED || err == ErrorCode.ERR_OUTPUT_EXHAUSTED || nlen != lencode.counts[0] + lencode.counts[1]) ) {
27,806
14
// auction admin role
bytes32 constant public AUCTION_ADMIN_ROLE = keccak256("AUCTION_ADMIN_ROLE"); event FeeAddressSet(address _oldFee, address _newFee); event ParameterUpdated(bytes32 indexed pair, string _param, uint _oldValue, uint _newValue); event ContractTrustStatusChanged(address indexed _contract, string indexed _organization, bool _status);
bytes32 constant public AUCTION_ADMIN_ROLE = keccak256("AUCTION_ADMIN_ROLE"); event FeeAddressSet(address _oldFee, address _newFee); event ParameterUpdated(bytes32 indexed pair, string _param, uint _oldValue, uint _newValue); event ContractTrustStatusChanged(address indexed _contract, string indexed _organization, bool _status);
43,271
363
// getProposalOrganization return the organizationId for a given proposal_proposalId the ID of the proposal return bytes32 organization identifier/
function getProposalOrganization(bytes32 _proposalId) external view returns(bytes32) { return (proposals[_proposalId].organizationId); }
function getProposalOrganization(bytes32 _proposalId) external view returns(bytes32) { return (proposals[_proposalId].organizationId); }
36,245
106
// Given the symbol for a token in the registry, returns a tuple containing the token's address,the token's index in the registry, the token's name, and the number of decimals. Example:getTokenAttributesBySymbol("WETH");=> ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", 1, "Canonical Wrapped Ether", 18] /
function getTokenAttributesBySymbol(string _symbol) public view returns ( address, uint, string, uint )
function getTokenAttributesBySymbol(string _symbol) public view returns ( address, uint, string, uint )
26,611
34
// check special functions
function imAlive() public onlyOwner() { inactivity = 1; }
function imAlive() public onlyOwner() { inactivity = 1; }
26,832
62
// Otherwise, the token is burned, and we must revert. This handles the case of batch burned tokens, where only the burned bit of the starting slot is set, and remaining slots are left uninitialized.
_revert(OwnerQueryForNonexistentToken.selector);
_revert(OwnerQueryForNonexistentToken.selector);
1,172
88
// fee
uint256 fee0; uint256 fee1;
uint256 fee0; uint256 fee1;
21,513
61
// withdraw Owner can withdraw pending tokens from contract. tokenAddrtoken address./
function withdraw(address tokenAddr, address receiver) external onlyOwner{ // Owner call check // Pending token transfer IERC20(tokenAddr).transfer(receiver, IERC20(tokenAddr).balanceOf(address(this))); }
function withdraw(address tokenAddr, address receiver) external onlyOwner{ // Owner call check // Pending token transfer IERC20(tokenAddr).transfer(receiver, IERC20(tokenAddr).balanceOf(address(this))); }
40,865
23
// fallback function can be used to buy tokens
function () public payable { buyTokens(msg.sender); }
function () public payable { buyTokens(msg.sender); }
1,617
52
// get user order status based on Ids
function orderIdStatusCheck( uint256 orderId
function orderIdStatusCheck( uint256 orderId
24,909
0
// ◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺◹◺
import {TLCreator} from "tl-creator-contracts/TLCreator.sol"; contract IntegrationOfOpposites is TLCreator { constructor( address defaultRoyaltyRecipient, uint256 defaultRoyaltyPercentage, address[] memory admins, bool enableStory, address blockListRegistry ) TLCreator( 0x154DAc76755d2A372804a9C409683F2eeFa9e5e9, "Integration of Opposites", "IOO", defaultRoyaltyRecipient, defaultRoyaltyPercentage, msg.sender, admins, enableStory, blockListRegistry ) {} }
import {TLCreator} from "tl-creator-contracts/TLCreator.sol"; contract IntegrationOfOpposites is TLCreator { constructor( address defaultRoyaltyRecipient, uint256 defaultRoyaltyPercentage, address[] memory admins, bool enableStory, address blockListRegistry ) TLCreator( 0x154DAc76755d2A372804a9C409683F2eeFa9e5e9, "Integration of Opposites", "IOO", defaultRoyaltyRecipient, defaultRoyaltyPercentage, msg.sender, admins, enableStory, blockListRegistry ) {} }
28,288
14
// An endorser is allowed to endorse/reject a nomination once
require((endorsedBy | rejectedBy) & endorserRoles == 0);
require((endorsedBy | rejectedBy) & endorserRoles == 0);
18,989
82
// NFT by either {approve} or {setApprovalForAll}. /
function safeTransferFrom(address from, address to, uint256 tokenId) public;
function safeTransferFrom(address from, address to, uint256 tokenId) public;
9,795
21
// Empty internal constructor, to prevent people from mistakenly deploying an instance of this contract, with should be used via inheritance.
constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address) { return msg.sender; }
constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address) { return msg.sender; }
13,597
89
// no use of revert to make sure the loop will work
function WithdrawLeftOvers(uint256 _PoolId) public PoolId(_PoolId) returns (bool) { //pool is finished + got left overs + did not took them if (IsReadyWithdrawLeftOvers(_PoolId)) { pools[_PoolId].MoreData.TookLeftOvers = true; TransferToken( pools[_PoolId].BaseData.Token, pools[_PoolId].BaseData.Creator, pools[_PoolId].MoreData.Lefttokens ); return true; } return false; }
function WithdrawLeftOvers(uint256 _PoolId) public PoolId(_PoolId) returns (bool) { //pool is finished + got left overs + did not took them if (IsReadyWithdrawLeftOvers(_PoolId)) { pools[_PoolId].MoreData.TookLeftOvers = true; TransferToken( pools[_PoolId].BaseData.Token, pools[_PoolId].BaseData.Creator, pools[_PoolId].MoreData.Lefttokens ); return true; } return false; }
45,969
84
// m_rgp.activityDays = 21;
emit LogRGPInit( now, m_rgp.startTimestamp, m_rgp.maxDailyTotalInvestment, m_rgp.activityDays );
emit LogRGPInit( now, m_rgp.startTimestamp, m_rgp.maxDailyTotalInvestment, m_rgp.activityDays );
55,538
1
// EMG - Initial funding for the insurance is 10 ether
uint private constant INITIAL_FUNDING = 10 ether; address private contractOwner; // Account used to deploy contract bool private operational = true; // Blocks all state changes throughout the contract if false
uint private constant INITIAL_FUNDING = 10 ether; address private contractOwner; // Account used to deploy contract bool private operational = true; // Blocks all state changes throughout the contract if false
41,725
25
// Updates a sequencer address at the sequencer inbox newSequencer new sequencer address to be used /
function setSequencer(address newSequencer) external override { ISequencerInbox(sequencerBridge).setSequencer(newSequencer); emit OwnerFunctionCalled(19); }
function setSequencer(address newSequencer) external override { ISequencerInbox(sequencerBridge).setSequencer(newSequencer); emit OwnerFunctionCalled(19); }
20,449
67
// Update lot variables
_lot.counterAssetWithdrawn = _lot.counterAssetWithdrawn.add(ethAvailableToWithdraw); _lot.lotValueInCounterAsset = _lot.lotValueInCounterAsset.sub(ethAvailableToWithdraw);
_lot.counterAssetWithdrawn = _lot.counterAssetWithdrawn.add(ethAvailableToWithdraw); _lot.lotValueInCounterAsset = _lot.lotValueInCounterAsset.sub(ethAvailableToWithdraw);
6,970
77
// IInstantDistributionAgreementV1.deleteSubscription implementation
function deleteSubscription( ISuperfluidToken token, address publisher, uint32 indexId, address subscriber, bytes calldata ctx ) external override returns(bytes memory newCtx)
function deleteSubscription( ISuperfluidToken token, address publisher, uint32 indexId, address subscriber, bytes calldata ctx ) external override returns(bytes memory newCtx)
5,230
1
// An event emitted when a new proposal is created
event ProposalCreated( uint256 id, address proposer, address[] targets, uint256[] values, string[] signatures, bytes[] calldatas, uint256 startBlock, uint256 endBlock, string description
event ProposalCreated( uint256 id, address proposer, address[] targets, uint256[] values, string[] signatures, bytes[] calldatas, uint256 startBlock, uint256 endBlock, string description
18,699
77
// Bool if trading is active
bool public tradingActive = false;
bool public tradingActive = false;
14,306
159
// Convert ERC20 token amount to the corresponding ether amount./_token ERC20 token contract address./_amount amount of token in base units.
function convertToEther(address _token, uint256 _amount) public view returns (uint256) { // Store the token in memory to save map entry lookup gas. (, uint256 magnitude, uint256 rate, bool available, , , ) = _getTokenInfo(_token); // If the token exists require that its rate is not zero. if (available) { require(rate != 0, "rate=0"); // Safely convert the token amount to ether based on the exchange rate. return _amount.mul(rate).div(magnitude); } return 0; }
function convertToEther(address _token, uint256 _amount) public view returns (uint256) { // Store the token in memory to save map entry lookup gas. (, uint256 magnitude, uint256 rate, bool available, , , ) = _getTokenInfo(_token); // If the token exists require that its rate is not zero. if (available) { require(rate != 0, "rate=0"); // Safely convert the token amount to ether based on the exchange rate. return _amount.mul(rate).div(magnitude); } return 0; }
35,391
40
// Redeem several tokens into the address specified by `_to`. This function will failif the provided `_baseTokens` are not owned by the caller or have previously redeemed._to Address where the minted tokens will be assigned. _baseTokens Array with base tokens ID. /
function redeemTo(address _to, uint256[] memory _baseTokens) public { // Verify the recipient's address. require(_to != address(0), "recipient not set"); // Verify more than 1 tokens were provided, else the caller can use // the single variants of the redeem functions. require(_baseTokens.length > 1, "incorrect amount"); // Verify that all the specified base tokens IDs are owned by the transaction caller // and does not have already been redeemed. for (uint256 i = 0; i < _baseTokens.length; i++) { require(IERC721(baseTokenContract).ownerOf(_baseTokens[i]) == msg.sender, "wrong owner"); require(!redeemedBaseTokens[_baseTokens[i]], "token already redeemed"); } // Verify there is enough items available to giveaway. // Verifies giveaway is in active state under the hood. require(itemsAvailable() >= _baseTokens.length, "inactive giveaway or not enough items available"); // Store the minted giveaway tokens. uint256[] memory giveawayTokens = new uint256[](_baseTokens.length); // For each base token provided, mint a giveaway token. for (uint256 i = 0; i < _baseTokens.length; i++) { // Mint token to to the recipient. IMintableERC721(giveawayTokenContract).mint(_to, nextId); // Save the minted token ID. giveawayTokens[i] = nextId; // Set the next token ID to mint. nextId += 1; // Increase the giveaway counter. giveawayCounter += 1; // Record the base token, so that it cannot be used again for redeeming. redeemedBaseTokens[_baseTokens[i]] = true; } // All the tokens were redeemed, emit the corresponding event. emit Redeemed(msg.sender, _to, giveawayTokens); }
function redeemTo(address _to, uint256[] memory _baseTokens) public { // Verify the recipient's address. require(_to != address(0), "recipient not set"); // Verify more than 1 tokens were provided, else the caller can use // the single variants of the redeem functions. require(_baseTokens.length > 1, "incorrect amount"); // Verify that all the specified base tokens IDs are owned by the transaction caller // and does not have already been redeemed. for (uint256 i = 0; i < _baseTokens.length; i++) { require(IERC721(baseTokenContract).ownerOf(_baseTokens[i]) == msg.sender, "wrong owner"); require(!redeemedBaseTokens[_baseTokens[i]], "token already redeemed"); } // Verify there is enough items available to giveaway. // Verifies giveaway is in active state under the hood. require(itemsAvailable() >= _baseTokens.length, "inactive giveaway or not enough items available"); // Store the minted giveaway tokens. uint256[] memory giveawayTokens = new uint256[](_baseTokens.length); // For each base token provided, mint a giveaway token. for (uint256 i = 0; i < _baseTokens.length; i++) { // Mint token to to the recipient. IMintableERC721(giveawayTokenContract).mint(_to, nextId); // Save the minted token ID. giveawayTokens[i] = nextId; // Set the next token ID to mint. nextId += 1; // Increase the giveaway counter. giveawayCounter += 1; // Record the base token, so that it cannot be used again for redeeming. redeemedBaseTokens[_baseTokens[i]] = true; } // All the tokens were redeemed, emit the corresponding event. emit Redeemed(msg.sender, _to, giveawayTokens); }
42,710
23
// Transfer token for a specified address_to The address to transfer to._value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
11,991
74
// Enable or disable approval for a third party ("operator") to manage/all of `msg.sender`'s assets/Emits the ApprovalForAll event. The contract MUST allow/multiple operators per owner./_operator Address to add to the set of authorized operators/_approved True if the operator is approved, false to revoke approval
function setApprovalForAll(address _operator, bool _approved) external;
function setApprovalForAll(address _operator, bool _approved) external;
24,655
165
// Required ratio of over-collateralization
Decimal.D256 marginRatio;
Decimal.D256 marginRatio;
25,564
1
// is everything okay?
require(campaign.deadline < block.timestamp, "The deadline should be a date in the future"); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign.target = _target; campaign.deadline= _deadline; campaign.ammountCollected = 0; campaign.image = _image; numberOfCampaigns++;
require(campaign.deadline < block.timestamp, "The deadline should be a date in the future"); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign.target = _target; campaign.deadline= _deadline; campaign.ammountCollected = 0; campaign.image = _image; numberOfCampaigns++;
19,035
83
// converts Ether (in wei) to vouchers
function _weiToVouchers(uint256 _value) internal view returns (uint256) { return _value.mul(voucherMthEthRate).div(RATE_COEFFICIENT2); }
function _weiToVouchers(uint256 _value) internal view returns (uint256) { return _value.mul(voucherMthEthRate).div(RATE_COEFFICIENT2); }
16,900
86
// Issue of tokens for the zero round, it is usually called: private pre-sale (Round 0) @ Do I have to use the functionmay be @ When it is possible to callbefore Round 1/2 @ When it is launched automatically- @ Who can call the functionadmins
function firstMintRound0(uint256 _amount /* QUINTILLIONS! */) public { onlyAdmin(false); require(canFirstMint); begin(); token.mint(wallets[uint8(Roles.manager)],_amount); }
function firstMintRound0(uint256 _amount /* QUINTILLIONS! */) public { onlyAdmin(false); require(canFirstMint); begin(); token.mint(wallets[uint8(Roles.manager)],_amount); }
58,720
4
// lp挖矿合约地址
address constant COFIXV1VAULTFORLP_ADDRESS = 0x01a63418C78b1beaDc98e3Baa8373543C4918e38;
address constant COFIXV1VAULTFORLP_ADDRESS = 0x01a63418C78b1beaDc98e3Baa8373543C4918e38;
14,058
209
// `owner()` is provided as an helper to mimick the `Ownable` contract ABI.The `Ownable` logic is used by many 3rd party services to determinecontract ownership - e.g. who is allowed to edit metadata on Opensea.This logic is NOT used internally by the Unlock Protocol and is madeavailable only as a convenience helper. /
function owner() external view returns (address owner);
function owner() external view returns (address owner);
16,746
226
// NOTE: send is chosen over transfer to prevent cases where a malicious fallback function could forcibly block an attribute's removal. Another option is to allow a user to pull the staked amount after the removal. NOTE: refine transaction rebate gas calculation! Setting this value too high gives validators the incentive to revoke valid attributes. Simply checking against gasLeft() & adding the final gas usage won't give the correct transaction cost, as freeing space refunds gas upon completion.
uint256 transactionGas = 37700; // <--- WARNING: THIS IS APPROXIMATE uint256 transactionCost = transactionGas.mul(tx.gasprice);
uint256 transactionGas = 37700; // <--- WARNING: THIS IS APPROXIMATE uint256 transactionCost = transactionGas.mul(tx.gasprice);
42,457
348
// PToken initialize does the bulk of the work
super.init(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
super.init(comptroller_, interestRateModel_, initialExchangeRateMantissa_, name_, symbol_, decimals_);
27,150
2
// Uninvest value and tranfer exchanged value to receiver./data whatever data you want to pass to strategy from vote extry./unwindPercent percentage of available assets to be released with 2 decimal points./outputCoin address of token that strategy MUST return./receiver address where tokens should go./swapRewards true if rewards are needed to swap to `outputCoin`, false otherwise.
function exitAll( bytes calldata data, uint256 unwindPercent, address outputCoin, address receiver, bool _withdrawRewards, bool swapRewards ) external; function getDeployedAmountAndRewards(
function exitAll( bytes calldata data, uint256 unwindPercent, address outputCoin, address receiver, bool _withdrawRewards, bool swapRewards ) external; function getDeployedAmountAndRewards(
23,412
100
// Deposit LP tokens.In normal case, _recipient should be same as msg.senderIn deposit and stake, _recipient should be address of initial user
function deposit(uint256 _pid, uint256 _amount, address _recipient) public returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_recipient]; uint256 rewards = _harvest(_recipient, _pid); // Update debt before calling external function uint256 newAmount = user.amount.add(_amount); user.rewardDebt = newAmount.mul(pool.accPerShare).div(1e12); if (_amount > 0) { pool.lpToken.safeTransferFrom(msg.sender, address(this), _amount); user.amount = newAmount; user.depositTime = block.timestamp; } emit Deposit(_recipient, _pid, _amount); return rewards; }
function deposit(uint256 _pid, uint256 _amount, address _recipient) public returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_recipient]; uint256 rewards = _harvest(_recipient, _pid); // Update debt before calling external function uint256 newAmount = user.amount.add(_amount); user.rewardDebt = newAmount.mul(pool.accPerShare).div(1e12); if (_amount > 0) { pool.lpToken.safeTransferFrom(msg.sender, address(this), _amount); user.amount = newAmount; user.depositTime = block.timestamp; } emit Deposit(_recipient, _pid, _amount); return rewards; }
18,386
152
// An event thats emitted when a new governance account is set/ _new The new governance address
event NewGovernance(address _new);
event NewGovernance(address _new);
33,347
87
// Buyers can claim refund. Note that any refunds from proxy buyers should be handled separately, and not through this contract./
function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); }
function refund() external { require(!isMinimumGoalReached() && loadedRefund > 0); require(!isExternalBuyer[msg.sender]); uint weiValue = boughtAmountOf[msg.sender]; require(weiValue > 0); boughtAmountOf[msg.sender] = 0; weiRefunded = weiRefunded.add(weiValue); msg.sender.transfer(weiValue); Refund(msg.sender, weiValue); }
21,062
33
// Gets the cutoff time in blocks after which the given group is/ considered as stale. Stale group is an expired group which is no longer/ performing any operations.
function groupStaleTime( Storage storage self, Group memory group
function groupStaleTime( Storage storage self, Group memory group
26,601
21
// Redeem ETH corresponding to uToken amount
(bool sent, bytes memory data) = msg.sender.call{value: totalBidAmount.mul(finalBalance).div(this.totalSupply())}("");
(bool sent, bytes memory data) = msg.sender.call{value: totalBidAmount.mul(finalBalance).div(this.totalSupply())}("");
47,806
183
// Set the state to running.
icoState = State.running;
icoState = State.running;
41,597
13
// Triggers withdraw from vault and burns receivers' sharesid Vault idassets Amount of tokens to withdrawreceiver Receiver of assetsowner Owner of shares return shares Amount of shares burned/
function withdraw( uint256 id, uint256 assets, address receiver, address owner
function withdraw( uint256 id, uint256 assets, address receiver, address owner
18,103
58
// if fees are enabled, subtract 2.25% fee and send it to beneficiary after a certain threshold, try to swap collected fees automatically if automatic swap fails (or beneficiary does not implement swapTokens function) transfer should still succeed /
function _transfer( address sender, address recipient, uint256 amount
function _transfer( address sender, address recipient, uint256 amount
10,215
31
// Get ID based on key attributes of position /
function getKeyId(string _account, string _asset, string _loaction) public view returns(uint) { return idMap[compileKey(_account, _asset, _loaction)]; }
function getKeyId(string _account, string _asset, string _loaction) public view returns(uint) { return idMap[compileKey(_account, _asset, _loaction)]; }
48,444
74
// Update operator status
operators[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved);
operators[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved);
725
175
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
if (packed & _BITMASK_BURNED == 0) {
1,977
6
// stake `amount` SUSHI into aXSUSHI for benefit of `to` by batching calls to `sushiBar` and `aave` lending pool.
function saaveTo(address to, uint256 amount) external { sushiToken.transferFrom(msg.sender, address(this), amount); // deposit caller SUSHI `amount` into this contract sushiBar.enter(amount); // stake deposited SUSHI `amount` into xSUSHI aave.deposit(address(sushiBar), sushiBar.balanceOf(address(this)), to, 0); // stake resulting xSUSHI into aXSUSHI - send to `to` }
function saaveTo(address to, uint256 amount) external { sushiToken.transferFrom(msg.sender, address(this), amount); // deposit caller SUSHI `amount` into this contract sushiBar.enter(amount); // stake deposited SUSHI `amount` into xSUSHI aave.deposit(address(sushiBar), sushiBar.balanceOf(address(this)), to, 0); // stake resulting xSUSHI into aXSUSHI - send to `to` }
81