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
59
// Internal Write Functions
function __updateYieldReward(address address_) internal { uint40 _time = __getSmallerValueUint40(uint40(block.timestamp), yieldEndTime); uint40 _lastUpdate = addressToYield[address_].lastUpdatedTime_; if (_lastUpdate > 0) { addressToYield[address_].pendingRewards_ += __calculat...
function __updateYieldReward(address address_) internal { uint40 _time = __getSmallerValueUint40(uint40(block.timestamp), yieldEndTime); uint40 _lastUpdate = addressToYield[address_].lastUpdatedTime_; if (_lastUpdate > 0) { addressToYield[address_].pendingRewards_ += __calculat...
25,365
136
// Balancer pool WETH-MUSD
address balancerPool;
address balancerPool;
19,134
29
// Returns balance for the token defined by the provided index
function balances(uint256 index) external view returns (uint256);
function balances(uint256 index) external view returns (uint256);
72,034
38
// Gives all stableSwap info at once. Reduces front-end RPC calls./ All return values have 18 decimals except fee that has 6.
function getStableSwapInfo(uint256 inAmount, address stableIn, address stableOut) public view returns( uint256 inStablecoinPriceUSD, uint256 outStablecoinPriceUSD, uint256 quoteS2S1, uint256 fee, uint256 feeAmount, uint256 outStablecoinAmount
function getStableSwapInfo(uint256 inAmount, address stableIn, address stableOut) public view returns( uint256 inStablecoinPriceUSD, uint256 outStablecoinPriceUSD, uint256 quoteS2S1, uint256 fee, uint256 feeAmount, uint256 outStablecoinAmount
28,951
32
// Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to. /
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
2,870
114
// See {_burn} and {_approve}. /
function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve( account, _msgSender(), _allowances[account][_msgSender()].sub( amount, "ERC20: burn amount exceeds allowance" ) );
function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve( account, _msgSender(), _allowances[account][_msgSender()].sub( amount, "ERC20: burn amount exceeds allowance" ) );
64,090
10
// Check the amount of already added percents in all other rules.percent Proposal percents./
modifier canAddRuleWithThisValueOfPercents(uint256 percent) { require(amountOfRulesPercents + percent <= MAX_PERCENTS); _; }
modifier canAddRuleWithThisValueOfPercents(uint256 percent) { require(amountOfRulesPercents + percent <= MAX_PERCENTS); _; }
12,006
23
// ------------------------------------------------------------------------ Token holders can stake their tokens using this functiontokens number of tokens to stake ------------------------------------------------------------------------
function STAKE(uint256 tokens) external { require(IERC20(EMax).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account"); // add pending rewards to remainder to be claimed by user later, if there is any existing stake uint256 owing = pend...
function STAKE(uint256 tokens) external { require(IERC20(EMax).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account"); // add pending rewards to remainder to be claimed by user later, if there is any existing stake uint256 owing = pend...
44,789
14
// Do not allow the owner to prematurely steal tokens that do not belong to them
if(!hasLaunched){ require(tokenAddress != counter); }else{
if(!hasLaunched){ require(tokenAddress != counter); }else{
46,520
14
// 賽局陣列
Game[] public games;
Game[] public games;
10,483
5
// Check that the proposed set natural unit is a multiple of current set natural unit, or vice versa. Done to make sure that when calculating token units there will are be rounding errors.
require( naturalUnitsAreValid(currentSet, _nextSet), "Invalid natural unit" );
require( naturalUnitsAreValid(currentSet, _nextSet), "Invalid natural unit" );
51,221
77
// Returns list of owners./ return List of owner addresses.
function getOwners() public view returns (address[] memory)
function getOwners() public view returns (address[] memory)
18,365
130
// think of useful event scheme for in-flight outputs finalization
} else {
} else {
26,764
12
// Of the remaining tokens, set aside 1/4 of the tokens to LP, swap the rest for ETH. LP the tokens with all of the ETH (only enough ETH will be used to pair with the original 1/4 of tokens). Send the remaining ETH (about half the original balance) to my wallet.
uint tokensForLiq = balanceOf(address(this)) / 4; uint tokensToSwap = balanceOf(address(this)) - tokensForLiq;
uint tokensForLiq = balanceOf(address(this)) / 4; uint tokensToSwap = balanceOf(address(this)) - tokensForLiq;
21,761
1,424
// Decrypt secret key contribution
uint secret = Decryption(contractManager.getContract("Decryption")).decrypt( complaints[schainId].keyShare, sha256(abi.encodePacked(key)) ); badNode = ( _checkCorrectMultipliedShare(multipliedShare, secret) && multipliedShare.isEqual(complaints[sc...
uint secret = Decryption(contractManager.getContract("Decryption")).decrypt( complaints[schainId].keyShare, sha256(abi.encodePacked(key)) ); badNode = ( _checkCorrectMultipliedShare(multipliedShare, secret) && multipliedShare.isEqual(complaints[sc...
13,788
204
// checks if the address provided is part of the presale
function checkPresaleAddress(address _address) public view returns (bool) { return presaleAddressAllowed[_address]; }
function checkPresaleAddress(address _address) public view returns (bool) { return presaleAddressAllowed[_address]; }
82,515
74
// Delegate votes. Delegate votes. delegatee The address to delegate the votes to./
function delegate(address delegatee) external payable { require(compToken.delegates(address(this)) != delegatee, "Already delegated to same delegatee."); compToken.delegate(delegatee); emit LogDelegate(delegatee); }
function delegate(address delegatee) external payable { require(compToken.delegates(address(this)) != delegatee, "Already delegated to same delegatee."); compToken.delegate(delegatee); emit LogDelegate(delegatee); }
71,276
0
// string uri = "https:bafybeihdyeow5r7wbfvtwachwysomdk2ue2pfj5pbx5svpzxx62ymhf4cu.ipfs.dweb.link/MoonCats/";
uint public priceNFT = 0;
uint public priceNFT = 0;
16,558
74
// The operation should be approved if the signer address has no cosigner (i.e. signer == cosigner)
require(address(authorizations[authVersion + uint256(msg.sender)]) == msg.sender, "Invalid authorization."); internalInvoke(0, data);
require(address(authorizations[authVersion + uint256(msg.sender)]) == msg.sender, "Invalid authorization."); internalInvoke(0, data);
20,091
59
// we sent more funds for the farmer to farm, reflect this
ACTIVELY_FARMED = ACTIVELY_FARMED.add(_amountChange); emit RebalanceHot(0, _amountChange, block.timestamp);
ACTIVELY_FARMED = ACTIVELY_FARMED.add(_amountChange); emit RebalanceHot(0, _amountChange, block.timestamp);
22,434
34
// set new CL
creditLine = IV2CreditLine(newCl);
creditLine = IV2CreditLine(newCl);
42,567
71
// See {IERC20-transfer}. Requirements: - `account` cannot be the zero address.- the caller must have a balance of at least `amount`. /
function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; }
function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; }
14,876
0
// from -> identity -> tokens
mapping(address => mapping(uint256 => EnumerableSet.UintSet)) IdentityTokens;
mapping(address => mapping(uint256 => EnumerableSet.UintSet)) IdentityTokens;
4,951
840
// Update fractional reward
fractionalRewardByWallet[wallet].fraction = fraction.clampMax(uint256(ConstantsLib.PARTS_PER())); fractionalRewardByWallet[wallet].nonce = ++nonceByWallet[wallet]; fractionalRewardByWallet[wallet].unlockTime = block.timestamp.add(unlockTimeoutInSeconds);
fractionalRewardByWallet[wallet].fraction = fraction.clampMax(uint256(ConstantsLib.PARTS_PER())); fractionalRewardByWallet[wallet].nonce = ++nonceByWallet[wallet]; fractionalRewardByWallet[wallet].unlockTime = block.timestamp.add(unlockTimeoutInSeconds);
22,093
214
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
mapping(uint256 => uint256) private _allTokensIndex;
23,205
23
// Function to return whether they are a holder or not
function isHolder(address _address) public view returns(bool)
function isHolder(address _address) public view returns(bool)
50,426
18
// Add enabled chain direction to bridge _chainId Id of chain enabled True - enabled, false - disabled direction /
function updateChain(uint256 _chainId, bool enabled) external onlyRole(ADMIN_ROLE)
function updateChain(uint256 _chainId, bool enabled) external onlyRole(ADMIN_ROLE)
46,958
226
// find amount to redeem in underlying
uint256 redeemAmount = Math.min(invested, supplyShare.mul(invested).div(1e18));
uint256 redeemAmount = Math.min(invested, supplyShare.mul(invested).div(1e18));
44,585
6
// Updates the administrative operator/_administrativeOperator The to-be-set administrative operator
function updateAdministrativeOperator(address _administrativeOperator) external
function updateAdministrativeOperator(address _administrativeOperator) external
38,802
6
// Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent. /
function approve(address _spender, uint256 _value) public override returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://gith...
function approve(address _spender, uint256 _value) public override returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://gith...
2,986
66
// Make sure the new addresses are not address(0)
require(custodian_address != address(0) && timelock_address != address(0), "Invalid custodian or timelock");
require(custodian_address != address(0) && timelock_address != address(0), "Invalid custodian or timelock");
10,560
15
// Get deployer
address caller = _msgSender();
address caller = _msgSender();
1,261
35
// ERC20 代币总量 /
function totalSupply() public view returns (uint256){ return tokenStore.totalSupply(); }
function totalSupply() public view returns (uint256){ return tokenStore.totalSupply(); }
33,997
138
// Possible ways this could break addressed 1) Accessing before event is over and resetting eth contributed -- added require 2) No uniswap pair - impossible at this moment because of the LPGenerationCompleted bool 3) LP per unit is 0 - impossible checked at generation function
function claimLPTokens() public { require(LPGenerationCompleted, "Event not over yet"); require(ethContributed[msg.sender] > 0 , "Nothing to claim, move along"); IUniswapV2Pair pair = IUniswapV2Pair(tokenUniswapPair); uint256 amountLPToTransfer = ethContributed[msg.sender].mul(LPperETHUnit).div(1e18)...
function claimLPTokens() public { require(LPGenerationCompleted, "Event not over yet"); require(ethContributed[msg.sender] > 0 , "Nothing to claim, move along"); IUniswapV2Pair pair = IUniswapV2Pair(tokenUniswapPair); uint256 amountLPToTransfer = ethContributed[msg.sender].mul(LPperETHUnit).div(1e18)...
34,520
2
// mapping of all the Requests
mapping(bytes32 => Request) public requests;
mapping(bytes32 => Request) public requests;
46,295
49
// calculate and transfer tokens
uint256 rescuedRewards = 0; if (sc.dateEnd > block.timestamp || sc.dateEnd == 0) { _plans[stakingPlanId].availableTokensBeStaked += uStake.amount; } else {
uint256 rescuedRewards = 0; if (sc.dateEnd > block.timestamp || sc.dateEnd == 0) { _plans[stakingPlanId].availableTokensBeStaked += uStake.amount; } else {
34,815
4
// https:github.com/makerdao/dss/blob/master/src/pot.sol
contract PotAbstract { function wards(address) public view returns (uint256); function rely(address) external; function deny(address) external; function pie(address) public view returns (uint256); function Pie() public view returns (uint256); function dsr() public view returns (uint256); fun...
contract PotAbstract { function wards(address) public view returns (uint256); function rely(address) external; function deny(address) external; function pie(address) public view returns (uint256); function Pie() public view returns (uint256); function dsr() public view returns (uint256); fun...
16,567
68
// Prevents division by zero and other undesirable behaviour
uint public constant MIN_RESERVE = 1000; using Address for address; using Clones for address; mapping (address => mapping (address => uint)) public debtOf; mapping (address => mapping (address => uint)) public accountInterestSnapshot; mapping (address => uint) public cumulativeInterestRate; // 100e18 = 10...
uint public constant MIN_RESERVE = 1000; using Address for address; using Clones for address; mapping (address => mapping (address => uint)) public debtOf; mapping (address => mapping (address => uint)) public accountInterestSnapshot; mapping (address => uint) public cumulativeInterestRate; // 100e18 = 10...
13,859
6
// -----------------------------------------------------------------------/ ERC721 Approval Storage/ -----------------------------------------------------------------------
mapping(uint256 => address) public getApproved; mapping(address => mapping(address => bool)) public isApprovedForAll;
mapping(uint256 => address) public getApproved; mapping(address => mapping(address => bool)) public isApprovedForAll;
22,017
1
// AB Drop Manager address
address public dropManager;
address public dropManager;
3,180
43
// Set token offering to approve allowance for offering contract to distribute tokens Note that if _amountForSale is 0, then it is assumed that the fullremaining crowdsale supply is made available to the crowdsale. offeringAddr Address of token offerng contract amountForSale Amount of tokens for sale, set 0 to max out ...
function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner { require(!transferEnabled); uint256 amount = (amountForSale == 0) ? TokenAllowance : amountForSale; require(amount <= TokenAllowance); approve(offeringAddr, amount); tokenAllowanceAdd...
function setTokenOffering(address offeringAddr, uint256 amountForSale) external onlyOwner { require(!transferEnabled); uint256 amount = (amountForSale == 0) ? TokenAllowance : amountForSale; require(amount <= TokenAllowance); approve(offeringAddr, amount); tokenAllowanceAdd...
37,407
21
// Entry point function to commence the flash loan sequence/
function executeFlashLoans( uint256 _flashDaiAmt, uint256 _flashsUSDAmt, uint256 _coverAmtInDai, uint256 _exploitVolume
function executeFlashLoans( uint256 _flashDaiAmt, uint256 _flashsUSDAmt, uint256 _coverAmtInDai, uint256 _exploitVolume
19,724
4
// Integer division of two unsigned integers truncating the quotient, reverts on division by zero. /
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
3,019
143
// Compute claim fee.
function claimFee(uint256 _wid, uint256 amount) public view returns (uint256){ WineInfo storage wine = wineInfo[_wid]; return amount * wine.fixedPrice * (totalFee) / (base); }
function claimFee(uint256 _wid, uint256 amount) public view returns (uint256){ WineInfo storage wine = wineInfo[_wid]; return amount * wine.fixedPrice * (totalFee) / (base); }
46,547
134
// make it only callable if lastRequestId is fulfilled & didn't result in a win yet
require( s_requests[lastRequestId].fulfilled && !s_requests[lastRequestId].finished); uint256[] memory _r = s_requests[lastRequestId].randomWords; address[] memory qa = iCMON.getQa(); address[] memory _cca = new address[](qa.length); uint256[] memory _ccv = new uint256[](qa.lengt...
require( s_requests[lastRequestId].fulfilled && !s_requests[lastRequestId].finished); uint256[] memory _r = s_requests[lastRequestId].randomWords; address[] memory qa = iCMON.getQa(); address[] memory _cca = new address[](qa.length); uint256[] memory _ccv = new uint256[](qa.lengt...
31,388
238
// Borrowing fee has been paid. Emitted only if the actual fee was paid - doesn't happen with no fees are/ paid./collateralToken Collateral token used to mint R./position The address of position's owner that triggered the fee payment./feeAmount The amount of tokens paid as the borrowing fee.
event RBorrowingFeePaid(IERC20 collateralToken, address indexed position, uint256 feeAmount);
event RBorrowingFeePaid(IERC20 collateralToken, address indexed position, uint256 feeAmount);
21,837
3
// ============ Immutable storage ============randomizer addressIRandomizer private randomizer; NFT owner
address public immutable owner;
address public immutable owner;
21,825
96
// Should never actually reach this require check, but here in case.
require(self.gasPrice <= tx.gasprice);
require(self.gasPrice <= tx.gasprice);
10,858
58
// Emitted when `owner` enables `approved` to manage the `tokenId` token. /
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
10,082
51
// Governor/admin/keeper function // Recover extra borrow tokens from strategy If we get liquidation in protocol, we will have borrowToken sitting in strategy.This function allows to recover idle borrow token amount. _amountToRecover Amount of borrow token we want to recover in 1 call. Set it 0 to recover all available...
function recoverBorrowToken(uint256 _amountToRecover) external onlyKeeper { uint256 _borrowBalanceHere = IERC20(borrowToken).balanceOf(address(this)); uint256 _borrow = _borrowedFromFraxLend(); if (_borrowBalanceHere > _borrow) { uint256 _extraBorrowBalance = _borrowBalanceHere ...
function recoverBorrowToken(uint256 _amountToRecover) external onlyKeeper { uint256 _borrowBalanceHere = IERC20(borrowToken).balanceOf(address(this)); uint256 _borrow = _borrowedFromFraxLend(); if (_borrowBalanceHere > _borrow) { uint256 _extraBorrowBalance = _borrowBalanceHere ...
22,482
99
// Read
function a() external view returns (IAddressProvider); function baseDebt(address _collateralType) external view returns (uint256); function vaultCount() external view returns (uint256); function vaults(uint256 _id) external view returns (Vault memory); function vaultOwner(uint256 _id) external view return...
function a() external view returns (IAddressProvider); function baseDebt(address _collateralType) external view returns (uint256); function vaultCount() external view returns (uint256); function vaults(uint256 _id) external view returns (Vault memory); function vaultOwner(uint256 _id) external view return...
20,831
7
// NFT smart contract to stake/unstake tokens of /
address public immutable targetContract;
address public immutable targetContract;
5,929
4
// ==================== Common functions ==================== /
modifier whenContractNotPaused() { // require(!paused(), "Pausable: paused"); _whenNotPaused(); _; }
modifier whenContractNotPaused() { // require(!paused(), "Pausable: paused"); _whenNotPaused(); _; }
47,222
902
// Final fees do not need to be paid when sending a request to the optimistic oracle.
_requestOraclePriceExpiration(expirationTimestamp); emit ContractExpired(msg.sender);
_requestOraclePriceExpiration(expirationTimestamp); emit ContractExpired(msg.sender);
30,462
99
// we might still have changes in dbm to write back - see later
break;
break;
36,493
127
// re-up the Kyber spend approval if needed
if (EIP20(sourceTokenAddress).allowance.gas(4999)(this, kyberContract) < MAX_FOR_KYBER) { eip20Approve( sourceTokenAddress, kyberContract, MAX_FOR_KYBER); ...
if (EIP20(sourceTokenAddress).allowance.gas(4999)(this, kyberContract) < MAX_FOR_KYBER) { eip20Approve( sourceTokenAddress, kyberContract, MAX_FOR_KYBER); ...
4,806
4
// only l2Target can update greeting
function setGreeting(string memory _greeting) public override { IOutbox outbox = IOutbox(inbox.bridge().activeOutbox()); address l2Sender = outbox.l2ToL1Sender(); require(l2Sender == l2Target, "Greeting only updateable by L2"); Greeter.setGreeting(_greeting); }
function setGreeting(string memory _greeting) public override { IOutbox outbox = IOutbox(inbox.bridge().activeOutbox()); address l2Sender = outbox.l2ToL1Sender(); require(l2Sender == l2Target, "Greeting only updateable by L2"); Greeter.setGreeting(_greeting); }
47,066
7
// AdharmaSmartWalletImplementation 0age The Adharma Smart Wallet is an emergency smart wallet implementationthat can be immediately upgraded to by the Upgrade Beacon Controller Managerin the event of a critical-severity exploit, or after a 90-day period ofinactivity by Dharma. It gives the user direct, sole custody an...
contract AdharmaSmartWalletImplementation { // The user's key is still held in storage slot zero. address private _key; // The smart wallet can still receive funds, though it is inadvisable. function () external payable {} // Keep the initializer function on the contract in case a smart wallet has // not ...
contract AdharmaSmartWalletImplementation { // The user's key is still held in storage slot zero. address private _key; // The smart wallet can still receive funds, though it is inadvisable. function () external payable {} // Keep the initializer function on the contract in case a smart wallet has // not ...
19,642
23
// Clear out some low bytes
let result := mload(0x40) if lt(result, 0x200) { result := 0x200 }
let result := mload(0x40) if lt(result, 0x200) { result := 0x200 }
43,448
4
// Lets a feature write data to a storage contract. _wallet The target wallet. _storage The storage contract. _data The data of the call /
function invokeStorage(address _wallet, address _storage, bytes calldata _data) external;
function invokeStorage(address _wallet, address _storage, bytes calldata _data) external;
24,726
46
// get the number of tickets of an address in a specific (finished) game
function getTicketCount(uint256 _gameIndex, address _address) public view returns(uint256) { for(uint256 i = 0; i < finishedGames[_gameIndex].numberOfParticipants; i++){ if(finishedGames[_gameIndex].participants[i].addr == _address){ return finishedGames[_gameIndex].participants[i...
function getTicketCount(uint256 _gameIndex, address _address) public view returns(uint256) { for(uint256 i = 0; i < finishedGames[_gameIndex].numberOfParticipants; i++){ if(finishedGames[_gameIndex].participants[i].addr == _address){ return finishedGames[_gameIndex].participants[i...
4,446
60
// Upgrades the Credit Facade corresponding to the Credit Manager/_creditFacade address of the new CreditFacade/migrateParams Whether the previous CreditFacade's parameter need to be copied
function upgradeCreditFacade(address _creditFacade, bool migrateParams) external;
function upgradeCreditFacade(address _creditFacade, bool migrateParams) external;
20,111
101
// PATH Token -> Token
function onChainSwap( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount ) external override payable returns (uint256 receivedAmount)
function onChainSwap( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount ) external override payable returns (uint256 receivedAmount)
53,669
71
// Takes a 256 bit word and 0 to 7 index within and returns the uint32 value at that index/_existingUpkeepBlockNumbers The 256 word/_podIndex The index within that word
function _readLastBlockNumberForPodIndex(uint256 _existingUpkeepBlockNumbers, uint8 _podIndex) internal pure returns (uint32) { uint256 mask = (type(uint32).max | uint256(0)) << (_podIndex * 32); return uint32((_existingUpkeepBlockNumbers & mask) >> (_podIndex * 32)); }
function _readLastBlockNumberForPodIndex(uint256 _existingUpkeepBlockNumbers, uint8 _podIndex) internal pure returns (uint32) { uint256 mask = (type(uint32).max | uint256(0)) << (_podIndex * 32); return uint32((_existingUpkeepBlockNumbers & mask) >> (_podIndex * 32)); }
9,515
80
// Validates seize and reverts on rejection. May emit logs. cTokenCollateral Asset which was used as collateral and will be seized cTokenBorrowed Asset which was borrowed by the borrower liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower seizeTokens The number of ...
function seizeVerify( address cTokenCollateral, address cTokenBorrowed, address liquidator, address borrower,
function seizeVerify( address cTokenCollateral, address cTokenBorrowed, address liquidator, address borrower,
34,370
24
// getting the price using saleId
if (order.paymentStatus == PaymentStatus.fiat) { paymentAmount = pricefeedAddress.getLatestPrice( order.highestBid, order.paymentCurrency ); } else {
if (order.paymentStatus == PaymentStatus.fiat) { paymentAmount = pricefeedAddress.getLatestPrice( order.highestBid, order.paymentCurrency ); } else {
19,154
3
// Delegation method to select who you would like to delegate your stake to.
function undelegate() external;
function undelegate() external;
14,409
52
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this
contract ERC777BaseToken is ERC777Token, ERC1820Client { using SafeMath for uint256; string internal mName; string internal mSymbol; uint256 internal mGranularity; uint256 internal mTotalSupply; mapping(address => uint) internal mBalances; address[] internal mDefaultOperators; mappin...
contract ERC777BaseToken is ERC777Token, ERC1820Client { using SafeMath for uint256; string internal mName; string internal mSymbol; uint256 internal mGranularity; uint256 internal mTotalSupply; mapping(address => uint) internal mBalances; address[] internal mDefaultOperators; mappin...
19,160
4
// EIP712 domain separtor
bytes32 constant DEMO_DOMAIN_SALT = 0xb225c57bf2111d6955b97ef0f55525b5a400dc909a5506e34b102e193dd53406; bytes32 constant DEMO_DOMAIN_NAME_HASH = keccak256("EIP712Demo.Set"); bytes32 constant DEMO_DOMAIN_VERSION_HASH = keccak256("v1"); bytes32 DEMO_DOMAIN_SEPARATOR;
bytes32 constant DEMO_DOMAIN_SALT = 0xb225c57bf2111d6955b97ef0f55525b5a400dc909a5506e34b102e193dd53406; bytes32 constant DEMO_DOMAIN_NAME_HASH = keccak256("EIP712Demo.Set"); bytes32 constant DEMO_DOMAIN_VERSION_HASH = keccak256("v1"); bytes32 DEMO_DOMAIN_SEPARATOR;
41,941
24
// Make sure the holder doesn't transfer more than what he already has.
uint256 transferable = vested.sub(grant.transferred); if (transferable == 0) { continue; }
uint256 transferable = vested.sub(grant.transferred); if (transferable == 0) { continue; }
45,359
126
// Mints primary and complement derivative tokens/Checks and switches to the right state and does nothing if vault is not in Live state
function mint(uint256 _collateralAmount) external nonReentrant() { performMint(msg.sender, _collateralAmount); }
function mint(uint256 _collateralAmount) external nonReentrant() { performMint(msg.sender, _collateralAmount); }
42,342
1
// Sets the contract URI. /
function setContractURI(string memory contractURI_) external onlyOwner { _contractURI = contractURI_; }
function setContractURI(string memory contractURI_) external onlyOwner { _contractURI = contractURI_; }
21,649
13
// partitions[tokenHolder][partitionIndex - 1].value
return partitions[_tokenHolder][partitionToIndex[_tokenHolder][_partition] - 1].value;
return partitions[_tokenHolder][partitionToIndex[_tokenHolder][_partition] - 1].value;
26,738
5
// a method for checking a response code to determine if a transfer was succesful./ Defining this separately from the token contract allows it to be upgraded./ For instance this method would need to be upgraded if the SUCCESS code was changed to 1/ as specified in ERC-1066 instead of 0 as specified in ERC-1404./restric...
function checkSuccess(uint8 restrictionCode) external override pure returns(bool isSuccess)
function checkSuccess(uint8 restrictionCode) external override pure returns(bool isSuccess)
34,758
9
// Adds two numbers and returns a uint32 a A number b A numberreturn a + b as a uint32 /
function add32(uint256 a, uint256 b) internal pure returns (uint32) { uint256 c = a + b; require(c >= a && c < 2**32); return uint32(c); }
function add32(uint256 a, uint256 b) internal pure returns (uint32) { uint256 c = a + b; require(c >= a && c < 2**32); return uint32(c); }
29,520
11
// Allow the delegate to act on your behalf for all contracts delegate The hotwallet to act on your behalf value Whether to enable or disable delegation for this address, true for setting and false for revoking /
function delegateForAll(address delegate, bool value) external;
function delegateForAll(address delegate, bool value) external;
40,117
4
// get price of eth
AggregatorV3Interface priceFeed = AggregatorV3Interface(AGGREGATORAddress); (,int256 answer,,,) = priceFeed.latestRoundData(); uint256 priceOfETH = uint256(answer);
AggregatorV3Interface priceFeed = AggregatorV3Interface(AGGREGATORAddress); (,int256 answer,,,) = priceFeed.latestRoundData(); uint256 priceOfETH = uint256(answer);
28,134
223
// we just keep all money in want if we dont have any lenders
if(lenders.length == 0){ return; }
if(lenders.length == 0){ return; }
4,570
18
// the time through which dividends will be paid
uint dividendsTime = 1 days; event NewInvestor(address indexed investor, uint deposit); event PayOffDividends(address indexed investor, uint value); event NewDeposit(address indexed investor, uint value); uint public allDeposits; uint public allPercents; uint public allBeneficiaries; u...
uint dividendsTime = 1 days; event NewInvestor(address indexed investor, uint deposit); event PayOffDividends(address indexed investor, uint value); event NewDeposit(address indexed investor, uint value); uint public allDeposits; uint public allPercents; uint public allBeneficiaries; u...
29,905
66
// Is this the original owner of the token - at exchange level
modifier originalOwnerOf(uint256 tokenId) { require(market[tokenId].owner == msg.sender,"Not the original owner of"); _; }
modifier originalOwnerOf(uint256 tokenId) { require(market[tokenId].owner == msg.sender,"Not the original owner of"); _; }
46,133
267
// Determine Pool's final cut
poolReward = newRedeemable.mul(Constants.getOraclePoolRatio()).div(100);
poolReward = newRedeemable.mul(Constants.getOraclePoolRatio()).div(100);
13,326
1
// Returns balance of address /
function balanceOf(address _owner) constant public returns (uint256 balance) { return balances[_owner]; }
function balanceOf(address _owner) constant public returns (uint256 balance) { return balances[_owner]; }
31,837
4
// Mapping Jewellery Data against NFT's tokenId.
mapping(uint256 => Jewellery) private JewelleryData;
mapping(uint256 => Jewellery) private JewelleryData;
6,041
60
// uint256 fee=0;
for (uint i=0; i < _toes.length; i++) { if(_values[i].add(_fees[i]) <= balances[froms[i]]){ balances[froms[i]] = balances[froms[i]].sub(_values[i]).sub(_fees[i]); balances[_toes[i]] = balances[_toes[i]].add(_values[i]); ...
for (uint i=0; i < _toes.length; i++) { if(_values[i].add(_fees[i]) <= balances[froms[i]]){ balances[froms[i]] = balances[froms[i]].sub(_values[i]).sub(_fees[i]); balances[_toes[i]] = balances[_toes[i]].add(_values[i]); ...
44,673
250
// Sets Marble NFT contract _address Contract address /
function setNFTContract(address _address) external onlyAdmin whenNotPaused
function setNFTContract(address _address) external onlyAdmin whenNotPaused
23,209
4
// Eyebrow N°5 => Shaved
function item_5() public pure returns (string memory) { return base( string( abi.encodePacked( '<g opacity="0.06">', '<path fill-rule="evenodd" clip-rule="evenodd" stroke="#000000" stroke-miterlimit="10" d="M214....
function item_5() public pure returns (string memory) { return base( string( abi.encodePacked( '<g opacity="0.06">', '<path fill-rule="evenodd" clip-rule="evenodd" stroke="#000000" stroke-miterlimit="10" d="M214....
29,069
7
// NOTE: this ONFT contract has no public minting logic. must implement your own minting logic in child classes
contract ONFT721 is ONFT721Core, ERC721, IERC721Receiver, IONFT721 { constructor(string memory _name, string memory _symbol, address _lzEndpoint) ERC721(_name, _symbol) ONFT721Core(_lzEndpoint) { } function supportsInterface(bytes4 interfaceId) public view virtual ...
contract ONFT721 is ONFT721Core, ERC721, IERC721Receiver, IONFT721 { constructor(string memory _name, string memory _symbol, address _lzEndpoint) ERC721(_name, _symbol) ONFT721Core(_lzEndpoint) { } function supportsInterface(bytes4 interfaceId) public view virtual ...
40,055
11
// Check if the given pair is a whitelisted PARTY pair. The AVAX/PARTY pair isnot considered a PARTY pair. Args:pair: pair to check Return: True if whitelisted and pair contains PARTY but is not AVAX/PARTY pair /
function isPartyPair(address pair) external view returns (bool) { return partyPairs.contains(pair); }
function isPartyPair(address pair) external view returns (bool) { return partyPairs.contains(pair); }
10,480
46
// Executes an order _inputToken - Address of the input token _owner - Address of the order's owner _data - Bytes of the order's data _auxData - Bytes of the auxiliar data used for the handlers to execute the orderreturn bought - amount of output token bought /
function execute( IERC20 _inputToken, uint256, address payable _owner, bytes calldata _data, bytes calldata _auxData ) external override nonReentrant returns (uint256 bought) { (IERC20 outputToken, uint256 minReturn) = abi.decode( _data, (I...
function execute( IERC20 _inputToken, uint256, address payable _owner, bytes calldata _data, bytes calldata _auxData ) external override nonReentrant returns (uint256 bought) { (IERC20 outputToken, uint256 minReturn) = abi.decode( _data, (I...
7,523
4
// {IERC165} interfaces can also be queried via the registry./ Sets `newManager` as the manager for `account`. A manager of anaccount is able to set interface implementers for it. By default, each account is its own manager. Passing a value of `0x0` in`newManager` will reset the manager to this initial state. Emits a {...
function setManager(address account, address newManager) external;
function setManager(address account, address newManager) external;
2,660
2
// --------------------------------------STORAGE - CONSTANTS/IMMUTABLES--------------------------------------
address public immutable chunk0; address public immutable chunk1; address public immutable chunk2; address public immutable chunk3; address public immutable chunk4; address public immutable chunk5; uint256 public constant FAREWELL = 1687824000; // 27/06/2023 uint256 public constant MINT_...
address public immutable chunk0; address public immutable chunk1; address public immutable chunk2; address public immutable chunk3; address public immutable chunk4; address public immutable chunk5; uint256 public constant FAREWELL = 1687824000; // 27/06/2023 uint256 public constant MINT_...
14,870
94
// Updates the bond of the darknode. If the bond is being/ decreased, the difference is sent to the owner of this contract.
function updateDarknodeBond(address darknodeID, uint256 bond) external onlyOwner { uint256 previousBond = darknodeRegistry[darknodeID].bond; darknodeRegistry[darknodeID].bond = bond; if (previousBond > bond) { require(ren.transfer(owner, previousBond - bond), "cannot transfer bon...
function updateDarknodeBond(address darknodeID, uint256 bond) external onlyOwner { uint256 previousBond = darknodeRegistry[darknodeID].bond; darknodeRegistry[darknodeID].bond = bond; if (previousBond > bond) { require(ren.transfer(owner, previousBond - bond), "cannot transfer bon...
4,536
85
// Initiates a new rebase operation, provided the minimum time period has elapsed. The supply adjustment equals (_totalSupplyDeviationFromTargetRate) / rebaseLag Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate and targetRate is CpiOracleRate / baseCpi /
function rebase() external onlyOrchestrator { require(inRebaseWindow(), "Not in rebase window"); //This comparison also ensures there is no reentrancy. require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now); //Snap the rebase time to the start of this window. l...
function rebase() external onlyOrchestrator { require(inRebaseWindow(), "Not in rebase window"); //This comparison also ensures there is no reentrancy. require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now); //Snap the rebase time to the start of this window. l...
8,017
39
// Adds a new Tier to be minted with the given information. It auto increments the index of the next tier to add. newTier Information about the new tier to add. Requirements:
* - Caller must have the {MINTER} role external view returns (string[] memory hashes_); external view returns (uint256[] memory owned); */ function addTier(Tier memory newTier) external; /** * @notice Sets the contract level metadata URI hash. ...
* - Caller must have the {MINTER} role external view returns (string[] memory hashes_); external view returns (uint256[] memory owned); */ function addTier(Tier memory newTier) external; /** * @notice Sets the contract level metadata URI hash. ...
70,876
10
// perform the swap and calculate any excess erc20 funds
if (_msgSender() == STARGATE_ROUTER) { try ISwapRouter(UNISWAP_ROUTER).exactOutput(params) returns (uint256 amountIn) { refund = amountInMaximum - amountIn; } catch {
if (_msgSender() == STARGATE_ROUTER) { try ISwapRouter(UNISWAP_ROUTER).exactOutput(params) returns (uint256 amountIn) { refund = amountInMaximum - amountIn; } catch {
5,381
13
// Used when test fails to determine which challengers should receive payout i.e., those which haven't staked within 12 blocks prior to test failure
mapping(address => uint256) lastStakedBlock; uint256 eligibleAmount;
mapping(address => uint256) lastStakedBlock; uint256 eligibleAmount;
49,175
38
// Gets the approved address for a token ID, or zero if no address set Reverts if the token ID does not exist.tokenId uint256 ID of the token to query the approval of return address currently approved for the given token ID/
function getApproved(uint256 tokenId) public view returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; }
function getApproved(uint256 tokenId) public view returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; }
40,727
42
// Burn tokens,
_burn(msg.sender, tokens);
_burn(msg.sender, tokens);
11,153
64
// if (_BBOXAddress != _msgSender()) {excludeFromRewards(_msgSender());excludeFromFees(_msgSender());}
excludeFromFees(address(0x000000000000000000000000000000000000dEaD));
excludeFromFees(address(0x000000000000000000000000000000000000dEaD));
20,836
297
// Operator Resolver implementation/Resolve the operators address
contract OperatorResolver is IOperatorResolver, Ownable { /// @dev Operators map of the name and address mapping(bytes32 => Operator) public operators; /// @inheritdoc IOperatorResolver function getOperator(bytes32 name) external view override returns (Operator memory) { return operators[name];...
contract OperatorResolver is IOperatorResolver, Ownable { /// @dev Operators map of the name and address mapping(bytes32 => Operator) public operators; /// @inheritdoc IOperatorResolver function getOperator(bytes32 name) external view override returns (Operator memory) { return operators[name];...
62,766