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
71
// Enumerate NFTs assigned to an owner/Throws if `_index` >= `balanceOf(_owner)` or if/`_owner` is the zero address, representing invalid NFTs./_owner An address where we are interested in NFTs owned by them/_index A counter less than `balanceOf(_owner)`/ return The token identifier for the `_index`th NFT assigned to `_owner`,/ (sort order not specified)
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
24,396
11
// uint128 numSelectorsInSlot, uint128 selectorSlotsLength selectorSlotsLength is the number of 32-byte slots in selectorSlots. selectorSlotLength is the number of selectors in the last slot of selectorSlots.
uint selectorSlotsLength;
uint selectorSlotsLength;
37,382
145
// dont tax some operations
if(txType == swapEngine.TX_REMOVE_LIQUIDITY() || sender == address(swapEngine) || isSwapAndLiquidifyLocked == true ) { return amount; }
if(txType == swapEngine.TX_REMOVE_LIQUIDITY() || sender == address(swapEngine) || isSwapAndLiquidifyLocked == true ) { return amount; }
7,186
25
// Returns the subtraction of two unsigned integers, reverting with custom meswise onoverflow (when the result is negative). CAUTION: This function is deprecated because it requires allocating memory for the error
* meswise unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMeswise) internal pure returns (uint256) { require(b <= a, errorMeswise); return a - b; }
* meswise unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMeswise) internal pure returns (uint256) { require(b <= a, errorMeswise); return a - b; }
2,297
124
// delays between attempted burns or token disbursement
uint public constant burnOrDisburseTokensPeriod = 7 days;
uint public constant burnOrDisburseTokensPeriod = 7 days;
32,794
13
// ----------------------------------------------------------------------------setBaseURI Function----------------------------------------------------------------------------This function sets the base URI.---------------------------------------------------------------------------- /
function setBaseURI(string memory _baseURI) external onlyOwner { baseURI = _baseURI; }
function setBaseURI(string memory _baseURI) external onlyOwner { baseURI = _baseURI; }
1,258
471
// Add assets to be included in account liquidity calculation cTokens The list of addresses of the cToken markets to be enabledreturn Success indicator for whether each corresponding market was entered /
function enterMarkets(address[] calldata cTokens) external returns (uint[] memory) { uint len = cTokens.length; uint[] memory results = new uint[](len); for (uint i = 0; i < len; i++) { CToken cToken = CToken(cTokens[i]); results[i] = uint(addToMarketInternal(cToken, msg.sender)); } return results; }
function enterMarkets(address[] calldata cTokens) external returns (uint[] memory) { uint len = cTokens.length; uint[] memory results = new uint[](len); for (uint i = 0; i < len; i++) { CToken cToken = CToken(cTokens[i]); results[i] = uint(addToMarketInternal(cToken, msg.sender)); } return results; }
6,326
19
// Mark the lottery inactive
isLotteryLive = false;
isLotteryLive = false;
7,284
55
// Returns the downcasted int136 from int256, reverting onoverflow (when the input is less than smallest int136 orgreater than largest int136). Counterpart to Solidity's `int136` operator. Requirements: - input must fit into 136 bits _Available since v4.7._ /
function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); }
function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); }
26,502
163
// Check id is bigger than 0
require(_id > 0, "Non-existent controller for id 0"); uint256 n = controllers.length;
require(_id > 0, "Non-existent controller for id 0"); uint256 n = controllers.length;
59,833
4
// ConstructorwhenTokenContract Address of the WHENToken contract/
function TokenVesting ( address whenTokenContract ) public
function TokenVesting ( address whenTokenContract ) public
51,043
113
// Provide an indication of whether this strategy is currently "active" in that it is managing an active position, or will manage a position in the future. This should correlate to `harvest()` activity, so that Harvest events can be tracked externally by indexing agents.return True if the strategy is actively managing a position. /
function isActive() public view returns (bool) { return vault.strategies(address(this)).debtRatio > 0 || estimatedTotalAssets() > 0; }
function isActive() public view returns (bool) { return vault.strategies(address(this)).debtRatio > 0 || estimatedTotalAssets() > 0; }
9,197
264
// calculate the fee on the principle received
uint256 fee = calculateFee(_amount);
uint256 fee = calculateFee(_amount);
33,336
5
// BASE 64 - Written by Brech Devos
string internal constant TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; function base64(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return '';
string internal constant TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; function base64(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return '';
3,281
54
// Emitted when proposal threshold is set
event ProposalThresholdSet(uint oldProposalThreshold, uint newProposalThreshold);
event ProposalThresholdSet(uint oldProposalThreshold, uint newProposalThreshold);
9,623
129
// Trim the data with the reference and parameters
for (uint256 i = 0; i < refs.length; i++) { require(refs[i] < index, "Reference to out of localStack"); bytes32 ref = localStack[refs[i]]; uint256 offset = params[i]; uint256 base = PERCENTAGE_BASE; assembly { let loc := add(add(data, 0x20), offset) let m := mload(loc)
for (uint256 i = 0; i < refs.length; i++) { require(refs[i] < index, "Reference to out of localStack"); bytes32 ref = localStack[refs[i]]; uint256 offset = params[i]; uint256 base = PERCENTAGE_BASE; assembly { let loc := add(add(data, 0x20), offset) let m := mload(loc)
8,315
27
// Emitted when kUSD changed
event NewKUSD(address oldKUSD, address newKUSD); address public admin; address public pendingAdmin; address public operator; address public counterParty; IERC20 public kUSD;
event NewKUSD(address oldKUSD, address newKUSD); address public admin; address public pendingAdmin; address public operator; address public counterParty; IERC20 public kUSD;
59,682
2
// UInt128
function addUInt128Key(bytes32 _listId, uint128 _value) public; function removeUInt128Key(bytes32 _listId, uint128 _value) public; function getUInt128KeySize(bytes32 _listId) public view returns (uint256); function getUInt128Keys(bytes32 _listId) public view returns (uint128[] memory); function getRangeOfUInt128Keys(bytes32 _listId, uint256 _offset, uint256 _limit) public view returns (uint128[] memory); function getUInt128KeyByIndex(bytes32 _listId, uint256 _listIndex) public view returns (uint128); function existsUInt128Key(bytes32 _listId, uint128 _value) public view returns (bool);
function addUInt128Key(bytes32 _listId, uint128 _value) public; function removeUInt128Key(bytes32 _listId, uint128 _value) public; function getUInt128KeySize(bytes32 _listId) public view returns (uint256); function getUInt128Keys(bytes32 _listId) public view returns (uint128[] memory); function getRangeOfUInt128Keys(bytes32 _listId, uint256 _offset, uint256 _limit) public view returns (uint128[] memory); function getUInt128KeyByIndex(bytes32 _listId, uint256 _listIndex) public view returns (uint128); function existsUInt128Key(bytes32 _listId, uint128 _value) public view returns (bool);
50,961
38
// Determine whether the account is Coin Dealer and CoinDealerState must be 2
require( CoinDealerState[account][tokenAddress] == 2, "account&tokenAddress must be Coin Dealer and CoinDealerState must be 2" ); require( WithDrawTimes[account][tokenAddress] != 0, "WithDrawTime can not be 0" ); uint256 withDrawTime = WithDrawTimes[account][tokenAddress];
require( CoinDealerState[account][tokenAddress] == 2, "account&tokenAddress must be Coin Dealer and CoinDealerState must be 2" ); require( WithDrawTimes[account][tokenAddress] != 0, "WithDrawTime can not be 0" ); uint256 withDrawTime = WithDrawTimes[account][tokenAddress];
17,205
12
// Get the timelock address from the minter
timelock_address = cc_bridge_backer.timelock_address();
timelock_address = cc_bridge_backer.timelock_address();
12,111
463
// Emits one {CallExecuted} event per transaction in the batch. Requirements: - the caller must have the 'executor' role. / This function can reenter, but it doesn't pose a risk because _afterCall checks that the proposal is pending, thus any modifications to the operation during reentrancy should be caught. slither-disable-next-line reentrancy-eth
function executeBatch( address[] calldata targets, uint256[] calldata values, bytes[] calldata payloads, bytes32 predecessor, bytes32 salt ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) { require(targets.length == values.length, "TimelockController: length mismatch"); require(targets.length == payloads.length, "TimelockController: length mismatch");
function executeBatch( address[] calldata targets, uint256[] calldata values, bytes[] calldata payloads, bytes32 predecessor, bytes32 salt ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) { require(targets.length == values.length, "TimelockController: length mismatch"); require(targets.length == payloads.length, "TimelockController: length mismatch");
27,997
141
// Update number of events pushed to buffer -
mstore(0x140, add(1, mload(0x140)))
mstore(0x140, add(1, mload(0x140)))
28,206
3
// withdraw ETH stuck in the contract /transfer contract's ETH to current owner, emit an event called ContractEmptied/ An event SwapContractEmptied containing the owner address and the ETH amount sent is emitted
function withdrawETH() external onlyOwner { address payable self = address(this); uint256 ETHbalance = self.balance; _owner.transfer(ETHbalance); emit ContractEmptied(_owner, ETHbalance); }
function withdrawETH() external onlyOwner { address payable self = address(this); uint256 ETHbalance = self.balance; _owner.transfer(ETHbalance); emit ContractEmptied(_owner, ETHbalance); }
4,297
0
// Call base constructor with correct address but then allow overwrite for tests
function MockSweepstakesFactory(address _pryzeTokenAddress, uint _previouslyUsedTokens) public SweepstakesFactory(0x6b834f43B7f5a1644e0C81CaA0246969dA23105e, _previouslyUsedTokens) { pryzeTokenAddress = _pryzeTokenAddress; }
function MockSweepstakesFactory(address _pryzeTokenAddress, uint _previouslyUsedTokens) public SweepstakesFactory(0x6b834f43B7f5a1644e0C81CaA0246969dA23105e, _previouslyUsedTokens) { pryzeTokenAddress = _pryzeTokenAddress; }
8,414
2
// Number of allowed PresaleGenerators /
function presaleGeneratorsLength() external view returns (uint256) { return presaleGenerators.length(); }
function presaleGeneratorsLength() external view returns (uint256) { return presaleGenerators.length(); }
27,184
1
// Commit scheme data
struct CommitSchemeData { uint256 index; bytes32 digest; bytes32 secret; }
struct CommitSchemeData { uint256 index; bytes32 digest; bytes32 secret; }
12,377
169
// Modifier that checks that an account has a specific role. Revertswith a standardized message including the required role. The format of the revert reason is given by the following regular expression:
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; }
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; }
1,019
7
// Approved third party addresses to manage all tokens belonging to some address /
mapping (address => mapping (address => bool)) private _token_operators;
mapping (address => mapping (address => bool)) private _token_operators;
46,646
10
// fallback function DO NOT OVERRIDE /
receive() external payable { buyTokens(msg.sender); }
receive() external payable { buyTokens(msg.sender); }
13,314
42
// Deletes a RewardDistribution from the distributionsso it will no longer be included in the call to distributeRewards() index The index of the DistributionData to delete /
function removeRewardDistribution(uint256 index) external onlyOwner { require(index <= distributions.length - 1, "index out of bounds"); // shift distributions indexes across delete distributions[index]; }
function removeRewardDistribution(uint256 index) external onlyOwner { require(index <= distributions.length - 1, "index out of bounds"); // shift distributions indexes across delete distributions[index]; }
61,065
160
// assume timestamps will not cause overflow
tCampaignStart = tNow; t_1st_StageEnd += tNow; t_2nd_StageEnd += tNow; tCampaignEnd += tNow; CampaignOpen(now);
tCampaignStart = tNow; t_1st_StageEnd += tNow; t_2nd_StageEnd += tNow; tCampaignEnd += tNow; CampaignOpen(now);
18,510
235
// CHECK !!! this is suspicious!! 0 should be msg.value but this is not payable function msg.value will be zero since it is non-payable function and designed to be used to usdc-base CAFE contract
_collectInvestment(_from, _currencyValue, 0); uint256 currencyValue = _currencyValue.sub(gasFee); _transferCurrency(feeCollector, gasFee); _buy(_from, _to, currencyValue, _minTokensBought, false);
_collectInvestment(_from, _currencyValue, 0); uint256 currencyValue = _currencyValue.sub(gasFee); _transferCurrency(feeCollector, gasFee); _buy(_from, _to, currencyValue, _minTokensBought, false);
7,852
112
// Transfers a users deposit, and potential winnings, back to them.The Pool must be unlocked.The user must have deposited funds.Fires the Withdrawn event. /
function withdraw() public { require(_hasEntry(msg.sender), "entrant exists"); require(state == State.UNLOCKED || state == State.COMPLETE, "pool has not been unlocked"); Entry storage entry = entries[msg.sender]; int256 remainingBalanceNonFixed = balanceOf(msg.sender); require(remainingBalanceNonFixed > 0, "entrant has already withdrawn"); entry.withdrawnNonFixed = entry.withdrawnNonFixed + remainingBalanceNonFixed; emit Withdrawn(msg.sender, remainingBalanceNonFixed); require(token.transfer(msg.sender, uint256(remainingBalanceNonFixed)), "could not transfer winnings"); }
function withdraw() public { require(_hasEntry(msg.sender), "entrant exists"); require(state == State.UNLOCKED || state == State.COMPLETE, "pool has not been unlocked"); Entry storage entry = entries[msg.sender]; int256 remainingBalanceNonFixed = balanceOf(msg.sender); require(remainingBalanceNonFixed > 0, "entrant has already withdrawn"); entry.withdrawnNonFixed = entry.withdrawnNonFixed + remainingBalanceNonFixed; emit Withdrawn(msg.sender, remainingBalanceNonFixed); require(token.transfer(msg.sender, uint256(remainingBalanceNonFixed)), "could not transfer winnings"); }
53,155
28
// ---------------------------------------------------------------------------- Removes account from the root ----------------------------------------------------------------------------
function removeFromRootAccounts(address removeFromRoot) public { require(rootAccounts[removeFromRoot]); //we need to have something to remove assert(address(msg.sender) == address(owner) || rootAccounts[msg.sender]); //Only the contract owner OR root accounts can initiate it rootAccounts[removeFromRoot] = false; }
function removeFromRootAccounts(address removeFromRoot) public { require(rootAccounts[removeFromRoot]); //we need to have something to remove assert(address(msg.sender) == address(owner) || rootAccounts[msg.sender]); //Only the contract owner OR root accounts can initiate it rootAccounts[removeFromRoot] = false; }
730
25
// balances[_to] -=balance-reduceTaxValue; balances[msg.sender] +=balance-reduceTaxValue;
emit TokenBuAndSellWithTax(receiver,reduceTaxValue,balance); emit Transfer(msg.sender, receiver, numTokens); return true;
emit TokenBuAndSellWithTax(receiver,reduceTaxValue,balance); emit Transfer(msg.sender, receiver, numTokens); return true;
15,464
4
// Struct representing a bounty/No submissions may be posted to the bounty after the unlock time. If there is an/ active submission when the unlock time is reached, it may still be approved after the/ unlock time. The bounty is only considered closed when it is past the expiration AND there/ is no active submission. The ID corresponds to a record kept on the Arkham platform - or in/ the future, on any number of secondary serivices.
struct Bounty { uint256 amount; uint256 initialAmount; uint64 expiration; address funder; bool closed; }
struct Bounty { uint256 amount; uint256 initialAmount; uint64 expiration; address funder; bool closed; }
24,747
222
// Info of each user that stakes LP tokens.
mapping(uint => mapping(address => UserInfo)) public userInfo;
mapping(uint => mapping(address => UserInfo)) public userInfo;
11,459
140
// Obtain the current state of the callers timestamp
(uint256 timeRemaining, bool isReady, uint256 rewardDate) = ISparkleTimestamp(timestampAddress).getTimeRemaining(msg.sender);
(uint256 timeRemaining, bool isReady, uint256 rewardDate) = ISparkleTimestamp(timestampAddress).getTimeRemaining(msg.sender);
56,628
33
// Set requester's request index
users[requestee].index[requester] = _index;
users[requestee].index[requester] = _index;
15,960
28
// round 20
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 6172482022646932735745595886795230725225293469762393889050804649558459236626) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 6172482022646932735745595886795230725225293469762393889050804649558459236626) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
31,516
77
// Internal function to add a token ID to the list of a given address _to address representing the new owner of the given token ID _tokenId uint256 ID of the token to be added to the tokens list of the given address /
function addTokenTo(address _to, uint256 _tokenId) internal { require(tokenOwner[_tokenId] == address(0)); tokenOwner[_tokenId] = _to; ownedTokensCount[_to] = ownedTokensCount[_to].add(1); }
function addTokenTo(address _to, uint256 _tokenId) internal { require(tokenOwner[_tokenId] == address(0)); tokenOwner[_tokenId] = _to; ownedTokensCount[_to] = ownedTokensCount[_to].add(1); }
15,401
18
// report a known exception/
function raiseException(Exception exception, Reason reason) internal returns (uint) { emit SwapException(uint(exception), uint(reason), 0); return uint(exception); }
function raiseException(Exception exception, Reason reason) internal returns (uint) { emit SwapException(uint(exception), uint(reason), 0); return uint(exception); }
3,378
685
// There is a discount on Fees paying in Mona
uint256 amountOfDiscountOnETHPrice = offer.primarySalePrice.mul(discountToPayERC20).div(maxShare); uint256 amountOfETHToBePaidInFees = feeInETH.sub(amountOfDiscountOnETHPrice); uint256 amountOfMonaToTransferAsFees = _estimateMonaAmount(amountOfETHToBePaidInFees);
uint256 amountOfDiscountOnETHPrice = offer.primarySalePrice.mul(discountToPayERC20).div(maxShare); uint256 amountOfETHToBePaidInFees = feeInETH.sub(amountOfDiscountOnETHPrice); uint256 amountOfMonaToTransferAsFees = _estimateMonaAmount(amountOfETHToBePaidInFees);
13,706
196
// The number of depositaries in agregate.
uint256 public maxSize;
uint256 public maxSize;
42,620
200
// End an auction and pay out the respective parties. If for some reason the auction cannot be finalized (invalid token recipient, for example),The auction is reset and the NFT is transferred back to the auction creator. /
function endAuction(uint256 auctionId) external override auctionExists(auctionId) nonReentrant { require( uint256(auctions[auctionId].firstBidTime) != 0, "Auction hasn't begun" ); require( block.timestamp >= auctions[auctionId].firstBidTime.add(auctions[auctionId].duration), "Auction hasn't completed" ); address currency = auctions[auctionId].auctionCurrency == address(0) ? wethAddress : auctions[auctionId].auctionCurrency; uint256 tokenOwnerProfit = auctions[auctionId].amount; address tokenContract = auctions[auctionId].tokenContract; // Otherwise, transfer the token to the winner and pay out the participants below try IERC721(auctions[auctionId].tokenContract).safeTransferFrom(address(this), auctions[auctionId].bidder, auctions[auctionId].tokenId) {} catch { _handleOutgoingBid(auctions[auctionId].bidder, auctions[auctionId].amount, auctions[auctionId].auctionCurrency); _cancelAuction(auctionId); return; }
function endAuction(uint256 auctionId) external override auctionExists(auctionId) nonReentrant { require( uint256(auctions[auctionId].firstBidTime) != 0, "Auction hasn't begun" ); require( block.timestamp >= auctions[auctionId].firstBidTime.add(auctions[auctionId].duration), "Auction hasn't completed" ); address currency = auctions[auctionId].auctionCurrency == address(0) ? wethAddress : auctions[auctionId].auctionCurrency; uint256 tokenOwnerProfit = auctions[auctionId].amount; address tokenContract = auctions[auctionId].tokenContract; // Otherwise, transfer the token to the winner and pay out the participants below try IERC721(auctions[auctionId].tokenContract).safeTransferFrom(address(this), auctions[auctionId].bidder, auctions[auctionId].tokenId) {} catch { _handleOutgoingBid(auctions[auctionId].bidder, auctions[auctionId].amount, auctions[auctionId].auctionCurrency); _cancelAuction(auctionId); return; }
30,423
37
// 初始化合约,并且把初始的所有的令牌都给这合约的创建者 initialSupply 所有币的总数 tokenName 代币名称 tokenSymbol 代币符号 /
function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol
function MyAdvancedToken( uint256 initialSupply, string tokenName, string tokenSymbol
21,236
88
// initialise total supply.
_supplyTokens = supplyTokens; _totalSupply = _totalSupply.add(_supplyTokens); _balances[msg.sender] = _balances[msg.sender].add(_supplyTokens); emit Transfer(address(0), msg.sender, _supplyTokens);
_supplyTokens = supplyTokens; _totalSupply = _totalSupply.add(_supplyTokens); _balances[msg.sender] = _balances[msg.sender].add(_supplyTokens); emit Transfer(address(0), msg.sender, _supplyTokens);
10,104
10
// The total number of NfTs in the DAO
uint256 public _nftCount;
uint256 public _nftCount;
77,107
7
// Sets the maximum allowed mint amount in private sale _maxAllowedPrivate The new maximal value for private sale /
function setMaxAllowedPrivate(uint256 _maxAllowedPrivate) external onlyOwner { maxAllowedPrivate = _maxAllowedPrivate; }
function setMaxAllowedPrivate(uint256 _maxAllowedPrivate) external onlyOwner { maxAllowedPrivate = _maxAllowedPrivate; }
14,321
26
// approve() allowances
mapping (address => mapping (address => uint)) allowed;
mapping (address => mapping (address => uint)) allowed;
39,542
9
// Update a list of aggregators _inputs list of addresses representing the input currencies _outputs list of addresses representing the output currencies _aggregators list of addresses of the aggregator contracts /
function updateAggregatorsList( address[] calldata _inputs, address[] calldata _outputs, address[] calldata _aggregators
function updateAggregatorsList( address[] calldata _inputs, address[] calldata _outputs, address[] calldata _aggregators
41,203
57
// Pull underlyingTokens from the original msg.sender to pay the remainder of the flash swap. Revert if the minPayout is less than or equal to the underlyingPayment of 0. There is 0 underlyingPayment in the case that loanRemainder > 0. This code branch can be successful by setting `minPayout` to 0. This means the user is willing to pay to close the position.
require(minPayout <= underlyingPayout, "ERR_NEGATIVE_PAYOUT"); IERC20(underlyingToken).safeTransferFrom( to, pairAddress, loanRemainder );
require(minPayout <= underlyingPayout, "ERR_NEGATIVE_PAYOUT"); IERC20(underlyingToken).safeTransferFrom( to, pairAddress, loanRemainder );
4,634
82
// If the marker is not found, there is no proposer suffix to check
if (marker != bytes12("#proposer=0x")) { return true; }
if (marker != bytes12("#proposer=0x")) { return true; }
20,283
12
// Deposit from player/
function deposit() public payable { require(msg.value >= DEPOSIT_AMOUNT); players.push(Player({ wallet: msg.sender, playing: true, playingJackpot: true })); amountRound = amountRound.add(msg.value); countPlayerRound = countPlayerRound.add(1); countPlayerJackpot = countPlayerJackpot.add(1); emit DepositSuccess(msg.sender, msg.value, countRound, countJackpot); if (now >= roundTime && amountRound > 0 && countPlayerRound > 1) { roundTime = now.add(INTERVAL_TIME); executeRound(); if (now >= jackpotTime && amountJackpot > 0 && countPlayerJackpot > 1) { jackpotTime = now.add(JACKPOT_INTERVAL_TIME); executeJackpot(); } } }
function deposit() public payable { require(msg.value >= DEPOSIT_AMOUNT); players.push(Player({ wallet: msg.sender, playing: true, playingJackpot: true })); amountRound = amountRound.add(msg.value); countPlayerRound = countPlayerRound.add(1); countPlayerJackpot = countPlayerJackpot.add(1); emit DepositSuccess(msg.sender, msg.value, countRound, countJackpot); if (now >= roundTime && amountRound > 0 && countPlayerRound > 1) { roundTime = now.add(INTERVAL_TIME); executeRound(); if (now >= jackpotTime && amountJackpot > 0 && countPlayerJackpot > 1) { jackpotTime = now.add(JACKPOT_INTERVAL_TIME); executeJackpot(); } } }
28,043
98
// Handles the bridged tokens. Checks that the value is inside the execution limits and invokes the method to execute the Mint or Unlock accordingly._token bridged ERC20/ERC677 token_recipient address that will receive the tokens_value amount of tokens to be received/
function _handleBridgedTokens(ERC677 _token, address _recipient, uint256 _value) internal { if (withinExecutionLimit(_token, _value)) { addTotalExecutedPerDay(_token, getCurrentDay(), _value); executeActionOnBridgedTokens(_token, _recipient, _value); } else { executeActionOnBridgedTokensOutOfLimit(_token, _recipient, _value); } }
function _handleBridgedTokens(ERC677 _token, address _recipient, uint256 _value) internal { if (withinExecutionLimit(_token, _value)) { addTotalExecutedPerDay(_token, getCurrentDay(), _value); executeActionOnBridgedTokens(_token, _recipient, _value); } else { executeActionOnBridgedTokensOutOfLimit(_token, _recipient, _value); } }
51,504
17
// 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);
16,352
113
// Called by an admin to remove a member from the platform/This function can only be called by the contract owner/The member will be automatically refunded their stake balance and any/ unclaimed rewards as a result of being removed by the admin/Can be called if user is authorised or joined/userAddress the address of the member that the admin wishes to remove
function removeMember(address userAddress) public isMember(userAddress) onlyOwner
function removeMember(address userAddress) public isMember(userAddress) onlyOwner
23,583
4
// A struct representing the initial Credit Manager configuration parameters
struct CreditManagerOpts { /// @dev The minimal debt principal amount uint128 minBorrowedAmount; /// @dev The maximal debt principal amount uint128 maxBorrowedAmount; /// @dev The initial list of collateral tokens to allow CollateralToken[] collateralTokens; /// @dev Address of DegenNFT, address(0) if whitelisted mode is not used address degenNFT; /// @dev Address of BlacklistHelper, address(0) if the underlying is not blacklistable address blacklistHelper; /// @dev Whether the Credit Manager is connected to an expirable pool (and the CreditFacade is expirable) bool expirable; }
struct CreditManagerOpts { /// @dev The minimal debt principal amount uint128 minBorrowedAmount; /// @dev The maximal debt principal amount uint128 maxBorrowedAmount; /// @dev The initial list of collateral tokens to allow CollateralToken[] collateralTokens; /// @dev Address of DegenNFT, address(0) if whitelisted mode is not used address degenNFT; /// @dev Address of BlacklistHelper, address(0) if the underlying is not blacklistable address blacklistHelper; /// @dev Whether the Credit Manager is connected to an expirable pool (and the CreditFacade is expirable) bool expirable; }
20,061
19
// ------------------------------------------------------------------------ Transfer the balance from token owner's account to to account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; }
function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; }
22,434
5
// load the sender's deposit and calculate their share award.
Deposit memory _deposit = _deposits[msg.sender][depositId]; require(_deposit.stakeIndex == stakeIndex, "Invalid stake index"); uint256 shares = (_deposit.hearts / stakedHearts) * stakeShares;
Deposit memory _deposit = _deposits[msg.sender][depositId]; require(_deposit.stakeIndex == stakeIndex, "Invalid stake index"); uint256 shares = (_deposit.hearts / stakedHearts) * stakeShares;
41,902
5
// mints `amount` of NFAs and transfers it to msg.sender in exchange of the priceamount in ETH Required `proof` a valid merkle proof that msg.sender is whitelistedProvide an empty proof for the public sale Required `quantity` the amount of desired NFAs to buy `listType` if proof is not empty, which whitelist should be checked against sender address to register whitelisting.
* Emits a {Transfer} event. */ function buy(uint quantity, bytes32[] calldata proof, ListType listType) payable public { uint userMintLimit = MAX_MINT_NOT_WHITELISTED; if (isWhitelisted[msg.sender]){ userMintLimit = MAX_MINT_PER_ADDRESS; } else { if(checkWhitelisting(proof, listType)){ userMintLimit = MAX_MINT_PER_ADDRESS; } else { require(publicSaleStarted, "The sale isn't public yet"); } } require(nbOfNFAsMintedBy[msg.sender] + quantity <= userMintLimit, "Mint quantity exceeds allowance for this address"); require(_tokenIdCounter.current() < MAX_SUPPLY, "Max supply reached"); require(_tokenIdCounter.current() + quantity <= MAX_SUPPLY, "Mint quantity exceeds max supply"); require(msg.value >= PRICE * quantity, "Price not met"); for (uint i = 0; i < quantity; i++){ // _safeMint() not used to avoid reentrency // it is the responsibility of the caller not to call buy() from a contract where the tokens // would be locked _tokenIdCounter.increment(); nbOfNFAsMintedBy[msg.sender]++; _mint(msg.sender, _tokenIdCounter.current()); } }
* Emits a {Transfer} event. */ function buy(uint quantity, bytes32[] calldata proof, ListType listType) payable public { uint userMintLimit = MAX_MINT_NOT_WHITELISTED; if (isWhitelisted[msg.sender]){ userMintLimit = MAX_MINT_PER_ADDRESS; } else { if(checkWhitelisting(proof, listType)){ userMintLimit = MAX_MINT_PER_ADDRESS; } else { require(publicSaleStarted, "The sale isn't public yet"); } } require(nbOfNFAsMintedBy[msg.sender] + quantity <= userMintLimit, "Mint quantity exceeds allowance for this address"); require(_tokenIdCounter.current() < MAX_SUPPLY, "Max supply reached"); require(_tokenIdCounter.current() + quantity <= MAX_SUPPLY, "Mint quantity exceeds max supply"); require(msg.value >= PRICE * quantity, "Price not met"); for (uint i = 0; i < quantity; i++){ // _safeMint() not used to avoid reentrency // it is the responsibility of the caller not to call buy() from a contract where the tokens // would be locked _tokenIdCounter.increment(); nbOfNFAsMintedBy[msg.sender]++; _mint(msg.sender, _tokenIdCounter.current()); } }
60,538
18
// Rebuild the message signed by the source
abi.encode("prices", t, _symbol, p) ) ) ), uint8(packedV), // the lowest byte of packedV rList[i], sList[i] ) == source, "Invalid signature" );
abi.encode("prices", t, _symbol, p) ) ) ), uint8(packedV), // the lowest byte of packedV rList[i], sList[i] ) == source, "Invalid signature" );
10,441
5
// Write info to the log when the expire interval was updated/
event ExpireInteravalUpdated(uint oldValue, uint newValue);
event ExpireInteravalUpdated(uint oldValue, uint newValue);
46,999
128
// --- Helper functions ---
function _bothOraclesSimilarPrice( uint256 primaryOraclePrice, uint256 secondaryOraclePrice ) internal view returns (bool)
function _bothOraclesSimilarPrice( uint256 primaryOraclePrice, uint256 secondaryOraclePrice ) internal view returns (bool)
30,782
86
// Of all the nOutcomes, there must be at least one non-winning outcome
if (!(nWinningOutcomes < vf.nOutcomes)) revert TooManyWinningOutcomes(); vf.winningOutcomeIndex = nWinningOutcomes == 1 ? singleWinningOutcomeIndex : 0xff; vf.winningOutcomeIndexFlags = winningOutcomeIndexFlags;
if (!(nWinningOutcomes < vf.nOutcomes)) revert TooManyWinningOutcomes(); vf.winningOutcomeIndex = nWinningOutcomes == 1 ? singleWinningOutcomeIndex : 0xff; vf.winningOutcomeIndexFlags = winningOutcomeIndexFlags;
22,405
105
// Returns if an exclusion is enabled/ return True if the exclusion is enabled
function isExcluded(address _exclusion) public view returns (bool) { return SENTINEL_EXCLUSIONS != _exclusion && exclusions[_exclusion] != address(0); }
function isExcluded(address _exclusion) public view returns (bool) { return SENTINEL_EXCLUSIONS != _exclusion && exclusions[_exclusion] != address(0); }
61,991
68
// Contract module which provides a basic access control mechanism, wherethere is an account (an owner) 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}. * * This module is used through inheritance. It will make available the modifier * 'onlyOwner', which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address public _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * 'onlyOwner' functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account ('newOwner'). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
* can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * 'onlyOwner', which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address public _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * 'onlyOwner' functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account ('newOwner'). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
17,300
9
// ERC-677 functionality, can be useful for swapping and wrapping tokens
function transferAndCall(address recipient, uint amount, bytes calldata data) external virtual returns (bool) { bool success = transfer(recipient, amount); if (success){ success = IERC677Receiver(recipient).onTokenTransfer(msg.sender, amount, data); } return success; }
function transferAndCall(address recipient, uint amount, bytes calldata data) external virtual returns (bool) { bool success = transfer(recipient, amount); if (success){ success = IERC677Receiver(recipient).onTokenTransfer(msg.sender, amount, data); } return success; }
20,462
13
// chef is cooking
if (_lastRewardBlock == 0 || _lastRewardBlock < block.number) { _lastRewardBlock = block.number; }
if (_lastRewardBlock == 0 || _lastRewardBlock < block.number) { _lastRewardBlock = block.number; }
24,949
67
// limited admin function to update uberHaus address once @Dev meant for setting up genesis members
require(msg.sender == controller, "only controller"); require(uberHaus == address(0), "already updated"); uberHaus = _uberHaus; emit SetUberHaus(uberHaus); return uberHaus;
require(msg.sender == controller, "only controller"); require(uberHaus == address(0), "already updated"); uberHaus = _uberHaus; emit SetUberHaus(uberHaus); return uberHaus;
33,712
5
// Initializing Safe owners.
address currentOwner = SENTINEL_OWNERS; for (uint256 i = 0; i < _owners.length; i++) {
address currentOwner = SENTINEL_OWNERS; for (uint256 i = 0; i < _owners.length; i++) {
4,532
326
// Each Pools deposit time values
mapping(uint256 => mapping(uint256 => uint256)) public depositTime;
mapping(uint256 => mapping(uint256 => uint256)) public depositTime;
18,916
26
// increase the token&39;s supply
function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); if (value + currentSupply > totalSupply) throw; currentSupply = safeAdd(currentSupply, value); IncreaseSupply(value); }
function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); if (value + currentSupply > totalSupply) throw; currentSupply = safeAdd(currentSupply, value); IncreaseSupply(value); }
11,392
3
// Initialize block number and borrow index (block number mocks depend on comptroller being set)
accrualBlockNumber = getBlockNumber(); borrowIndex = mantissaOne;
accrualBlockNumber = getBlockNumber(); borrowIndex = mantissaOne;
3,997
41
// Calculates amount of AVAX received for given amount of the last $HAT. This is a helper function used in getAvaxAmountInForExactHatAmountOut and _getAvaxAmountOutForExactHatAmountIn. hatAmount - The amount of last $HAT to swap for AVAX.return avaxAmount - The amount of AVAX received. /
function _getAvaxAmountForLastExactHatAmount(uint256 hatAmount) private view returns (uint256) { return lastHatPriceInAvax * hatAmount / 1e18; }
function _getAvaxAmountForLastExactHatAmount(uint256 hatAmount) private view returns (uint256) { return lastHatPriceInAvax * hatAmount / 1e18; }
7,165
46
// Set the contract that may call the release function. /
function setReleaseAgent(address addr) onlyOwner inReleaseState(false) public { releaseAgent = addr; }
function setReleaseAgent(address addr) onlyOwner inReleaseState(false) public { releaseAgent = addr; }
44,582
3
// Contract semantic version
string public constant version = '0.2.0';
string public constant version = '0.2.0';
21,803
9
// Event raised when name was changed. _owner Contract owner performing the operation. _newName New name given to contract. /
event NameChanged(address indexed _owner, bytes32 _newName);
event NameChanged(address indexed _owner, bytes32 _newName);
28,738
30
// time
userChargeTime[_addr][_times] = ShowTime();
userChargeTime[_addr][_times] = ShowTime();
57,656
123
// given a return amount, returns the amount minus the conversion fee_amountreturn amount_magnitude 1 for standard conversion, 2 for cross reserve conversion return return amount minus conversion fee/
function getFinalAmount(uint256 _amount, uint8 _magnitude) public view returns (uint256) { return _amount.mul((CONVERSION_FEE_RESOLUTION - conversionFee) ** _magnitude).div(CONVERSION_FEE_RESOLUTION ** _magnitude); }
function getFinalAmount(uint256 _amount, uint8 _magnitude) public view returns (uint256) { return _amount.mul((CONVERSION_FEE_RESOLUTION - conversionFee) ** _magnitude).div(CONVERSION_FEE_RESOLUTION ** _magnitude); }
25,246
17
// View function to see pending RIOs on frontend. (user.amountpool.accRioPerShare) - rewardDebt
function pendingRioReward(uint256 _poolId, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_poolId]; UserInfo storage user = userInfo[_poolId][_user]; uint256 accRioPerShare = pool.accRioPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply < 0) { return 0; } uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 rioReward = multiplier.mul(rioRewardPerBlock).mul(pool.perBlockRioAllocated).div(totalAllocRioPerBlock); accRioPerShare = accRioPerShare.add(rioReward.mul(1e12).div(lpSupply)); return user.amount.mul(accRioPerShare).div(1e12).sub(user.rewardDebt); }
function pendingRioReward(uint256 _poolId, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_poolId]; UserInfo storage user = userInfo[_poolId][_user]; uint256 accRioPerShare = pool.accRioPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply < 0) { return 0; } uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 rioReward = multiplier.mul(rioRewardPerBlock).mul(pool.perBlockRioAllocated).div(totalAllocRioPerBlock); accRioPerShare = accRioPerShare.add(rioReward.mul(1e12).div(lpSupply)); return user.amount.mul(accRioPerShare).div(1e12).sub(user.rewardDebt); }
5,817
22
// Enter DAI + USDC + ETH markets to enable using them as borrow collateral.
_enterMarkets();
_enterMarkets();
26,650
142
// registerEscapeRequest(): set the escape state of _point and update the reverse lookup for sponsors
function registerEscapeRequest( uint32 _point, bool _isEscaping, uint32 _sponsor ) internal
function registerEscapeRequest( uint32 _point, bool _isEscaping, uint32 _sponsor ) internal
14,324
211
// get tokenID
uint tokenID = totalSupply();
uint tokenID = totalSupply();
17,089
2
// Used by gages to compute and distribute ETRNL liquid gage rewards appropriately
function settleGage(address payable receiver, uint256 id, bool winner) external;
function settleGage(address payable receiver, uint256 id, bool winner) external;
12,439
51
// May only be called if the crowdfund has not been halted
modifier is_not_halted() { if (halted) throw; _; }
modifier is_not_halted() { if (halted) throw; _; }
18,244
48
// Burns a specific amount of tokens. _value The amount of token to be burned. /
function burn(uint256 _value) public { _burn(msg.sender, _value); }
function burn(uint256 _value) public { _burn(msg.sender, _value); }
2,107
3
// send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /_from The address of the sender /_to The address of the recipient /_value The amount of token to be transferred / return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
28,712
31
// Gets the currently accumulated rewards per signal.return Currently accumulated rewards per signal /
function getAccRewardsPerSignal() public view override returns (uint256) { return accRewardsPerSignal.add(getNewRewardsPerSignal()); }
function getAccRewardsPerSignal() public view override returns (uint256) { return accRewardsPerSignal.add(getNewRewardsPerSignal()); }
10,675
10
// Get the total supply of token held by this contract.
function totalSupply() public view returns (uint256 _totalSupply)
function totalSupply() public view returns (uint256 _totalSupply)
20,471
18
// Subtracts two signed integers, reverts on overflow./
function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a)); return c; }
function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a)); return c; }
3,351
17
// Function to trigger gaslessBasefee payment from payer to paymasterCan only be called from trustedForwarder payer Address of basefee payer (meta-tx signer) paymaster Address of paymester (meta-tx executer) /
function payGaslessBasefee(address payer, address paymaster) external { require(isTrustedForwarder(msg.sender), "EURL: only trustedForwarder can process gasless basefee payment"); require(balanceOf(_msgSender()) >= _gaslessBasefee, "EURL: balance too low, can't pay gasless basefee"); uint256 feeRate = _txfeeRate; _txfeeRate = 0; _transfer(payer, paymaster, _gaslessBasefee); _txfeeRate = feeRate; }
function payGaslessBasefee(address payer, address paymaster) external { require(isTrustedForwarder(msg.sender), "EURL: only trustedForwarder can process gasless basefee payment"); require(balanceOf(_msgSender()) >= _gaslessBasefee, "EURL: balance too low, can't pay gasless basefee"); uint256 feeRate = _txfeeRate; _txfeeRate = 0; _transfer(payer, paymaster, _gaslessBasefee); _txfeeRate = feeRate; }
55,599
496
// Now there are three valid scenarios remaining: - msg.sender is the original booster - op is expired - getBoosterAddress returns a different booster than the original booster In the second and third case, anyone can call finalize.
address originalBooster = metadata.booster; if (originalBooster == msg.sender) { return metadata.createdAt; // First case }
address originalBooster = metadata.booster; if (originalBooster == msg.sender) { return metadata.createdAt; // First case }
67,472
127
// Ensure that the implementation contract has code via extcodesize.
uint256 size; assembly { size := extcodesize(implementation) }
uint256 size; assembly { size := extcodesize(implementation) }
4,877
6
// Proposed Governor can claim governance ownership /
function claimGovernorChange() public virtual onlyProposedGovernor { _changeGovernor(proposedGovernor); emit GovernorChangeClaimed(proposedGovernor); proposedGovernor = address(0); }
function claimGovernorChange() public virtual onlyProposedGovernor { _changeGovernor(proposedGovernor); emit GovernorChangeClaimed(proposedGovernor); proposedGovernor = address(0); }
31,954
47
// In case of ordinary placement
transferEth(referrerAddress, cost); Transfer(userAddress, referrerAddress, cost, 3, level); return;
transferEth(referrerAddress, cost); Transfer(userAddress, referrerAddress, cost, 3, level); return;
41,098
35
// Assigns a new address to act as the Secondary Manager.
function setSecondaryManager(address _newGM) external onlyManager { require(_newGM != address(0)); managerSecondary = _newGM; }
function setSecondaryManager(address _newGM) external onlyManager { require(_newGM != address(0)); managerSecondary = _newGM; }
23,216
104
// returns 0x0 if pair doesn't exist.
address uniswapV2Pair = IUniswapV2Factory(uniswapV2FactoryAddress).getPair(address(this), erc20token); require(uniswapV2Pair != 0x0000000000000000000000000000000000000000, "EnableInterest: No valid pair exists for erc20token"); if(generateInterest) { _UniswapAddresses[uniswapV2Pair] = generateInterest; emit UniswapAddressAdded(uniswapV2Pair); } else {
address uniswapV2Pair = IUniswapV2Factory(uniswapV2FactoryAddress).getPair(address(this), erc20token); require(uniswapV2Pair != 0x0000000000000000000000000000000000000000, "EnableInterest: No valid pair exists for erc20token"); if(generateInterest) { _UniswapAddresses[uniswapV2Pair] = generateInterest; emit UniswapAddressAdded(uniswapV2Pair); } else {
11,005
1
// ProductIndex is used to identify products
uint public ProductIndex; address public arbiter;
uint public ProductIndex; address public arbiter;
2,342
197
// no consensus, challenge failed.
for (uint i = 0; i < numAgrees; i++) { consensus_strikes[agrees[i]] += 2; if (consensus_strikes[agrees[i]] > FAIL_THRESHOLD) { reward += penalize(agrees[i]); }
for (uint i = 0; i < numAgrees; i++) { consensus_strikes[agrees[i]] += 2; if (consensus_strikes[agrees[i]] > FAIL_THRESHOLD) { reward += penalize(agrees[i]); }
53,805