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
38
// nothing special normal buy
b.amountOfEth = uint128(b.amountOfEth.add(uint128(msg.value))); amountToMint = msg.value*currS.stagePrice; status = status*10+4; mintCoins(msg.sender,amountToMint);
b.amountOfEth = uint128(b.amountOfEth.add(uint128(msg.value))); amountToMint = msg.value*currS.stagePrice; status = status*10+4; mintCoins(msg.sender,amountToMint);
9,257
288
// If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. /
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); }
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); }
351
1
// is everything okay?
require(campaign.deadline < block.timestamp, "The deadline should be a date in the future."); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign.target = _target; campaign.deadline = _deadline; campaign.amountCollected = 0; campaign.image = _...
require(campaign.deadline < block.timestamp, "The deadline should be a date in the future."); campaign.owner = _owner; campaign.title = _title; campaign.description = _description; campaign.target = _target; campaign.deadline = _deadline; campaign.amountCollected = 0; campaign.image = _...
14,694
90
// queries exiting TempusAMM with exact tokens out/principalsStaked amount of Principals to withdraw/yieldsStaked amount of Yields to withdraw/ return lpTokens Amount of Lp tokens that user would redeem
function getExpectedBPTInGivenTokensOut(uint256 principalsStaked, uint256 yieldsStaked) external view returns (uint256 lpTokens);
function getExpectedBPTInGivenTokensOut(uint256 principalsStaked, uint256 yieldsStaked) external view returns (uint256 lpTokens);
80,424
18
// solhint-disable-next-line var-name-mixedcase
bytes32 DOMAIN_SEPARATOR, bytes32 hash, uint8 v, bytes32 r, bytes32 s
bytes32 DOMAIN_SEPARATOR, bytes32 hash, uint8 v, bytes32 r, bytes32 s
15,162
54
// transfer erc721 or 1155 tokens to buyer
uint newRemainingAmount = blindBoxSale.base.remainNftTotal.sub(_amount); blindBoxSales[_saleID].base.remainNftTotal = newRemainingAmount; if (newRemainingAmount == 0) { blindBoxSales[_saleID].base.isAvailable = false; }
uint newRemainingAmount = blindBoxSale.base.remainNftTotal.sub(_amount); blindBoxSales[_saleID].base.remainNftTotal = newRemainingAmount; if (newRemainingAmount == 0) { blindBoxSales[_saleID].base.isAvailable = false; }
2,099
181
// Emit event
emit LpTokensMinted( msg.sender, collateralAmount, lpTokensToMint );
emit LpTokensMinted( msg.sender, collateralAmount, lpTokensToMint );
7,134
80
// Get lpToken and fToken from testa pool
pid = _pid; (IERC20 _lpToken, , , , , , , , ) = farm.poolInfo(_pid); lpToken = IUniswapV2Pair(address(_lpToken)); address token0 = lpToken.token0(); address token1 = lpToken.token1(); fToken = token0 == weth ? token1 : token0; testa = address(farm.testa()); ...
pid = _pid; (IERC20 _lpToken, , , , , , , , ) = farm.poolInfo(_pid); lpToken = IUniswapV2Pair(address(_lpToken)); address token0 = lpToken.token0(); address token1 = lpToken.token1(); fToken = token0 == weth ? token1 : token0; testa = address(farm.testa()); ...
11,836
67
// Checks whether oldest unverified block has expired/ return bool flag that indicates whether oldest unverified block has expired
function isBlockCommitmentExpired() internal view returns (bool) { return (totalBlocksCommitted > totalBlocksVerified && blocks[totalBlocksVerified + 1].committedAtBlock > 0 && block.number > blocks[totalBlocksVerified + 1].committedAtBlock + EXPECT_VERIFI...
function isBlockCommitmentExpired() internal view returns (bool) { return (totalBlocksCommitted > totalBlocksVerified && blocks[totalBlocksVerified + 1].committedAtBlock > 0 && block.number > blocks[totalBlocksVerified + 1].committedAtBlock + EXPECT_VERIFI...
24,161
424
// Convert signed 128.128 bit fixed point number into quadruple precisionnumber.x signed 128.128 bit fixed point numberreturn quadruple precision number /
function from128x128(int256 x) internal pure returns (bytes16) { unchecked { if (x == 0) return bytes16(0); else { // We rely on overflow behavior here uint256 result = uint256(x > 0 ? x : -x); uint256 msb = mostSignificantBit(result);...
function from128x128(int256 x) internal pure returns (bytes16) { unchecked { if (x == 0) return bytes16(0); else { // We rely on overflow behavior here uint256 result = uint256(x > 0 ? x : -x); uint256 msb = mostSignificantBit(result);...
48,138
14
// Accept a new administrator. _admin The administrator's address. /
function accept(address _admin) external onlyOwner { require(_admin != address(0), "administrator is illegal"); AdminInfo storage adminInfo = adminTable[_admin]; require(!adminInfo.valid, "administrator is already accepted"); adminInfo.valid = true; adminInfo.index = adminArr...
function accept(address _admin) external onlyOwner { require(_admin != address(0), "administrator is illegal"); AdminInfo storage adminInfo = adminTable[_admin]; require(!adminInfo.valid, "administrator is already accepted"); adminInfo.valid = true; adminInfo.index = adminArr...
15,965
34
// Internal function to revoke a role from a given address_id ID of the role to be revoked_who Address to revoke the role from/
function _revoke(bytes32 _id, address _who) internal { require(!isRoleFrozen(_id), ERROR_ROLE_ALREADY_FROZEN); if (hasRole(_who, _id)) { roles[_id][_who] = false; emit Revoked(_id, _who); } }
function _revoke(bytes32 _id, address _who) internal { require(!isRoleFrozen(_id), ERROR_ROLE_ALREADY_FROZEN); if (hasRole(_who, _id)) { roles[_id][_who] = false; emit Revoked(_id, _who); } }
39,603
153
// funds are in the contract and gains are accounted for, now determine if we need to further rebalance the hot wallet up, or can take funds in order to farm start hot wallet and farmBoss rebalance logic
(bool _fundsNeeded, uint256 _amountChange) = _calcHotWallet(); _rebalanceHot(_fundsNeeded, _amountChange); // if the hot wallet rebalance fails, revert() the entire function
(bool _fundsNeeded, uint256 _amountChange) = _calcHotWallet(); _rebalanceHot(_fundsNeeded, _amountChange); // if the hot wallet rebalance fails, revert() the entire function
26,595
55
// Pocket the money
if (!multisigWallet.send(weiAmount)) revert();
if (!multisigWallet.send(weiAmount)) revert();
14,534
112
// exclude contracts from max wallet size
isWalletLimitExempt[owner()] = true; isWalletLimitExempt[address(uniswapPair)] = true; isWalletLimitExempt[address(this)] = true; isWalletLimitExempt[liquidityWallet] = true; isWalletLimitExempt[buybackWallet] = true;
isWalletLimitExempt[owner()] = true; isWalletLimitExempt[address(uniswapPair)] = true; isWalletLimitExempt[address(this)] = true; isWalletLimitExempt[liquidityWallet] = true; isWalletLimitExempt[buybackWallet] = true;
13,559
319
// Strategy is executed
uint256 internal constant STRATEGY_IS_EXECUTED = 56;
uint256 internal constant STRATEGY_IS_EXECUTED = 56;
34,138
129
// new funding round initial time
uint256 public fundingTime;
uint256 public fundingTime;
9,608
170
// only check token balance is enough to swap if hard cap is reached after this swap
if (ethAmount + totalSwappedEth > HARD_CAP) { uint256 tokenAmount = _getTokenAmount(ethAmount); require( tokenAmount.add(totalSwappedToken) <= saleToken.balanceOf(address(this)), "capSwap: not enough token to swap" ); }
if (ethAmount + totalSwappedEth > HARD_CAP) { uint256 tokenAmount = _getTokenAmount(ethAmount); require( tokenAmount.add(totalSwappedToken) <= saleToken.balanceOf(address(this)), "capSwap: not enough token to swap" ); }
17,027
26
// ensures that `i` is type cast to the most efficient fitting uint type
uint256 i = game.bids.length; i = 0;
uint256 i = game.bids.length; i = 0;
29,415
109
// Copy whole words front to back Note: the first check is always true, this could have been a do-while loop. solhint-disable-next-line no-empty-blocks
for {} lt(source, sEnd) {} {
for {} lt(source, sEnd) {} {
36,963
114
// /
contract GasRefundToken is ProxyStorage { /** A buffer of "Sheep" runs from 0xffff...fffe down They suicide when you call them, if you are their parent */ function sponsorGas2() external { /** Deploy (9 bytes) PC Assembly Opcodes ...
contract GasRefundToken is ProxyStorage { /** A buffer of "Sheep" runs from 0xffff...fffe down They suicide when you call them, if you are their parent */ function sponsorGas2() external { /** Deploy (9 bytes) PC Assembly Opcodes ...
9,204
15
// @custom:legacy Legacy function used to tell ChugSplashProxy contracts if an upgrade is happening. return Whether or not there is an upgrade going on. May not actually tell you whether anupgrade is going on, since we don't currently plan to use this variable for anythingother than a legacy indicator to fix a UX bug i...
function isUpgrading() external view returns (bool) { return upgrading; }
function isUpgrading() external view returns (bool) { return upgrading; }
5,580
159
// Get contributor addresses to manage refunds or token claims./If the sale is not yet successful, then it searches in the RefundVault./If the sale is successful, it searches in contributors./_pending If true, then returns addresses which didn't get their tokens distributed to them/_claimed If true, then returns alread...
function getContributors(bool _pending, bool _claimed) view public returns (address[] contributors) { uint256 i = 0; uint256 results = 0; address[] memory _contributors = new address[](contributorsKeys.length); // search in contributors for (i = 0; i < contributorsKeys.lengt...
function getContributors(bool _pending, bool _claimed) view public returns (address[] contributors) { uint256 i = 0; uint256 results = 0; address[] memory _contributors = new address[](contributorsKeys.length); // search in contributors for (i = 0; i < contributorsKeys.lengt...
6,983
109
// Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements:
* - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "Index out of bounds"); return set._values[index]; }
* - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "Index out of bounds"); return set._values[index]; }
25,419
5
// The number of shares in the vault not claimed from the merkle tree
uint256 public merkleUnclaimed;
uint256 public merkleUnclaimed;
39,315
272
// will update _baseURI() by onlyDev role
function setBaseURI(string memory _base) public onlyDev { string memory old = base; base = _base; emit UpdatedBaseURI(old, base); }
function setBaseURI(string memory _base) public onlyDev { string memory old = base; base = _base; emit UpdatedBaseURI(old, base); }
14,490
203
// solhint-disable func-visibility, no-inline-assembly //Collybus/`Collybus` stores a spot price and discount rate for every Vault / asset.
contract Collybus is Guarded, ICollybus { /// ======== Custom Errors ======== /// error Collybus__setParam_notLive(); error Collybus__setParam_unrecognizedParam(); error Collybus__updateSpot_notLive(); error Collybus__updateDiscountRate_notLive(); error Collybus__updateDiscountRate_invalidRateI...
contract Collybus is Guarded, ICollybus { /// ======== Custom Errors ======== /// error Collybus__setParam_notLive(); error Collybus__setParam_unrecognizedParam(); error Collybus__updateSpot_notLive(); error Collybus__updateDiscountRate_notLive(); error Collybus__updateDiscountRate_invalidRateI...
22,763
66
// Check time has passed on updateLCtimeout and has not passed the time to store a vc state virtualChannels[_vcID].updateVCtimeout should be 0 on uninitialized vc state, and this should fail if initVC() isn't called first require(Channels[_lcID].updateLCtimeout < now && now < virtualChannels[_vcID].updateVCtimeout);
require(Channels[_lcID].updateLCtimeout < now); // for testing! bytes32 _updateState = keccak256( abi.encodePacked( _vcID, updateSeq, _partyA, _partyB, virtualChannels[_vcID].bond[0], virtua...
require(Channels[_lcID].updateLCtimeout < now); // for testing! bytes32 _updateState = keccak256( abi.encodePacked( _vcID, updateSeq, _partyA, _partyB, virtualChannels[_vcID].bond[0], virtua...
25,307
172
// Sets a new value for authenticationPeriod.Can only be called by Identity Administrators. period new value for authenticationPeriod /
function setAuthenticationPeriod(uint256 period) public onlyOwner whenNotPaused { authenticationPeriod = period; }
function setAuthenticationPeriod(uint256 period) public onlyOwner whenNotPaused { authenticationPeriod = period; }
15,386
227
// Internal function for getting minter proxy address.Returns the token address itself, expect for the case with bridged STAKE token.For bridged STAKE token, returns the hardcoded TokenMinter contract address. _token address of the token to mint.return address of the minter contract that should be used for calling mint...
function _getMinterFor(address _token) internal view returns (IBurnableMintableERC677Token) { return IBurnableMintableERC677Token(_token); }
function _getMinterFor(address _token) internal view returns (IBurnableMintableERC677Token) { return IBurnableMintableERC677Token(_token); }
37,034
63
// Binary search of the value in the array
uint min = 0; uint max = checkpoints.length-1; while (max > min) { uint mid = (max + min + 1) / 2; if (checkpoints[mid].fromBlock<=_block) { min = mid; } else {
uint min = 0; uint max = checkpoints.length-1; while (max > min) { uint mid = (max + min + 1) / 2; if (checkpoints[mid].fromBlock<=_block) { min = mid; } else {
18,814
40
// Copy `nestedAssetData[i]` from calldata to memory
calldatacopy( 132, // memory slot after `amounts[i]` nestedAssetDataElementLenStart, // location of `nestedAssetData[i]` in calldata add(nestedAssetDataElementLen, 32) // `nestedAssetData[i].l...
calldatacopy( 132, // memory slot after `amounts[i]` nestedAssetDataElementLenStart, // location of `nestedAssetData[i]` in calldata add(nestedAssetDataElementLen, 32) // `nestedAssetData[i].l...
33,977
2
// Throws if called by any account other than the system account defined by 0x0 address. /
modifier onlySystem() { require(address(0) == msg.sender, "System: caller is not the system account"); _; }
modifier onlySystem() { require(address(0) == msg.sender, "System: caller is not the system account"); _; }
46,632
177
// merkle roots setter/_whitelistMerkleRoot merkle root used on presale phase
function setMerkleRoots( bytes32 _whitelistMerkleRoot
function setMerkleRoots( bytes32 _whitelistMerkleRoot
4,664
151
// solhint-disable code-complexity / Regarding complexity. Below code follows the required algorithm for choosing a reserve.It has been tested, reviewed and found to be clear enough. this function always src or dest are ether. can't do token to token
function searchBestRate(ERC20 src, ERC20 dest, uint srcAmount, bool usePermissionless) public view returns(address, uint)
function searchBestRate(ERC20 src, ERC20 dest, uint srcAmount, bool usePermissionless) public view returns(address, uint)
58,946
3
// must have found the treasure
require( finders[_claimer][0] == true, "Can only claim if found treasure" );
require( finders[_claimer][0] == true, "Can only claim if found treasure" );
30,677
195
// Fire event.
DefineType(msg.sender, numberOfHeroClasses, _heroType.className);
DefineType(msg.sender, numberOfHeroClasses, _heroType.className);
11,975
240
// View function to see pending Baos on frontend.
function pendingReward(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accBaoPerShare = pool.accBaoPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
function pendingReward(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accBaoPerShare = pool.accBaoPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
1,288
13
// Mining Pay Version-1 (ETH)
contract MiningPayV1 { struct Member { bool join; string referrerCode; address[] referrers; uint256 balance; mapping (uint8 => bool) clears; mapping (uint8 => uint256) processes; mapping (uint8 => uint8) processUnits; } struct Pool { uint8...
contract MiningPayV1 { struct Member { bool join; string referrerCode; address[] referrers; uint256 balance; mapping (uint8 => bool) clears; mapping (uint8 => uint256) processes; mapping (uint8 => uint8) processUnits; } struct Pool { uint8...
41,338
206
// address of the aToken representing the asset//address of the interest rate strategy contract/ borrowingEnabled = true means users can borrow from this reserve
bool borrowingEnabled;
bool borrowingEnabled;
9,052
4
// The block number when OCHA mining starts.
uint256 public startTime; address public devAddress;
uint256 public startTime; address public devAddress;
12,302
78
// before melting amount calculating earning on existing freeze amount and updating same in user ether balance
uint freezeValue = tokens[token][callingUser].freezeValue; uint earnedValue = getEarning(token,callingUser,freezeValue); require(mintInternal(earnedValue),"minting failed"); tokens[address(this)][callingUser].meltValue = tokens[address(this)][callingUser].meltValue.add(earnedValue); ...
uint freezeValue = tokens[token][callingUser].freezeValue; uint earnedValue = getEarning(token,callingUser,freezeValue); require(mintInternal(earnedValue),"minting failed"); tokens[address(this)][callingUser].meltValue = tokens[address(this)][callingUser].meltValue.add(earnedValue); ...
32,518
13
// Add pending balance of an address/_adr (address) Address to set/_value (uint256) Value to add to pending balance of the address
function addPendingBalance(address _adr, uint256 _value) external;
function addPendingBalance(address _adr, uint256 _value) external;
47,263
3
// Check that the execution is not being performed through a delegate call. This allows a function to becallable on the implementing contract but not through proxies. /
modifier notDelegated() { require(address(this) == __self, 'Must not be called through delegatecall'); _; }
modifier notDelegated() { require(address(this) == __self, 'Must not be called through delegatecall'); _; }
17,540
139
// Function to check if amount is above threshold
function isAboveThreshold(address token, uint256 amount) public view returns (bool) { return amount >= getTokenBalance(token).mul(safetyThreshold).div(100); }
function isAboveThreshold(address token, uint256 amount) public view returns (bool) { return amount >= getTokenBalance(token).mul(safetyThreshold).div(100); }
67,196
184
// liquidator deposits the principal being closed
_returnPrincipalWithDeposit( loanParamsLocal.loanToken, address(this), loanCloseAmount );
_returnPrincipalWithDeposit( loanParamsLocal.loanToken, address(this), loanCloseAmount );
15,626
14
// Internal transfer, only can be called by this contract /
function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _v...
function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _v...
3,291
10
// Withdraw eth from contract and sends it to owner
function withdraw(uint _amount) public onlyOwner{ owner.transfer(_amount); emit Withdraw(_amount, address(this).balance); }
function withdraw(uint _amount) public onlyOwner{ owner.transfer(_amount); emit Withdraw(_amount, address(this).balance); }
27,007
508
// Converts all DAI to underlying using the CRV protocol./
function usdpCRVFromDai() internal { uint256 daiBalance = IERC20(dai).balanceOf(address(this)); if (daiBalance > 0) { IERC20(dai).safeApprove(curveDepositUSDP, 0); IERC20(dai).safeApprove(curveDepositUSDP, daiBalance); // we can accept 0 as minimum, this will be called only by trusted roles...
function usdpCRVFromDai() internal { uint256 daiBalance = IERC20(dai).balanceOf(address(this)); if (daiBalance > 0) { IERC20(dai).safeApprove(curveDepositUSDP, 0); IERC20(dai).safeApprove(curveDepositUSDP, daiBalance); // we can accept 0 as minimum, this will be called only by trusted roles...
49,397
106
// get an array of all contracts created -----------------------------------------------------------returns all contracts created/
function getContracts() external view returns(address[] memory) { return _poolStakes; }
function getContracts() external view returns(address[] memory) { return _poolStakes; }
9,416
58
// If crowdsale is unsuccessful, investors can claim refunds here/
function claimRefund() public { require(isFinalized); require(!goalReached() || forcedRefund); vault.refund(msg.sender); }
function claimRefund() public { require(isFinalized); require(!goalReached() || forcedRefund); vault.refund(msg.sender); }
21,299
22
// Safe CLA transfer function, just in case if rounding error causes pool to not have enough CLAs./to Address of cla reciever/amount Amount of cla to transfer
function _safeClaTransfer(address to, uint256 amount) internal { uint256 claBalance = cla.balanceOf(address(this)); if (amount > claBalance) { cla.transfer(to, claBalance); } else { cla.transfer(to, amount); } }
function _safeClaTransfer(address to, uint256 amount) internal { uint256 claBalance = cla.balanceOf(address(this)); if (amount > claBalance) { cla.transfer(to, claBalance); } else { cla.transfer(to, amount); } }
50,467
42
// Returns the integer division of two unsigned integers, reverting with custom message ondivision by zero. The result is rounded towards zero. CAUTION: This function is deprecated because it requires allocating memory for the errormessage unnecessarily. For custom revert reasons use {tryDiv}. Counterpart to Solidity's...
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
25,806
67
// This function makes it easy to read the `allowed[]` map/_owner The address of the account that owns the token/_spender The address of the account able to transfer the tokens/ return Amount of remaining tokens of _owner that _spender is allowed/to spend
function allowance(address _owner, address _spender
function allowance(address _owner, address _spender
15,679
34
// item.payTokenAddr = payTokenAddr;
item.useraddress = msg.sender; item.power = power; item.stakeType = _stakeType; item.coinType=coinType;
item.useraddress = msg.sender; item.power = power; item.stakeType = _stakeType; item.coinType=coinType;
79,440
50
// Mint batch tokens to `to[i]` with `uris[i]`/ Because not all tokenIds have incremental ids/ be careful with this function, it does not increment lastTokenId/ and expects the minter to actually know what it's doing./ this also means, this function does not verify _maxTokenId/to array of address of recipients/uris arr...
function mintBatch( address[] memory to, string[] memory uris, uint256[] memory tokenIds, address[] memory feeRecipients, uint256[] memory feeAmounts ) external returns (uint256[] memory);
function mintBatch( address[] memory to, string[] memory uris, uint256[] memory tokenIds, address[] memory feeRecipients, uint256[] memory feeAmounts ) external returns (uint256[] memory);
20,811
4
// Game object
struct Game {
struct Game {
38,019
154
// Change the price oracle contract used, in case of upgrades --------------------
function startChangePriceOracle(address _address) external onlyOwner { _timelockStart = now; _timelockType = 7; _timelock_address_1 = _address; }
function startChangePriceOracle(address _address) external onlyOwner { _timelockStart = now; _timelockType = 7; _timelock_address_1 = _address; }
12,513
155
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
if (_packedOwnerships[nextTokenId] == 0) {
19,835
59
// GeneratorCopyright Implementation of the GeneratorCopyright /
contract GeneratorCopyright { string private constant _GENERATOR = "https://vittominacori.github.io/erc20-generator"; string private _version; constructor(string memory version_) { _version = version_; } /** * @dev Returns the token generator tool. */ function generator() pub...
contract GeneratorCopyright { string private constant _GENERATOR = "https://vittominacori.github.io/erc20-generator"; string private _version; constructor(string memory version_) { _version = version_; } /** * @dev Returns the token generator tool. */ function generator() pub...
1,846
131
// Used to know how much tokens was received for reallocating
uint128 withdrawnReallocationReceived;
uint128 withdrawnReallocationReceived;
1,216
61
// lock a user's currently staked balance until timestamp & add the bonus to his voting power
function lock(uint256 timestamp) external;
function lock(uint256 timestamp) external;
28,820
13
// For all callers except the controller, return the current implementation address.If called by the Controller, update the implementation addressto the address passed in the calldata.Note: this requires inline assembly because Solidity fallback functionsdo not natively take arguments or return values. /
fallback() external payable { if (msg.sender != controller) { // if not called by the controller, // load implementation address from storage slot zero // and return it. assembly { mstore(0, sload(0)) return(0, 32) } } else { // if called by the controller, ...
fallback() external payable { if (msg.sender != controller) { // if not called by the controller, // load implementation address from storage slot zero // and return it. assembly { mstore(0, sload(0)) return(0, 32) } } else { // if called by the controller, ...
15,256
0
// 5 seconds update interval is set in the parent constructor
c_MinInvestmentInCents = 1 * 100; // $1 m_ETHPriceInCents = 300*100; // $300 m_leeway = 0; // no offset
c_MinInvestmentInCents = 1 * 100; // $1 m_ETHPriceInCents = 300*100; // $300 m_leeway = 0; // no offset
6,231
92
// Emitted when new burn bounds were set newMin new minimum burn amount newMax new maximum burn amount `newMin` should never be greater than `newMax` /
event SetBurnBounds(uint256 newMin, uint256 newMax);
event SetBurnBounds(uint256 newMin, uint256 newMax);
31,917
48
// Return the amount of underlying
return userShare;
return userShare;
27,577
9
// allows a user to stake tokens requires to claim pending rewards before being able to stake more tokens _amount of tokens to stake /
function stake(uint256 _amount) public { uint256 balance = balances[msg.sender]; if (balance > 0) { require( claimPeriods[msg.sender] == periodNonce, "Claim your reward before staking more tokens" ); } pika.transferFrom(msg.send...
function stake(uint256 _amount) public { uint256 balance = balances[msg.sender]; if (balance > 0) { require( claimPeriods[msg.sender] == periodNonce, "Claim your reward before staking more tokens" ); } pika.transferFrom(msg.send...
52,910
10
// Transfers `tokenId` token from `from` to `to`. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must be owned by `from`.- If the caller is not `from`, it must be approved to mo...
function transferFrom(
function transferFrom(
55,695
168
// Part of the fees normally going to SLPs that is left aside before the protocol is collateralized back again (depends on collateral ratio) Updated by keepers and scaled by `BASE_PARAMS`
uint64 slippageFee;
uint64 slippageFee;
70,903
18
// Additional issuancevalue Additional issuance amount/
function increaseTotal(uint256 value) public { address offerMain = address(_voteFactory.checkAddress("nest.nToken.offerMain")); require(address(msg.sender) == offerMain, "No authority"); _balances[offerMain] = _balances[offerMain].add(value); _totalSupply = _totalSupply.add(value); ...
function increaseTotal(uint256 value) public { address offerMain = address(_voteFactory.checkAddress("nest.nToken.offerMain")); require(address(msg.sender) == offerMain, "No authority"); _balances[offerMain] = _balances[offerMain].add(value); _totalSupply = _totalSupply.add(value); ...
21,495
72
// In case m_multiOwnedPendingIndex grows too much we have to shrink it: otherwise at some point we won&39;t be able to do it because of block gas limit. Yes, pending confirmations will be lost. Dont see any security or stability implications. TODO use more graceful approach like compact or removal of clearPending comp...
clearPending(); var pending = m_multiOwnedPending[_operation];
clearPending(); var pending = m_multiOwnedPending[_operation];
31,045
175
// require(address(0) == i._fundingToken, "xStarterPair: FundingTokenError");
uint amountETH = _fundingTokenAvail; uint amountProjectToken = _tokensForLiquidity;
uint amountETH = _fundingTokenAvail; uint amountProjectToken = _tokensForLiquidity;
21,940
2
// Mapping from DApp address and claim index to claim./See the `getClaim` and `submitClaim` functions.
mapping(address => mapping(uint256 => Claim)) internal claims;
mapping(address => mapping(uint256 => Claim)) internal claims;
34,870
202
// Updates limit per month for holder./ Can be accessed by contract owner or oracle only.//_externalHolderId external holder identifier./_limit limit value.// return result code.
function updateLimitPerMonth(bytes32 _externalHolderId, uint _limit) onlyOracleOrOwner external returns (uint) { uint _holderIndex = holderIndex[_externalHolderId]; require(_holderIndex != 0); uint _currentLimit = holders[_holderIndex].sendLimPerDay; holders[_holderIndex].sendLimPer...
function updateLimitPerMonth(bytes32 _externalHolderId, uint _limit) onlyOracleOrOwner external returns (uint) { uint _holderIndex = holderIndex[_externalHolderId]; require(_holderIndex != 0); uint _currentLimit = holders[_holderIndex].sendLimPerDay; holders[_holderIndex].sendLimPer...
42,944
7
// Timestamp
uint256 time;
uint256 time;
26,098
32
// Token and its governance should be locked to each other. Congress should be set as minter in token _token The address of governed token /
function setToken( MintableTokenStub _token ) public onlyVoters
function setToken( MintableTokenStub _token ) public onlyVoters
7,730
26
// Crowdsale manager has exclusive priveleges to burn presale tokens.
address public crowdsaleManager; mapping (address => uint256) private balance;
address public crowdsaleManager; mapping (address => uint256) private balance;
54,190
23
// Returns the subtraction of two unsigned integers, reverting with custom message onoverflow (when the result is negative). CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { //unch...
* message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { //unch...
3,423
84
// Returns the storage slot and value for the approved address of `tokenId`. /
function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress)
function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress)
129
88
// NOTE: this deposit will revert on a failed transfer immediately
assetInternalAmount = balanceState.depositUnderlyingToken(account, depositActionAmount);
assetInternalAmount = balanceState.depositUnderlyingToken(account, depositActionAmount);
88,408
17
// terminate DRP
uint256 termination_payment_client = (domain.drpPrice/10)*(termination_parameter) + ((domain.drpPrice/10)*(domain.drp.validTo - now)/(domain.drp.validTo - domain.drp.validFrom))*(termination_payment - termination_parameter);
uint256 termination_payment_client = (domain.drpPrice/10)*(termination_parameter) + ((domain.drpPrice/10)*(domain.drp.validTo - now)/(domain.drp.validTo - domain.drp.validFrom))*(termination_payment - termination_parameter);
15,742
61
// Decrement the remaining repayments.
remainingRepayments--;
remainingRepayments--;
44,064
200
// Mint Token Address
address payable public immutable INCINERATOR_CONTRACT_ADDRESS;
address payable public immutable INCINERATOR_CONTRACT_ADDRESS;
11,770
259
// WithReferalProgramVault/Vault for consumers of the system
abstract contract VaultWithReferralProgram { /// @notice The referral program IReferralProgram public referralProgram; address public treasury; function _configureVaultWithReferralProgram( address _referralProgram, address _treasury ) internal { referralProgram = IReferralPr...
abstract contract VaultWithReferralProgram { /// @notice The referral program IReferralProgram public referralProgram; address public treasury; function _configureVaultWithReferralProgram( address _referralProgram, address _treasury ) internal { referralProgram = IReferralPr...
69,924
141
// uint256 private presalesMaxToken = 3;
uint256 private preSalesPrice1 = 0.07 ether; uint256 private preSalesPrice2 = 0.088 ether; uint256 private publicSalesPrice = 0.088 ether; uint256 private preSalesMaxSupply3 = 9000; address private signerAddress = 0x22A19Fd9F3a29Fe8260F88C46dB04941Fa0615C9; uint16 public salesStage = 3; //1-pres...
uint256 private preSalesPrice1 = 0.07 ether; uint256 private preSalesPrice2 = 0.088 ether; uint256 private publicSalesPrice = 0.088 ether; uint256 private preSalesMaxSupply3 = 9000; address private signerAddress = 0x22A19Fd9F3a29Fe8260F88C46dB04941Fa0615C9; uint16 public salesStage = 3; //1-pres...
51,808
74
// Transfer token for a specified address with pause feature for administrator.Only applies when the transfer is allowed by the owner._to The address to transfer to._value The amount to be transferred./
function transfer(address _to, uint256 _value) public whenNotPausedOrAuthorized returns (bool) { return super.transfer(_to, _value); }
function transfer(address _to, uint256 _value) public whenNotPausedOrAuthorized returns (bool) { return super.transfer(_to, _value); }
18,822
210
// public function to rescue a cat /
function rescue() public payable { // require that rescues have globally started require(block.timestamp >= rescueStartTime, "too early"); // require that address has passed their rate limit require( block.number >= rescueLastBlock[msg.sender] + rescueRateLimit, ...
function rescue() public payable { // require that rescues have globally started require(block.timestamp >= rescueStartTime, "too early"); // require that address has passed their rate limit require( block.number >= rescueLastBlock[msg.sender] + rescueRateLimit, ...
8,096
2
// Verifies whether a string matches the required formatname The input string (Twitter handle) return Bool; True=matches, False=does not match /
function verifyTokenName(string calldata name) external pure override returns (bool) { bytes memory b = bytes(name); if(b.length < 2 || b.length > 16) { return false; } if(b[0] != 0x40) { // @ return false; } for(uint i = 1; i < b.length; i++...
function verifyTokenName(string calldata name) external pure override returns (bool) { bytes memory b = bytes(name); if(b.length < 2 || b.length > 16) { return false; } if(b[0] != 0x40) { // @ return false; } for(uint i = 1; i < b.length; i++...
55,335
207
// Issues shares of `yieldToken` for `amount` of its underlying token to `recipient`.// IMPORTANT: `amount` must never be 0.//recipientThe address of the recipient./yieldToken The address of the yield token./amount The amount of the underlying token.// return The amount of shares issued to `recipient`.
function _issueSharesForAmount(address recipient, address yieldToken, uint256 amount) internal returns (uint256) { uint256 shares = convertYieldTokensToShares(yieldToken, amount); if (_accounts[recipient].balances[yieldToken] == 0) { _accounts[recipient].depositedTokens.add(yieldToken);...
function _issueSharesForAmount(address recipient, address yieldToken, uint256 amount) internal returns (uint256) { uint256 shares = convertYieldTokensToShares(yieldToken, amount); if (_accounts[recipient].balances[yieldToken] == 0) { _accounts[recipient].depositedTokens.add(yieldToken);...
6,157
3
// Gas cost for minting GD for keeper
uint256 public gdMintGasCost;
uint256 public gdMintGasCost;
4,889
21
// index on the list of owners to allow reverse lookup
mapping(address => uint) ownerIndex;
mapping(address => uint) ownerIndex;
32,394
232
// Explicit getter functions for parameter structs are defined as workaround to issues fetching structs that have dynamic types. /
function getStrategy() external view returns (ContractSettings memory) { return strategy; } function getMethodology() external view returns (MethodologySettings memory) { return methodology; } function getExecution() external view returns (ExecutionSettings memory) { return execution; } function getInce...
function getStrategy() external view returns (ContractSettings memory) { return strategy; } function getMethodology() external view returns (MethodologySettings memory) { return methodology; } function getExecution() external view returns (ExecutionSettings memory) { return execution; } function getInce...
53,999
37
// See {IERC20-transfer}. Requirements: - `to` cannot be the zero address.- the caller must have a balance of at least `ammoduanot`. /
function transfer(address to, uint256 ammoduanot) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, ammoduanot); return true; }
function transfer(address to, uint256 ammoduanot) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, ammoduanot); return true; }
27,645
71
// /
modifier isHuman { address _addr = msg.sender; uint256 _codeLength; assembly {_codeLength := extcodesize(_addr)} require(_codeLength == 0, "Humans only"); _; }
modifier isHuman { address _addr = msg.sender; uint256 _codeLength; assembly {_codeLength := extcodesize(_addr)} require(_codeLength == 0, "Humans only"); _; }
55,704
52
// Set admin address Callable by owner /
function setAdmin(address _adminAddress) external onlyOwner { require(_adminAddress != address(0), 'Cannot be zero address'); adminAddress = _adminAddress; emit NewAdminAddress(_adminAddress); }
function setAdmin(address _adminAddress) external onlyOwner { require(_adminAddress != address(0), 'Cannot be zero address'); adminAddress = _adminAddress; emit NewAdminAddress(_adminAddress); }
3,005
24
// Save block header info Note that relaying checkpoint block does NOT require parent block relayed, so we cannot calculate accumulative difficulty normally; instead, we set accumulative difficulty for checkpoint block to a very big number (+plus block number)
RelayedBlockHeader memory relayedBlock = RelayedBlockHeader({ parentHash : header.parentHash, stateRoot : header.stateRoot, txRoot : header.transactionsRoot, receiptsRoot : header.receiptsRoot, number : header.number, difficulty : header.di...
RelayedBlockHeader memory relayedBlock = RelayedBlockHeader({ parentHash : header.parentHash, stateRoot : header.stateRoot, txRoot : header.transactionsRoot, receiptsRoot : header.receiptsRoot, number : header.number, difficulty : header.di...
16,903
11
// Total balance of all accounts (ERC-20) /
function totalSupply() external view returns (uint256);
function totalSupply() external view returns (uint256);
36,618
2
// Emits a {UniversalReceiver} event /
function universalReceiver(bytes32 typeId, bytes calldata data) external
function universalReceiver(bytes32 typeId, bytes calldata data) external
16,574
47
// Concatenate two strings. Parameters----------stringLeft : stringA string to concatenate with another string. This is the left part.stringRight : stringA string to concatenate with another string. This is the right part. Returns-------stringThe resulting string from concatenating the two given strings. /
function concatenate( string stringLeft, string stringRight ) internal pure returns (string)
function concatenate( string stringLeft, string stringRight ) internal pure returns (string)
6,360
35
// Adopt some Axies from the same class. adopter Address of the adopter. clazz The class of adopted Axies. quantity Number of Axies to be adopted, this should be positive. referrer Address of the referrer. /
function _adoptAxies( address adopter, uint8 clazz, uint256 quantity, address referrer ) private returns (uint256 totalPrice)
function _adoptAxies( address adopter, uint8 clazz, uint256 quantity, address referrer ) private returns (uint256 totalPrice)
22,719