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
40
// Date and Time utilities for ethereum contracts /
contract DateTime { struct _DateTime { uint16 year; uint8 month; uint8 day; uint8 hour; uint8 minute; uint8 second; uint8 weekday; } uint constant DAY_IN_SECONDS = 86400; ui...
contract DateTime { struct _DateTime { uint16 year; uint8 month; uint8 day; uint8 hour; uint8 minute; uint8 second; uint8 weekday; } uint constant DAY_IN_SECONDS = 86400; ui...
45,583
33
// Transfers asset balance from the caller to specified ICAP adding specified comment.Resolves asset implementation contract for the caller and forwards there arguments along withthe caller address._icap recipient ICAP to give to. _value amount to transfer. _reference transfer comment to be included in a EToken2's Tran...
function transferToICAPWithReference(bytes32 _icap, uint _value, string _reference) public returns(bool) { return _getAsset()._performTransferToICAPWithReference(_icap, _value, _reference, msg.sender); }
function transferToICAPWithReference(bytes32 _icap, uint _value, string _reference) public returns(bool) { return _getAsset()._performTransferToICAPWithReference(_icap, _value, _reference, msg.sender); }
70,815
325
// Hero cooldown time. (Default value: 60 mins.)
uint256 public coolHero = 3600;
uint256 public coolHero = 3600;
41,887
103
// Address `addr` will no longer incur the `_burnRatePerTransferThousandth`/1000 burn on Transfers from it./addr Address to whitelist / dewhitelist /whitelisted True to add to whitelist, false to remove.
function setBurnWhitelistFromAddress (address addr, bool whitelisted) external onlyOwner { if(whitelisted) { _burnWhitelistFrom[addr] = whitelisted; emit AddedToWhitelistFrom(addr); } else { delete _burnWhitelistFrom[addr]; emit RemovedFromWhitelistFro...
function setBurnWhitelistFromAddress (address addr, bool whitelisted) external onlyOwner { if(whitelisted) { _burnWhitelistFrom[addr] = whitelisted; emit AddedToWhitelistFrom(addr); } else { delete _burnWhitelistFrom[addr]; emit RemovedFromWhitelistFro...
15,138
4
// a loan. It also includes the internal function {_takeOutLoanProcessNFTs} that See {MainnetCreateLoanWithNFTFacet._takeOutLoanProcessNFTs} TELLER NFT V2
TellerNFT_V2 private immutable TELLER_NFT_V2; constructor(address tellerNFTV2Address) { TELLER_NFT_V2 = TellerNFT_V2(tellerNFTV2Address); }
TellerNFT_V2 private immutable TELLER_NFT_V2; constructor(address tellerNFTV2Address) { TELLER_NFT_V2 = TellerNFT_V2(tellerNFTV2Address); }
51,441
71
// 5. RoundC
else if (RoundBHardCap <= RoundBSold && RoundCSold < RoundCHardCap) { return 5; }
else if (RoundBHardCap <= RoundBSold && RoundCSold < RoundCHardCap) { return 5; }
63,267
42
// view how much of the origin currency the target currency will take/_origin the address of the origin/_target the address of the target/_targetAmount the target amount/ return originAmount_ the amount of target that has been swapped for the origin
function viewTargetSwap( address _origin, address _target, uint256 _targetAmount
function viewTargetSwap( address _origin, address _target, uint256 _targetAmount
29,917
4
// Operator Data Flags // Flag used in operator data parameters to indicate the transfer is a withdrawal /
bytes32
bytes32
41,798
18
// Returns the amount of tokens owned by `account`. /
function balanceOf(address account) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
16
5
// This event will be emitted every time the implementation gets upgraded implementation representing the address of the upgraded implementation /
event Upgraded(address indexed implementation, uint256 version);
event Upgraded(address indexed implementation, uint256 version);
12,293
18
// ------------------------------------------------------------------------ Get the token balance for account tokenOwner ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public override view returns (uint balance) { return balances[tokenOwner]; }
function balanceOf(address tokenOwner) public override view returns (uint balance) { return balances[tokenOwner]; }
1,799
83
// Burns a specific amount of tokens and emit transfer event for native chain to The address to transfer to in the native chain. value The amount of token to be burned. /
function transferToNative(bytes32 to, uint256 value) public { _burn(msg.sender, value); emit TransferToNative(msg.sender, to, value); }
function transferToNative(bytes32 to, uint256 value) public { _burn(msg.sender, value); emit TransferToNative(msg.sender, to, value); }
15,154
455
// We store the `bptAmount` in the previous slot to the `tokenAmounts` array. We can make sure there will be at least one available slot due to how the memory scratch space works. We can safely overwrite whatever is stored in this slot as we will revert immediately after that.
let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount)
let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount)
1,761
1
// contract properties
uint _ticketPrice = 0.05 ether; // wei uint _commission = 30; // percents uint[12] _rewards = [0, 0, 0, 0, 0, 0, 0, 14, 16, 20, 24, 26]; // as map [guessedEvents => rewardPercents] uint _commissionFunds; uint _accumulatedFunds;
uint _ticketPrice = 0.05 ether; // wei uint _commission = 30; // percents uint[12] _rewards = [0, 0, 0, 0, 0, 0, 0, 14, 16, 20, 24, 26]; // as map [guessedEvents => rewardPercents] uint _commissionFunds; uint _accumulatedFunds;
6,018
148
// Blacklist participant so they cannot make further purchases
blacklist[participant] = true; AddedToBlacklist(participant, now); stages.refundParticipant(_stage1, _stage2, _stage3, _stage4); TokensReclaimed(participant, tokens, now);
blacklist[participant] = true; AddedToBlacklist(participant, now); stages.refundParticipant(_stage1, _stage2, _stage3, _stage4); TokensReclaimed(participant, tokens, now);
48,193
131
// Verifies that the game exists/_gameId ID of the game/ return game Storage value of game info
function _verify(uint40 _gameId) internal view returns (Game storage game) { game = games[_gameId]; // Reverts if game does not exist due to invalid ID or canceled game if (_gameId == 0 || _gameId > currentId || game.p1.player == address(0)) revert InvalidGame(); }
function _verify(uint40 _gameId) internal view returns (Game storage game) { game = games[_gameId]; // Reverts if game does not exist due to invalid ID or canceled game if (_gameId == 0 || _gameId > currentId || game.p1.player == address(0)) revert InvalidGame(); }
36,152
124
// The market's last updated rewardBorrowIndex or rewardSupplyIndex
uint224 index;
uint224 index;
19,740
121
// Check if token transfer is free of any charge or not. return true if transfer is free of any charge./
function freeTransfer() public view returns (bool isTransferFree) { return transferFeePaymentFinished || transferFeePercentage == 0; }
function freeTransfer() public view returns (bool isTransferFree) { return transferFeePaymentFinished || transferFeePercentage == 0; }
31,999
3
// Invalid caller /
error InvalidCaller();
error InvalidCaller();
13,515
463
// Note: computing the current round is required to disallow people from revealing an old commit after the round is over.
uint256 roundId = voteTiming.computeCurrentRoundId(getCurrentTime()); PriceRequest storage priceRequest = _getPriceRequest(identifier, time, ancillaryData); VoteInstance storage voteInstance = priceRequest.voteInstances[roundId]; VoteSubmission storage voteSubmission = voteInstance.vote...
uint256 roundId = voteTiming.computeCurrentRoundId(getCurrentTime()); PriceRequest storage priceRequest = _getPriceRequest(identifier, time, ancillaryData); VoteInstance storage voteInstance = priceRequest.voteInstances[roundId]; VoteSubmission storage voteSubmission = voteInstance.vote...
9,203
197
// grab crew stats and merge with ship
uint8[STATS_SIZE] memory _crewStats = ethernautsStorage.getStats(_crewTokenId); _shipStats[uint256(ShipStats.Range)] += _crewStats[uint256(ShipStats.Range)]; _shipStats[uint256(ShipStats.Speed)] += _crewStats[uint256(ShipStats.Speed)]; if (_shipStats[uint256(ShipStats.Ra...
uint8[STATS_SIZE] memory _crewStats = ethernautsStorage.getStats(_crewTokenId); _shipStats[uint256(ShipStats.Range)] += _crewStats[uint256(ShipStats.Range)]; _shipStats[uint256(ShipStats.Speed)] += _crewStats[uint256(ShipStats.Speed)]; if (_shipStats[uint256(ShipStats.Ra...
63,207
39
// Withdraw token (assets of our contract) for a specified address token The address of token for transfer _to The address to transfer to amount The amount to be transferred /
function withdrawToken(address token, address _to, uint256 amount) onlyOwner public returns (bool) { require(token != address(0)); require(Erc20Basic(token).balanceOf(address(this)) >= amount); bool transferOk = Erc20Basic(token).transfer(_to, amount); require(transferOk); re...
function withdrawToken(address token, address _to, uint256 amount) onlyOwner public returns (bool) { require(token != address(0)); require(Erc20Basic(token).balanceOf(address(this)) >= amount); bool transferOk = Erc20Basic(token).transfer(_to, amount); require(transferOk); re...
23,662
20
// Get a storefront information by index._owner the address of store owner._index a index of storefront. return name The name of storefront. return isOpen The status of storefront./
function getFrontAtIndex(address _owner, uint _index) public view returns(string memory name, bool isOpen) { require(isStore[_owner], "the owner's store doesn't exist"); Store storage s = stores[_owner]; require(_index < s.frontKeys.length, "out of index."); Front memory f = s.fronts[s.frontKe...
function getFrontAtIndex(address _owner, uint _index) public view returns(string memory name, bool isOpen) { require(isStore[_owner], "the owner's store doesn't exist"); Store storage s = stores[_owner]; require(_index < s.frontKeys.length, "out of index."); Front memory f = s.fronts[s.frontKe...
36,588
150
// Set number of tokens to sell to nativeTokenAmount
contractTokenBalance = nativeTokenAmount; swapTokens(contractTokenBalance); swapping = false;
contractTokenBalance = nativeTokenAmount; swapTokens(contractTokenBalance); swapping = false;
15,609
216
// __ERC721_init("swng", "swng");
__ERC721_init("Vending Machines Tycoon", "VMT"); royaltyPercentage = _royaltyPercentage; _owner = _contractOwner; _mintRoyaltiesAddr = _mintRoyaltyReceiver; _buyRoyaltiesAddr = _buyRoyaltyReceiver; mintFeeAmount = _mintFeeAmount; excludedList[_buyRoyaltyReceiver] ...
__ERC721_init("Vending Machines Tycoon", "VMT"); royaltyPercentage = _royaltyPercentage; _owner = _contractOwner; _mintRoyaltiesAddr = _mintRoyaltyReceiver; _buyRoyaltiesAddr = _buyRoyaltyReceiver; mintFeeAmount = _mintFeeAmount; excludedList[_buyRoyaltyReceiver] ...
23,207
25
// set ETH/USD Price Feed
priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
26,573
21
// Acceptable duration is between 1 - 30 days
revert TokenVault_InvalidDuration();
revert TokenVault_InvalidDuration();
10,721
137
// Reverts if not running in test mode. /
modifier onlyIfTest { require(timerAddress != address(0x0)); _; }
modifier onlyIfTest { require(timerAddress != address(0x0)); _; }
17,134
44
// Amalgamate lending metadata with strategy metadata
function augmentStratMetadata(IStrategy.StrategyMetadata[] memory stratMeta) public view returns (ILStrategyMetadata[] memory)
function augmentStratMetadata(IStrategy.StrategyMetadata[] memory stratMeta) public view returns (ILStrategyMetadata[] memory)
5,457
23
// Chainlink: rETH/ETH
return 0x536218f9E9Eb48863970252233c8F271f554C2d0;
return 0x536218f9E9Eb48863970252233c8F271f554C2d0;
10,940
79
// The block number when Reward mining ends.
uint256 public endBlock; event feeAddressUpdated(address); event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw( address indexed user, uint256 indexed pid, ...
uint256 public endBlock; event feeAddressUpdated(address); event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw( address indexed user, uint256 indexed pid, ...
7,459
166
// Provide a reasonable value for `tokenPriceInWei` when it would otherwise revert, using the starting price before auction starts.
tokenPriceInWei = _projectConfig.startPrice;
tokenPriceInWei = _projectConfig.startPrice;
37,845
36
// The block at which voting ends: votes must be cast prior to this block
uint256 endBlock;
uint256 endBlock;
5,871
3
// Goerli has a max gas limit of 2.5 million, we'll cap out at 200000, enough for about 10 words
uint32 callbackGasLimit = 200000;
uint32 callbackGasLimit = 200000;
13,354
73
// Instantiate quadron
qToken = IQuadron(_quadron);
qToken = IQuadron(_quadron);
5,307
8
// A base contract to be inherited by any contract that want to receive forwarded transactions.The contract designed to be stateless, it supports a scenario when a inherited contract isTrustedForwarder and Recipient at the same time. The contract supports token based nonce, that is why standard calldata extended by tok...
* Forwarded calldata layout: {bytes:data}{address:from}{uint256:tokenId} */ abstract contract ERC2771RegistryContext is Initializable, ContextUpgradeable { // solhint-disable-next-line func-name-mixedcase function __ERC2771RegistryContext_init() internal onlyInitializing { __Context_init_unchained(); ...
* Forwarded calldata layout: {bytes:data}{address:from}{uint256:tokenId} */ abstract contract ERC2771RegistryContext is Initializable, ContextUpgradeable { // solhint-disable-next-line func-name-mixedcase function __ERC2771RegistryContext_init() internal onlyInitializing { __Context_init_unchained(); ...
43,936
11
// We add half the scale before dividing so that we get rounding instead of truncation.See "Listing 6" and text above it at https:accu.org/index.php/journals/1717 Without this change, a result like 6.6...e-19 will be truncated to 0 instead of being rounded to 1e-18.
(CarefulMath.MathError err1, uint doubleScaledProductWithHalfScale) = CarefulMath.addUInt(ExponentialNoError.halfExpScale, doubleScaledProduct); if (err1 != CarefulMath.MathError.NO_ERROR) { return (err1, ExponentialNoError.Exp({mantissa: 0}));
(CarefulMath.MathError err1, uint doubleScaledProductWithHalfScale) = CarefulMath.addUInt(ExponentialNoError.halfExpScale, doubleScaledProduct); if (err1 != CarefulMath.MathError.NO_ERROR) { return (err1, ExponentialNoError.Exp({mantissa: 0}));
7,002
15
// Unfortunately we can't create this array outright because Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning index-by-index circumvents this issue.
raw[0] = Lib_RLPWriter.writeBytes( Lib_Bytes32Utils.removeLeadingZeros( bytes32(_account.nonce) ) ); raw[1] = Lib_RLPWriter.writeBytes( Lib_Bytes32Utils.removeLeadingZeros( bytes32(_account.balance) ) );
raw[0] = Lib_RLPWriter.writeBytes( Lib_Bytes32Utils.removeLeadingZeros( bytes32(_account.nonce) ) ); raw[1] = Lib_RLPWriter.writeBytes( Lib_Bytes32Utils.removeLeadingZeros( bytes32(_account.balance) ) );
42,183
102
// An event thats emitted when an account changes its delegate
event DelegateChanged( address indexed delegator, address indexed fromDelegate, address indexed toDelegate );
event DelegateChanged( address indexed delegator, address indexed fromDelegate, address indexed toDelegate );
622
14
// Sanity check interval
require(beginEpoch < endEpoch, "CR_INTERVAL_INVALID");
require(beginEpoch < endEpoch, "CR_INTERVAL_INVALID");
13,164
11
// Emit once collateral is reclaimed by a writer after `expiryTime + windowSize`.
event Refund(address indexed seller, uint256 amount);
event Refund(address indexed seller, uint256 amount);
15,364
21
// Returns the number of LP tokens the strategy has in circulation return uint Number of LP tokens in circulation/
function getCirculatingSupply() public view override returns (uint) { return circulatingSupply; }
function getCirculatingSupply() public view override returns (uint) { return circulatingSupply; }
1,001
6
// reference to $EGG for burning on mint
IEgg public egg;
IEgg public egg;
76,352
272
// Repay debt ONLY to skip reinvest in case of strategy migration period
_repaidDebt = _swapRewardsToDebt(_wethAmount);
_repaidDebt = _swapRewardsToDebt(_wethAmount);
67,692
68
// https:etherscan.io/address/0x24701A6368Ff6D2874d6b8cDadd461552B8A5283
address internal constant LINK_INTEREST_RATE_STRATEGY = 0x24701A6368Ff6D2874d6b8cDadd461552B8A5283;
address internal constant LINK_INTEREST_RATE_STRATEGY = 0x24701A6368Ff6D2874d6b8cDadd461552B8A5283;
15,765
23
// First pay out any LQTY gains
address frontEnd = deposits[msg.sender].frontEndTag; _payOutLQTYGains(communityIssuanceCached, msg.sender, frontEnd);
address frontEnd = deposits[msg.sender].frontEndTag; _payOutLQTYGains(communityIssuanceCached, msg.sender, frontEnd);
15,541
6
// define function here
function feedOnKitty(uint _zombieId, uint _kittyId, "kitty") public { uint kittyDna; //we only care about one of the values returned from KittyInterface which is kittyDna (,,,,,,,,,kittyDna) = kittyContract.getKitty(_kittyId); feedAndMultiply(_zombieId, kittyDna); }
function feedOnKitty(uint _zombieId, uint _kittyId, "kitty") public { uint kittyDna; //we only care about one of the values returned from KittyInterface which is kittyDna (,,,,,,,,,kittyDna) = kittyContract.getKitty(_kittyId); feedAndMultiply(_zombieId, kittyDna); }
27,031
286
// Pays out pending amount in a stream streamId The id of the stream to payout.return The amount paid out in underlying /
function payout(uint256 streamId) public returns (uint256 paidOut)
function payout(uint256 streamId) public returns (uint256 paidOut)
79,498
4
// Allows minter to create new tokens./Mint method is reserved for minter module./recipient Address receiving the new tokens./amount Number of minted tokens.
function mintToken(address recipient, uint256 amount) external;
function mintToken(address recipient, uint256 amount) external;
34,728
23
// if the applicant address is already taken by a member's delegateKey, reset it to their member address
if (members[memberAddressByDelegateKey[proposal.applicant]].exists) { address memberToOverride = memberAddressByDelegateKey[proposal.applicant]; memberAddressByDelegateKey[memberToOverride] = memberToOverride; members[memberToOverride].delegate...
if (members[memberAddressByDelegateKey[proposal.applicant]].exists) { address memberToOverride = memberAddressByDelegateKey[proposal.applicant]; memberAddressByDelegateKey[memberToOverride] = memberToOverride; members[memberToOverride].delegate...
43,168
18
// calculate the amount of tokens we need to reimburse uniswap for the flashloan
uint amountRequired = UniswapV2Library.getAmountsIn(factory, amountTokenBorrowed, path)[0];
uint amountRequired = UniswapV2Library.getAmountsIn(factory, amountTokenBorrowed, path)[0];
29,597
252
// Team Mint /
function teamMint(uint256 _quantity) external onlyOwner { require(totalSupply() + _quantity <= maxSupply, "Sold out"); _safeMint(msg.sender, _quantity); }
function teamMint(uint256 _quantity) external onlyOwner { require(totalSupply() + _quantity <= maxSupply, "Sold out"); _safeMint(msg.sender, _quantity); }
3,791
7
// Account Merging
function startMergingWindow() external; function mergeAccount(address accountToMerge, uint256[] calldata entryIDs) external; function nominateAccountToMerge(address account) external; function accountMergingIsOpen() external view returns (bool);
function startMergingWindow() external; function mergeAccount(address accountToMerge, uint256[] calldata entryIDs) external; function nominateAccountToMerge(address account) external; function accountMergingIsOpen() external view returns (bool);
974
20
// Passes on the accumulated debt changes from the markets, into the pool, so that vaults can later access this debt.
self.vaultsDebtDistribution.distributeValue(cumulativeDebtChangeD18);
self.vaultsDebtDistribution.distributeValue(cumulativeDebtChangeD18);
25,865
26
// If above ripcord threshold, then check if incentivized cooldown period has elapsed
if (currentLeverageRatio >= incentive.incentivizedLeverageRatio) { if (lastTradeTimestamp.add(incentive.incentivizedTwapCooldownPeriod) < block.timestamp) { return ShouldRebalance.RIPCORD; }
if (currentLeverageRatio >= incentive.incentivizedLeverageRatio) { if (lastTradeTimestamp.add(incentive.incentivizedTwapCooldownPeriod) < block.timestamp) { return ShouldRebalance.RIPCORD; }
11,781
4
// each user can get only 3 timesbe careful, SafeMath is not used. /
function mintForUsers() public virtual { require(totalSupply() < maxAmount); require(balanceOf(msg.sender) < baseAmount * 4); _mint(msg.sender, baseAmount); }
function mintForUsers() public virtual { require(totalSupply() < maxAmount); require(balanceOf(msg.sender) < baseAmount * 4); _mint(msg.sender, baseAmount); }
19,973
35
// Verify that the number of claims is a multiple of 3
if (numberOfShillings % 3 != 0 || numberOfShillings == 0) revert InvalidNumberOfTokens();
if (numberOfShillings % 3 != 0 || numberOfShillings == 0) revert InvalidNumberOfTokens();
32,928
0
// The OpenSea interface system that allows for approval fee skipping. /
contract OwnableDelegateProxy {} contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; }
contract OwnableDelegateProxy {} contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; }
49,496
114
// string memory _name = INFTXInventoryStaking(msg.sender).nftxVaultFactory().vault();
__ERC20_init(name, symbol); baseToken = IERC20Upgradeable(_baseToken);
__ERC20_init(name, symbol); baseToken = IERC20Upgradeable(_baseToken);
33,181
37
// Get Round number and control, we need these first otherwise behavior of other fetches may be undefined or unceccesary spending of LINK
function getInitialApiData() private
function getInitialApiData() private
42,805
3
// Emitted when the ACO fee destination address has been changed. previousAcoFeeDestination Address of the previous ACO fee destination. newAcoFeeDestination Address of the new ACO fee destination. /
event SetAcoFeeDestination(address previousAcoFeeDestination, address newAcoFeeDestination);
event SetAcoFeeDestination(address previousAcoFeeDestination, address newAcoFeeDestination);
992
356
// Mapping from token id to sha256 hash of metadata
mapping(uint256 => bytes32) public tokenMetadataHashes;
mapping(uint256 => bytes32) public tokenMetadataHashes;
30,616
22
// Map that contains the number of entries each user has bought, to prevent abuse, and the claiming info
struct ClaimStruct { uint256 numEntriesPerUser; uint256 amountSpentInWeis; bool claimed; }
struct ClaimStruct { uint256 numEntriesPerUser; uint256 amountSpentInWeis; bool claimed; }
31,838
11
// Verify that the priceDepth parameters is within the max No. of historical blocks a contract can track
modifier checkMaxBlockDepth(uint _value) { require(_value > 0 && _value <= 255, "Price Depth parameter must be within then range [1-255]"); _; }
modifier checkMaxBlockDepth(uint _value) { require(_value > 0 && _value <= 255, "Price Depth parameter must be within then range [1-255]"); _; }
50,730
8
// sell half and add liquidity
uint256 half = liquidityAddAmount.div(2); drace.approve(address(routerV2), liquidityAddAmount); address[] memory path = new address[](2); path[0] = address(drace); path[1] = otherTokenAddress; IERC20 otherToken = IERC20(otherTokenAddress); uint256 minToReceive ...
uint256 half = liquidityAddAmount.div(2); drace.approve(address(routerV2), liquidityAddAmount); address[] memory path = new address[](2); path[0] = address(drace); path[1] = otherTokenAddress; IERC20 otherToken = IERC20(otherTokenAddress); uint256 minToReceive ...
22,442
101
// It calls parent BasicToken.transfer() function. It will transfer an amount of tokens to an specific address/ return True if the token is transfered with success
function transfer(address _to, uint256 _value) isAllowed(msg.sender, _to) public returns (bool) { return super.transfer(_to, _value); }
function transfer(address _to, uint256 _value) isAllowed(msg.sender, _to) public returns (bool) { return super.transfer(_to, _value); }
33,234
5
// 終止帳號
function closeAccount() public onlyContractOwner { selfdestruct(contractOwner); }
function closeAccount() public onlyContractOwner { selfdestruct(contractOwner); }
19,512
196
// HELPERS /
function assertUint104(uint256 num) internal pure { require(num <= type(uint104).max, "Overflow uint104"); }
function assertUint104(uint256 num) internal pure { require(num <= type(uint104).max, "Overflow uint104"); }
17,322
47
// Returns array of three non-duplicating integers from 0-9
function generateIndexes ( address account ) internal returns (uint8[3])
function generateIndexes ( address account ) internal returns (uint8[3])
43,654
151
// Redeem mining reward The validation of this redeeming operation should be done by the caller, a registered sidechain contract Here we use cumulative mining reward to simplify the logic in sidechain code _receiver the receiver of the redeemed mining reward _cumulativeReward the latest cumulative mining reward /
function redeemMiningReward(address _receiver, uint256 _cumulativeReward)
function redeemMiningReward(address _receiver, uint256 _cumulativeReward)
50,045
238
// View function to see pending CROW on frontend.
function pendingCrow(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accCrowPerShare = pool.accCrowPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
function pendingCrow(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accCrowPerShare = pool.accCrowPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
25,785
253
// Base interface for a contract that will be called via the GSN from {IRelayHub}.TIP: You don't need to write an implementation yourself! Inherit from {GSNRecipient} instead./ Returns the address of the {IRelayHub} instance this recipient interacts with. /
function getHubAddr() external view returns (address);
function getHubAddr() external view returns (address);
7,809
400
// Check to see if a given address is a CRP addr - address to checkreturn boolean indicating whether it is a CRP /
function isCrp(address addr) external view returns (bool) { return _isCrp[addr]; }
function isCrp(address addr) external view returns (bool) { return _isCrp[addr]; }
23,477
113
// Withdraws the interest only of user, and updates the stake date, balance and etc../
function claim() external whenNotPaused nonReentrant { uint256 balance = balances[msg.sender]; require(balance > 0, "balance should more than 0"); // calculate total balance with interest (uint256 totalWithInterest, uint256 principalOfRepresentUmi, uint256 timePassed) = calculateRewa...
function claim() external whenNotPaused nonReentrant { uint256 balance = balances[msg.sender]; require(balance > 0, "balance should more than 0"); // calculate total balance with interest (uint256 totalWithInterest, uint256 principalOfRepresentUmi, uint256 timePassed) = calculateRewa...
38,281
44
// ========================================ERC20========================================= ERC20 Transfer function
function TRANSFER970(address to, uint value) public override returns (bool success) { //inject NONSTANDARD NAMING _TRANSFER893(msg.sender, to, value); return true; }
function TRANSFER970(address to, uint value) public override returns (bool success) { //inject NONSTANDARD NAMING _TRANSFER893(msg.sender, to, value); return true; }
22,795
17
// Contains 512-bit math functions/Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision/Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Rem...
library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Rem...
34,960
13
// Returns the downcasted int16 from int256, reverting onoverflow (when the input is less than smallest int16 orgreater than largest int16). Counterpart to Solidity's `int16` operator. Requirements: - input must fit into 16 bits _Available since v3.1._ /
function toInt16(int256 value) internal pure returns (int16) { require( value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits" ); return int16(value); }
function toInt16(int256 value) internal pure returns (int16) { require( value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits" ); return int16(value); }
39,075
19
// Add the token to the staker's list of staked tokens
staker.stakedTokens.push(StakedToken(msg.sender, _tokenId));
staker.stakedTokens.push(StakedToken(msg.sender, _tokenId));
22,962
31
// The sender should already be certified
require(certifier.certified(msg.sender));
require(certifier.certified(msg.sender));
7,284
27
// 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 onlyPayloadSize(2 * 32) returns (bool)
function approve(address _spender, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool)
15,257
96
// Lazily checks if every reserve tranche has reached maturity. If so redeems the tranche balance for the underlying collateral and removes the tranche from the reserve list. NOTE: We traverse the reserve list in the reverse order as deletions involve swapping the deleted element to the end of the list and removing the...
uint256 reserveCount = _reserveCount(); for (uint256 i = reserveCount - 1; i > 0; i--) { ITranche tranche = ITranche(address(_reserveAt(i))); IBondController bond = IBondController(tranche.bond());
uint256 reserveCount = _reserveCount(); for (uint256 i = reserveCount - 1; i > 0; i--) { ITranche tranche = ITranche(address(_reserveAt(i))); IBondController bond = IBondController(tranche.bond());
13,707
27
// Claimable Extension for the Ownable contract, where the ownership needs to be claimed.This allows the new owner to accept the transfer. /
contract Claimable is Ownable { address public pendingOwner; /** * @dev Modifier throws if called by any account other than the pendingOwner. */ modifier onlyPendingOwner() { require(msg.sender == pendingOwner); _; } /** * @dev Allows the current owner to set the pendingOwner address. * ...
contract Claimable is Ownable { address public pendingOwner; /** * @dev Modifier throws if called by any account other than the pendingOwner. */ modifier onlyPendingOwner() { require(msg.sender == pendingOwner); _; } /** * @dev Allows the current owner to set the pendingOwner address. * ...
383
77
// We store the `bptAmount` in the previous slot to the `tokenAmounts` array. We can make sure there will be at least one available slot due to how the memory scratch space works. We can safely overwrite whatever is stored in this slot as we will revert immediately after that.
let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount)
let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount)
26,503
21
// function _msgSender() internal view virtual returns (address payable) {
function _msgSender() internal view virtual returns (address) { return msg.sender; }
function _msgSender() internal view virtual returns (address) { return msg.sender; }
8,432
14
// If this is the first mint the tokens are exactly the supplied underlying
mintAmount = _amount;
mintAmount = _amount;
42,468
4
// The interface for the contract that manages pools and the options parameters,accumulates the funds from the liquidity providers and makes the withdrawals for them,sells the options contracts to the options buyers and collateralizes them,exercises the ITM (in-the-money) options with the unrealized P&L and settles the...
interface IHegicPool is IERC721, IPriceCalculator { enum OptionState {Invalid, Active, Exercised, Expired} enum TrancheState {Invalid, Open, Closed} /** * @param state The state of the option: Invalid, Active, Exercised, Expired * @param strike The option strike * @param amount The option si...
interface IHegicPool is IERC721, IPriceCalculator { enum OptionState {Invalid, Active, Exercised, Expired} enum TrancheState {Invalid, Open, Closed} /** * @param state The state of the option: Invalid, Active, Exercised, Expired * @param strike The option strike * @param amount The option si...
5,499
73
// Adjust the balance
uint256 oldBalance = balances[_buyer]; balances[_buyer] = SafeMath.add(oldBalance, _amount); totalSupply = checkedSupply; trackHolder(_buyer);
uint256 oldBalance = balances[_buyer]; balances[_buyer] = SafeMath.add(oldBalance, _amount); totalSupply = checkedSupply; trackHolder(_buyer);
34,269
19
// Request to leave the set of collator candidates/ @custom:selector b1a3c1b7/candidateCount The number of candidates in the CandidatePool
function scheduleLeaveCandidates(uint256 candidateCount) external;
function scheduleLeaveCandidates(uint256 candidateCount) external;
32,308
7
// Si los depósitos 'msgSender = 0' , significa que es el primer depósito. Por esto, se agrega 1 al recuento total de jugadores y al contador de sus referidos.
if (activatedPlayer_[msg.sender] == false) { activatedPlayer_[msg.sender] = true; players += 1; referralsOf_[_referredBy] += 1; }
if (activatedPlayer_[msg.sender] == false) { activatedPlayer_[msg.sender] = true; players += 1; referralsOf_[_referredBy] += 1; }
9,689
24
// all returns all list elements _self is a pointer to list in the storagereturn all list elements /
function all( List storage _self ) public view returns(bytes32[] memory)
function all( List storage _self ) public view returns(bytes32[] memory)
13,711
2
// INSUR token address
address public INSUR;
address public INSUR;
32,574
26
// Adds `gauge` to the GaugeController with type `gaugeType` and an initial weight of zero /
function _addGauge(address gauge, string memory gaugeType) private { require(_isGaugeFromValidFactory(gauge, gaugeType), "Invalid gauge"); // `_gaugeController` enforces that duplicate gauges may not be added so we do not need to check here. _authorizerAdaptorEntrypoint.performAction( ...
function _addGauge(address gauge, string memory gaugeType) private { require(_isGaugeFromValidFactory(gauge, gaugeType), "Invalid gauge"); // `_gaugeController` enforces that duplicate gauges may not be added so we do not need to check here. _authorizerAdaptorEntrypoint.performAction( ...
34,504
2
// IOptimismMintableERC721/Interface for contracts that are compatible with the OptimismMintableERC721 standard./ Tokens that follow this standard can be easily transferred across the ERC721 bridge.
interface IOptimismMintableERC721 is IERC721Enumerable { /// @notice Emitted when a token is minted. /// @param account Address of the account the token was minted to. /// @param tokenId Token ID of the minted token. event Mint(address indexed account, uint256 tokenId); /// @notice Emitted when a t...
interface IOptimismMintableERC721 is IERC721Enumerable { /// @notice Emitted when a token is minted. /// @param account Address of the account the token was minted to. /// @param tokenId Token ID of the minted token. event Mint(address indexed account, uint256 tokenId); /// @notice Emitted when a t...
29,848
99
// Returns true if strategy can be upgraded./If there are no aTokens in strategy then it is upgradable
function isUpgradable() external view override returns (bool) { return aToken.balanceOf(address(this)) == 0; }
function isUpgradable() external view override returns (bool) { return aToken.balanceOf(address(this)) == 0; }
48,905
23
// Assigns all C-Level addresses/_ceo CEO address/_cfo CFO address/_coo COO address/_commish Commissioner address
function setCLevelAddresses(address _ceo, address _cfo, address _coo, address _commish) public onlyCEO { require(_ceo != address(0)); require(_cfo != address(0)); require(_coo != address(0)); require(_commish != address(0)); ceoAddress = _ceo; cfoAddress = _cfo; ...
function setCLevelAddresses(address _ceo, address _cfo, address _coo, address _commish) public onlyCEO { require(_ceo != address(0)); require(_cfo != address(0)); require(_coo != address(0)); require(_commish != address(0)); ceoAddress = _ceo; cfoAddress = _cfo; ...
41,479
18
// deposit made by bidder to initiate buyout /buyoutValuationDeposit = currentValuation - ((reserveTokens in primary curve) + (reserveTokens in secondary curve))
uint256 public buyoutValuationDeposit;
uint256 public buyoutValuationDeposit;
8,681
2
// return The symbol of the token /
function symbol() public view override returns (string memory) { return _symbol; }
function symbol() public view override returns (string memory) { return _symbol; }
7,792
56
// get getDepositDetails/
function getDepositDetails(uint256 _id) view public returns (address _withdrawalAddress, uint256 _tokenAmount, uint256 _unlockTime, bool _withdrawn) { return(lockedToken[_id].withdrawalAddress,lockedToken[_id].tokenAmount, lockedToken[_id].unlockTime,lockedToken[_id].withdrawn); }
function getDepositDetails(uint256 _id) view public returns (address _withdrawalAddress, uint256 _tokenAmount, uint256 _unlockTime, bool _withdrawn) { return(lockedToken[_id].withdrawalAddress,lockedToken[_id].tokenAmount, lockedToken[_id].unlockTime,lockedToken[_id].withdrawn); }
40,792
276
// Boolean indicating if return values of `getPoolBalance` are to be cached. /
bool _cachePoolBalances;
bool _cachePoolBalances;
35,789
166
// Check nft registry
IERC721 nftRegistry = _requireERC721(_nftAddress);
IERC721 nftRegistry = _requireERC721(_nftAddress);
47,931