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
60
// calculates how much eth would be in contract given a number of keys _keys number of keys "in contract" return eth that would exists /
function eth(uint256 _keys) internal pure returns(uint256)
function eth(uint256 _keys) internal pure returns(uint256)
28,304
52
// UpgradedERC20Token Contract - Implement methods which are called as legacy /
contract UpgradedERC20Token is StandardToken { function transferByLegacy(address from, address to, uint256 value) public returns (bool success); function transferFromByLegacy( address sender, address from, address spender, uint256 value ) public returns (bool...
contract UpgradedERC20Token is StandardToken { function transferByLegacy(address from, address to, uint256 value) public returns (bool success); function transferFromByLegacy( address sender, address from, address spender, uint256 value ) public returns (bool...
48,561
568
// Set liquidation incentive to new incentive
liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;
liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;
6,388
66
// Initializes the owner, admin and operator roles. _owner Address of the contract owner _initialAdmins The list of addresses that are granted the admin role. /
function initialize(address _owner, address[] memory _initialAdmins) public initializer { owner = _owner; // Grant the admin role to the initial admins for (uint256 i = 0; i < _initialAdmins.length; i++) { admins[_initialAdmins[i]] = true; } }
function initialize(address _owner, address[] memory _initialAdmins) public initializer { owner = _owner; // Grant the admin role to the initial admins for (uint256 i = 0; i < _initialAdmins.length; i++) { admins[_initialAdmins[i]] = true; } }
20,343
103
// засчитываем поражение
if (_useCoin) { require(coin.burn(heroes.ownerOf(_tokenId), 1));
if (_useCoin) { require(coin.burn(heroes.ownerOf(_tokenId), 1));
31,735
166
// Users are unable to claim fees if their collateralisation ratio drifts out of target threshold
function targetThreshold() external view returns (uint) { return getTargetThreshold(); }
function targetThreshold() external view returns (uint) { return getTargetThreshold(); }
48,967
163
// set the new leader bool to true
_eventData_.compressedData = _eventData_.compressedData + 100;
_eventData_.compressedData = _eventData_.compressedData + 100;
3,494
122
// increase next purchase eligibility by an hour
nextBoostPurchaseTime[user] = block.timestamp.add(3600);
nextBoostPurchaseTime[user] = block.timestamp.add(3600);
41,811
18
// Get the current fee return uint256 /
function fee() public view returns (uint256) { return s_fee; }
function fee() public view returns (uint256) { return s_fee; }
51,970
1
// Three different options for minting MyCollectibles (basic, premium, and gold). /
enum Option { Basic, Premium, Gold }
enum Option { Basic, Premium, Gold }
2,665
327
// migrate user HOLY tokens to HH tokens (without multipliers) allowance should be already provided to this contract address by user
function emergencyMigrate() public { require(block.timestamp >= migrationStartTimestamp && block.timestamp < migrationEndTimestamp, "time not in migration window"); uint256 userBalance = oldToken.balanceOf(msg.sender); uint256 contractAllowance = oldToken.allowance(msg.sender, address(this))...
function emergencyMigrate() public { require(block.timestamp >= migrationStartTimestamp && block.timestamp < migrationEndTimestamp, "time not in migration window"); uint256 userBalance = oldToken.balanceOf(msg.sender); uint256 contractAllowance = oldToken.allowance(msg.sender, address(this))...
24,362
22
// Stores usernames used
mapping (string => address) usernames;
mapping (string => address) usernames;
34,597
47
// Submit the answer whose hash you sent in a previous submitAnswerCommitment() transaction/Checks the parameters supplied recreate an existing commitment, and stores the revealed answer/ Updates the current answer unless someone has since supplied a new answer with a higher bond/ msg.sender is intentionally not restri...
function submitAnswerReveal(bytes32 question_id, bytes32 answer, uint256 nonce, uint256 bond) stateOpenOrPendingArbitration(question_id)
function submitAnswerReveal(bytes32 question_id, bytes32 answer, uint256 nonce, uint256 bond) stateOpenOrPendingArbitration(question_id)
26,584
238
// return if minting is finished or not. /
function mintingFinished() public view returns (bool) { return _mintingFinished; }
function mintingFinished() public view returns (bool) { return _mintingFinished; }
6,246
20
// Validator is blamed during investigation phase
ValidatorIsPunished, // 7
ValidatorIsPunished, // 7
46,993
3
// Edition description
string description;
string description;
30,766
79
// bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58ebytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5bytes4(keccak256('safeTransferFrom(address,address,u...
bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26;
bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26;
12,486
3
// 2018-08-20 23:59:59 GMT - end time for pre sale
uint256 private constant presaleEndTime = 1534809599;
uint256 private constant presaleEndTime = 1534809599;
48,927
157
// Cancel bet and relase all the bets back to the betters if, for any reason, payouts cannot be completed. (For example Oracle fails.) Triggered by owners.
function cancel() private { canceled = true; completed = false; }
function cancel() private { canceled = true; completed = false; }
52,273
58
//
* @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * h...
* @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * h...
588
37
// Phase information for slow-release tokens.
uint public phaseStart = 0; uint public constant PHASE_DURATION = 180 days; uint public constant UNLOCK_PHASES = 4;
uint public phaseStart = 0; uint public constant PHASE_DURATION = 180 days; uint public constant UNLOCK_PHASES = 4;
13,315
90
// Query the quantity of the target quotation/channelId 报价通道编号/index The index of the sheet/ return minedBlocks Mined block period from previous block/ return totalShares Total shares of sheets in the block
function getMinedBlocks( uint channelId, uint index ) external view returns (uint minedBlocks, uint totalShares);
function getMinedBlocks( uint channelId, uint index ) external view returns (uint minedBlocks, uint totalShares);
30,454
344
// Getter functions for Rewards contract
function getCurrentRewardWeek() external view returns(uint256)
function getCurrentRewardWeek() external view returns(uint256)
10,714
101
// Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address. /
function _mint(address account, uint256 amount) internal { require(account != address(0), "BEP20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
function _mint(address account, uint256 amount) internal { require(account != address(0), "BEP20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); }
10,447
30
// Call Approve of JPYC contract before claimDo all requestDamageInformation() before claimUse "require" to call this function after insuredDeadline when you make your product. /
function determineTotalPayoutAmount() public onlyOwner { require(block.timestamp > insuredDeadline, "The insuredDeadline has not come."); uint256 _compensatedAmount; uint256 _remainingAmount; if (totalMaxPayoutAmount <= riskPoolBalanceForPayout) { _r...
function determineTotalPayoutAmount() public onlyOwner { require(block.timestamp > insuredDeadline, "The insuredDeadline has not come."); uint256 _compensatedAmount; uint256 _remainingAmount; if (totalMaxPayoutAmount <= riskPoolBalanceForPayout) { _r...
29,066
68
// beneficiary address of the beneficiary to whom vested tokens are transferredcliff duration in seconds of the cliff in which tokens will begin to vestduration duration in seconds of the period in which the tokens will vest/
function AddVest(address beneficiary, uint256 start, uint256 cliff, uint256 duration, uint256 amount) internal { require(beneficiary != address(0), "ZONE::AddVest Invalid beneficiary"); require(cliff <= duration, "ZONE::AddVest cliff > duration"); Vest memory vest = Vest({ benef...
function AddVest(address beneficiary, uint256 start, uint256 cliff, uint256 duration, uint256 amount) internal { require(beneficiary != address(0), "ZONE::AddVest Invalid beneficiary"); require(cliff <= duration, "ZONE::AddVest cliff > duration"); Vest memory vest = Vest({ benef...
45,998
33
// Divides two exponentials, returning a new exponential. (a/scale) / (b/scale) = (a/scale)(scale/b) = a/b,which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)/
function divExp(Exp memory a, Exp memory b) pure internal returns (Error, Exp memory) { return getExp(a.mantissa, b.mantissa); }
function divExp(Exp memory a, Exp memory b) pure internal returns (Error, Exp memory) { return getExp(a.mantissa, b.mantissa); }
38,451
54
// Whether `a` is less than or equal to `b`. a a FixedPoint.Signed. b a FixedPoint.Signed.return True if `a <= b`, or False. /
function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue <= b.rawValue; }
function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue <= b.rawValue; }
34,147
33
// Note: We don't need to check their balance as the _convert() below will do a safe subtraction which requires the subtraction to not overflow, which would happen if their balance is not sufficient.
_convert( sourceCurrencyKey, from, sourceAmountAfterSettlement, destinationCurrencyKey, amountReceived, destinationAddress, false // no vsynths );
_convert( sourceCurrencyKey, from, sourceAmountAfterSettlement, destinationCurrencyKey, amountReceived, destinationAddress, false // no vsynths );
41,477
11
// diagonal
if(board[1][1] != SquareState.Empty && board[1][1] == board[0][0] && board[1][1] == board[2][2]) { return board[1][1]; }
if(board[1][1] != SquareState.Empty && board[1][1] == board[0][0] && board[1][1] == board[2][2]) { return board[1][1]; }
22,134
114
// NOTE: the offset 32 is added to skip the `size` field of both bytes variables
uint i = 32 + fromOffset; uint j = 32 + toOffset; while (i < (32 + fromOffset + length)) { assembly { let tmp := mload(add(from, i)) mstore(add(to, j), tmp) }
uint i = 32 + fromOffset; uint j = 32 + toOffset; while (i < (32 + fromOffset + length)) { assembly { let tmp := mload(add(from, i)) mstore(add(to, j), tmp) }
14,131
425
// to set address of kyc authentication_add is the new address /
function setKycAuthAddress(address _add) external onlyInternal { kycAuthAddress = _add; }
function setKycAuthAddress(address _add) external onlyInternal { kycAuthAddress = _add; }
22,375
177
// must override
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); }
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); }
23,887
46
// There must be enough balance to stake.
require( _unstakedBalanceOf >= _amount, "TicketBooth::stake: INSUFFICIENT_FUNDS" );
require( _unstakedBalanceOf >= _amount, "TicketBooth::stake: INSUFFICIENT_FUNDS" );
81,816
5
// Disputes
mapping (uint256=>Disputes) private disputes_;
mapping (uint256=>Disputes) private disputes_;
53,016
434
// Get the non-fungible balance record for the given wallet, type, currency/ and block number/wallet The address of the concerned wallet/_type The balance type/currencyCt The address of the concerned currency contract (address(0) == ETH)/currencyId The ID of the concerned currency (0 for ETH and ERC20)/_blockNumber The...
function nonFungibleRecordByBlockNumber(address wallet, bytes32 _type, address currencyCt, uint256 currencyId, uint256 _blockNumber) public view returns (int256[] ids, uint256 blockNumber)
function nonFungibleRecordByBlockNumber(address wallet, bytes32 _type, address currencyCt, uint256 currencyId, uint256 _blockNumber) public view returns (int256[] ids, uint256 blockNumber)
59,036
4
// 將不同地址映射到不同的貨幣持有量
mapping(address => uint256) balances;
mapping(address => uint256) balances;
34,534
68
// transfer tokens to pair
token.safeTransferFrom(from, to, amount);
token.safeTransferFrom(from, to, amount);
4,453
112
// claim ARA allocation based on old + new invested amounts
function claimARA() public onlyEOA { require(canClaim, "cannot claim yet"); require(!claimed[msg.sender], "already claimed"); require(!blacklisted[msg.sender], "blacklisted"); if (invested[msg.sender] > 0) { ERC20(ARA).transfer(msg.sender, invested[msg.sender]); ...
function claimARA() public onlyEOA { require(canClaim, "cannot claim yet"); require(!claimed[msg.sender], "already claimed"); require(!blacklisted[msg.sender], "blacklisted"); if (invested[msg.sender] > 0) { ERC20(ARA).transfer(msg.sender, invested[msg.sender]); ...
9,261
30
// Means permHash is not currently set.
if (currentFlag == UNSET_FLAG) { permissionsHashed[permHash] = ALLOW_FLAG; emit Granted(_permissionId, msg.sender, _where, _who, ALLOW_FLAG); }
if (currentFlag == UNSET_FLAG) { permissionsHashed[permHash] = ALLOW_FLAG; emit Granted(_permissionId, msg.sender, _where, _who, ALLOW_FLAG); }
8,292
158
// Provides a standard implementation for transferring unspent spend assets/ from an adapter to a VaultProxy at the end of an adapter action
modifier postActionSpendAssetsTransferHandler(address _vaultProxy, bytes memory _assetData) { _; (address[] memory spendAssets, , ) = __decodeAssetData(_assetData); __pushFullAssetBalances(_vaultProxy, spendAssets); }
modifier postActionSpendAssetsTransferHandler(address _vaultProxy, bytes memory _assetData) { _; (address[] memory spendAssets, , ) = __decodeAssetData(_assetData); __pushFullAssetBalances(_vaultProxy, spendAssets); }
22,228
1,235
// (tokenB, tokenC, tokenA)
return (2, 0, 1);
return (2, 0, 1);
13,842
4
// Compatible with old version 1
return address(0);
return address(0);
16,467
77
// Returns the xxx of the token. /
_allowances[owner][spender] = amount; emit Approval(owner, spender, amount);
_allowances[owner][spender] = amount; emit Approval(owner, spender, amount);
40,217
10
// Called by the payer to store the sent amount as credit to be pulled.dest The destination address of the funds.amount The amount to transfer./
function asyncSend(address dest, uint256 amount) internal { payments[dest] = payments[dest].add(amount); totalPayments = totalPayments.add(amount); }
function asyncSend(address dest, uint256 amount) internal { payments[dest] = payments[dest].add(amount); totalPayments = totalPayments.add(amount); }
4,591
172
// _fromToken will be either fromToken of toToken of the previous path
IERC20 _fromToken = i > 0 ? IERC20(path[i - 1].to) : IERC20(fromToken); IERC20 _toToken = IERC20(path[i].to); if (i > 0 && address(_fromToken) == Utils.ethAddress()) { _fromAmount = _fromAmount.sub(path[i].totalNetworkFee); }
IERC20 _fromToken = i > 0 ? IERC20(path[i - 1].to) : IERC20(fromToken); IERC20 _toToken = IERC20(path[i].to); if (i > 0 && address(_fromToken) == Utils.ethAddress()) { _fromAmount = _fromAmount.sub(path[i].totalNetworkFee); }
19,934
450
// returns `(x + y) % 2 ^ 256` /
function _unsafeAdd(uint256 x, uint256 y) private pure returns (uint256) { unchecked { return x + y; } }
function _unsafeAdd(uint256 x, uint256 y) private pure returns (uint256) { unchecked { return x + y; } }
65,095
129
// The seller have enought tokens to fulfill the request!
_verifyOwnershipOfTokens(_companyId, msg.sender, _amount); order.amountFilled += uint32(_amount);
_verifyOwnershipOfTokens(_companyId, msg.sender, _amount); order.amountFilled += uint32(_amount);
44,386
3
// list of all citizens of the DAO
EnumerableSet.AddressSet Citizens_List;
EnumerableSet.AddressSet Citizens_List;
6,556
58
// Allow lender to set repayment recipient of a given loan./ loanID_ of lender's loan./ recipient_ reciever of repayments
function setRepaymentAddress(uint256 loanID_, address recipient_) external { if (msg.sender != loans[loanID_].lender) revert OnlyApproved(); // Update the repayment method. loans[loanID_].recipient = recipient_; }
function setRepaymentAddress(uint256 loanID_, address recipient_) external { if (msg.sender != loans[loanID_].lender) revert OnlyApproved(); // Update the repayment method. loans[loanID_].recipient = recipient_; }
14,601
37
// Contract can change ICO finish date up to 7 days, but only one time
bool public isTryedFinishCrowdsale = false; bool public isBurnActive = false;
bool public isTryedFinishCrowdsale = false; bool public isBurnActive = false;
36,854
13
// Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],but performing a static call. _Available since v3.3._ /
function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, retu...
function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, retu...
21,554
128
// Pay transmitter back this much LINK per unit eth spent on gas (1e-6LINK/ETH units)
uint32 microLinkPerEth;
uint32 microLinkPerEth;
25,953
86
// 0xE1873e7f38F2e88Dd0283ce4a2d8Cc9AAbD55EcF
contract Controller { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public governance; address public onesplit; address public rewards; address public timelock; mapping(address => address) public vaults; mapping(address => address) publ...
contract Controller { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public governance; address public onesplit; address public rewards; address public timelock; mapping(address => address) public vaults; mapping(address => address) publ...
30,582
107
// Open a state channel through auth withdraw message library function can't be payable but can read msg.value in caller's context _self storage data of CelerLedger contract _openRequest bytes of open channel request message /
function openChannel(
function openChannel(
25,269
62
// Destroys `amount` tokens from `account`.`amount` is then deductedfrom the caller's allowance.
* See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); }
* See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); }
28,307
13
// Pause sale if active, make active if paused
function flipSaleState() external onlyOwner { saleIsActive = !saleIsActive; }
function flipSaleState() external onlyOwner { saleIsActive = !saleIsActive; }
31,745
683
// Mints debt token to the `onBehalfOf` address.-Only callable by the LendingPool- The resulting rate is the weighted average between the rate of the new debtand the rate of the previous debt user The address receiving the borrowed underlying, being the delegatee in caseof credit delegate, or same as `onBehalfOf` other...
) external override onlyLendingPool returns (bool) { MintLocalVars memory vars; if (user != onBehalfOf) { _decreaseBorrowAllowance(onBehalfOf, user, amount); } (, uint256 currentBalance, uint256 balanceIncrease) = _calculateBalanceIncrease(onBehalfOf); vars.previousSupply = totalSupply();...
) external override onlyLendingPool returns (bool) { MintLocalVars memory vars; if (user != onBehalfOf) { _decreaseBorrowAllowance(onBehalfOf, user, amount); } (, uint256 currentBalance, uint256 balanceIncrease) = _calculateBalanceIncrease(onBehalfOf); vars.previousSupply = totalSupply();...
25,139
17
// Function to add APS manager to Yieldster./_manager Address of the manager.
function addManager(address _manager) public onlyYieldsterDAO
function addManager(address _manager) public onlyYieldsterDAO
40,240
22
// Assumes worst case scenario if FRAX slips out of range.Otherwise, it would only be half that is multiplied by the CR
frax_portion = frax_portion.mul(FRAX.global_collateral_ratio()).div(PRICE_PRECISION); return (collat_portion).add(frax_portion);
frax_portion = frax_portion.mul(FRAX.global_collateral_ratio()).div(PRICE_PRECISION); return (collat_portion).add(frax_portion);
6,389
76
// Sets the minimum bond that is required for an answer to be accepted./bond Minimum bond that is required for an answer to be accepted/This can only be called by the owner
function setMinimumBond(uint256 bond) public onlyOwner { minimumBond = bond; }
function setMinimumBond(uint256 bond) public onlyOwner { minimumBond = bond; }
49,569
77
// setup _limits
_limits = MaxLimits({ maxWallet: TOTAL_SUPPLY * _limitRatios.wallet / _limitRatios.divisor, maxSell: TOTAL_SUPPLY * _limitRatios.sell / _limitRatios.divisor, maxBuy: TOTAL_SUPPLY * _limitRatios.buy / _limitRatios.divisor });
_limits = MaxLimits({ maxWallet: TOTAL_SUPPLY * _limitRatios.wallet / _limitRatios.divisor, maxSell: TOTAL_SUPPLY * _limitRatios.sell / _limitRatios.divisor, maxBuy: TOTAL_SUPPLY * _limitRatios.buy / _limitRatios.divisor });
24,038
10
// no payout has been made. subtract genesis from milkTill
totalDuration = milkTill - tokenData.genesis;
totalDuration = milkTill - tokenData.genesis;
8,305
601
// Emits a {Transfer} event. Requirements: - `src` must have a balance of at least `amount`. // if_succeeds {:msg "Transfer - src decrease"} old(_balanceOf[src]) >= _balanceOf[src];/ if_succeeds {:msg "Transfer - dst increase"} _balanceOf[dst] >= old(_balanceOf[dst]);/ if_succeeds {:msg "Transfer - supply"} old(_balanc...
function _transfer(address src, address dst, uint wad) internal virtual returns (bool) { require(_balanceOf[src] >= wad, "ERC20: Insufficient balance"); unchecked { _balanceOf[src] = _balanceOf[src] - wad; }
function _transfer(address src, address dst, uint wad) internal virtual returns (bool) { require(_balanceOf[src] >= wad, "ERC20: Insufficient balance"); unchecked { _balanceOf[src] = _balanceOf[src] - wad; }
20,141
56
// Verify whether order nonce has expired
require( (_isUserOrderNonceExecutedOrCancelled[makerOrder.signer][makerOrder.nonce] < type(uint256).max) && (makerOrder.nonce >= userMinOrderNonce[makerOrder.signer]), "Order: Matching order expired" );
require( (_isUserOrderNonceExecutedOrCancelled[makerOrder.signer][makerOrder.nonce] < type(uint256).max) && (makerOrder.nonce >= userMinOrderNonce[makerOrder.signer]), "Order: Matching order expired" );
28,325
667
// AmmExitProcess
library AmmExitProcess
library AmmExitProcess
81,202
163
// Migrate funds to the new liquidity provider.//_newLP The address of the new LiquidityPool contract.
function migrate(ILiquidityPool _newLP) public onlyOperator { for (uint256 i = 0; i < registeredTokens.length; i++) { address token = registeredTokens[i]; kTokens[token].addMinter(address(_newLP)); kTokens[token].renounceMinter(); _newLP.register(kTokens[token...
function migrate(ILiquidityPool _newLP) public onlyOperator { for (uint256 i = 0; i < registeredTokens.length; i++) { address token = registeredTokens[i]; kTokens[token].addMinter(address(_newLP)); kTokens[token].renounceMinter(); _newLP.register(kTokens[token...
50,942
27
// add owner
function addOwner(address owner) external onlyThis{ require(owner != address(0), "Zero address"); require(owners.length() < 127, "Too many owners"); require(owners.add(owner), "Owner already added"); ownersSetCounter++; // change owners set emit SetOwner(owner, true); }
function addOwner(address owner) external onlyThis{ require(owner != address(0), "Zero address"); require(owners.length() < 127, "Too many owners"); require(owners.add(owner), "Owner already added"); ownersSetCounter++; // change owners set emit SetOwner(owner, true); }
52,008
5
// Game information
struct GameInfo { // game start time uint256 timestamp; // game odds uint32 odd_homeTeam; uint32 odd_drawTeam; uint32 odd_awayTeam; uint32 odd_over; uint32 odd_under; uint32 odd_homeTeamAndDraw; uint32 odd_homeAndAwayTeam; uint32 odd_awayTeamAndDraw; // Checking the ga...
struct GameInfo { // game start time uint256 timestamp; // game odds uint32 odd_homeTeam; uint32 odd_drawTeam; uint32 odd_awayTeam; uint32 odd_over; uint32 odd_under; uint32 odd_homeTeamAndDraw; uint32 odd_homeAndAwayTeam; uint32 odd_awayTeamAndDraw; // Checking the ga...
38,054
4
// Address of the MANA ERC20 contract
IERC20 MANA;
IERC20 MANA;
23,568
52
// convert little endian bytes to uint
function getBytesLE(bytes data, uint pos, uint bits) returns (uint) { if (bits == 8) { return uint8(data[pos]); } else if (bits == 16) { return uint16(data[pos]) + uint16(data[pos + 1]) * 2 ** 8; } else if (bits == 32) { return uint32(data...
function getBytesLE(bytes data, uint pos, uint bits) returns (uint) { if (bits == 8) { return uint8(data[pos]); } else if (bits == 16) { return uint16(data[pos]) + uint16(data[pos + 1]) * 2 ** 8; } else if (bits == 32) { return uint32(data...
17,422
38
// Buy SPUME with ETH
function buy() public payable { require(closed == false, "Sale is closed"); int price = getETHUSDPrice(); require(price > 0, "Error with Chainlink"); uint256 spumeAmount = uint256(price) * msg.value; spumeAmount = (((spumeAmount / (10 ** 8)) * 3333) / 1000); require(s...
function buy() public payable { require(closed == false, "Sale is closed"); int price = getETHUSDPrice(); require(price > 0, "Error with Chainlink"); uint256 spumeAmount = uint256(price) * msg.value; spumeAmount = (((spumeAmount / (10 ** 8)) * 3333) / 1000); require(s...
85,755
4
// get the slot from storage and unpack it
uint256 slot = EDITION_SLOTS[slotForTokenId]; uint256 unpackedSlot = _unPackSlot(slot, slotIndex);
uint256 slot = EDITION_SLOTS[slotForTokenId]; uint256 unpackedSlot = _unPackSlot(slot, slotIndex);
75,979
139
// 44the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping (uint256 => add...
* {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping (uint256 => add...
40,403
265
// purchase multiple kidz at once
function purchaseKidz(uint256 _howMany) public payable { require(isSaleActive, "Sale not active"); _beforeMint(_howMany); require(_howMany <= 20, "Max 20 kidz at once"); uint256 _itemPrice = _howMany == 1 ? tier1Price : _howMany == 2 ? tier2Price : tier3Price; require(msg.val...
function purchaseKidz(uint256 _howMany) public payable { require(isSaleActive, "Sale not active"); _beforeMint(_howMany); require(_howMany <= 20, "Max 20 kidz at once"); uint256 _itemPrice = _howMany == 1 ? tier1Price : _howMany == 2 ? tier2Price : tier3Price; require(msg.val...
76,343
3
// State Variables // Transactions /
string _dob) public returns(bool success) { profiles[userAddress].username = _username; profiles[userAddress].email = _email; profiles[userAddress].firstName = _firstname; profiles[userAddress].lastName = _lastname; profiles[userAddress].occupation = _occupation; profiles[userAddress].dob =...
string _dob) public returns(bool success) { profiles[userAddress].username = _username; profiles[userAddress].email = _email; profiles[userAddress].firstName = _firstname; profiles[userAddress].lastName = _lastname; profiles[userAddress].occupation = _occupation; profiles[userAddress].dob =...
19,262
16
// Additional transaction functions below
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "Transfer from the zero address"); require(recipient != address(0), "Transfer to the zero address"); uint256 senderBalance = _balances[sender]; require(senderBalance >= amou...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "Transfer from the zero address"); require(recipient != address(0), "Transfer to the zero address"); uint256 senderBalance = _balances[sender]; require(senderBalance >= amou...
31,003
1
// General proposal structure.
struct Proposal { uint256 id; address proposalAddress; address investTokenAddress; DaoFunction daoFunction; uint256 amount; address creator; uint256 endLifetime; EnumerableSet.AddressSet voterAddresses; uint256 votesFor; uint256 votesAgainst; uint256 votes; bool execute...
struct Proposal { uint256 id; address proposalAddress; address investTokenAddress; DaoFunction daoFunction; uint256 amount; address creator; uint256 endLifetime; EnumerableSet.AddressSet voterAddresses; uint256 votesFor; uint256 votesAgainst; uint256 votes; bool execute...
1,812
414
// Library for managing an enumerable variant of Solidity'stype. Maps have the following properties: - Entries are added, removed, and checked for existence in constant time(O(1)).- Entries are enumerated in O(n). No guarantees are made on the ordering. ```
* contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * }
* contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * }
33,605
55
// Manually back TTC owner address. /
function backTTCOwner() onlyOwner public { coin.transferOwnership(owner); }
function backTTCOwner() onlyOwner public { coin.transferOwnership(owner); }
20,710
0
// Network: Fuji TestnetLINK address: 0x47523b7C935671d6e4AC0CB8f9F6a3Fa60Fe298bFee: 0.001 LINK /
constructor() public { setChainlinkToken(0x326C977E6efc84E512bB9C30f76E30c160eD06FB); fee = 10 ** 15; // 0.001 LINK }
constructor() public { setChainlinkToken(0x326C977E6efc84E512bB9C30f76E30c160eD06FB); fee = 10 ** 15; // 0.001 LINK }
30,747
91
// feeEnabled is a failsafe incase something goes wrong - no one must get rekt, let's be able to turn off if required
if(feeEnabled) {
if(feeEnabled) {
36,584
446
// expmods_and_points.points[70] = -(g^8175z).
mstore(add(expmodsAndPoints, 0xb20), point)
mstore(add(expmodsAndPoints, 0xb20), point)
3,369
77
// Getter for the data encryption key and version. account The address of the account to get the key forreturn dataEncryptionKey secp256k1 public key for data encryption. Preferably compressed. /
function getDataEncryptionKey(address account) external view returns (bytes memory) { return accounts[account].dataEncryptionKey; }
function getDataEncryptionKey(address account) external view returns (bytes memory) { return accounts[account].dataEncryptionKey; }
15,229
116
// allow DEFALUT_ADMIN to withdraw as much as he wants
_checkAndUpdateEthMaxCap(amount); payable(to).transfer(amount);
_checkAndUpdateEthMaxCap(amount); payable(to).transfer(amount);
25,389
104
// require(bytes(_name).length > 0 && bytes(_symbol).length > 0);validate input
token = GACToken(tokenAddress); tokensPerUSD = 10 * 10 ** 18; valueToBeSent = token.valueToBeSent(); pricingstrategy = PricingStrategy(strategy);
token = GACToken(tokenAddress); tokensPerUSD = 10 * 10 ** 18; valueToBeSent = token.valueToBeSent(); pricingstrategy = PricingStrategy(strategy);
17,447
37
// Initializes timelock contract with the address of the governor/admin admin_ Address of the timelock admin. /
function initialize(address admin_) external onlyOwner initializer { admin = admin_; }
function initialize(address admin_) external onlyOwner initializer { admin = admin_; }
43,019
33
// Set the address as claimed with the _claimable amount.
addressToBBClaimed[msg.sender] += _claimable; // add the claimed amount
addressToBBClaimed[msg.sender] += _claimable; // add the claimed amount
26,386
216
// Construct a new Configurable Rights Pool (wrapper around BPool) _initialTokens and _swapFee are only used for temporary storage between construction and create pool, and should not be used thereafter! _initialTokens is destroyed in createPool to prevent this, and _swapFee is kept in sync (defensively), but should ne...
constructor( address factoryAddress, PoolParams memory poolParams, RightsManager.Rights memory rightsStruct ) public PCToken(poolParams.poolTokenSymbol, poolParams.poolTokenName)
constructor( address factoryAddress, PoolParams memory poolParams, RightsManager.Rights memory rightsStruct ) public PCToken(poolParams.poolTokenSymbol, poolParams.poolTokenName)
33,586
85
// burn
_updateAccountSnapshot(from); _updateTotalSupplySnapshot();
_updateAccountSnapshot(from); _updateTotalSupplySnapshot();
20,441
201
// Allows owner to set Max mints per tx _newMaxMint maximum amount of tokens allowed to mint per tx. Must be >= 1 /
function setMaxMint(uint256 _newMaxMint) public onlyOwner { require(_newMaxMint >= 1, "Max mint must be at least 1"); maxBatchSize = _newMaxMint; }
function setMaxMint(uint256 _newMaxMint) public onlyOwner { require(_newMaxMint >= 1, "Max mint must be at least 1"); maxBatchSize = _newMaxMint; }
15,927
155
// whether a certain entity has a permission
mapping (bytes32 => bytes32) permissions; // 0 for no permission, or parameters id mapping (bytes32 => Param[]) public permissionParams;
mapping (bytes32 => bytes32) permissions; // 0 for no permission, or parameters id mapping (bytes32 => Param[]) public permissionParams;
27,597
118
// Owner can KYC (or revoke) addresses until close of funding
function addKycAddress(address _addr, bool _kyc) public noReentry onlyOwner returns (bool)
function addKycAddress(address _addr, bool _kyc) public noReentry onlyOwner returns (bool)
985
9
// Approve tokens from gnosis safe to attacker contract
token.approve(spender, type(uint256).max);
token.approve(spender, type(uint256).max);
38,599
7
// Add a token to the end of the list /
function add(uint16 _id) public onlyAllowed { data[actualSize] = _id; actualSize++; }
function add(uint16 _id) public onlyAllowed { data[actualSize] = _id; actualSize++; }
54,480
3
// Status of a risk provider
mapping(address => bool) private _provider;
mapping(address => bool) private _provider;
5,022
85
// manages the Collateralization Oracle as well as other protocol oracles.
bytes32 internal constant ORACLE_ADMIN = keccak256("ORACLE_ADMIN_ROLE");
bytes32 internal constant ORACLE_ADMIN = keccak256("ORACLE_ADMIN_ROLE");
49,491
79
// ----------- PCV Controller only state changing api -----------
function withdraw(address to, uint256 amount) external; function withdrawERC20(address token, address to, uint256 amount) external; function withdrawETH(address payable to, uint256 amount) external;
function withdraw(address to, uint256 amount) external; function withdrawERC20(address token, address to, uint256 amount) external; function withdrawETH(address payable to, uint256 amount) external;
27,928
47
// Do reverse order of fees charged in joinswap_ExternAmountIn, this way``` pAo == joinswap_ExternAmountIn(Ti, joinswap_PoolAmountOut(pAo, Ti)) ```uint tAi = tAiAfterFee / (1 - (1-weightTi)swapFee) ;
uint zar = bmul(bsub(BConst.BONE, normalizedWeight), swapFee); tokenAmountIn = bdiv(tokenAmountInAfterFee, bsub(BConst.BONE, zar)); return tokenAmountIn;
uint zar = bmul(bsub(BConst.BONE, normalizedWeight), swapFee); tokenAmountIn = bdiv(tokenAmountInAfterFee, bsub(BConst.BONE, zar)); return tokenAmountIn;
20,741
0
// if ether is sent to this address, send it back.
throw;
throw;
23,133