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
11
// Transfers 'value' amount of tokens from address 'from' to address 'to'.
* Emits {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external override returns (bool) { require(to != from); require(to != address(0)); require(value <= balanceOf[from]); require(value <= allowed[from][msg.sender]); balanceOf[from] -= value; balanc...
* Emits {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external override returns (bool) { require(to != from); require(to != address(0)); require(value <= balanceOf[from]); require(value <= allowed[from][msg.sender]); balanceOf[from] -= value; balanc...
1,271
6
// for curve t2t
ICurvePool curvePool;
ICurvePool curvePool;
34,369
28
// Storing address of target
constructor(address _target) public{ target = _target; }
constructor(address _target) public{ target = _target; }
29,878
27
// ERC721 functions
function balanceOf(address _owner) public view override returns (uint256 _balance){ //à compléter }
function balanceOf(address _owner) public view override returns (uint256 _balance){ //à compléter }
8,165
170
// name of your Token (eg. "BoredApeYachtClub")
string memory _name,
string memory _name,
13,953
23
// Sets the pool payment default duration. _poolId The Id of the pool. _duration The duration to be set. /
function setPaymentDefaultDuration( uint256 _poolId, uint32 _duration
function setPaymentDefaultDuration( uint256 _poolId, uint32 _duration
11,237
116
// generate our synth currency key to check if enough time has elapsed
address _synth; bytes32 _synthCurrencyKey; if (_vaultToken == 0x1b905331F7dE2748F4D6a0678e1521E20347643F) {
address _synth; bytes32 _synthCurrencyKey; if (_vaultToken == 0x1b905331F7dE2748F4D6a0678e1521E20347643F) {
60,124
7
// allow owner to set flush address
function setFlushAddress(address to) external onlyOwner{ flushAddress = to; }
function setFlushAddress(address to) external onlyOwner{ flushAddress = to; }
19,931
59
// Require that the random result is not 0
require(randomResult != 0, "Waffle: Please wait for Chainlink VRF to update the winner first.");
require(randomResult != 0, "Waffle: Please wait for Chainlink VRF to update the winner first.");
8,570
163
// deletes proposal signature data after successfully executing a multiSig function
function deleteProposal(Data storage self, bytes32 _whatFunction) internal
function deleteProposal(Data storage self, bytes32 _whatFunction) internal
2,977
30
// Gets the balance of the specified address._owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./
function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; }
function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; }
1,844
144
// Get new id
newNftId = _reissueStakeNftId(nftId, lookupIndex);
newNftId = _reissueStakeNftId(nftId, lookupIndex);
13,583
112
// Transfers the StakeAmount from the reporded miner to the reporting party
TellorTransfer.doTransfer(self, disp.reportedMiner,disp.reportingParty, self.uintVars[keccak256("stakeAmount")]);
TellorTransfer.doTransfer(self, disp.reportedMiner,disp.reportingParty, self.uintVars[keccak256("stakeAmount")]);
8,760
99
// check name string查询某个名字是否可以注册 /
function checkIfNameValid(string memory nameStr) public view returns(bool)
function checkIfNameValid(string memory nameStr) public view returns(bool)
36,981
26
// set Question to Closed
allQuestions[allAnswers[_id].questionId].state = State.Closed;
allQuestions[allAnswers[_id].questionId].state = State.Closed;
30,029
2
// He tweeted and we created. /
abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; return msg.data; } }
abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; return msg.data; } }
30
74
// 撤销买单,当 卖队列无法满足 买队列时 正确
function cancelBuyOrder() public override { require(msg.sender!=address(0), "#1"); ITlbShop(_contractShop)._cancelBuyOrder(msg.sender); }
function cancelBuyOrder() public override { require(msg.sender!=address(0), "#1"); ITlbShop(_contractShop)._cancelBuyOrder(msg.sender); }
50,676
4
// : Mints NFT to desired wallet: walletAddress - The walletAddress to mint to: quantity - The quantity to mint /
function mint(address walletAddress, uint256 quantity) external onlyRole(MINTER_ROLE) { require(!PAUSED, "Minting is paused"); _safeMint(walletAddress, quantity); }
function mint(address walletAddress, uint256 quantity) external onlyRole(MINTER_ROLE) { require(!PAUSED, "Minting is paused"); _safeMint(walletAddress, quantity); }
15,019
475
// returns an `Sint256` positive representation of an unsigned integer /
function toPos256(uint256 n) internal pure returns (Sint256 memory) { return Sint256({ value: n, isNeg: false }); }
function toPos256(uint256 n) internal pure returns (Sint256 memory) { return Sint256({ value: n, isNeg: false }); }
31,422
86
// previous rounds
function getRoundTotalSupply(uint r) external view returns(uint256); function getRoundExpiryDate(uint r) external view returns(uint); function getRoundStrikePrice(uint r) external view returns(uint); function getRoundSettlePrice(uint r) external view returns(uint); function getRoundTotalPremiums(uin...
function getRoundTotalSupply(uint r) external view returns(uint256); function getRoundExpiryDate(uint r) external view returns(uint); function getRoundStrikePrice(uint r) external view returns(uint); function getRoundSettlePrice(uint r) external view returns(uint); function getRoundTotalPremiums(uin...
13,370
222
// Disables the corresponding DMMA from minting new tokens. This allows the market to close over time, since users are only able to redeem tokens.dmmTokenIdThe DMMA that should be disabled. /
function disableMarket(uint dmmTokenId) external;
function disableMarket(uint dmmTokenId) external;
2,470
117
// weiAmount(fee %)(EDO/Wei) / (decimals in edo/wei) / (decimals in percentage)
if (!__isSell__(makerOrder)) {
if (!__isSell__(makerOrder)) {
11,892
132
// PUBLIC FACING: Enter the auction lobby for the current round referrerAddr TRX address of referring user (optional; 0x0 for no referrer) /
function xfLobbyEnter(address referrerAddr) external payable
function xfLobbyEnter(address referrerAddr) external payable
76,734
128
// This method can be used by the owner to extract mistakenly/sent tokens to this contract./_token The address of the token contract that you want to recover
function rescueTokens(address _token, address _dst) public governance { uint balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(_dst, balance); }
function rescueTokens(address _token, address _dst) public governance { uint balance = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(_dst, balance); }
3,237
16
// Whether or not a particular contract is available for projects to migrate their funds and Tickets to.
mapping(ITerminal => bool) public override migrationIsAllowed;
mapping(ITerminal => bool) public override migrationIsAllowed;
28,490
146
// Update price oracle with the pre-exit balances
_updateOracle(lastChangeBlock, balances[0], balances[1]);
_updateOracle(lastChangeBlock, balances[0], balances[1]);
52,204
55
// send back ETH above fee
safeTransferETH(msg.sender, msg.value.sub(fee)); emit TokensBurned(msg.sender, vault.Id, _amount);
safeTransferETH(msg.sender, msg.value.sub(fee)); emit TokensBurned(msg.sender, vault.Id, _amount);
11,174
5
// Removes the ClaimIssuer contract of a trusted claim issuer trustedIssueris the address of the trusted issuer's ClaimIssuer contract /
function removeTrustedIssuer( IClaimIssuer trustedIssuer
function removeTrustedIssuer( IClaimIssuer trustedIssuer
12,830
183
// Disable an old outbox from interacting with the bridge _outbox Outbox contract to remove /
function removeOldOutbox(address _outbox) external;
function removeOldOutbox(address _outbox) external;
55,993
364
// 验证交易滑点是否满足条件/path 兑换路径/uniV3Factory uniswap v3 factory/maxSqrtSlippage 最大滑点,最大值: 1e4/ return 当前价
function verifySlippage( bytes memory path, address uniV3Factory, uint32 maxSqrtSlippage
function verifySlippage( bytes memory path, address uniV3Factory, uint32 maxSqrtSlippage
35,509
12
// PAUSE GUARDIAN FUNCTIONS / Admin function to change the Pause Guardian newPauseGuardian The address of the new Pause Guardianreturn uint 0=success, otherwise a failure. (See enum Error for details) /
function _setPauseGuardian(address newPauseGuardian) external onlyGovernor returns (uint) { return comptroller._setPauseGuardian(newPauseGuardian); }
function _setPauseGuardian(address newPauseGuardian) external onlyGovernor returns (uint) { return comptroller._setPauseGuardian(newPauseGuardian); }
41,969
130
// WorkLock interface/
interface WorkLockInterface { function token() external view returns (NuCypherToken); }
interface WorkLockInterface { function token() external view returns (NuCypherToken); }
49,991
49
// adds a pool to the whitelist can only be called by the contract owner_poolAnchor pool anchor/
function addPoolToWhitelist(IConverterAnchor _poolAnchor)
function addPoolToWhitelist(IConverterAnchor _poolAnchor)
23,135
6
// Returns the amount of tokens owned by `account`./
function balanceOf(address account) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
2,918
107
// change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){ require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); ...
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){ require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); ...
665
73
// loop over past epochs from the latest `dead` epoch to the current
uint256 earliest_non_dead_auction_epoch = 1; uint256 earlist_epoch = getEarliestActiveAuctionEpoch(); uint256 epochCurrent = epoch(); uint256 temp_epoch = (epochCurrent.sub(earlist_epoch) > Constants.getCouponAuctionMaxEpochsBestBidderSelection()) ? earlist_epoch.add(Constants.getCouponA...
uint256 earliest_non_dead_auction_epoch = 1; uint256 earlist_epoch = getEarliestActiveAuctionEpoch(); uint256 epochCurrent = epoch(); uint256 temp_epoch = (epochCurrent.sub(earlist_epoch) > Constants.getCouponAuctionMaxEpochsBestBidderSelection()) ? earlist_epoch.add(Constants.getCouponA...
41,094
10
// Ownership check above ensures no underflow.
unchecked { balanceOf[owner]--; }
unchecked { balanceOf[owner]--; }
13,055
95
// No trading is performed on deposit
if(nonContract == true){ }
if(nonContract == true){ }
3,977
275
// Set maximum count to mint per once. /
function setMaxToMint(uint256 _maxValue) external onlyOwner { maxToMint = _maxValue; }
function setMaxToMint(uint256 _maxValue) external onlyOwner { maxToMint = _maxValue; }
34,031
141
// We need this libary for Rarible
library LibPart { bytes32 public constant TYPE_HASH = keccak256("Part(address account,uint96 value)"); struct Part { address payable account; uint96 value; } function hash(Part memory part) internal pure returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, part.account, p...
library LibPart { bytes32 public constant TYPE_HASH = keccak256("Part(address account,uint96 value)"); struct Part { address payable account; uint96 value; } function hash(Part memory part) internal pure returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, part.account, p...
44,913
115
// Create tokens /
function create(uint256 tokensToCreate) external;
function create(uint256 tokensToCreate) external;
70,647
176
// SPECTRE tokens created per block.
uint256 public spectrePerBlock;
uint256 public spectrePerBlock;
45,090
491
// Update remove delegator evaluation window duration _duration - new window duration /
function updateRemoveDelegatorEvalDuration(uint256 _duration) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); removeDelegatorEvalDuration = _duration; emit RemoveDelegatorEvalDurationUpdated(_duration); }
function updateRemoveDelegatorEvalDuration(uint256 _duration) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); removeDelegatorEvalDuration = _duration; emit RemoveDelegatorEvalDurationUpdated(_duration); }
3,330
22
// We take the portion of the offer that we need
_take(offerId, uint128(baux), offerType); payAmt = 0; //All amount is sold
_take(offerId, uint128(baux), offerType); payAmt = 0; //All amount is sold
12,989
287
// A descriptive name for a collection of NFTs in this contract
function name() external view returns (string memory _name);
function name() external view returns (string memory _name);
3,734
24
// "_selectorCount >> 3" is a gas efficient division by 8 "_selectorCount / 8"
uint256 selectorSlotCount = _selectorCount >> 3;
uint256 selectorSlotCount = _selectorCount >> 3;
9,854
135
// Internal functions // /
function _getSetting(bytes32 name) internal view returns (SettingsLib.Setting memory) { return settings[name]; }
function _getSetting(bytes32 name) internal view returns (SettingsLib.Setting memory) { return settings[name]; }
56,016
448
// expmods_and_points.points[102] = -(g^16372z).
mstore(add(expmodsAndPoints, 0x1000), point)
mstore(add(expmodsAndPoints, 0x1000), point)
29,090
1
// USDC token contract address on BSC Testnet
address private constant WALLET_A = 0x4862ADFAdFF8f20633Fb52C1eD5040602cB5626E; // address for Wallet A address private constant WALLET_B = 0xAE28a1cCeb77258DfbE07cB308ecf65DE49398c9; // address for Wallet B address private constant WALLET_C = 0x1cc1468758C02bcB1988CcBce827d58F7889CE...
address private constant WALLET_A = 0x4862ADFAdFF8f20633Fb52C1eD5040602cB5626E; // address for Wallet A address private constant WALLET_B = 0xAE28a1cCeb77258DfbE07cB308ecf65DE49398c9; // address for Wallet B address private constant WALLET_C = 0x1cc1468758C02bcB1988CcBce827d58F7889CE...
4,351
18
// Modifier that checks that the contract has finished successfully/
modifier hasFinished() { require((gameFinishedTime != 0) && now >= (gameFinishedTime + (15 days))); _; }
modifier hasFinished() { require((gameFinishedTime != 0) && now >= (gameFinishedTime + (15 days))); _; }
23,932
23
// replace
require(oldFacetAddress != _newFacetAddress, "LibDiamondCut: Can't replace function with same function"); removeSelector(oldFacetAddress, selector); addSelector(_newFacetAddress, selector);
require(oldFacetAddress != _newFacetAddress, "LibDiamondCut: Can't replace function with same function"); removeSelector(oldFacetAddress, selector); addSelector(_newFacetAddress, selector);
42,726
46
// We write previously calculated values into storage // We emit a Mint event, and a Transfer event // We call the defense hook / unused function comptroller.mintVerify(address(this), minter, vars.actualMintAmount, vars.mintTokens);
return (uint256(Error.NO_ERROR), vars.actualMintAmount);
return (uint256(Error.NO_ERROR), vars.actualMintAmount);
2,026
9
// function to add tokens to the user that calls the contract the money held in contract is sent using a payable modifier function money can be released using selfdestruct(address)
function addTokens() payable { uint present = 0; uint tokensToAdd = msg.value/(10**18); for(uint i = 0; i < userAddresses.length; i++) { if(userAddresses[i] == msg.sender) { present = 1; break; } } // adding tokens if the user present in the userAddresses array if ...
function addTokens() payable { uint present = 0; uint tokensToAdd = msg.value/(10**18); for(uint i = 0; i < userAddresses.length; i++) { if(userAddresses[i] == msg.sender) { present = 1; break; } } // adding tokens if the user present in the userAddresses array if ...
46,591
22
// Converts all of caller's dividends to tokens. /
function reinvest() onlyStronghands() public
function reinvest() onlyStronghands() public
2,126
95
// gets start index and end index in a stream schedule/streamId stream index/start start time (in seconds)/end end time (in seconds)
function startEndScheduleIndex( uint256 streamId, uint256 start, uint256 end
function startEndScheduleIndex( uint256 streamId, uint256 start, uint256 end
14,770
47
// reset topCandidate
topCandidate = address(0); topCandidateVotes = 0; if (managerLimit > managers.length) { nextVotingPeriod = block.number.add(13000); } else {
topCandidate = address(0); topCandidateVotes = 0; if (managerLimit > managers.length) { nextVotingPeriod = block.number.add(13000); } else {
23,614
3
// Address of mintable token instance /
Mintable public token;
Mintable public token;
50,872
7
// self administration
_setupRole(TIMELOCK_ADMIN_ROLE, address(this));
_setupRole(TIMELOCK_ADMIN_ROLE, address(this));
6,205
6
// 定义一个调用AddressList的合约
contract MockAlarmList { using AlarmList for AlarmList.alarmMap; AlarmList.alarmMap tasks; function insert( address _addr, address _creator, uint256 _type, uint256 _begin, uint256 _peroid ) public returns (bool) { return tasks.insert(_addr, _creator, _type, _begin, _peroid); } fun...
contract MockAlarmList { using AlarmList for AlarmList.alarmMap; AlarmList.alarmMap tasks; function insert( address _addr, address _creator, uint256 _type, uint256 _begin, uint256 _peroid ) public returns (bool) { return tasks.insert(_addr, _creator, _type, _begin, _peroid); } fun...
4,889
90
// chainlink already give data as 108 so covnert to 18 decimal
function checkInflation() external view returns(uint256){ return _inflation(); }
function checkInflation() external view returns(uint256){ return _inflation(); }
41,004
261
// Mapping from Pool ID to quantity of AO available to buy at `price`
mapping (uint256 => uint256) public poolTotalQuantity;
mapping (uint256 => uint256) public poolTotalQuantity;
53,066
151
// Ensure that the supplied default expiration does not exceed 1 month.
require( newTimelockExpiration <= 30 days, "New timelock expiration cannot exceed one month." );
require( newTimelockExpiration <= 30 days, "New timelock expiration cannot exceed one month." );
35,453
74
// Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded.
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * *...
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * *...
156
2
// info about rewards for a particular staking token
struct StakingRewardsInfo { address stakingRewards; uint rewardAmount; }
struct StakingRewardsInfo { address stakingRewards; uint rewardAmount; }
11,297
50
// Returns an `BooleanSlot` with member `value` located at `slot`. /
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } }
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } }
18,634
0
// activates / deactivates the terms of use.
function setTermsActivation(TermsDataTypes.Terms storage termsData, bool _active) external { if (_active) { _activateTerms(termsData); } else { _deactivateTerms(termsData); } }
function setTermsActivation(TermsDataTypes.Terms storage termsData, bool _active) external { if (_active) { _activateTerms(termsData); } else { _deactivateTerms(termsData); } }
24,779
99
// A crowdsaled token that you can also burn./
contract BurnableCrowdsaleToken is BurnableToken, CrowdsaleToken { function BurnableCrowdsaleToken(string _name, string _symbol, uint _initialSupply, uint _decimals, bool _mintable) public CrowdsaleToken(_name, _symbol, _initialSupply, _decimals, _mintable) { } }
contract BurnableCrowdsaleToken is BurnableToken, CrowdsaleToken { function BurnableCrowdsaleToken(string _name, string _symbol, uint _initialSupply, uint _decimals, bool _mintable) public CrowdsaleToken(_name, _symbol, _initialSupply, _decimals, _mintable) { } }
48,807
225
// We will use these to be able to calculate remaining correctly.
uint256 public totalGiftSupply; uint256 public totalPublicSupply; mapping(address => bool) private _allowList; mapping(address => uint256) private _allowListClaimed; address public authAdmin; string private _contractURI = ''; string private _tokenBaseURI = ''; string private _tokenRevealedBaseURI = ''...
uint256 public totalGiftSupply; uint256 public totalPublicSupply; mapping(address => bool) private _allowList; mapping(address => uint256) private _allowListClaimed; address public authAdmin; string private _contractURI = ''; string private _tokenBaseURI = ''; string private _tokenRevealedBaseURI = ''...
23,315
25
// Update collection size
function setCollectionSize (uint256 newCollectionSize) public onlyOwner virtual returns (uint256)
function setCollectionSize (uint256 newCollectionSize) public onlyOwner virtual returns (uint256)
46,934
239
// returns the amount of each reserve token entitled for a given amount of pool tokens_amountamount of pool tokens_reserveTokens address of each reserve token return the amount of each reserve token entitled for the given amount of pool tokens/
function removeLiquidityReturn(uint256 _amount, IERC20Token[] memory _reserveTokens) public view returns (uint256[] memory)
function removeLiquidityReturn(uint256 _amount, IERC20Token[] memory _reserveTokens) public view returns (uint256[] memory)
25,368
13
// Query balance
(bool success, bytes memory returnData) = tokenAddress.staticcall(balanceOfData); uint256 totalBalance = success && returnData.length == 32 ? returnData.readUint256(0) : 0;
(bool success, bytes memory returnData) = tokenAddress.staticcall(balanceOfData); uint256 totalBalance = success && returnData.length == 32 ? returnData.readUint256(0) : 0;
515
98
// event UpdateTaxes();
event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity ); event BuyBackTriggered(uint256 amount); event OwnerForcedSwapBack(uint256 timestamp);
event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity ); event BuyBackTriggered(uint256 amount); event OwnerForcedSwapBack(uint256 timestamp);
26,986
28
// Withdraws contributions of multiple appeal rounds at once. This function is O(n) where n is the number of rounds.This could exceed the gas limit, therefore this function should be used only as a utility and not be relied upon by other contracts._localDisputeID The dispute ID as defined in the arbitrable contract._be...
function batchWithdrawFeesAndRewards( ArbitrableStorage storage self, uint256 _localDisputeID, address payable _beneficiary, uint256 _cursor, uint256 _count, uint256 _ruling
function batchWithdrawFeesAndRewards( ArbitrableStorage storage self, uint256 _localDisputeID, address payable _beneficiary, uint256 _cursor, uint256 _count, uint256 _ruling
31,820
18
// update counters
for (uint256 i = 0; i < numberOfTokens; ++i) { _tokenIds.increment(); }
for (uint256 i = 0; i < numberOfTokens; ++i) { _tokenIds.increment(); }
19,428
148
// accrues interest and updates the interest rate model using _setInterestRateModelFresh Admin function to accrue interest and update the interest rate model newInterestRateModel the new interest rate model to usereturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function _setInterestRateModel(address newInterestRateModel) public override 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 change of interest rate model fa...
function _setInterestRateModel(address newInterestRateModel) public override 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 change of interest rate model fa...
27,511
41
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast...
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast...
1,529
3
// if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.
require(_srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), "LzApp: invalid source sending contract"); _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
require(_srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), "LzApp: invalid source sending contract"); _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
21,184
66
// TODO comment actual hash value.
bytes32 constant private ERC20TOKEN_ERC1820_INTERFACE_ID = keccak256( "ERC20Token" );
bytes32 constant private ERC20TOKEN_ERC1820_INTERFACE_ID = keccak256( "ERC20Token" );
9,915
178
// Calculates amount of base tokens that needs to be paid out to all users /
function calcPayoff( uint256[] memory strikePrices, uint256 expiryPrice, bool isPut, uint256[] memory longSupplies, uint256[] memory shortSupplies
function calcPayoff( uint256[] memory strikePrices, uint256 expiryPrice, bool isPut, uint256[] memory longSupplies, uint256[] memory shortSupplies
2,087
53
// Set fee wallet
function SetFeeWallet(address _team_wallet) public onlyOwner { team_wallet = _team_wallet; }
function SetFeeWallet(address _team_wallet) public onlyOwner { team_wallet = _team_wallet; }
34,013
122
// Destroys `amount` tokens of token type `id` from `from` Requirements: - `from` cannot be the zero address.- `from` must have at least `amount` tokens of token type `id`. /
function _burn( address from, uint256 id, uint256 amount
function _burn( address from, uint256 id, uint256 amount
21,441
7
// if it's dai_join_addr don't check gem() it will fail
if (_joinAddr == DAI_JOIN_ADDR) return false;
if (_joinAddr == DAI_JOIN_ADDR) return false;
45,724
234
// The facet of the Ethernauts Explore contract that send a ship to explore the deep space./An owned ship can be send on an expedition. Exploration takes timeand will always result in “success”. This means the ship can never be destroyedand always returns with a collection of loot. The degree of success is dependenton ...
contract EthernautsExplore is EthernautsLogic { /// @dev Delegate constructor to Nonfungible contract. function EthernautsExplore() public EthernautsLogic() {} /*** EVENTS ***/ /// emit signal to anyone listening in the universe event Explore(uint256 shipId, uint256 sectorID, uint256 crewId, u...
contract EthernautsExplore is EthernautsLogic { /// @dev Delegate constructor to Nonfungible contract. function EthernautsExplore() public EthernautsLogic() {} /*** EVENTS ***/ /// emit signal to anyone listening in the universe event Explore(uint256 shipId, uint256 sectorID, uint256 crewId, u...
33,730
98
// slither-disable-next-line timestamp
if (maxEnd <= start) { continue; }
if (maxEnd <= start) { continue; }
21,643
13
// Ability to add liquidity to the pool (mints LP tokens) Add liquidity of GNXToken and GNXNative to this trading pool. Users are rewarded in LP which can be exchanged for liquidity and trading accrued fees.Liquidity of both tokens added must be equal. Technically only one param required but having two params for both ...
function addLiquidity(uint256 tokenDeposit, uint256 nativeDeposit) public override(IGNXPool) returns (uint256) { // Iniital liquidity add if (tokenReserve() == 0) { // Pulling GNXToken token.transferFrom(msg.sender, address(this), tokenDeposit); // Pullin...
function addLiquidity(uint256 tokenDeposit, uint256 nativeDeposit) public override(IGNXPool) returns (uint256) { // Iniital liquidity add if (tokenReserve() == 0) { // Pulling GNXToken token.transferFrom(msg.sender, address(this), tokenDeposit); // Pullin...
7,468
2
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the benefit is lost if 'b' is also tested.
if (a == 0) { return 0; }
if (a == 0) { return 0; }
17,788
378
// NOTE: We don't use SafeMath (or similar) in this function becauseall of our public functions carefully cap the maximum values fortime (at 64-bits) and currency (at 128-bits). _duration isalso known to be non-zero (see the require() statement in_addAuction())
if (_secondsPassed >= _duration) {
if (_secondsPassed >= _duration) {
25,218
2
// mapping of a staker to its current properties
mapping (address => Staker) public stakers;
mapping (address => Staker) public stakers;
33,203
115
// Allows the admin to set the price for tokens sold during phases 1 and 2 of the sale.
function setTokensPerKEther(uint256 _tokensPerKEther) external onlyAdmin onlyBeforeSale returns (bool) { require(_tokensPerKEther > 0); tokensPerKEther = _tokensPerKEther; TokensPerKEtherUpdated(_tokensPerKEther); return true; }
function setTokensPerKEther(uint256 _tokensPerKEther) external onlyAdmin onlyBeforeSale returns (bool) { require(_tokensPerKEther > 0); tokensPerKEther = _tokensPerKEther; TokensPerKEtherUpdated(_tokensPerKEther); return true; }
26,529
71
// A getter that searches the delegationChain for the level of/authority a specific delegate has within a Pledge/p The Pledge that will be searched/idDelegate The specified delegate that's searched for/ return If the delegate chain contains the delegate with the/`admins` array index `idDelegate` this returns that deleg...
function getDelegateIdx(Pledge p, uint64 idDelegate) internal returns(uint64) { for (uint i=0; i < p.delegationChain.length; i++) { if (p.delegationChain[i] == idDelegate) return uint64(i); } return NOTFOUND; }
function getDelegateIdx(Pledge p, uint64 idDelegate) internal returns(uint64) { for (uint i=0; i < p.delegationChain.length; i++) { if (p.delegationChain[i] == idDelegate) return uint64(i); } return NOTFOUND; }
47,828
37
// This is an alternative to {approve} that can be used as a mitigation forproblems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - 'spender' cannot be the zero address. /
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; }
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; }
15,297
77
// Grants tokens to an address, including a portion that will vest over timeaccording to a set vesting schedule. The overall duration and cliff duration of the grant mustbe an even multiple of the vesting interval.beneficiary = Address to which tokens will be granted. vestingAmount = The number of tokens subject to ves...
function addGrant( address beneficiary, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval, bool isRevocable
function addGrant( address beneficiary, uint256 vestingAmount, uint32 startDay, uint32 duration, uint32 cliffDuration, uint32 interval, bool isRevocable
50,423
8
// Finalizes a withdrawal via Outbox message; callable only by L2Gateway.outboundTransfer _token L1 address of token being withdrawn from _from initiator of withdrawal _to address the L2 withdrawal call set as the destination. _amount Token amount being withdrawn _data encoded exitNum (Sequentially increasing exit coun...
function finalizeInboundTransfer( address _token, address _from, address _to, uint256 _amount, bytes calldata _data
function finalizeInboundTransfer( address _token, address _from, address _to, uint256 _amount, bytes calldata _data
35,874
492
// Ensure the ExchangeRates contract has the feed for sETHBTC;
exchangerates_i.addAggregator("sETHBTC", 0xAc559F25B1619171CbC396a50854A3240b6A4e99);
exchangerates_i.addAggregator("sETHBTC", 0xAc559F25B1619171CbC396a50854A3240b6A4e99);
6,217
85
// deploy a token vesting contract for the founder tokens
uint256 cliff = 6 * 4 weeks; // 4 months founderTokenVesting = new TokenVesting( _pathFounderAddress, now, // start vesting now cliff, // cliff time cliff, // 100% unlocked at cliff false // irrevocable );
uint256 cliff = 6 * 4 weeks; // 4 months founderTokenVesting = new TokenVesting( _pathFounderAddress, now, // start vesting now cliff, // cliff time cliff, // 100% unlocked at cliff false // irrevocable );
56,304
22
// Mapping from holder address to their (enumerable) set of owned tokens
mapping (address => EnumerableSet.UintSet) private _holderTokens;
mapping (address => EnumerableSet.UintSet) private _holderTokens;
48,653
19
// Function modifier to require caller to be contract owner /
modifier onlyOwner() { require(isOwner(msg.sender), "!OWNER"); _; }
modifier onlyOwner() { require(isOwner(msg.sender), "!OWNER"); _; }
41,608
10
// timestamp for when presale would end
uint256 public timeToEndPresale = 1647586800; modifier onlyWhenNotPaused() { require(!_paused, "Contract currently paused"); _; }
uint256 public timeToEndPresale = 1647586800; modifier onlyWhenNotPaused() { require(!_paused, "Contract currently paused"); _; }
66,559
77
// Returns the last node in the list (node with the smallest key)return address for the tail of the list /
function getLast(Data storage self) public view returns (address) { return self.tail; }
function getLast(Data storage self) public view returns (address) { return self.tail; }
35,149
18
// Update the continuously compounding (risk premium) interest rate for a given debtor, from this block onwards /
function setRiskPremiumInterestRate(address _debtor, uint96 _rate) external override onlyElevatedAccess { // First checkpoint the base interest & debtor risk premium interest Debtor storage debtor = debtors[_debtor]; _getDebtorCache(_getBaseCache(), debtor, true); debtor.rate = _rate...
function setRiskPremiumInterestRate(address _debtor, uint96 _rate) external override onlyElevatedAccess { // First checkpoint the base interest & debtor risk premium interest Debtor storage debtor = debtors[_debtor]; _getDebtorCache(_getBaseCache(), debtor, true); debtor.rate = _rate...
18,942