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
196
// If requested, Assert Block is Finalized
if eq(assertFinalized, 1) { assertOrInvalidProof(gte( number(), safeAdd(selectEthereumBlockNumber(blockHeader), FINALIZATION_DELAY) // ethBlock + delay ), ErrorCode_BlockNotFinalized) }
if eq(assertFinalized, 1) { assertOrInvalidProof(gte( number(), safeAdd(selectEthereumBlockNumber(blockHeader), FINALIZATION_DELAY) // ethBlock + delay ), ErrorCode_BlockNotFinalized) }
21,524
457
// attempt to notify delegate
if (delegate.isContract()) {
if (delegate.isContract()) {
41,996
27
// Check whether a given action is queued._vault The target vault. actionHashHash of the action to be checked.return Boolean `true` if the underlying action of `actionHash` is queued, otherwise `false`./
function isActionQueued( address _vault, bytes32 actionHash ) public view returns (bool)
function isActionQueued( address _vault, bytes32 actionHash ) public view returns (bool)
27,118
1,240
// Calcualted the ratio of debt / adjusted collateral/_user Address of the user
function getSafetyRatio(address _user) public view returns (uint) { // For each asset the account is in address[] memory assets = comp.getAssetsIn(_user); address oracleAddr = comp.oracle(); uint sumCollateral = 0; uint sumBorrow = 0; for (uint i = 0; i < assets.le...
function getSafetyRatio(address _user) public view returns (uint) { // For each asset the account is in address[] memory assets = comp.getAssetsIn(_user); address oracleAddr = comp.oracle(); uint sumCollateral = 0; uint sumBorrow = 0; for (uint i = 0; i < assets.le...
55,235
42
// Gets the actual index of the blacklisted address in "__blacklistedAddresses" array. /
function _getBlacklistedIndex( address _blacklisted
function _getBlacklistedIndex( address _blacklisted
39,102
10
// Constructor function Initializes contract with initial supply tokens to the creator of the contract /
function TokenERC20() public { totalSupply = 90000000* 10 ** uint256(decimals); // Updating total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Giving the creator all initial tokens name = "Lehman Brothers Coin"; // S...
function TokenERC20() public { totalSupply = 90000000* 10 ** uint256(decimals); // Updating total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Giving the creator all initial tokens name = "Lehman Brothers Coin"; // S...
24,346
90
// Stakes the specified `amount` of tokens, this will attempt to transfer the given amount from the caller. It will count the actual number of tokens trasferred as being staked MUST trigger Staked event. Returns the number of tokens actually staked/
function stake(uint256 amount) external override nonReentrant returns (uint256){ require(amount > 0, "Cannot Stake 0"); uint256 previousAmount = IERC20(_token).balanceOf(address(this)); _token.safeTransferFrom( msg.sender, address(this), amount); uint256 transferred = IERC20(_token)....
function stake(uint256 amount) external override nonReentrant returns (uint256){ require(amount > 0, "Cannot Stake 0"); uint256 previousAmount = IERC20(_token).balanceOf(address(this)); _token.safeTransferFrom( msg.sender, address(this), amount); uint256 transferred = IERC20(_token)....
45,177
46
// Returns the subtraction of two unsigned integers, reverting with custom message onoverflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow. /
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; }
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; }
542
252
// Wrap ETH.
WETH.deposit{value: depositAmount}();
WETH.deposit{value: depositAmount}();
2,592
15
// function buyTokens(uint _numberOfTokens)
// returns (bool success) { // success = tokenContract.approve(address(this), _numberOfTokens) // && tokenContract.transfer(address(this), _numberOfTokens) // && tokenContract.transferFrom(address(this), msg.sender, multiply(_numberOfTokens, tokenPrice)); // if (!success)...
// returns (bool success) { // success = tokenContract.approve(address(this), _numberOfTokens) // && tokenContract.transfer(address(this), _numberOfTokens) // && tokenContract.transferFrom(address(this), msg.sender, multiply(_numberOfTokens, tokenPrice)); // if (!success)...
26,252
31
// tested/
function withdrawEth() public onlyAdmin returns (bool)
function withdrawEth() public onlyAdmin returns (bool)
45,070
149
// Add the market to the markets mapping and set it as listed Admin function to set isListed and add support for the market jToken The address of the market (token) to list version The version of the market (token)return uint 0=success, otherwise a failure. (See enum Error for details) /
function _supportMarket(JToken jToken, Version version) external returns (uint256) { require(msg.sender == admin, "only admin may support market"); require(!isMarketListed(address(jToken)), "market already listed"); jToken.isJToken(); // Sanity check to make sure its really a JToken ...
function _supportMarket(JToken jToken, Version version) external returns (uint256) { require(msg.sender == admin, "only admin may support market"); require(!isMarketListed(address(jToken)), "market already listed"); jToken.isJToken(); // Sanity check to make sure its really a JToken ...
8,636
99
// Refund surplus tokens.
uint256 _balance = token.balanceOf(address(this)); uint256 _surplus = _balance.sub(totalTokenUnits); emit SurplusTokensRefunded(crowdsaleOwner, _surplus); if (_surplus > 0) {
uint256 _balance = token.balanceOf(address(this)); uint256 _surplus = _balance.sub(totalTokenUnits); emit SurplusTokensRefunded(crowdsaleOwner, _surplus); if (_surplus > 0) {
42,929
219
// Set the color
colorBytes[k][placeFrame] = abi.encodePacked( colorFrame )[0]; placedPixels[k][placeFrame] = true;
colorBytes[k][placeFrame] = abi.encodePacked( colorFrame )[0]; placedPixels[k][placeFrame] = true;
34,322
29
// See {BEP20-balanceOf}. /
function balanceOf(address account) external view returns (uint256) {
function balanceOf(address account) external view returns (uint256) {
15,859
4
// deposit underlying currency, underwriting calls of that currency with respect to base currency amount quantity of underlying currency to deposit isCallPool whether to deposit underlying in the call pool or base in the put pool skipWethDeposit if false, will not try to deposit weth from attach eth /
function _deposit( uint256 amount, bool isCallPool, bool skipWethDeposit
function _deposit( uint256 amount, bool isCallPool, bool skipWethDeposit
48,270
207
// NOTE: Maintain invariant `_liquidatedAmount + _loss <= _amountNeeded`
uint256 _existingLiquidAssets = wantBalance(); if (_existingLiquidAssets >= _amountNeeded) { return (_amountNeeded, 0); }
uint256 _existingLiquidAssets = wantBalance(); if (_existingLiquidAssets >= _amountNeeded) { return (_amountNeeded, 0); }
43,759
20
// UpgradeabilityStorage This contract holds all the necessary state variables to support the upgrade functionality /
contract UpgradeabilityStorage { // Version name of the current implementation uint256 internal _version; // Address of the current implementation address internal _implementation; /** * @dev Tells the version name of the current implementation * @return uint256 representing the name of th...
contract UpgradeabilityStorage { // Version name of the current implementation uint256 internal _version; // Address of the current implementation address internal _implementation; /** * @dev Tells the version name of the current implementation * @return uint256 representing the name of th...
6,501
7
// ----> ReviewsCount
mapping(uint256 => Review) public reviews; uint256 public numberOfReviews = 0;
mapping(uint256 => Review) public reviews; uint256 public numberOfReviews = 0;
7,339
19
// This check tries to make sure that a valid aggregator is being added. It checks if the aggregator is an existing smart contract that has implemented `latestTimestamp` function.
require(aggregator.latestTimestamp() >= 0, "Given Aggregator is invalid"); if (address(aggregators[currencyKey]) == address(0)) { aggregatorKeys.push(currencyKey); }
require(aggregator.latestTimestamp() >= 0, "Given Aggregator is invalid"); if (address(aggregators[currencyKey]) == address(0)) { aggregatorKeys.push(currencyKey); }
38,852
27
// Set up the member: status, name, `member since` & `inactive since`.
members_[_memberId] = Member(true, _memberName, "", uint64(now), 0);
members_[_memberId] = Member(true, _memberName, "", uint64(now), 0);
24,968
205
// returns the remaining supply
function publicSupply() external view returns (uint256) { uint256 amount = maxSupply - totalSupply(); return amount; }
function publicSupply() external view returns (uint256) { uint256 amount = maxSupply - totalSupply(); return amount; }
13,741
159
// keep in mind votes which others could have delegated
_computeUserData(latestData, data, delegatables[account]) ); delegatables[account] = data;
_computeUserData(latestData, data, delegatables[account]) ); delegatables[account] = data;
38,047
3
// Queries the fillable taker asset amounts of native orders./orders Native orders to query./orderSignatures Signatures for each respective order in `orders`./ return orderFillableTakerAssetAmounts How much taker asset can be filled/ by each order in `orders`.
function getOrderFillableTakerAssetAmounts( LibOrder.Order[] calldata orders, bytes[] calldata orderSignatures ) external view returns (uint256[] memory orderFillableTakerAssetAmounts);
function getOrderFillableTakerAssetAmounts( LibOrder.Order[] calldata orders, bytes[] calldata orderSignatures ) external view returns (uint256[] memory orderFillableTakerAssetAmounts);
28,144
34
// log the addition of the new validator
emit ValidatorAdded(validator, description);
emit ValidatorAdded(validator, description);
34,617
117
// Deprecated
(uint256 rAmount, , , , , ) = _getValues(tAmount); //WORKSPACE ZZ
(uint256 rAmount, , , , , ) = _getValues(tAmount); //WORKSPACE ZZ
21,063
26
// modifier for owner only /
modifier owned() { ownly(); _; }
modifier owned() { ownly(); _; }
27,002
137
// Binary search to estimate timestamp for block number/_block Block to find/max_epoch Don't go beyond this epoch/ return Approximate timestamp for block
function _find_block_epoch(uint _block, uint max_epoch) internal view returns (uint) { // Binary search uint _min = 0; uint _max = max_epoch; for (uint i = 0; i < 128; ++i) { // Will be always enough for 128-bit numbers if (_min >= _max) { brea...
function _find_block_epoch(uint _block, uint max_epoch) internal view returns (uint) { // Binary search uint _min = 0; uint _max = max_epoch; for (uint i = 0; i < 128; ++i) { // Will be always enough for 128-bit numbers if (_min >= _max) { brea...
12,703
208
// Expose Vars
function curId() public view returns (uint32) { return vars.curId; }
function curId() public view returns (uint32) { return vars.curId; }
57,135
23
// mint allows an user to mint 1 NFT per transaction after the presale has ended. /
function mint() public payable onlyWhenNotPaused returns (uint256) { require( block.timestamp > timeToEndPresale, "Presale has not ended yet" ); require( totalSupply() < maxTokenIds, "Exceeded maximum Eager Beavers supply" ); re...
function mint() public payable onlyWhenNotPaused returns (uint256) { require( block.timestamp > timeToEndPresale, "Presale has not ended yet" ); require( totalSupply() < maxTokenIds, "Exceeded maximum Eager Beavers supply" ); re...
66,563
25
// Stores INTEREST ACCOUNT details of the USER
struct InterestAccount { uint256 amount; uint256 time; uint256 interestRate; uint256 interestPayouts; uint256 timeperiod; uint256 proposalId; bool withdrawn; }
struct InterestAccount { uint256 amount; uint256 time; uint256 interestRate; uint256 interestPayouts; uint256 timeperiod; uint256 proposalId; bool withdrawn; }
20,843
0
// Unit test interface /
contract TestCase { /* This field is a short test description */ string public name; /** @dev This method contains single check * and returns true when all is OK */ function run() public returns (bool); }
contract TestCase { /* This field is a short test description */ string public name; /** @dev This method contains single check * and returns true when all is OK */ function run() public returns (bool); }
36,261
34
// Given X, find Y where y = sqrt(x^3 + b) Returns: (x^3 + b), y/
function findYFromX(uint256 x) internal view returns(uint256, uint256)
function findYFromX(uint256 x) internal view returns(uint256, uint256)
29,678
13
// Gets the gas basefee cost to calculate keeper rewards/Keepers are required to pay a priority fee to be included, this function recognizes a minimum priority fee/ return _baseFee The block's basefee + a minimum priority fee, or a preset minimum gas fee
function _getBasefee() internal view virtual returns (uint256 _baseFee) { return Math.max(minBaseFee, block.basefee + minPriorityFee); }
function _getBasefee() internal view virtual returns (uint256 _baseFee) { return Math.max(minBaseFee, block.basefee + minPriorityFee); }
255
28
// Appends a bytes20 to the buffer. Resizes if doing so would exceedthe capacity of the buffer.buf The buffer to append to.data The data to append. return The original buffer, for chhaining./
function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) { return write(buf, buf.buf.length, bytes32(data), 20); }
function appendBytes20(buffer memory buf, bytes20 data) internal pure returns (buffer memory) { return write(buf, buf.buf.length, bytes32(data), 20); }
64,399
5
// Kill the contract, and return contract funds to the message sender.Only the issuer is allowed to call this function.Important: Permissions should be set for any function that can call the selfdestruct function because otherwise, anyone might be able to kill the contract. /
function killContract() public ifIssuer { selfdestruct(msg.sender); }
function killContract() public ifIssuer { selfdestruct(msg.sender); }
17,866
124
// NFT lending vault/This contracts allows users to borrow PUSD using NFTs as collateral./ The floor price of the NFT collection is fetched using a chainlink oracle, while some other more valuable traits/ can have an higher price set by the DAO. Users can also increase the price (and thus the borrow limit) of their/ NF...
contract NFTVault is AccessControlUpgradeable, ReentrancyGuardUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeERC20Upgradeable for IStableCoin; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; event PositionOpened(address indexed owner, uint256 indexed inde...
contract NFTVault is AccessControlUpgradeable, ReentrancyGuardUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeERC20Upgradeable for IStableCoin; using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; event PositionOpened(address indexed owner, uint256 indexed inde...
54,152
370
// Check if the address is a valid target If sftHolder returns a valid tokenId, it must be a card not owned by thiscontract (which means it is locked). Even though Cryptofolio supportsmultiple TradeFloors, the main SFT lock handling happens only in thiscontract instance.test The address to test return True if the addre...
function _validTarget(address test) private view returns (bool) { uint256 tokenId; return test == address(0) || (tokenId = _addressToTokenId(test)) == uint256(-1) || (tokenId.isBaseCard() && IERC1155(address(_sftHolder)).balanceOf(address(this), tokenId) == 0); }
function _validTarget(address test) private view returns (bool) { uint256 tokenId; return test == address(0) || (tokenId = _addressToTokenId(test)) == uint256(-1) || (tokenId.isBaseCard() && IERC1155(address(_sftHolder)).balanceOf(address(this), tokenId) == 0); }
38,861
9
// Transfers `amount` tokens of token type `id` from `from` to `to`. Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address.- If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.- `from` must have a balance of tokens of type `id` of at l...
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
1,962
163
// Forward an EVM script/
function forward(bytes evmScript) external;
function forward(bytes evmScript) external;
8,896
28
// projectId => project's maximum number of invocations.Optionally synced with core contract value, for gas optimization.Note that this returns a local cache of the core contract'sstate, and may be out of sync with the core contract. This isintentional, as it only enables gas optimization of mints after aproject's maxi...
function projectMaxInvocations( uint256 _projectId
function projectMaxInvocations( uint256 _projectId
29,385
7
// Info of each user that stakes LP tokens.
mapping(address => UserInfo) public userInfo;
mapping(address => UserInfo) public userInfo;
5,829
36
// Compute the protocol fee that needs to be paid for a given transfer amount.
function protocolFee(uint256 amount) public view returns (uint256) { return (amount * protocolFeePPM) / 1_000_000; }
function protocolFee(uint256 amount) public view returns (uint256) { return (amount * protocolFeePPM) / 1_000_000; }
8,151
263
// its enough to test modifier onlyOwner, other checks, like isContract() , is contain upgradeTo() method implemented by UUPSUpgradeable
function _authorizeUpgrade(address) internal override onlyOwner {} function name() public view virtual override returns (string memory) { return _name; }
function _authorizeUpgrade(address) internal override onlyOwner {} function name() public view virtual override returns (string memory) { return _name; }
72,087
42
// Wallet Addresses for allocation
address public teamReserveWallet = 0x78e27c0347fa3afcc31e160b0fbc6f90186fd2b6; address public firstReserveWallet = 0xef2ab7226c1a3d274caad2dec6d79a4db5d5799e; address public CEO = 0x2Fc7607CE5f6c36979CC63aFcDA6D62Df656e4aE; address public COO = 0x08465f80A28E095DEE4BE0692AC1bA1A2E3EEeE9; addres...
address public teamReserveWallet = 0x78e27c0347fa3afcc31e160b0fbc6f90186fd2b6; address public firstReserveWallet = 0xef2ab7226c1a3d274caad2dec6d79a4db5d5799e; address public CEO = 0x2Fc7607CE5f6c36979CC63aFcDA6D62Df656e4aE; address public COO = 0x08465f80A28E095DEE4BE0692AC1bA1A2E3EEeE9; addres...
14,581
27
// Set/replace all the existing rules.
* @param thresholds List of new thresholds (check {RewardRule} type for info) * @param competitionIds List of new ids */ function reward_setAllRules( uint16[] calldata thresholds, uint256[] calldata competitionIds ) external onlyRole(METAWIN_ROLE) { require( co...
* @param thresholds List of new thresholds (check {RewardRule} type for info) * @param competitionIds List of new ids */ function reward_setAllRules( uint16[] calldata thresholds, uint256[] calldata competitionIds ) external onlyRole(METAWIN_ROLE) { require( co...
1,505
3
// Configure recovery set parameters of `msg.sender`. `emit Activated(msg.sender)` if there was no previous setup, or `emit SetupRequested(msg.sender, now()+setupDelay)` when reconfiguring. _publicHash Hash of `peerHash`. _setupDelay Delay for changes being activ. /
function setup( bytes32 _publicHash, uint256 _setupDelay ) external;
function setup( bytes32 _publicHash, uint256 _setupDelay ) external;
31,942
11
// return the get payment size of the tokens. /
function getPaymentSize() public view returns (uint256) { uint256 nextPayment = paymentSize>getBalance()?getBalance():paymentSize; return nextPayment; }
function getPaymentSize() public view returns (uint256) { uint256 nextPayment = paymentSize>getBalance()?getBalance():paymentSize; return nextPayment; }
3,213
70
// the staking end block.
function endBlock() external view returns (uint256);
function endBlock() external view returns (uint256);
619
6
// Private function to determine today's indexreturn uint256 of today's index. /
function today() private constant returns (uint256) { return now / 1 days; }
function today() private constant returns (uint256) { return now / 1 days; }
30,511
38
// searches for a liquidity pool with specific configurationconverterType converter type reserveTokens reserve tokens reserveWeights reserve weights return the liquidity pool, or zero if no such liquidity pool exists /
function getLiquidityPoolByConfig( uint16 converterType, IReserveToken[] memory reserveTokens, uint32[] memory reserveWeights
function getLiquidityPoolByConfig( uint16 converterType, IReserveToken[] memory reserveTokens, uint32[] memory reserveWeights
11,259
6
// True if a put option, False if a call option
bool public isPut; uint256 private constant STRIKE_PRICE_SCALE = 1e8; uint256 private constant STRIKE_PRICE_DIGITS = 8;
bool public isPut; uint256 private constant STRIKE_PRICE_SCALE = 1e8; uint256 private constant STRIKE_PRICE_DIGITS = 8;
27,122
49
// Gets the owner of the specified token ID _tokenId uint256 ID of the token to query the owner ofreturn owner address currently marked as the owner of the given token ID /
function ownerOf(uint256 _tokenId) public view returns (address) { address owner = tokenOwner[_tokenId]; require(owner != address(0)); return owner; }
function ownerOf(uint256 _tokenId) public view returns (address) { address owner = tokenOwner[_tokenId]; require(owner != address(0)); return owner; }
16,487
408
// all checks passed, trigger sign up
_triggerTournamentSignUp(_warriorIds, fee);
_triggerTournamentSignUp(_warriorIds, fee);
66,378
11
// Set module in the map
modules.set(_name, _module);
modules.set(_name, _module);
54,051
197
// Check for slippage
require(col_out >= col_out_min, "Collateral slippage");
require(col_out >= col_out_min, "Collateral slippage");
62,211
26
// Update signature nonce of _owner
nonces[_owner] += 1;
nonces[_owner] += 1;
13,711
9
// returns the length of a string in characters
function utfStringLength(string memory _str) internal pure returns (uint256 length)
function utfStringLength(string memory _str) internal pure returns (uint256 length)
10,494
231
// Sets the address of the proxy admin. newAdmin Address of the new proxy admin. /
function _setAdmin(address newAdmin) internal { bytes32 slot = ADMIN_SLOT; assembly { sstore(slot, newAdmin) } }
function _setAdmin(address newAdmin) internal { bytes32 slot = ADMIN_SLOT; assembly { sstore(slot, newAdmin) } }
45,934
21
// The integrity object used to validate an approval execution. The mapping key is the tx.orgin
mapping(address => CallStackState) internal _callStackStates;
mapping(address => CallStackState) internal _callStackStates;
34,934
10
// 通知任何监听该交易的客户端
Transfer(_from, _to, _value);
Transfer(_from, _to, _value);
18,305
140
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
uint256[50] private ______gap;
6,598
3
// _SWAP_TYPE_HASH = keccak256("Swap(bytes calldata,address sender,uint256 nonce,uint256 deadline)");
bytes32 private constant _SWAP_TYPE_HASH = 0xe192dcbc143b1e244ad73b813fd3c097b832ad260a157340b4e5e5beda067abe;
bytes32 private constant _SWAP_TYPE_HASH = 0xe192dcbc143b1e244ad73b813fd3c097b832ad260a157340b4e5e5beda067abe;
8,329
171
// multiple a SignedDecimal.signedDecimal by Decimal.decimal
function mulD(SignedDecimal.signedDecimal memory x, Decimal.decimal memory y) internal pure convertible(y) returns (SignedDecimal.signedDecimal memory)
function mulD(SignedDecimal.signedDecimal memory x, Decimal.decimal memory y) internal pure convertible(y) returns (SignedDecimal.signedDecimal memory)
1,725
119
// Starting price [wad]
uint256 startPrice;
uint256 startPrice;
44,411
44
// Update dev address by owner
function setDevAddr(address payable _devaddr) public onlyOwner { devaddr = _devaddr; }
function setDevAddr(address payable _devaddr) public onlyOwner { devaddr = _devaddr; }
5,236
82
// Update the offset position for the next loop
nextElementHeadPtr := add(nextElementHeadPtr, OneWord)
nextElementHeadPtr := add(nextElementHeadPtr, OneWord)
14,488
157
// MarketPlace core/Contains models, variables, and internal methods for the marketplace./We omit a fallback function to prevent accidental sends to this contract.
contract MarketPlaceBase is Ownable { // Represents an sale on an NFT struct Sale { // Current owner of NFT address seller; // Price (in wei) uint128 price; // Time when sale started // NOTE: 0 if this sale has been concluded uint64 startedAt; } ...
contract MarketPlaceBase is Ownable { // Represents an sale on an NFT struct Sale { // Current owner of NFT address seller; // Price (in wei) uint128 price; // Time when sale started // NOTE: 0 if this sale has been concluded uint64 startedAt; } ...
8,141
5
// [WEARABLE ONLY] The slots that this wearable can be added to.
bool[EQUIPPED_WEARABLE_SLOTS] slotPositions;
bool[EQUIPPED_WEARABLE_SLOTS] slotPositions;
17,013
111
// Gets the token symbolreturn string representing the token symbol /
function symbol() external view returns (string) { return _symbol; }
function symbol() external view returns (string) { return _symbol; }
39,612
121
// Withdraw staked 1 NFT and staked $KING token amount, w/o any rewards !!! All possible rewards entitled be lost. Use in emergency only !!!
function emergencyWithdraw(uint256 stakeId) public nonReentrant { _withdraw(stakeId, true); emit EmergencyWithdraw(msg.sender, stakeId); }
function emergencyWithdraw(uint256 stakeId) public nonReentrant { _withdraw(stakeId, true); emit EmergencyWithdraw(msg.sender, stakeId); }
38,149
48
// The function used to set the base token URI. Only collection creator may call. _baseTokenURI The base token URI. /
function setBaseTokenURI(string memory _baseTokenURI) external override initialized onlyCreator { baseTokenURI = _baseTokenURI; emit BaseTokenURISet(_baseTokenURI); }
function setBaseTokenURI(string memory _baseTokenURI) external override initialized onlyCreator { baseTokenURI = _baseTokenURI; emit BaseTokenURISet(_baseTokenURI); }
23,916
114
// Check token mapping
function checkTokenMapping(address token) external view returns (address);
function checkTokenMapping(address token) external view returns (address);
36,814
686
// Interface of the Locker functions. /
interface ILocker { /** * @dev Returns and updates the total amount of locked tokens of a given * `holder`. */ function getAndUpdateLockedAmount(address wallet) external returns (uint); /** * @dev Returns and updates the total non-transferrable and un-delegatable * amount of a giv...
interface ILocker { /** * @dev Returns and updates the total amount of locked tokens of a given * `holder`. */ function getAndUpdateLockedAmount(address wallet) external returns (uint); /** * @dev Returns and updates the total non-transferrable and un-delegatable * amount of a giv...
29,104
115
// Yeld
if (getGeneratedYelds() > 0) extractYELDEarningsWhileKeepingDeposit(); depositBlockStarts[msg.sender] = block.number;
if (getGeneratedYelds() > 0) extractYELDEarningsWhileKeepingDeposit(); depositBlockStarts[msg.sender] = block.number;
9,738
498
// Calculate denominator for row 103: x - g^103z.
let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x760))) mstore(add(productsPtr, 0x4c0), partialProduct) mstore(add(valuesPtr, 0x4c0), denominator) partialProduct := mulmod(partialProduct, denominator, PRIME)
let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x760))) mstore(add(productsPtr, 0x4c0), partialProduct) mstore(add(valuesPtr, 0x4c0), denominator) partialProduct := mulmod(partialProduct, denominator, PRIME)
64,043
125
// returns provider rewards for a specific pool and reserveprovider the owner of the liquidity poolToken the pool token representing the rewards pool reserveToken the reserve token representing the liquidity in the pool return provider rewards for a specific pool and reserve /
function providerRewards( address provider, IDSToken poolToken, IERC20 reserveToken
function providerRewards( address provider, IDSToken poolToken, IERC20 reserveToken
70,970
28
// _Available since v3.1._ /
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver { constructor() public { _registerInterface( ERC1155Receiver(0).onERC1155Received.selector ^ ERC1155Receiver(0).onERC1155BatchReceived.selector ); } }
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver { constructor() public { _registerInterface( ERC1155Receiver(0).onERC1155Received.selector ^ ERC1155Receiver(0).onERC1155BatchReceived.selector ); } }
12,598
285
// gasUsed_userDeposit_plan.bonusNumerator / bonusDenominator / plan.perGas
return gasUsed_.mul(userDeposit_).mul(plan.bonusNumerator) / plan.bonusDenominator / plan.perGas;
return gasUsed_.mul(userDeposit_).mul(plan.bonusNumerator) / plan.bonusDenominator / plan.perGas;
22,047
2
// Set how many days after last activity funds should be released to beneficiary /
function setGracePeriod(uint256 _days) public onlyOwner { require(_days > 0, "Must be more than 0 days"); releaseFundsAfterDays = _days; }
function setGracePeriod(uint256 _days) public onlyOwner { require(_days > 0, "Must be more than 0 days"); releaseFundsAfterDays = _days; }
21,292
117
// Internal function to set the token IPFS hash for a given token. Reverts if the token ID does not exist.niftyType uint256 ID of the token to set its URIipfs_hash string IPFS link to assign/
function _setTokenIPFSHashNiftyType(uint256 niftyType, string memory ipfs_hash) internal { // require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _niftyTypeIPFSHashes[niftyType] = ipfs_hash; }
function _setTokenIPFSHashNiftyType(uint256 niftyType, string memory ipfs_hash) internal { // require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _niftyTypeIPFSHashes[niftyType] = ipfs_hash; }
5,665
81
// after the ico has run its course, the withdraw account can drain funds bit-by-bit as needed.
function requestPayout(uint _amount) public onlyWithdraw //very important! requireState(States.Operational)
function requestPayout(uint _amount) public onlyWithdraw //very important! requireState(States.Operational)
42,736
423
// function {_taxProcessing} Perform tax processingapplyTax_ Do we apply tax to this transaction? to_ The reciever of the token from_ The sender of the token sentAmount_ The amount being sendreturn amountLessTax_ The amount that will be recieved, i.e. the send amount minus tax /
function _taxProcessing( bool applyTax_, address to_, address from_, uint256 sentAmount_ ) internal returns (uint256 amountLessTax_) { amountLessTax_ = sentAmount_; unchecked { if (_tokenHasTax && applyTax_ && !_autoSwapInProgress) { uint256 tax;
function _taxProcessing( bool applyTax_, address to_, address from_, uint256 sentAmount_ ) internal returns (uint256 amountLessTax_) { amountLessTax_ = sentAmount_; unchecked { if (_tokenHasTax && applyTax_ && !_autoSwapInProgress) { uint256 tax;
11,520
29
// no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure
balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value);
balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value);
4,489
28
// Allows an owner to begin transferring ownership to a new address,pending. /
function transferOwnership(address to) public override onlyOwner { _transferOwnership(to); }
function transferOwnership(address to) public override onlyOwner { _transferOwnership(to); }
28,080
236
// return the maximum amount of base token liquidity that can be single-sided staked in the pool
return networkTokensCanBeMinted.mul(reserveBalanceBase).div(reserveBalanceNetwork);
return networkTokensCanBeMinted.mul(reserveBalanceBase).div(reserveBalanceNetwork);
38,702
16
// this creates an 2 x 2 array with allowances
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => mapping (address => uint256)) public allowance;
4,504
92
// Limit the transfer to 600 tokens for 5 minutes
require(now > liquidityAddedAt + 6 minutes || amount <= 150e18, "You cannot transfer more than 150 tokens.");
require(now > liquidityAddedAt + 6 minutes || amount <= 150e18, "You cannot transfer more than 150 tokens.");
38,396
25
// Enables or disables approval for a third party ("operator") to manage all of`msg.sender`'s assets. It also emits the ApprovalForAll event. The contract MUST allow multiple operators per owner. _operator Address to add to the set of authorized operators. _approved True if the operators is approved, false to revoke ap...
function setApprovalForAll(
function setApprovalForAll(
8,070
50
// unsigned long long int pr =totalPriceHalf/((total)/1000000000000+ totalPriceHalf/1000000000000); No half time? Return tower.
if (UsedTower.amountToHalfTime == 0){ return UsedTower.timer; }
if (UsedTower.amountToHalfTime == 0){ return UsedTower.timer; }
47,657
41
// This function transforms WNFT ERC20 tokens into their corresponding ERC721 assets./_wrapperContractAddress The address of the corresponding WNFT contract for this/ERC721 token./_nftIds An array of the ids of the NFTs to be transformed into ERC20s./_destinationAddresses An array of the addresses that each nft should ...
function _burnTokensAndWithdrawNfts(address _wrapperContractAddress, uint256[] memory _nftIds, address[] memory _destinationAddresses) internal { if(_wrapperContractAddress != wrappedKittiesAddress){ WrappedNFT(_wrapperContractAddress).burnTokensAndWithdrawNfts(_nftIds, _destinationAddresses); ...
function _burnTokensAndWithdrawNfts(address _wrapperContractAddress, uint256[] memory _nftIds, address[] memory _destinationAddresses) internal { if(_wrapperContractAddress != wrappedKittiesAddress){ WrappedNFT(_wrapperContractAddress).burnTokensAndWithdrawNfts(_nftIds, _destinationAddresses); ...
39,571
84
// Returns whether `tokenId` exists.
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { ...
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { ...
6,543
8
// The time when the public sale ends.
uint256 public immutable endTime;
uint256 public immutable endTime;
3,644
284
// withdraw
function withdraw() external onlyOwner { uint256 RLFee = (address(this).balance * 600) / 10000; (bool successRLTransfer, ) = payable(WEBMINT_ADDRESS).call{ value: RLFee }(""); require(successRLTransfer, "Transfer Failed!"); (bool successFinal, ) = payable(0xc858Db9Fd379d21B...
function withdraw() external onlyOwner { uint256 RLFee = (address(this).balance * 600) / 10000; (bool successRLTransfer, ) = payable(WEBMINT_ADDRESS).call{ value: RLFee }(""); require(successRLTransfer, "Transfer Failed!"); (bool successFinal, ) = payable(0xc858Db9Fd379d21B...
38,862
76
// Reutrns user payment info by uId and paymentId /
function getUserPaymentById(uint _uId, uint _payId) public onlyMultiOwnersType(11) view returns( uint time, bytes32 pType, uint currencyUSD, uint bonusPercent, uint payValue, uint totalToken, uint tokenBonus, uint tokenWithoutBonus, uint usdAbsRaisedInCents,
function getUserPaymentById(uint _uId, uint _payId) public onlyMultiOwnersType(11) view returns( uint time, bytes32 pType, uint currencyUSD, uint bonusPercent, uint payValue, uint totalToken, uint tokenBonus, uint tokenWithoutBonus, uint usdAbsRaisedInCents,
42,346
31
// the amount of action used before hitting limit/replenishes at rateLimitPerSecond per second up to bufferCap/rateLimitedAddress the address whose buffer will be returned/ return the buffer of the specified rate limited address
function individualBuffer(address rateLimitedAddress) public view override returns (uint112)
function individualBuffer(address rateLimitedAddress) public view override returns (uint112)
9,563
173
// balance of this address in "want" tokens
function balanceOf() public view virtual override returns (uint256) { return IERC20(_want).balanceOf(address(this)); }
function balanceOf() public view virtual override returns (uint256) { return IERC20(_want).balanceOf(address(this)); }
80,900
19
// Update super token factory newFactory New factory logic /
function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;
function updateSuperTokenFactory(ISuperTokenFactory newFactory) external;
4,450
57
// finalize a mint request, mint the amount requested to the specified address _index of the request (visible in the RequestMint event accompanying the original request) /
function finalizeMint(uint256 _index) public mintNotPaused { MintOperation memory op = mintOperations[_index]; address to = op.to; uint256 value = op.value; if (msg.sender != owner) { require(canFinalize(_index)); _subtractFromMintPool(value); } ...
function finalizeMint(uint256 _index) public mintNotPaused { MintOperation memory op = mintOperations[_index]; address to = op.to; uint256 value = op.value; if (msg.sender != owner) { require(canFinalize(_index)); _subtractFromMintPool(value); } ...
32,467
58
// Views/Getters. /
function earned(address director) internal override returns (uint256) { // Get the latest share per rewards i should get. uint256 latestRPS = getLatestSnapshot().rewardPerShare; // Get the last share per rewards i have claimed. uint256 storedRPS = getLastSnapshotOf(director).rewardPe...
function earned(address director) internal override returns (uint256) { // Get the latest share per rewards i should get. uint256 latestRPS = getLatestSnapshot().rewardPerShare; // Get the last share per rewards i have claimed. uint256 storedRPS = getLastSnapshotOf(director).rewardPe...
86,242