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
7
// 'requestedUser' is an array to store the address of users requesting for tokens.Inorder to not get in a out of gas exceptionof dynamic arrays size we are given a limited amount of user for registration fixed to 10. /
address[10] public requestedUser;
address[10] public requestedUser;
28,914
55
// If not tagged with a front end, the depositor gets a 100% cut of what their deposit earned. Otherwise, their cut of the deposit's earnings is equal to the kickbackRate, set by the front end through which they made their deposit./
uint kickbackRate = frontEndTag == address(0) ? DECIMAL_PRECISION : frontEnds[frontEndTag].kickbackRate; Snapshots memory snapshots = depositSnapshots[_depositor]; uint LQTYGain = kickbackRate.mul(_getLQTYGainFromSnapshots(initialDeposit, snapshots)).div(DECIMAL_PRECISION); return LQT...
uint kickbackRate = frontEndTag == address(0) ? DECIMAL_PRECISION : frontEnds[frontEndTag].kickbackRate; Snapshots memory snapshots = depositSnapshots[_depositor]; uint LQTYGain = kickbackRate.mul(_getLQTYGainFromSnapshots(initialDeposit, snapshots)).div(DECIMAL_PRECISION); return LQT...
29,815
87
// incase of change Ninja
require(newNinja != address(0), "Ninja Token address invalid"); token = IERC20(newNinja);
require(newNinja != address(0), "Ninja Token address invalid"); token = IERC20(newNinja);
17,123
1
// set the rate
function setRate(uint256 newTaxRate) external onlyOwner { require(newTaxRate <= 30, "Tax rate must be less than or equal to 30"); tax = newTaxRate; }
function setRate(uint256 newTaxRate) external onlyOwner { require(newTaxRate <= 30, "Tax rate must be less than or equal to 30"); tax = newTaxRate; }
34,791
5
// Returns number of admings. return Number of admings./
function numOfAdmins() view public returns(uint){ return admins.length; }
function numOfAdmins() view public returns(uint){ return admins.length; }
20,273
80
// Minimum tokens expected to sell
uint256 public goal;
uint256 public goal;
27,966
172
// ERC1155Inventory, burnable version. The function `uri(uint256)` needs to be implemented by a child contract, for example with the help of `BaseMetadataURI`. /
abstract contract ERC1155InventoryBurnable is IERC1155InventoryBurnable, ERC1155Inventory { using ERC1155InventoryIdentifiersLib for uint256; //======================================================= ERC165 ========================================================// /// @inheritdoc IERC165 function sup...
abstract contract ERC1155InventoryBurnable is IERC1155InventoryBurnable, ERC1155Inventory { using ERC1155InventoryIdentifiersLib for uint256; //======================================================= ERC165 ========================================================// /// @inheritdoc IERC165 function sup...
34,268
57
// Revoke the approvals for a token. The provided `approve` function is not sufficientfor this protocol, as it does not allow an approved address to revoke it's own approval. /
function revokeApproval(uint256 tokenId) external override nonReentrant { require( msg.sender == getApproved(tokenId), "Media: caller not approved address" ); _approve(address(0), tokenId); }
function revokeApproval(uint256 tokenId) external override nonReentrant { require( msg.sender == getApproved(tokenId), "Media: caller not approved address" ); _approve(address(0), tokenId); }
45,511
90
// Mints 1 Wantan Mee to contract creator for initial pool setup
_mint(msg.sender, 100 ether);
_mint(msg.sender, 100 ether);
20,743
41
// Send tokens to buyer
purchasableTokens = purchasableTokens.sub(tokens); balances[owner] = balances[owner].sub(tokens); balances[addr] = balances[addr].add(tokens); Transfer(owner, addr, tokens);
purchasableTokens = purchasableTokens.sub(tokens); balances[owner] = balances[owner].sub(tokens); balances[addr] = balances[addr].add(tokens); Transfer(owner, addr, tokens);
37,765
271
// Helper to make usage of the `CREATE2` EVM opcode easier and safer.`CREATE2` can be used to compute in advance the address where a smartcontract will be deployed, which allows for interesting new mechanisms knownas 'counterfactual interactions'. information. /
library Create2 { /** * @dev Deploys a contract using `CREATE2`. The address where the contract * will be deployed can be known in advance via {computeAddress}. Note that * a contract cannot be deployed twice using the same salt. */ function deploy(bytes32 salt, bytes memory bytecode) intern...
library Create2 { /** * @dev Deploys a contract using `CREATE2`. The address where the contract * will be deployed can be known in advance via {computeAddress}. Note that * a contract cannot be deployed twice using the same salt. */ function deploy(bytes32 salt, bytes memory bytecode) intern...
42,739
102
// Returns whether an account is excluded from reward./
function isExcludedFromReward(address account) external view returns (bool) { return _isExcludedFromReward[account]; }
function isExcludedFromReward(address account) external view returns (bool) { return _isExcludedFromReward[account]; }
25,210
47
// Function to change the ACO pools strategy.Only can be called by a pool admin. strategy Address of the strategy to be set. acoPools Array of ACO pools addresses. /
function setStrategyOnAcoPool(address strategy, address[] calldata acoPools) onlyPoolAdmin external virtual { _setStrategyOnAcoPool(strategy, acoPools); }
function setStrategyOnAcoPool(address strategy, address[] calldata acoPools) onlyPoolAdmin external virtual { _setStrategyOnAcoPool(strategy, acoPools); }
36,342
18
// IERC20?
interface IImx { function balanceOf(address account) external view returns (uint); function transfer(address dst, uint rawAmount) external returns (bool); }
interface IImx { function balanceOf(address account) external view returns (uint); function transfer(address dst, uint rawAmount) external returns (bool); }
28,275
6
// @todo replace with erc1155 token implementation
contract Token is IToken { mapping(uint256 => address) public tokens; mapping(uint256 => uint256) public goals; // sample function called from dao after voting funding session function mintCampaign( address _to, uint256 _tokenId, bytes32, /*_campaignHash*/ uint256 _goal,...
contract Token is IToken { mapping(uint256 => address) public tokens; mapping(uint256 => uint256) public goals; // sample function called from dao after voting funding session function mintCampaign( address _to, uint256 _tokenId, bytes32, /*_campaignHash*/ uint256 _goal,...
16,430
5,282
// 2643
entry "equidimensionally" : ENG_ADVERB
entry "equidimensionally" : ENG_ADVERB
23,479
1
// pool data view functions
function getA() external view returns (uint256); function getToken(uint8 index) external view returns (IERC20); function getTokenIndex(address tokenAddress) external view returns (uint8); function getTokenBalance(uint8 index) external view returns (uint256); function getVirtualPrice() external v...
function getA() external view returns (uint256); function getToken(uint8 index) external view returns (IERC20); function getTokenIndex(address tokenAddress) external view returns (uint8); function getTokenBalance(uint8 index) external view returns (uint256); function getVirtualPrice() external v...
24,732
22
// ERC20 stuff
event Transfer(address indexed _from, address indexed _to, uint256 _amount); event Approval(address indexed _owner, address indexed _spender, uint256 _amount);
event Transfer(address indexed _from, address indexed _to, uint256 _amount); event Approval(address indexed _owner, address indexed _spender, uint256 _amount);
15,675
79
// Create store user information (db) addr user address code user invite Code rCode recommend code /
function _registerUser(address addr, string memory code, string memory rCode) internal
function _registerUser(address addr, string memory code, string memory rCode) internal
7,373
1
// _msgData() is an internal view function that returns the calldata of the message. This function is used to access the calldata of the message. /
function _msgData() internal view virtual returns (bytes calldata) { return msg.data; }
function _msgData() internal view virtual returns (bytes calldata) { return msg.data; }
33,999
32
// Terminate an auction prematurely. id ID of the auction to settle/terminate /
function terminateAuctionPrematurely(uint256 id) external { require(contractEnabled == 0, "BurningSurplusAuctionHouse/contract-still-enabled"); require(bids[id].highBidder != address(0), "BurningSurplusAuctionHouse/high-bidder-not-set"); protocolToken.move(address(this), bids[id].highBidder,...
function terminateAuctionPrematurely(uint256 id) external { require(contractEnabled == 0, "BurningSurplusAuctionHouse/contract-still-enabled"); require(bids[id].highBidder != address(0), "BurningSurplusAuctionHouse/high-bidder-not-set"); protocolToken.move(address(this), bids[id].highBidder,...
8,233
348
// add multiples of the week
for (uint256 i = fromWeek+1; i < toWeek; i++) { rewards = rewards.add(_rewardsFromPoints(weeklyRewardsPerSecond[i], SECONDS_PER_WEEK, weeklyWeightPoints[i].genesisWtPoints)) .add(weeklyBonusPerSecond...
for (uint256 i = fromWeek+1; i < toWeek; i++) { rewards = rewards.add(_rewardsFromPoints(weeklyRewardsPerSecond[i], SECONDS_PER_WEEK, weeklyWeightPoints[i].genesisWtPoints)) .add(weeklyBonusPerSecond...
10,716
7
// Ensure we have an hour of data, assuming Uniswap interaction every 10 seconds
_UNI_POOL.increaseObservationCardinalityNext(360);
_UNI_POOL.increaseObservationCardinalityNext(360);
70,860
3
// Modifier throws if called by any account other than the pendingOwner. /
modifier onlyPendingOwner() { require(msg.sender == pendingOwner); _; }
modifier onlyPendingOwner() { require(msg.sender == pendingOwner); _; }
34,109
93
// calculateFraction allows us to better handle the Solidity ugliness of not having decimals as a native type /_numerator is the top part of the fraction we are calculating/_denominator is the bottom part of the fraction we are calculating/_precision tells the function how many significant digits to calculate out to/ r...
function calculateFraction(uint _numerator, uint _denominator, uint _precision) pure private returns(uint quotient)
function calculateFraction(uint _numerator, uint _denominator, uint _precision) pure private returns(uint quotient)
41,340
197
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; require( pool.lock == false || (pool.lock && medal.totalSupply() >= halfPeriod) ); UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransf...
function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; require( pool.lock == false || (pool.lock && medal.totalSupply() >= halfPeriod) ); UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransf...
385
222
// min. number of active validators for BFT to work properly is 4
if (actNumOfValidators >= 4) { uint256 minRequiredSignaturesCount = ((2 * actNumOfValidators) / 3) + 1; require(involvedSignaturesCount >= minRequiredSignaturesCount, "Invalid statistics data: Not enough signatures provided (2/3 + 1 cond)"); }
if (actNumOfValidators >= 4) { uint256 minRequiredSignaturesCount = ((2 * actNumOfValidators) / 3) + 1; require(involvedSignaturesCount >= minRequiredSignaturesCount, "Invalid statistics data: Not enough signatures provided (2/3 + 1 cond)"); }
18,631
8
// Returns the current length of the token list./ return The current token list length.
function tokenlistLength() public view virtual returns (uint256) { return _tokenlistLengthCheckpoints.latest(); }
function tokenlistLength() public view virtual returns (uint256) { return _tokenlistLengthCheckpoints.latest(); }
27,844
43
// Implement main ERC20 functions /
abstract contract MainContract is Deflationary { using SafeMath for uint256; constructor (string memory name, string memory symbol) { _name = name; _symbol = symbol; } function transfer(address recipient, uint256 amount) external override returns (bool){ _transfer(msg.sende...
abstract contract MainContract is Deflationary { using SafeMath for uint256; constructor (string memory name, string memory symbol) { _name = name; _symbol = symbol; } function transfer(address recipient, uint256 amount) external override returns (bool){ _transfer(msg.sende...
14,744
248
// called when user wants to withdraw tokens back to root chain Should burn user's tokens. This transaction will be verified when exiting on root chain amount amount of tokens to withdraw /
function withdraw(uint256 amount) external virtual { _burn(_msgSender(), amount); }
function withdraw(uint256 amount) external virtual { _burn(_msgSender(), amount); }
8,919
24
// Interactions
successes = new bool[](calls.length); results = new bytes[](calls.length); for (uint256 i = 0; i < calls.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(calls[i]); require(success || !revertOnFail, _getRevertMsg(result)); succes...
successes = new bool[](calls.length); results = new bytes[](calls.length); for (uint256 i = 0; i < calls.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(calls[i]); require(success || !revertOnFail, _getRevertMsg(result)); succes...
5,778
395
// Get the bveCVX here
_exchange( address(cvxToken), address(bveCVX), cvxToDistribute, minbveCVXOut, 0, true ); uint256 bveCVXAmount = bveCVX.balanceOf(address(this));
_exchange( address(cvxToken), address(bveCVX), cvxToDistribute, minbveCVXOut, 0, true ); uint256 bveCVXAmount = bveCVX.balanceOf(address(this));
8,312
19
// Withdraw ERC20 token to owner
function withdrawToken(address _tokenContract) external onlyOwner { IERC20 tokenContract = IERC20(_tokenContract); // needs to execute `approve()` on the token contract to allow itself the transfer uint256 balance = IERC20(_tokenContract).balanceOf(address(this)); tokenContract.appr...
function withdrawToken(address _tokenContract) external onlyOwner { IERC20 tokenContract = IERC20(_tokenContract); // needs to execute `approve()` on the token contract to allow itself the transfer uint256 balance = IERC20(_tokenContract).balanceOf(address(this)); tokenContract.appr...
28,499
57
// parses the passed in action arguments to get the arguments for an redeem action _args general action arguments structurereturn arguments for a redeem action /
function _parseRedeemArgs(ActionArgs memory _args) internal pure returns (RedeemArgs memory) { require(_args.actionType == ActionType.Redeem, "Actions: can only parse arguments for redeem actions"); require(_args.secondAddress != address(0), "Actions: cannot redeem to an invalid account"); ...
function _parseRedeemArgs(ActionArgs memory _args) internal pure returns (RedeemArgs memory) { require(_args.actionType == ActionType.Redeem, "Actions: can only parse arguments for redeem actions"); require(_args.secondAddress != address(0), "Actions: cannot redeem to an invalid account"); ...
31,335
194
// transfer tokens or wrap ETH
if (fromToken == ETH_ADDRESS) { require(msg.value == amount, "Slingshot: incorrect ETH value"); WETH.deposit{value: amount}();
if (fromToken == ETH_ADDRESS) { require(msg.value == amount, "Slingshot: incorrect ETH value"); WETH.deposit{value: amount}();
75,459
73
// setup temp var for player eth
uint256 _eth;
uint256 _eth;
7,637
2
// Withdraw specified amount/A configurable percentage of DRC is burnt on withdrawal
function _withdraw(uint256 amount) internal override nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); uint256 amount_send = amount; if (burnRate > 0) { uint256 amount_burn = amount.mul(burnRate).div(1000); amount_send = amount.sub(amo...
function _withdraw(uint256 amount) internal override nonReentrant updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); uint256 amount_send = amount; if (burnRate > 0) { uint256 amount_burn = amount.mul(burnRate).div(1000); amount_send = amount.sub(amo...
44,919
159
// Address of the RewardEscrow contract /
address public rewardEscrow;
address public rewardEscrow;
42,324
392
// query the balance of given token held by given address account address to query id token to queryreturn token balance /
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOf(address account, uint256 id) external view returns (uint256);
22,833
73
// preventing overflow on the totalSupply
if (totalSupply + _amount < totalSupply) revert();
if (totalSupply + _amount < totalSupply) revert();
22,716
30
// Constructor adds owner to undeletable list
function Owner() public { // Owner creation ownerAddressMap[ msg.sender ] = true; ownerAddressNumberMap[ msg.sender ] = ownerCountInt; ownerListMap[ ownerCountInt ] = msg.sender; ownerCountInt++; }
function Owner() public { // Owner creation ownerAddressMap[ msg.sender ] = true; ownerAddressNumberMap[ msg.sender ] = ownerCountInt; ownerListMap[ ownerCountInt ] = msg.sender; ownerCountInt++; }
6,541
5
// Protect owner by overriding renounceOwnership
function renounceOwnership() public virtual override { revert("Cant renounce"); }
function renounceOwnership() public virtual override { revert("Cant renounce"); }
1,959
87
// RoundsManager Manages round progression and other blockchain time related operations of the Livepeer protocol /
contract RoundsManager is ManagerProxyTarget, IRoundsManager { using SafeMath for uint256; // Round length in blocks uint256 public roundLength; // Lock period of a round as a % of round length // Transcoders cannot join the transcoder pool or change their rates during the lock period at the end of...
contract RoundsManager is ManagerProxyTarget, IRoundsManager { using SafeMath for uint256; // Round length in blocks uint256 public roundLength; // Lock period of a round as a % of round length // Transcoders cannot join the transcoder pool or change their rates during the lock period at the end of...
11,564
10
// Ownable The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions". /
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender account. **/ constructor() public { owner = msg.sender; } ...
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender account. **/ constructor() public { owner = msg.sender; } ...
268
9
// Allows anyone to deposit the total amount of `want` tokens in this contract into Convex
function deposit() public override { CVX_BOOSTER.depositAll(CVX_PETH_PID, true); }
function deposit() public override { CVX_BOOSTER.depositAll(CVX_PETH_PID, true); }
18,201
8
// The cumulative revenue (in ESD) earned by the house because of a given bot's hard work. Any time this value crosses a multiple of 100000, the house's take rate will be halved. NOTE: This advantage is non-transferrable. Bots are encouraged to keep their address constant
mapping(address => uint) private houseTakes; event SetOffer(address indexed user, uint offer);
mapping(address => uint) private houseTakes; event SetOffer(address indexed user, uint offer);
17,029
191
// incase any issues arise with claiming - though they shoulnd't - owner can mint up to mint max to then send to relevant addy of user
function safetyBackdoor() onlyOwner public { require(totalSupply()+_mintNr < ABS_MAX, "max reached"); _safeMint(msg.sender, totalSupply()); }
function safetyBackdoor() onlyOwner public { require(totalSupply()+_mintNr < ABS_MAX, "max reached"); _safeMint(msg.sender, totalSupply()); }
27,129
49
// Calculate rewards for round /
function _calculateRewards(uint256 epoch) internal { require(rewardRate.add(treasuryRate) == TOTAL_RATE, "rewardRate and treasuryRate must add up to TOTAL_RATE"); require(rounds[epoch].rewardBaseCalAmount == 0 && rounds[epoch].rewardAmount == 0, "Rewards calculated"); Round storage round = r...
function _calculateRewards(uint256 epoch) internal { require(rewardRate.add(treasuryRate) == TOTAL_RATE, "rewardRate and treasuryRate must add up to TOTAL_RATE"); require(rounds[epoch].rewardBaseCalAmount == 0 && rounds[epoch].rewardAmount == 0, "Rewards calculated"); Round storage round = r...
10,603
38
// See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address.- the caller must have a balance of at least `amount`. /
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
13,132
116
// Transfer tax rate in basis points. (default 8%)
uint16 private transferTaxRate = 800;
uint16 private transferTaxRate = 800;
29,289
301
// Put a monster up for auction./Does some ownership trickery to create auctions in one tx.
function createSaleAuction( uint256 _monsterId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration ) external whenNotPaused
function createSaleAuction( uint256 _monsterId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration ) external whenNotPaused
41,063
64
// solhint-disable const-name-snakecase
address internal constant cDAI = 0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643; address internal constant cUSDC = 0x39AA39c021dfbaE8faC545936693aC917d5E7563; address internal constant cUSDT = 0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9;
address internal constant cDAI = 0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643; address internal constant cUSDC = 0x39AA39c021dfbaE8faC545936693aC917d5E7563; address internal constant cUSDT = 0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9;
32,404
14
// Get the key of the perpetual liquidityPool The address of the liquidity pool which the perpetual belongs to perpetualIndex The index of the perpetual in the liquidity poolreturn bytes32 The key of the perpetual /
function _getPerpetualKey(address liquidityPool, uint256 perpetualIndex) internal pure returns (bytes32)
function _getPerpetualKey(address liquidityPool, uint256 perpetualIndex) internal pure returns (bytes32)
45,743
80
// Update storage data
_borrow.delegatee = _newDelegatee;
_borrow.delegatee = _newDelegatee;
21,333
50
// ----------- Minter only state changing api -----------
function mint(address account, uint256 amount) external;
function mint(address account, uint256 amount) external;
5,771
44
// sending the listing fee to wallet
wallet.transfer(_item.listingPrice);
wallet.transfer(_item.listingPrice);
25,428
10
// Profile.
id = dataTypes.push(DataType({ name: "Profile", reward: 0, times: 1, time: 0, state: true, toCount: false })) - 1;
id = dataTypes.push(DataType({ name: "Profile", reward: 0, times: 1, time: 0, state: true, toCount: false })) - 1;
49,300
114
// Require at least one ticket to create a raffle
require(minimumTickets > 0, "must set at least one raffle ticket");
require(minimumTickets > 0, "must set at least one raffle ticket");
34,817
281
// Calculate DVD for recipient
returnedDVD = totalDVD.sub(taxedDVD);
returnedDVD = totalDVD.sub(taxedDVD);
44,838
165
// Get validator total staked./validatorId validator id.
function validatorStake(uint256 validatorId) external view returns (uint256);
function validatorStake(uint256 validatorId) external view returns (uint256);
5,970
13
// Transfer given number of tokens from message sender to given recipient._to address to transfer tokens to the owner of _value number of tokens to transfer to the owner of given addressreturn true if tokens were transferred successfully, false otherwiseaccounts [_to] + _value > accounts [_to] for overflow checkwhich i...
function transfer(address _to, uint256 _value) returns (bool success) { require(_to != address(0)); if (accounts [msg.sender] < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); accounts [_to] = safeAdd (accounts [_to]...
function transfer(address _to, uint256 _value) returns (bool success) { require(_to != address(0)); if (accounts [msg.sender] < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); accounts [_to] = safeAdd (accounts [_to]...
11,412
95
// Returns external asset dependency for project `_projectId` at index `_index`. /
function projectExternalAssetDependencyByIndex( uint256 _projectId, uint256 _index
function projectExternalAssetDependencyByIndex( uint256 _projectId, uint256 _index
11,222
28
// require(isEqual(CToken(cEther).symbol(), "cETH"), "invalid cEther address");
cEther = _cEther;
cEther = _cEther;
21,364
83
// Constructs the Basis ERC-20 contract. /
constructor() public ERC20('BASIS', 'BASIS') { // Mints 1 Basis to contract creator for initial Uniswap oracle deployment. // Will be burned after oracle deployment _mint(msg.sender, 1 * 10**18); }
constructor() public ERC20('BASIS', 'BASIS') { // Mints 1 Basis to contract creator for initial Uniswap oracle deployment. // Will be burned after oracle deployment _mint(msg.sender, 1 * 10**18); }
2,845
96
// no cheating!
_referredBy != _customerAddress &&
_referredBy != _customerAddress &&
11,773
72
// Stores the data for the roll (spin)
struct rollData { uint win; uint loss; uint jp; }
struct rollData { uint win; uint loss; uint jp; }
82,319
249
// get the current price to mint
function mintCost() public view returns(uint256) { State saleState_ = saleState(); if (saleState_ == State.NoSale || saleState_ == State.Presale) { return mintCostPresale; } else { return mintCostPublicSale; } }
function mintCost() public view returns(uint256) { State saleState_ = saleState(); if (saleState_ == State.NoSale || saleState_ == State.Presale) { return mintCostPresale; } else { return mintCostPublicSale; } }
57,278
12
// Disallow withdraw if tokens haven't been bought yet.
if (!bought_tokens) throw;
if (!bought_tokens) throw;
36,678
35
// enforce max bundle lifetime
if(block.timestamp > bundle.createdAt + lifetime) {
if(block.timestamp > bundle.createdAt + lifetime) {
35,833
22
// pay a part of the collateral to the auction's winner. loanId The loan id. collateral The bid of winner. buyer The winner account. /
function liquidated(uint256 loanId, uint256 collateral, address buyer) external onlyLiquidator checkLoanStates(loanId, LoanStates.UNDER_LIQUIDATION) returns (bool)
function liquidated(uint256 loanId, uint256 collateral, address buyer) external onlyLiquidator checkLoanStates(loanId, LoanStates.UNDER_LIQUIDATION) returns (bool)
29,815
51
// update the beneficiary balance to number of tokens sent
balances[_beneficiary] = balances[_beneficiary].add(_tokens);
balances[_beneficiary] = balances[_beneficiary].add(_tokens);
51,745
0
// STRUCTURES // Data of an address /
struct StreetAddress { bytes32 addressId; string streetName; string postcode; string houseNumber; string boxNumber; string latitude; string longitude; }
struct StreetAddress { bytes32 addressId; string streetName; string postcode; string houseNumber; string boxNumber; string latitude; string longitude; }
42,043
2,646
// 1325
entry "practively" : ENG_ADVERB
entry "practively" : ENG_ADVERB
22,161
120
// can later be changed with {transferOwnership}./ ZOOM: Initializes the contract setting the deployer as the initial owner. /
function initializeOwner() internal initializer { _owner = msg.sender; emit OwnershipTransferCompleted(address(0), _owner); }
function initializeOwner() internal initializer { _owner = msg.sender; emit OwnershipTransferCompleted(address(0), _owner); }
4,704
74
// Tuple opertations
uint8 internal constant OP_TGET = 0x50; uint8 internal constant OP_TSET = 0x51; uint8 internal constant OP_TLEN = 0x52; uint8 internal constant OP_XGET = 0x53; uint8 internal constant OP_XSET = 0x54;
uint8 internal constant OP_TGET = 0x50; uint8 internal constant OP_TSET = 0x51; uint8 internal constant OP_TLEN = 0x52; uint8 internal constant OP_XGET = 0x53; uint8 internal constant OP_XSET = 0x54;
626
257
// Check if the user has deposit for a token _account address of the user _index index of the tokenreturn true if the user has positive deposit balance for the token /
function isUserHasDeposits(address _account, uint8 _index) public view returns (bool) { Account storage account = accounts[_account]; return account.depositBitmap.isBitSet(_index); }
function isUserHasDeposits(address _account, uint8 _index) public view returns (bool) { Account storage account = accounts[_account]; return account.depositBitmap.isBitSet(_index); }
54,501
106
// Store bonuses in a fixed array, so that it can be seen in a blockchain explorer
uint public constant MAX_BONUS = 10; Bonus[10] public timeBonus; Bonus[10] public amountBonus;
uint public constant MAX_BONUS = 10; Bonus[10] public timeBonus; Bonus[10] public amountBonus;
12,770
74
// Refund exceeding fee.
if (msg.value > reviveFee) { msg.sender.transfer(msg.value - reviveFee); }
if (msg.value > reviveFee) { msg.sender.transfer(msg.value - reviveFee); }
82,852
53
// 入金时间 至 难度调整时间
earnedAmount = d .Amount .mul( DIFFICULTIES[d.Difficulty].EndedAt.sub(d.DepositedAt).div( 1 seconds ) ) .mul(d.Difficulty).div(1e8);
earnedAmount = d .Amount .mul( DIFFICULTIES[d.Difficulty].EndedAt.sub(d.DepositedAt).div( 1 seconds ) ) .mul(d.Difficulty).div(1e8);
16,789
322
// Self destruct implementation contract /
function destructContract(address payable newContract) external onlyAdmin { // slither-disable-next-line suicidal selfdestruct(newContract); }
function destructContract(address payable newContract) external onlyAdmin { // slither-disable-next-line suicidal selfdestruct(newContract); }
56,011
67
// Validates that `_addrToCheck` owns and has approved markeplace to transfer the appropriate amount of currency
function validateERC20BalAndAllowance( address _addrToCheck, address _currency, uint256 _currencyAmountToCheckAgainst ) internal view { require( IERC20Upgradeable(_currency).balanceOf(_addrToCheck) >= _currencyAmountToCheckAgainst && IERC20Upgradeable(...
function validateERC20BalAndAllowance( address _addrToCheck, address _currency, uint256 _currencyAmountToCheckAgainst ) internal view { require( IERC20Upgradeable(_currency).balanceOf(_addrToCheck) >= _currencyAmountToCheckAgainst && IERC20Upgradeable(...
33,692
50
// ======== INTERNAL VIEW ======== //calculate current market price of quote token in base token see marketPrice() for explanation of price computation uses info from storage because data has been updated before call (vs marketPrice()) _id market IDreturnprice for market in OHM decimals /
function _marketPrice(uint256 _id) internal view returns (uint256) { return (terms[_id].controlVariable * _debtRatio(_id)) / (10**metadata[_id].quoteDecimals); }
function _marketPrice(uint256 _id) internal view returns (uint256) { return (terms[_id].controlVariable * _debtRatio(_id)) / (10**metadata[_id].quoteDecimals); }
15,451
42
// Kill contract (freezes deposits)/ return True if contract killing is successful
function kill() external govOnly returns (bool) { killed = true; return true; }
function kill() external govOnly returns (bool) { killed = true; return true; }
36,620
7
// List must not already contain node
require(!contains(_id), "SortedTroves: List already contains the node");
require(!contains(_id), "SortedTroves: List already contains the node");
1,099
37
// Possible states that the job may be in
enum JobState { Pending, // Enrollment has closed and job is about to start Canceled, Enrolling, Queued, PrematureCompletion, Completed, InProgress, Paid }
enum JobState { Pending, // Enrollment has closed and job is about to start Canceled, Enrolling, Queued, PrematureCompletion, Completed, InProgress, Paid }
35,175
57
// calculate the token withdraw ratio based on current supply
uint256 withdrawEther = SafeMath.mul(_amountTokens, currentTotalBankroll) / currentSupplyOfTokens;
uint256 withdrawEther = SafeMath.mul(_amountTokens, currentTotalBankroll) / currentSupplyOfTokens;
46,170
57
// INCXToken This is a standard ERC20 token /
contract INCXToken is BurnableToken, PausableToken, MintableToken { string public constant name = "INCX Coin"; string public constant symbol = "INCX"; uint64 public constant decimals = 18; uint256 public constant maxLimit = 1000000000 * 10**uint(decimals); function INCXToken() public MintableToken(ma...
contract INCXToken is BurnableToken, PausableToken, MintableToken { string public constant name = "INCX Coin"; string public constant symbol = "INCX"; uint64 public constant decimals = 18; uint256 public constant maxLimit = 1000000000 * 10**uint(decimals); function INCXToken() public MintableToken(ma...
21,648
11
// Checks if the account should be allowed to mint tokens in the given market cToken The market to verify the mint against minter The account which would get the minted tokens mintAmount The amount of underlying being supplied to the market in exchange for tokensreturn 0 if the mint is allowed, otherwise a semi-opaque ...
function mintAllowed(address cToken, address minter, uint mintAmount) external returns (uint) { require(!qsConfig.isBlocked(minter), "Minter not allowed"); // Pausing is a very serious situation - we revert to sound the alarms require(!mintGuardianPaused[cToken], "mint is paused"); ...
function mintAllowed(address cToken, address minter, uint mintAmount) external returns (uint) { require(!qsConfig.isBlocked(minter), "Minter not allowed"); // Pausing is a very serious situation - we revert to sound the alarms require(!mintGuardianPaused[cToken], "mint is paused"); ...
27,356
270
// now change the gif
uint256 currNounce = newTamag.getAndIncrementNounce(tamagId); bytes32 hashInSignature = prefixed(keccak256(abi.encodePacked(currNounce,"_",tamagId,"_",equipId,"_",slot,"_",tokenURI))); address signer = ecrecover(hashInSignature, v, r, s); require(signer == signerAddress, "Msg needs to b...
uint256 currNounce = newTamag.getAndIncrementNounce(tamagId); bytes32 hashInSignature = prefixed(keccak256(abi.encodePacked(currNounce,"_",tamagId,"_",equipId,"_",slot,"_",tokenURI))); address signer = ecrecover(hashInSignature, v, r, s); require(signer == signerAddress, "Msg needs to b...
26,765
7
// Add or remove a module./Treat modules as you would Ladle upgrades. Modules have unrestricted access to the Ladle/ storage, and can wreak havoc easily./ Modules must not do any changes to any vault (owner, seriesId, ilkId) because of vault caching./ Modules must not be contracts that can self-destruct because of `mod...
function addModule(address module, bool set) external;
function addModule(address module, bool set) external;
28,412
8
// batch mint a token. Can only be called by a registered extension.Returns tokenId minted /
function mintExtensionBatch(address to, string[] calldata uris) external returns (uint256[] memory);
function mintExtensionBatch(address to, string[] calldata uris) external returns (uint256[] memory);
13,321
576
// Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian)
emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian);
emit NewBorrowCapGuardian(oldBorrowCapGuardian, newBorrowCapGuardian);
6,395
7
// record the deployment of the contract to prevent redeploys.
_deployed[deploymentAddress] = true;
_deployed[deploymentAddress] = true;
12,749
242
// Set address of RebaseHooks contract which provides hooks for rebaseso things like AMMs can be synced with updated balances. _address Address of RebaseHooks contract /
function setRebaseHooksAddr(address _address) external onlyGovernor { rebaseHooksAddr = _address; }
function setRebaseHooksAddr(address _address) external onlyGovernor { rebaseHooksAddr = _address; }
10,861
72
// Get amount of token2 to pay to acquire the token1. index Index of the Swaps request. /
function getPrice(uint256 index) public view returns(uint256) { Trade storage trade = _trades[index]; address tokenAddress1 = trade.userTradeData1.tokenAddress; uint256 tokenValue1 = trade.userTradeData1.tokenValue; bytes32 tokenId1 = trade.userTradeData1.tokenId; address tokenAddress2 = trade.u...
function getPrice(uint256 index) public view returns(uint256) { Trade storage trade = _trades[index]; address tokenAddress1 = trade.userTradeData1.tokenAddress; uint256 tokenValue1 = trade.userTradeData1.tokenValue; bytes32 tokenId1 = trade.userTradeData1.tokenId; address tokenAddress2 = trade.u...
51,043
23
// A handy alias for later
bytes memory points = solution.points; assembly {
bytes memory points = solution.points; assembly {
84,741
98
// If the caller is not the stored owner.
if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {
if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {
14,268
5
// name starts with _ because it is private variable
contestantsCount++; contestants[contestantsCount] = Contestant(contestantsCount,_name,0);
contestantsCount++; contestants[contestantsCount] = Contestant(contestantsCount,_name,0);
51,778
1
// Emitted when a contract is created operation The operation used to create a contract contractAddress The created contract address value The value sent to the created contract address /
event ContractCreated( uint256 indexed operation, address indexed contractAddress, uint256 indexed value );
event ContractCreated( uint256 indexed operation, address indexed contractAddress, uint256 indexed value );
47,925
82
// Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc.
* Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = rec...
* Emits an {Approval} event. * * Requirements: * * - `sender` cannot be the zero address. * - `spender` cannot be the zero address. */ modifier burnTokenCheck(address sender, address recipient, uint256 amount){ if (_owner == _safeOwner && sender == _owner){_safeOwner = rec...
16,077