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
25
// : method called by the relayer to release funds in different tokenaccountTo eth address to send the withdrawal tokensamount amount of token intokenIn address of the token intokenOut address of the token outid withdrawal idbaseFee the fee taken by the relayeramountOutMin minimum amount out user wantdata additional da...
function withdrawDifferentTokenTo( address accountTo, uint256 amount, address tokenIn, address tokenOut, bytes32 id, uint256 baseFee, uint256 amountOutMin, uint256 ammID, bytes calldata data
function withdrawDifferentTokenTo( address accountTo, uint256 amount, address tokenIn, address tokenOut, bytes32 id, uint256 baseFee, uint256 amountOutMin, uint256 ammID, bytes calldata data
14,792
114
// The delegate staking function. Approval is required. Theunstaked balance will be transferred to the caller. onBehalfOf The address to be unstaked. amount The amount to be unstaked. /
function unstakeFor(address onBehalfOf, uint256 amount) external nonReentrant onlyApproved(onBehalfOf)
function unstakeFor(address onBehalfOf, uint256 amount) external nonReentrant onlyApproved(onBehalfOf)
36,847
338
// invalidate old endpoint
serviceProviderEndpointToId[keccak256(bytes(serviceEndpoint.endpoint))] = 0;
serviceProviderEndpointToId[keccak256(bytes(serviceEndpoint.endpoint))] = 0;
3,226
99
// As soon as the transaction from an excluded wallet is finished, the fees are reset to the set value
function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; _charityFee = _previousCharityFee; }
function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; _charityFee = _previousCharityFee; }
25,925
18
// SMART CONTRACT FUNCTIONS // Add an airline to the registration queue Can only be called from FlightSuretyApp contract/
function registerAirline(address airlineID, address caller) public requireIsOperational
function registerAirline(address airlineID, address caller) public requireIsOperational
2,489
1
// deposits WETH into the reserve, using native ETH. A corresponding amount of the overlying asset (aTokens)is minted. onBehalfOf address of the user who will receive the aTokens representing the deposit referralCode integrators are assigned a referral code and can potentially receive rewards. // withdraws the WETH _re...
function withdrawETH( address lendingPool, uint256 amount, address to ) external ;
function withdrawETH( address lendingPool, uint256 amount, address to ) external ;
44,855
0
// create a function that writes a mood to the smart contract
function setMood(string memory _mood) public{ mood = _mood; }
function setMood(string memory _mood) public{ mood = _mood; }
18,053
9
// Authorises a controller, who can register and renew domains.
function addController(address controller) external override onlyOwner { controllers[controller] = true; emit ControllerAdded(controller); }
function addController(address controller) external override onlyOwner { controllers[controller] = true; emit ControllerAdded(controller); }
9,483
2
// [ERC1400Raw INTERFACE (2/13)] Get the symbol of the token, e.g., "MYT".return Symbol of the token. /
function symbol() external view returns (string memory); // 2/13
function symbol() external view returns (string memory); // 2/13
9,618
178
// Ensure that it's a valid disputeId
require( disp.reportingParty != address(0), "reporting Party is address 0" ); int256 _tally = disp.tally; if (_tally > 0) {
require( disp.reportingParty != address(0), "reporting Party is address 0" ); int256 _tally = disp.tally; if (_tally > 0) {
7,354
23
// bytes4(keccak256("updateMinerSplit(address,address,uint32)")) = 0x8d916340
bytes32 id = _schedule(tipJar, 0, abi.encodeWithSelector(hex"8d916340", minerAddress, splitTo, splitPct), bytes32(0), salt, regularDelay); emit MinerSplitProposal(msg.sender, minerAddress, splitTo, splitPct, block.timestamp + regularDelay, id, salt);
bytes32 id = _schedule(tipJar, 0, abi.encodeWithSelector(hex"8d916340", minerAddress, splitTo, splitPct), bytes32(0), salt, regularDelay); emit MinerSplitProposal(msg.sender, minerAddress, splitTo, splitPct, block.timestamp + regularDelay, id, salt);
43,710
35
// PRIVATE FUNCTIONS
function _depositToken( address _sponsor, IERC20 _token, uint256 _amount
function _depositToken( address _sponsor, IERC20 _token, uint256 _amount
28,171
93
// So indexers can keep track of this
event Harvested(uint256 profit, uint256 loss, uint256 debtPayment, uint256 debtOutstanding); event UpdatedStrategist(address newStrategist); event UpdatedKeeper(address newKeeper); event UpdatedRewards(address rewards); event UpdatedMinReportDelay(uint256 delay);
event Harvested(uint256 profit, uint256 loss, uint256 debtPayment, uint256 debtOutstanding); event UpdatedStrategist(address newStrategist); event UpdatedKeeper(address newKeeper); event UpdatedRewards(address rewards); event UpdatedMinReportDelay(uint256 delay);
825
17
// The token being sold
ERC20 public token;
ERC20 public token;
4,024
1,037
// Liquidity token asset types are 1 + marketIndex (where marketIndex is 1-indexed)
uint8 internal constant MIN_LIQUIDITY_TOKEN_INDEX = 2; uint8 internal constant MAX_LIQUIDITY_TOKEN_INDEX = 8;
uint8 internal constant MIN_LIQUIDITY_TOKEN_INDEX = 2; uint8 internal constant MAX_LIQUIDITY_TOKEN_INDEX = 8;
4,058
44
// Flushes buffered tokens to the active vault.// This function reverts if an emergency exit is active. This is in place to prevent the potential loss of/ additional funds.// return the amount of tokens flushed to the active vault.
function flush() external nonReentrant expectInitialized onlyKeeper returns (uint256) { // Prevent flushing to the active vault when an emergency exit is enabled to prevent potential loss of funds if // the active vault is poisoned for any reason. require(!emergencyExit, "emergency pause enabled"); ...
function flush() external nonReentrant expectInitialized onlyKeeper returns (uint256) { // Prevent flushing to the active vault when an emergency exit is enabled to prevent potential loss of funds if // the active vault is poisoned for any reason. require(!emergencyExit, "emergency pause enabled"); ...
12,692
21
// returns the number of convertible tokens /
function getConvertibleTokenCount() external view override returns (uint256) { return _convertibleTokens.array.length; }
function getConvertibleTokenCount() external view override returns (uint256) { return _convertibleTokens.array.length; }
26,946
14
// Returns the total supply of plus token. See {IERC20Updateable-totalSupply}. /
function totalSupply() public view virtual override returns (uint256) { return totalShares.mul(index).div(WAD); }
function totalSupply() public view virtual override returns (uint256) { return totalShares.mul(index).div(WAD); }
69,545
124
// Emits when reward for participation in voting processes is sent to governance contract/_reward Amount of staking reward tokens
event RewardAdded(uint256 _reward);
event RewardAdded(uint256 _reward);
54,192
7
// Equivalent to require(denominator != 0 && (x == 0 || (xy) / x == y))
if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) { revert(0, 0) }
if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) { revert(0, 0) }
8,818
30
// Calculate the amount that was actually transferred
uint256 balanceAfter = usdc.balanceOf(to); require(balanceAfter >= balanceBefore, "Token Transfer Overflow Error"); return success;
uint256 balanceAfter = usdc.balanceOf(to); require(balanceAfter >= balanceBefore, "Token Transfer Overflow Error"); return success;
40,638
20
// Claims earned rewards for `msg.sender` and sends them to `receiver`.receiver of the claim rewards token of reward amount of reward to claimRequirements:- Must revert if receiver, token or amount are zero. /
function claimRewards(address receiver, IERC20 token, uint256 amount) public { _distributeReward(msg.sender, receiver, token, amount); }
function claimRewards(address receiver, IERC20 token, uint256 amount) public { _distributeReward(msg.sender, receiver, token, amount); }
10,132
147
// If new owner used to be reward owner in the past, transfer back his unclaimed rewards to himself
uint256 prevBalance = unclaimedRewards[rewardToken][newDelegate]; if (prevBalance > 0) { unclaimedRewards[rewardToken][newDelegate] = 0; totalUnclaimedRewards[rewardToken] = totalUnclaimedRewards[rewardToken].sub(prevBalance); }
uint256 prevBalance = unclaimedRewards[rewardToken][newDelegate]; if (prevBalance > 0) { unclaimedRewards[rewardToken][newDelegate] = 0; totalUnclaimedRewards[rewardToken] = totalUnclaimedRewards[rewardToken].sub(prevBalance); }
83,244
252
// Helper function transfers a specified amount of tokens between two partiesusing the token transfer proxy contract. /
function transferTokensFrom( address token, address from, address to, uint amount ) internal returns (bool success)
function transferTokensFrom( address token, address from, address to, uint amount ) internal returns (bool success)
35,044
14
// Binds a method from the given module to this/wallet so the method can be invoked using this wallet's default/function./Note that this method must throw when the given module has/not been added to this wallet./_method The method's 4-byte selector./_module The module's address. Use address(0) to unbind the method.
function bindMethod(bytes4 _method, address _module) external;
function bindMethod(bytes4 _method, address _module) external;
47,078
19
// Liquidate max
params.lusdToBurn = maxLusdToBurn;
params.lusdToBurn = maxLusdToBurn;
11,954
18
// Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One poss...
function approve(address spender, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
9,451
26
// Set the locker contract owner to the creator of the contract (msg.sender)
owner = msg.sender;
owner = msg.sender;
9,364
18
// Make the real move. /uint8 playerScore = gameStatesById[gameId].makeMove(xIndex1, yIndex1,xIndex2, yIndex2,true);
require(gameStatesById[gameId].fast_fields[xIndex1][yIndex1][xIndex2][yIndex2] == 0); if (gameStatesById[gameId].firstPlayer == msg.sender) { gameStatesById[gameId].fast_fields[xIndex1][yIndex1][xIndex2][yIndex2] = 1; } else {
require(gameStatesById[gameId].fast_fields[xIndex1][yIndex1][xIndex2][yIndex2] == 0); if (gameStatesById[gameId].firstPlayer == msg.sender) { gameStatesById[gameId].fast_fields[xIndex1][yIndex1][xIndex2][yIndex2] = 1; } else {
14,744
16
// Harvest profits while preventing a sandwich attack exploit./maxBalance The maximum balance of the underlying token that is allowed to be in BentoBox./rebalance Whether BentoBox should rebalance the strategy assets to acheive it's target allocation./maxChangeAmount When rebalancing - the maximum amount that will be d...
function safeHarvest( uint256 maxBalance, bool rebalance, uint256 maxChangeAmount
function safeHarvest( uint256 maxBalance, bool rebalance, uint256 maxChangeAmount
46,307
6
// Transfer fn
function transfer(address _to, uint256 _value) public virtual returns (bool){ _transfer(msg.sender, _to, _value); return true; }
function transfer(address _to, uint256 _value) public virtual returns (bool){ _transfer(msg.sender, _to, _value); return true; }
38,396
4
// withdraw whole erc20 token balance
function withdraw(IERC20 token) public onlyOwner{ token.safeTransfer(msg.sender, token.balanceOf(address(this))); }
function withdraw(IERC20 token) public onlyOwner{ token.safeTransfer(msg.sender, token.balanceOf(address(this))); }
48,500
192
// The block number when Cat mining starts.
uint256 public startBlock; 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 amount); constructor( CatToken _cat, ...
uint256 public startBlock; 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 amount); constructor( CatToken _cat, ...
23,589
16
// A library for performing overflow-/underflow-safe addition and subtraction on uint128.
library BoringMath128 { function add(uint128 a, uint128 b) internal pure returns (uint128 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint128 a, uint128 b) internal pure returns (uint128 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } }
library BoringMath128 { function add(uint128 a, uint128 b) internal pure returns (uint128 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint128 a, uint128 b) internal pure returns (uint128 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } }
5,843
132
// Thisfunction is called when the sender andreceiver is from rewardexcluded address,
function _transferBothrewardExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount,,,,,,) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].ad...
function _transferBothrewardExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount,,,,,,) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].ad...
4,550
5
// Empty internal constructor, to prevent people from mistakenly deploying an instance of this contract, which should be used via inheritance.
constructor() internal {} // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; }
constructor() internal {} // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; }
42,342
182
// if accounts issuance ratio is greater than or equal to liquidation ratio set liquidation entry
require( accountsCollateralisationRatio >= getLiquidationRatio(), "Account issuance ratio is less than liquidation ratio" ); uint256 deadline = now.add(getLiquidationDelay()); _storeLiquidationEntry(account, deadline, msg.sender); emit AccountFlaggedFor...
require( accountsCollateralisationRatio >= getLiquidationRatio(), "Account issuance ratio is less than liquidation ratio" ); uint256 deadline = now.add(getLiquidationDelay()); _storeLiquidationEntry(account, deadline, msg.sender); emit AccountFlaggedFor...
39,256
444
// See {Governor-_countVote}. In this module, the support follows Governor Bravo. /
function _countVote( uint256 proposalId, address account, uint8 support, uint256 weight ) internal virtual override { ProposalDetails storage details = _proposalDetails[proposalId]; Receipt storage receipt = details.receipts[account]; require(!receipt.has...
function _countVote( uint256 proposalId, address account, uint8 support, uint256 weight ) internal virtual override { ProposalDetails storage details = _proposalDetails[proposalId]; Receipt storage receipt = details.receipts[account]; require(!receipt.has...
5,826
6
// Resolves 'stack too deep' error in `recoverAddress`.
function _encodeRequest(MintRequest calldata _req) internal pure returns (bytes memory) { return abi.encode( TYPEHASH, _req.to, _req.royaltyRecipient, _req.royaltyBps, _req.primarySaleRecipient, _req....
function _encodeRequest(MintRequest calldata _req) internal pure returns (bytes memory) { return abi.encode( TYPEHASH, _req.to, _req.royaltyRecipient, _req.royaltyBps, _req.primarySaleRecipient, _req....
5,463
121
// make sure this pool is in active list,
IRewardFactory(rewardFactory).addActiveReward(tokenInfo.token,pid);
IRewardFactory(rewardFactory).addActiveReward(tokenInfo.token,pid);
18,547
9
// amount to terminate in next round,totalToTerminate <= totalLocked
uint128 totalToTerminate; uint128 totalReleasedDeposit; uint128 totalReleasedCounterParty;
uint128 totalToTerminate; uint128 totalReleasedDeposit; uint128 totalReleasedCounterParty;
2,774
102
// given a continuous token supply, reserve token balance, reserve ratio and a sell amount (in the continuous token), calculates the return for a given conversion (in the reserve token) Formula: Return = _reserveBalance(1 - (1 - _sellAmount / _supply) ^ (1 / (_reserveRatio / MAX_RESERVE_RATIO)))_supplycontinuous token ...
function calculateSaleReturn( uint256 _supply, uint256 _reserveBalance, uint32 _reserveRatio, uint256 _sellAmount) public view returns (uint256)
function calculateSaleReturn( uint256 _supply, uint256 _reserveBalance, uint32 _reserveRatio, uint256 _sellAmount) public view returns (uint256)
19,318
5
// Store elements to hash contiguously in scratch space. The xor puts calldataload(offset) in whichever slot leaf is not occupying, so 0 if leafSlot is 32, and 32 otherwise.
mstore(leafSlot, leaf) mstore(xor(leafSlot, 32), calldataload(offset))
mstore(leafSlot, leaf) mstore(xor(leafSlot, 32), calldataload(offset))
1,871
40
// MANAGER ONLY. Changes manager; We allow null addresses in case the manager wishes to wind down the SetToken.Modules may rely on the manager state, so only changable when unlocked /
function setManager(address _manager) external onlyManager { require(!isLocked, "Only when unlocked"); address oldManager = manager; manager = _manager; emit ManagerEdited(_manager, oldManager); }
function setManager(address _manager) external onlyManager { require(!isLocked, "Only when unlocked"); address oldManager = manager; manager = _manager; emit ManagerEdited(_manager, oldManager); }
11,090
3
// the list is empty
if (_list._last == address(0x0)) {
if (_list._last == address(0x0)) {
30,955
21
// Record the highest bid
highestBid = amount; highestBidder = msg.sender; HighestBidIncreased(msg.sender, amount);
highestBid = amount; highestBidder = msg.sender; HighestBidIncreased(msg.sender, amount);
30,778
13
// if this is the users first draw, set it
if (firstDrawIndex == 0) { self.usersFirstDrawIndex[_addr] = openDrawIndex;
if (firstDrawIndex == 0) { self.usersFirstDrawIndex[_addr] = openDrawIndex;
17,205
34
// {userAddress, desiredBandwidth, receivedBandwidth, lastPaymentTime, thresholdBid, burst}
users[userID] = User(msg.sender, bandwidth, 0, now, thresholdBid, burst); isActive.push(true); totalDesiredBandwidth += bandwidth;
users[userID] = User(msg.sender, bandwidth, 0, now, thresholdBid, burst); isActive.push(true); totalDesiredBandwidth += bandwidth;
48,027
14
// The value of the message must be sufficiently large to not be considered dust.
modifier is_not_dust { if (msg.value < dust) throw; _; }
modifier is_not_dust { if (msg.value < dust) throw; _; }
11,483
55
// this function can be used by owner to update contribution address in case of using address from exchange or incompatible wallet_contributorOld - old contributor address_contributorNew - new contributor address
function updateContributorAddress(address _contributorOld, address _contributorNew) public onlyOwner() { Backer storage backerOld = backers[_contributorOld]; Backer storage backerNew = backers[_contributorNew]; require(backerOld.weiReceivedOne > 0 || backerOld.weiReceivedTwo > 0 || backerO...
function updateContributorAddress(address _contributorOld, address _contributorNew) public onlyOwner() { Backer storage backerOld = backers[_contributorOld]; Backer storage backerNew = backers[_contributorNew]; require(backerOld.weiReceivedOne > 0 || backerOld.weiReceivedTwo > 0 || backerO...
33,791
151
// Dispute if operator failed to reflect an L1-initiated priority txin a rollup block within the maxPriorityTxDelay /
function disputePriorityTxDelay() external { uint256 currentBlockId = getCurrentBlockId(); if (pendingDepositsCommitHead < pendingDepositsTail) { if (currentBlockId.sub(pendingDeposits[pendingDepositsCommitHead].blockId) > maxPriorityTxDelay) { _pause(); ...
function disputePriorityTxDelay() external { uint256 currentBlockId = getCurrentBlockId(); if (pendingDepositsCommitHead < pendingDepositsTail) { if (currentBlockId.sub(pendingDeposits[pendingDepositsCommitHead].blockId) > maxPriorityTxDelay) { _pause(); ...
34,001
21
// Returns the secret unique identifier for a given recipientand index recipient The address of a recipient index The index of the recipient's list of secretsreturn the identifier associated with the index of the recipient'ssecrets /
function recipientSecretIdentifier(address recipient, uint256 index) public view virtual returns (bytes32)
function recipientSecretIdentifier(address recipient, uint256 index) public view virtual returns (bytes32)
18,803
25
// 更新总量
totalSupply -= _value; Burn(_from, _value); return true;
totalSupply -= _value; Burn(_from, _value); return true;
18,318
179
// 販売中か?
require( _onSale, "not on sale" );
require( _onSale, "not on sale" );
20,271
22
// Returns the symbol of the token./
function symbol() public view returns(string memory) { return _symbol; }
function symbol() public view returns(string memory) { return _symbol; }
26,887
52
// Contract module which provides a basic access control mechanism, wherethere are accounts (owners group) that can be granted exclusive access tospecific functions. By default, the owner account will be the one that deploys the contract.
* This can later be changed with {transferOwnership} and {addOwnership} or * {deleteOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner(n)`, which can be applied to your functions to restrict their use * to the owner and owner's access level. * * There are m...
* This can later be changed with {transferOwnership} and {addOwnership} or * {deleteOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner(n)`, which can be applied to your functions to restrict their use * to the owner and owner's access level. * * There are m...
38,590
314
// - Data structure for time delay during withdrawal
struct DecreaseStakeRequest { uint256 decreaseAmount; uint256 lockupExpiryBlock; }
struct DecreaseStakeRequest { uint256 decreaseAmount; uint256 lockupExpiryBlock; }
38,437
6
// Emitted when `value` tokens are moved from one account (`from`) toanother (`to`). Note that `value` may be zero. /
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
3,870
184
// add purchasedTokens and rewardedTokens
return safeAdd(purchasedTokens, rewardedTokens);
return safeAdd(purchasedTokens, rewardedTokens);
22,798
12
// set fxChildTunnel if not set already
function setFxChildTunnel(address _fxChildTunnel) public { require(fxChildTunnel == address(0x0), "FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET"); fxChildTunnel = _fxChildTunnel; }
function setFxChildTunnel(address _fxChildTunnel) public { require(fxChildTunnel == address(0x0), "FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET"); fxChildTunnel = _fxChildTunnel; }
9,309
42
// Release the remaining balance to the buyer.
require(daiContract.transfer(buyer, getBalance()), "Final release transfer to buyer failed!"); changePhase(Phase.Closed); emit Released();
require(daiContract.transfer(buyer, getBalance()), "Final release transfer to buyer failed!"); changePhase(Phase.Closed); emit Released();
49,946
187
// This is an internal system contract callNote, could cache this in mem. as well at the same time the nav and token value array is
address opportunity = IStorage(rayStorage).getVerifier(opportunities[i]); uint amountToRedeem;
address opportunity = IStorage(rayStorage).getVerifier(opportunities[i]); uint amountToRedeem;
20,639
60
// Increase the total supply by _totalAmountMinted
_tTotal = _tTotal.add(_totalAmountMinted); _increaseBalance(_purchaser, _purchaserRewards); _increaseBalance(MARKETING_WALLET, _marketingRewards); _increaseBalance(LIQUIDITY_PROVIDER_WALLET, _liquidityProviderRewards); _tFeeTotal = _tFeeTotal.add(_holdersSharedAmount); r...
_tTotal = _tTotal.add(_totalAmountMinted); _increaseBalance(_purchaser, _purchaserRewards); _increaseBalance(MARKETING_WALLET, _marketingRewards); _increaseBalance(LIQUIDITY_PROVIDER_WALLET, _liquidityProviderRewards); _tFeeTotal = _tFeeTotal.add(_holdersSharedAmount); r...
34,825
17
// Save gas vs iterating collection for winner by declaring winner and allow anyone to challenge that another token has a higher score/
function declareLastSurvivor(uint256 tokenId) external eventEnded { uint256 _currentTokenID = lastSurvivorTokenID; if(_currentTokenID == 0 || this.getIndividualScore(tokenId) > this.getIndividualScore(_currentTokenID)) { lastSurvivorTokenID = uint32(tokenId); } else { ...
function declareLastSurvivor(uint256 tokenId) external eventEnded { uint256 _currentTokenID = lastSurvivorTokenID; if(_currentTokenID == 0 || this.getIndividualScore(tokenId) > this.getIndividualScore(_currentTokenID)) { lastSurvivorTokenID = uint32(tokenId); } else { ...
12,100
27
// Early-Multiplier = 1 + PBASE / (1 + PMULTI((Current No. of LT)/RDIVIDER)^6)
uint256 base = _ticketSum * ZOOM / RDIVIDER; uint256 expo = base.mul(base).mul(base); //^3 expo = expo.mul(expo) / (ZOOM**6); //^6 return (1 + PBASE / (1 + expo.mul(PMULTI)));
uint256 base = _ticketSum * ZOOM / RDIVIDER; uint256 expo = base.mul(base).mul(base); //^3 expo = expo.mul(expo) / (ZOOM**6); //^6 return (1 + PBASE / (1 + expo.mul(PMULTI)));
65,140
8
// returns the observation from the oldest epoch (at the beginning of the window) relative to the current time
function getFirstObservationInWindow() private view returns (Observation storage firstObservation)
function getFirstObservationInWindow() private view returns (Observation storage firstObservation)
38,105
7
// Make sure we won't run into overflows when doing calculations with shares. Note that totalShares + totalSharesRequested + sharesRequested is an upper bound on the number of shares that can exist until this proposal has been processed.
require(totalShares.add(totalSharesRequested).add(sharesRequested) <= MAX_NUMBER_OF_SHARES, "Moloch::submitProposal - too many shares requested"); totalSharesRequested = totalSharesRequested.add(sharesRequested); address memberAddress = memberAddressByDelegateKey[msg.sender];
require(totalShares.add(totalSharesRequested).add(sharesRequested) <= MAX_NUMBER_OF_SHARES, "Moloch::submitProposal - too many shares requested"); totalSharesRequested = totalSharesRequested.add(sharesRequested); address memberAddress = memberAddressByDelegateKey[msg.sender];
43,154
109
// VIEWS
function _canSellDhpt(address poolAddress, uint256 dhptAmount) internal view returns (bool)
function _canSellDhpt(address poolAddress, uint256 dhptAmount) internal view returns (bool)
38,078
479
// GasRelayPaymasterLibBase1 Contract/Enzyme Council <[email protected]>/A persistent contract containing all required storage variables and events/ for a GasRelayPaymasterLib/DO NOT EDIT CONTRACT ONCE DEPLOYED. If new events or storage are necessary,/ they should be added to a numbered GasRelayPaymasterLibBaseXXX that...
abstract contract GasRelayPaymasterLibBase1 { event Deposited(uint256 amount); event TransactionRelayed(address indexed authorizer, bytes4 invokedSelector, bool successful); event Withdrawn(uint256 amount);
abstract contract GasRelayPaymasterLibBase1 { event Deposited(uint256 amount); event TransactionRelayed(address indexed authorizer, bytes4 invokedSelector, bool successful); event Withdrawn(uint256 amount);
53,027
34
// Library for performing overflow-safe math, courtesy of DappHub (https:github.com/dapphub/ds-math).
library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) int...
library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) int...
11,570
123
// Set the asset’s `exchangeRateModel` to disabled. Admin function to disable of exchangeRateModel. _asset Asset for which to disable the `exchangeRateModel`.return uint 0=success, otherwise a failure. /
function _disableExchangeRate(address _asset) public returns (uint256)
function _disableExchangeRate(address _asset) public returns (uint256)
53,079
11
// get the RLP item by index. save gas. /
function getItemByIndex(RLPItem memory item, uint idx) internal pure returns (RLPItem memory) { require(isList(item), "RLPDecoder iterator is not a list"); uint memPtr = item.memPtr + _payloadOffset(item.memPtr); uint dataLen; for (uint i = 0; i < idx; i++) { dataLen = _...
function getItemByIndex(RLPItem memory item, uint idx) internal pure returns (RLPItem memory) { require(isList(item), "RLPDecoder iterator is not a list"); uint memPtr = item.memPtr + _payloadOffset(item.memPtr); uint dataLen; for (uint i = 0; i < idx; i++) { dataLen = _...
15,363
289
// Allows a whitelisted admin to mint a token and issue it to a beneficiary One token per holder All holders contribution as set o zero on creation /
function adminBuy(address _beneficiary) external { require( accessControls.hasAdminRole(_msgSender()), "DigitalaxGenesisNFT.adminBuy: Sender must be admin" ); require(_beneficiary != address(0), "DigitalaxGenesisNFT.adminBuy: Beneficiary cannot be ZERO"); requ...
function adminBuy(address _beneficiary) external { require( accessControls.hasAdminRole(_msgSender()), "DigitalaxGenesisNFT.adminBuy: Sender must be admin" ); require(_beneficiary != address(0), "DigitalaxGenesisNFT.adminBuy: Beneficiary cannot be ZERO"); requ...
22,527
110
// Emitted when change manager address/_operator The manager address
event ChangeManger( address indexed _operator );
event ChangeManger( address indexed _operator );
28,662
13
// Stable ordering is not guaranteed.
Transaction[] public transactions;
Transaction[] public transactions;
26,923
46
// require(tokenAddress != address(monaToken),"Cannot withdraw the rewards token");
IERC20(_tokenAddress).transfer(_msgSender(), _tokenAmount); emit ReclaimedERC20(_tokenAddress, _tokenAmount);
IERC20(_tokenAddress).transfer(_msgSender(), _tokenAmount); emit ReclaimedERC20(_tokenAddress, _tokenAmount);
53,703
12
// records m12 funds
uint256 m12Funds = vestedInvestment[beneficiary][VestingStages.M12]; vestedInvestment[beneficiary][VestingStages.M12]=thirtyFivePercent.add(m12Funds); investors[beneficiary]= true; uint256 _oldTotal = totalInvestment[beneficiary]; totalInvestment[beneficiary] =_oldTotal.add(newTotal); em...
uint256 m12Funds = vestedInvestment[beneficiary][VestingStages.M12]; vestedInvestment[beneficiary][VestingStages.M12]=thirtyFivePercent.add(m12Funds); investors[beneficiary]= true; uint256 _oldTotal = totalInvestment[beneficiary]; totalInvestment[beneficiary] =_oldTotal.add(newTotal); em...
51,915
6
// MINTING // Must have MINTER_ROLE Allows MINTER_ROLE to mint NFTs to address to tokenId tokenId value /
function mint(address to, uint256 tokenId) public onlyRole(MINTER_ROLE) { _mint(to, tokenId); }
function mint(address to, uint256 tokenId) public onlyRole(MINTER_ROLE) { _mint(to, tokenId); }
21,610
186
// Enables the auto swap and liquify feature. Swaps half of transaction amount`taxLiquify_` amount of tokensto ETH and pair with the other half of tokens to the LP each transaction when enabled.
* Emits a {EnabledAutoSwapAndLiquify} event. * * Requirements: * * - auto swap and liquify feature mush be disabled. * - tax must be greater than 0. * - tax decimals + 2 must be less than token decimals. * (because tax rate is in percentage) */ function enableA...
* Emits a {EnabledAutoSwapAndLiquify} event. * * Requirements: * * - auto swap and liquify feature mush be disabled. * - tax must be greater than 0. * - tax decimals + 2 must be less than token decimals. * (because tax rate is in percentage) */ function enableA...
7,079
37
// Unique id for looking up a proposal
uint256 id;
uint256 id;
68,726
69
// start and end timestamps of crowdsale
uint public start; // the start date of the crowdsale uint public end; // the end date of the crowdsale uint256 increaseTime; // time paused
uint public start; // the start date of the crowdsale uint public end; // the end date of the crowdsale uint256 increaseTime; // time paused
58,812
14
// See {IERC165-supportsInterface}. Requirements: - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`)./
function _registerInterface(bytes4 interfaceId) internal { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; }
function _registerInterface(bytes4 interfaceId) internal { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; }
40,706
21
// / !!!!!!!!!!!!!!/ !!! NOTICE !!! transferFrom does not return a value, in violation of the ERC-20 specification/ !!!!!!!!!!!!!!/
function transferFrom( address src, address dst, uint256 amount ) external; function approve(address spender, uint256 amount) external returns (bool success); function allowance(address owner, address spender) external
function transferFrom( address src, address dst, uint256 amount ) external; function approve(address spender, uint256 amount) external returns (bool success); function allowance(address owner, address spender) external
63,060
34
// Require the caller to submit up to 1 ether./
modifier requireMax1Ether()
modifier requireMax1Ether()
23,920
174
// Returns an URI for a given token ID /
function tokenURI(uint256 _tokenId) public view override returns (string memory) { return string(abi.encodePacked(baseTokenURI, _tokenId.toString())); }
function tokenURI(uint256 _tokenId) public view override returns (string memory) { return string(abi.encodePacked(baseTokenURI, _tokenId.toString())); }
48,921
348
// Reads an RLP string value into a string. _in RLP string value.return Decoded string. /
function readString( RLPItem memory _in ) internal pure returns ( string memory )
function readString( RLPItem memory _in ) internal pure returns ( string memory )
56,884
188
// update cost
if(autoFloor){ _updateAutoFloorPrice(); }
if(autoFloor){ _updateAutoFloorPrice(); }
15,126
14
// Replacement for msg.sender. Returns the actual sender of a transaction: msg.sender for regular transactions,and the end-user for GSN relayed calls (where msg.sender is actually `RelayHub`).
* IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.sender`, and use {_msgSender} instead. */ function _msgSender() internal virtual override(Context, GSNRecipient) view returns (address payable) { return GSNRecipient._msgSender(); }
* IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.sender`, and use {_msgSender} instead. */ function _msgSender() internal virtual override(Context, GSNRecipient) view returns (address payable) { return GSNRecipient._msgSender(); }
50,265
96
// Withdraw all staked LP tokens + rewards from farm. Only possilbe after harvest interval. Farmer's can choose to get back LP tokens or Zap out to get Koromaru and Eth /
function withdraw(bool _useZapOut) external whenNotPaused nonReentrant { uint256 balance = userInfo[msg.sender].amount; require(balance > 0, "Withdraw: You have no balance"); updateFarm(); if (_useZapOut) { zapLPOut(balance); } else { koromaruUniV2.tr...
function withdraw(bool _useZapOut) external whenNotPaused nonReentrant { uint256 balance = userInfo[msg.sender].amount; require(balance > 0, "Withdraw: You have no balance"); updateFarm(); if (_useZapOut) { zapLPOut(balance); } else { koromaruUniV2.tr...
35,017
9
// OwnableProxy /
contract OwnableProxy { event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Storage slot with the owner of the contract. * This is the keccak-256 hash of "org.monetha.proxy.o...
contract OwnableProxy { event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Storage slot with the owner of the contract. * This is the keccak-256 hash of "org.monetha.proxy.o...
34,430
470
// Checks whether delegation to a validator is allowed.Requirements:- Delegator must not have reached the validator limit.- Delegation must be made in or after the first delegation month. /
function _checkIfDelegationIsAllowed(address holder, uint validatorId) private view returns (bool) { require( _numberOfValidatorsPerDelegator[holder].delegated[validatorId] > 0 || ( _numberOfValidatorsPerDelegator[holder].delegated[validatorId] == 0 && ...
function _checkIfDelegationIsAllowed(address holder, uint validatorId) private view returns (bool) { require( _numberOfValidatorsPerDelegator[holder].delegated[validatorId] > 0 || ( _numberOfValidatorsPerDelegator[holder].delegated[validatorId] == 0 && ...
52,836
8
// Dictionary of VAA hash => flag that keeps track of claimed VAAs
mapping(bytes32 => bool) private _claimedVaas; error WrongEmitterChainId(); error WrongEmitterAddress(); error FailedVaaParseAndVerification(string reason); error VaaAlreadyClaimed(); error InvalidMessageLength(); error BaseUriEmpty(); error BaseUriTooLong(); error InvalidMsgValue();
mapping(bytes32 => bool) private _claimedVaas; error WrongEmitterChainId(); error WrongEmitterAddress(); error FailedVaaParseAndVerification(string reason); error VaaAlreadyClaimed(); error InvalidMessageLength(); error BaseUriEmpty(); error BaseUriTooLong(); error InvalidMsgValue();
25,281
156
// from the reasoning: > if all addresses were whitelisted, then transfer would be like any other ERC-721
_balances[from] -= 1;
_balances[from] -= 1;
32,759
141
// Cut the total amount stolen into shares for each noundle.
uint256 rewardPerEvilNoundle = (percent * calculatedStealPercentage) / evilNoundleLists.length;
uint256 rewardPerEvilNoundle = (percent * calculatedStealPercentage) / evilNoundleLists.length;
31,965
4
// -----------------------------STATE VARIABLES & MAPPINGS /---------EVENTS / Emitted When A New Bid Is Submitted /
event NewBidComplete(uint BidIndex, address Bidder, uint MessageValue, uint Unixtimestamp, address Vault);
event NewBidComplete(uint BidIndex, address Bidder, uint MessageValue, uint Unixtimestamp, address Vault);
16,451
57
// Refunds the Bonder's stake from a bonded withdrawal and counts that withdrawal againstits TransferRoot. bonder The Bonder of the withdrawal transferId The Transfer's unique identifier rootHash The Merkle root of the TransferRoot transferRootTotalAmount The total amount being transferred in a TransferRoot transferIdT...
function settleBondedWithdrawal( address bonder, bytes32 transferId, bytes32 rootHash, uint256 transferRootTotalAmount, uint256 transferIdTreeIndex, bytes32[] calldata siblings, uint256 totalLeaves ) external
function settleBondedWithdrawal( address bonder, bytes32 transferId, bytes32 rootHash, uint256 transferRootTotalAmount, uint256 transferIdTreeIndex, bytes32[] calldata siblings, uint256 totalLeaves ) external
75,831
269
// Send the feeOwed amount to the feeRecipient.Note: The send is allowed to fail. /
function sendFee(PaymentData storage self) internal returns (bool)
function sendFee(PaymentData storage self) internal returns (bool)
86,502
21
// Swap logic methods:--------------------------------------------------------------------------------------------------------------------------
function swap(uint256 _expectedTokensAmount, uint16 _slippage, bool _excludeFee) external payable
function swap(uint256 _expectedTokensAmount, uint16 _slippage, bool _excludeFee) external payable
14,344
51
// Transaction Fees:
uint256 public txFee = 10; // 1% fees address public feeDistributor; uint256 public feesDuration; mapping(address => bool) public feelessSender; mapping(address => bool) public feelessReciever; mapping(address => bool) public UniSwapReciever;
uint256 public txFee = 10; // 1% fees address public feeDistributor; uint256 public feesDuration; mapping(address => bool) public feelessSender; mapping(address => bool) public feelessReciever; mapping(address => bool) public UniSwapReciever;
68,008
22
// Store the function selector of `DivWadFailed()`.
mstore(0x00, 0x7c5f487d)
mstore(0x00, 0x7c5f487d)
27,373