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
0
// Pool Errors. /
interface IPoolErrors { /**************************/ /*** Common Pool Errors ***/ /**************************/ /** * @notice `LP` allowance is already set by the owner. */ error AllowanceAlreadySet(); /** * @notice The action cannot be executed on an active auction. */ ...
interface IPoolErrors { /**************************/ /*** Common Pool Errors ***/ /**************************/ /** * @notice `LP` allowance is already set by the owner. */ error AllowanceAlreadySet(); /** * @notice The action cannot be executed on an active auction. */ ...
39,848
224
// Token symbol
string public constant symbol = "KODA";
string public constant symbol = "KODA";
51,028
940
// list of stakers for all contracts
mapping(address => address[]) public contractStakers;
mapping(address => address[]) public contractStakers;
29,442
18
// Reclaim tokens if accidentally sent /
function reclaimToken(IERC20 token) public onlyOwner { require(address(token) != address(0)); uint256 balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); }
function reclaimToken(IERC20 token) public onlyOwner { require(address(token) != address(0)); uint256 balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); }
50,288
36
// Set the array of NFTs to reward. _contractAddresses Addresse of NFT contract _modelIds Model id of the NFT. If the NFT doesn't have a model, the value is uint256.max _pricesInEth Price in ETH. This arrays is expected to be sorted in ascending order, and to contain no repeated elements. /
function setRewardNfts( address[] memory _contractAddresses, uint256[] memory _modelIds, uint256[] memory _pricesInEth
function setRewardNfts( address[] memory _contractAddresses, uint256[] memory _modelIds, uint256[] memory _pricesInEth
61,032
65
// It is a StandardToken ERC20 token and inherits all of that It has the Property structure and holds the Properties It governs the regulators (moderators, admins, root, Property DApps and PixelProperty) It has getters and setts for all data storage It selectively allows access to PXL and Properties based on caller acc...
contract PXLProperty is StandardToken { /* ERC-20 MetaData */ string public constant name = "PixelPropertyToken"; string public constant symbol = "PXL"; uint256 public constant decimals = 0; /* Access Level Constants */ uint8 constant LEVEL_1_MODERATOR = 1; // 1: Level 1 Moderator - nsfw...
contract PXLProperty is StandardToken { /* ERC-20 MetaData */ string public constant name = "PixelPropertyToken"; string public constant symbol = "PXL"; uint256 public constant decimals = 0; /* Access Level Constants */ uint8 constant LEVEL_1_MODERATOR = 1; // 1: Level 1 Moderator - nsfw...
26,708
137
// EIP712 Domain Separator // EIP2612 Permit nonces // EIP3009 Authorization States /
{ SeizableBridgeERC20.initialize(owner, processor); processor.register(name, symbol, decimals); _trustedIntermediaries = trustedIntermediaries; emit TrustedIntermediariesChanged(trustedIntermediaries); _upgradeToV2(); }
{ SeizableBridgeERC20.initialize(owner, processor); processor.register(name, symbol, decimals); _trustedIntermediaries = trustedIntermediaries; emit TrustedIntermediariesChanged(trustedIntermediaries); _upgradeToV2(); }
78,851
9
// Pausable Base contract which allows children to implement an emergency stop mechanism. /
contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } ...
contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } ...
14,361
7
// Copy revert reason from call
assembly { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) }
assembly { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) }
12,186
53
// ========== Internal Functions ========== /
function _convert(address token0, address token1) internal { // Interactions // S1 - S4: OK IRipPair pair = IRipPair(factory.getPair(token0, token1)); require(address(pair) != address(0), "RipMakerV2: Invalid pair"); // balanceOf: S1 - S4: OK // transfer: X1 - X5: OK ...
function _convert(address token0, address token1) internal { // Interactions // S1 - S4: OK IRipPair pair = IRipPair(factory.getPair(token0, token1)); require(address(pair) != address(0), "RipMakerV2: Invalid pair"); // balanceOf: S1 - S4: OK // transfer: X1 - X5: OK ...
26,975
3
// this modifier will stop the function if emergency breaker is switched on
modifier stop_if_emergency() { if(!stopped) _; }
modifier stop_if_emergency() { if(!stopped) _; }
35,018
110
// PAID Token Control /
function controlPAIDTokens() public view returns (bool) { address sender = _msgSender(); uint256 tier = whitelist[sender].tier; return _paidToken.balanceOf(sender) >= tiers[tier].paidAmount; }
function controlPAIDTokens() public view returns (bool) { address sender = _msgSender(); uint256 tier = whitelist[sender].tier; return _paidToken.balanceOf(sender) >= tiers[tier].paidAmount; }
61,292
150
// lib/openzeppelin-contracts/src/token/ERC721/ERC721Metadata.sol/ pragma solidity ^0.5.0; // import "../../GSN/Context.sol"; // import "./ERC721.sol"; // import "./IERC721Metadata.sol"; // import "../../introspection/ERC165.sol"; /
contract ERC721Metadata is Context, ERC165, ERC721, IERC721Metadata { // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /* * bytes4(keccak256('name()')) == 0x06fdde03 ...
contract ERC721Metadata is Context, ERC165, ERC721, IERC721Metadata { // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /* * bytes4(keccak256('name()')) == 0x06fdde03 ...
32,589
115
// Mapping from tokenId to index of the tokens list
mapping (uint256 => uint256) public tokenIdsIndex;
mapping (uint256 => uint256) public tokenIdsIndex;
41,422
79
// Calculates the new borrower and total borrow balances:newAccountBorrows = accountBorrows + borrowAmountnewTotalBorrows = totalBorrows + borrowAmount
BorrowSnapshot storage borrowSnapshot = accountBorrows[_borrower]; borrowSnapshot.principal = _borrowBalanceInternal(_borrower).add( _borrowAmount ); borrowSnapshot.interestIndex = borrowIndex; totalBorrows = totalBorrows.add(_borrowAmount);
BorrowSnapshot storage borrowSnapshot = accountBorrows[_borrower]; borrowSnapshot.principal = _borrowBalanceInternal(_borrower).add( _borrowAmount ); borrowSnapshot.interestIndex = borrowIndex; totalBorrows = totalBorrows.add(_borrowAmount);
34,490
65
// STC: Sense check
monetaryPolicy = IMonetaryPolicy(data);
monetaryPolicy = IMonetaryPolicy(data);
3,461
110
// e.g. 100e695e16 / 1e6 = 100e18
uint256 minOutCrv = bAssetBal.mul(95e16).div(10 ** bAssetDec); purchased = curve.exchange_underlying(_curvePosition, 0, bAssetBal, minOutCrv);
uint256 minOutCrv = bAssetBal.mul(95e16).div(10 ** bAssetDec); purchased = curve.exchange_underlying(_curvePosition, 0, bAssetBal, minOutCrv);
3,245
8
// Tokens bought by user
mapping(address => uint256) public tokensBoughtOf; mapping(address => bool) public KYCpassed; event AcceptedUSD(address indexed user, uint256 amount); event AcceptedWBTC(address indexed user, uint256 amount); event AcceptedETH(address indexed user, uint256 amount); string constant ERR_TRANSFE...
mapping(address => uint256) public tokensBoughtOf; mapping(address => bool) public KYCpassed; event AcceptedUSD(address indexed user, uint256 amount); event AcceptedWBTC(address indexed user, uint256 amount); event AcceptedETH(address indexed user, uint256 amount); string constant ERR_TRANSFE...
58,133
5
// https:rstormsf.github.io/slides-merkleairdrop14
function verify(bytes32[] memory proof, address who) public pure returns (bool) { bytes32 computedHash = keccak256(abi.encodePacked(who)); for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash < proofElement) { computedHa...
function verify(bytes32[] memory proof, address who) public pure returns (bool) { bytes32 computedHash = keccak256(abi.encodePacked(who)); for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash < proofElement) { computedHa...
21,421
163
// clean up storage to save gas
userLocks[lock.owner].remove(lockId); delete tokenLocks[lockId];
userLocks[lock.owner].remove(lockId); delete tokenLocks[lockId];
29,110
18
// Function to access total supply of tokens .
function totalSupply() public view returns (uint256 _totalSupply) { return totalSupply; }
function totalSupply() public view returns (uint256 _totalSupply) { return totalSupply; }
560
58
// build event data
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
6,899
372
// This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. /
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
11,016
13
// A participant cannot send less than the minimum amount
if (msg.value < MIN_AMOUNT) throw;
if (msg.value < MIN_AMOUNT) throw;
34,440
108
// Note: we can't use "currentEthInvested" for this calculation, we must use:currentEthInvested + ethTowardsICOPriceTokens This is because a split-buy essentially needs to simulate two separate buys - including the currentEthInvested update that comes BEFORE variable price tokens are bought!
uint simulatedEthBeforeInvested = toPowerOfThreeHalves(tokenSupply.div(MULTIPLIER * 1e6)).mul(2).div(3) + ethTowardsICOPriceTokens; uint simulatedEthAfterInvested = simulatedEthBeforeInvested + ethTowardsVariablePriceTokens;
uint simulatedEthBeforeInvested = toPowerOfThreeHalves(tokenSupply.div(MULTIPLIER * 1e6)).mul(2).div(3) + ethTowardsICOPriceTokens; uint simulatedEthAfterInvested = simulatedEthBeforeInvested + ethTowardsVariablePriceTokens;
80,504
6
// slashing parameter settings record the quit request
address[] public quitRequestList;
address[] public quitRequestList;
4,061
7
// Current max bid in ETH
uint256 loanAmount;
uint256 loanAmount;
8,893
85
// SB07Offer /
contract SB07Offer is Ownable, IOffer { uint256 public constant TOKEN_BASE_RATE = 2500; uint256 public constant MIN_TOTAL_TOKEN_SOLD = 32000 * 1 ether; uint256 public constant TOTAL_TOKENS = 32175.09 * 1 ether; address public constant OWNER = 0xe7463F674837F3035a4fBE15Da5D50F5cAC982f4; // If the of...
contract SB07Offer is Ownable, IOffer { uint256 public constant TOKEN_BASE_RATE = 2500; uint256 public constant MIN_TOTAL_TOKEN_SOLD = 32000 * 1 ether; uint256 public constant TOTAL_TOKENS = 32175.09 * 1 ether; address public constant OWNER = 0xe7463F674837F3035a4fBE15Da5D50F5cAC982f4; // If the of...
20,606
109
// Also it's a good time to rebase!
rebase(); emit Harvested(VESPER_WBTC, _wbtc, _fee);
rebase(); emit Harvested(VESPER_WBTC, _wbtc, _fee);
61,364
58
// Ensure this token has not been withdrawn
require(!_escrowBalance.executed, "executed"); require(_escrowBalance.tokenAddress != address(0), "!token"); _escrowBalance.executed = true;
require(!_escrowBalance.executed, "executed"); require(_escrowBalance.tokenAddress != address(0), "!token"); _escrowBalance.executed = true;
78,234
43
// set investors to invested
if(resetType == 0) { usr[usrs[i]].invested = 0; } else {
if(resetType == 0) { usr[usrs[i]].invested = 0; } else {
40,031
22
// Exclude an address from the base minimum price check
function excludeFromPriceCheck(address account) public onlyOwner { _excludedFromPriceCheck[account] = true; }
function excludeFromPriceCheck(address account) public onlyOwner { _excludedFromPriceCheck[account] = true; }
28,523
105
// function to allow owner to claim other modern ERC20 tokens sent to this contract
function transferAnyERC20Token(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out deposit tokens from this vault!"); require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "...
function transferAnyERC20Token(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out deposit tokens from this vault!"); require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "...
40,350
203
// Numerator: 1. val = 1. val := mulmod(val, 1, PRIME). Denominator: point - trace_generator^(16(trace_length / 16 - 1)). val = denominator_invs[4].
val := mulmod(val, mload(0x51a0), PRIME)
val := mulmod(val, mload(0x51a0), PRIME)
17,504
34
// Stop copying when the memory counter reaches the length of the first bytes array.
let end := add(mc, length) for {
let end := add(mc, length) for {
5,144
11
// create new subdomain, temporarily this smartcontract is the owner
registry.setSubnodeOwner(domainNamehash, subdomainLabelhash, address(this));
registry.setSubnodeOwner(domainNamehash, subdomainLabelhash, address(this));
22,306
2
// string mapping to flight
mapping(bytes32 => Flight) private flights; bytes32[] private currentFlights; mapping(address => Airline) private airlines;
mapping(bytes32 => Flight) private flights; bytes32[] private currentFlights; mapping(address => Airline) private airlines;
19,900
10
// get the outboundNonce from this source chain which, consequently, is always an EVM_srcAddress - the source chain contract address
function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);
function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);
2,905
9
// Upgrade the implementation of the proxy. See {ERC1967Utils-upgradeToAndCall}. Requirements: - If `data` is empty, `msg.value` must be zero. /
function _dispatchUpgradeToAndCall() private { (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes)); ERC1967Utils.upgradeToAndCall(newImplementation, data); }
function _dispatchUpgradeToAndCall() private { (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes)); ERC1967Utils.upgradeToAndCall(newImplementation, data); }
636
191
// Returns the staker reward as interest. /
function _calculateInterestAmount(address _property, address _user) private view returns ( uint256 _amount, uint256 _interestPrice, RewardPrices memory _prices )
function _calculateInterestAmount(address _property, address _user) private view returns ( uint256 _amount, uint256 _interestPrice, RewardPrices memory _prices )
10,387
8
// keccack256("BundledSaleApproval(uint8 protocol,address marketplace,uint256 marketplaceFeeNumerator,address privateBuyer,address seller,address tokenAddress,uint256 expiration,uint256 nonce,uint256 masterNonce,address coin,uint256[] tokenIds,uint256[] amounts,uint256[] maxRoyaltyFeeNumerators,uint256[] itemPrices)")
bytes32 public constant BUNDLED_SALE_APPROVAL_HASH = 0x80244acca7a02d7199149a3038653fc8cb10ca984341ec429a626fab631e1662;
bytes32 public constant BUNDLED_SALE_APPROVAL_HASH = 0x80244acca7a02d7199149a3038653fc8cb10ca984341ec429a626fab631e1662;
39,635
20
// Set immutable state variables
_vault = vault; _poolId = poolId; percentFee = _percentFee;
_vault = vault; _poolId = poolId; percentFee = _percentFee;
34,303
97
// wallet.transfer(msg.value);
vault.deposit.value(msg.value)(msg.sender);
vault.deposit.value(msg.value)(msg.sender);
23,102
149
// Returns whether `msgSender` is equal to `approvedAddress` or `owner`. /
function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender
function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender
5,055
34
// See {cancelDefaultAdminTransfer}. Internal function without access restriction. /
function _cancelDefaultAdminTransfer() internal virtual { _setPendingDefaultAdmin(address(0), 0); }
function _cancelDefaultAdminTransfer() internal virtual { _setPendingDefaultAdmin(address(0), 0); }
23,577
14
// ERC20 interface /
contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed ow...
contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed ow...
596
35
// Throws if called by any account other than contract itself or owner./
modifier onlyRelevantSender() { // proxy owner if used through proxy, address(0) otherwise require( !address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)) || // covers usage without calling through storage proxy msg.sender == IUpgradeabilityOwnerStorage(this).u...
modifier onlyRelevantSender() { // proxy owner if used through proxy, address(0) otherwise require( !address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)) || // covers usage without calling through storage proxy msg.sender == IUpgradeabilityOwnerStorage(this).u...
50,366
7
// address of the active staking contracts
address[] public activeContracts; event GasCostSet(uint256 newGasCost); event CollectInterestTimeThresholdSet( uint256 newCollectInterestTimeThreshold ); event InterestMultiplierSet(uint8 newInterestMultiplier); event GasCostExceptInterestCollectSet( uint256 newGasCostExceptInterestCollect );
address[] public activeContracts; event GasCostSet(uint256 newGasCost); event CollectInterestTimeThresholdSet( uint256 newCollectInterestTimeThreshold ); event InterestMultiplierSet(uint8 newInterestMultiplier); event GasCostExceptInterestCollectSet( uint256 newGasCostExceptInterestCollect );
18,525
667
// public inputs
PairingsBn254.Fr memory tmp = PairingsBn254.new_fr(0); PairingsBn254.Fr memory inputs_term = PairingsBn254.new_fr(0);
PairingsBn254.Fr memory tmp = PairingsBn254.new_fr(0); PairingsBn254.Fr memory inputs_term = PairingsBn254.new_fr(0);
78,555
48
// Gets the approved address to take ownership of a given token ID _tokenId uint256 ID of the token to query the approval ofreturn address currently approved to take ownership of the given token ID /
function getApproved(uint256 _tokenId) public view returns (address) { return tokenApprovals[_tokenId]; }
function getApproved(uint256 _tokenId) public view returns (address) { return tokenApprovals[_tokenId]; }
25,110
6
// Function to deposit currency to the contract _duration is in blocks from current
function deposit(address _tokenAddress, uint256 _amount, uint _duration) public returns (bool success) { // Require that user doesn't have any pending balances in this token require(balances[msg.sender][_tokenAddress] == 0, "You can't have two pending pools with the same currency"); // Check that we have allo...
function deposit(address _tokenAddress, uint256 _amount, uint _duration) public returns (bool success) { // Require that user doesn't have any pending balances in this token require(balances[msg.sender][_tokenAddress] == 0, "You can't have two pending pools with the same currency"); // Check that we have allo...
705
23
// Receive function.Implemented entirely in `_fallback`. /
receive () payable external { _fallback(); }
receive () payable external { _fallback(); }
7,457
115
// If the benefactor is found in the set of exchange pools, then it's a buy transactions, otherwise a sell transactions, because the other use cases have already been checked above.
if (_exchangePools.contains(benefactor)) { basisPoints = _getBuyTaxBasisPoints(amount, poolBalance); } else {
if (_exchangePools.contains(benefactor)) { basisPoints = _getBuyTaxBasisPoints(amount, poolBalance); } else {
42,299
6
// Some ERC20 do not allow zero amounts to be sent:
if (yieldAmount == 0) return; uint256 incentiveAmount; uint256 fee = _incentiveRatio; bool isIncentiveToken = (getIncentiveToken() == _asset); if (isIncentiveToken && fee != 0) { incentiveAmount = yieldAmount.percentMul(fee); _sendIncentive(incentiveAmount); }
if (yieldAmount == 0) return; uint256 incentiveAmount; uint256 fee = _incentiveRatio; bool isIncentiveToken = (getIncentiveToken() == _asset); if (isIncentiveToken && fee != 0) { incentiveAmount = yieldAmount.percentMul(fee); _sendIncentive(incentiveAmount); }
9,008
310
// Get Liquidity for Optimizer's balances
uint128 liquidity = pool.liquidityForAmounts(balance0, balance1, tickLower, tickUpper);
uint128 liquidity = pool.liquidityForAmounts(balance0, balance1, tickLower, tickUpper);
4,219
41
// Checks unprefixed signatures
function _isSigned(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s) internal pure returns (bool)
function _isSigned(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s) internal pure returns (bool)
34,549
393
// MasterChef is the master of Olymps. He can make Olymps and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once GEMSTONES is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hope...
contract MasterChef is Referral, ReentrancyGuard { using SafeMath for uint256; using SafeBEP20 for IBEP20; using SafeMath16 for uint16; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward...
contract MasterChef is Referral, ReentrancyGuard { using SafeMath for uint256; using SafeBEP20 for IBEP20; using SafeMath16 for uint16; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward...
3,767
320
// 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. Thiscan later be changed with {transferOwnership}. This module is used through inher...
abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
3,915
8
// The next line will calculate the reward for each staked token in the pool.So when a specific user will claim his rewards,we will basically multiply this var by the amount the user staked.
accumulatedRewardPerShare = accumulatedRewardPerShare.add(totalNewReward.mul(1e12).div(totalStaked)); lastRewardTimestamp = block.timestamp; if (block.timestamp > rewardPeriodEndTimestamp) { rewardPerSecond = 0; }
accumulatedRewardPerShare = accumulatedRewardPerShare.add(totalNewReward.mul(1e12).div(totalStaked)); lastRewardTimestamp = block.timestamp; if (block.timestamp > rewardPeriodEndTimestamp) { rewardPerSecond = 0; }
31,281
30
// Main mapping storing an Election record for each election id.
Election[] Elections;
Election[] Elections;
55,452
6
// _num_valid_blocks > 0
function payFlashbotsMiner(bytes32 _parent_hash, uint256 _num_valid_blocks, uint256 _amount_wei) public payable { for(uint256 i = 0; i < _num_valid_blocks; i++){ if(checkParentHash(_parent_hash, _num_valid_blocks)){ return; } } revert("stale chain"); }
function payFlashbotsMiner(bytes32 _parent_hash, uint256 _num_valid_blocks, uint256 _amount_wei) public payable { for(uint256 i = 0; i < _num_valid_blocks; i++){ if(checkParentHash(_parent_hash, _num_valid_blocks)){ return; } } revert("stale chain"); }
41,766
194
// cannot be a contract
require(isContract(msg.sender) == false); address beneficiary = msg.sender; uint256 weiAmount = msg.value;
require(isContract(msg.sender) == false); address beneficiary = msg.sender; uint256 weiAmount = msg.value;
17,759
22
// Allows an owner to confirm a transaction./transactionId Transaction ID.
function confirmTransaction(uint transactionId) public ownerExists(msg.sender) transactionExists(transactionId) notConfirmed(transactionId, msg.sender)
function confirmTransaction(uint transactionId) public ownerExists(msg.sender) transactionExists(transactionId) notConfirmed(transactionId, msg.sender)
13,752
2
// Team gets 25 and 75 are minted for promo and giveaways
_tokenIdCounter.increment(); promoAddress = 0x48B8cB893429D97F3fECbFe6301bdA1c6936d8d9; mint(promoAddress, 100); whitelistERC721 = [ 0xf1eF40f5aEa5D1501C1B8BCD216CF305764fca40, 0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D, 0x711d2aC13b86BE157795B576dE4bbe6827564111...
_tokenIdCounter.increment(); promoAddress = 0x48B8cB893429D97F3fECbFe6301bdA1c6936d8d9; mint(promoAddress, 100); whitelistERC721 = [ 0xf1eF40f5aEa5D1501C1B8BCD216CF305764fca40, 0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D, 0x711d2aC13b86BE157795B576dE4bbe6827564111...
45,695
1
// stores pushed results
mapping(address => mapping(bytes4 => Result)) private _results;
mapping(address => mapping(bytes4 => Result)) private _results;
18,465
100
// Emits an {Approval} event. Requirements: - `_owner` cannot be the zero address.- `spender` cannot be the zero address. /
function _approve(ShellStorage.Shell storage shell, address _owner, address spender, uint256 amount) private { require(_owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); shell.allowances[_owner][spender] = amo...
function _approve(ShellStorage.Shell storage shell, address _owner, address spender, uint256 amount) private { require(_owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); shell.allowances[_owner][spender] = amo...
23,029
167
// used for owner and pre sale addresses
require( canTransferBeforeTradingIsEnabled[account] != allowed, "JPOPDOGE: Pre trading is already the value of 'excluded'" ); canTransferBeforeTradingIsEnabled[account] = allowed;
require( canTransferBeforeTradingIsEnabled[account] != allowed, "JPOPDOGE: Pre trading is already the value of 'excluded'" ); canTransferBeforeTradingIsEnabled[account] = allowed;
58,855
7
// Mints new tokens. to The address that will receive the minted tokens amount The amount of tokens to mint /
function mint(address to, uint256 amount) public onlyOwner { require( ERC20.totalSupply() + amount <= cap(), "ERC20FlexibleCappedSupply: cap exceeded" ); _mint(to, amount); }
function mint(address to, uint256 amount) public onlyOwner { require( ERC20.totalSupply() + amount <= cap(), "ERC20FlexibleCappedSupply: cap exceeded" ); _mint(to, amount); }
80,165
5
// total rewards
uint256 public totalRewards = 0;
uint256 public totalRewards = 0;
27,210
3
// if (keccak256(abi.encodePacked((ApiStore[_name].name))) == keccak256(abi.encodePacked(("")))) {
ApiInfo api = (new ApiInfo)(_name, _param1, _param2, _cost, oar, _owner);
ApiInfo api = (new ApiInfo)(_name, _param1, _param2, _cost, oar, _owner);
51,943
62
// Make the proposal fail if it is requesting more tokens than the available guild bank balance
if (tokenWhitelist[proposal.paymentToken] && proposal.paymentRequested > userTokenBalances[GUILD][proposal.paymentToken]) { didPass = false; }
if (tokenWhitelist[proposal.paymentToken] && proposal.paymentRequested > userTokenBalances[GUILD][proposal.paymentToken]) { didPass = false; }
40,008
202
// Decrease pendingParsecs by pendingAmountOfParsecs
pendingParsecs = pendingParsecs.sub(pendingAmountOfParsecs);
pendingParsecs = pendingParsecs.sub(pendingAmountOfParsecs);
19,441
6
// Allows transfer adminship of Registry to new adminTransfer associated token and set admin of registry to new admin_registryID uint256 Registry-token ID_newOwner address Address of new admin/
function updateRegistryOwnership( uint256 _registryID, address _newOwner ) public whenNotPaused onlyOwnerOf(_registryID)
function updateRegistryOwnership( uint256 _registryID, address _newOwner ) public whenNotPaused onlyOwnerOf(_registryID)
38,922
39
// Custom verification implementation -Mint signature includes a tokenID and address signed by the backend server /
function _verifySignature( uint256 _tokenId, address _address, bytes memory _signature, address _signer
function _verifySignature( uint256 _tokenId, address _address, bytes memory _signature, address _signer
24,975
116
// Expose internal function that exchanges components for Set tokens,accepting any owner, to system modules _ownerAddress to use tokens from_recipientAddress to issue Set to_setAddress of the Set to issue_quantity Number of tokens to issue /
function issueModule(
function issueModule(
42,538
363
// Always allowed when the smart wallet hasn't been deployed yet
if (!walletAddress.isContract()) { return type(uint).max; }
if (!walletAddress.isContract()) { return type(uint).max; }
54,634
25
// must use type "address payable", to send eth, not just "address"
address payable payableOwner = payable(owner()); payableOwner.transfer(amount);
address payable payableOwner = payable(owner()); payableOwner.transfer(amount);
37,742
80
// Increase house stake by msg.value /
function addHouseStake() public payable onlyOwner { houseStake += msg.value; }
function addHouseStake() public payable onlyOwner { houseStake += msg.value; }
35,204
53
// Make sure input address is clean. (Solidity does not guarantee this)
input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
6,389
43
// Store pendingAdmin with value newPendingAdmin
pendingAdmin = newPendingAdmin;
pendingAdmin = newPendingAdmin;
1,453
40
// Maximum amount of ETH to collect at price 5. /
uint256 internal constant RESERVE_THRESHOLD_5 = 50000 ether;
uint256 internal constant RESERVE_THRESHOLD_5 = 50000 ether;
14,083
22
// Modified allowing execution only if not stopped
modifier stopInEmergency { require(!halted); _; }
modifier stopInEmergency { require(!halted); _; }
30,656
9
// Internal method to remove a subscriber from the list
function _unsubscribe(uint _cdpId) internal { require(subscribers.length > 0, "Must have subscribers in the list"); SubPosition storage subInfo = subscribersPos[_cdpId]; require(subInfo.subscribed, "Must first be subscribed"); uint lastCdpId = subscribers[subscribers.length - 1].c...
function _unsubscribe(uint _cdpId) internal { require(subscribers.length > 0, "Must have subscribers in the list"); SubPosition storage subInfo = subscribersPos[_cdpId]; require(subInfo.subscribed, "Must first be subscribed"); uint lastCdpId = subscribers[subscribers.length - 1].c...
43,299
12
// repatriate
function transferToHomeChain(string memory home_address, string memory data, uint amount, uint reward) external { _burn(msg.sender, amount); emit NewRepatriation(msg.sender, amount, reward, home_address, data); }
function transferToHomeChain(string memory home_address, string memory data, uint amount, uint reward) external { _burn(msg.sender, amount); emit NewRepatriation(msg.sender, amount, reward, home_address, data); }
31,251
129
// purchase
error INSUFFICIENT_ERC20_VALUE(); error INSUFFICIENT_VALUE();
error INSUFFICIENT_ERC20_VALUE(); error INSUFFICIENT_VALUE();
37,732
45
// Reentrancy guard/stop infinite tax sells mainly
inSwap = true; if ( _allowances[address(this)][address(uniswapV2Router)] < tokenAmount ) {
inSwap = true; if ( _allowances[address(this)][address(uniswapV2Router)] < tokenAmount ) {
458
44
// the wallet who has authority to mint a token
address public mintAuthority = 0x66E69Dc02f0B4F8FE80f31417C56e91e22354B1F;
address public mintAuthority = 0x66E69Dc02f0B4F8FE80f31417C56e91e22354B1F;
34,385
30
// I present a struct which takes only 20k gas
struct playerRoll{ uint200 tokenValue; // Token value in uint uint48 blockn; // Block number 48 bits uint8 rollUnder; // Roll under 8 bits }
struct playerRoll{ uint200 tokenValue; // Token value in uint uint48 blockn; // Block number 48 bits uint8 rollUnder; // Roll under 8 bits }
25,156
88
// Joins an array of slices, using `self` as a delimiter, returning a newly allocated string. self The delimiter to use. parts A list of slices to join.return A newly allocated string containing all the slices in `parts`,joined with `self`. /
function join(slice memory self, slice[] memory parts) internal pure returns (string memory) { if (parts.length == 0) return ""; uint length = self._len * (parts.length - 1); for(uint i = 0; i < parts.length; i++) length += parts[i]._len; string memory ret =...
function join(slice memory self, slice[] memory parts) internal pure returns (string memory) { if (parts.length == 0) return ""; uint length = self._len * (parts.length - 1); for(uint i = 0; i < parts.length; i++) length += parts[i]._len; string memory ret =...
11,956
7
// emergency withdraw ERC20, can only call by the owner/ to withdraw tokens that have been sent to this address
function emergencyERC20Drain(IERC20 token, uint256 amount) external onlyOwner { token.safeTransfer(owner(), amount); }
function emergencyERC20Drain(IERC20 token, uint256 amount) external onlyOwner { token.safeTransfer(owner(), amount); }
28,635
12
// Balances for each account
mapping(address => uint256) balances;
mapping(address => uint256) balances;
1,266
329
// Sets the ERC-1155 metadata URI. newURI The new ERC-1155 metadata URI. /
function setURI(string memory newURI) external;
function setURI(string memory newURI) external;
15,080
133
// allocate token for Z88 Lotto Jackpot
super.transfer(lotto645JackpotWallet, LOTTO645_JACKPOT_ALLOCATION); super.transfer(lotto655Jackpot1Wallet, LOTTO655_JACKPOT_1_ALLOCATION); super.transfer(lotto655Jackpot2Wallet, LOTTO655_JACKPOT_2_ALLOCATION);
super.transfer(lotto645JackpotWallet, LOTTO645_JACKPOT_ALLOCATION); super.transfer(lotto655Jackpot1Wallet, LOTTO655_JACKPOT_1_ALLOCATION); super.transfer(lotto655Jackpot2Wallet, LOTTO655_JACKPOT_2_ALLOCATION);
12,982
1
// number of LEAFs that owner receives after deploying contracts
uint256 constant OWNER_LEAFS = 1000000 * (10**18);
uint256 constant OWNER_LEAFS = 1000000 * (10**18);
14,859
42
// https:docs.synthetix.io/contracts/source/interfaces/iflexiblestorage
interface IFlexibleStorage { // Views function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint); function getUIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (uint[] memory); function getIntValue(bytes32 contractName, bytes32 record) ext...
interface IFlexibleStorage { // Views function getUIntValue(bytes32 contractName, bytes32 record) external view returns (uint); function getUIntValues(bytes32 contractName, bytes32[] calldata records) external view returns (uint[] memory); function getIntValue(bytes32 contractName, bytes32 record) ext...
25,055
31
// Maintain balances for each funding key
mapping(uint256 => uint256) public dappBalances;
mapping(uint256 => uint256) public dappBalances;
10,139
5
// Gets the next sqrt price given a delta of token1/Always rounds down, because in the exact output case (decreasing price) we need to move the price at least/ far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the/ price less in order to not send too much output...
function getNextSqrtPriceFromAmount1RoundingDown( uint160 sqrtPX96, uint128 liquidity, uint256 amount, bool add
function getNextSqrtPriceFromAmount1RoundingDown( uint160 sqrtPX96, uint128 liquidity, uint256 amount, bool add
17,764
14
// 管理员列表(管理员权限见上述)
mapping(bytes32 => bool) public administrators; // 管理者地址列表
mapping(bytes32 => bool) public administrators; // 管理者地址列表
43,290
82
// Get rid of the token in the balance list
for (uint d = 0; d < depositedTokens.length; d++) { if (depositedTokens[d] == tokenaddress) { delete depositedTokens[d]; }
for (uint d = 0; d < depositedTokens.length; d++) { if (depositedTokens[d] == tokenaddress) { delete depositedTokens[d]; }
39,481
15
// Min duration for each fee-sharing period (in blocks)
uint256 public immutable MIN_REWARD_DURATION_IN_BLOCKS;
uint256 public immutable MIN_REWARD_DURATION_IN_BLOCKS;
69,970