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
223
// Gas optimization: Implicit nonDecreasingShareValue due to no supply change within _harvest (reentrancyGuards guarantee this)./Gas optimization: Implicit nonDecreasingUnderlyingValue check due to before-after underflow.
function _harvest(uint256 vaultId) internal returns (uint256 underlyingIncrease)
function _harvest(uint256 vaultId) internal returns (uint256 underlyingIncrease)
35,083
21
// Function to access name of token .
function name() public view returns (string) { return name; }
function name() public view returns (string) { return name; }
55,185
24
// Staking /
bool public stakingPaused = true;
bool public stakingPaused = true;
4,523
9
// Sets the gas limit for calls made on the Arbitrum network by the bridge newGasLimit The new gas limit /
function setGasLimit(uint newGasLimit) external onlyChair { gasLimit = newGasLimit; }
function setGasLimit(uint newGasLimit) external onlyChair { gasLimit = newGasLimit; }
28,401
15
// This function only works the first time.
error FinishedAirdropPhase(); /*////////////////////////////////////////////////////////////////////////////////////////////////// CONSTRUCTOR
error FinishedAirdropPhase(); /*////////////////////////////////////////////////////////////////////////////////////////////////// CONSTRUCTOR
19,970
11
// ERC20Basic Simpler version of ERC20 interface /
contract ERC20Basic { uint public _totalSupply; function totalSupply() public view returns (uint); function balanceOf(address who) public view returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); }
contract ERC20Basic { uint public _totalSupply; function totalSupply() public view returns (uint); function balanceOf(address who) public view returns (uint); function transfer(address to, uint value) public; event Transfer(address indexed from, address indexed to, uint value); }
1,863
21
// Called by the operator to transfer control to new operator/Access Control: operator/State Machine: anytime/operator Address of the new operator
function transferOperator(address operator) public { // restrict access require(Operated.isOperator(msg.sender), "only operator"); // transfer operator Operated._transferOperator(operator); }
function transferOperator(address operator) public { // restrict access require(Operated.isOperator(msg.sender), "only operator"); // transfer operator Operated._transferOperator(operator); }
26,088
0
// Set variables
uint256 public constant SOTM_SUPPLY = 7500; uint256 public constant SOTM_PRICE = 75000000000000000 wei; bool private _saleActive = false; bool private _presaleActive = false; uint256 public constant presale_supply = 1000; address team1 = 0x3479Bb56816B2822B208F7175EF0D33990025c89; ...
uint256 public constant SOTM_SUPPLY = 7500; uint256 public constant SOTM_PRICE = 75000000000000000 wei; bool private _saleActive = false; bool private _presaleActive = false; uint256 public constant presale_supply = 1000; address team1 = 0x3479Bb56816B2822B208F7175EF0D33990025c89; ...
6,325
2
// StMATIC interface./2021 ShardLabs
interface IStMATIC is IERC20Upgradeable { /// @notice The request withdraw struct. /// @param amount2WithdrawFromStMATIC amount in Matic. /// @param validatorNonce validator nonce. /// @param requestEpoch request epoch. /// @param validatorAddress validator share address. struct RequestWithdraw ...
interface IStMATIC is IERC20Upgradeable { /// @notice The request withdraw struct. /// @param amount2WithdrawFromStMATIC amount in Matic. /// @param validatorNonce validator nonce. /// @param requestEpoch request epoch. /// @param validatorAddress validator share address. struct RequestWithdraw ...
31,929
21
// Logic for tokens
ERC20 token = ERC20(_token); balance = token.balanceOf(this); require(token.transfer(escapeHatchDestination, balance)); EscapeHatchCalled(_token, balance);
ERC20 token = ERC20(_token); balance = token.balanceOf(this); require(token.transfer(escapeHatchDestination, balance)); EscapeHatchCalled(_token, balance);
54,003
26
// Sets new timeZone.
timeZone = _timeZone; emit SetTimeZone(_oldTimeZone, _timeZone);
timeZone = _timeZone; emit SetTimeZone(_oldTimeZone, _timeZone);
52,131
19
// Function to check that if Investor already voted for a particular task or not, if voted:true, else: false
function VotedForProposal(uint _task, address spender) public constant returns(bool)
function VotedForProposal(uint _task, address spender) public constant returns(bool)
33,479
106
// Only apply the modifier if it's greater than zero
if (difficultyMod > 0) {
if (difficultyMod > 0) {
21,924
93
// Cannot safely transfer to a contract that does not implement theERC721Receiver interface. /
error TransferToNonERC721ReceiverImplementer();
error TransferToNonERC721ReceiverImplementer();
469
26
// to unstake BONQ/_bonqAmount amount of BONQ to unstake/Unstake the BONQ and send the it back to the caller, and record accumulated StableCoin gains./ If requested amount > stake, send their entire stake.
function unstake(uint256 _bonqAmount) external override { _requireNonZeroAmount(_bonqAmount); uint256 currentStake = stakes[msg.sender]; _requireUserHasStake(currentStake); // Grab and record accumulated StableCoin gains from the current stake and update Snapshot _updateUserSnapshot(msg.sender); ...
function unstake(uint256 _bonqAmount) external override { _requireNonZeroAmount(_bonqAmount); uint256 currentStake = stakes[msg.sender]; _requireUserHasStake(currentStake); // Grab and record accumulated StableCoin gains from the current stake and update Snapshot _updateUserSnapshot(msg.sender); ...
7,845
11
// returns the value of a LP token if it is one, or the regular price if it isn't LP
function getRawLPPrice(address token) internal view returns (uint256) { uint256 pegPrice = pegTokenPriceV2(token); if (pegPrice != 0) return pegPrice; (uint256 ethPrice, ) = getETHPriceV2(); return getRawLPPrice(token, ethPrice); }
function getRawLPPrice(address token) internal view returns (uint256) { uint256 pegPrice = pegTokenPriceV2(token); if (pegPrice != 0) return pegPrice; (uint256 ethPrice, ) = getETHPriceV2(); return getRawLPPrice(token, ethPrice); }
19,477
7
// Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function acceptProposedOwner() public virtual onlyOwner { require((block.timestamp - _proposedTimestamp) > _delay, "#APO:030"); _setOwner(_proposed); }
function acceptProposedOwner() public virtual onlyOwner { require((block.timestamp - _proposedTimestamp) > _delay, "#APO:030"); _setOwner(_proposed); }
31,721
51
// no user money is kept in this contract, only trasaction fee
if (_amount > this.balance) { revert(); }
if (_amount > this.balance) { revert(); }
42,708
2
// Allows users to update the medications on EHR./_patientId ID of the patient. (fixme: I believe this should be an address/instead though)./_medications The new medications which the EHR will be updated with./There needs to be some verifySig(sig, patientPK) function as well where the/patient provides a signature stati...
function updateMedications(uint16 _patientId, string memory _medications) external
function updateMedications(uint16 _patientId, string memory _medications) external
31,727
195
// Function to set Base and Blind URI /
function setURIs( string memory _blindURI, string memory _URI ) external onlyOwner
function setURIs( string memory _blindURI, string memory _URI ) external onlyOwner
28,358
49
// Initialization function for upgradable proxy contracts _nexus Nexus contract address /
constructor(address _nexus) { require(_nexus != address(0), "Nexus address is zero"); nexus = INexus(_nexus); }
constructor(address _nexus) { require(_nexus != address(0), "Nexus address is zero"); nexus = INexus(_nexus); }
17,403
78
// Approve manaReward here
MANAToken.transferFrom(rewardPool, address(this), manaReward); accManaPerShare = accManaPerShare.add(manaReward.mul(1e18).div(totalStaked)); lastRewardBlock = block.number; emit PoolUpdated(blocksToReward, manaReward, now);
MANAToken.transferFrom(rewardPool, address(this), manaReward); accManaPerShare = accManaPerShare.add(manaReward.mul(1e18).div(totalStaked)); lastRewardBlock = block.number; emit PoolUpdated(blocksToReward, manaReward, now);
24,698
10
// hard time limit
uint256 private immutable _dateEnd;
uint256 private immutable _dateEnd;
58,370
99
// Updates the contract owner._owner Address of the new contract owner./
function setOwner(address _owner) public _onlyOwner delegatedOnly { owner = _owner; }
function setOwner(address _owner) public _onlyOwner delegatedOnly { owner = _owner; }
21,891
53
// Disable all Users
for (Loop = 0; Loop < GuardianshipTable[NewIndex].ContributorList.length; Loop++) { ContributorId = GuardianshipTable[NewIndex].ContributorList[Loop]; ContributorTable[ContributorId].Name = ""; ContributorTable[ContributorId].Guardianship = 0; ...
for (Loop = 0; Loop < GuardianshipTable[NewIndex].ContributorList.length; Loop++) { ContributorId = GuardianshipTable[NewIndex].ContributorList[Loop]; ContributorTable[ContributorId].Name = ""; ContributorTable[ContributorId].Guardianship = 0; ...
52,248
1
// Default signer address
address public defaultSigner;
address public defaultSigner;
13,934
8
// MINT ///
function mint( address to, uint256 tokenId, uint256 amount
function mint( address to, uint256 tokenId, uint256 amount
28,402
25
// the ordered list of target addresses for calls to be made
address[] targets;
address[] targets;
13,836
7
// setting token price
tokenPrice[newTokenId] = price_; tokenAvailable[newTokenId] = true; _tokenIds.increment(); return newTokenId;
tokenPrice[newTokenId] = price_; tokenAvailable[newTokenId] = true; _tokenIds.increment(); return newTokenId;
45,045
119
// Get auctionPriceParameters for current auction return uint256[4]AuctionPriceParameters for current rebalance auction /
function getAuctionPriceParameters()
function getAuctionPriceParameters()
33,638
3
// Token symbol
string private _symbol;
string private _symbol;
7,415
38
// Make sure symbol has 3-8 chars in [A-Za-z._] and name has up to 128 chars.
function checkSymbolAndName( string memory _symbol, string memory _name ) internal pure
function checkSymbolAndName( string memory _symbol, string memory _name ) internal pure
63,389
6
// This function allow user withdraw balances in contract to ETH/Withdraw token in system to ETH. (Wei = tokenmGranularity)/amount number of token that you want withdraw/ return `true` if withdraw process successful
function withdraw(uint amount) external returns (bool) { require( amount > 0, "Amount to deposit MUST be greater zero" ); require( amount <= getBalance(msg.sender), "You don't have enough token" ); uint weiValue = amount.mul(mGr...
function withdraw(uint amount) external returns (bool) { require( amount > 0, "Amount to deposit MUST be greater zero" ); require( amount <= getBalance(msg.sender), "You don't have enough token" ); uint weiValue = amount.mul(mGr...
6,021
8
// See {IERC5313-owner}. /
function owner() public view virtual returns (address) { return defaultAdmin(); }
function owner() public view virtual returns (address) { return defaultAdmin(); }
764
280
// Fee incurred when withdrawing out of the vault, in the units of 1018 where 1 ether = 100%, so 0.005 means 0.5% fee
uint256 public instantWithdrawalFee;
uint256 public instantWithdrawalFee;
54,430
9
// player placed a bet
function flipCoin(bool betOnHead) public payable costs(MIN_BET){ uint downPayment = msg.value; balance += downPayment; _isRegistered(msg.sender); uint256 randomNumber = _pseudoRandom(msg.sender); gambler[msg.sender].plays++; gambler[msg.sender].downPayment = downPaym...
function flipCoin(bool betOnHead) public payable costs(MIN_BET){ uint downPayment = msg.value; balance += downPayment; _isRegistered(msg.sender); uint256 randomNumber = _pseudoRandom(msg.sender); gambler[msg.sender].plays++; gambler[msg.sender].downPayment = downPaym...
29,673
20
// Changes All Presale Roots SaleIndex The Sale Index To Edit RootEligibilityFullSet The Merkle Eligibility Root For Full Set RootAmountsFullSet The Merkle Amounts Root For Full Set RootEligibilityCitizen The Merkle Eligibility Root For Citizens RootAmountsCitizen The Merkle Amounts Root For Citizens /
function __ChangePresaleRootsAll ( uint SaleIndex, bytes32 RootEligibilityFullSet, bytes32 RootAmountsFullSet, bytes32 RootEligibilityCitizen, bytes32 RootAmountsCitizen
function __ChangePresaleRootsAll ( uint SaleIndex, bytes32 RootEligibilityFullSet, bytes32 RootAmountsFullSet, bytes32 RootEligibilityCitizen, bytes32 RootAmountsCitizen
19,791
13
// Emergency withdraw eth in contract in case something is wrong with the contract/
function emergencyWithdraw() external onlyOwner{ payable(msg.sender).transfer(address(this).balance); }
function emergencyWithdraw() external onlyOwner{ payable(msg.sender).transfer(address(this).balance); }
29,916
6
// Create an `address public` variable called `kasei_crowdsale_address`.
address public kasei_crowdsale_address;
address public kasei_crowdsale_address;
10,892
321
// find where to write elements and store this location into `loc` load array storage slot number into memory onto position 0, calculate the keccak256 of the slot number (first 32 bytes at position 0) - this will point to the beginning of the array, so we add array length divided by 8 to point to the last array slot
mstore(0, data.slot) let loc := add(keccak256(0, 32), div(len, 8))
mstore(0, data.slot) let loc := add(keccak256(0, 32), div(len, 8))
3,760
6
// Sets address of actual pToken implementation contract return uint 0 = success, otherwise a failure (see ErrorReporter.sol for details) /
function setPTokenImplementation(address newImplementation) external returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_NEW_IMPLEMENTATION); } address oldImplementation = pTokenImplementation; pTokenImplementation = newImplementat...
function setPTokenImplementation(address newImplementation) external returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_NEW_IMPLEMENTATION); } address oldImplementation = pTokenImplementation; pTokenImplementation = newImplementat...
3,323
121
// the minimum increment in a bid
uint minBidIncrement;
uint minBidIncrement;
46,652
36
// If price is at the resting price, we can send the value directly to the payment splitter.
if (price == MINT_END_PRICE) { paymentSplitter.sendValue(msg.value); _processMint(msg.sender, 1); return; }
if (price == MINT_END_PRICE) { paymentSplitter.sendValue(msg.value); _processMint(msg.sender, 1); return; }
39,174
984
// If the payer is the contract, adjust the cumulativeFeeMultiplier to compensate.
FixedPoint.Unsigned memory collateralPool = _pfc();
FixedPoint.Unsigned memory collateralPool = _pfc();
10,263
47
// these values are pretty much arbitrary since they get overwritten for every txn, but the placeholders make it easier to work with current contract.
uint256 private _taxFee; uint256 private _previousTaxFee = _taxFee; uint256 private _marketingFee; uint256 private _liquidityFee; uint256 private _previousLiquidityFee = _liquidityFee; uint256 private constant BUY = 1; uint256 private constant SELL = 2;
uint256 private _taxFee; uint256 private _previousTaxFee = _taxFee; uint256 private _marketingFee; uint256 private _liquidityFee; uint256 private _previousLiquidityFee = _liquidityFee; uint256 private constant BUY = 1; uint256 private constant SELL = 2;
13,991
1
// Define mapping for tickets
mapping(uint256 => Ticket) private tickets; uint256 public ticketId;
mapping(uint256 => Ticket) private tickets; uint256 public ticketId;
11,394
3
// ============ Constructor ============ //Set state variables_oneInchApprovalAddress Address of 1inch approval contract _oneInchExchangeAddress Address of 1inch exchange contract _oneInchFunctionSignature Bytes of 1inch function signature /
constructor( address _oneInchApprovalAddress, address _oneInchExchangeAddress, bytes4 _oneInchFunctionSignature ) public
constructor( address _oneInchApprovalAddress, address _oneInchExchangeAddress, bytes4 _oneInchFunctionSignature ) public
33,333
140
// exit early - any calls after the first failed call will not execute.
break;
break;
32,060
16
// Returns the sum of unclaimed and new rewards. _stakerAddress of staker.returnavailableRewards_Available OST rewards for '_staker'. /
function availableRewards(address _staker) public view returns (uint256 availableRewards_) { return _calculateRewards(_staker) + stakers[_staker].unclaimedRewards; }
function availableRewards(address _staker) public view returns (uint256 availableRewards_) { return _calculateRewards(_staker) + stakers[_staker].unclaimedRewards; }
7,850
25
// Gets the premium with fee breakdown and new iv value for all listings in a board /
function getPremiumsForBoard( uint _boardId, IOptionMarket.TradeType tradeType, bool isBuy, uint amount
function getPremiumsForBoard( uint _boardId, IOptionMarket.TradeType tradeType, bool isBuy, uint amount
36,935
37
// Calculate any excess funds included with the bid. If the excess is anything worth worrying about, transfer it back to bidder. NOTE: We checked above that the bid amount is greater than or equal to the price so this cannot underflow.
uint256 bidExcess = _bidAmount - price;
uint256 bidExcess = _bidAmount - price;
43,579
12
// the total possoble locked AOD tokens that are allocated for this sale
uint256 public totalPossibleLockedTokens;
uint256 public totalPossibleLockedTokens;
21,192
63
// NOTE: take up any remainder here as profit
if (debtPayment > debtOutstanding) { profit = debtPayment.sub(debtOutstanding); debtPayment = debtOutstanding; }
if (debtPayment > debtOutstanding) { profit = debtPayment.sub(debtOutstanding); debtPayment = debtOutstanding; }
5,532
145
// Update the index for the moved entry
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
2,425
6
// Private function to calculate the normal cummulative distribution. x The value normalized with `ABDKMath64x64` library to be calculated.return The normal cummulative distribution normalized with `ABDKMath64x64` library. /
function _normalCummulativeDistribution(int128 x) private pure returns (int128) { int128 z = ABDKMath64x64.div(x, 0x16a09e667f3bcc908); int128 t = ABDKMath64x64.div(0x10000000000000000, ABDKMath64x64.add(0x10000000000000000, ABDKMath64x64.mul(0x53dd02a4f5ee2e46, ABDKMath64x64.abs(z)))); int1...
function _normalCummulativeDistribution(int128 x) private pure returns (int128) { int128 z = ABDKMath64x64.div(x, 0x16a09e667f3bcc908); int128 t = ABDKMath64x64.div(0x10000000000000000, ABDKMath64x64.add(0x10000000000000000, ABDKMath64x64.mul(0x53dd02a4f5ee2e46, ABDKMath64x64.abs(z)))); int1...
34,094
0
// Interface that token factory should implement/
contract ITokensFactory { /** * @notice This function create new token depending on his standard * @param name Name of the future token * @param symbol Symbol of the future token * @param decimals The quantity of the future token decimals * @param totalSupply The number of coins * @param tok...
contract ITokensFactory { /** * @notice This function create new token depending on his standard * @param name Name of the future token * @param symbol Symbol of the future token * @param decimals The quantity of the future token decimals * @param totalSupply The number of coins * @param tok...
25,373
177
// emits an event when an account operator is updated for a specific account owner
event AccountOperatorUpdated(address indexed accountOwner, address indexed operator, bool isSet);
event AccountOperatorUpdated(address indexed accountOwner, address indexed operator, bool isSet);
63,471
1
// structs
struct PoolData { address rewardToken; uint256 accRewardPerShare; // Accumulated Rewards per share, times 1e36. See below. uint256 rewardRate; uint256 reserves; }
struct PoolData { address rewardToken; uint256 accRewardPerShare; // Accumulated Rewards per share, times 1e36. See below. uint256 rewardRate; uint256 reserves; }
63,186
119
// Allows the owners of the DMM Ecosystem to deposit funds into a DMMA. These funds are used to disburse interest payments and add more liquidity to the specific market.dmmTokenIdThe ID of the DMM token whose underlying will be funded. underlyingAmountThe amount underlying the DMM token that will be deposited into the ...
function adminDepositFunds(uint dmmTokenId, uint underlyingAmount) external;
function adminDepositFunds(uint dmmTokenId, uint underlyingAmount) external;
23,952
18
// Redeems cETH for withdraw return Withdrawn cETH/
function _withdrawCEther(uint256 _amountOfCEth) internal returns (uint256) { // uint256 cEthContractBefore = ceth.balanceOf(address(this)); uint256 EthContractBefore = address(this).balance; ceth.redeem(_amountOfCEth); // uint256 cEthContractAfter = ceth.balanceOf(address(this)); ...
function _withdrawCEther(uint256 _amountOfCEth) internal returns (uint256) { // uint256 cEthContractBefore = ceth.balanceOf(address(this)); uint256 EthContractBefore = address(this).balance; ceth.redeem(_amountOfCEth); // uint256 cEthContractAfter = ceth.balanceOf(address(this)); ...
51,517
66
// Reset announcement
delete _nextForkName; delete _nextForkUrl; delete _nextForkBlockNumber;
delete _nextForkName; delete _nextForkUrl; delete _nextForkBlockNumber;
18,753
126
// Return target(numerator / denominator). /
function getPartial( uint256 target, uint256 numerator, uint256 denominator
function getPartial( uint256 target, uint256 numerator, uint256 denominator
4,922
15
// mintingAllowedAfter: tokenContract.mintingAllowedAfter(), minimumTimeBetweenMints: tokenContract.minimumTimeBetweenMints(), mintCap: tokenContract.mintCap(),
totalSupply: tokenContract.totalSupply(), symbol: tokenContract.symbol(), name: tokenContract.name()
totalSupply: tokenContract.totalSupply(), symbol: tokenContract.symbol(), name: tokenContract.name()
43,774
9
// NOTE: this ds_slot must be the shared if you want to share storage with another contract under the proxy umbrella NOTE: this ds_slot must be unique if you want to NOT share storage with another contract under the proxy umbrella ds_slot = keccak256(diamond.storage.tutorial.properties);
assembly { ds_slot := 0x8009ef9e316d149758ddd03fd4cb6dd67f0acee3d8cdf1372cf6f2ac6d689dbd }
assembly { ds_slot := 0x8009ef9e316d149758ddd03fd4cb6dd67f0acee3d8cdf1372cf6f2ac6d689dbd }
30,378
30
// Standard ERC223 token TokenMint.ioImplementation of the basic standard token. For full specification see: /
contract TokenMintERC223Token is ERC223Token { constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, address feeReceiver, address tokenOwnerAccount) public payable { name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; // set sender as owne...
contract TokenMintERC223Token is ERC223Token { constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, address feeReceiver, address tokenOwnerAccount) public payable { name = _name; symbol = _symbol; decimals = _decimals; totalSupply = _totalSupply; // set sender as owne...
36,526
128
// get invitation relationship
IInvitation public invitation; uint256 public bonusEndBlock; uint256 public totalAvailableDividend; bool public isInitialized; bool public isDepositAvailable; bool public isRevenueWithdrawable; event AddPool(uint256 indexed pid, address tokenAddress);
IInvitation public invitation; uint256 public bonusEndBlock; uint256 public totalAvailableDividend; bool public isInitialized; bool public isDepositAvailable; bool public isRevenueWithdrawable; event AddPool(uint256 indexed pid, address tokenAddress);
41,070
3
// create contract
contract Kudos { mapping (address => Kudo[]) allKudos; function giveKudos(address who, string memory what, string memory comments) public { Kudo memory kudo = Kudo(what, msg.sender, comments); allKudos[who].push(kudo); } function getKudosLength(address who) public view returns(uint) {...
contract Kudos { mapping (address => Kudo[]) allKudos; function giveKudos(address who, string memory what, string memory comments) public { Kudo memory kudo = Kudo(what, msg.sender, comments); allKudos[who].push(kudo); } function getKudosLength(address who) public view returns(uint) {...
9,013
13
// ========================================================================================= //User-facing// ========================================================================================= //Mint CLR tokens by depositing LP tokensMinted tokens are staked in CLR instance, while address receives a receipt token...
function deposit(uint8 inputAsset, uint256 amount) external whenNotPaused { require(amount > 0); (uint256 amount0, uint256 amount1) = calculateAmountsMintedSingleToken( inputAsset, amount ); // Check if address has enough balance uint256 token0Balance...
function deposit(uint8 inputAsset, uint256 amount) external whenNotPaused { require(amount > 0); (uint256 amount0, uint256 amount1) = calculateAmountsMintedSingleToken( inputAsset, amount ); // Check if address has enough balance uint256 token0Balance...
31,922
218
// propose to add a new global constraint:_avatar the avatar of the organization that the constraint is proposed for_gc the address of the global constraint that is being proposed_params the parameters for the global constraint_voteToRemoveParams the conditions (on the voting machine) for removing this global constrain...
function proposeGlobalConstraint(Avatar _avatar, address _gc, bytes32 _params, bytes32 _voteToRemoveParams) public returns(bytes32)
function proposeGlobalConstraint(Avatar _avatar, address _gc, bytes32 _params, bytes32 _voteToRemoveParams) public returns(bytes32)
23,136
115
// Wrap the ETH we got from the msg.sender
Wrap(investAmount);
Wrap(investAmount);
7,747
14
// Sets the Uniswap router address. _routerAddress New router address /
function setRouter( address _routerAddress
function setRouter( address _routerAddress
17,205
62
// It's probably never going to happen, 4 billion EtherDogs is A LOT, but let's just be 100% sure we never let this happen.
require(newEtherDogId == uint256(uint32(newEtherDogId)));
require(newEtherDogId == uint256(uint32(newEtherDogId)));
20,777
459
// INTERNAL FUNCTIONS / This settles a liquidation if it is in the PendingDispute state. If not, it will immediately return. If the liquidation is in the PendingDispute state, but a price is not available, this will revert.
function _settle(uint256 liquidationId, address sponsor) internal { LiquidationData storage liquidation = _getLiquidationData(sponsor, liquidationId); // Settlement only happens when state == PendingDispute and will only happen once per liquidation. // If this liquidation is not ready to be...
function _settle(uint256 liquidationId, address sponsor) internal { LiquidationData storage liquidation = _getLiquidationData(sponsor, liquidationId); // Settlement only happens when state == PendingDispute and will only happen once per liquidation. // If this liquidation is not ready to be...
34,722
8
// Collects fees for the integrator/tokenAddress address of the token to collect fees for/integratorFee amount of fees to collect going to the integrator/lifiFee amount of fees to collect going to lifi/integratorAddress address of the integrator
function collectTokenFees( address tokenAddress, uint256 integratorFee, uint256 lifiFee, address integratorAddress ) external { LibAsset.depositAsset(tokenAddress, integratorFee + lifiFee); _balances[integratorAddress][tokenAddress] += integratorFee; _lifi...
function collectTokenFees( address tokenAddress, uint256 integratorFee, uint256 lifiFee, address integratorAddress ) external { LibAsset.depositAsset(tokenAddress, integratorFee + lifiFee); _balances[integratorAddress][tokenAddress] += integratorFee; _lifi...
21,639
64
// Updates the performance fee. Only governance can update the performance fee. /
function setPerformanceFee(uint256 _performanceFee) public onlyGovernance { require(_performanceFee <= PERCENT_MAX, "overflow"); uint256 oldPerformanceFee = performanceFee; performanceFee = _performanceFee; emit PerformanceFeeUpdated(oldPerformanceFee, _performanceFee); }
function setPerformanceFee(uint256 _performanceFee) public onlyGovernance { require(_performanceFee <= PERCENT_MAX, "overflow"); uint256 oldPerformanceFee = performanceFee; performanceFee = _performanceFee; emit PerformanceFeeUpdated(oldPerformanceFee, _performanceFee); }
12,051
1
// A little over 15 minutes
uint256 public constant minimumAssertionPeriod = 75;
uint256 public constant minimumAssertionPeriod = 75;
34,094
51
// claim for the user if possible
if (canClaim(recipient)) {
if (canClaim(recipient)) {
13,085
34
// Return the total rewards available to the staker
return rewards;
return rewards;
26,781
312
// Max number of assets a single account can participate in (borrow or use as collateral) /
uint256 public maxAssets;
uint256 public maxAssets;
3,327
25
// function withdraw() external returns (bool) { It is important to set this to zero because the recipient can call this function again as part of the receiving call before `send` returns.
pendingReturns[msg.sender] = 0; if (!payable(msg.sender).send(amount)) {
pendingReturns[msg.sender] = 0; if (!payable(msg.sender).send(amount)) {
33,300
13
// ---------------------------------------------------------------------------- External Only ADMIN, MINTER ROLES/CONTRACT_ADMIN_ROLE reveals URI for contract
* - Emits a {Reveal} event. */ function reveal() virtual external whenNotPaused() onlyContractAdmin { revealed = true; emit Reveal(msg.sender); }
* - Emits a {Reveal} event. */ function reveal() virtual external whenNotPaused() onlyContractAdmin { revealed = true; emit Reveal(msg.sender); }
21,854
132
// Controllers
bool public wrappedRoute = true;
bool public wrappedRoute = true;
35,340
121
// Creates `amount` tokens and assigns them to `account`, increasingthe total supply. If a send hook is registered for `account`, the corresponding functionwill be called with `operator`, `data` and `operatorData`.
* See {IERC777Sender} and {IERC777Recipient}. * * Emits {Minted} and {IERC20-Transfer} events. * * Requirements * * - `account` cannot be the zero address. * - if `account` is a contract, it must implement the {IERC777Recipient} * interface. */ function _mint( ...
* See {IERC777Sender} and {IERC777Recipient}. * * Emits {Minted} and {IERC20-Transfer} events. * * Requirements * * - `account` cannot be the zero address. * - if `account` is a contract, it must implement the {IERC777Recipient} * interface. */ function _mint( ...
15,442
259
// If ownership is revoked, don't set royalties.
if (owner() == address(0x0)) { return (owner(), 0); }
if (owner() == address(0x0)) { return (owner(), 0); }
14,494
14
// Destroy this contract
function triggerSelfDestruction() public
function triggerSelfDestruction() public
28,992
102
// Record the caller's staked S2 Citizen.
_stakerS2Position[msg.sender].push(citizenId);
_stakerS2Position[msg.sender].push(citizenId);
42,897
5
// Minimum duration in seconds for which the auction has to be live
uint256 public minimumAuctionLiveness;
uint256 public minimumAuctionLiveness;
1,171
44
// Function to set the ACO Pool maximum number of open ACOs allowed.Only can be called by the factory admin. newMaximumOpenAco Value of the new ACO Pool maximum number of open ACOs allowed. /
function setAcoPoolMaximumOpenAco(uint256 newMaximumOpenAco) onlyFactoryAdmin external virtual { _setAcoPoolMaximumOpenAco(newMaximumOpenAco); }
function setAcoPoolMaximumOpenAco(uint256 newMaximumOpenAco) onlyFactoryAdmin external virtual { _setAcoPoolMaximumOpenAco(newMaximumOpenAco); }
36,339
19
// SafeMath Math operations with safety checks that revert on error. /
library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, // but the benefit is lost if 'b' is also tested. // See: ...
library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, // but the benefit is lost if 'b' is also tested. // See: ...
20,220
113
// Calculates stop price./ return Returns stop price.
function calcStopPrice() view public returns (uint)
function calcStopPrice() view public returns (uint)
10,417
1
// Decimals of the token
uint8 private __decimals;
uint8 private __decimals;
10,807
59
// Checks if a given address currently has transferApproval for a particular monster./_claimant the address we are confirming monster is approved for./_tokenId monster id, only valid when > 0
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) { return monsterIndexToApproved[_tokenId] == _claimant; }
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) { return monsterIndexToApproved[_tokenId] == _claimant; }
28,417
34
// Transfer the amount of fertilizer from the sender to this contract
if (!currency.transferFrom(msg.sender, address(this), fertilizerAmount)) revert TransferError(address(currency), msg.sender, address(this), fertilizerAmount);
if (!currency.transferFrom(msg.sender, address(this), fertilizerAmount)) revert TransferError(address(currency), msg.sender, address(this), fertilizerAmount);
25,399
38
// MintableToken token /
contract MintableToken is Ownable, StandardToken { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; address public saleAgent; modifier canMint() { require(!mintingFinished); _; } modifier onlySaleAgent() { ...
contract MintableToken is Ownable, StandardToken { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; address public saleAgent; modifier canMint() { require(!mintingFinished); _; } modifier onlySaleAgent() { ...
63,694
29
// First return all funds
if (executed == false) {
if (executed == false) {
2,486
68
// Only Governance can do it. Register a pair Vault/Strategy/_vault Vault addresses/_strategy Strategy addresses
function _addVaultAndStrategy(address _vault, address _strategy) private { require(_vault != address(0), "new vault shouldn't be empty"); require(!vaults[_vault], "vault already exists"); require(!strategies[_strategy], "strategy already exists"); require(_strategy != address(0), "new strategy must no...
function _addVaultAndStrategy(address _vault, address _strategy) private { require(_vault != address(0), "new vault shouldn't be empty"); require(!vaults[_vault], "vault already exists"); require(!strategies[_strategy], "strategy already exists"); require(_strategy != address(0), "new strategy must no...
35,386
42
// Returns the downcasted int240 from int256, reverting onoverflow (when the input is less than smallest int240 orgreater than largest int240). Counterpart to Solidity's `int240` operator. Requirements: - input must fit into 240 bits _Available since v4.7._ /
function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); }
function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); }
25,785
783
// The Vault only requires the token list to be ordered for the Two Token Pools specialization. However, to make the developer experience consistent, we are requiring this condition for all the native pools. Also, since these Pools will register tokens only once, we can ensure the Pool tokens will follow the same order...
InputHelpers.ensureArrayIsSorted(tokens); _setSwapFeePercentage(swapFeePercentage); bytes32 poolId = vault.registerPool(specialization);
InputHelpers.ensureArrayIsSorted(tokens); _setSwapFeePercentage(swapFeePercentage); bytes32 poolId = vault.registerPool(specialization);
7,043
952
// Get a CalldataPointer from OfferItem.obj The OfferItem object. return ptr The CalldataPointer. /
function toCalldataPointer( OfferItem calldata obj
function toCalldataPointer( OfferItem calldata obj
23,839
11
// Copy word-length chunks while possible
assembly { mstore(dest, mload(src)) }
assembly { mstore(dest, mload(src)) }
35,806