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
161
// Update storedTotalAssets on withdraw/redeem
function beforeWithdraw(uint256 amount, uint256 shares) internal virtual override { super.beforeWithdraw(amount, shares); storedTotalAssets -= amount; }
function beforeWithdraw(uint256 amount, uint256 shares) internal virtual override { super.beforeWithdraw(amount, shares); storedTotalAssets -= amount; }
41,810
12
// Returns the global time cursor representing the most earliest uncheckpointed week. /
function getTimeCursor() external view override returns (uint256) { return _timeCursor; }
function getTimeCursor() external view override returns (uint256) { return _timeCursor; }
29,042
24
// Set to Refunded for confirmation
function createAccountRefund( string calldata operationId
function createAccountRefund( string calldata operationId
13,231
194
// Send bounty. Wrapper over the real function that performs an extracheck to see if it&39;s after execution window (and thus the first transaction failed) /
function sendBounty(Request storage self) public returns (bool)
function sendBounty(Request storage self) public returns (bool)
53,344
81
// We need to parse Flash loan actions in a different way
enum ActionType { FL_ACTION, STANDARD_ACTION, CUSTOM_ACTION } /// @notice Parses inputs and runs the implemented action through a proxy /// @dev Is called by the TaskExecutor chaining actions together /// @param _callData Array of input values each value encoded as bytes /// @param _subData Array o...
enum ActionType { FL_ACTION, STANDARD_ACTION, CUSTOM_ACTION } /// @notice Parses inputs and runs the implemented action through a proxy /// @dev Is called by the TaskExecutor chaining actions together /// @param _callData Array of input values each value encoded as bytes /// @param _subData Array o...
2,655
118
// Simple SushiSwap local `fromToken` balance in this contract to `toToken` for benefit of `to`.
function swapBalance(address fromToken, address toToken, address to) external returns (uint256 amountOut) { (address token0, address token1) = fromToken < toToken ? (fromToken, toToken) : (toToken, fromToken); ISushiSwap pair = ISushiSwap( uint256( kec...
function swapBalance(address fromToken, address toToken, address to) external returns (uint256 amountOut) { (address token0, address token1) = fromToken < toToken ? (fromToken, toToken) : (toToken, fromToken); ISushiSwap pair = ISushiSwap( uint256( kec...
51,700
102
// Added safety function to extend LGE in case multisig 2 isn't avaiable from emergency life events TODO x3 add your key here
function extendLGE(uint numHours) public { require(msg.sender == 0xd5b47B80668840e7164C1D1d81aF8a9d9727B421 || msg.sender == 0xC91FE1ee441402D854B8F22F94Ddf66618169636, "LGE: Requires admin"); require(numHours <= 24); LGEDurationDays = LGEDurationDays.add(numHours.mul(1 hours)); }
function extendLGE(uint numHours) public { require(msg.sender == 0xd5b47B80668840e7164C1D1d81aF8a9d9727B421 || msg.sender == 0xC91FE1ee441402D854B8F22F94Ddf66618169636, "LGE: Requires admin"); require(numHours <= 24); LGEDurationDays = LGEDurationDays.add(numHours.mul(1 hours)); }
11,255
209
// Get the amount of stake available for a given staker to withdraw. stakerThe address whose balance to check. return The staker's stake amount that is inactive and available to withdraw. /
function getStakeAvailableToWithdraw( address staker ) public view returns (uint256)
function getStakeAvailableToWithdraw( address staker ) public view returns (uint256)
43,865
8
// Withdraw liquidity from Uniswap pool
(uint256 base0, uint256 base1) = _burnLiquidity( baseLower, baseUpper, _liquidityForShares(baseLower, baseUpper, shares), to, false ); (uint256 limit0, uint256 limit1) = _burnLiquidity( limitLower, limitUpper,
(uint256 base0, uint256 base1) = _burnLiquidity( baseLower, baseUpper, _liquidityForShares(baseLower, baseUpper, shares), to, false ); (uint256 limit0, uint256 limit1) = _burnLiquidity( limitLower, limitUpper,
36,205
60
// Symbol of token. /
string public constant symbol = "DUNG";
string public constant symbol = "DUNG";
56,639
32
// Grand and Revoke Admin Roles
function addAdmin(bytes32 _role, address _address) onlyRole(_role) external { grantRole(_role, _address); }
function addAdmin(bytes32 _role, address _address) onlyRole(_role) external { grantRole(_role, _address); }
20,212
61
// dynamic reward:
(, uint dynamicReward,, uint dynamicWd,) = hdudPool.userInfoes(player); recieve = recieve.add(dynamicReward.sub(dynamicWd)); hdudPool.setUser(player, address(0), 0, rewardHDUD.mul(85).div(100), dynamicReward.sub(dynamicWd)); hdudPool.mintHDUD(player, recieve);
(, uint dynamicReward,, uint dynamicWd,) = hdudPool.userInfoes(player); recieve = recieve.add(dynamicReward.sub(dynamicWd)); hdudPool.setUser(player, address(0), 0, rewardHDUD.mul(85).div(100), dynamicReward.sub(dynamicWd)); hdudPool.mintHDUD(player, recieve);
19,898
15
// wrapper to call the encoded transactions on downstream consumers. destination Address of destination contract. data The encoded data payload.return True on success /
function externalCall(address destination, bytes memory data) internal returns (bool)
function externalCall(address destination, bytes memory data) internal returns (bool)
9,717
4
// Used when attempting to unlock stCELO when there is no stCELO to unlock. account The account's address. /
error NothingToUnlock(address account);
error NothingToUnlock(address account);
26,156
0
// Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20PresetMinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allow...
uint256 public _maxSupply = 0;
uint256 public _maxSupply = 0;
16,854
7
// After the end date, the newly deployed parity multisig will bechosen if no transaction is made.
require(now <= endDate); require(returnAddresses[msg.sender] == 0x0); returnAddresses[msg.sender] = _returnAddr; ReturnRequested(msg.sender, _returnAddr);
require(now <= endDate); require(returnAddresses[msg.sender] == 0x0); returnAddresses[msg.sender] = _returnAddr; ReturnRequested(msg.sender, _returnAddr);
16,283
51
// burn the amount sent
return burn(amount);
return burn(amount);
4,146
121
// Update the pre-ICO investments statistic._weiAmount The investment received from a pre-ICO investor._tokensAmount The tokens that will be sent to pre-ICO investor./
function addPreIcoPurchaseInfo(uint256 _weiAmount, uint256 _tokensAmount) internal { totalInvestedAmount[msg.sender] = totalInvestedAmount[msg.sender].add(_weiAmount); tokensSoldPreIco = tokensSoldPreIco.add(_tokensAmount); tokensSoldTotal = tokensSoldTotal.add(_tokensAmount); token...
function addPreIcoPurchaseInfo(uint256 _weiAmount, uint256 _tokensAmount) internal { totalInvestedAmount[msg.sender] = totalInvestedAmount[msg.sender].add(_weiAmount); tokensSoldPreIco = tokensSoldPreIco.add(_tokensAmount); tokensSoldTotal = tokensSoldTotal.add(_tokensAmount); token...
4,747
22
// Only worry about allowances for other addresses
_transfer(sender, recipient, amount); return true;
_transfer(sender, recipient, amount); return true;
22,973
24
// ChangedDns: dnsDomains have been updated
event ChangedDns(string primary, string secondary, string tertiary);
event ChangedDns(string primary, string secondary, string tertiary);
36,875
0
// event FeeChanged(uint256 fee);
event ParametersChanged(address wallet, string name);
event ParametersChanged(address wallet, string name);
30
12
// Минимальная сумма для участия в режиме Тигров
uint256 minValueInvest = 0.05 ether;
uint256 minValueInvest = 0.05 ether;
41,828
41
// Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requires the msg.sender to be the owner, approved, or operator.from current owner of the tokento address to receive the ownership of the given token IDtokenId uint256 ID of the token to be transferred/
function transferFrom(address from, address to, uint256 tokenId) public {
function transferFrom(address from, address to, uint256 tokenId) public {
50,092
200
// Interface of the ERC3156 FlashLender, as defined in _Available since v4.1._ /
interface IERC3156FlashLender { /** * @dev The amount of currency available to be lended. * @param token The loan currency. * @return The amount of `token` that can be borrowed. */ function maxFlashLoan(address token) external view returns (uint256); /** * @dev The fee to be charge...
interface IERC3156FlashLender { /** * @dev The amount of currency available to be lended. * @param token The loan currency. * @return The amount of `token` that can be borrowed. */ function maxFlashLoan(address token) external view returns (uint256); /** * @dev The fee to be charge...
6,044
7
// Publish a new extension in structure
function publishExtension(string _hash, string _name, string _version, ExtensionType _type, string _moduleKey)
function publishExtension(string _hash, string _name, string _version, ExtensionType _type, string _moduleKey)
46,534
447
// Policy Hooks // Checks if the account should be allowed to mint tokens in the given market bToken The market to verify the mint against minter The account which would get the minted tokens mintAmount The amount of underlying being supplied to the market in exchange for tokensreturn 0 if the mint is allowed, otherwis...
function mintAllowed(address bToken, address minter, uint mintAmount) external returns (uint) { // Pausing is a very serious situation - we revert to sound the alarms require(!mintGuardianPaused[bToken], "mint is paused"); // Shh - currently unused minter; mintAmount; ...
function mintAllowed(address bToken, address minter, uint mintAmount) external returns (uint) { // Pausing is a very serious situation - we revert to sound the alarms require(!mintGuardianPaused[bToken], "mint is paused"); // Shh - currently unused minter; mintAmount; ...
11,863
53
// Use of staticcall - this will revert if the underlying function mutates state
let result := staticcall(gas, sload(target_slot), 0, calldatasize, 0, 0) returndatacopy(0, 0, returndatasize) if iszero(result) { revert(0, returndatasize) }
let result := staticcall(gas, sload(target_slot), 0, calldatasize, 0, 0) returndatacopy(0, 0, returndatasize) if iszero(result) { revert(0, returndatasize) }
4,657
21
// Amount that is ending up after liq rewards and liq budget
uint256 totalsub = LiqPoolAddition.add(liquidityLockAmount); super._transfer(from, to, amount.sub(totalsub));
uint256 totalsub = LiqPoolAddition.add(liquidityLockAmount); super._transfer(from, to, amount.sub(totalsub));
31,076
10
// Mints token. /
function mint(uint256 _quanity) external { _mint(msg.sender, _quanity); }
function mint(uint256 _quanity) external { _mint(msg.sender, _quanity); }
28,963
34
// Minimum amount of funds to be raised for the sale to succeed.
uint256 public constant GOAL = 5000 ether;
uint256 public constant GOAL = 5000 ether;
77,639
168
// IIFOV2. It is an interface for IFOV2.sol /
interface IIFOV2 { /** * @notice It allows users to deposit LP tokens to pool * @param _amount: the number of LP token used (18 decimals) * @param _pid: poolId */ function depositPool(uint256 _amount, uint8 _pid) external; /** * @notice It allows users to harvest from pool * @...
interface IIFOV2 { /** * @notice It allows users to deposit LP tokens to pool * @param _amount: the number of LP token used (18 decimals) * @param _pid: poolId */ function depositPool(uint256 _amount, uint8 _pid) external; /** * @notice It allows users to harvest from pool * @...
5,177
391
// Update the allowed fee recipient for this nft contracton SeaDrop.Only the administrator can set the allowed fee recipient.seaDropImplThe allowed SeaDrop contract. feeRecipient The new fee recipient. /
function updateAllowedFeeRecipient(
function updateAllowedFeeRecipient(
26,017
47
// confirm transaction on behalf of signer, not msg.sender
function confirmTransactionBySigner( address signer, uint256 transactionId ) internal transactionExists(transactionId) notConfirmed(transactionId, signer)
function confirmTransactionBySigner( address signer, uint256 transactionId ) internal transactionExists(transactionId) notConfirmed(transactionId, signer)
38,584
96
// if (msg.sender == ci.users[_teamIdx]) { Team storage teamInfo = userToTeam[msg.sender]; require(teamInfo.index == _competitionId && teamInfo.status == TeamStatus.Competition); delete userToTeam[msg.sender]; }
delete si.sponsors[msg.sender]; require(joyTokenContract.transfer(msg.sender, baseValue));
delete si.sponsors[msg.sender]; require(joyTokenContract.transfer(msg.sender, baseValue));
35,444
678
// Record voteMagnitude for voter
proposals[_proposalId].voteMagnitudes[voter] = voterActiveStake;
proposals[_proposalId].voteMagnitudes[voter] = voterActiveStake;
45,513
26
// @custom:member recipientContract - The target contract address@custom:member sourceChain - The chain which this delivery was requested from (in wormholeChainID format)@custom:member sequence - The wormhole sequence number of the delivery VAA on the source chaincorresponding to this delivery request@custom:member del...
event Delivery( address indexed recipientContract, uint16 indexed sourceChain, uint64 indexed sequence, bytes32 deliveryVaaHash, DeliveryStatus status, uint256 gasUsed, RefundStatus refundStatus, bytes additionalStatusInfo, bytes overridesInfo
event Delivery( address indexed recipientContract, uint16 indexed sourceChain, uint64 indexed sequence, bytes32 deliveryVaaHash, DeliveryStatus status, uint256 gasUsed, RefundStatus refundStatus, bytes additionalStatusInfo, bytes overridesInfo
8,622
230
// Set 'stop = min(stop, stopLimit)'.
if (stop > stopLimit) { stop = stopLimit; }
if (stop > stopLimit) { stop = stopLimit; }
44,336
68
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
4,730
0
// Functions/The next two functions are onlyOwner functions.For Zap to be truly decentralized, we will need to transfer the Deity to the 0 address.Only needs to be in library/This function allows us to set a new Deity (or remove it) _newDeity address of the new Deity of the zap system /
function changeDeity(ZapStorage.ZapStorageStruct storage self, address _newDeity) internal{ require(self.addressVars[keccak256("_deity")] == msg.sender); self.addressVars[keccak256("_deity")] =_newDeity; }
function changeDeity(ZapStorage.ZapStorageStruct storage self, address _newDeity) internal{ require(self.addressVars[keccak256("_deity")] == msg.sender); self.addressVars[keccak256("_deity")] =_newDeity; }
7,529
8
// Mapping to check if extension is added
mapping(address => bool) public isExtension;
mapping(address => bool) public isExtension;
45,541
43
// -----------------------------------------payableFunctions-----------------------------------------
53,894
15
// What action to execute when a hash is validated .
mapping (bytes32 => ValidatorAction) internal _hashActions;
mapping (bytes32 => ValidatorAction) internal _hashActions;
30,484
87
// BlacklistableToken Allows accounts to be blacklisted by a "blacklister" role /
contract BlacklistableToken is PausableToken { BlacklistStore public blacklistStore; address private _blacklister; event BlacklisterChanged(address indexed previousBlacklister, address indexed newBlacklister); event BlacklistStoreSet(address indexed previousBlacklistStore, address indexed newblacklis...
contract BlacklistableToken is PausableToken { BlacklistStore public blacklistStore; address private _blacklister; event BlacklisterChanged(address indexed previousBlacklister, address indexed newBlacklister); event BlacklistStoreSet(address indexed previousBlacklistStore, address indexed newblacklis...
49,808
23
// no user money is kept in this contract, only trasaction fee
if (_amount > address(this).balance) { revert(); }
if (_amount > address(this).balance) { revert(); }
9,265
160
// Emit Event
LimitSellOrderCreated(tokenNameIndex, msg.sender, amountOfTokensNecessary, priceInWei, tokens[tokenNameIndex].sellBook[priceInWei].offers_length);
LimitSellOrderCreated(tokenNameIndex, msg.sender, amountOfTokensNecessary, priceInWei, tokens[tokenNameIndex].sellBook[priceInWei].offers_length);
46,094
21
// Redeem collateral. 100+% collateral-backed
function redeem1t1FRAX(uint256 FRAX_amount) external notRedeemPaused { (uint256 frax_price, , , uint256 global_collateral_ratio, , , uint256 redemption_fee) = FRAX.frax_info(); require(global_collateral_ratio >= 1000000, "Collateral ratio must be >= 1"); (uint256 collateral_needed) = FraxPo...
function redeem1t1FRAX(uint256 FRAX_amount) external notRedeemPaused { (uint256 frax_price, , , uint256 global_collateral_ratio, , , uint256 redemption_fee) = FRAX.frax_info(); require(global_collateral_ratio >= 1000000, "Collateral ratio must be >= 1"); (uint256 collateral_needed) = FraxPo...
19,552
115
// Updating the core currency is not yet supported
require(_userRegistry.currency() == currency, "TC01");
require(_userRegistry.currency() == currency, "TC01");
16,023
7
// Check if the NFT was already minted, in which case we will give ownership to whoever preminted it first.
bool was_nft_already_minted = ( nft.minted_at > 0 ); if( was_nft_already_minted ) { require( preminted_at < nft.preminted_at, ACCESS_DENIED ); nft.owners[ nft.minter ] = 0; // Reset previous minter balance to zero.
bool was_nft_already_minted = ( nft.minted_at > 0 ); if( was_nft_already_minted ) { require( preminted_at < nft.preminted_at, ACCESS_DENIED ); nft.owners[ nft.minter ] = 0; // Reset previous minter balance to zero.
36,258
21
// Make payments to the business and service node
if (attemptPaymentElseCancel( _subscriptionContract, _subscriptionIdentifier, tokenAddress, msg.sender, amount, fee, stakeMultiplier ) == false) {
if (attemptPaymentElseCancel( _subscriptionContract, _subscriptionIdentifier, tokenAddress, msg.sender, amount, fee, stakeMultiplier ) == false) {
10,049
10
// Check if address is stakeholder /
function isStakeholder(address _address) public view returns(bool, uint256) { for (uint256 s = 0; s < stakeholders.length; s += 1){ if (_address == stakeholders[s]) return (true, s); } return (false, 0); }
function isStakeholder(address _address) public view returns(bool, uint256) { for (uint256 s = 0; s < stakeholders.length; s += 1){ if (_address == stakeholders[s]) return (true, s); } return (false, 0); }
44,464
8
// to deposit collateral into ArbitragePool and get APtoken/ _collateralToken amount to deposit/ _amount amount to deposit
function deposit(address _collateralToken, uint256 _amount) public nonReentrant { IMintableToken apToken = collateralToAPToken[_collateralToken]; require(address(apToken) != address(0), "d7db9 token must have APtoken"); require(_amount > 0, "d7db9 deposit amount must be bigger than zero"); uint256 st...
function deposit(address _collateralToken, uint256 _amount) public nonReentrant { IMintableToken apToken = collateralToAPToken[_collateralToken]; require(address(apToken) != address(0), "d7db9 token must have APtoken"); require(_amount > 0, "d7db9 deposit amount must be bigger than zero"); uint256 st...
21,542
35
// 2. Burn bridgeable nft
bridgeableNfts[nftType-1].burn(tokenId);
bridgeableNfts[nftType-1].burn(tokenId);
43,967
162
// convert to eth first, same as convertToEther() Store the token in memory to save map entry lookup gas.
(, uint256 magnitude, uint256 rate, bool available, , , ) = _getTokenInfo(_token);
(, uint256 magnitude, uint256 rate, bool available, , , ) = _getTokenInfo(_token);
35,394
38
// Strategy shares have been redeemed strategy Strategy address owner Address that owns the shares recipient Address that received the withdrawn funds shares Amount of shares that were redeemed assetsWithdrawn Amounts of withdrawn assets /
event StrategySharesRedeemed(
event StrategySharesRedeemed(
30,968
2
// `Jade` metadata
mapping(uint256=>uint40) private _jadeMetadata;
mapping(uint256=>uint40) private _jadeMetadata;
4,664
43
// PONZU3
constructor(string memory _name, string memory _symbol, address _ethContract) ERC20(_name, _symbol) { LiveTimer = (block.timestamp + day_1_time) * 1 ether; contractAddress = _ethContract; }
constructor(string memory _name, string memory _symbol, address _ethContract) ERC20(_name, _symbol) { LiveTimer = (block.timestamp + day_1_time) * 1 ether; contractAddress = _ethContract; }
1,213
27
// stake amount
_stake(msg.sender, msg.value); emit StakedWithPartner(partner, msg.value);
_stake(msg.sender, msg.value); emit StakedWithPartner(partner, msg.value);
52,016
3
// Selector: contractOwner(address) 5152b14c
function contractOwner(address contractAddress) external view returns (address);
function contractOwner(address contractAddress) external view returns (address);
35,742
18
// DATATYPES /
struct Char { //name of the char //string name; //wiki pageid of char string wikiID_Name; //save gas }
struct Char { //name of the char //string name; //wiki pageid of char string wikiID_Name; //save gas }
27,664
4
// The SNP TOKEN!
SnpToken public snptoken;
SnpToken public snptoken;
4,149
16
// Vault must have a positive balance for at least one managed asset
if (amountOut >= type(uint256).max) revert DefunctVault();
if (amountOut >= type(uint256).max) revert DefunctVault();
9,696
9
// greater than 100gwei for safetymeasure
require(address(this).balance > 100000000000, "Make sure this contract has atleast 100 gwei"); require(isAuto = true, "Auto Mode is not on");
require(address(this).balance > 100000000000, "Make sure this contract has atleast 100 gwei"); require(isAuto = true, "Auto Mode is not on");
1,042
22
// Mapping for allowance
mapping (address => mapping (address => uint)) internal allowed;
mapping (address => mapping (address => uint)) internal allowed;
20,967
13
//
error TOO_MANY_PROPERTIES();
error TOO_MANY_PROPERTIES();
17,034
13
// Calculate estimated epoch for _startBlock
StreamInfo memory streamInfo = StreamInfo(0, false, 0, 0, 0, new uint256[](0), new uint256[](0)); (streamInfo.notOverflow, streamInfo.startDiff) = _startBlock.trySub( block.number ); if (streamInfo.notOverflow) {
StreamInfo memory streamInfo = StreamInfo(0, false, 0, 0, 0, new uint256[](0), new uint256[](0)); (streamInfo.notOverflow, streamInfo.startDiff) = _startBlock.trySub( block.number ); if (streamInfo.notOverflow) {
40,447
81
// Logic for pricing based on the Tiers of the crowdsale These bonus amounts and the number of tiers itself can be changed/This means that:/
if (now>=tier1Start && now < tier1End) { rate = 120; }else if (now>=tier2Start && now < tier2End) {
if (now>=tier1Start && now < tier1End) { rate = 120; }else if (now>=tier2Start && now < tier2End) {
10,321
4
// Sets contract blocker _val Should we block contracts? /
function setBlockContracts(bool _val) external onlyOwner { _blockContracts = _val; }
function setBlockContracts(bool _val) external onlyOwner { _blockContracts = _val; }
8,097
9
// Specifies clothes owner would like to wear. Overwrites existing selections, so always include every items you'd like to wear.
function wearClothes(uint256 tokenId, uint256[] calldata clothes) public returns (string memory) { require (msg.sender == ownerOf(tokenId), "not your Noun"); clothingState[tokenId] = clothes; return 'Updated your clothing'; }
function wearClothes(uint256 tokenId, uint256[] calldata clothes) public returns (string memory) { require (msg.sender == ownerOf(tokenId), "not your Noun"); clothingState[tokenId] = clothes; return 'Updated your clothing'; }
71,934
120
// Sets the owner for a given list/_id The id of the list/_nextOwner The owner to set
function setListOwner(uint256 _id, address _nextOwner) external onlyListOwner(_id) { lists[_id].owner = _nextOwner; emit ListOwnerSet(_id, _nextOwner); }
function setListOwner(uint256 _id, address _nextOwner) external onlyListOwner(_id) { lists[_id].owner = _nextOwner; emit ListOwnerSet(_id, _nextOwner); }
72,858
22
// Increases the given smart contract `vault`'s balance and/ notifies the `vault` contract. Called by the Bridge after/ the deposits routed by depositors to that `vault` have been/ swept by the Bridge. This way, the depositor does not have to/ issue a separatetransaction to the `vault` contract./ Can be called only by ...
function increaseBalanceAndCall( address vault, address[] calldata depositors, uint256[] calldata depositedAmounts
function increaseBalanceAndCall( address vault, address[] calldata depositors, uint256[] calldata depositedAmounts
9,118
241
// for other pools - stake as pool
address highPool = factory.getPoolAddress(HIGH); require(highPool != address(0),"invalid high pool address"); ICorePool(highPool).stakeAsPool(_staker, pendingYield);
address highPool = factory.getPoolAddress(HIGH); require(highPool != address(0),"invalid high pool address"); ICorePool(highPool).stakeAsPool(_staker, pendingYield);
12,325
54
// Get the balance of multiple account/token pairs _owners The addresses of the token holders _idsID of the TokensreturnThe _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair) /
function balanceOfBatch(address[] memory _owners, uint256[] memory _ids) public view returns (uint256[] memory)
function balanceOfBatch(address[] memory _owners, uint256[] memory _ids) public view returns (uint256[] memory)
1,847
149
// Return the desired amount of liquidity token that the migrator wants.
function desiredLiquidity() external view returns (uint256);
function desiredLiquidity() external view returns (uint256);
1,654
94
// Get rewards for one day stakedAmount Stake amount of the user stakedToken Staked token address of the user rewardToken Reward token addressreturn reward One dayh reward for the user /
function getOneDayReward( uint256 stakedAmount, address stakedToken, address rewardToken
function getOneDayReward( uint256 stakedAmount, address stakedToken, address rewardToken
3,199
16
// Create ERC20 oreder. price uint The ETH price amount uint The token amount tokenId uint The token id expireDate uint The expire date in timestamp /
function createERC20order(uint price, uint amount, uint tokenId, uint expireDate) external isActive checkOrderERC20(amount, tokenId, expireDate) returns(uint id) { ERC20tokens[tokenId].transferFrom(msg.sender, address(this), amount); OrderERC20 memory order; id = ordersCountERC20; ...
function createERC20order(uint price, uint amount, uint tokenId, uint expireDate) external isActive checkOrderERC20(amount, tokenId, expireDate) returns(uint id) { ERC20tokens[tokenId].transferFrom(msg.sender, address(this), amount); OrderERC20 memory order; id = ordersCountERC20; ...
47,155
167
// Internal only rebalance for better gas in redeem
function _rebalance(Lender newProvider) internal { if (_balance() > 0) { if (newProvider == Lender.DYDX) { supplyDydx(_balance()); } else if (newProvider == Lender.FULCRUM) { supplyFulcrum(_balance()); } else if (newProvider == Lender.COMPOUND) { supplyCompound(_balance()...
function _rebalance(Lender newProvider) internal { if (_balance() > 0) { if (newProvider == Lender.DYDX) { supplyDydx(_balance()); } else if (newProvider == Lender.FULCRUM) { supplyFulcrum(_balance()); } else if (newProvider == Lender.COMPOUND) { supplyCompound(_balance()...
83,217
35
// May need to be split if not enough gas
require(!open,"Airdrop is already close"); for (uint i=0; i<_addresses.length; i++) { if(_isParticipant[_addresses[i]]){ continue; }
require(!open,"Airdrop is already close"); for (uint i=0; i<_addresses.length; i++) { if(_isParticipant[_addresses[i]]){ continue; }
26,861
14
// Withdraws stETH + WETH (if necessary) from vault using vault shares collateralToken is the address of the collateral token weth is the WETH address recipient is the recipient amount is the withdraw amount in `asset`return withdrawAmount is the withdraw amount in `collateralToken` /
function withdrawYieldAndBaseToken( address collateralToken, address weth, address recipient, uint256 amount
function withdrawYieldAndBaseToken( address collateralToken, address weth, address recipient, uint256 amount
48,071
198
// Verifies that the rebasing is not paused. /
modifier whenNotRebasePaused() { require(!rebasePaused, "Rebasing paused"); _; }
modifier whenNotRebasePaused() { require(!rebasePaused, "Rebasing paused"); _; }
11,602
2
// How many allocation points assigned to this pool. UBQ to distribute per block.
uint256 allocPoint; uint256 lastRewardBlock; // Last block number that UBQs distribution occurs. uint256 accUbqPerShare; // Accumulated UBQs per share, times 1e12. See below.
uint256 allocPoint; uint256 lastRewardBlock; // Last block number that UBQs distribution occurs. uint256 accUbqPerShare; // Accumulated UBQs per share, times 1e12. See below.
7,523
69
// Called by the DSProxy contract which owns the Compound position/Adds the users Compound poistion in the list of subscriptions so it can be monitored/_minRatio Minimum ratio below which repay is triggered/_maxRatio Maximum ratio after which boost is triggered/_optimalBoost Ratio amount which boost should target/_opti...
function subscribe(uint128 _minRatio, uint128 _maxRatio, uint128 _optimalBoost, uint128 _optimalRepay, bool _boostEnabled) external { // if boost is not enabled, set max ratio to max uint uint128 localMaxRatio = _boostEnabled ? _maxRatio : uint128(-1); require(checkParams(_minRatio, localMa...
function subscribe(uint128 _minRatio, uint128 _maxRatio, uint128 _optimalBoost, uint128 _optimalRepay, bool _boostEnabled) external { // if boost is not enabled, set max ratio to max uint uint128 localMaxRatio = _boostEnabled ? _maxRatio : uint128(-1); require(checkParams(_minRatio, localMa...
7,775
7
// The lower limit of the maximum number of tokens that can be minted.
uint32 editionMaxMintableUpper;
uint32 editionMaxMintableUpper;
42,579
64
// calculate tax amount and send WETH _developmentFee + _autoLPFee _totalTax
uint256 wethDevelopment = (wethReceived * _developmentFee) / (_developmentFee + _autoLPFee); IERC20(token).transfer(feeaddress, wethDevelopment);
uint256 wethDevelopment = (wethReceived * _developmentFee) / (_developmentFee + _autoLPFee); IERC20(token).transfer(feeaddress, wethDevelopment);
22,138
959
// Returns the time average weighted price corresponding to `query`. /
function getTimeWeightedAverage( mapping(uint256 => bytes32) storage samples, IPriceOracle.OracleAverageQuery memory query, uint256 latestIndex
function getTimeWeightedAverage( mapping(uint256 => bytes32) storage samples, IPriceOracle.OracleAverageQuery memory query, uint256 latestIndex
13,739
364
// If the previous cumulativeRewardFactor is 0 and we are before the LIP-71 round, set the default value to MathUtils.percPoints(1, 1) because we only set the default value to PreciseMathUtils.percPoints(1, 1) when storing for the LIP-71 round and onwards (see updateCumulativeRewardFactor() in EarningsPoolLIP36.sol)
if (prevEarningsPool.cumulativeRewardFactor == 0 && _round < roundsManager().lipUpgradeRound(71)) { prevEarningsPool.cumulativeRewardFactor = MathUtils.percPoints(1, 1); }
if (prevEarningsPool.cumulativeRewardFactor == 0 && _round < roundsManager().lipUpgradeRound(71)) { prevEarningsPool.cumulativeRewardFactor = MathUtils.percPoints(1, 1); }
35,703
15
// Determine whether or not a contract address relates to one of the identifiers. _contractAddress The contract address to look for. _identifiers The identifiers.return A boolean indicating if the contract address relates to one of the identifiers. /
function isContractAddressRelates(address _contractAddress, bytes32[] _identifiers) external view returns (bool);
function isContractAddressRelates(address _contractAddress, bytes32[] _identifiers) external view returns (bool);
53,136
522
// PIGGY-MODIFY: Modified some methods and fields according to WePiggy's business logic
contract Comptroller is ComptrollerStorage, IComptroller, ComptrollerErrorReporter, Exponential, OwnableUpgradeSafe { // @notice Emitted when an admin supports a market event MarketListed(PToken pToken); // @notice Emitted when an account enters a market event MarketEntered(PToken pToken, address acco...
contract Comptroller is ComptrollerStorage, IComptroller, ComptrollerErrorReporter, Exponential, OwnableUpgradeSafe { // @notice Emitted when an admin supports a market event MarketListed(PToken pToken); // @notice Emitted when an account enters a market event MarketEntered(PToken pToken, address acco...
15,965
60
// GovernancePhases
bytes32 internal KEY_GOVERNANCE; // 2.x bytes32 internal KEY_STAKING; // 1.2 bytes32 internal KEY_PROXY_ADMIN; // 1.0
bytes32 internal KEY_GOVERNANCE; // 2.x bytes32 internal KEY_STAKING; // 1.2 bytes32 internal KEY_PROXY_ADMIN; // 1.0
31,459
24
// Toggle deposit override/pos Hypervisor Address
function toggleDepositOverride(address pos) external onlyOwner onlyAddedPosition(pos) { Position storage p = positions[pos]; p.depositOverride = !p.depositOverride; emit DepositOverrideToggled(pos); }
function toggleDepositOverride(address pos) external onlyOwner onlyAddedPosition(pos) { Position storage p = positions[pos]; p.depositOverride = !p.depositOverride; emit DepositOverrideToggled(pos); }
16,298
30
// alloc tracks
_allocTracks(_num, trackTmps_[_num].length); for (uint i=0; i<trackTmps_[_num].length; i++) { _updateTrack(_num, startIndex+i, trackTmps_[_num][i]); }
_allocTracks(_num, trackTmps_[_num].length); for (uint i=0; i<trackTmps_[_num].length; i++) { _updateTrack(_num, startIndex+i, trackTmps_[_num][i]); }
33,501
189
// Validate reards slippage swapData Swap slippage and path array /
function _validateRewardsSlippage(SwapData[] calldata swapData) internal view virtual { if (swapData.length > 0) { require( swapData.length == _getRewardSlippageSlots(), "BaseStrategy::_validateSlippage: Invalid Number of reward slippages Defined" ); ...
function _validateRewardsSlippage(SwapData[] calldata swapData) internal view virtual { if (swapData.length > 0) { require( swapData.length == _getRewardSlippageSlots(), "BaseStrategy::_validateSlippage: Invalid Number of reward slippages Defined" ); ...
8,146
100
// Copyright (C) 2020 PlotX.io
contract IMaster { mapping(address => bool) public whitelistedSponsor; function dAppToken() public view returns(address); function getLatestAddress(bytes2 _module) public view returns(address); }
contract IMaster { mapping(address => bool) public whitelistedSponsor; function dAppToken() public view returns(address); function getLatestAddress(bytes2 _module) public view returns(address); }
13,981
22
// ---------------------------------------------------------------------- Auction Price ----------------------------------------------------------------------
function AUCTIONPRICEPARAMETERS855(address _set) //inject NONSTANDARD NAMING external view returns (RebalancingLibrary.AuctionPriceParameters memory);
function AUCTIONPRICEPARAMETERS855(address _set) //inject NONSTANDARD NAMING external view returns (RebalancingLibrary.AuctionPriceParameters memory);
4,383
64
// Create a uniswap pair for this new token
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH());
480
73
// grab time
uint256 _now = now;
uint256 _now = now;
1,739
218
// Init ballot /
) only_editors() external returns (uint ballotId) { // calculate the ballotId based on the last 224 bits of the specHash. ballotId = uint224(specHash) ^ (uint256(NAMESPACE) << 224); // we need to call the init functions on our libraries getDb(ballotId).init(specHash, pack...
) only_editors() external returns (uint ballotId) { // calculate the ballotId based on the last 224 bits of the specHash. ballotId = uint224(specHash) ^ (uint256(NAMESPACE) << 224); // we need to call the init functions on our libraries getDb(ballotId).init(specHash, pack...
47,150
164
// get the lusd
LUSD.safeTransferFrom(msg.sender, address(this), lusdAmount);
LUSD.safeTransferFrom(msg.sender, address(this), lusdAmount);
28,510
23
// Claim Governance of the contract to a new account (`newGovernor`).Can only be called by the new Governor. /
function claimGovernance() external { require( msg.sender == _pendingGovernor(), "Only the pending Governor can complete the claim" ); _changeGovernor(msg.sender); }
function claimGovernance() external { require( msg.sender == _pendingGovernor(), "Only the pending Governor can complete the claim" ); _changeGovernor(msg.sender); }
13,512
429
// revert if applicable transfer recipient is not valid ERC1155Receiver operator executor of transfer from sender of tokens to receiver of tokens ids token IDs amounts quantities of tokens to transfer data data payload /
function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data
function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data
22,846
29
// Image
metadata = string( abi.encodePacked( metadata, ' "image": "', imageURI(_tokenId), '",\n' ) );
metadata = string( abi.encodePacked( metadata, ' "image": "', imageURI(_tokenId), '",\n' ) );
24,728