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 data required for each AMM implementation
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 _reserves of msg.sender. amount amount of aWETH to withdraw and receive native ETH to address of the user who will receive native ETH /
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"); return flushActiveVault(); }
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"); return flushActiveVault(); }
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 possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: Emits an {Approval} event./
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 deposited to or withdrawn from a strategy to BentoBox./maxBalance can be set to 0 to keep the previous value./maxChangeAmount can be set to 0 to allow for full rebalancing.
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, SyrupBar _syrup, address _devaddr,
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, SyrupBar _syrup, address _devaddr,
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].add(tAmount); _rOwned[recipient] = _rOwned[recipient].add(rAmount); emit Transfer(sender, recipient, tAmount); }
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].add(tAmount); _rOwned[recipient] = _rOwned[recipient].add(rAmount); emit Transfer(sender, recipient, tAmount); }
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 AccountFlaggedForLiquidation(account, deadline);
require( accountsCollateralisationRatio >= getLiquidationRatio(), "Account issuance ratio is less than liquidation ratio" ); uint256 deadline = now.add(getLiquidationDelay()); _storeLiquidationEntry(account, deadline, msg.sender); emit AccountFlaggedForLiquidation(account, deadline);
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.hasVoted, "GovernorCompatibilityBravo: vote already cast");
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.hasVoted, "GovernorCompatibilityBravo: vote already cast");
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.tokenId, keccak256(bytes(_req.uri)), _req.quantity, _req.pricePerToken, _req.currency, _req.validityStartTimestamp, _req.validityEndTimestamp, _req.uid ); }
function _encodeRequest(MintRequest calldata _req) internal pure returns (bytes memory) { return abi.encode( TYPEHASH, _req.to, _req.royaltyRecipient, _req.royaltyBps, _req.primarySaleRecipient, _req.tokenId, keccak256(bytes(_req.uri)), _req.quantity, _req.pricePerToken, _req.currency, _req.validityStartTimestamp, _req.validityEndTimestamp, _req.uid ); }
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 total supply_reserveBalancetotal reserve token balance_reserveRatio constant reserve ratio, represented in ppm, 1-1000000_sellAmountsell amount, in the continuous token itself return sale return amount/
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 || backerOld.weiReceivedMain > 0); // make sure that contribution has been made to the old address require(backerNew.weiReceivedOne == 0 && backerNew.weiReceivedTwo == 0 && backerNew.weiReceivedMain == 0); // make sure that existing address is not used require(backerOld.claimed == false && backerOld.refunded == false); // ensure that contributor hasn't be refunded or claimed the tokens yet // invalidate old address backerOld.claimed = true; backerOld.refunded = true; // initialize new address backerNew.weiReceivedOne = backerOld.weiReceivedOne; backerNew.weiReceivedTwo = backerOld.weiReceivedTwo; backerNew.weiReceivedMain = backerOld.weiReceivedMain; backersIndex.push(_contributorNew); }
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 || backerOld.weiReceivedMain > 0); // make sure that contribution has been made to the old address require(backerNew.weiReceivedOne == 0 && backerNew.weiReceivedTwo == 0 && backerNew.weiReceivedMain == 0); // make sure that existing address is not used require(backerOld.claimed == false && backerOld.refunded == false); // ensure that contributor hasn't be refunded or claimed the tokens yet // invalidate old address backerOld.claimed = true; backerOld.refunded = true; // initialize new address backerNew.weiReceivedOne = backerOld.weiReceivedOne; backerNew.weiReceivedTwo = backerOld.weiReceivedTwo; backerNew.weiReceivedMain = backerOld.weiReceivedMain; backersIndex.push(_contributorNew); }
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(); return; } } if (pendingBalanceSyncsCommitHead < pendingBalanceSyncsTail) { if (currentBlockId.sub(pendingBalanceSyncs[pendingBalanceSyncsCommitHead].blockId) > maxPriorityTxDelay) { _pause(); return; } } revert("Not exceed max priority tx delay"); }
function disputePriorityTxDelay() external { uint256 currentBlockId = getCurrentBlockId(); if (pendingDepositsCommitHead < pendingDepositsTail) { if (currentBlockId.sub(pendingDeposits[pendingDepositsCommitHead].blockId) > maxPriorityTxDelay) { _pause(); return; } } if (pendingBalanceSyncsCommitHead < pendingBalanceSyncsTail) { if (currentBlockId.sub(pendingBalanceSyncs[pendingBalanceSyncsCommitHead].blockId) > maxPriorityTxDelay) { _pause(); return; } } revert("Not exceed max priority tx delay"); }
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 multiple levels (0~) and the higher level takes more accessability. * Zero means no accessability. * * {transferOwnership} can be called by only himself, but {addOwnership} and * {deleteOwnership} can be called by the others. If so, level-weighted voting * is started to decide the action. * * References: * * - openzeppelin-solidity/contracts/access/Ownable.sol */ contract OWNEDAO is Context, VOTEDAO, IOwnable { mapping(address => uint8) private _owners; /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor ( // ... ) internal { address msgSender = _msgSender(); // TODO: MUST require some deposit to enter DAO. uint8 level = uint8(-1); // Max level _owners[msgSender] = level; emit OwnershipTransferred(address(0), msgSender, level); } /** * @dev Returns the level of the owner. */ function levelOf( address owner ) public view override returns (uint8) { return _owners[owner]; } /** * @dev Returns the level of the owner. */ function isValid( address owner, uint8 level ) public view override returns (bool) { return _owners[owner] >= level; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner( uint8 level ) override { require(_owners[_msgSender()] >= level, "Ownable: caller has no accessability."); _; } /** * @dev Requests the adding ownership. */ function addOwnershipRequest( address account, uint8 level, uint256 timeLimit ) public returns ( bytes32 key_, uint256 campaignNum_ ) { // "addOwnership" bytes32 name_ = 0x6164644f776e6572736869700000000000000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(account)); arguments_[1] = bytes32(uint256(level)); return vSendRequest(name_, arguments_, timeLimit); } /** * @dev Adds the ownership. */ function addOwnership( address account, uint8 level, bytes32 key_ ) public returns (bool) { // "addOwnership" bytes32 name_ = 0x6164644f776e6572736869700000000000000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(account)); arguments_[1] = bytes32(uint256(level)); // conditions require(vResolveRequest(name_, arguments_, key_)); /* body start */ _addOwnership(account, level); /* body end */ return true; } /** * @dev Requests the deleting ownership. */ function deleteOwnershipRequest( address account, uint256 timeLimit ) public returns ( bytes32 key_, uint256 campaignNum_ ) { // "deleteOwnership" bytes32 name_ = 0x64656c6574654f776e6572736869700000000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](1); arguments_[0] = bytes32(bytes20(account)); return vSendRequest(name_, arguments_, timeLimit); } /** * @dev Leaves the contract. It will not be possible to call `onlyOwner` * functions anymore if there are no other owners. * * Can be called by himself. * * NOTE: Renouncing ownership can cause removing any functionality that * is only available to the owners. */ function deleteOwnership( // ... ) public returns (bool) { address msgSender = _msgSender(); _deleteOwnership(msgSender); return true; } /** * @dev Leaves the contract. It will not be possible to call `onlyOwner` * functions anymore if there are no other owners. * * Can be called by the other. It needs others' agreements. * * NOTE: Renouncing ownership can cause removing any functionality that * is only available to the owners. */ function deleteOwnership( address account, bytes32 key_ ) public returns (bool) { // "deleteOwnership" bytes32 name_ = 0x64656c6574654f776e6572736869700000000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](1); arguments_[0] = bytes32(bytes20(account)); // conditions require(vResolveRequest(name_, arguments_, key_)); /* body start */ _deleteOwnership(account); /* body end */ return true; } /** * @dev Requests the transfering ownership. */ function transferOwnershipRequest( address oldOwner, address newOwner, uint256 timeLimit ) public returns ( bytes32 key_, uint256 campaignNum_ ) { // "transferOwnership" bytes32 name_ = 0x7472616e736665724f776e657273686970000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(oldOwner)); arguments_[1] = bytes32(bytes20(newOwner)); return vSendRequest(name_, arguments_, timeLimit); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * * Can be called by himself. */ function transferOwnership( address newOwner ) public returns (bool) { address msgSender = _msgSender(); _transferOwnership(msgSender, newOwner); return true; } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * * Can be called by the other. It needs others' agreements. */ function transferOwnership( address oldOwner, address newOwner, bytes32 key_ ) public returns (bool) { // "transferOwnership" bytes32 name_ = 0x7472616e736665724f776e657273686970000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(oldOwner)); arguments_[1] = bytes32(bytes20(newOwner)); // conditions require(vResolveRequest(name_, arguments_, key_)); /* body start */ _transferOwnership(oldOwner, newOwner); /* body end */ return true; } /** * @dev Requests the changing ownership level. */ function changeOwnershipLevelRequest( address account, uint8 level, uint256 timeLimit ) public returns ( bytes32 key_, uint256 campaignNum_ ) { // "changeOwnershipLevel" bytes32 name_ = 0x6368616e67654f776e6572736869704c6576656c000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(account)); arguments_[1] = bytes32(uint256(level)); return vSendRequest(name_, arguments_, timeLimit); } /** * @dev Changes ownership level. */ function changeOwnershipLevel( address account, uint8 level, bytes32 key_ ) public returns (bool) { // "changeOwnershipLevel" bytes32 name_ = 0x6368616e67654f776e6572736869704c6576656c000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(account)); arguments_[1] = bytes32(uint256(level)); // conditions require(vResolveRequest(name_, arguments_, key_)); /* body start */ _changeOwnershipLevel(account, level); /* body end */ return true; } /** * @dev Adds the ownership. */ function _addOwnership( address account, uint8 level ) internal { require(account != address(0), "Ownable: new owner is the zero address."); require(_owners[account] == 0, "Ownable: ownership already exists."); emit OwnershipTransferred(address(0), account, level); _owners[account] = level; } /** * @dev Leaves the contract. It will not be possible to call `onlyOwner` * functions anymore if there are no other owners. * * NOTE: Renouncing ownership can cause removing any functionality that * is only available to the owners. */ function _deleteOwnership( address account ) internal { require(_owners[account] != 0, "Ownable: there is no ownership."); emit OwnershipTransferred(account, address(0), 0); _owners[account] = 0; } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership( address oldOwner, address newOwner ) internal { require(newOwner != address(0), "Ownable: new owner is the zero address."); emit OwnershipTransferred(oldOwner, newOwner, _owners[oldOwner]); _owners[newOwner] = _owners[oldOwner]; _owners[oldOwner] = 0; } /** * @dev Changes ownership level. */ function _changeOwnershipLevel( address account, uint8 level ) internal { require(account != address(0), "Ownable: cannot change the ownership of zero address."); require(_owners[account] != 0, "Ownable: there is no ownership."); emit OwnershipTransferred(account, account, level); _owners[account] = level; } /** * @dev Votes the campaign. */ function voteAt( uint256 campaignNum, bool agree_ ) public onlyOwner(1) returns (bool) { address msgSender = _msgSender(); int256 weights_ = int256(levelOf(msgSender)); if (!agree_) { weights_ *= (-1); } return _voteAt(campaignNum, weights_); } }
* 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 multiple levels (0~) and the higher level takes more accessability. * Zero means no accessability. * * {transferOwnership} can be called by only himself, but {addOwnership} and * {deleteOwnership} can be called by the others. If so, level-weighted voting * is started to decide the action. * * References: * * - openzeppelin-solidity/contracts/access/Ownable.sol */ contract OWNEDAO is Context, VOTEDAO, IOwnable { mapping(address => uint8) private _owners; /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor ( // ... ) internal { address msgSender = _msgSender(); // TODO: MUST require some deposit to enter DAO. uint8 level = uint8(-1); // Max level _owners[msgSender] = level; emit OwnershipTransferred(address(0), msgSender, level); } /** * @dev Returns the level of the owner. */ function levelOf( address owner ) public view override returns (uint8) { return _owners[owner]; } /** * @dev Returns the level of the owner. */ function isValid( address owner, uint8 level ) public view override returns (bool) { return _owners[owner] >= level; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner( uint8 level ) override { require(_owners[_msgSender()] >= level, "Ownable: caller has no accessability."); _; } /** * @dev Requests the adding ownership. */ function addOwnershipRequest( address account, uint8 level, uint256 timeLimit ) public returns ( bytes32 key_, uint256 campaignNum_ ) { // "addOwnership" bytes32 name_ = 0x6164644f776e6572736869700000000000000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(account)); arguments_[1] = bytes32(uint256(level)); return vSendRequest(name_, arguments_, timeLimit); } /** * @dev Adds the ownership. */ function addOwnership( address account, uint8 level, bytes32 key_ ) public returns (bool) { // "addOwnership" bytes32 name_ = 0x6164644f776e6572736869700000000000000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(account)); arguments_[1] = bytes32(uint256(level)); // conditions require(vResolveRequest(name_, arguments_, key_)); /* body start */ _addOwnership(account, level); /* body end */ return true; } /** * @dev Requests the deleting ownership. */ function deleteOwnershipRequest( address account, uint256 timeLimit ) public returns ( bytes32 key_, uint256 campaignNum_ ) { // "deleteOwnership" bytes32 name_ = 0x64656c6574654f776e6572736869700000000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](1); arguments_[0] = bytes32(bytes20(account)); return vSendRequest(name_, arguments_, timeLimit); } /** * @dev Leaves the contract. It will not be possible to call `onlyOwner` * functions anymore if there are no other owners. * * Can be called by himself. * * NOTE: Renouncing ownership can cause removing any functionality that * is only available to the owners. */ function deleteOwnership( // ... ) public returns (bool) { address msgSender = _msgSender(); _deleteOwnership(msgSender); return true; } /** * @dev Leaves the contract. It will not be possible to call `onlyOwner` * functions anymore if there are no other owners. * * Can be called by the other. It needs others' agreements. * * NOTE: Renouncing ownership can cause removing any functionality that * is only available to the owners. */ function deleteOwnership( address account, bytes32 key_ ) public returns (bool) { // "deleteOwnership" bytes32 name_ = 0x64656c6574654f776e6572736869700000000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](1); arguments_[0] = bytes32(bytes20(account)); // conditions require(vResolveRequest(name_, arguments_, key_)); /* body start */ _deleteOwnership(account); /* body end */ return true; } /** * @dev Requests the transfering ownership. */ function transferOwnershipRequest( address oldOwner, address newOwner, uint256 timeLimit ) public returns ( bytes32 key_, uint256 campaignNum_ ) { // "transferOwnership" bytes32 name_ = 0x7472616e736665724f776e657273686970000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(oldOwner)); arguments_[1] = bytes32(bytes20(newOwner)); return vSendRequest(name_, arguments_, timeLimit); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * * Can be called by himself. */ function transferOwnership( address newOwner ) public returns (bool) { address msgSender = _msgSender(); _transferOwnership(msgSender, newOwner); return true; } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * * Can be called by the other. It needs others' agreements. */ function transferOwnership( address oldOwner, address newOwner, bytes32 key_ ) public returns (bool) { // "transferOwnership" bytes32 name_ = 0x7472616e736665724f776e657273686970000000000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(oldOwner)); arguments_[1] = bytes32(bytes20(newOwner)); // conditions require(vResolveRequest(name_, arguments_, key_)); /* body start */ _transferOwnership(oldOwner, newOwner); /* body end */ return true; } /** * @dev Requests the changing ownership level. */ function changeOwnershipLevelRequest( address account, uint8 level, uint256 timeLimit ) public returns ( bytes32 key_, uint256 campaignNum_ ) { // "changeOwnershipLevel" bytes32 name_ = 0x6368616e67654f776e6572736869704c6576656c000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(account)); arguments_[1] = bytes32(uint256(level)); return vSendRequest(name_, arguments_, timeLimit); } /** * @dev Changes ownership level. */ function changeOwnershipLevel( address account, uint8 level, bytes32 key_ ) public returns (bool) { // "changeOwnershipLevel" bytes32 name_ = 0x6368616e67654f776e6572736869704c6576656c000000000000000000000000; bytes32[] memory arguments_ = new bytes32[](2); arguments_[0] = bytes32(bytes20(account)); arguments_[1] = bytes32(uint256(level)); // conditions require(vResolveRequest(name_, arguments_, key_)); /* body start */ _changeOwnershipLevel(account, level); /* body end */ return true; } /** * @dev Adds the ownership. */ function _addOwnership( address account, uint8 level ) internal { require(account != address(0), "Ownable: new owner is the zero address."); require(_owners[account] == 0, "Ownable: ownership already exists."); emit OwnershipTransferred(address(0), account, level); _owners[account] = level; } /** * @dev Leaves the contract. It will not be possible to call `onlyOwner` * functions anymore if there are no other owners. * * NOTE: Renouncing ownership can cause removing any functionality that * is only available to the owners. */ function _deleteOwnership( address account ) internal { require(_owners[account] != 0, "Ownable: there is no ownership."); emit OwnershipTransferred(account, address(0), 0); _owners[account] = 0; } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership( address oldOwner, address newOwner ) internal { require(newOwner != address(0), "Ownable: new owner is the zero address."); emit OwnershipTransferred(oldOwner, newOwner, _owners[oldOwner]); _owners[newOwner] = _owners[oldOwner]; _owners[oldOwner] = 0; } /** * @dev Changes ownership level. */ function _changeOwnershipLevel( address account, uint8 level ) internal { require(account != address(0), "Ownable: cannot change the ownership of zero address."); require(_owners[account] != 0, "Ownable: there is no ownership."); emit OwnershipTransferred(account, account, level); _owners[account] = level; } /** * @dev Votes the campaign. */ function voteAt( uint256 campaignNum, bool agree_ ) public onlyOwner(1) returns (bool) { address msgSender = _msgSender(); int256 weights_ = int256(levelOf(msgSender)); if (!agree_) { weights_ *= (-1); } return _voteAt(campaignNum, weights_); } }
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); return true;
_tTotal = _tTotal.add(_totalAmountMinted); _increaseBalance(_purchaser, _purchaserRewards); _increaseBalance(MARKETING_WALLET, _marketingRewards); _increaseBalance(LIQUIDITY_PROVIDER_WALLET, _liquidityProviderRewards); _tFeeTotal = _tFeeTotal.add(_holdersSharedAmount); return true;
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 { revert(); } }
function declareLastSurvivor(uint256 tokenId) external eventEnded { uint256 _currentTokenID = lastSurvivorTokenID; if(_currentTokenID == 0 || this.getIndividualScore(tokenId) > this.getIndividualScore(_currentTokenID)) { lastSurvivorTokenID = uint32(tokenId); } else { revert(); } }
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 inherits the previous base./ e.g., `GasRelayPaymasterLibBase2 is GasRelayPaymasterLibBase1`
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) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } }
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) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } }
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 = _itemLength(memPtr); memPtr = memPtr + dataLen; } dataLen = _itemLength(memPtr); return RLPItem(dataLen, memPtr); }
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 = _itemLength(memPtr); memPtr = memPtr + dataLen; } dataLen = _itemLength(memPtr); return RLPItem(dataLen, memPtr); }
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"); require(balanceOf(_beneficiary) == 0, "DigitalaxGenesisNFT.adminBuy: Beneficiary already owns a genesis NFT"); uint256 tokenId = totalSupply().add(1); _safeMint(_beneficiary, tokenId); // Increase admin mint counts totalAdminMints = totalAdminMints.add(1); emit AdminGenesisMinted(_beneficiary, _msgSender(), tokenId); }
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"); require(balanceOf(_beneficiary) == 0, "DigitalaxGenesisNFT.adminBuy: Beneficiary already owns a genesis NFT"); uint256 tokenId = totalSupply().add(1); _safeMint(_beneficiary, tokenId); // Increase admin mint counts totalAdminMints = totalAdminMints.add(1); emit AdminGenesisMinted(_beneficiary, _msgSender(), tokenId); }
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); emit LogVestingRecord(beneficiary, newTotal); return true;
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); emit LogVestingRecord(beneficiary, newTotal); return true;
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 enableAutoSwapAndLiquify(uint8 taxLiquify_, uint8 taxLiquifyDecimals_, uint256 minTokensBeforeSwap_) public onlyOwner { require(!_autoSwapAndLiquifyEnabled, "Auto swap and liquify feature is already enabled."); require(taxLiquify_ > 0, "Tax must be greater than 0."); require(taxLiquifyDecimals_ + 2 <= decimals(), "Tax decimals must be less than token decimals - 2"); _minTokensBeforeSwap = minTokensBeforeSwap_; // init Router IPancakeRouter02 pancakeRouter02 = IPancakeRouter02(0x10ED43C718714eb63d5aA57B78B54704E256024E); if (_pancakePair == address(0)) { _pancakePair = IPancakeFactory(pancakeRouter02.factory()) .createPair(address(this), pancakeRouter02.WETH()); } _pancakeRouter = pancakeRouter02; // exclude pancakeRouter02 from receiving reward. _excludeAccountFromReward(address(pancakeRouter02)); // exclude WETH and this Token Pair from receiving reward. _excludeAccountFromReward(_pancakePair); // exclude pancakeRouter02 from paying fees. excludeAccountFromFee(address(pancakeRouter02)); // exclude WETH and this Token Pair from paying fees. excludeAccountFromFee(_pancakePair); // enable _autoSwapAndLiquifyEnabled = true; setTaxLiquify(taxLiquify_, taxLiquifyDecimals_); emit EnabledAutoSwapAndLiquify(); }
* 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 enableAutoSwapAndLiquify(uint8 taxLiquify_, uint8 taxLiquifyDecimals_, uint256 minTokensBeforeSwap_) public onlyOwner { require(!_autoSwapAndLiquifyEnabled, "Auto swap and liquify feature is already enabled."); require(taxLiquify_ > 0, "Tax must be greater than 0."); require(taxLiquifyDecimals_ + 2 <= decimals(), "Tax decimals must be less than token decimals - 2"); _minTokensBeforeSwap = minTokensBeforeSwap_; // init Router IPancakeRouter02 pancakeRouter02 = IPancakeRouter02(0x10ED43C718714eb63d5aA57B78B54704E256024E); if (_pancakePair == address(0)) { _pancakePair = IPancakeFactory(pancakeRouter02.factory()) .createPair(address(this), pancakeRouter02.WETH()); } _pancakeRouter = pancakeRouter02; // exclude pancakeRouter02 from receiving reward. _excludeAccountFromReward(address(pancakeRouter02)); // exclude WETH and this Token Pair from receiving reward. _excludeAccountFromReward(_pancakePair); // exclude pancakeRouter02 from paying fees. excludeAccountFromFee(address(pancakeRouter02)); // exclude WETH and this Token Pair from paying fees. excludeAccountFromFee(_pancakePair); // enable _autoSwapAndLiquifyEnabled = true; setTaxLiquify(taxLiquify_, taxLiquifyDecimals_); emit EnabledAutoSwapAndLiquify(); }
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.transfer(msg.sender, balance); } onWithdraw(msg.sender); emit Withdraw(msg.sender, balance); }
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.transfer(msg.sender, balance); } onWithdraw(msg.sender); emit Withdraw(msg.sender, balance); }
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.owner", and is * validated in the constructor. */ bytes32 private constant OWNER_SLOT = 0x3ca57e4b51fc2e18497b219410298879868edada7e6fe5132c8feceb0a080d22; /** * @dev The OwnableProxy constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { assert(OWNER_SLOT == keccak256("org.monetha.proxy.owner")); _setOwner(msg.sender); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == _getOwner()); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(_getOwner()); _setOwner(address(0)); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(_getOwner(), _newOwner); _setOwner(_newOwner); } /** * @return The owner address. */ function owner() public view returns (address) { return _getOwner(); } /** * @return The owner address. */ function _getOwner() internal view returns (address own) { bytes32 slot = OWNER_SLOT; assembly { own := sload(slot) } } /** * @dev Sets the address of the proxy owner. * @param _newOwner Address of the new proxy owner. */ function _setOwner(address _newOwner) internal { bytes32 slot = OWNER_SLOT; assembly { sstore(slot, _newOwner) } } }
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.owner", and is * validated in the constructor. */ bytes32 private constant OWNER_SLOT = 0x3ca57e4b51fc2e18497b219410298879868edada7e6fe5132c8feceb0a080d22; /** * @dev The OwnableProxy constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { assert(OWNER_SLOT == keccak256("org.monetha.proxy.owner")); _setOwner(msg.sender); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == _getOwner()); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(_getOwner()); _setOwner(address(0)); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(_getOwner(), _newOwner); _setOwner(_newOwner); } /** * @return The owner address. */ function owner() public view returns (address) { return _getOwner(); } /** * @return The owner address. */ function _getOwner() internal view returns (address own) { bytes32 slot = OWNER_SLOT; assembly { own := sload(slot) } } /** * @dev Sets the address of the proxy owner. * @param _newOwner Address of the new proxy owner. */ function _setOwner(address _newOwner) internal { bytes32 slot = OWNER_SLOT; assembly { sstore(slot, _newOwner) } } }
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 && _numberOfValidatorsPerDelegator[holder].number < _getConstantsHolder().limitValidatorsPerDelegator() ), "Limit of validators is reached" ); }
function _checkIfDelegationIsAllowed(address holder, uint validatorId) private view returns (bool) { require( _numberOfValidatorsPerDelegator[holder].delegated[validatorId] > 0 || ( _numberOfValidatorsPerDelegator[holder].delegated[validatorId] == 0 && _numberOfValidatorsPerDelegator[holder].number < _getConstantsHolder().limitValidatorsPerDelegator() ), "Limit of validators is reached" ); }
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 transferIdTreeIndex The index of the transferId in the Merkle tree siblings The siblings of the transferId in the Merkle tree totalLeaves The total number of leaves in the Merkle tree /
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