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
36
// _receiver:作者授权的经销商账户,_goodsId:作品ID,_goodsNum:作品的数量判断一个经销商是否已经注册
if(!isDealerAlreadyRegister(_receiver)){
if(!isDealerAlreadyRegister(_receiver)){
42,502
153
// transfer all exchange staked money to passport owner
uint256 val = exchange.dataRequesterValue.add(exchange.passportOwnerValue); require(exchange.passportOwner.send(val)); _decOpenPrivateDataExchangesCount(); emit PrivateDataExchangeClosed(_exchangeIdx);
uint256 val = exchange.dataRequesterValue.add(exchange.passportOwnerValue); require(exchange.passportOwner.send(val)); _decOpenPrivateDataExchangesCount(); emit PrivateDataExchangeClosed(_exchangeIdx);
81,999
119
// Whether `a` is greater than `b`. a an int256. b a FixedPoint.Signed.return True if `a > b`, or False. /
function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue > b.rawValue; }
function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue > b.rawValue; }
26,657
16
// ========== WRITE FUNCTIONS ========== // Stake tokens for 90 days _amount the amount of tokens to stake the tokens must be approved to this contract before calling this function /
function stakeNinetyDays(uint256 _amount) external { if (stakingPoolNinety < _amount * aprNinety / 100 / 4) revert NotEnoughTokensIntoStakingPool(); stakingPoolNinety -= _amount * aprNinety / 100 / 4; stakesNinety[msg.sender].unlockTime = block.timestamp + NinetyDaysInSeconds; ...
function stakeNinetyDays(uint256 _amount) external { if (stakingPoolNinety < _amount * aprNinety / 100 / 4) revert NotEnoughTokensIntoStakingPool(); stakingPoolNinety -= _amount * aprNinety / 100 / 4; stakesNinety[msg.sender].unlockTime = block.timestamp + NinetyDaysInSeconds; ...
37,079
27
// Extra safety check to ensure the max supply is not exceeded.
if (_totalMinted() + quantity > maxSupply()) { revert MintQuantityExceedsMaxSupply( _totalMinted() + quantity, maxSupply() ); }
if (_totalMinted() + quantity > maxSupply()) { revert MintQuantityExceedsMaxSupply( _totalMinted() + quantity, maxSupply() ); }
11,831
14
// buy item
item.mintedSupply += amount; _mint(msg.sender, itemId, amount, "");
item.mintedSupply += amount; _mint(msg.sender, itemId, amount, "");
30,063
79
// Check to ensure user is admin and block is not being modifed where a state change has been made.
require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account);
require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account);
70,208
8
// create snapshot
ERC20Snapshot._snapshot();
ERC20Snapshot._snapshot();
13,242
51
// ICO state. /
function InitialPriceEnable() onlyOwner() { preTge = true; }
function InitialPriceEnable() onlyOwner() { preTge = true; }
36,530
0
// /
struct userGame { uint8 Game; uint8 Prize; uint256 GameId; uint8 LuckyNumber; }
struct userGame { uint8 Game; uint8 Prize; uint256 GameId; uint8 LuckyNumber; }
3,989
4
// function to set information of Token sold in Pre-Sale and its rate in Native currency
function setSaleTokenParams( address _saleToken, uint256 _totalTokensforSale
function setSaleTokenParams( address _saleToken, uint256 _totalTokensforSale
28,296
2
// Event triggered when an auction for a collateral asset ends. user The address of the user who owns the collateral asset. collateralAsset The address of the collateral asset for the auction. collateralTokenId The ID of the collateral token for the auction. /
event AuctionEnded( address indexed user, address indexed collateralAsset, uint256 indexed collateralTokenId
event AuctionEnded( address indexed user, address indexed collateralAsset, uint256 indexed collateralTokenId
22,529
55
// confirm there are tokens remaining
uint256 amount = token.balanceOf(this); require(amount > 0);
uint256 amount = token.balanceOf(this); require(amount > 0);
38,921
489
// intermediate_value/ecdsa/signature0/doubling_key/x_squared/ mload(0x4380),/intermediate_value/ecdsa/signature0/doubling_key/x_squared/ mload(0x4380),/intermediate_value/ecdsa/signature0/doubling_key/x_squared/ mload(0x4380),/ecdsa/sig_config.alpha/ mload(0x2c0),/column20_row0/ mload(0x3ae0), Numerator: point^(trace_...
val := mulmod(val, mload(0x4d80), PRIME)
val := mulmod(val, mload(0x4d80), PRIME)
56,778
78
// After migration ends, governance will burn these tokens into the treasury furnace
require(now > migrationEnd, "Too early to move tokens to Treasury Furnace"); lockedToken.safeTransfer(governance(), lockedToken.balanceOf(address(this)));
require(now > migrationEnd, "Too early to move tokens to Treasury Furnace"); lockedToken.safeTransfer(governance(), lockedToken.balanceOf(address(this)));
25,647
7
// If the document is not the last one in the array, swap it with the last one
_docNames[index] = _docNames[_docNames.length - 1]; _docIndexes[_docNames[index]] = index + 1;
_docNames[index] = _docNames[_docNames.length - 1]; _docIndexes[_docNames[index]] = index + 1;
21,322
4
// String comparison
function compareStrings (bytes32 a, bytes32 b) public pure returns (bool) { return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b)))); }
function compareStrings (bytes32 a, bytes32 b) public pure returns (bool) { return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b)))); }
14,763
87
// Amount of reward to be sent to staker
amountWei = rewardsPerEpoch[epoch].mul(percentageInPrecision).div(PRECISION);
amountWei = rewardsPerEpoch[epoch].mul(percentageInPrecision).div(PRECISION);
11,890
267
// Emitted when an account withdraws funds from `RelayHub`. /
event Withdrawn(address indexed account, address indexed dest, uint256 amount);
event Withdrawn(address indexed account, address indexed dest, uint256 amount);
23,668
12
// Decay seedSalt value
uint256 private _seed = 4254618; uint256 constant MODEVALUE = 100;
uint256 private _seed = 4254618; uint256 constant MODEVALUE = 100;
24,611
69
// Event signal: Loyalty contract address waws changed /
event ContractAddressChanged(address indexed _previousAddress, address indexed _newAddress);
event ContractAddressChanged(address indexed _previousAddress, address indexed _newAddress);
56,570
9
// Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.Used in balance queries. owner Address of the current owner of a token. /
error ERC721InvalidOwner(address owner);
error ERC721InvalidOwner(address owner);
13,368
267
// Sets the mint price /
function setMintPrice(uint256 _mintPrice) external onlyOwners { MINT_PRICE = _mintPrice; }
function setMintPrice(uint256 _mintPrice) external onlyOwners { MINT_PRICE = _mintPrice; }
17,795
26
// still need to grant update_role to admin for emergency call
_setupRole(UPDATER_ROLE, _admin); _setConfig(EXPIRATION_PERIOD, MAX_DEVIATION_RATE);
_setupRole(UPDATER_ROLE, _admin); _setConfig(EXPIRATION_PERIOD, MAX_DEVIATION_RATE);
28,088
13
// Withdraws any ERC20 tokens WARNING: Double check token is legit before calling this _token Contract address of token _to Address to which to withdraw _amount Amount to withdraw _hasVerifiedToken Must be true (sanity check) /
function withdrawERC20( address _token, address _to, uint256 _amount, bool _hasVerifiedToken ) external onlyOwner
function withdrawERC20( address _token, address _to, uint256 _amount, bool _hasVerifiedToken ) external onlyOwner
41,268
22
// minigame info
mapping(address => bool) public miniGames;
mapping(address => bool) public miniGames;
14,865
0
// address that is payable to the market owner
address payable MarketOwner;
address payable MarketOwner;
42,428
100
// sumCollateral += tokensToDenomcTokenBalance
vars.sumCollateral = mul_ScalarTruncateAddUInt(vars.tokensToDenom, vars.cTokenBalance, vars.sumCollateral);
vars.sumCollateral = mul_ScalarTruncateAddUInt(vars.tokensToDenom, vars.cTokenBalance, vars.sumCollateral);
37,212
184
// Change takoPerBlock. Can only be called by the owner.
function setRewardPerBlock(uint256 _value, bool _withUpdate) public onlyOwner() { takoPerBlock = _value; if (_withUpdate) { massUpdatePools(); } }
function setRewardPerBlock(uint256 _value, bool _withUpdate) public onlyOwner() { takoPerBlock = _value; if (_withUpdate) { massUpdatePools(); } }
24,827
16
// mapping of application addresses to lists of removed services
mapping (address => uint32[]) servicesRemovedLists;
mapping (address => uint32[]) servicesRemovedLists;
18,587
188
// Assume predefined token supply has been minted and calculate the maximum number of tokens that can be sold
tokenCap = _tokenMaximumSupply.sub(token.totalSupply()); emit LogNokuCustomCrowdsaleCreated(msg.sender, startBlock, endBlock, _wallet);
tokenCap = _tokenMaximumSupply.sub(token.totalSupply()); emit LogNokuCustomCrowdsaleCreated(msg.sender, startBlock, endBlock, _wallet);
19,286
67
// Transfers token from one address to another/NOTE: this function handles tokens that have transfer function not strictly compatible with ERC20 standard/NOTE: call `transferFrom` to this token may return (bool) or nothing/_token Token address/_from Address of sender/_to Address of recipient/_amount Amount of tokens to...
function transferFromERC20( IERC20 _token, address _from, address _to, uint256 _amount
function transferFromERC20( IERC20 _token, address _from, address _to, uint256 _amount
8,905
2
// Sets the fallbackOracle/ - Callable only by the Aave governance/_fallbackOracle The address of the fallbackOracle
function setFallbackOracle(address _fallbackOracle) external onlyOwner { internalSetFallbackOracle(_fallbackOracle); }
function setFallbackOracle(address _fallbackOracle) external onlyOwner { internalSetFallbackOracle(_fallbackOracle); }
18,083
93
// Ensure that the sponsor will meet the min position size after the reduction.
FixedPoint.Unsigned memory newTokenCount = positionData.tokensOutstanding.sub(tokensToRemove); require(newTokenCount.isGreaterThanOrEqual(minSponsorTokens), "Below minimum sponsor position"); positionData.tokensOutstanding = newTokenCount;
FixedPoint.Unsigned memory newTokenCount = positionData.tokensOutstanding.sub(tokensToRemove); require(newTokenCount.isGreaterThanOrEqual(minSponsorTokens), "Below minimum sponsor position"); positionData.tokensOutstanding = newTokenCount;
27,512
1
// The or-choice (true is the first sub-contract, false is the second sub-contract)
bool choice;
bool choice;
44,275
2
// Schedules a withdrawal of Vault shares that will be processed once the round completes
function scheduleWithdraw(uint256 shares) external returns (uint256);
function scheduleWithdraw(uint256 shares) external returns (uint256);
28,481
23
// [BUNNY, WBNB, BUSD, VAI]
path = new address[](4); path[0] = _from; path[1] = WBNB; path[2] = intermediate; path[3] = _to;
path = new address[](4); path[0] = _from; path[1] = WBNB; path[2] = intermediate; path[3] = _to;
42,956
9
// Core: get new condition ID unique for each core.return new condition ID /
function newConditionId() external override onlyCore returns (uint256) { return ++lastConditionId; }
function newConditionId() external override onlyCore returns (uint256) { return ++lastConditionId; }
8,662
79
// Check expiration time. /
function _checkExpiration(uint256 expiration) private view { require(expiration > block.timestamp || expiration == 0, "Expiration date must be greater than block timestamp or zero"); }
function _checkExpiration(uint256 expiration) private view { require(expiration > block.timestamp || expiration == 0, "Expiration date must be greater than block timestamp or zero"); }
7,127
72
// Function to check beneficiary of a vestingreturn Beneficiary's address /
function beneficiary() public view returns (address) { return beneficiaryAddress; }
function beneficiary() public view returns (address) { return beneficiaryAddress; }
53,114
50
// transfer fee to network contract
if (feeInWei > 0) { network.transfer(feeInWei); }
if (feeInWei > 0) { network.transfer(feeInWei); }
22,516
156
// function to migrate old totalLoanAmount and totalLockedAmount from old monetarySupervisor contract
external restrict("StabilityBoard") { totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment); totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment); emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment); }
external restrict("StabilityBoard") { totalLoanAmount = totalLoanAmount.add(totalLoanAmountAdjustment); totalLockedAmount = totalLockedAmount.add(totalLockedAmountAdjustment); emit KPIsAdjusted(totalLoanAmountAdjustment, totalLockedAmountAdjustment); }
14,528
11
// @inheritdoc ICollateralWrapper /
function enumerate( uint256 tokenId, bytes calldata context
function enumerate( uint256 tokenId, bytes calldata context
13,637
48
// Event fired each time an oracle submits a response
event FlightStatusInfo( address airline, string flight, uint256 timestamp, uint8 status ); event OracleReport( address airline, string flight,
event FlightStatusInfo( address airline, string flight, uint256 timestamp, uint8 status ); event OracleReport( address airline, string flight,
5,410
41
// get challenge state
function getChallengeState() public view returns (string memory) { ChallengeState _challengeState = forecastChallengeState(); if (_challengeState == ChallengeState.DRAFT) return "Draft"; if (_challengeState == ChallengeState.RUNNING) return "Open"; if (_challengeState == ChallengeSta...
function getChallengeState() public view returns (string memory) { ChallengeState _challengeState = forecastChallengeState(); if (_challengeState == ChallengeState.DRAFT) return "Draft"; if (_challengeState == ChallengeState.RUNNING) return "Open"; if (_challengeState == ChallengeSta...
496
28
// amount in cents
uint256 amount = msg.value.mul(oracle.price()); uint256 finalAmount= amount.div(1 ether); _mint(msg.sender,finalAmount);
uint256 amount = msg.value.mul(oracle.price()); uint256 finalAmount= amount.div(1 ether); _mint(msg.sender,finalAmount);
34,619
155
// Assets and their assimilators
Assimilator[] assets; mapping(address => Assimilator) assimilators;
Assimilator[] assets; mapping(address => Assimilator) assimilators;
14,978
0
// private variables
Counters.Counter private _wolfCounter; string private _ipfsURI = "https://ipfs.io/ipfs/";
Counters.Counter private _wolfCounter; string private _ipfsURI = "https://ipfs.io/ipfs/";
9,157
0
// mapping to mapping to track whitelisted collateral for covered calls or puts
mapping(bytes32 => bool) internal coveredWhitelistedCollateral;
mapping(bytes32 => bool) internal coveredWhitelistedCollateral;
46,109
63
// Sets {decimals} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Mostapplications that interact with token contracts will not expect{decimals} to ever change, and may work incorrectly if it does. /
function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; }
function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; }
51,238
404
// Current price of GD in `token`. currently only cDAI is supported. _token The desired reserve token to havereturn price of GD /
function currentPrice(ERC20 _token) public view onlyActiveToken(_token) returns (uint256)
function currentPrice(ERC20 _token) public view onlyActiveToken(_token) returns (uint256)
49,588
78
// This method manages SCENARIO 2 and SCENARIO 3/ So when a raffle cannot be fulfilled because either there are no purchases/ or there are only a few players./_raffleId Id of the raffle/_normalizedRandomNumber index of the array that contains the winner of the raffle. Generated by chainlink
function closeRaffleAndRefund( uint256 _raffleId, uint256 _normalizedRandomNumber
function closeRaffleAndRefund( uint256 _raffleId, uint256 _normalizedRandomNumber
7,414
48
// stop playing with yourself
require(msg.sender!=stacks[_stack].owner); bytes32 counterstack = keccak256(nonce++,msg.sender,_id); uint256[5] memory ids = [_id,_id2,_id3,_id4,_id5]; stacks[counterstack] = Stack(ids,msg.sender,uint32(block.number)); stackCounter[counterstack] = _stack;
require(msg.sender!=stacks[_stack].owner); bytes32 counterstack = keccak256(nonce++,msg.sender,_id); uint256[5] memory ids = [_id,_id2,_id3,_id4,_id5]; stacks[counterstack] = Stack(ids,msg.sender,uint32(block.number)); stackCounter[counterstack] = _stack;
50,853
57
// the main public burn function which uses the internal burn function
function burn(address _from,uint256 _value) external returns(uint burnAmount) { _burn(_from,_value); emit dappBurned(msg.sender,_value); return(burnAmount); }
function burn(address _from,uint256 _value) external returns(uint burnAmount) { _burn(_from,_value); emit dappBurned(msg.sender,_value); return(burnAmount); }
71,572
45
// Transfer asset to Strategy and call deposit method to mint or take required action
asset.safeTransfer(address(strategy), allocateAmount); strategy.deposit(address(asset), allocateAmount); emit AssetAllocated( address(asset), depositStrategyAddr, allocateAmount );
asset.safeTransfer(address(strategy), allocateAmount); strategy.deposit(address(asset), allocateAmount); emit AssetAllocated( address(asset), depositStrategyAddr, allocateAmount );
15,396
3
// Doctors
mapping(address=> Doctor) public Doctors;
mapping(address=> Doctor) public Doctors;
30,435
54
// Provide Liquidity
_provideLiquidity(bnbToLiquidity - fees);
_provideLiquidity(bnbToLiquidity - fees);
5,908
38
// Minting
function mint(address[] _recipient, uint256[] _value) public { require(msg.sender == owner); //only owner can claim proposal require(!mintDone); //only during minting //require(_recipient.length == _value.length); //input need to be of same size //we know what we are doing... remove ...
function mint(address[] _recipient, uint256[] _value) public { require(msg.sender == owner); //only owner can claim proposal require(!mintDone); //only during minting //require(_recipient.length == _value.length); //input need to be of same size //we know what we are doing... remove ...
40,393
6
// returns metadata link of tokenid
function tokenURI(uint256 tokenId) public view virtual override returns (string memory)
function tokenURI(uint256 tokenId) public view virtual override returns (string memory)
5,842
79
// Add backend privileges to an address addr address /
function addBackend(address addr) public onlyAdmin
function addBackend(address addr) public onlyAdmin
43,299
62
// set total fee to zero, so owner cannot empty whole contract
totalFee = 0;
totalFee = 0;
9,583
279
// Query if a contract implements an interface, does not check ERC165 support account The address of the contract to query for support of an interface interfaceId The interface identifier, as specified in ERC-165return true if the contract at account indicates support of the interface withidentifier interfaceId, false ...
* with {supportsERC165}. * * Some precompiled contracts will falsely indicate support for a given interface, so caution * should be exercised when using this function. * * Interface identification is specified in ERC-165. */ function supportsERC165InterfaceUnchecked(address accoun...
* with {supportsERC165}. * * Some precompiled contracts will falsely indicate support for a given interface, so caution * should be exercised when using this function. * * Interface identification is specified in ERC-165. */ function supportsERC165InterfaceUnchecked(address accoun...
12,224
30
// modifier Throws if called by any account other than the owner. /
modifier onlyOwner() { require(isOwner(), "Ownable: it is not called by the owner"); _; }
modifier onlyOwner() { require(isOwner(), "Ownable: it is not called by the owner"); _; }
318
304
// intermediate variable for user fee token1 calculation
uint256 public token1PerShareStored;
uint256 public token1PerShareStored;
37,885
7
// total alpha scores staked
uint256 public totalAlphaStaked = 0;
uint256 public totalAlphaStaked = 0;
30,179
469
// Update auction start time
_tokenAuctionStart[newCarId] = now;
_tokenAuctionStart[newCarId] = now;
4,150
107
// The rate is the conversion between wei and the smallest and indivisibletoken unit. So, if you are using a rate of 1 with a ERC20Detailed tokenwith 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK. /
constructor () public Crowdsale(10000, 0xa5824a8f9e997e50B62B5E4130B4605B6D5404Cb, IERC20(0x5DaB961F0Eb447bF53ba01691f42Ff8FE6CCfe40)) { transferOwnership(0xa5824a8f9e997e50B62B5E4130B4605B6D5404Cb); }
constructor () public Crowdsale(10000, 0xa5824a8f9e997e50B62B5E4130B4605B6D5404Cb, IERC20(0x5DaB961F0Eb447bF53ba01691f42Ff8FE6CCfe40)) { transferOwnership(0xa5824a8f9e997e50B62B5E4130B4605B6D5404Cb); }
8,733
17
// sets whether collected fees are autoswapped only callable by owner _enabled bool whether swap is enabled /
function setSwapEnabled(bool _enabled) external virtual onlyOwner { emit SwapEnabledUpdated(_enabled); swapEnabled = _enabled; }
function setSwapEnabled(bool _enabled) external virtual onlyOwner { emit SwapEnabledUpdated(_enabled); swapEnabled = _enabled; }
40,897
70
// Returns the current implementation address. /
function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; }
function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; }
14,555
19
// 市场清单
IMarket[] public marketList;
IMarket[] public marketList;
48,828
57
// Deduct from contributor balance
ContributorRole.allContributors[contributor].balance = ContributorRole.allContributors[contributor].balance.sub(amount); availableWithdrawls[contributor] = availableWithdrawls[contributor].sub(amount);
ContributorRole.allContributors[contributor].balance = ContributorRole.allContributors[contributor].balance.sub(amount); availableWithdrawls[contributor] = availableWithdrawls[contributor].sub(amount);
35,671
163
// LuckyBestBar with Governance.
contract LBCBar is BEP20('LBC Bar', 'LBCBAR') { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } functi...
contract LBCBar is BEP20('LBC Bar', 'LBCBAR') { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } functi...
13,881
240
// Retrieves the domain from a TokenID _tokenId The messagereturn The domain /
function domain(bytes29 _tokenId) internal pure typeAssert(_tokenId, Types.TokenId) returns (uint32)
function domain(bytes29 _tokenId) internal pure typeAssert(_tokenId, Types.TokenId) returns (uint32)
22,374
90
// we know CORE
tokenReserves[CORE] = COREReserves; totalCOREUnitsContributed = totalCOREUnitsContributed.add(_amountContribution); emit Contibution(_amountContribution, msg.sender);
tokenReserves[CORE] = COREReserves; totalCOREUnitsContributed = totalCOREUnitsContributed.add(_amountContribution); emit Contibution(_amountContribution, msg.sender);
45,529
3
// keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
bytes32 private constant _TYPE_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;
bytes32 private constant _TYPE_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;
5,284
51
// Airdrop tracking
uint256 airdrops; uint256 airdrops_received; uint256 last_airdrop;
uint256 airdrops; uint256 airdrops_received; uint256 last_airdrop;
13,921
8
// Remove a staker from the list
function removeStaker(uint index) private { require(index < stakers.length, "Invalid index"); // Move the last element to the index to delete stakers[index] = stakers[stakers.length - 1]; // Remove the last element stakers.pop(); }
function removeStaker(uint index) private { require(index < stakers.length, "Invalid index"); // Move the last element to the index to delete stakers[index] = stakers[stakers.length - 1]; // Remove the last element stakers.pop(); }
26,250
1
// SPDX-License-Identifier: MIT//
abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } }
abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } }
1,443
5
// Returns the largest of two numbers. /
function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; }
function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; }
33,639
7
// Get how many SoulMinter NFTs a certain user owns
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public balanceOf;
9,913
36
// Standard ERC20 tokenImplementation of the basic ERC20 Interface./
contract CityLifePlusToken is ERC20Interface, Pausable { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; /** * @dev Constru...
contract CityLifePlusToken is ERC20Interface, Pausable { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; /** * @dev Constru...
13,673
47
// Send ETH owned by this contract to `_contractOwner`. Can be called by anyone but requires `block.timestamp` > `endOfLockUp`. /
function unlockETH() external { // Verify end of lock-up period. require(block.timestamp > _endOfLockUp, 'Cannot claim yet.'); // Send ETH balance to `_contractOwner`. _contractOwner.transfer(address(this).balance); }
function unlockETH() external { // Verify end of lock-up period. require(block.timestamp > _endOfLockUp, 'Cannot claim yet.'); // Send ETH balance to `_contractOwner`. _contractOwner.transfer(address(this).balance); }
51,702
295
// The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas/ when accessed externally./ return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value/ tick The current tick of the pool, i.e. according to the last tick transition that was run./ This val...
function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol,
function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol,
25,854
13
// transfer funds in
IERC20(depositToken).safeTransferFrom( msg.sender, address(this), finalAmount );
IERC20(depositToken).safeTransferFrom( msg.sender, address(this), finalAmount );
36,068
17
// Protocol calls this function to pay the affiliates rewards to a user (referrer).Affiliates program has 2 kind of rewards:1. x% based on the fee of the token that is traded (in form of the token itself).2. x% based on the fee of the token that is traded (in form of SOV).Both are paid in this function.Actually they ar...
function payTradingFeeToAffiliatesReferrer( address referrer, address trader, address token, uint256 tradingFeeTokenBaseAmount
function payTradingFeeToAffiliatesReferrer( address referrer, address trader, address token, uint256 tradingFeeTokenBaseAmount
10,869
92
// increase pending unstake requests total so we keep track of final stake
uint newPending = staker.pendingUnstakeRequestsTotal[contractAddress].add(requestedAmount); staker.pendingUnstakeRequestsTotal[contractAddress] = newPending;
uint newPending = staker.pendingUnstakeRequestsTotal[contractAddress].add(requestedAmount); staker.pendingUnstakeRequestsTotal[contractAddress] = newPending;
51,829
138
// Emitted when a validator registers. /
event ValidatorRegistered( uint validatorId );
event ValidatorRegistered( uint validatorId );
4,935
151
// Restore the zero slot.
mstore(ZeroSlot, 0)
mstore(ZeroSlot, 0)
17,418
13
// Event for updating auction times.Needs to be before auction starts.
event AuctionTimeUpdated(uint256 startTime, uint256 endTime);
event AuctionTimeUpdated(uint256 startTime, uint256 endTime);
36,756
344
// Upgrades the proxy to a new implementation. newImplementation Address of the new implementation. /
function upgradeTo(address newImplementation) internal { setImplementation(newImplementation); (bool success, bytes memory reason) = newImplementation.delegatecall(abi.encodeWithSignature("initialize()")); require(success, string(reason)); emit Upgraded(newImplementation); }
function upgradeTo(address newImplementation) internal { setImplementation(newImplementation); (bool success, bytes memory reason) = newImplementation.delegatecall(abi.encodeWithSignature("initialize()")); require(success, string(reason)); emit Upgraded(newImplementation); }
21,143
24
// Stores STAKE ACCOUNT details of the USER
struct StakeAccount { uint256 stakedAmount; uint256 time; uint256 interestRate; bool unstaked; }
struct StakeAccount { uint256 stakedAmount; uint256 time; uint256 interestRate; bool unstaked; }
20,842
52
// Update token stake time
* Emits a {UpdateStakeTime} event */ event UpdateStakeTime(uint256 _stakeTime); function updateStakeTime(uint256 _stakeTime) external onlyOwner { stakeTime = _stakeTime; emit UpdateStakeTime(_stakeTime); }
* Emits a {UpdateStakeTime} event */ event UpdateStakeTime(uint256 _stakeTime); function updateStakeTime(uint256 _stakeTime) external onlyOwner { stakeTime = _stakeTime; emit UpdateStakeTime(_stakeTime); }
45,810
48
// Extract basic CBOR properties from input bytes
initialByte = _buffer.readUint8(); majorType = initialByte >> 5; additionalInformation = initialByte & 0x1f;
initialByte = _buffer.readUint8(); majorType = initialByte >> 5; additionalInformation = initialByte & 0x1f;
59,739
277
// Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(addres...
* {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(addres...
37,763
46
// _name = "KP3rBaseV1";_symbol = "Kbase";
_name = "KP3rBaseV1"; _symbol = "Kbase"; _decimals = 18; _totalSupply = 40000000000000000000000; _balances[creator()] = _totalSupply; emit Transfer(address(0), creator(), _totalSupply);
_name = "KP3rBaseV1"; _symbol = "Kbase"; _decimals = 18; _totalSupply = 40000000000000000000000; _balances[creator()] = _totalSupply; emit Transfer(address(0), creator(), _totalSupply);
25,439
28
// Validates a flashloan action. reserve The state of the reserve /
function validateFlashloanSimple(DataTypes.ReserveData storage reserve) internal view { DataTypes.ReserveConfigurationMap memory configuration = reserve.configuration; require(!configuration.getPaused(), Errors.RESERVE_PAUSED); require(configuration.getActive(), Errors.RESERVE_INACTIVE); }
function validateFlashloanSimple(DataTypes.ReserveData storage reserve) internal view { DataTypes.ReserveConfigurationMap memory configuration = reserve.configuration; require(!configuration.getPaused(), Errors.RESERVE_PAUSED); require(configuration.getActive(), Errors.RESERVE_INACTIVE); }
29,772
69
// updateDocumentPoll(): check whether the _proposal has achieved majority,updating the state and sending an event if it hasthis can be called by anyone, because the ecliptic does notneed to be aware of the result
function updateDocumentPoll(bytes32 _proposal) public returns (bool majority)
function updateDocumentPoll(bytes32 _proposal) public returns (bool majority)
3,187
69
// Sell Equivalent tokens (50% of priceLevel) burn the sold tokens
tokenCirculation_ = SafeMath.sub(tokenCirculation_, _tokenAmount); tokenBalanceLedger_[_userId] = SafeMath.sub(tokenBalanceLedger_[_userId], _tokenAmount); uint _dividends = SafeMath.div(_cost, sellFee_); if (tokenCirculation_ > 0) {
tokenCirculation_ = SafeMath.sub(tokenCirculation_, _tokenAmount); tokenBalanceLedger_[_userId] = SafeMath.sub(tokenBalanceLedger_[_userId], _tokenAmount); uint _dividends = SafeMath.div(_cost, sellFee_); if (tokenCirculation_ > 0) {
14,220
403
// the TrustedForwarder singleton we accept calls from. we trust it to verify the caller's signature, and pass the caller's address as last 20 bytes
address internal trustedForwarder;
address internal trustedForwarder;
16,135
21
// Accessor for array length /
function paymentCount() public view returns (uint) { return payments.length; }
function paymentCount() public view returns (uint) { return payments.length; }
11,086