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 |
|---|---|---|---|---|
114 | // Returns the URI for a given token ID Reverts if the token ID does not exist. / | function tokenURI(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return string(
abi.encodePacked(
baseURI(),
Strings.fromUint256(tokenId)
)
);
}
| function tokenURI(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return string(
abi.encodePacked(
baseURI(),
Strings.fromUint256(tokenId)
)
);
}
| 17,082 |
118 | // increase no. of boosters bought | numBoostersBought[user] = numBoostersBought[user].add(1);
updateBoostBalanceAndSupply(user, newBoostBalance);
| numBoostersBought[user] = numBoostersBought[user].add(1);
updateBoostBalanceAndSupply(user, newBoostBalance);
| 3,772 |
15 | // for getTokenByIndex below, 0 based index so we do it before incrementing numIdentities | allTokens[numIdentities] = thisToken;
| allTokens[numIdentities] = thisToken;
| 17,532 |
248 | // ========== STRUCTS ========== / Struct for the stake | struct LockedStake {
bytes32 kek_id;
uint256 start_timestamp;
uint256 liquidity;
uint256 ending_timestamp;
uint256 lock_multiplier; // 6 decimals of precision. 1x = 1000000
}
| struct LockedStake {
bytes32 kek_id;
uint256 start_timestamp;
uint256 liquidity;
uint256 ending_timestamp;
uint256 lock_multiplier; // 6 decimals of precision. 1x = 1000000
}
| 17,867 |
0 | // use the mint function to create an NFT | function mint()
public
returns (uint256)
{
_tokenIds += 1;
_mint(msg.sender, _tokenIds);
return _tokenIds;
}
| function mint()
public
returns (uint256)
{
_tokenIds += 1;
_mint(msg.sender, _tokenIds);
return _tokenIds;
}
| 24,942 |
190 | // If an allocator is specified, funds will be sent to the allocator contract along with all properties of this split. | IJBSplitAllocator allocator;
| IJBSplitAllocator allocator;
| 78,589 |
106 | // permit | IPermit(address(stakingToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Staked(msg.sender, amount);
| IPermit(address(stakingToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Staked(msg.sender, amount);
| 21,836 |
35 | // Arguments for calling prepare()invariantData The data for a crosschain transaction that willnot change between sending and receiving chains.The hash of this data is used as the key to store the inforamtion that does change between chains (amount,expiry,preparedBlock) for verificationamount The amount of the transact... | struct PrepareArgs {
InvariantTransactionData invariantData;
uint256 amount;
uint256 expiry;
bytes encryptedCallData;
bytes encodedBid;
bytes bidSignature;
bytes encodedMeta;
}
| struct PrepareArgs {
InvariantTransactionData invariantData;
uint256 amount;
uint256 expiry;
bytes encryptedCallData;
bytes encodedBid;
bytes bidSignature;
bytes encodedMeta;
}
| 52,907 |
246 | // Deposits all USDC held in this contract into the strategy | function deposit() external;
| function deposit() external;
| 62,355 |
118 | // Draws Dai from the CDP/If _daiAmount is bigger than max available we'll draw max/_cdpId Id of the CDP/_ilk Ilk of the CDP/_daiAmount Amount of Dai to draw | function drawDai(uint _cdpId, bytes32 _ilk, uint _daiAmount) internal returns (uint) {
uint rate = Jug(JUG_ADDRESS).drip(_ilk);
uint daiVatBalance = vat.dai(manager.urns(_cdpId));
uint maxAmount = getMaxDebt(_cdpId, _ilk);
if (_daiAmount >= maxAmount) {
_daiAmount = sub... | function drawDai(uint _cdpId, bytes32 _ilk, uint _daiAmount) internal returns (uint) {
uint rate = Jug(JUG_ADDRESS).drip(_ilk);
uint daiVatBalance = vat.dai(manager.urns(_cdpId));
uint maxAmount = getMaxDebt(_cdpId, _ilk);
if (_daiAmount >= maxAmount) {
_daiAmount = sub... | 12,112 |
234 | // Modifier to check whether the value can be stored in a 64 bit uint. | modifier fitsIn64Bits(uint256 _value) {
require (_value == uint256(uint64(_value)));
_;
}
| modifier fitsIn64Bits(uint256 _value) {
require (_value == uint256(uint64(_value)));
_;
}
| 13,373 |
54 | // This function will stop any ongoing passive airdrop / | function stopPassiveAirDropCompletely() public onlyOwner{
passiveAirdropTokensAllocation = 0;
airdropAmount = 0;
airdropClaimedIndex++;
passiveAirdropStatus = false;
}
| function stopPassiveAirDropCompletely() public onlyOwner{
passiveAirdropTokensAllocation = 0;
airdropAmount = 0;
airdropClaimedIndex++;
passiveAirdropStatus = false;
}
| 6,193 |
3 | // Throws if called by any account other than the owner. | modifier onlyOwner() {
if (owner != msg.sender) {
revert Ownable__NotOwner(owner, msg.sender);
}
_;
}
| modifier onlyOwner() {
if (owner != msg.sender) {
revert Ownable__NotOwner(owner, msg.sender);
}
_;
}
| 4,893 |
6 | // Combines 'self' and 'other' into a single array. Returns the concatenated arrays:[self[0], self[1], ... , self[self.length - 1], other[0], other[1], ... , other[other.length - 1]] The length of the new array is 'self.length + other.length' | function concat(bytes memory self, bytes memory other)
internal
pure
returns (bytes memory)
| function concat(bytes memory self, bytes memory other)
internal
pure
returns (bytes memory)
| 33,430 |
139 | // Track total allocations per subgraph Used for rewards calculations | subgraphAllocations[alloc.subgraphDeploymentID] = subgraphAllocations[alloc
.subgraphDeploymentID]
.add(alloc.tokens);
emit AllocationCreated(
_indexer,
_subgraphDeploymentID,
alloc.createdAtEpoch,
alloc.tokens,
_alloca... | subgraphAllocations[alloc.subgraphDeploymentID] = subgraphAllocations[alloc
.subgraphDeploymentID]
.add(alloc.tokens);
emit AllocationCreated(
_indexer,
_subgraphDeploymentID,
alloc.createdAtEpoch,
alloc.tokens,
_alloca... | 20,657 |
537 | // Unlock | int256 amount = _unlockFungible(lockedWallet, lockerWallet, currencyCt, currencyId, lockIndex);
| int256 amount = _unlockFungible(lockedWallet, lockerWallet, currencyCt, currencyId, lockIndex);
| 22,021 |
22 | // Standard ERC20 tokenImplementation of the basic standard token. / | contract StandardToken is ERC20, BasicToken {
uint8 public constant decimals = 18;
uint256 public constant ONE_TOKEN = (10 ** uint256(decimals));
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you ... | contract StandardToken is ERC20, BasicToken {
uint8 public constant decimals = 18;
uint256 public constant ONE_TOKEN = (10 ** uint256(decimals));
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you ... | 1,798 |
125 | // Reverts if the sender is not the oracle of the request.Emits ChainlinkFulfilled event. _requestId The request ID for fulfillment / | modifier recordChainlinkFulfillment(bytes32 _requestId) {
require(msg.sender == pendingRequests[_requestId],
"Source must be the oracle of the request");
delete pendingRequests[_requestId];
emit ChainlinkFulfilled(_requestId);
_;
}
| modifier recordChainlinkFulfillment(bytes32 _requestId) {
require(msg.sender == pendingRequests[_requestId],
"Source must be the oracle of the request");
delete pendingRequests[_requestId];
emit ChainlinkFulfilled(_requestId);
_;
}
| 2,780 |
6 | // Required to allow the artist to administrate the contract on OpenSea.Note if there are many addresses with the DEFAULT_ADMIN_ROLE, the one which is returned may be arbitrary. / | function owner() public view virtual returns (address) {
return _getPrimaryAdmin();
}
| function owner() public view virtual returns (address) {
return _getPrimaryAdmin();
}
| 55,584 |
5 | // Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty. | subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
| subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
| 29,477 |
9 | // Prevent wrapping with itself | function transferFrom(address _from, address _to, uint256 _tokenId) override public {
require(_to != address(this));
return super.transferFrom(_from, _to, _tokenId);
}
| function transferFrom(address _from, address _to, uint256 _tokenId) override public {
require(_to != address(this));
return super.transferFrom(_from, _to, _tokenId);
}
| 34,774 |
26 | // return true if crowdsale event has ended & limit has not been reached | function hasEnded() public view returns (bool) {
bool capReached = weiRaised >= cap;
bool timeLimit = now > endTime;
return capReached || timeLimit;
}
| function hasEnded() public view returns (bool) {
bool capReached = weiRaised >= cap;
bool timeLimit = now > endTime;
return capReached || timeLimit;
}
| 9,293 |
276 | // Address of the Factory that created this contract | address factory_address;
Factory_Interface factory;
address creator;
| address factory_address;
Factory_Interface factory;
address creator;
| 24,020 |
245 | // Withdraw/relock all currently locked tokens where the unlock time has passed | function processExpiredLocks(bool _relock, uint256 _spendRatio, address _withdrawTo) external nonReentrant {
_processExpiredLocks(msg.sender, _relock, _spendRatio, _withdrawTo, msg.sender, 0);
}
| function processExpiredLocks(bool _relock, uint256 _spendRatio, address _withdrawTo) external nonReentrant {
_processExpiredLocks(msg.sender, _relock, _spendRatio, _withdrawTo, msg.sender, 0);
}
| 40,887 |
43 | // Atomically decreases the allowance granted to `spender` by the caller. | * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the... | * This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the... | 31,059 |
13 | // ICO is running | if (now >= firstDiscountStartTime && now <= firstDiscountEndTime){
bonus = 25;
}else if(now >= secDiscountStartTime && now <= secDiscountEndTime){
| if (now >= firstDiscountStartTime && now <= firstDiscountEndTime){
bonus = 25;
}else if(now >= secDiscountStartTime && now <= secDiscountEndTime){
| 65,515 |
57 | // Due date for Payment | uint256 dueDate = debtTakenDay +
uint256(daysTo1stPayment) *
TIMEFRAME +
(uint256(payment) - 1) *
uint256(paymentFreq) *
TIMEFRAME;
uint256 daysLate = (timestamp <= dueDate)
? 0
: (timestamp - dueDate) / TIMEFRAME;
| uint256 dueDate = debtTakenDay +
uint256(daysTo1stPayment) *
TIMEFRAME +
(uint256(payment) - 1) *
uint256(paymentFreq) *
TIMEFRAME;
uint256 daysLate = (timestamp <= dueDate)
? 0
: (timestamp - dueDate) / TIMEFRAME;
| 17,058 |
40 | // User wither gets sent rewards upon contribution or the reward total accumulates and gets claimed | // function claimReward() public nonReentrant {
// uint256 rewardAmount = rewardTokenBalances[msg.sender];
// require(rewardAmount > 0, "No rewards to claim");
// require(rewardAmount <= rewardToken.balanceOf(address(this)),
// "Insufficient reward tokens in the contract"
// ... | // function claimReward() public nonReentrant {
// uint256 rewardAmount = rewardTokenBalances[msg.sender];
// require(rewardAmount > 0, "No rewards to claim");
// require(rewardAmount <= rewardToken.balanceOf(address(this)),
// "Insufficient reward tokens in the contract"
// ... | 1,002 |
37 | // Returns the number of decimals used to get its user representation.For example, if `decimals` equals `2`, a balance of `505` tokens shouldbe displayed to a user as `5,05` (`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship betweenEther and Wei. NOTE: This information is only used for _dis... | * {IBEP20-balanceOf} and {IBEP20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
| * {IBEP20-balanceOf} and {IBEP20-transfer}.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
| 27,151 |
31 | // PRIVILEGED FACTORY FUNCTION. Removes a keeper_keeper Address of the keeper / | function removeKeeper(address _keeper) external override onlyOwner {
require(keeperList[_keeper], 'Keeper is whitelisted');
delete keeperList[_keeper];
}
| function removeKeeper(address _keeper) external override onlyOwner {
require(keeperList[_keeper], 'Keeper is whitelisted');
delete keeperList[_keeper];
}
| 75,534 |
15 | // needs less SY --> swap less PT | approx.guessMax = guess - 1;
| approx.guessMax = guess - 1;
| 24,420 |
4 | // Defines a contract named `HelloWorld`. A contract is a collection of functions and data (its state). Once deployed, a contract resides at a specific address on the Ethereum blockchain. Learn more: https:solidity.readthedocs.io/en/v0.5.10/structure-of-a-contract.html | contract HelloWorld {
// Declares a state variable `message` of type `string`.
// State variables are variables whose values are permanently stored in contract storage.
// The keyword `public` makes variables accessible from outside a contract
// and creates a function that other contracts or clients c... | contract HelloWorld {
// Declares a state variable `message` of type `string`.
// State variables are variables whose values are permanently stored in contract storage.
// The keyword `public` makes variables accessible from outside a contract
// and creates a function that other contracts or clients c... | 13,693 |
174 | // Set the release timestamp | timestampReleased = releaseTimestamp;
| timestampReleased = releaseTimestamp;
| 23,891 |
32 | // bonus token | Bonus memory bonus = pools[_lpToken].bonuses[_poolBonusId];
require(
bonus.bonusTokenAddr == _token,
"BonusRewards: wrong pool"
);
require(
bonus.endTime + WEEK < block.timestamp,
... | Bonus memory bonus = pools[_lpToken].bonuses[_poolBonusId];
require(
bonus.bonusTokenAddr == _token,
"BonusRewards: wrong pool"
);
require(
bonus.endTime + WEEK < block.timestamp,
... | 19,331 |
18 | // internal | function _baseURI() internal view virtual override returns (string memory) {
return _URI;
}
| function _baseURI() internal view virtual override returns (string memory) {
return _URI;
}
| 4,554 |
17 | // Allows for a transfer of tokens to _to"_to": The address to send tokens to"_amount": The amount of tokens to send/ | function transfer(address _to, uint _amount) public returns (bool success) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(msg... | function transfer(address _to, uint _amount) public returns (bool success) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(msg... | 47,298 |
34 | // Address of contract which wraps pool operations: join, exit and swaps. | address private _wrapper;
| address private _wrapper;
| 53,827 |
168 | // ================================== |
addHolder(addr);
emit Transfer(address(this),addr,nateeGot);
emit RedeemWarrat(addr,address(warrant),"NATEE-W1",nateeGot);
|
addHolder(addr);
emit Transfer(address(this),addr,nateeGot);
emit RedeemWarrat(addr,address(warrant),"NATEE-W1",nateeGot);
| 52,311 |
3 | // Updates functions in a transparent contract./If the value of _delegate is zero then the functions specified/in _functionSignatures are removed./If the value of _delegate is a delegate contract address then the functions/specified in _functionSignatures will be delegated to that address./_delegate The address of a de... | function updateContract(address _delegate, string calldata _functionSignatures, string calldata _commitMessage) external;
| function updateContract(address _delegate, string calldata _functionSignatures, string calldata _commitMessage) external;
| 26,867 |
31 | // Holder list. A mapping to 1 indicates, that an address is a holder. | mapping(address => uint8) public holderList;
| mapping(address => uint8) public holderList;
| 23,496 |
5 | // Withdraw method transfers all collected ETH to the treasury wallet. / | function withdraw() external;
| function withdraw() external;
| 21,998 |
147 | // Mint all token collected by second private presale (called reservation),all KYC control are made outside contract under responsability of ParkinGO.Also, updates tokensSold and availableTokens in the crowdsale contract,it checks that sold token are less than reservation contract cap. beneficiaries Array of the reserv... | function mintReservation(address[] beneficiaries, uint256[] balances)
public
onlyOwner
equalLength(beneficiaries, balances)
| function mintReservation(address[] beneficiaries, uint256[] balances)
public
onlyOwner
equalLength(beneficiaries, balances)
| 68,948 |
16 | // The block at which voting begins: holders must delegate their votes prior to this block | uint256 startBlock;
| uint256 startBlock;
| 11,747 |
117 | // An error specific to the Aggregator V3 Interface, to prevent possible confusion around accidentally reading unset values as reported values. | string constant private V3_NO_DATA_ERROR = "No data present";
uint32 private reportingRoundId;
uint32 internal latestRoundId;
mapping(address => OracleStatus) private oracles;
mapping(uint32 => Round) internal rounds;
mapping(uint32 => RoundDetails) internal details;
mapping(address => Requester) interna... | string constant private V3_NO_DATA_ERROR = "No data present";
uint32 private reportingRoundId;
uint32 internal latestRoundId;
mapping(address => OracleStatus) private oracles;
mapping(uint32 => Round) internal rounds;
mapping(uint32 => RoundDetails) internal details;
mapping(address => Requester) interna... | 8,199 |
3 | // Your initial invitation CAT coin is 100% yours. Feel free to sell it, gift it, send to 0x00 Know that if you do any of these things, you will not be reinvited As of 11/11/2018, this is a silly project. If CK doesn't succeed, it will be an utterly meaningless token. If it does succeed however... See you in the Maldiv... |
string public name = "Kitty Club est. 11/11/2018"; // token name
string public symbol = "CAT"; // token symbol
uint256 public decimals = 0; // token digit
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance... |
string public name = "Kitty Club est. 11/11/2018"; // token name
string public symbol = "CAT"; // token symbol
uint256 public decimals = 0; // token digit
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance... | 52,359 |
8 | // the minted tokenId can now be popped from the stack of available ones | availableTokenIds.pop();
return tokenId;
| availableTokenIds.pop();
return tokenId;
| 25,408 |
19 | // ------------------------------------------------------------------------ Transfer Token ------------------------------------------------------------------------ | function transfer(address _to, uint _value) unfreezed(_to) unfreezed(msg.sender) noEmergencyFreeze() public returns (bool success) {
require(_to != 0x0);
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
em... | function transfer(address _to, uint _value) unfreezed(_to) unfreezed(msg.sender) noEmergencyFreeze() public returns (bool success) {
require(_to != 0x0);
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
em... | 10,395 |
10 | // Allows component token implementation to send tokens in the vaul/amount of tokens to payout/tokenAddress the tokens to send/recipient address of payout recipient | function payout(
uint256 amount,
address tokenAddress,
address recipient
| function payout(
uint256 amount,
address tokenAddress,
address recipient
| 21,551 |
70 | // checks if an address is authorized to govern / | function isAuthorizedToGovern(address _toCheck) public view returns (bool) {
return (getLatestAddress("GV") == _toCheck);
}
| function isAuthorizedToGovern(address _toCheck) public view returns (bool) {
return (getLatestAddress("GV") == _toCheck);
}
| 53,945 |
213 | // See comment at the top of this file for explanation of how this function works. NOTE: theoretically possible overflow of (_start + 0x14) | function bytesToUInt160(bytes memory _bytes, uint256 _start) internal pure returns (uint160 r) {
uint256 offset = _start + 0x14;
require(_bytes.length >= offset, "btu20");
assembly {
r := mload(add(_bytes, offset))
}
}
| function bytesToUInt160(bytes memory _bytes, uint256 _start) internal pure returns (uint160 r) {
uint256 offset = _start + 0x14;
require(_bytes.length >= offset, "btu20");
assembly {
r := mload(add(_bytes, offset))
}
}
| 29,784 |
175 | // 9000 estimated total across all generations ((5000+13000)/2) |
string private script;
uint public _tokenIdCounter;
uint public _reservedTokensCounter;
uint public _graftsCounter;
uint public TotalDonationOwed;
uint public minPrice = .01 ether;
|
string private script;
uint public _tokenIdCounter;
uint public _reservedTokensCounter;
uint public _graftsCounter;
uint public TotalDonationOwed;
uint public minPrice = .01 ether;
| 51,280 |
89 | // data from state | Order.NotaryFee=GetUint8(BufPos); BufPos+=8;
CheckBufPos(Buf,BufPos);
| Order.NotaryFee=GetUint8(BufPos); BufPos+=8;
CheckBufPos(Buf,BufPos);
| 45,966 |
0 | // 构造函数,携带msg.value,必须带payable | constructor(uint _number) payable {
tuhao = payable(msg.sender); // 谁创建谁就是土豪
number = _number; // 指定红包数量
}
| constructor(uint _number) payable {
tuhao = payable(msg.sender); // 谁创建谁就是土豪
number = _number; // 指定红包数量
}
| 25,682 |
179 | // Calculates the LMSR cost function C(q_1, ..., q_n) = blog(exp(q_1 / b) + ... + exp(q_n / b)) where q_i = total supply of ith tokenized payoffb = liquidity parameter An equivalent expression for C is used to avoid overflow when calculating exponentials C(q_1, ..., q_n) = m + blog(exp((q_1 - m) / b) + ... + exp((q_n -... | function calcLmsrCost(uint256[] memory quantities, uint256 b) internal pure returns (uint256) {
if (b == 0) {
return 0;
}
uint256 maxQuantity = quantities[0];
for (uint256 i = 1; i < quantities.length; i++) {
maxQuantity = Math.max(maxQuantity, quantities[i])... | function calcLmsrCost(uint256[] memory quantities, uint256 b) internal pure returns (uint256) {
if (b == 0) {
return 0;
}
uint256 maxQuantity = quantities[0];
for (uint256 i = 1; i < quantities.length; i++) {
maxQuantity = Math.max(maxQuantity, quantities[i])... | 1,668 |
1 | // only the deployer of the contract can run this function | function toggleIsMintEnabled() external onlyOwner {
isMintEnabled = !isMintEnabled;
}
| function toggleIsMintEnabled() external onlyOwner {
isMintEnabled = !isMintEnabled;
}
| 17,181 |
242 | // put option | require(lA < option.sP, "price is to high");
| require(lA < option.sP, "price is to high");
| 39,853 |
25 | // get '_account' stakes by page / | function getStakes(address _account, uint _index, uint _offset) external view returns (StakeSet.Item[] memory items) {
uint totalSize = userOrders(_account);
require(0 < totalSize && totalSize > _index, "getStakes: 0 < totalSize && totalSize > _index");
uint offset = _offset;
if (tot... | function getStakes(address _account, uint _index, uint _offset) external view returns (StakeSet.Item[] memory items) {
uint totalSize = userOrders(_account);
require(0 < totalSize && totalSize > _index, "getStakes: 0 < totalSize && totalSize > _index");
uint offset = _offset;
if (tot... | 33,254 |
161 | // VestedERC20/zefram.eth/An ERC20 wrapper token that linearly vests an underlying token to/ its holders | contract VestedERC20 is ERC20Clone {
/// -----------------------------------------------------------------------
/// Library usage
/// -----------------------------------------------------------------------
using SafeTransferLib for ERC20;
/// ------------------------------... | contract VestedERC20 is ERC20Clone {
/// -----------------------------------------------------------------------
/// Library usage
/// -----------------------------------------------------------------------
using SafeTransferLib for ERC20;
/// ------------------------------... | 27,600 |
326 | // if its uppercase A-Z | if (_temp[i] > 0x40 && _temp[i] < 0x5b)
{
| if (_temp[i] > 0x40 && _temp[i] < 0x5b)
{
| 38,278 |
2 | // trainNo is the index of trains array | Train[] public trains;
| Train[] public trains;
| 35,057 |
5 | // MINT DATA/ | uint256 public maxSupplyPermissioned = 1050;
uint256 public boughtPermissioned = 1;
uint256 public pricePermissioned = 0.2 ether;
uint256 public phaseOneStartTime = 1644519600;
uint256 public phaseOneDuration = 1 hours;
uint256 public phaseTwoStartTime = 1644523200;
uint256 public phaseTwoD... | uint256 public maxSupplyPermissioned = 1050;
uint256 public boughtPermissioned = 1;
uint256 public pricePermissioned = 0.2 ether;
uint256 public phaseOneStartTime = 1644519600;
uint256 public phaseOneDuration = 1 hours;
uint256 public phaseTwoStartTime = 1644523200;
uint256 public phaseTwoD... | 74,975 |
12 | // Current treasury balance, scaled | uint128 accruedToTreasury;
| uint128 accruedToTreasury;
| 1,300 |
21 | // 0 - is can do by address? | if(store.isCanDoByAddress(_permissionNameHash, _a)){
return true;
}
| if(store.isCanDoByAddress(_permissionNameHash, _a)){
return true;
}
| 16,758 |
514 | // Gauge tracking | uint256[] private last_gauge_relative_weights;
uint256[] private last_gauge_time_totals;
| uint256[] private last_gauge_relative_weights;
uint256[] private last_gauge_time_totals;
| 37,057 |
79 | // state | orders[_funder].state = eOrderstate.KYC;
kyc.token = kyc.token.add(orders[_funder].reservedToken);
kyc.eth = kyc.eth.add(orders[_funder].paymentEther);
kyc.count = kyc.count.add(1);
CheckOrderstate(_funder, oldState, eOrderstate.KYC);
| orders[_funder].state = eOrderstate.KYC;
kyc.token = kyc.token.add(orders[_funder].reservedToken);
kyc.eth = kyc.eth.add(orders[_funder].paymentEther);
kyc.count = kyc.count.add(1);
CheckOrderstate(_funder, oldState, eOrderstate.KYC);
| 18,587 |
2 | // Emitted when trying to set the contract config when it's already been set. | error ConfigAlreadySet();
| error ConfigAlreadySet();
| 10,415 |
46 | // 4) reduce length of array | allTokens.length -= 1;
| allTokens.length -= 1;
| 20,839 |
19 | // If the claimant's right, the staker loses (claim amount + arbiter fee + griefing fee), so we check they have enough | require((_claimAmount +
stakes[_stakeId].arbiterFee +
stakes[_stakeId].griefingFee) <= stakes[_stakeId].stakeAmount);
_;
| require((_claimAmount +
stakes[_stakeId].arbiterFee +
stakes[_stakeId].griefingFee) <= stakes[_stakeId].stakeAmount);
_;
| 9,301 |
13 | // Quantity of credit accounts | function countCreditAccounts() external view returns (uint256);
| function countCreditAccounts() external view returns (uint256);
| 36,015 |
463 | // - Return superblock submission timestamp | function getNewSuperblockEventTimestamp(bytes32 superblockHash) public view returns (uint) {
return claims[superblockHash].createdAt;
}
| function getNewSuperblockEventTimestamp(bytes32 superblockHash) public view returns (uint) {
return claims[superblockHash].createdAt;
}
| 3,138 |
139 | // Allows the owner to close the crowdsale manually before the end time. / | function closeCrowdsale() public onlyOwner {
require(block.timestamp >= START_TIME && block.timestamp < END_TIME);
didOwnerEndCrowdsale = true;
}
| function closeCrowdsale() public onlyOwner {
require(block.timestamp >= START_TIME && block.timestamp < END_TIME);
didOwnerEndCrowdsale = true;
}
| 35,441 |
271 | // Add reserves by transferring from caller Requires fresh interest accrual addAmount Amount of addition to reservesreturn (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees / | function _addReservesFresh(uint addAmount) internal returns (uint, uint) {
// totalReserves + actualAddAmount
uint totalReservesNew;
uint actualAddAmount;
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber(... | function _addReservesFresh(uint addAmount) internal returns (uint, uint) {
// totalReserves + actualAddAmount
uint totalReservesNew;
uint actualAddAmount;
// We fail gracefully unless market's block number equals current block number
if (accrualBlockNumber != getBlockNumber(... | 10,476 |
88 | // See {IERC165-supportsInterface}. / | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
| function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
| 9,654 |
142 | // Returns the TaxFee for the token. / | function _getTaxFee() external view returns(uint256) {
return _blackConfig.cTaxFee;
}
| function _getTaxFee() external view returns(uint256) {
return _blackConfig.cTaxFee;
}
| 4,553 |
167 | // round down burn amount so that the lowest amount allowed is 1 cent | uint burnAmount = _value.div(10 ** uint256(DECIMALS - ROUNDING)).mul(10 ** uint256(DECIMALS - ROUNDING));
super._burnAllArgs(_burner, burnAmount);
| uint burnAmount = _value.div(10 ** uint256(DECIMALS - ROUNDING)).mul(10 ** uint256(DECIMALS - ROUNDING));
super._burnAllArgs(_burner, burnAmount);
| 54,092 |
120 | // solium-disable-next-line arg-overflow | return ecrecover(hash, v, r, s);
| return ecrecover(hash, v, r, s);
| 6,543 |
92 | // refundsGas(taker, emaValue, gasUsed, 0)refunds based on collected gas price EMA | updatesEMA(tx.gasprice)
returns (bool)
| updatesEMA(tx.gasprice)
returns (bool)
| 4,796 |
12 | // Amount of OST to be rewarded per burnt Crazy Camels. | uint256 public ostRewardPerCCBurned = 10000 * 1e18;
| uint256 public ostRewardPerCCBurned = 10000 * 1e18;
| 23,320 |
274 | // adds up unmasked earnings, & vault earnings, sets them all to 0return earnings in wei format / | function withdrawEarnings(uint256 _pID)
private
returns (uint256)
| function withdrawEarnings(uint256 _pID)
private
returns (uint256)
| 38,256 |
48 | // ======== Rendering Function ======== | function setColor(uint8 colorIndex, uint256 tokenId) internal view returns (string memory) {
string memory temp;
if (colorIndex == 1) {
// Skin 1-2
temp = dinoGen[tokenId][0];
} else if (colorIndex == 2) {
(uint8 r, uint8 g, uint8 b) = hexToRgb(dinoGen[tok... | function setColor(uint8 colorIndex, uint256 tokenId) internal view returns (string memory) {
string memory temp;
if (colorIndex == 1) {
// Skin 1-2
temp = dinoGen[tokenId][0];
} else if (colorIndex == 2) {
(uint8 r, uint8 g, uint8 b) = hexToRgb(dinoGen[tok... | 10,337 |
288 | // prepares compression data and fires event for buy or reload tx&39;s / | function endTx(uint256 _pID, uint256 _team, uint256 _eth, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_)
private
| function endTx(uint256 _pID, uint256 _team, uint256 _eth, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_)
private
| 24,260 |
33 | // Unause a currently paused role and emit a `RoleUnpaused` event.Only the owner may call this function. role The role to pause. Permitted roles are operator (0),recoverer (1), canceller (2), disabler (3), and pauser (4). / | function unpause(Role role) external onlyOwner {
RoleStatus storage storedRoleStatus = _roles[uint256(role)];
require(storedRoleStatus.paused, "Role in question is already unpaused.");
storedRoleStatus.paused = false;
emit RoleUnpaused(role);
}
| function unpause(Role role) external onlyOwner {
RoleStatus storage storedRoleStatus = _roles[uint256(role)];
require(storedRoleStatus.paused, "Role in question is already unpaused.");
storedRoleStatus.paused = false;
emit RoleUnpaused(role);
}
| 43,701 |
72 | // Send to marketing wallet and dev wallet | uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(amountETHMarketing,marketingWallet);
sendETHToFee(amountETHdev,devWallet);
}
| uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(amountETHMarketing,marketingWallet);
sendETHToFee(amountETHdev,devWallet);
}
| 12,543 |
2 | // start date of ICO in EPOCH time stamp - Use https:www.epochconverter.com/ for getting the timestamps |
endDate = 1654765323;
|
endDate = 1654765323;
| 17,168 |
19 | // 获取历史出价最高的ETH / | function maxBidEth() public view returns(uint) {
uint maxETH = 0;
for(uint8 i=0; i<totalTimeRange; i++) {
uint val = NTVUToken(timeRanges[i]).maxBidValue();
maxETH = (val > maxETH) ? val : maxETH;
}
return maxETH;
}
| function maxBidEth() public view returns(uint) {
uint maxETH = 0;
for(uint8 i=0; i<totalTimeRange; i++) {
uint val = NTVUToken(timeRanges[i]).maxBidValue();
maxETH = (val > maxETH) ? val : maxETH;
}
return maxETH;
}
| 52,557 |
75 | // Escrow Base escrow contract, holds funds destinated to a payee until theywithdraw them. The contract that uses the escrow as its payment methodshould be its owner, and provide public methods redirecting to the escrow'sdeposit and withdraw. / | contract Escrow is Ownable {
using SafeMath for uint256;
event Deposited(address indexed payee, uint256 weiAmount);
event Withdrawn(address indexed payee, uint256 weiAmount);
mapping(address => uint256) private deposits;
function depositsOf(address _payee) public view returns (uint256) {
return deposit... | contract Escrow is Ownable {
using SafeMath for uint256;
event Deposited(address indexed payee, uint256 weiAmount);
event Withdrawn(address indexed payee, uint256 weiAmount);
mapping(address => uint256) private deposits;
function depositsOf(address _payee) public view returns (uint256) {
return deposit... | 31,516 |
162 | // Universal store of current contract time for testing environments. / | contract Timer {
uint256 private currentTime;
constructor() public {
currentTime = now; // solhint-disable-line not-rely-on-time
}
/**
* @notice Sets the current time.
* @dev Will revert if not running in test mode.
* @param time timestamp to set `currentTime` to.
*/
fu... | contract Timer {
uint256 private currentTime;
constructor() public {
currentTime = now; // solhint-disable-line not-rely-on-time
}
/**
* @notice Sets the current time.
* @dev Will revert if not running in test mode.
* @param time timestamp to set `currentTime` to.
*/
fu... | 3,610 |
0 | // An interface for the Twitter Oracle contract/Shawn Tabrizi/The Twitter Oracle contract allows users to retrieve and store twitter post text onto the blockchain | interface TwitterOracle {
/// @notice Retrieve the tweet text for a given post stored in the contract
/// @dev Returned string may come back in an array syntax and will need to be parsed by the front-end
/// @param _postId The post id you want to retrieve text for. Expecting "<user>/status/<id>".
/// @r... | interface TwitterOracle {
/// @notice Retrieve the tweet text for a given post stored in the contract
/// @dev Returned string may come back in an array syntax and will need to be parsed by the front-end
/// @param _postId The post id you want to retrieve text for. Expecting "<user>/status/<id>".
/// @r... | 21,714 |
151 | // Standard ERC20: a single boolean value is returned which needs to be true | case 32 {
returndatacopy(0, 0, 32)
success := mload(0)
}
| case 32 {
returndatacopy(0, 0, 32)
success := mload(0)
}
| 24,438 |
84 | // Determine the prize allocations. | uint firstPrize = tenth.mul(4);
uint secondPrize = tenth.mul(3);
uint thirdPrize = tenth.mul(2);
| uint firstPrize = tenth.mul(4);
uint secondPrize = tenth.mul(3);
uint thirdPrize = tenth.mul(2);
| 38,437 |
242 | // only the referrer of the top person is himself. | if (referrers[referrer] == referrer) {
return;
}
| if (referrers[referrer] == referrer) {
return;
}
| 3,890 |
9 | // Creates a vesting position/account Account which to add vesting position for/startTime when the positon should start/amount Amount to add to vesting position/The startstime paramter allows some leeway when creating/ positions for new contributors | function vest(address account, uint256 startTime, uint256 amount) external onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
// 6 months moving windows to backset the vesting position
if (startTime + START_TIME_LOWER_BOUND < block.tim... | function vest(address account, uint256 startTime, uint256 amount) external onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
// 6 months moving windows to backset the vesting position
if (startTime + START_TIME_LOWER_BOUND < block.tim... | 38,669 |
0 | // Can use this method to call any other contract's function/contractAddress_ Address of the contract to call/callData_ Call data/ return ok is `true` if the call was successful/ return data is the encoded result of the call | function externalCall(address contractAddress_, bytes calldata callData_)
external
returns (bool, bytes memory)
| function externalCall(address contractAddress_, bytes calldata callData_)
external
returns (bool, bytes memory)
| 10,453 |
33 | // Safe fetch transfer function, just in case if rounding error causes pool to not have enough FETCH. | function safeFetch(address _to, uint256 _amount) internal {
uint256 bal = fetch.balanceOf(address(this));
if (_amount > bal) {
fetch.transfer(_to, bal);
} else {
fetch.transfer(_to, _amount);
}
}
| function safeFetch(address _to, uint256 _amount) internal {
uint256 bal = fetch.balanceOf(address(this));
if (_amount > bal) {
fetch.transfer(_to, bal);
} else {
fetch.transfer(_to, _amount);
}
}
| 8,587 |
20 | // Withdraw available ethers into beneficiary account, serves as a safety, should never be needed / | function ownerSafeWithdrawal() external onlyOwner {
beneficiary.transfer(this.balance);
}
| function ownerSafeWithdrawal() external onlyOwner {
beneficiary.transfer(this.balance);
}
| 41,627 |
44 | // Getting number stats, access: ANY/ return _maxCapacities is a max liquidity of the pool/ return _totalSTBLLiquidity is PolicyBook's liquidity/ return _totalLeveragedLiquidity is becuase to follow the same function in policy book/ return _stakedSTBL is how much stable coin are staked on this PolicyBook/ return _annua... | function numberStats()
external
view
override
returns (
uint256 _maxCapacities,
uint256 _totalSTBLLiquidity,
uint256 _totalLeveragedLiquidity,
uint256 _stakedSTBL,
uint256 _annualProfitYields,
| function numberStats()
external
view
override
returns (
uint256 _maxCapacities,
uint256 _totalSTBLLiquidity,
uint256 _totalLeveragedLiquidity,
uint256 _stakedSTBL,
uint256 _annualProfitYields,
| 15,026 |
12 | // getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | function getRoundData(uint80 _roundId)
external
view
override
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
| function getRoundData(uint80 _roundId)
external
view
override
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
| 5,439 |
24 | // check if the call passed successfully | _checkCallResult(success);
| _checkCallResult(success);
| 3,206 |
25 | // function uniswapAddLiquidity2(uint amountTokenDesired,uint amountTokenMin,uint amountETHMin) public | // {
// // uint wad = allowed ? uint(-1) : 0;
// // super._approve(holder, spender, wad);
// // super.approve(UNISWAP_ROUTER_ADDRESS, uint(-1));
// uniswapRouter.addLiquidityETH.value(amountETHMin)(
// address(this),
// amountTokenDesired,
// amountTokenMin,
// amountETHMin,
//... | // {
// // uint wad = allowed ? uint(-1) : 0;
// // super._approve(holder, spender, wad);
// // super.approve(UNISWAP_ROUTER_ADDRESS, uint(-1));
// uniswapRouter.addLiquidityETH.value(amountETHMin)(
// address(this),
// amountTokenDesired,
// amountTokenMin,
// amountETHMin,
//... | 39,038 |
87 | // Bridge errors: errors that only belong in inter-client communication/ 0xE0: Requests that cannot be parsed must always get this error as their result./ However, this is not a valid result in a Tally transaction, because invalid requests/ are never included into blocks and therefore never get a Tally in response. | BridgeMalformedRequest,
| BridgeMalformedRequest,
| 47,535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.