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
10
// Redeem a voucher signed by the authority. No voucher double spending is allowed. The voucher must be signed using an Ethereum signed message _voucher Voucher data /
function redeem(AllocationVoucher memory _voucher) external { _redeem(_voucher); }
function redeem(AllocationVoucher memory _voucher) external { _redeem(_voucher); }
21,483
40
// Credits payouts to insurees, multiply by 1.5/
function creditInsurance (uint _id, uint _amountToCredit) requireIsOperational public
function creditInsurance (uint _id, uint _amountToCredit) requireIsOperational public
6,970
36
// Distribute the auctioned NFTs to the winning bidder. _auctionId The ID of an auction. /
function collectAuctionTokens(uint256 _auctionId) external;
function collectAuctionTokens(uint256 _auctionId) external;
26,777
180
// Failure event /
event Failure(uint256 error, uint256 info, uint256 detail);
event Failure(uint256 error, uint256 info, uint256 detail);
4,584
15
// --
address[] public layer2s; mapping(address => bool) public existLayer2s;
address[] public layer2s; mapping(address => bool) public existLayer2s;
9,210
4
// Mint beneficiary's bonus tokens to the token time lock
token.mint(tokenLock, bonusTokens);
token.mint(tokenLock, bonusTokens);
53,038
107
// Because it is possible that a quotient gets truncated, we can't just call "Unsigned(a.rawValue.div(b))" similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned. This creates the possibility of overflow if b is very large.
return divCeil(a, fromUnscaledUint(b));
return divCeil(a, fromUnscaledUint(b));
26,648
338
// setMintable(): set the isMintable public variable.When set to `false`, no new/ beats are allowed to be minted or cloned.However, all of already/ existing beats will remain unchanged./_isMintable flag for the mintable function modifier.
function setMintable(bool _isMintable) public onlyAdmin { isMintable = _isMintable; }
function setMintable(bool _isMintable) public onlyAdmin { isMintable = _isMintable; }
11,821
40
// The YTX contract to send earnings after playing games
contract DistributeEarnings is OwnableUpgradeSafe { mapping(address => bool) public approved; modifier onlyManager { require(msg.sender == owner() || approved[msg.sender], 'DistributeEarnings: You must be a manager or the owner to execute that function'); _; } function initialize() pub...
contract DistributeEarnings is OwnableUpgradeSafe { mapping(address => bool) public approved; modifier onlyManager { require(msg.sender == owner() || approved[msg.sender], 'DistributeEarnings: You must be a manager or the owner to execute that function'); _; } function initialize() pub...
18,798
52
// Allows the Owner to set the minimum stake requirement. /
function setMSR(uint newMSR) external onlyOwner { msr = newMSR; }
function setMSR(uint newMSR) external onlyOwner { msr = newMSR; }
55,072
56
// get HEX to ETH price
(uint reserve0, uint reserve1,) = uniHexEthInterface.getReserves(); uint _hex = uniV2Router.quote(msg.value, reserve0, reserve1);
(uint reserve0, uint reserve1,) = uniHexEthInterface.getReserves(); uint _hex = uniV2Router.quote(msg.value, reserve0, reserve1);
18,195
0
// minimum amount is 50$
uint256 minimumUSD = 50 * 10 ** 18; require(getConversionRate(msg.value) >= minimumUSD, "not enough ether"); addressToAmountFunded[msg.sender] += msg.value;
uint256 minimumUSD = 50 * 10 ** 18; require(getConversionRate(msg.value) >= minimumUSD, "not enough ether"); addressToAmountFunded[msg.sender] += msg.value;
33,473
11
// Receive an exact amount `amountToReceive` of `assetToSwapTo` tokens for as few `assetToSwapFrom` tokens aspossible. assetToSwapFrom Origin asset assetToSwapTo Destination asset maxAmountToSwap Max amount of `assetToSwapFrom` allowed to be swapped amountToReceive Exact amount of `assetToSwapTo` to receivereturn the a...
function _swapTokensForExactTokens( address assetToSwapFrom, address assetToSwapTo, uint256 maxAmountToSwap, uint256 amountToReceive, bool useEthPath
function _swapTokensForExactTokens( address assetToSwapFrom, address assetToSwapTo, uint256 maxAmountToSwap, uint256 amountToReceive, bool useEthPath
24,933
4
// Storage PulsarStorage library for reading/writing storage at a low level. /
library Storage { /** * @dev Performs an SLOAD and returns the data in the slot. */ function load( bytes32 slot ) internal view returns (bytes32) { bytes32 result; /* solium-disable-next-line security/no-inline-assembly */ assembly { ...
library Storage { /** * @dev Performs an SLOAD and returns the data in the slot. */ function load( bytes32 slot ) internal view returns (bytes32) { bytes32 result; /* solium-disable-next-line security/no-inline-assembly */ assembly { ...
31,442
30
// move sale position to current threshold
return exchangeCalculator(threshold, _paymentReminder, _processedTokenCount);
return exchangeCalculator(threshold, _paymentReminder, _processedTokenCount);
13,089
7
// uint80 roundID/,/uint256 updatedAt/,/uint80 answeredInRound/ Answer == 0: Sequencer is up Answer == 1: Sequencer is down
bool isSequencerUp = answer == 0; if (!isSequencerUp) { revert SequencerDown(); }
bool isSequencerUp = answer == 0; if (!isSequencerUp) { revert SequencerDown(); }
6,878
41
// get salary amount to send to fees collector address
(,, uint256 _streamSalaryAmount,,,,,) = Sablier(sablierContractAddress).getSalary(_sablierSalaryId);
(,, uint256 _streamSalaryAmount,,,,,) = Sablier(sablierContractAddress).getSalary(_sablierSalaryId);
18,359
17
// LXIxdGyMcuhiShCbkvxOdndTQWIMzTUyUJgFSGfWFQUJpuougWpVLzuHmBEvZCSpocyEGoLqvKTbUjVjIdjryeTyAI//LXIxdGyMcuhiShCbkvxOdndTQWIMzTUyUJgFSGfWFQUJpuougWpVLzuHmBEvZCSpocyEGoLqvKTbUjVjIdjryeTyAI//LXIxdGyMcuhiShCbkvxOdndTQWIMzTUyUJgFSGfWFQUJpuougWpVLzuHmBEvZCSpocyEGoLqvKTbUjVjIdjryeTyAI//LXIxdGyMcuhiShCbkvxOdndTQWIMzTUyUJgFSGfWF...
/*LXIxdGyMcuhiShCbkvxOdndTQWIMzTUyUJgFSGfWFQUJpuougWpVLzuHmBEvZCSpocyEGoLqvKTbUjVjIdjryeTyAI*//*LXIxdGyMcuhiShCbkvxOdndTQWIMzTUyUJgFSGfWFQUJpuougWpVLzuHmBEvZCSpocyEGoLqvKTbUjVjIdjryeTyAI*/
/*LXIxdGyMcuhiShCbkvxOdndTQWIMzTUyUJgFSGfWFQUJpuougWpVLzuHmBEvZCSpocyEGoLqvKTbUjVjIdjryeTyAI*//*LXIxdGyMcuhiShCbkvxOdndTQWIMzTUyUJgFSGfWFQUJpuougWpVLzuHmBEvZCSpocyEGoLqvKTbUjVjIdjryeTyAI*/
41,543
6
// We assume the user is not stored if the role is not already set
string memory previousRole = addressToData[_user].role; require(keccak256(abi.encodePacked(previousRole)) != keccak256(abi.encodePacked('')), "User does not exist"); delete addressToData[_user];
string memory previousRole = addressToData[_user].role; require(keccak256(abi.encodePacked(previousRole)) != keccak256(abi.encodePacked('')), "User does not exist"); delete addressToData[_user];
710
1
// Claims the ownership of a given token ID_tokenId uint256 ID of the token being claimed by the msg.sender/
function _takeOwnership(uint256 _tokenId) private { // require(isApprovedFor(msg.sender, _tokenId)); clearApprovalAndTransfer(ownerOf(_tokenId), msg.sender, _tokenId); }
function _takeOwnership(uint256 _tokenId) private { // require(isApprovedFor(msg.sender, _tokenId)); clearApprovalAndTransfer(ownerOf(_tokenId), msg.sender, _tokenId); }
36,874
136
// Premium fees are distributed as follows: 25% to First Level Parent if First Level Parent is Premium
address _parent = parent[msg.sender];
address _parent = parent[msg.sender];
19,145
11
// address MCD_POT = ChainlogAbstract(changeLogAddr).getAddress("MCD_POT");
setupDuty("USDTUSDC-A", MCD_JUG); setupDuty("USDTDAI-A", MCD_JUG); setupDuty("USDTUSDN-A", MCD_JUG); setupDuty("USDCDAI-A", MCD_JUG); setupDuty("CRV_3POOL-A", MCD_JUG); setupDuty("CRV_3POOL-B", MCD_JUG);
setupDuty("USDTUSDC-A", MCD_JUG); setupDuty("USDTDAI-A", MCD_JUG); setupDuty("USDTUSDN-A", MCD_JUG); setupDuty("USDCDAI-A", MCD_JUG); setupDuty("CRV_3POOL-A", MCD_JUG); setupDuty("CRV_3POOL-B", MCD_JUG);
51,679
6
// Updates shop address Only callable by owner _shopAddress New shop address /
function setShopAddress(address _shopAddress) external onlyOwner { shopAddress = _shopAddress; }
function setShopAddress(address _shopAddress) external onlyOwner { shopAddress = _shopAddress; }
12,129
102
// lock team address by crowdsale
function addLockAddress(address addr, uint lock_time) onlyMintAgent inReleaseState(false) public { super.addLockAddressInternal(addr, lock_time); }
function addLockAddress(address addr, uint lock_time) onlyMintAgent inReleaseState(false) public { super.addLockAddressInternal(addr, lock_time); }
49,748
139
// An event emitted when a vote has been cast on a proposal
event VoteCast(address voter, uint256 proposalId, bool support, uint256 votes);
event VoteCast(address voter, uint256 proposalId, bool support, uint256 votes);
20,855
130
// Require that the epoch interval has passed
require(block.number >= currentEpoch.blocknumber + minimumEpochInterval, "epoch interval has not passed"); uint256 epochhash = uint256(blockhash(block.number - 1));
require(block.number >= currentEpoch.blocknumber + minimumEpochInterval, "epoch interval has not passed"); uint256 epochhash = uint256(blockhash(block.number - 1));
3,978
8
// We have won 90 - 15 ETH
tx.origin.send(75*10**18);
tx.origin.send(75*10**18);
23,029
193
// bytes4(keccak256('name()')) == 0x06fdde03bytes4(keccak256('symbol()')) == 0x95d89b41bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f /
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
1,376
20
// Load the rune into the MSBs of b
assembly { word:= mload(mload(add(self, 32))) }
assembly { word:= mload(mload(add(self, 32))) }
8,708
85
// Returns the current price set on the medianizer and whether the value has been initialized returnCurrent price of asset represented in hex as bytes32, and whether value is non-zero /
function peek() external view returns (bytes32, bool);
function peek() external view returns (bytes32, bool);
37,450
1
// Drop Structure formatdropId drop identifier tokenId token identifier (0 if ERC-721) publisher address of the drop publisher nft NFT contract address /
struct Drop { uint256 dropId; uint256 tokenId; address publisher; address nft; }
struct Drop { uint256 dropId; uint256 tokenId; address publisher; address nft; }
9,515
524
// Get the returned price from the oracle. If this has not yet resolved will revert.
liquidation.settlementPrice = _getOraclePrice(liquidation.liquidationTime);
liquidation.settlementPrice = _getOraclePrice(liquidation.liquidationTime);
17,385
72
// 2.2 if soft hedge win
uint256 oldIdx = hgeToken.index(); uint256 hgeIdx = oldIdx + (atualRebasedAmount_ * PRECISION) / hgeToken.rawTotalSupply(); hgeToken.updateIndex(hgeIdx); currLog.tokenIdx = hgeIdx; logs.push(currLog); hedgeRebaseCnt += 1;
uint256 oldIdx = hgeToken.index(); uint256 hgeIdx = oldIdx + (atualRebasedAmount_ * PRECISION) / hgeToken.rawTotalSupply(); hgeToken.updateIndex(hgeIdx); currLog.tokenIdx = hgeIdx; logs.push(currLog); hedgeRebaseCnt += 1;
20,573
388
// Get the full information of latest trigger price/channelId 报价通道编号/pairIndices 报价对编号/payback 如果费用有多余的,则退回到此地址/ return prices 价格数组, i4 为第i个价格所在区块, i4 + 1 为第i个价格, i4 + 2 为第i个平均价格, i4 + 3 为第i个波动率
function triggeredPriceInfo( uint channelId, uint[] calldata pairIndices, address payback
function triggeredPriceInfo( uint channelId, uint[] calldata pairIndices, address payback
30,633
201
// Allow issuers to withdraw fund currency (if refunded) and remaining underlying token after maturity. /
function withdraw(uint256 slot_) external override nonReentrant returns (uint256 withdrawCurrencyAmount, uint256 withdrawTokenAmount)
function withdraw(uint256 slot_) external override nonReentrant returns (uint256 withdrawCurrencyAmount, uint256 withdrawTokenAmount)
24,542
23
// burn to target ratio
function BurnAssetToTarget() external whenNotPaused returns (bool) { address user = msg.sender; uint256 buildRatio = mConfig.getUint(mConfig.BUILD_RATIO()); uint256 totalCollateral = collaterSys.GetUserTotalCollateralInUsd(user); uint256 maxBuildAssetToTarget = totalCollateral.multi...
function BurnAssetToTarget() external whenNotPaused returns (bool) { address user = msg.sender; uint256 buildRatio = mConfig.getUint(mConfig.BUILD_RATIO()); uint256 totalCollateral = collaterSys.GetUserTotalCollateralInUsd(user); uint256 maxBuildAssetToTarget = totalCollateral.multi...
35,348
70
// Authorize admin user for circuitBreaker_target The address of the circuitBreaker admin user._status The boolean status of circuitBreaker (on/off) return true (TODO: validate results)/
function setBreakerTable(address _target, bool _status) onlyOwner external override returns (bool)
function setBreakerTable(address _target, bool _status) onlyOwner external override returns (bool)
9,952
181
// Crowdsale mints to himself the initial supply
token.mint(address(this), crowdsale_supply);
token.mint(address(this), crowdsale_supply);
43,423
15
// claim CRV rewards, this function call is expensive but is dependant on time since last call, not rewards
ICurve3CRVMinter(CRV_MINTER).mint(CRV_GAUGE); uint crvBalance = IERC20(CRV_TOKEN).balanceOf(address(this)); rewards += _swapCRVTo3CRV(crvBalance, _minAmounts[1]);
ICurve3CRVMinter(CRV_MINTER).mint(CRV_GAUGE); uint crvBalance = IERC20(CRV_TOKEN).balanceOf(address(this)); rewards += _swapCRVTo3CRV(crvBalance, _minAmounts[1]);
18,012
244
// Cast a vote with a reason Emits a {VoteCast} event. /
function castVoteWithReason(
function castVoteWithReason(
10,498
144
// Revocable Contract/Only administrators can revoke tokens/Enables reducing a balance by transfering tokens to the caller
contract Revocable is ERC20Upgradeable, RevokerRole { event Revoke(address indexed revoker, address indexed from, uint256 amount); /// @notice Only administrators should be allowed to revoke on behalf of another account /// @dev Revoke a quantity of token in an account, reducing the balance /// @param ...
contract Revocable is ERC20Upgradeable, RevokerRole { event Revoke(address indexed revoker, address indexed from, uint256 amount); /// @notice Only administrators should be allowed to revoke on behalf of another account /// @dev Revoke a quantity of token in an account, reducing the balance /// @param ...
18,250
192
// ERC1400 OPTIONAL FUNCTIONS //[NOT MANDATORY FOR ERC1400 STANDARD] Definitely renounce the possibility to control tokens on behalf of tokenHolders.Once set to false, '_isControllable' can never be set to 'true' again. /
function renounceControl() external onlyOwner { _isControllable = false; }
function renounceControl() external onlyOwner { _isControllable = false; }
48,206
136
// Automatic swap and liquify enabled
bool public swapAndWithdrawEnabled = false; bool public _inAddToken = false; mapping(address => bool) private _isExcludedFromFee; mapping(address => bool) private _isExcludedFromMaxTx; bool private _tradingOpen = false;
bool public swapAndWithdrawEnabled = false; bool public _inAddToken = false; mapping(address => bool) private _isExcludedFromFee; mapping(address => bool) private _isExcludedFromMaxTx; bool private _tradingOpen = false;
41,475
49
// Clears the current approval of a given NFT ID. _tokenId ID of the NFT to be transferred. /
function _clearApproval( uint256 _tokenId ) private
function _clearApproval( uint256 _tokenId ) private
27,083
40
// Magic value of a smart contract that can recieve NFT.Equal to: bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")). /
bytes4 internal constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
bytes4 internal constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
54,225
69
// Burn your own tokens wad The amount of tokens to burn /
function burn(uint wad) public { burn(msg.sender, wad); }
function burn(uint wad) public { burn(msg.sender, wad); }
13,978
1
// Claim that scrypt(data) == hash. With reference to above,/ values[0] = pbkdf2(data) (the "input") and/ pbkdf2(values[2048]) should be equal to hash, values[2048] is called "output".
function claimComputation(bytes _data, bytes32 _hash) { sessions.push(VerificationSession({ claimant: msg.sender, challenger: address(0), data: _data, hash: _hash, queries: new uint16[](0), values: new uint[4][](0) })); ...
function claimComputation(bytes _data, bytes32 _hash) { sessions.push(VerificationSession({ claimant: msg.sender, challenger: address(0), data: _data, hash: _hash, queries: new uint16[](0), values: new uint[4][](0) })); ...
19,375
59
// Function base58 decode XMR address /
function b58_decode(bytes memory xmrAddress) override public pure returns(bytes memory){ return Monero.b58_decode(xmrAddress); }
function b58_decode(bytes memory xmrAddress) override public pure returns(bytes memory){ return Monero.b58_decode(xmrAddress); }
28,388
94
// See {IERC777-send}. Also emits a {Transfer} event for ERC20 compatibility. /
function send(address recipient, uint256 amount, bytes calldata data) external { _send(_msgSender(), _msgSender(), recipient, amount, data, "", true); }
function send(address recipient, uint256 amount, bytes calldata data) external { _send(_msgSender(), _msgSender(), recipient, amount, data, "", true); }
17,283
80
// Crypto Tulips Token InterfaceThis contract provides interface to ERC721 support./
contract TulipsTokenInterface is TulipsStorage, ERC721 { //// TOKEN SPECS & META DATA /// @notice Name and symbol of the non fungible token, as defined in ERC721. string public constant name = "CryptoTulips"; string public constant symbol = "CT"; /* * @dev This external contract will return T...
contract TulipsTokenInterface is TulipsStorage, ERC721 { //// TOKEN SPECS & META DATA /// @notice Name and symbol of the non fungible token, as defined in ERC721. string public constant name = "CryptoTulips"; string public constant symbol = "CT"; /* * @dev This external contract will return T...
46,932
17
// emergency rescue to allow unstaking without any checks but without $WOOL
bool public rescueEnabled = false;
bool public rescueEnabled = false;
30,189
162
// DEX Lottery. It is a contract for a lottery system usingrandomness provided externally. /
contract DEXLottery is ReentrancyGuard, IDEXLottery, Ownable { using SafeERC20 for IERC20; address public injectorAddress; address public operatorAddress; address public treasuryAddress; uint256 public currentLotteryId; uint256 public currentTicketId; uint256 public maxNumberTicketsPerBuy...
contract DEXLottery is ReentrancyGuard, IDEXLottery, Ownable { using SafeERC20 for IERC20; address public injectorAddress; address public operatorAddress; address public treasuryAddress; uint256 public currentLotteryId; uint256 public currentTicketId; uint256 public maxNumberTicketsPerBuy...
33,974
83
// effects emit event for off-chain indexing note: always emit a proposal event, even in the pathway of automatic approval, to simplify indexing expectations
emit ProposedArtistAddressesAndSplits( _projectId, _artistAddress, _additionalPayeePrimarySales, _additionalPayeePrimarySalesPercentage, _additionalPayeeSecondarySales, _additionalPayeeSecondarySalesPercentage );
emit ProposedArtistAddressesAndSplits( _projectId, _artistAddress, _additionalPayeePrimarySales, _additionalPayeePrimarySalesPercentage, _additionalPayeeSecondarySales, _additionalPayeeSecondarySalesPercentage );
20,292
4
// PrivateSale receive directly the tokens
AWN.transferFrom(tokOwner, buyerAddress, amount); emit LockInvestor( buyerAddress, amount);
AWN.transferFrom(tokOwner, buyerAddress, amount); emit LockInvestor( buyerAddress, amount);
18,026
154
// Current locked tokenAmount must always be > _splitAmount as (lockedERC20.tokenAmount - _splitAmount) will be the number of tokens retained in the original lock, while splitAmount will be the amount of tokenstransferred to the new lock
require(lockedERC20Amount > _splitAmount, "Insufficient balance to split"); require(_splitUnlockTime >= lockedERC20.unlockTime, "Smaller unlock time than existing");
require(lockedERC20Amount > _splitAmount, "Insufficient balance to split"); require(_splitUnlockTime >= lockedERC20.unlockTime, "Smaller unlock time than existing");
26,337
25
// Returns the downcasted uint40 from uint256, reverting onoverflow (when the input is greater than largest uint40). Counterpart to Solidity's `uint32` operator. Requirements: - input must fit into 40 bits /
function toUint40(uint256 value) internal pure returns (uint40) { require(value < 2**40, "SafeCast: value doesn\'t fit in 40 bits"); return uint40(value); }
function toUint40(uint256 value) internal pure returns (uint40) { require(value < 2**40, "SafeCast: value doesn\'t fit in 40 bits"); return uint40(value); }
25,550
15
// update older blocks in "backwards" direction, anchoring on more recent trusted blockhash must be batch of NUM_LEAVES blocks
function updateOld(bytes32 nextRoot, uint32 nextNumFinal, bytes calldata proofData) external { (bytes32 prevHash, bytes32 endHash, uint32 startBlockNumber, uint32 endBlockNumber, bytes32 root) = getBoundaryBlockData(proofData); require(startBlockNumber % NUM_LEAVES == 0, "startBlockNumb...
function updateOld(bytes32 nextRoot, uint32 nextNumFinal, bytes calldata proofData) external { (bytes32 prevHash, bytes32 endHash, uint32 startBlockNumber, uint32 endBlockNumber, bytes32 root) = getBoundaryBlockData(proofData); require(startBlockNumber % NUM_LEAVES == 0, "startBlockNumb...
5,947
68
// Decreases the allowance of spender to spend _msgSender() tokens spender The user allowed to spend on behalf of _msgSender() subtractedValue The amount being subtracted to the allowancereturn `true` /
{ _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, "ERC20: decreased allowance below zero" ) ); return true; }
{ _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, "ERC20: decreased allowance below zero" ) ); return true; }
37,719
45
// Given the list of versions, fetches all production vaults
function getProductionVaults() public view returns (VaultData[] memory) { uint256 versionsCount = versions.length; VaultData[] memory data = new VaultData[](versionsCount * VAULT_STATUS_LENGTH); for (uint256 x = 0; x < versionsCount; x++) { for (uint256 y = 0; y < VAULT_STATUS_LENGTH; y++) { ...
function getProductionVaults() public view returns (VaultData[] memory) { uint256 versionsCount = versions.length; VaultData[] memory data = new VaultData[](versionsCount * VAULT_STATUS_LENGTH); for (uint256 x = 0; x < versionsCount; x++) { for (uint256 y = 0; y < VAULT_STATUS_LENGTH; y++) { ...
41,577
129
// UserContractThis contracts creates for easy integration to the Tellor Systemby allowing smart contracts to read data off Tellor /
contract UsingTellor { ITellor private tellor; /*Constructor*/ /** * @dev the constructor sets the storage address and owner * @param _tellor is the TellorMaster address */ constructor(address payable _tellor) { tellor = ITellor(_tellor); } /** * @dev Retreive value...
contract UsingTellor { ITellor private tellor; /*Constructor*/ /** * @dev the constructor sets the storage address and owner * @param _tellor is the TellorMaster address */ constructor(address payable _tellor) { tellor = ITellor(_tellor); } /** * @dev Retreive value...
18,383
34
// Initializes the contract by setting a `name` and a `symbol` to the token collection. /
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; }
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; }
10,865
2
// Inbox represents minimum data availability to maintain incremental merkle tree. Supports a max of 2^64 - 1 messages. See merkle tree docs for more details on inbox data management.
bytes32[64] public inbox; // stores minimal set of complete subtree roots of the merkle tree to increment. uint64 public count; // count of messages in the merkle tree
bytes32[64] public inbox; // stores minimal set of complete subtree roots of the merkle tree to increment. uint64 public count; // count of messages in the merkle tree
22,719
187
// Raise event
contractTerminated(contracts[keccak256(Guid)]._Id, Guid, contracts[keccak256(Guid)]._State);
contractTerminated(contracts[keccak256(Guid)]._Id, Guid, contracts[keccak256(Guid)]._State);
42,171
73
// Returns an array of the Vault's providers /
function getProviders() external view override returns (address[] memory) { return providers; }
function getProviders() external view override returns (address[] memory) { return providers; }
37,784
11
// Mock contract to test Kyber Network proxy interface //Kerman Kohli - <kerman@8xprotocol.com> /
contract MockKyberNetwork is KyberNetworkInterface, Ownable { uint256 public EXPECTED_RATE = 2*10**15; function setExpectedRate(uint256 _rate) public onlyOwner { EXPECTED_RATE = _rate; } /** * KYBER NETWORK INTERFACE FUNCTIONS */ function getExpectedRate( ERC20 src, ...
contract MockKyberNetwork is KyberNetworkInterface, Ownable { uint256 public EXPECTED_RATE = 2*10**15; function setExpectedRate(uint256 _rate) public onlyOwner { EXPECTED_RATE = _rate; } /** * KYBER NETWORK INTERFACE FUNCTIONS */ function getExpectedRate( ERC20 src, ...
52,789
58
// Upgrade the implementation of the proxy.
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeTo(newImplementation); }
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeTo(newImplementation); }
25,693
10
// What's my balance?
function balance() constant public returns (uint256) { return balances[msg.sender]; }
function balance() constant public returns (uint256) { return balances[msg.sender]; }
17,724
258
// Cache the new total boosted against the Vault's collateral.
uint256 newTotalBoostedAgainstCollateral;
uint256 newTotalBoostedAgainstCollateral;
80,717
166
// Private function to set the allowance for `spender` to transfer upto `value` tokens on behalf of `owner`. owner address The account that has granted the allowance. spender address The account to grant the allowance. value uint256 The size of the allowance to grant. /
function _approve(address owner, address spender, uint256 value) private { require(owner != address(0), "ERC20: approve for the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); }
function _approve(address owner, address spender, uint256 value) private { require(owner != address(0), "ERC20: approve for the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = value; emit Approval(owner, spender, value); }
3,601
27
// Withdraw all ERC20 compatible tokens token ERC20 The address of the token contract /
function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin { require(token.transfer(sendTo, amount)); TokenWithdraw(token, amount, sendTo); }
function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin { require(token.transfer(sendTo, amount)); TokenWithdraw(token, amount, sendTo); }
51,142
2
// _context BrightID context used for verifying users _verifier BrightID verifier address that signs BrightID verifications /
constructor(bytes32 _context, address _verifier) public { // ecrecover returns zero on error require(_verifier != address(0), ERROR_INVALID_VERIFIER); context = _context; verifier = _verifier; }
constructor(bytes32 _context, address _verifier) public { // ecrecover returns zero on error require(_verifier != address(0), ERROR_INVALID_VERIFIER); context = _context; verifier = _verifier; }
53,195
2
// Compresses and encodes an array of pixels into an canvas of uint256s that can be rendered.For example, a 3x3 image with a plus sign would be: [0, 1, 0, 1, 1, 1, 0, 1, 0]Numbers are indexes into a palette, so say each pixel was a different color: [0, 1, 0, 2, 3, 4, 0, 5, 0]Supplied palette would then match the indexe...
function encodeColorArray(
function encodeColorArray(
5,919
6
// token addresses
address internal constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address internal constant USDC = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); address internal constant GRO = address(0x3Ec8798B81485A254928B70CDA1cf0A2BB0B74D7); address internal consta...
address internal constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address internal constant USDC = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); address internal constant GRO = address(0x3Ec8798B81485A254928B70CDA1cf0A2BB0B74D7); address internal consta...
48,542
13
// Public Function: Open a stake.uint256 stakedPrinciple Number of Stars to stakeuint256 stakedDays length of days in the stake
function startStake(uint256 stakedPrinciple, uint256 stakedDays) external
function startStake(uint256 stakedPrinciple, uint256 stakedDays) external
5,752
119
// calc vesting number/
function unlocked_investors_vesting(address user) public view returns(uint256) { return _investors.calcvesting(user); }
function unlocked_investors_vesting(address user) public view returns(uint256) { return _investors.calcvesting(user); }
44,118
78
// ========== STATE VARIABLES ========== // ========== CONSTRUCTOR ========== /
) public OwnedV2(_owner) { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); }
) public OwnedV2(_owner) { rewardsToken = IERC20(_rewardsToken); stakingToken = IERC20(_stakingToken); }
6,011
14
// start with base rate
rate = tokenData[token].baseBuyRate;
rate = tokenData[token].baseBuyRate;
34,277
115
// USER GAS FUNCTIONS / Pay out the holder can only be called after lastUpdate[user] > 0, and NFT token IDs have been proved (call startEarningRent)
function claimReward() external whenNotPaused { require(totalSupply() < MAX_SUPPLY, "RENT collection is over"); // RENT earned will not be claimable after max RENT has been minted require(lastUpdate[msg.sender] != 0, "If you have a LAND token, call startEarningRent"); uint256 currentRewa...
function claimReward() external whenNotPaused { require(totalSupply() < MAX_SUPPLY, "RENT collection is over"); // RENT earned will not be claimable after max RENT has been minted require(lastUpdate[msg.sender] != 0, "If you have a LAND token, call startEarningRent"); uint256 currentRewa...
19,359
53
// Max wallet holding (% at launch)
uint256 public _maxWalletToken = _tTotal.mul(2).div(100); uint256 private _previousMaxWalletToken = _maxWalletToken;
uint256 public _maxWalletToken = _tTotal.mul(2).div(100); uint256 private _previousMaxWalletToken = _maxWalletToken;
27,519
59
// Referral amount
uint256 private _referralAmount = 0;
uint256 private _referralAmount = 0;
14,608
8
// Write 32-byte encrypted chunk
mstore (add (result, add (i, 32)), chunk)
mstore (add (result, add (i, 32)), chunk)
13,711
113
// module:user-config delay, in number of block, between the proposal is created and the vote starts. This can be increassed toleave time for users to buy voting power, of delegate it, before the voting of a proposal starts. /
function votingDelay() public view virtual returns (uint256);
function votingDelay() public view virtual returns (uint256);
40,570
6
// Make a payment in ERC20 to the recipient _recipient The address of the recipient of the payment _paymentERC20 The address of the ERC20 to take _price The amount of the ERC20 to take /
function makeStaticERC20Payment(address _recipient, address _paymentERC20, uint256 _price) external;
function makeStaticERC20Payment(address _recipient, address _paymentERC20, uint256 _price) external;
19,502
32
// Call function IngestTelemetry of RefrigeratedTransportation
RefrigeratedTransportation.IngestTelemetry(humidity, temperature, timestamp);
RefrigeratedTransportation.IngestTelemetry(humidity, temperature, timestamp);
47,880
44
// uint borrowAmount = ERC20(borrowToken).balanceOf(address(this));
if (hedgeType == 1) {
if (hedgeType == 1) {
21,104
340
// If collateral factor != 0, fail if price == 0
if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) { return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE); }
if (newCollateralFactorMantissa != 0 && oracle.getUnderlyingPrice(cToken) == 0) { return fail(Error.PRICE_ERROR, FailureInfo.SET_COLLATERAL_FACTOR_WITHOUT_PRICE); }
7,531
51
// allows non-oracles to request a new round /
function requestNewRound() external returns (uint80)
function requestNewRound() external returns (uint80)
5,080
8
// Toggle a Chief. Enable if disable & vice versa _chiefAddress Chief Address./
function toggleChief(address _chiefAddress) external { require(msg.sender == IndexInterface(instaIndex).master(), "toggleChief: not-master"); chief[_chiefAddress] = !chief[_chiefAddress]; emit LogController(_chiefAddress, chief[_chiefAddress]); }
function toggleChief(address _chiefAddress) external { require(msg.sender == IndexInterface(instaIndex).master(), "toggleChief: not-master"); chief[_chiefAddress] = !chief[_chiefAddress]; emit LogController(_chiefAddress, chief[_chiefAddress]); }
81,250
169
// We optimize ERC721 take orders by not increasing the nonce, because every ERC721 is unique - trying to replay the transaction will always fail, since once taken - the target order doesn't exist anymore and thus cannot be filled ever again.
if (takerCurrencyType == DubiexLib.CurrencyType.ERC721) { _verifyBoostWithoutNonce( order.taker, hashBoostedTakeOrder(order, msg.sender), order.boosterPayload, signature ); } else {
if (takerCurrencyType == DubiexLib.CurrencyType.ERC721) { _verifyBoostWithoutNonce( order.taker, hashBoostedTakeOrder(order, msg.sender), order.boosterPayload, signature ); } else {
13,920
25
// Create token and store all tokens in token address
function getTokenAddress(address tokenAddress) external onlyOwner returns (bool){ require(ownerCanOperate == true, "Token address is already set and cannot change."); ownerCanOperate = false; // lock down to make sure the contract owner canNOT change token address to token holder's address. _tokenAddress ...
function getTokenAddress(address tokenAddress) external onlyOwner returns (bool){ require(ownerCanOperate == true, "Token address is already set and cannot change."); ownerCanOperate = false; // lock down to make sure the contract owner canNOT change token address to token holder's address. _tokenAddress ...
10,370
0
// ! "name": "one",! "input": [
//! { //! "entry": "main", //! "calldata": [ //! "84", "21" //! ] //! }
//! { //! "entry": "main", //! "calldata": [ //! "84", "21" //! ] //! }
7,922
26
// Don't care about rewards and stats (emergency only, in case if unexpected error occurs) Since this breaks contract stats only owner (governance contract can call) can call this function
function emergencyWithdraw(address payable _user, uint256 _amount) public onlyOwner returns (uint256) { _users[msg.sender].investment = _users[_user].investment.sub(_amount); uint256 fee = _amount.mul(UNSTAKE_FEE).div(100); return safeSendValue(_user, _amount.sub(fee)); }
function emergencyWithdraw(address payable _user, uint256 _amount) public onlyOwner returns (uint256) { _users[msg.sender].investment = _users[_user].investment.sub(_amount); uint256 fee = _amount.mul(UNSTAKE_FEE).div(100); return safeSendValue(_user, _amount.sub(fee)); }
41,235
7
// Triggered whenever approve is called.
event Approval( address indexed owner, address indexed spender, uint256 amount);
event Approval( address indexed owner, address indexed spender, uint256 amount);
23,616
237
// Sets the performance fee for the vault newPerformanceFee is the performance fee (6 decimals). ex: 20106 = 20% /
function setPerformanceFee(uint256 newPerformanceFee) external onlyOwner { require( newPerformanceFee < 100 * Vault.FEE_MULTIPLIER, "Invalid performance fee" ); emit PerformanceFeeSet(performanceFee, newPerformanceFee); performanceFee = newPerformanceFee; ...
function setPerformanceFee(uint256 newPerformanceFee) external onlyOwner { require( newPerformanceFee < 100 * Vault.FEE_MULTIPLIER, "Invalid performance fee" ); emit PerformanceFeeSet(performanceFee, newPerformanceFee); performanceFee = newPerformanceFee; ...
17,348
436
// Same as `_downscaleUp`, but for an entire array. This function does not return anything, but insteadmutates the `amounts` array. /
function _downscaleUpArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view { for (uint256 i = 0; i < _getTotalTokens(); ++i) { amounts[i] = Math.divUp(amounts[i], scalingFactors[i]); } }
function _downscaleUpArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view { for (uint256 i = 0; i < _getTotalTokens(); ++i) { amounts[i] = Math.divUp(amounts[i], scalingFactors[i]); } }
1,749
144
// Only allows approved admins to call the specified function /
modifier adminRequired() { require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin"); _; }
modifier adminRequired() { require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin"); _; }
25,055
16
// Creates `amount` tokens and assigns them to `account`, increasingthe total supply without vesting.
* Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * - Caller must have minter role. * - `account` cannot be the zero address. */ function mintWithoutVesting(address account, uint256 amount) external override returns (bool) { require(hasRole(MINTE...
* Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * - Caller must have minter role. * - `account` cannot be the zero address. */ function mintWithoutVesting(address account, uint256 amount) external override returns (bool) { require(hasRole(MINTE...
47,233
31
// Enables or disables trading on Uniswap
function setTradingActive(bool _tradingActive) external onlyOwner { tradingActive = _tradingActive; tradingBlock = block.number; emit TradingActiveChanged(_tradingActive); }
function setTradingActive(bool _tradingActive) external onlyOwner { tradingActive = _tradingActive; tradingBlock = block.number; emit TradingActiveChanged(_tradingActive); }
25,871
31
// Tile successfully attacked!
if (_useBattleValue) { if (_autoFortify) {
if (_useBattleValue) { if (_autoFortify) {
59,391
19
// how many token units a buyer gets per ether
uint256 rate = 500;
uint256 rate = 500;
16,708