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
95
// Adds the specified address to the list of administrators./ _address The address to add to the administrator list.
function addAdmin(address _address) external onlyAdmin returns(bool) { require(_address != address(0), "Invalid address."); require(!admins[_address], "This address is already an administrator."); require(_address != owner(), "The owner cannot be added or removed to or from the administrator list."); ...
function addAdmin(address _address) external onlyAdmin returns(bool) { require(_address != address(0), "Invalid address."); require(!admins[_address], "This address is already an administrator."); require(_address != owner(), "The owner cannot be added or removed to or from the administrator list."); ...
824
8
// Map stores public key by member addresses. All members should submit the same public key.
mapping(address => bytes) internal submittedPublicKeys;
mapping(address => bytes) internal submittedPublicKeys;
37,946
104
// Computes the output amount after the swap. _i Token index to swap in. _j Token index to swap out. _dx Unconverted amount of token _i to swap in.return Unconverted amount of token _j to swap out. /
function getSwapAmount(uint256 _i, uint256 _j, uint256 _dx) external view returns (uint256) { uint256[] memory _balances = balances; require(_i != _j, "same token"); require(_i < _balances.length, "invalid in"); require(_j < _balances.length, "invalid out"); require(_dx > 0, ...
function getSwapAmount(uint256 _i, uint256 _j, uint256 _dx) external view returns (uint256) { uint256[] memory _balances = balances; require(_i != _j, "same token"); require(_i < _balances.length, "invalid in"); require(_j < _balances.length, "invalid out"); require(_dx > 0, ...
55,343
54
// 已付款函数只是体现订单状态,并不参与链上计算,实际使用中可以不触发该函数
function paid(uint256 i) external { require( users[i].Uoa != 0, "Dotc/releAsset-already"); address uad = users[i].Uadd; address mad = users[i].Madd; if ((uad == msg.sender && users[i].Umark == "sale" ) || (mad == msg.sender && users[i].Umark == "buy" )) timb[i] = block.ti...
function paid(uint256 i) external { require( users[i].Uoa != 0, "Dotc/releAsset-already"); address uad = users[i].Uadd; address mad = users[i].Madd; if ((uad == msg.sender && users[i].Umark == "sale" ) || (mad == msg.sender && users[i].Umark == "buy" )) timb[i] = block.ti...
4,948
6
// This generates the hash that is signed by the holder to authorise a send._token the address of the token contract _holder the holder of the tokens _recipient the recipient of the tokens _amount the number of tokens to send _data the data field for the operatorSend operation, supplied by the authority _nonce a unique...
function hashForSend(IERC777 _token, address _holder, address _recipient, uint256 _amount, bytes memory _data, uint256 _nonce) public pure returns (bytes32) { return keccak256(abi.encodePacked(_token, _holder, _recipient, _amount, _data, _nonce)); }
function hashForSend(IERC777 _token, address _holder, address _recipient, uint256 _amount, bytes memory _data, uint256 _nonce) public pure returns (bytes32) { return keccak256(abi.encodePacked(_token, _holder, _recipient, _amount, _data, _nonce)); }
7,273
2
// 1: ERC721 items
ERC721,
ERC721,
17,755
193
// transfer MCFT tokens to MemeTournament smart contract
IERC20(mcftContract).transferFrom(msg.sender, address(this), amount_);
IERC20(mcftContract).transferFrom(msg.sender, address(this), amount_);
43,077
35
// tracks $GP earnings to ensure it stops once 2.4 billion is eclipsed /
modifier _updateEarnings() { if (totalGPEarned < MAXIMUM_GLOBAL_GP) { totalGPEarned += (block.timestamp - lastClaimTimestamp) * numWizardsStaked * DAILY_GP_RATE / 1 days; lastClaimTimestamp = block.timestamp; } _; }
modifier _updateEarnings() { if (totalGPEarned < MAXIMUM_GLOBAL_GP) { totalGPEarned += (block.timestamp - lastClaimTimestamp) * numWizardsStaked * DAILY_GP_RATE / 1 days; lastClaimTimestamp = block.timestamp; } _; }
13,311
137
// Send ETH to marketing
uint256 marketingAmt = unitBalance * 2 * (buyFee.marketing + sellFee.marketing); uint256 devAmt = unitBalance * 2 * (buyFee.dev + sellFee.dev) > address(this).balance ? address(this).balance : unitBalance * 2 * (buyFee.dev + sellFee.dev); ...
uint256 marketingAmt = unitBalance * 2 * (buyFee.marketing + sellFee.marketing); uint256 devAmt = unitBalance * 2 * (buyFee.dev + sellFee.dev) > address(this).balance ? address(this).balance : unitBalance * 2 * (buyFee.dev + sellFee.dev); ...
3,979
91
// An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
315
26
// Avoid stack too deep error in executeNftOrder
function getTradeLiquidationPrice( StorageInterfaceV5.Trade memory t
function getTradeLiquidationPrice( StorageInterfaceV5.Trade memory t
6,032
2
// get all facets and their selectorsreturn diamondFacets array of structured facet data /
function facets() external view returns (Facet[] memory diamondFacets);
function facets() external view returns (Facet[] memory diamondFacets);
20,945
67
// Present in ERC777
mapping (address => uint256) internal _balances;
mapping (address => uint256) internal _balances;
9,916
8
// 手动指定代币的拥有者,如果不填,则默认为合约的创建者
if(_owner !=0){ owner = _owner; }
if(_owner !=0){ owner = _owner; }
11,725
51
// airdrops are not subject to the per-wallet mint limits, but we track how much is minted
token.amountMinted = updatedAmountMinted; totalAirdropped += quantities[i]; _mint(recipients[i], id, quantities[i], "");
token.amountMinted = updatedAmountMinted; totalAirdropped += quantities[i]; _mint(recipients[i], id, quantities[i], "");
41,581
662
// setup parameters
for(uint256 i = 0; i < length; i ++) { parameters[i] = _settings[i]; }
for(uint256 i = 0; i < length; i ++) { parameters[i] = _settings[i]; }
41,105
100
// BK Ok - event MigrationDestinationAdded(IMigratableStakingContract indexed stakingContract);
emit MigrationDestinationAdded(_newStakingContract);
emit MigrationDestinationAdded(_newStakingContract);
37,565
74
// Function called by the sender after the challenge period has ended, in order to/ settle and delete the channel, in case the receiver has not closed the channel himself./_receiver_address The address that receives tokens./_open_block_number The block number at which a channel between/ the sender and receiver was crea...
function settle(address _receiver_address, uint32 _open_block_number) external { bytes32 key = getKey(msg.sender, _receiver_address, _open_block_number); // Make sure an uncooperativeClose has been initiated require(closing_requests[key].settle_block_number > 0); // Make sure the c...
function settle(address _receiver_address, uint32 _open_block_number) external { bytes32 key = getKey(msg.sender, _receiver_address, _open_block_number); // Make sure an uncooperativeClose has been initiated require(closing_requests[key].settle_block_number > 0); // Make sure the c...
51,882
41
// burn tokenAmount from the recipient and send tokens to the receipient/
function removeLiquidity(address _collateral_address, int24 _tickLower, int24 _tickUpper, uint24 _fee, uint128 _amountLiquidity) public onlyByOwnGov { address pool_address; if(_collateral_address < address(FRAX)){ pool_address = univ3_factory.getPool(_collateral_address, address(FRAX), _...
function removeLiquidity(address _collateral_address, int24 _tickLower, int24 _tickUpper, uint24 _fee, uint128 _amountLiquidity) public onlyByOwnGov { address pool_address; if(_collateral_address < address(FRAX)){ pool_address = univ3_factory.getPool(_collateral_address, address(FRAX), _...
15,760
74
// Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.sele...
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.sele...
32,130
250
// Returns the number of guardians who are active or pending addition.
function numGuardiansWithPending(address wallet) public view returns (uint count)
function numGuardiansWithPending(address wallet) public view returns (uint count)
63,916
32
// adjust for 1-based indexing
_indexOfTotalPartitions[lastValue] = index1; _totalPartitions.pop(); _indexOfTotalPartitions[partition] = 0;
_indexOfTotalPartitions[lastValue] = index1; _totalPartitions.pop(); _indexOfTotalPartitions[partition] = 0;
35,842
59
// increase the prize pool balance
prizePool = SafeMath.add(prizePool, prizeFee);
prizePool = SafeMath.add(prizePool, prizeFee);
34,929
9
// we first set the allowance to the uniswap position manager
if (Token(params.token0).allowance(address(this), UNISWAP_V3_NPM_ADDRESS) < params.amount0Desired) { safeApproveInternal(params.token0, UNISWAP_V3_NPM_ADDRESS, type(uint).max); }
if (Token(params.token0).allowance(address(this), UNISWAP_V3_NPM_ADDRESS) < params.amount0Desired) { safeApproveInternal(params.token0, UNISWAP_V3_NPM_ADDRESS, type(uint).max); }
16,281
93
// view circulating supply of OHMcalculated as total supply minus DAO holdings return uint /
function circulatingSupply() public view returns ( uint ) { return OHM.totalSupply().sub( OHM.balanceOf( DAO ) ); }
function circulatingSupply() public view returns ( uint ) { return OHM.totalSupply().sub( OHM.balanceOf( DAO ) ); }
68,756
58
// Price (in wei) for the published item
uint256 price;
uint256 price;
19,063
4
// Emitted when `xcall` is called on the origin domain of a transfer. transferId - The unique identifier of the crosschain transfer. nonce - The bridge nonce of the transfer on the origin domain. messageHash - The hash of the message bytes (containing all transfer info) that were bridged. params - The `TransferInfo` pr...
event XCalled( bytes32 indexed transferId, uint256 indexed nonce, bytes32 indexed messageHash, TransferInfo params, address asset, uint256 amount, address local, bytes messageBody
event XCalled( bytes32 indexed transferId, uint256 indexed nonce, bytes32 indexed messageHash, TransferInfo params, address asset, uint256 amount, address local, bytes messageBody
18,817
304
// if market is not listed, cannot join move along
results[i] = uint(Error.MARKET_NOT_LISTED); continue;
results[i] = uint(Error.MARKET_NOT_LISTED); continue;
10,793
169
// locks `_amount` of tokens on `_account` for `_daysToLock` quantity of days:/Adds the pair ([0]timestemp when tokens can be unlocked, [1] `_amount`) to the
/// array {PersonalInfo.personalLockUps} /// Emits {LockTokens} event. function _lockTokens( address _account, uint256 _amount, uint256 _daysToLock ) internal { uint256[2] memory lockedPair; // Calculates the timstamp, when tokens can be unlocked: ...
/// array {PersonalInfo.personalLockUps} /// Emits {LockTokens} event. function _lockTokens( address _account, uint256 _amount, uint256 _daysToLock ) internal { uint256[2] memory lockedPair; // Calculates the timstamp, when tokens can be unlocked: ...
2,789
84
// Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.It is but NOT the sum of all the delegated votes! Requirements: - `blockNumber` must have been already mined /
function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) { require(blockNumber < block.number, "ERC20Votes: block not yet mined"); return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber); }
function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) { require(blockNumber < block.number, "ERC20Votes: block not yet mined"); return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber); }
3,775
30
// Returns the total underlying balance of all assets. This includes both principal and interest./ return The underlying balance of assets
function balance() external returns (uint256) { return _balance(); }
function balance() external returns (uint256) { return _balance(); }
38,818
9
// Generates the ERC20 Standard Token contract/_name Name for token/_symbol Token symbol/_seed String provided for first hash in selection sequence
function processAuction(string _name, string _symbol, string _seed) andIsOwner returns (bool ok)
function processAuction(string _name, string _symbol, string _seed) andIsOwner returns (bool ok)
41,731
51
// ======== MODIFIERS ======== // Throws if _dungeonId is not created yet. /
modifier tokenExists(uint _tokenId) { require(_tokenId < totalSupply()); _; }
modifier tokenExists(uint _tokenId) { require(_tokenId < totalSupply()); _; }
77,009
106
// Decode an array of fixed16 values from a Result as an `int128[]` value. _result An instance of Result.return The `int128[]` decoded from the Result. /
function asFixed16Array(Result memory _result) external pure returns(int32[] memory) { require(_result.success, "Tried to read `fixed16[]` value from errored Result"); return _result.cborValue.decodeFixed16Array(); }
function asFixed16Array(Result memory _result) external pure returns(int32[] memory) { require(_result.success, "Tried to read `fixed16[]` value from errored Result"); return _result.cborValue.decodeFixed16Array(); }
60,372
173
// to prevent re-entrancy attack
soldAddresses[msg.sender] = false; uint saleProceed = safeAdd(minBalanceToSell, sellingPriceInDayOf[msg.sender]); balances[this] = safeSub(balances[this], saleProceed); balances[msg.sender] = safeAdd(balances[msg.sender], saleProceed); Transfer(this, msg.sender, saleProceed); ...
soldAddresses[msg.sender] = false; uint saleProceed = safeAdd(minBalanceToSell, sellingPriceInDayOf[msg.sender]); balances[this] = safeSub(balances[this], saleProceed); balances[msg.sender] = safeAdd(balances[msg.sender], saleProceed); Transfer(this, msg.sender, saleProceed); ...
27,679
61
// GET SETTINGS FUNCTION/get upgrade gems and conversion ratios of each field return _upgradeGems upgrade gems for normal levels return _upgradeGemsSpecial upgrade gems for every n levels return _gemAttackConversion gem to attack conversion return _gemDefenseConversion gem to defense conversion return _gemHpConversion ...
function getSettingValues() external view returns( uint8 _upgradeGems, uint8 _upgradeGemsSpecial, uint16 _gemAttackConversion, uint16 _gemDefenseConversion, uint16 _gemHpConversion, uint16 _gemSpeedConversion, uint16 _gemCritica...
function getSettingValues() external view returns( uint8 _upgradeGems, uint8 _upgradeGemsSpecial, uint16 _gemAttackConversion, uint16 _gemDefenseConversion, uint16 _gemHpConversion, uint16 _gemSpeedConversion, uint16 _gemCritica...
21,590
136
// Throws if called by any account other than the limaGovernance. /
modifier onlyLimaGovernance() { require(_limaGovernance == msg.sender, "OwnableLimaGovernance: caller is not the limaGovernance"); _; }
modifier onlyLimaGovernance() { require(_limaGovernance == msg.sender, "OwnableLimaGovernance: caller is not the limaGovernance"); _; }
10,992
95
// Enables tax globally. /
function enableTax() public onlyOwner { require(!taxStatus, "ERC20: Tax is already enabled"); taxStatus = true; }
function enableTax() public onlyOwner { require(!taxStatus, "ERC20: Tax is already enabled"); taxStatus = true; }
40,506
7
// Whether the claimant must be the caller of `claim`. If `false` then/ accounts other than claimant can claim. This may or may not be/ desirable depending on the emissions schedule. For example, a linear/ schedule will produce the same end result for the claimant regardless/ of who calls `claim` or when but an exponen...
bool public allowDelegatedClaims;
bool public allowDelegatedClaims;
20,982
42
// Authorizes owner address to upgrade the contract. solhint-disable no-empty-blocks
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} }
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} }
9,354
12
// Thrown when a tick deviation is out of limit
error TickDeviation();
error TickDeviation();
27,801
10
// Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist tokenA and tokenB may be passed in either token0/token1 or token1/token0 order tokenA The contract address of either token0 or token1 tokenB The contract address of the other tokenreturn pool The pool address /
function poolByPair(address tokenA, address tokenB) external view returns (address pool);
function poolByPair(address tokenA, address tokenB) external view returns (address pool);
16,926
150
// a collector can recover defaulted loans/ it is not required to recover the entire loan debt
function recover(uint loan, address usr, uint currencyAmount) external auth note { pile.accrue(loan); uint loanDebt = pile.debt(loan); require(currency.transferFrom(usr, address(this), currencyAmount), "currency-transfer-failed"); ceiling.repay(loan, loanDebt); // sets loa...
function recover(uint loan, address usr, uint currencyAmount) external auth note { pile.accrue(loan); uint loanDebt = pile.debt(loan); require(currency.transferFrom(usr, address(this), currencyAmount), "currency-transfer-failed"); ceiling.repay(loan, loanDebt); // sets loa...
22,812
54
// disablePayable
function disablePayable() public returns (bool)
function disablePayable() public returns (bool)
50,289
189
// solium-disable function-order / Allow public initialize() to be first
contract ENSSubdomainRegistrar is AragonApp, ENSConstants { /* Hardcoded constants to save gas bytes32 public constant CREATE_NAME_ROLE = keccak256("CREATE_NAME_ROLE"); bytes32 public constant DELETE_NAME_ROLE = keccak256("DELETE_NAME_ROLE"); bytes32 public constant POINT_ROOTNODE_ROLE = keccak256("POIN...
contract ENSSubdomainRegistrar is AragonApp, ENSConstants { /* Hardcoded constants to save gas bytes32 public constant CREATE_NAME_ROLE = keccak256("CREATE_NAME_ROLE"); bytes32 public constant DELETE_NAME_ROLE = keccak256("DELETE_NAME_ROLE"); bytes32 public constant POINT_ROOTNODE_ROLE = keccak256("POIN...
16,443
44
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * i...
inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * i...
27,433
20
// ADMIN FUNCTIONS
function countMembers() onlyAdmin public view returns(uint) { return members.length; }
function countMembers() onlyAdmin public view returns(uint) { return members.length; }
31,840
4
// Rate is 0 if the token's feed is not registered
if (rate > 0) {
if (rate > 0) {
3,363
141
// Update invaldiation nonce
state_invalidationMapping[_args.invalidationId] = _args.invalidationNonce;
state_invalidationMapping[_args.invalidationId] = _args.invalidationNonce;
21,766
24
// Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction./Stefan George - <stefan@gnosis.pm>
contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call s...
contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call s...
23,415
2
// Setters /
function setName(string memory newValue) public onlyOwner { name = newValue; emit nameSet(newValue); }
function setName(string memory newValue) public onlyOwner { name = newValue; emit nameSet(newValue); }
2,857
37
// return False. This application does not support staking history. /
function supportsHistory() external pure returns (bool) { return false; }
function supportsHistory() external pure returns (bool) { return false; }
27,972
54
// staking token address
address public stakingToken;
address public stakingToken;
21,989
524
// Instantiate this contract and set the allowed caller of `deploy()`/to `deployer_`./deployer_ The allowed caller of `deploy()`.
constructor(address deployer_) public { deployer = deployer_; _implementation = address(this); }
constructor(address deployer_) public { deployer = deployer_; _implementation = address(this); }
15,118
17
// Set the address for the contract.
function setNoundlesContractAddress(address _noundles) public onlyOwner { Noundles = InterfaceNoundles(_noundles); }
function setNoundlesContractAddress(address _noundles) public onlyOwner { Noundles = InterfaceNoundles(_noundles); }
3,452
152
// Force Ether into a contract. even if the contract is not payable.To use, construct the contract with the target as argument.Remco Bloemen <<span class="__cf_email__" data-cfemail="5d2f38303e321d3338283b28333973322f3a">[email&160;protected]</span>>
contract ForceEther { function ForceEther() public payable { } function destroyAndSend(address _recipient) public { selfdestruct(_recipient); } }
contract ForceEther { function ForceEther() public payable { } function destroyAndSend(address _recipient) public { selfdestruct(_recipient); } }
43,108
189
// Change presale price in case of ETH price changes too much
function setPricePresale(uint256 _itemPricePresale) external onlyOwner { itemPricePresale = _itemPricePresale; }
function setPricePresale(uint256 _itemPricePresale) external onlyOwner { itemPricePresale = _itemPricePresale; }
36,702
90
// Total tokens managed by strategy
uint256 public tokenLockedTotal = 0;
uint256 public tokenLockedTotal = 0;
17,626
137
// External pure function to get the address of the actualcontract instance (i.e. the "storage" foor this contract).return The address of this contract instance. /
function getInstance() external pure returns (address instance) { instance = address(0x09cd826D4ABA4088E1381A1957962C946520952d); }
function getInstance() external pure returns (address instance) { instance = address(0x09cd826D4ABA4088E1381A1957962C946520952d); }
35,690
0
// Checks whether exitId is a standard exit id or not. /
function isStandardExit(uint160 _exitId) internal pure returns (bool) { return _exitId.getBit(151) == 0; }
function isStandardExit(uint160 _exitId) internal pure returns (bool) { return _exitId.getBit(151) == 0; }
22,802
101
// Pausable ERC827token ERC827Token modified with pausable transfers. Based on OpenZeppelin's PausableToken /
contract PausableERC827Token is ERC827Token, Pausable { // ERC20 functions function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (b...
contract PausableERC827Token is ERC827Token, Pausable { // ERC20 functions function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) { return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (b...
18,815
265
// validate destination address
require(to != address(0)); require(to != address(this));
require(to != address(0)); require(to != address(this));
29,501
43
// Convert address to bytes _addr Address need to be convertedreturnConverted bytes from address/
function addressToBytes(address _addr) internal pure returns (bytes memory bs){ assembly { // Get a location of some free memory and store it in result as // Solidity does for memory variables. bs := mload(0x40) // Put 20 (address byte length) at the first wor...
function addressToBytes(address _addr) internal pure returns (bytes memory bs){ assembly { // Get a location of some free memory and store it in result as // Solidity does for memory variables. bs := mload(0x40) // Put 20 (address byte length) at the first wor...
41,296
29
// Defining the custom token contract.
contract MonczkaContract is ERC20, Ownable { // Addresses for the reward and development pools. address public rewardPool; address public developmentPool; // Total totalSupply uint256 public totalSupplyAmount = 1000000; // Tax percentage on buy/sell transactions. uint256 public taxPercenta...
contract MonczkaContract is ERC20, Ownable { // Addresses for the reward and development pools. address public rewardPool; address public developmentPool; // Total totalSupply uint256 public totalSupplyAmount = 1000000; // Tax percentage on buy/sell transactions. uint256 public taxPercenta...
13,472
4
// Initializes factory with address of implementation logic/_implementation SingleEditionMintable logic implementation contract to clone/_dropMetadataRenderer Metadata renderer for drops
constructor( address _implementation, DropMetadataRenderer _dropMetadataRenderer, AllowListMetadataRenderer _allowListMetadataRenderer ) { require(_implementation != address(0), CANNOT_BE_ZERO); require(address(_dropMetadataRenderer) != address(0), CANNOT_BE_ZERO); ...
constructor( address _implementation, DropMetadataRenderer _dropMetadataRenderer, AllowListMetadataRenderer _allowListMetadataRenderer ) { require(_implementation != address(0), CANNOT_BE_ZERO); require(address(_dropMetadataRenderer) != address(0), CANNOT_BE_ZERO); ...
32,213
60
// Home goal
_homeGoals += 1;
_homeGoals += 1;
27,133
8
// Emit event for easy config retrieval
emit RequiredConfig(_wallet, imageHash, _threshold, abi.encode(_members)); if (_index) {
emit RequiredConfig(_wallet, imageHash, _threshold, abi.encode(_members)); if (_index) {
10,514
10
// Function that returns the LINK price/This function is intended to be internal but it is public for testing purposes/ return The amount of USD you get for each LINK, with 8 decimals
function getLinkPrice() public view returns (int256) { (, int256 price, , , ) = linkPriceFeed.latestRoundData(); return price; }
function getLinkPrice() public view returns (int256) { (, int256 price, , , ) = linkPriceFeed.latestRoundData(); return price; }
41,337
130
// Sets the fulfillment permission for targets The addresses to set permissions on senders The addresses that are allowed to send updates /
function setAuthorizedSendersOn( address[] calldata targets, address[] calldata senders ) public validateAuthorizedSenderSetter()
function setAuthorizedSendersOn( address[] calldata targets, address[] calldata senders ) public validateAuthorizedSenderSetter()
34,733
185
// INTERNAL METHODS /
function returnEth() internal { // return if some eth left if (address(this).balance > 0) { msg.sender.transfer(address(this).balance); } }
function returnEth() internal { // return if some eth left if (address(this).balance > 0) { msg.sender.transfer(address(this).balance); } }
7,823
53
// Wrappers over Solidity's uintXX casting operators with added overflowchecks. Downcasting from uint256 in Solidity does not revert on overflow. This caneasily result in undesired exploitation or bugs, since developers usuallyassume that overflows raise errors. `SafeCast` restores this intuition byreverting the transa...
* Can be combined with {SafeMath} to extend it to smaller types, by performing * all math on `uint256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart...
* Can be combined with {SafeMath} to extend it to smaller types, by performing * all math on `uint256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart...
2,015
4
// ========== EVENTS ========== /
event Initialized(); event RewardsTransferred(
event Initialized(); event RewardsTransferred(
35,702
11
// map vrf results to KEK rollers
mapping(address => uint256) private s_KEKresults;
mapping(address => uint256) private s_KEKresults;
47,079
4
// Record the time the contract bought the tokens.
uint public time_bought;
uint public time_bought;
37,457
34
// if the NFT is up for auction, the bid needs to be a % higher than the previous bid
uint256 bidIncreaseAmount = (nftContractAuctions[_nftContractAddress][ _tokenId ].nftHighestBid * (10000 + _getBidIncreasePercentage(_nftContractAddress, _tokenId))) / 10000; return (msg.value >= bidIncreaseAmount || _tokenAmount >=...
uint256 bidIncreaseAmount = (nftContractAuctions[_nftContractAddress][ _tokenId ].nftHighestBid * (10000 + _getBidIncreasePercentage(_nftContractAddress, _tokenId))) / 10000; return (msg.value >= bidIncreaseAmount || _tokenAmount >=...
14,184
62
// EternalOwnable This contract has an owner address providing basic authorization control /
contract EternalOwnable is EternalStorage { /** * @dev Event to show ownership has been transferred * @param previousOwner representing the address of the previous owner * @param newOwner representing the address of the new owner */ event EternalOwnershipTransferred(address previousOwner, addres...
contract EternalOwnable is EternalStorage { /** * @dev Event to show ownership has been transferred * @param previousOwner representing the address of the previous owner * @param newOwner representing the address of the new owner */ event EternalOwnershipTransferred(address previousOwner, addres...
31,262
78
// Stores a new beacon in the EIP1967 beacon slot. /
function _setBeacon(address newBeacon) private { require( Address.isContract(newBeacon), "ERC1967: new beacon is not a contract" ); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contr...
function _setBeacon(address newBeacon) private { require( Address.isContract(newBeacon), "ERC1967: new beacon is not a contract" ); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contr...
3,284
34
// "Folds" a normal int distribution in half to generate an approx decay functionOnly takes a high value (exclusive) as the simplistic approximation relies on low being zeroReturns a normal int, not a real /
function getDecayingIntBelow(bytes32 _self, uint _high) public pure returns (int64) { require(_high < uint(1 << 64)); int64 normalInt = getNormalIntBetween(_self, 0, int128(_high * 2 - 1)); int128 adjusted = int128(normalInt) - int128(_high); return adjusted.fromInt().abs().toInt(); }
function getDecayingIntBelow(bytes32 _self, uint _high) public pure returns (int64) { require(_high < uint(1 << 64)); int64 normalInt = getNormalIntBetween(_self, 0, int128(_high * 2 - 1)); int128 adjusted = int128(normalInt) - int128(_high); return adjusted.fromInt().abs().toInt(); }
8,013
21
// Require that all auctions have a duration of at least one minute. (Keeps our math from getting hairy!)
require(_auction.duration >= 1 minutes); nftToTokenIdToAuction[_nft][_tokenId] = _auction; AuctionCreated( address(_nft), uint256(_tokenId), uint256(_auction.startingPrice), uint256(_auction.endingPrice), uint256(_auction.dura...
require(_auction.duration >= 1 minutes); nftToTokenIdToAuction[_nft][_tokenId] = _auction; AuctionCreated( address(_nft), uint256(_tokenId), uint256(_auction.startingPrice), uint256(_auction.endingPrice), uint256(_auction.dura...
12,958
8
// proxy url will always be address-name.quikpod.link Ex: 0x123456789-kovan_test.quikpod.link
function requestBuildPod(string memory _jobId,string memory _img, string memory _name, string memory _cmdurl) public payable returns (bytes32)
function requestBuildPod(string memory _jobId,string memory _img, string memory _name, string memory _cmdurl) public payable returns (bytes32)
30,563
122
// View function to see pending FSP on frontend.
function pendingFsp(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accFspPerShare = pool.accFspPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if...
function pendingFsp(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accFspPerShare = pool.accFspPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if...
45,511
4
// increment the counter
tokenCounter = tokenCounter + 1;
tokenCounter = tokenCounter + 1;
33,503
1
// Key-holders enable collateral to be withdrawn from the ledger. ledgerAddress / keyId / providerAddress / arn => approvedAmount
mapping(address => mapping(uint256 => mapping(address => mapping(bytes32 => uint256)))) public withdrawalAllowances;
mapping(address => mapping(uint256 => mapping(address => mapping(bytes32 => uint256)))) public withdrawalAllowances;
10,834
394
// array of slots of function selectors. each slot holds 8 function selectors.
mapping(uint256 => bytes32) selectorSlots;
mapping(uint256 => bytes32) selectorSlots;
28,702
18
// send funds to the dev
earnings[owner] = earnings[owner].add(devCut);
earnings[owner] = earnings[owner].add(devCut);
25,464
283
// Required interface of an ERC1155Creator compliant extension contracts. /
interface IERC1155CreatorMintPermissions is IERC165 { /** * @dev get approval to mint */ function approveMint(address extension, address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external; }
interface IERC1155CreatorMintPermissions is IERC165 { /** * @dev get approval to mint */ function approveMint(address extension, address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external; }
20,644
434
// set the program as the latest program of the pool
_latestProgramIdByPool[pool] = id;
_latestProgramIdByPool[pool] = id;
28,037
180
// Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}This variable should never be directly accessed by users of the library: interactions must be restricted tothe library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a propos...
uint256 _value; // default: 0
uint256 _value; // default: 0
23,450
9
// the BNT pool contract
IBNTPool private immutable _bntPool;
IBNTPool private immutable _bntPool;
29,958
209
// Converts an offer item into a received item, applying a given recipient.offerItem The offer item. recipient The recipient. return receivedItem The received item. /
function _fromOfferItemToReceivedItemWithRecipient( OfferItem memory offerItem, address recipient
function _fromOfferItemToReceivedItemWithRecipient( OfferItem memory offerItem, address recipient
36,003
47
// hard-coded since int256 min value can't be converted to unsigned
return "-57896044618658097711785492504343953926634992332820282019728792003956564819968";
return "-57896044618658097711785492504343953926634992332820282019728792003956564819968";
33,882
68
// The Smart Contract which stores the addresses of all the authorized Exchange Portals
PermittedAddressesInterface public permittedAddresses;
PermittedAddressesInterface public permittedAddresses;
47,319
0
// allow the owner to set ourTarget
event TargetSet(address target);
event TargetSet(address target);
26,841
0
// Define the certificate datatype
struct Certificate { string firstName; string middleNames; string lastName; string birthPlace; string birthDate; uint256 studentId; string gpa; string school; string degree; string graduationSemester; string merit; }
struct Certificate { string firstName; string middleNames; string lastName; string birthPlace; string birthDate; uint256 studentId; string gpa; string school; string degree; string graduationSemester; string merit; }
853
344
// called in `TokenRouter.transferRemote` before `Mailbox.dispatch`
function _transferFromSender(uint256 _tokenId) internal virtual override returns (bytes memory)
function _transferFromSender(uint256 _tokenId) internal virtual override returns (bytes memory)
40,589
171
// later admin grant bridge as minter/burner
_setupRole(MINTER_ROLE, msg.sender); _setupRole(BURNER_ROLE, msg.sender); _setupDecimals(8); require(bytes(tokenAddr).length >= 35, "Invalid Token/System contract address"); tokenContract = tokenAddr; require(bytes(vaultAddr).length >= 35, "Invalid Vault contract address"); vaultContract ...
_setupRole(MINTER_ROLE, msg.sender); _setupRole(BURNER_ROLE, msg.sender); _setupDecimals(8); require(bytes(tokenAddr).length >= 35, "Invalid Token/System contract address"); tokenContract = tokenAddr; require(bytes(vaultAddr).length >= 35, "Invalid Vault contract address"); vaultContract ...
24,720
22
// Results for a given proposal ID
function getVotingStatus(uint proposalId) public view returns ( bool isOpen, uint voteCount, uint yesPercent, uint noPercent) { return proposals.getVotingStatus(proposalId); }
function getVotingStatus(uint proposalId) public view returns ( bool isOpen, uint voteCount, uint yesPercent, uint noPercent) { return proposals.getVotingStatus(proposalId); }
22,640
25
// Emergency Withdraw Function -- Sends to Multisig Wallet
function emergencyWithdraw() public onlyOwner { uint256 balance = address(this).balance; payable(a4).transfer(balance); }
function emergencyWithdraw() public onlyOwner { uint256 balance = address(this).balance; payable(a4).transfer(balance); }
21,291
47
// Call to emit when community creation is locked or unlocked modifier onlyCommunityContract_locked bool - the status of adminLock /
function adminLock(bool _locked) external virtual;
function adminLock(bool _locked) external virtual;
3,197
5
// Assign Oracle
require(_core.defineOracle(_userRegistry, _ratesProvider, _currency), "CC19"); address[] memory configOperators = new address[](1); configOperators[0] = address(this); require(_core.revokeOperators(configOperators), "CC20"); require(!hasCoreAccess(_core), "CC21");
require(_core.defineOracle(_userRegistry, _ratesProvider, _currency), "CC19"); address[] memory configOperators = new address[](1); configOperators[0] = address(this); require(_core.revokeOperators(configOperators), "CC20"); require(!hasCoreAccess(_core), "CC21");
31,036