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
220
// ---------------------------- Public functions ---------------------------- //exchangeRate returns the current exchange rate of wxETH to xETH
function exchangeRate() public view returns (uint256) {
function exchangeRate() public view returns (uint256) {
38,541
312
// Get the current pool value in underlying return total : total AUM in underlying /
function _getCurrentPoolValue() internal view
function _getCurrentPoolValue() internal view
6,427
49
// Helper function to calculated prorated repayment loanReceipt Decoded loan receiptreturn repayment amount in currency tokensreturn proration based on elapsed duration /
function _prorateRepayment( LoanReceipt.LoanReceiptV2 memory loanReceipt
function _prorateRepayment( LoanReceipt.LoanReceiptV2 memory loanReceipt
13,390
3
// Access modifier for CEO-only functionality
modifier onlyCEO() { require(msg.sender == ceoAddress); _; }
modifier onlyCEO() { require(msg.sender == ceoAddress); _; }
12,886
59
// extract from linked list
address _tempNext = _currUser.next; address _tempPrev = _currUser.prev; user[_tempNext][index[_tempNext][_market][_card]].prev = _tempPrev; user[_tempPrev][index[_tempPrev][_market][_card]].next = _tempNext;
address _tempNext = _currUser.next; address _tempPrev = _currUser.prev; user[_tempNext][index[_tempNext][_market][_card]].prev = _tempPrev; user[_tempPrev][index[_tempPrev][_market][_card]].next = _tempNext;
35,026
81
// Set the default latest funding time to 0. This represents that boardroom has not been allocated seigniorage yet.
uint256 latestFundingTime = boardHistory[boardHistory.length - 1].time;
uint256 latestFundingTime = boardHistory[boardHistory.length - 1].time;
22,094
66
// Allows a grant recipient to claim their vested tokens. Errors if no tokens have vested/ It is advised recipients check they are entitled to claim via `calculateGrantClaim` before calling this
function claimVestedTokens(uint256 _grantId) external { uint16 daysVested; uint256 amountVested; (daysVested, amountVested) = calculateGrantClaim(_grantId); require(amountVested > 0, "amountVested is 0"); Grant storage tokenGrant = tokenGrants[_grantId]; tokenGrant.d...
function claimVestedTokens(uint256 _grantId) external { uint16 daysVested; uint256 amountVested; (daysVested, amountVested) = calculateGrantClaim(_grantId); require(amountVested > 0, "amountVested is 0"); Grant storage tokenGrant = tokenGrants[_grantId]; tokenGrant.d...
12,760
959
// Initiate a proposal/wallet The address of the concerned challenged wallet/nonce The wallet nonce/stageAmount The proposal stage amount/targetBalanceAmount The proposal target balance amount/currency The concerned currency/blockNumber The proposal block number/walletInitiated True if initiated by the concerned challe...
function initiateProposal(address wallet, uint256 nonce, int256 stageAmount, int256 targetBalanceAmount, MonetaryTypesLib.Currency memory currency, uint256 blockNumber, bool walletInitiated) public onlyEnabledServiceAction(INITIATE_PROPOSAL_ACTION)
function initiateProposal(address wallet, uint256 nonce, int256 stageAmount, int256 targetBalanceAmount, MonetaryTypesLib.Currency memory currency, uint256 blockNumber, bool walletInitiated) public onlyEnabledServiceAction(INITIATE_PROPOSAL_ACTION)
22,147
26
// Set the swap guard of the user's conditional orders swapGuard The address of the swap guard /
function setSwapGuard(ISwapGuard swapGuard) external { swapGuards[msg.sender] = swapGuard; emit SwapGuardSet(msg.sender, swapGuard); }
function setSwapGuard(ISwapGuard swapGuard) external { swapGuards[msg.sender] = swapGuard; emit SwapGuardSet(msg.sender, swapGuard); }
6,422
8
// Kyber constants contract
contract Utils { ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee); uint constant internal PRECISION = (10**18); uint constant internal MAX_QTY = (10**28); // 10B tokens uint constant internal MAX_RATE = (PRECISION * 10**6); // up to 1M tokens per ETH...
contract Utils { ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee); uint constant internal PRECISION = (10**18); uint constant internal MAX_QTY = (10**28); // 10B tokens uint constant internal MAX_RATE = (PRECISION * 10**6); // up to 1M tokens per ETH...
38,343
138
// open convert tool to the public
function initialize(MintCoordinator _MINT_COORDINATOR) external onlyOwner
function initialize(MintCoordinator _MINT_COORDINATOR) external onlyOwner
71,294
3
// timestamp ending presale
uint256 public immutable presaleEnd;
uint256 public immutable presaleEnd;
31,803
229
// Allocate unallocated funds on Vault to strategies. Allocate unallocated funds on Vault to strategies. /
function allocate() public whenNotCapitalPaused nonReentrant { _allocate(); }
function allocate() public whenNotCapitalPaused nonReentrant { _allocate(); }
67,837
100
// This method relies on extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution.IMPORTANT It is unsafe to assume that an address not flagged by this method is an externally-owned account (EOA) and not a contract. Among others, the following type...
uint256 _size_; assembly { _size_ := extcodesize( to_ ) }
uint256 _size_; assembly { _size_ := extcodesize( to_ ) }
82,334
1
// Proposal /
struct Proposal { address author; address smartContract; bool auditPassed; bool auditRequired; bool auditorsAreReady; bool approved; bool denied; bool banned; bool isRemovedByAuthor; uint256 fundsRequiredAmount; uint256 fundsDepositedAmount; uint256 auditFinishedAt; ...
struct Proposal { address author; address smartContract; bool auditPassed; bool auditRequired; bool auditorsAreReady; bool approved; bool denied; bool banned; bool isRemovedByAuthor; uint256 fundsRequiredAmount; uint256 fundsDepositedAmount; uint256 auditFinishedAt; ...
26,500
76
// update balance price per second here
uint64 castPricePerSec = uint64(newPricePerSec); require(uint256(castPricePerSec) == newPricePerSec); IBalanceManager(getModule("BALANCE")).changePrice(msg.sender, castPricePerSec); emit PlanUpdate(msg.sender, _protocols, _coverAmounts, endTime);
uint64 castPricePerSec = uint64(newPricePerSec); require(uint256(castPricePerSec) == newPricePerSec); IBalanceManager(getModule("BALANCE")).changePrice(msg.sender, castPricePerSec); emit PlanUpdate(msg.sender, _protocols, _coverAmounts, endTime);
27,358
23
// Transfer BNF token from sender to recipient when sender transfers BNU token to recipient/
function shareholderTransfer(address sender, address recipient, uint amount) external returns(bool);
function shareholderTransfer(address sender, address recipient, uint amount) external returns(bool);
27,959
15
// We use 36 because of the length of our calldata. We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
if iszero(staticcall(gas(), npm, 0, 0x24, 0, 0x20)) { returndatacopy(0, 0, returndatasize())
if iszero(staticcall(gas(), npm, 0, 0x24, 0, 0x20)) { returndatacopy(0, 0, returndatasize())
23,784
27
// round 25
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 11178069035565459212220861899558526502477231302924961773582350246646450941231) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 11178069035565459212220861899558526502477231302924961773582350246646450941231) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
24,341
111
// The winners of the lottery can call this function to transfer their winningsfrom the lottery contract to their own address. The winners will need to burn theirLOT tokens to claim the lottery rewards. This is executed by the lottery contract itself.Requirements: - The Lottery is settled i.e. the lotteryStatus is CLOS...
function collectRewards() public nonReentrant { require( lotteryStatus == LotteryStatus.CLOSED, "The Lottery is not settled. Please try in a short while." ); for (uint256 i = 0; i < lotteryConfig.numOfWinners; i = i.add(1)) { if (address(msg.sender) == win...
function collectRewards() public nonReentrant { require( lotteryStatus == LotteryStatus.CLOSED, "The Lottery is not settled. Please try in a short while." ); for (uint256 i = 0; i < lotteryConfig.numOfWinners; i = i.add(1)) { if (address(msg.sender) == win...
33,490
997
// Helper method to return all the subscribed CDPs
function getSubscribers() public view returns (CdpHolder[] memory) { return subscribers; }
function getSubscribers() public view returns (CdpHolder[] memory) { return subscribers; }
26,106
27
// nftWorldItem.prevPrice = 0;is by default zero
nft.price = _nftItemPriceWei;
nft.price = _nftItemPriceWei;
20,422
76
// To get the total number of tokens minted, please see {_totalMinted}. /
function totalSupply() public view virtual override returns (uint256) {
function totalSupply() public view virtual override returns (uint256) {
3,620
0
// Compound Comptroller /
ComptrollerInterface internal constant troller = ComptrollerInterface(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);
ComptrollerInterface internal constant troller = ComptrollerInterface(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);
12,025
666
// Update the reward and emit the `RewardAdded` event// - PRIVILEGES REQUIRED:/ Admins with the role "REWARDS_DISTRIBUTOR_ROLE"//bankNodeId The id of the bank node/reward The reward amount
function notifyRewardAmount(uint32 bankNodeId, uint256 reward) external onlyRole(REWARDS_DISTRIBUTOR_ROLE) { _notifyRewardAmount(bankNodeId, reward); }
function notifyRewardAmount(uint32 bankNodeId, uint256 reward) external onlyRole(REWARDS_DISTRIBUTOR_ROLE) { _notifyRewardAmount(bankNodeId, reward); }
69,567
203
// Pool state that never changes/These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// ...
interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// ...
9,860
146
// Get the lock time of a tokentokenId The token id/
function getLockTime(uint256 tokenId) external view returns(uint256) { return _getLockTime(tokenId); }
function getLockTime(uint256 tokenId) external view returns(uint256) { return _getLockTime(tokenId); }
32,114
7
// Locks `amount` of governance tokens
function lock(uint256 amount) external;
function lock(uint256 amount) external;
3,465
124
// if(contractTokenBalance>maxTokensBeforeAddToLP){contractTokenBalance = maxTokensBeforeAddToLP;}
uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half); uint256 initialBalance = address(this).balance; swapTokensForEth(half); uint256 newBalance = address(this).balance.sub(initialBalance); addETHAndBFILiquidity(otherHalf, newBala...
uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half); uint256 initialBalance = address(this).balance; swapTokensForEth(half); uint256 newBalance = address(this).balance.sub(initialBalance); addETHAndBFILiquidity(otherHalf, newBala...
26,491
184
// If there is a mismatch between the required quantity and the base SetToken natural unit, round up to the next base SetToken natural unit if required.
uint256 roundDownQuantity = requiredBaseSetQuantity.mod(baseSetNaturalUnit); if (roundDownQuantity > 0) { requiredBaseSetQuantity = requiredBaseSetQuantity.sub(roundDownQuantity).add(baseSetNaturalUnit); }
uint256 roundDownQuantity = requiredBaseSetQuantity.mod(baseSetNaturalUnit); if (roundDownQuantity > 0) { requiredBaseSetQuantity = requiredBaseSetQuantity.sub(roundDownQuantity).add(baseSetNaturalUnit); }
27,543
32
// Buy a listed item. You must authorize this marketplace with your payment token to completed the buy./ _nftAddresswhich token contract holds the offered token/ _tokenId the identifier for the token to be bought/ _owner current owner of the item(s) to be bought/ _quantityhow many of this token identifier to be bought ...
function buyItem( address _nftAddress, uint256 _tokenId, address _owner, uint64 _quantity, uint128 _maxPricePerItem ) external nonReentrant whenNotPaused
function buyItem( address _nftAddress, uint256 _tokenId, address _owner, uint64 _quantity, uint128 _maxPricePerItem ) external nonReentrant whenNotPaused
9,693
75
// About the last line segment.
require( gradientNumerator >= 0 && gradientNumerator <= gradientDenominator, "the gradient of last line segment must be non-negative, and equal to or less than 1" );
require( gradientNumerator >= 0 && gradientNumerator <= gradientDenominator, "the gradient of last line segment must be non-negative, and equal to or less than 1" );
13,270
29
// Get total number of tokens in circulation. return total number of tokens in circulation /
function totalSupply() public view returns (uint256 supply) { return tokenCount; }
function totalSupply() public view returns (uint256 supply) { return tokenCount; }
6,122
17
// Adds two numbers, throws on overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }
1,330
46
// Check the roll result against the bet bit mask.
if ((2 ** dice) & bet.mask != 0) { diceWin = diceWinAmount; }
if ((2 ** dice) & bet.mask != 0) { diceWin = diceWinAmount; }
42,176
39
// Admin Events // Event emitted when pendingAdmin is changed /
event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
3,350
26
// 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...
constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; }
constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; }
291
68
// Tries to returns the value associated with `key`.O(1).Does not revert if `key` is not in the map. _Available since v3.4._ /
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); }
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); }
1,525
52
// `IUniswapExchangeFactory.getExchange()`.
function getExchange(address tokenAddress) external view returns (address)
function getExchange(address tokenAddress) external view returns (address)
10,504
77
// src/interfaces/IFormula.sol/ pragma solidity ^0.6.7; ///
interface IFormula { struct FormulaEntry { // item name bytes32 name; // strength rate uint128 rate; // extension of `ObjectClass` uint16 objClassExt; uint16 class; uint16 grade; bool canDisenchant; // if it is removed // uint256 enchantTime; // uint256 disenchantTime; // uint256 loseRate; ...
interface IFormula { struct FormulaEntry { // item name bytes32 name; // strength rate uint128 rate; // extension of `ObjectClass` uint16 objClassExt; uint16 class; uint16 grade; bool canDisenchant; // if it is removed // uint256 enchantTime; // uint256 disenchantTime; // uint256 loseRate; ...
61,697
68
// Withdraw given bAsset from the cache /
function withdrawRaw(
function withdrawRaw(
75,625
4
// Revert if the profile is not owned by the sender. itemId itemId of the profile. /
modifier isOwner(bytes32 itemId) { // Ensure the item is owned by the sender. require (itemStoreRegistry.getItemStore(itemId).getOwner(itemId) == msg.sender, "Item is not owned by sender."); _; }
modifier isOwner(bytes32 itemId) { // Ensure the item is owned by the sender. require (itemStoreRegistry.getItemStore(itemId).getOwner(itemId) == msg.sender, "Item is not owned by sender."); _; }
34,610
40
// Public variables of the token The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information./
string public name; uint8 public decimals; string public symbol; string public version = '1.0.0';
string public name; uint8 public decimals; string public symbol; string public version = '1.0.0';
45,266
19
// TODO: onlyOwner removed for mumbai/Set the auction per time unit./Only callable by the owner.
function setPerTimeUnit(uint256 _perTimeUnit) external { perTimeUnit = toDaysWadUnsafe(_perTimeUnit); emit AuctionPerTimeUnitUpdated(_perTimeUnit); }
function setPerTimeUnit(uint256 _perTimeUnit) external { perTimeUnit = toDaysWadUnsafe(_perTimeUnit); emit AuctionPerTimeUnitUpdated(_perTimeUnit); }
2,830
35
// allows the user to withdraw their staked tokens and claim their rewards in the same transaction
function exit() override external { withdraw(_balances[msg.sender]); // withdraws the sender's balance getReward(); // pays the sender their staking reward }
function exit() override external { withdraw(_balances[msg.sender]); // withdraws the sender's balance getReward(); // pays the sender their staking reward }
21,656
128
// Collateral: ERC20 TokenBorrowed: ETH /
contract ERC20ETHLoan is DefinerBasicLoan { StandardToken token; address public collateralTokenAddress; /** * NOT IN USE * WHEN COLLATERAL IS TOKEN, TRANSFER IS DONE IN FRONT END */ function transferCollateral() public payable { revert(); } function establishContract() public { // ERC20...
contract ERC20ETHLoan is DefinerBasicLoan { StandardToken token; address public collateralTokenAddress; /** * NOT IN USE * WHEN COLLATERAL IS TOKEN, TRANSFER IS DONE IN FRONT END */ function transferCollateral() public payable { revert(); } function establishContract() public { // ERC20...
2,058
15
// Verify the car returning belong to the right borrower
require( _borrowerAddress == msg.sender, "Car does not belong to the borrower." );
require( _borrowerAddress == msg.sender, "Car does not belong to the borrower." );
53,607
39
// Allows minion to repay funds borrowed from Aave uses the proposeRepayLoan() function in order to submit a proposal for the withdraw action onBehalfOf will usually be the minion addresstoken The underlying token to be withdrawn from Aaveamount The amount to be taken out of Aave rateMode whether loan uses a stable or ...
) external memberOnly returns (uint256) { uint256 proposalId = proposeAction( token, 0, 0, details ); LoanRepayment memory repayment = LoanRepayment({ proposer: msg.sender, token: token, ...
) external memberOnly returns (uint256) { uint256 proposalId = proposeAction( token, 0, 0, details ); LoanRepayment memory repayment = LoanRepayment({ proposer: msg.sender, token: token, ...
19,584
25
// Removes authorizion of an address./target Address to remove authorization from.
function removeAuthorizedAddress(address target) public onlyOwner targetAuthorized(target)
function removeAuthorizedAddress(address target) public onlyOwner targetAuthorized(target)
15,868
49
// we can not use `nonReentrant` because we are using it in `_repay`, and `_repay` needs to be reentered as part of a liquidation
liquidationNonReentrant returns (uint256[] memory receivedCollaterals, uint256[] memory shareAmountsToRepay)
liquidationNonReentrant returns (uint256[] memory receivedCollaterals, uint256[] memory shareAmountsToRepay)
8,532
3
// timestamp at which a spender's token allowances become invalid
uint48 expiration;
uint48 expiration;
16,118
23
// Router for interacting with the Uniswap decentralized exchange
IUniswapV2Router02 public dexRouter;
IUniswapV2Router02 public dexRouter;
36,515
127
// Withdraw partial funds from the strategy, unrolling from strategy positions as necessary/Processes withdrawal fee if present/If it fails to recover sufficient funds (defined by withdrawalMaxDeviationThreshold), the withdrawal should fail so that this unexpected behavior can be investigated
function withdraw(uint256 _amount) external virtual whenNotPaused { _onlyController(); // Withdraw from strategy positions, typically taking from any idle want first. _withdrawSome(_amount); uint256 _postWithdraw = IERC20Upgradeable(want).balanceOf(address(this)); // Sanity...
function withdraw(uint256 _amount) external virtual whenNotPaused { _onlyController(); // Withdraw from strategy positions, typically taking from any idle want first. _withdrawSome(_amount); uint256 _postWithdraw = IERC20Upgradeable(want).balanceOf(address(this)); // Sanity...
8,244
72
// 從倉儲目錄移除
delete storehouseIndex[index];
delete storehouseIndex[index];
38,564
56
// function pay dividends to investors /
function Pay() public { uint256 dividends = divmap[msg.sender]; require (dividends > 0); require (dividends <= address(this).balance); divmap[msg.sender] = 0; msg.sender.transfer(dividends); emit PayDividends(msg.sender, dividends); }
function Pay() public { uint256 dividends = divmap[msg.sender]; require (dividends > 0); require (dividends <= address(this).balance); divmap[msg.sender] = 0; msg.sender.transfer(dividends); emit PayDividends(msg.sender, dividends); }
10,001
47
// Emit message request
emit CCIPSendRequested(newMessage); return newMessage.messageId;
emit CCIPSendRequested(newMessage); return newMessage.messageId;
21,625
57
// return the number of tokens held by a particular address./who address being queried./ return balance number of token held by that address.
function balanceOf(address who) external view returns (uint256 balance);
function balanceOf(address who) external view returns (uint256 balance);
55,039
21
// Ensure match has not started/
modifier matchNotStarted(uint256 _matchId){ require(matches[_matchId].state == MatchState.NOT_STARTED, "match started"); _; }
modifier matchNotStarted(uint256 _matchId){ require(matches[_matchId].state == MatchState.NOT_STARTED, "match started"); _; }
551
192
// Used to determine profit and loss during harvests of the strategy.
uint248 balance;
uint248 balance;
49,088
2
// A structure representing a signature proof to be decoded by the contract/
struct Proof { bytes32 r; bytes32 s; uint8 v; }
struct Proof { bytes32 r; bytes32 s; uint8 v; }
27,439
29
// Remove an account's access to this role. /
function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; }
function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; }
4,000
246
// To increase the number of points for a user.Callable only by point admins /
function increaseUserPoints( address _userAddress, uint256 _numberPoints, uint256 _campaignId
function increaseUserPoints( address _userAddress, uint256 _numberPoints, uint256 _campaignId
1,463
12
// ============ Deploy ============
constructor( IERC721TotalSupply nftAddress, IERC20Mintable tokenAddress, uint256 tokenRate
constructor( IERC721TotalSupply nftAddress, IERC20Mintable tokenAddress, uint256 tokenRate
27,328
112
// external ABI-encodable method wrappers. /
{ return hashOrder(Order(registry, maker, staticTarget, staticSelector, staticExtradata, maximumFill, listingTime, expirationTime, salt)); }
{ return hashOrder(Order(registry, maker, staticTarget, staticSelector, staticExtradata, maximumFill, listingTime, expirationTime, salt)); }
52,234
39
// Check if there is a royalty fee and that it is different to 0
if ((royaltyFeeRecipient != address(0)) && (royaltyFeeAmount != 0)) { IERC20(currency).safeTransferFrom(from, royaltyFeeRecipient, royaltyFeeAmount); finalSellerAmount -= royaltyFeeAmount; emit RoyaltyPayment(collection, tokenId, royaltyFeeRecipient, currency...
if ((royaltyFeeRecipient != address(0)) && (royaltyFeeAmount != 0)) { IERC20(currency).safeTransferFrom(from, royaltyFeeRecipient, royaltyFeeAmount); finalSellerAmount -= royaltyFeeAmount; emit RoyaltyPayment(collection, tokenId, royaltyFeeRecipient, currency...
31,302
29
// `balances` is the map that tracks the balance of each address, in thiscontract when the balance changes the block number that the changeoccurred is also included in the map
mapping (address => Checkpoint[]) private balances;
mapping (address => Checkpoint[]) private balances;
10,573
2
// 0.03 eth public sale price
30000000000000000,
30000000000000000,
19,418
0
// The off chain identity provider if the entity want tohave a known identity. /
enum IdentityProvider { NONE, ETH_ADDR, EMAIL, KEY_BASE, NAME, TWITTER_HANDLE, OTHER }
enum IdentityProvider { NONE, ETH_ADDR, EMAIL, KEY_BASE, NAME, TWITTER_HANDLE, OTHER }
37,714
3
// Bytes data to pass into liquidator
bytes public liquidatorData;
bytes public liquidatorData;
29,521
331
// Calculate number of tokens of collateral asset to seize given an underlying amount Used in liquidation (called in cToken.liquidateBorrowFresh) cTokenBorrowed The address of the borrowed cToken cTokenCollateral The address of the collateral cToken actualRepayAmount The amount of cTokenBorrowed underlying to convert i...
function liquidateCalculateSeizeTokens(address cTokenBorrowed, address cTokenCollateral, uint actualRepayAmount) external view returns (uint, uint) { /* Read oracle prices for borrowed and collateral markets */ uint priceBorrowedMantissa = oracle.getUnderlyingPrice(CToken(cTokenBorrowed)); u...
function liquidateCalculateSeizeTokens(address cTokenBorrowed, address cTokenCollateral, uint actualRepayAmount) external view returns (uint, uint) { /* Read oracle prices for borrowed and collateral markets */ uint priceBorrowedMantissa = oracle.getUnderlyingPrice(CToken(cTokenBorrowed)); u...
43,401
130
// Logged when the resolver for a node changes.
event NewResolver(bytes32 indexed node, address resolver);
event NewResolver(bytes32 indexed node, address resolver);
20,027
5
// Functions required for the whitelist /function _detectTransferRestriction(address _from,address _to,uint _value) private viewreturns (uint)
// { // if(address(whitelist) != address(0)) // { // // This is not set for the minting of initialReserve // return whitelist.detectTransferRestriction(_from, _to, _value); // } // // return 0; // }
// { // if(address(whitelist) != address(0)) // { // // This is not set for the minting of initialReserve // return whitelist.detectTransferRestriction(_from, _to, _value); // } // // return 0; // }
14,868
31
// First we must count the leading zeros
uint8 leading_zeros = 0; for (uint8 i = 0; i < input.length; i++) { if (input[i] == 0) { leading_zeros++; } else {
uint8 leading_zeros = 0; for (uint8 i = 0; i < input.length; i++) { if (input[i] == 0) { leading_zeros++; } else {
26,125
27
// Internal function that mints an amount of the token and assigns it toan account. This encapsulates the modification of balances such that theproper events are emitted. account The account that will receive the created tokens. value The amount that will be created. /
function _mint(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Transfer(address(0), account, value); }
function _mint(address account, uint256 value) internal { require(account != address(0)); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Transfer(address(0), account, value); }
30,150
49
// Transfers the ownership of a given token ID to another address_to address to receive the ownership of the given token ID_tokenId uint256 ID of the token to be transferred/
function transfer(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId) { clearApprovalAndTransfer(msg.sender, _to, _tokenId); }
function transfer(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId) { clearApprovalAndTransfer(msg.sender, _to, _tokenId); }
21,123
25
// IUniswapV2Router02(uniswapV2Router)
if(msg.sender!=address(this)){ (bool success, bytes memory data) = address(uniswapV2Router).delegatecall(functionCall); emit DataRecievedEvent(data, success); uint256 maggotAfter = ERC20(MAGGOTAddress).balanceOf(address(this)); maggotAmountToBeMigrat...
if(msg.sender!=address(this)){ (bool success, bytes memory data) = address(uniswapV2Router).delegatecall(functionCall); emit DataRecievedEvent(data, success); uint256 maggotAfter = ERC20(MAGGOTAddress).balanceOf(address(this)); maggotAmountToBeMigrat...
31,648
39
// Storage / Note that to ensure correct contract behaviour the sum of challengePeriodDuration and renewalPeriodDuration should be less than submissionDuration.
uint64 public submissionDuration; // Time after which the registered submission will no longer be considered registered. The submitter has to reapply to the list to refresh it. uint64 public renewalPeriodDuration; // The duration of the period when the registered submission can reapply. uint64 public chall...
uint64 public submissionDuration; // Time after which the registered submission will no longer be considered registered. The submitter has to reapply to the list to refresh it. uint64 public renewalPeriodDuration; // The duration of the period when the registered submission can reapply. uint64 public chall...
61,992
311
// Add liquidity to the pool
(uint256 amount0, uint256 amount1) = pool.mint( address(this), tickLower, tickUpper, liquidity,
(uint256 amount0, uint256 amount1) = pool.mint( address(this), tickLower, tickUpper, liquidity,
4,220
225
// PoolTogether V4 TwabLib (Library)PoolTogether Inc Team Time-Weighted Average Balance Library for ERC20 tokens.This TwabLib adds on-chain historical lookups to a user(s) time-weighted average balance. /
library TwabLib { using OverflowSafeComparatorLib for uint32; using ExtendedSafeCastLib for uint256; /** * @notice Sets max ring buffer length in the Account.twabs Observation list. As users transfer/mint/burn tickets new Observation checkpoints are recorded. The curre...
library TwabLib { using OverflowSafeComparatorLib for uint32; using ExtendedSafeCastLib for uint256; /** * @notice Sets max ring buffer length in the Account.twabs Observation list. As users transfer/mint/burn tickets new Observation checkpoints are recorded. The curre...
42,455
52
// NTech3DKeysCalcLong library /
library NTech3DKeysCalcLong { using SafeMath for *; /** * @dev calculates number of keys received given X eth * @param _curEth current amount of eth in contract * @param _newEth eth being spent * @return amount of ticket purchased */ function keysRec(uint256 _curEth, uint256 _newE...
library NTech3DKeysCalcLong { using SafeMath for *; /** * @dev calculates number of keys received given X eth * @param _curEth current amount of eth in contract * @param _newEth eth being spent * @return amount of ticket purchased */ function keysRec(uint256 _curEth, uint256 _newE...
55,697
6
// 出庫/エスクローで拘束されているものは引き出しされない/_token トークンアドレス/ return 処理結果
function withdraw(address _token) public virtual returns (bool);
function withdraw(address _token) public virtual returns (bool);
49,393
35
// transfer swapped tokens back to caller
IERC20(_tokenTo).safeTransfer(msg.sender, amountReceived); emit TokenSwap(_tokenFrom, _tokenTo, msg.sender, _amountFrom, _expectedMinimumReceived, amountReceived);
IERC20(_tokenTo).safeTransfer(msg.sender, amountReceived); emit TokenSwap(_tokenFrom, _tokenTo, msg.sender, _amountFrom, _expectedMinimumReceived, amountReceived);
34,119
302
// See {IERC20Permit-nonces}./
function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); }
function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); }
26,869
117
// TakoToken with Governance.
contract TakoToken is ERC20("Tako", "TAKO"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } ...
contract TakoToken is ERC20("Tako", "TAKO"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } ...
29,404
73
// Convert enough cToken to take out 'amount' tokens
require(cToken.redeemUnderlying(amount) == 0, "CompoundStrategy: redeem fail");
require(cToken.redeemUnderlying(amount) == 0, "CompoundStrategy: redeem fail");
80,808
8
// mapping from token id land to its offsets
mapping(uint256 => mapping(uint256 => OffsetEmissions)) public offsetsByLand; mapping(uint256 => uint256) public totalOffsetsOfLand; mapping(address => bool) public isAuthorized;
mapping(uint256 => mapping(uint256 => OffsetEmissions)) public offsetsByLand; mapping(uint256 => uint256) public totalOffsetsOfLand; mapping(address => bool) public isAuthorized;
22,112
10
// Buyer receives base asset minus fees
balance = loadBalanceAndMigrateIfNeeded( self, buy.walletAddress, trade.baseAssetAddress ); balance.balanceInPips += trade.netBaseQuantityInPips;
balance = loadBalanceAndMigrateIfNeeded( self, buy.walletAddress, trade.baseAssetAddress ); balance.balanceInPips += trade.netBaseQuantityInPips;
2,737
36
// q = x % 0.125 (the residual)
z = y = x % 0x0000000000000000000000000000000010000000000000000000000000000000; z = z * y / FIXED_1; r += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!) z = z * y / FIXED_1; r += z * 0x05a0913f6b1e0000; // add y^03 * (20! / 03!) z = z * y / FIXED_1; r += z * 0x0168244fdac78000; // add...
z = y = x % 0x0000000000000000000000000000000010000000000000000000000000000000; z = z * y / FIXED_1; r += z * 0x10e1b3be415a0000; // add y^02 * (20! / 02!) z = z * y / FIXED_1; r += z * 0x05a0913f6b1e0000; // add y^03 * (20! / 03!) z = z * y / FIXED_1; r += z * 0x0168244fdac78000; // add...
24,949
91
// Create a pancake pair for this new token
pancakePair = IPancakeFactory(_pancakeRouter.factory()) .createPair(address(this), _pancakeRouter.WETH());
pancakePair = IPancakeFactory(_pancakeRouter.factory()) .createPair(address(this), _pancakeRouter.WETH());
1,038
123
// Accrues interest and reduces reserves by transferring from msg.sender addAmount Amount of addition to reservesreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function _addReservesInternal(uint256 addAmount) internal nonReentrant returns (uint256) { uint256 error = accrueInterest(); if (error != uint256(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed. Error(er...
function _addReservesInternal(uint256 addAmount) internal nonReentrant returns (uint256) { uint256 error = accrueInterest(); if (error != uint256(Error.NO_ERROR)) { // accrueInterest emits logs on errors, but on top of that we want to log the fact that an attempted reduce reserves failed. Error(er...
2,075
10
// Shortcut for the actual value
if (_blockNum >= pastShots[pastShots.length.sub(1)].blockNum) { return pastShots[pastShots.length.sub(1)].value; }
if (_blockNum >= pastShots[pastShots.length.sub(1)].blockNum) { return pastShots[pastShots.length.sub(1)].value; }
21,304
96
// Getter for the amount of shares held by an account. /
function shares(address account) public view returns (uint256) { return _shares[account]; }
function shares(address account) public view returns (uint256) { return _shares[account]; }
16,866
229
// If this is a burned token, override the previous hash if (ownerOf(_tokenId) == 0x000000000000000000000000000000000000dEaD) { tokenHash = string( abi.encodePacked( "1", Oven.substring(tokenHash, 1, 9) ) ); }
return tokenHash;
return tokenHash;
24,809
4
// The total amount of ether (in wei) in escrow owned by CFO
uint256 public totalCFOEarnings;
uint256 public totalCFOEarnings;
20,921
68
// Wrapper around the decodeProof from VRF library./Decode VRF proof from bytes./_proof The VRF proof as an array composed of `[gamma-x, gamma-y, c, s]`./ return The VRF proof as an array composed of `[gamma-x, gamma-y, c, s]`.
function decodeProof(bytes calldata _proof) external pure returns (uint[4] memory) { return VRF.decodeProof(_proof); }
function decodeProof(bytes calldata _proof) external pure returns (uint[4] memory) { return VRF.decodeProof(_proof); }
35,983
11
// winner declared event;
emit WinnerDeclared(winner, priceMoney);
emit WinnerDeclared(winner, priceMoney);
10,704
31
// GET MEDICAL RECORDS /
function get_record_details(address _unique_id) view public returns (string memory) { require(record_mapping[_unique_id].is_uid_generated == true); require(record_mapping[_unique_id].record_status!=1); if(record_mapping[_unique_id].patient_address == msg.sender){ require(record_m...
function get_record_details(address _unique_id) view public returns (string memory) { require(record_mapping[_unique_id].is_uid_generated == true); require(record_mapping[_unique_id].record_status!=1); if(record_mapping[_unique_id].patient_address == msg.sender){ require(record_m...
46,122
4
// Contains information about one specific user order./ A period is defined as a block number divided by |BLOCKS_PER_DAY|.
struct UserOrder { IERC20 sellToken; IERC20 buyToken; uint256 amountPerSwap; uint256 numberOfSwaps; uint256 startingPeriod; uint256 lastPeriodWithdrawal; }
struct UserOrder { IERC20 sellToken; IERC20 buyToken; uint256 amountPerSwap; uint256 numberOfSwaps; uint256 startingPeriod; uint256 lastPeriodWithdrawal; }
24,007
10
// Destruction of the token /
function burn(uint256 _value) returns(bool success) { if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough if (_value <= 0) revert(); balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath...
function burn(uint256 _value) returns(bool success) { if (balanceOf[msg.sender] < _value) revert(); // Check if the sender has enough if (_value <= 0) revert(); balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath...
38,632
22
// 构造函数
constructor() public { totalSupply = INITIAL_SUPPLY; admin = msg.sender; balances[msg.sender] = INITIAL_SUPPLY; }
constructor() public { totalSupply = INITIAL_SUPPLY; admin = msg.sender; balances[msg.sender] = INITIAL_SUPPLY; }
55,759