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 |
|---|---|---|---|---|
172 | // See {IERC721Enumerable-tokenByIndex}. / | function tokenByIndex(uint256 index)
public
view
virtual
override
returns (uint256)
{
require(
index < ERC721Enumerable.totalSupply(),
"ERC721Enumerable: global index out of bounds"
| function tokenByIndex(uint256 index)
public
view
virtual
override
returns (uint256)
{
require(
index < ERC721Enumerable.totalSupply(),
"ERC721Enumerable: global index out of bounds"
| 7,734 |
93 | // Remove all fees | function removeAllFee() private {
if(_TotalFee == 0 && _buyFee == 0 && _sellFee == 0) return;
_previousBuyFee = _buyFee;
_previousSellFee = _sellFee;
_previousTotalFee = _TotalFee;
_buyFee = 0;
_sellFee = 0;
_TotalFee = 0;
}
| function removeAllFee() private {
if(_TotalFee == 0 && _buyFee == 0 && _sellFee == 0) return;
_previousBuyFee = _buyFee;
_previousSellFee = _sellFee;
_previousTotalFee = _TotalFee;
_buyFee = 0;
_sellFee = 0;
_TotalFee = 0;
}
| 28,389 |
100 | // ERC20 Token Standard, optional extension: Multi TransfersNote: the ERC-165 identifier for this interface is 0xd5b86388. / | interface IERC20BatchTransfers {
/**
* Moves multiple `amounts` tokens from the caller's account to each of `recipients`.
* @dev Reverts if `recipients` and `amounts` have different lengths.
* @dev Reverts if one of `recipients` is the zero address.
* @dev Reverts if the caller has an insufficie... | interface IERC20BatchTransfers {
/**
* Moves multiple `amounts` tokens from the caller's account to each of `recipients`.
* @dev Reverts if `recipients` and `amounts` have different lengths.
* @dev Reverts if one of `recipients` is the zero address.
* @dev Reverts if the caller has an insufficie... | 54,558 |
0 | // SPDX-License-Identifier: UNLICENSED/ Interface of the ERC20 standard as defined in the EIP. / | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256)... | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256)... | 16,333 |
88 | // takes funds from users and issues tokens/ | contract RECORDICO {
// RCD - RECORD token contract
RECORDToken public RCD = new RECORDToken();
using SafeMath for uint256;
// Token price parameters
// These parametes can be changed only by manager of contract
uint256 public Rate_Eth = 690; // Rate USD per ETH
// Crowdfunding parameters
... | contract RECORDICO {
// RCD - RECORD token contract
RECORDToken public RCD = new RECORDToken();
using SafeMath for uint256;
// Token price parameters
// These parametes can be changed only by manager of contract
uint256 public Rate_Eth = 690; // Rate USD per ETH
// Crowdfunding parameters
... | 63,276 |
55 | // Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| 35,873 |
61 | // 0x80ac58cd ===bytes4(keccak256('balanceOf(address)')) ^bytes4(keccak256('ownerOf(uint256)')) ^bytes4(keccak256('approve(address,uint256)')) ^bytes4(keccak256('getApproved(uint256)')) ^bytes4(keccak256('setApprovalForAll(address,bool)')) ^bytes4(keccak256('isApprovedForAll(address,address)')) ^bytes4(keccak256('trans... |
bytes4 private constant InterfaceId_ERC721Exists = 0x4f558e79;
|
bytes4 private constant InterfaceId_ERC721Exists = 0x4f558e79;
| 1,388 |
16 | // Thrown if the same plugin setup exists in previous releases./release The release number./build The build number./pluginSetup The address of the plugin setup contract./buildMetadata The build metadata URI. | event VersionCreated(
uint8 release,
uint16 build,
address indexed pluginSetup,
bytes buildMetadata
);
| event VersionCreated(
uint8 release,
uint16 build,
address indexed pluginSetup,
bytes buildMetadata
);
| 8,185 |
11 | // Unlocks the `amount` from being sent only to `caller` over the`owner` balance.This `amount` does not override previous locked balance, it reduces it. | * Emits a {UnlockedFunds} event.
*
* @param owner - Account from where the funds are locked
* @param spender - Account to whom funds were locked
* @param amount - The amount that will be unlocked
*/
function unlockAmount(
address owner,
address spender,
uint256 amount
) external virtua... | * Emits a {UnlockedFunds} event.
*
* @param owner - Account from where the funds are locked
* @param spender - Account to whom funds were locked
* @param amount - The amount that will be unlocked
*/
function unlockAmount(
address owner,
address spender,
uint256 amount
) external virtua... | 23,238 |
32 | // operation cannot be performed because auction has ended. Signature : `0xa0e92984` | error AuctionEnded();
| error AuctionEnded();
| 29,086 |
8 | // address public commissionExchanger; |
uint256 public offerLifetimeSecondPrice = 1 gwei;
uint64 public freePeriod = 7 days;
|
uint256 public offerLifetimeSecondPrice = 1 gwei;
uint64 public freePeriod = 7 days;
| 23,388 |
68 | // Return the amount of wei that would be left over | weiRemainder = weiContribution % periodPriceInWei;
| weiRemainder = weiContribution % periodPriceInWei;
| 48,502 |
2 | // Emitted when test owner updates test vaults/thresholds/vault The address of the updated vault/oldThreshold old failure threshold/newThreshold new failure threshold | event AnteRibbonTestUpdated(address indexed vault, uint256 oldThreshold, uint256 newThreshold);
| event AnteRibbonTestUpdated(address indexed vault, uint256 oldThreshold, uint256 newThreshold);
| 27,520 |
18 | // Returns expected rate for Eth -> Mkr conversion/_amount Amount of Ether | function estimatedMkrPrice(uint256 _amount) internal view returns (uint256 expectedRate) {
expectedRate = ExchangeInterface(KYBER_WRAPPER).getExpectedRate(
KYBER_ETH_ADDRESS,
MKR_ADDRESS,
_amount
);
}
| function estimatedMkrPrice(uint256 _amount) internal view returns (uint256 expectedRate) {
expectedRate = ExchangeInterface(KYBER_WRAPPER).getExpectedRate(
KYBER_ETH_ADDRESS,
MKR_ADDRESS,
_amount
);
}
| 9,467 |
97 | // The total amount of ERC20 that's paid out as reward. | uint256 public paidOut;
| uint256 public paidOut;
| 7,040 |
220 | // Multiplies two `Signed`s, reverting on overflow. This will "floor" the product. a a FixedPoint.Signed. b a FixedPoint.Signed.return the product of `a` and `b`. / | function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) {
// There are two caveats with this computation:
// 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is
// stored internally as an int256 ~10^59.
// 2. Results that... | function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) {
// There are two caveats with this computation:
// 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is
// stored internally as an int256 ~10^59.
// 2. Results that... | 53,831 |
111 | // create pair | lpPair = IDexFactory(_dexRouter.factory()).createPair(address(this), _dexRouter.WETH());
excludeFromMaxTransaction(address(lpPair), true);
_setAutomatedMarketMakerPair(address(lpPair), true);
| lpPair = IDexFactory(_dexRouter.factory()).createPair(address(this), _dexRouter.WETH());
excludeFromMaxTransaction(address(lpPair), true);
_setAutomatedMarketMakerPair(address(lpPair), true);
| 16,892 |
38 | // Finalizes (or cancels) the strategy update by resetting the data / | function finalizeStrategyUpdate() public onlyControllerOrGovernance {
_setStrategyUpdateTime(0);
_setFutureStrategy(address(0));
}
| function finalizeStrategyUpdate() public onlyControllerOrGovernance {
_setStrategyUpdateTime(0);
_setFutureStrategy(address(0));
}
| 20,040 |
30 | // VIP list/ | function addToVIPList(address[] _vipList) public {
for (uint i = 0; i < _vipList.length; i++) {
vipList[_vipList[i]] = true;
}
}
| function addToVIPList(address[] _vipList) public {
for (uint i = 0; i < _vipList.length; i++) {
vipList[_vipList[i]] = true;
}
}
| 71,749 |
21 | // The current coin fee. / | uint internal pCoin;
| uint internal pCoin;
| 48,096 |
24 | // Get the subscription address of a given registrant, if any. / | function subscriptionOf(address registrant) external view returns (address subscription) {
subscription = _registrations[registrant];
if (subscription == address(0)) {
revert NotRegistered(registrant);
} else if (subscription == registrant) {
subscription = address(0)... | function subscriptionOf(address registrant) external view returns (address subscription) {
subscription = _registrations[registrant];
if (subscription == address(0)) {
revert NotRegistered(registrant);
} else if (subscription == registrant) {
subscription = address(0)... | 20,766 |
2 | // the address of the GenesisGroup contract | address public override genesisGroup;
| address public override genesisGroup;
| 1,970 |
5 | // Set the vault wallet address where the platform fees are sent / | function setVaultWallet(address _vaultWallet) external onlyOwner {
vaultWallet = _vaultWallet;
emit VaultWalletChanged(_vaultWallet);
}
| function setVaultWallet(address _vaultWallet) external onlyOwner {
vaultWallet = _vaultWallet;
emit VaultWalletChanged(_vaultWallet);
}
| 7,603 |
70 | // remove the acrued hold-points for this deposit | pool.totalHoldPoints -= _holdPoints(dep);
| pool.totalHoldPoints -= _holdPoints(dep);
| 24,354 |
63 | // This function withdraws ETH from the contract. / | function withdraw() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
| function withdraw() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
| 8,816 |
58 | // Get the latest effective price/tokenAddress Destination token address/ return blockNumber The block number of price/ return price The token price. (1eth equivalent to (price) token) | function latestPrice(address tokenAddress) external view returns (uint blockNumber, uint price);
| function latestPrice(address tokenAddress) external view returns (uint blockNumber, uint price);
| 12,511 |
6 | // 捐赠记录 | mapping(uint => Record) records;
| mapping(uint => Record) records;
| 50,512 |
19 | // Important state variables | uint public timeOfFirstVote = 0; // Record the time of the first vote, to serve as a yardstick
mapping(address => Voter) public votersMap; // Maintain a mapping of a voter's address to its voting information
address[] public votersList; // Maintain a list of a voters for iteration
| uint public timeOfFirstVote = 0; // Record the time of the first vote, to serve as a yardstick
mapping(address => Voter) public votersMap; // Maintain a mapping of a voter's address to its voting information
address[] public votersList; // Maintain a list of a voters for iteration
| 22,179 |
73 | // Define crowdsale address (only owner may call) | function addCrowdsale(address _crowdsale) public onlyOwner returns (bool) {
require(crowdsale == address(0), "Crowdsale address has already been defned!");
minters.push(_crowdsale);
crowdsale = _crowdsale;
return true;
}
| function addCrowdsale(address _crowdsale) public onlyOwner returns (bool) {
require(crowdsale == address(0), "Crowdsale address has already been defned!");
minters.push(_crowdsale);
crowdsale = _crowdsale;
return true;
}
| 47,233 |
14 | // Allows account to deregister a registered peer IDFunction can only be called when the registry is enabled. Performs a minimum validation of node IDs. Full validation should be done off-chain.hopr node peer id should always start with '16Uiu2HA' (0x3136556975324841) and be of length 53hoprPeerIds Array of hopr nodes ... | function selfDeregister(string[] calldata hoprPeerIds) external mustBeEnabled {
// update the counter
countRegisterdNodesPerAccount[msg.sender] -= hoprPeerIds.length;
// check sender eligibility
if (_checkEligibility(msg.sender)) {
// account becomes eligible
emit EligibilityUpdated(msg.s... | function selfDeregister(string[] calldata hoprPeerIds) external mustBeEnabled {
// update the counter
countRegisterdNodesPerAccount[msg.sender] -= hoprPeerIds.length;
// check sender eligibility
if (_checkEligibility(msg.sender)) {
// account becomes eligible
emit EligibilityUpdated(msg.s... | 5,011 |
23 | // Allows the current owner to relinquish control of the contract. It will not be possible to call the functions with the `onlyOwner` modifier anymore.Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./ | function renounceOwnership() external onlyOwner {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
| function renounceOwnership() external onlyOwner {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
| 15,055 |
31 | // return false in the event the account conversion returned null address. | if (
account == address(0)
) {
| if (
account == address(0)
) {
| 15,571 |
11 | // send `_value` token to `_to` from `msg.sender`/_to The address of the recipient/_value The amount of token to be transferred/ return Whether the transfer was successful or not | function transfer(address _to, uint256 _value) public returns (bool success);
| function transfer(address _to, uint256 _value) public returns (bool success);
| 1,912 |
12 | // quantity of ERC-20 deposited as collateral in the vault for each ERC-20 address in collateralAssets | uint256[] collateralAmounts;
| uint256[] collateralAmounts;
| 5,019 |
11 | // Maximum number of priority request that wait to be proceed/ to prevent an attacker submit a large number of priority requests/ that exceeding the processing power of the l2 server/ and force the contract to enter exodus mode/ this attack may occur on some blockchains with high tps but low gas prices | uint256 internal constant MAX_PRIORITY_REQUESTS = $(defined(MAX_PRIORITY_REQUESTS) ? MAX_PRIORITY_REQUESTS : 4096);
| uint256 internal constant MAX_PRIORITY_REQUESTS = $(defined(MAX_PRIORITY_REQUESTS) ? MAX_PRIORITY_REQUESTS : 4096);
| 46,264 |
297 | // Created and owned by the staking contract.It mints and burns OGTemple as users stake/unstake / | contract OGTemple is ERC20, ERC20Burnable, Ownable {
constructor() ERC20("OGTemple", "OG_TEMPLE") {}
function mint(address to, uint256 amount) external onlyOwner {
_mint(to, amount);
}
}
| contract OGTemple is ERC20, ERC20Burnable, Ownable {
constructor() ERC20("OGTemple", "OG_TEMPLE") {}
function mint(address to, uint256 amount) external onlyOwner {
_mint(to, amount);
}
}
| 84,853 |
70 | // Gets the address of the token used for dividends / | function getDividendsToken() public view returns (address) {
return address(dividendsToken);
}
| function getDividendsToken() public view returns (address) {
return address(dividendsToken);
}
| 20,360 |
17 | // Get Payment Token Information.Returns information about the payment token used to purchase the stablecoin. return The address, name, symbol, and decimals of the payment token./ | function coinPayments() public view override returns(address, string memory, string memory, uint256) {
return (address(s_coinPayments), s_coinPayments.name(), s_coinPayments.symbol(), s_coinPayments.decimals());
}
| function coinPayments() public view override returns(address, string memory, string memory, uint256) {
return (address(s_coinPayments), s_coinPayments.name(), s_coinPayments.symbol(), s_coinPayments.decimals());
}
| 4,150 |
2 | // new functions DAO related functions | function getDaoStartRound(bytes32 daoId) external view returns (uint256 startRound);
function getDaoMintableRound(bytes32 daoId) external view returns (uint256 mintableRound);
function getDaoIndex(bytes32 daoId) external view returns (uint256 index);
function getDaoUri(bytes32 daoId) external view re... | function getDaoStartRound(bytes32 daoId) external view returns (uint256 startRound);
function getDaoMintableRound(bytes32 daoId) external view returns (uint256 mintableRound);
function getDaoIndex(bytes32 daoId) external view returns (uint256 index);
function getDaoUri(bytes32 daoId) external view re... | 42,098 |
23 | // Mint Fake Tokens | for (uint i = 1; i < tokens_crypto.length; i++) {
IERC20(tokens_crypto[i]).mint(_address,uint(calculatedBalance[i]));
}
| for (uint i = 1; i < tokens_crypto.length; i++) {
IERC20(tokens_crypto[i]).mint(_address,uint(calculatedBalance[i]));
}
| 52,947 |
126 | // sets value for {shareToken} and {cash} _shareToken address of shareToken associated with a augur universe_cash DAI / | constructor(IShareToken _shareToken, IERC20 _cash) public {
cash = _cash;
shareToken = _shareToken;
}
| constructor(IShareToken _shareToken, IERC20 _cash) public {
cash = _cash;
shareToken = _shareToken;
}
| 12,519 |
148 | // Allows Schains, NodeRotation, and SkaleDKG contracts to remove an schain from a node. / | function removeSchainForNode(uint nodeIndex, uint schainIndex)
public
allowThree("NodeRotation", "SkaleDKG", "Schains")
| function removeSchainForNode(uint nodeIndex, uint schainIndex)
public
allowThree("NodeRotation", "SkaleDKG", "Schains")
| 83,519 |
135 | // Redemption rebate has been updated./redemptionRebate The new redemption rebate. | event RedemptionRebateUpdated(uint256 redemptionRebate);
| event RedemptionRebateUpdated(uint256 redemptionRebate);
| 35,816 |
41 | // This method relies on extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution. |
uint256 size;
|
uint256 size;
| 350 |
50 | // Private sale distributorprivate sale total is set once, irreversible and not modifiableOnce this amount in wei is reduced to 0, no more token can be generated as private sale!Maximum token generated by private sale is pvt_plmt_max_in_Wei125000 (discount upper limit)Note 1, Private sale limit is the balance of privat... | function distribute_private_sale_fund(address _beneficiary, uint256 _wei_amount, uint256 _rate) public onlyOwner returns(bool){
require(pvt_plmt_set && _beneficiary != address(0) && pvt_plmt_remaining_in_Wei >= _wei_amount && _rate >= 100000 && _rate <= 125000);
pvt_plmt_remaining_in_Wei = pvt_plmt... | function distribute_private_sale_fund(address _beneficiary, uint256 _wei_amount, uint256 _rate) public onlyOwner returns(bool){
require(pvt_plmt_set && _beneficiary != address(0) && pvt_plmt_remaining_in_Wei >= _wei_amount && _rate >= 100000 && _rate <= 125000);
pvt_plmt_remaining_in_Wei = pvt_plmt... | 57,770 |
67 | // Returns if presale times are active for a given token / | function tokenPresaleTimeIsActive(
uint256 _tokenId
| function tokenPresaleTimeIsActive(
uint256 _tokenId
| 21,304 |
122 | // Allow owner to update maximum number alpaca a given user can adopt / | function setMaxAdoptionCount(uint256 _maxAdoptionCount) public onlyOwner {
maxAdoptionCount = _maxAdoptionCount;
}
| function setMaxAdoptionCount(uint256 _maxAdoptionCount) public onlyOwner {
maxAdoptionCount = _maxAdoptionCount;
}
| 8,867 |
66 | // allows internal token transfers_from The source address_to The destination address/ | function internalTransfer(address _from, address _to, uint256 _value) internal returns (bool) {
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(_from, _to, _value);
onTokenTransfer(_from, _to, _value);
return true;
}
| function internalTransfer(address _from, address _to, uint256 _value) internal returns (bool) {
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(_from, _to, _value);
onTokenTransfer(_from, _to, _value);
return true;
}
| 15,721 |
250 | // G-UNI ============================================ | // {
// (uint256 reserve0, uint256 reserve1) = stakingToken.getUnderlyingBalances();
// uint256 total_frax_reserves = frax_is_token0 ? reserve0 : reserve1;
// frax_per_lp_token = (total_frax_reserves * 1e18) / stakingToken.totalSupply();
// }
| // {
// (uint256 reserve0, uint256 reserve1) = stakingToken.getUnderlyingBalances();
// uint256 total_frax_reserves = frax_is_token0 ? reserve0 : reserve1;
// frax_per_lp_token = (total_frax_reserves * 1e18) / stakingToken.totalSupply();
// }
| 12,132 |
217 | // Event emitted when the reserves are reduced / | event ReservesReduced(address admin, uint reduceAmount, uint newTotalReserves);
| event ReservesReduced(address admin, uint reduceAmount, uint newTotalReserves);
| 11,872 |
86 | // only after finalization | require(isFinalized);
| require(isFinalized);
| 7,080 |
336 | // Enum for types of syntheticId Invalid - syntheticId is not initialized yet NotPool - syntheticId with p2p logic Pool - syntheticId with pooled logic | enum SyntheticTypes { Invalid, NotPool, Pool }
// Cache of buyer margin by ticker
// buyerMarginByHash[derivativeHash] = buyerMargin
mapping (bytes32 => uint256) public buyerMarginByHash;
// Cache of seller margin by ticker
// sellerMarginByHash[derivativeHash] = sellerMargin
mapping (byte... | enum SyntheticTypes { Invalid, NotPool, Pool }
// Cache of buyer margin by ticker
// buyerMarginByHash[derivativeHash] = buyerMargin
mapping (bytes32 => uint256) public buyerMarginByHash;
// Cache of seller margin by ticker
// sellerMarginByHash[derivativeHash] = sellerMargin
mapping (byte... | 29,433 |
3 | // Map to know the ZRC20 address of a token given a chain id, ex zETH, zBNB etc. | mapping(uint256 => address) public gasCoinZRC20ByChainId;
| mapping(uint256 => address) public gasCoinZRC20ByChainId;
| 13,107 |
43 | // See {IFairxyzEditions-setEditionStages}. Allows the stages admin to set new stages for an existing edition. Requirements: - The edition must already exist.- The new stages phase limits must greater than the number of tokens already minted for the edition.- The new stages phase limits must be less than or equal to th... | function setEditionStages(
uint256 editionId,
uint256 fromIndex,
Stage[] calldata stages
) external virtual override onlyCreator onlyExistingEdition(editionId) {
if (stages.length == 0) {
_stagesRegistry().cancelStages(address(this), editionId, fromIndex);
} e... | function setEditionStages(
uint256 editionId,
uint256 fromIndex,
Stage[] calldata stages
) external virtual override onlyCreator onlyExistingEdition(editionId) {
if (stages.length == 0) {
_stagesRegistry().cancelStages(address(this), editionId, fromIndex);
} e... | 28,454 |
84 | // Get slash amount | slashAmount = _getSlashingPercentageForDisputeType(_disputeType).mul(slashableAmount).div(
MAX_PPM
);
require(slashAmount > 0, "Dispute has zero tokens to slash");
| slashAmount = _getSlashingPercentageForDisputeType(_disputeType).mul(slashableAmount).div(
MAX_PPM
);
require(slashAmount > 0, "Dispute has zero tokens to slash");
| 3,605 |
15 | // address public rewardsDistribution; | IERC20 public rewardsToken;
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public rewardsDuration = 30 days;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256... | IERC20 public rewardsToken;
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public rewardsDuration = 30 days;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256... | 35,873 |
176 | // See {IERC721Metadata-symbol}. / | function symbol() public view override returns (string memory) {
return _symbol;
}
| function symbol() public view override returns (string memory) {
return _symbol;
}
| 592 |
96 | // Withdraws a given amount from lender/amount The amount the caller wants to withdraw/ return Amount actually withdrawn | function withdraw(uint256 amount) external override onlyRole(STRATEGY_ROLE) returns (uint256) {
return _withdraw(amount);
}
| function withdraw(uint256 amount) external override onlyRole(STRATEGY_ROLE) returns (uint256) {
return _withdraw(amount);
}
| 59,701 |
16 | // deploy a new contract with the generated creation code. start 32 bytes into creationCode to avoid copying the byte length. | address_ := create(0, add(creationCode, 0x20), mload(creationCode))
| address_ := create(0, add(creationCode, 0x20), mload(creationCode))
| 4,308 |
9 | // Mint DDS token to msg.sender | uint256 reDaitokenAmount = getMintReDaiAmount(mintAmount);
lpAccount[msg.sender] = lpAccount[msg.sender].add(reDaitokenAmount);
_mint(msg.sender, reDaitokenAmount);
| uint256 reDaitokenAmount = getMintReDaiAmount(mintAmount);
lpAccount[msg.sender] = lpAccount[msg.sender].add(reDaitokenAmount);
_mint(msg.sender, reDaitokenAmount);
| 6,524 |
4 | // Mapping between addresses and how much money they have withdrawn. | mapping(address => uint) public amountsWithdrew;
| mapping(address => uint) public amountsWithdrew;
| 19,231 |
17 | // Emitted when a claim request was performed. Specification: Is not clear / | event ClaimRequested(uint256 indexed claimRequestId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
| event ClaimRequested(uint256 indexed claimRequestId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
| 40,161 |
8 | // external unstake function, for single unstake request _cid => collection address _id => nft id / | function unstake(uint256 _cid, uint256 _id) external {
_unstake(msg.sender, _cid, _id);
}
| function unstake(uint256 _cid, uint256 _id) external {
_unstake(msg.sender, _cid, _id);
}
| 4,216 |
1 | // Liqi Offer Token / | constructor(string memory _name, string memory _symbol)
public
ERC20(_name, _symbol)
| constructor(string memory _name, string memory _symbol)
public
ERC20(_name, _symbol)
| 17,157 |
166 | // BinaryAllocator constructor. _baseAsset The baseAsset address_quoteAssetThe quoteAsset address_baseAssetOracle The baseAsset oracle_quoteAssetOracleThe quoteAsset oracle_baseAssetCollateral The baseAsset collateral Set_quoteAssetCollateralThe quoteAsset collateral Set_coreThe address of the Core contract_setTokenFac... | constructor(
ERC20Detailed _baseAsset,
ERC20Detailed _quoteAsset,
IOracle _baseAssetOracle,
IOracle _quoteAssetOracle,
ISetToken _baseAssetCollateral,
ISetToken _quoteAssetCollateral,
ICore _core,
| constructor(
ERC20Detailed _baseAsset,
ERC20Detailed _quoteAsset,
IOracle _baseAssetOracle,
IOracle _quoteAssetOracle,
ISetToken _baseAssetCollateral,
ISetToken _quoteAssetCollateral,
ICore _core,
| 32,769 |
225 | // Avoid needing a Souschef by tracking staked pearl internally. | uint256 public pearlStaked;
| uint256 public pearlStaked;
| 26,864 |
82 | // Vault This contract is responsible for storing FET tokens being deposited by userswhich can be withdrawn by the contract admin and send directly to an address / | contract Vault is IVault, Ownable {
using SafeERC20 for IERC20;
using Address for address;
address public admin;
address public fundsDepositAddress;
address public token;
modifier onlyAdmin() {
require(msg.sender == admin, "!Admin");
_;
}
/**
* @param _admin: the... | contract Vault is IVault, Ownable {
using SafeERC20 for IERC20;
using Address for address;
address public admin;
address public fundsDepositAddress;
address public token;
modifier onlyAdmin() {
require(msg.sender == admin, "!Admin");
_;
}
/**
* @param _admin: the... | 25,637 |
18 | // recreates the 32 byte hash signed by the user's wallet verifies the signature using Open Zeppelin's ECDSA library signature valid if call doesn't throwreq : request being executed sig : the signature generated by the user's wallet/ | function _verifySigPersonalSign(
ERC20ForwardRequest calldata req,
bytes memory sig)
internal
view
| function _verifySigPersonalSign(
ERC20ForwardRequest calldata req,
bytes memory sig)
internal
view
| 23,080 |
8 | // Check balance again to prevent possible actions during lToken transfer | pBalance = pToken.distributionBalanceOf(user);
require(pBalance == 0, "PensionFundLiquidityModule: not zero balance after full withdraw");
delete plans[user];
emit PlanClosed(user, pRefund, pPenalty);
| pBalance = pToken.distributionBalanceOf(user);
require(pBalance == 0, "PensionFundLiquidityModule: not zero balance after full withdraw");
delete plans[user];
emit PlanClosed(user, pRefund, pPenalty);
| 25,901 |
92 | // Prevent creating lootprints / | function freeze () public onlyContractOwner notFrozen {
frozen = true;
}
| function freeze () public onlyContractOwner notFrozen {
frozen = true;
}
| 66,730 |
80 | // 0x434f4e54524143545f57415445525f45524332305f544f4b454e000000000000 | bytes32 public constant CONTRACT_WATER_ERC20_TOKEN =
"CONTRACT_WATER_ERC20_TOKEN";
| bytes32 public constant CONTRACT_WATER_ERC20_TOKEN =
"CONTRACT_WATER_ERC20_TOKEN";
| 63,722 |
22 | // total number of tokens in existence/ | function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| 4,048 |
6 | // Check if the given sender is the owner of the DB contract | function isOwnerDB(address _sender) public view isOwner(_sender) returns(bool){
return (owners[_sender] || owners[address(this)]);
}
| function isOwnerDB(address _sender) public view isOwner(_sender) returns(bool){
return (owners[_sender] || owners[address(this)]);
}
| 53,544 |
35 | // Check that there is no ongoing bet already - we support one game at a time from single address. | ActiveBet storage bet = activeBets[msg.sender];
require (bet.amount == 0);
| ActiveBet storage bet = activeBets[msg.sender];
require (bet.amount == 0);
| 42,166 |
8 | // Fallback function that accepts ether and announces its arrival via an event. / | function () payable external {
}
| function () payable external {
}
| 32,304 |
69 | // -------------------------------------------------------------------------- // ownable// -------------------------------------------------------------------------- / | function hokkItUpAgain() external onlyOwner {
tradingEnabled = true;
buyTaxes = Taxes({reflection: 0, operation: 20, buyback: 5, total: 25});
sellTaxes = Taxes({
reflection: 0,
operation: 60,
buyback: 15,
total: 75
});
}
| function hokkItUpAgain() external onlyOwner {
tradingEnabled = true;
buyTaxes = Taxes({reflection: 0, operation: 20, buyback: 5, total: 25});
sellTaxes = Taxes({
reflection: 0,
operation: 60,
buyback: 15,
total: 75
});
}
| 31,014 |
1 | // uint256 public currentBal; | Project [] public projectsListed;
| Project [] public projectsListed;
| 3,904 |
259 | // cut string s into s[start:end] _s the string to cut _start the starting index _end the ending index (excluded in the substring) / | function _slice(
string memory _s,
uint256 _start,
uint256 _end
| function _slice(
string memory _s,
uint256 _start,
uint256 _end
| 2,100 |
257 | // and not inverse rates | (uint entryPoint, , , , ) = exchangeRates.inversePricing(oracleKey);
if (entryPoint != 0) {
return false;
}
| (uint entryPoint, , , , ) = exchangeRates.inversePricing(oracleKey);
if (entryPoint != 0) {
return false;
}
| 36,920 |
29 | // Decorador para métodos que solo pueden ser accedidos a través de Vita reward | modifier onlyVitaReward(){
require(msg.sender == reward_contract);
_;
}
| modifier onlyVitaReward(){
require(msg.sender == reward_contract);
_;
}
| 38,686 |
95 | // non-proxied singletons, numbered down from 31 (as JS has problems with bitmasks over 31 bits) | uint256 public constant WETH_GATEWAY = 1 << 27;
uint256 public constant DATA_HELPER = 1 << 28;
uint256 public constant PRICE_ORACLE = 1 << 29;
uint256 public constant LENDING_RATE_ORACLE = 1 << 30;
| uint256 public constant WETH_GATEWAY = 1 << 27;
uint256 public constant DATA_HELPER = 1 << 28;
uint256 public constant PRICE_ORACLE = 1 << 29;
uint256 public constant LENDING_RATE_ORACLE = 1 << 30;
| 58,481 |
92 | // Position Manager cannot be zero. | error PositionManagerCannotBeZero();
| error PositionManagerCannotBeZero();
| 15,325 |
28 | // Burns a specific amount of tokens._value The amount of token to be burned./ | function burn(uint256 _value) public onlyOwner whenNotPaused {
_burn(msg.sender, _value);
}
| function burn(uint256 _value) public onlyOwner whenNotPaused {
_burn(msg.sender, _value);
}
| 42,407 |
48 | // owner > nonce mapping. Used in `permit`. | mapping(address => uint256) public nonces;
| mapping(address => uint256) public nonces;
| 14,174 |
20 | // Emitted when the expected value of a yield token is snapped to its current value.//yieldTokenThe address of the yield token./expectedValue The updated expected value measured in the yield token's underlying token. | event Snap(address indexed yieldToken, uint256 expectedValue);
| event Snap(address indexed yieldToken, uint256 expectedValue);
| 15,297 |
17 | // Handle the receipt of an NFT The ERC721 smart contract calls this function on the recipientafter a `safetransfer`. This function MAY throw to revert and reject thetransfer. Return of other than the magic value MUST result in thetransaction being reverted.Note: the contract address is always the message sender. _oper... | function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes memory _data
)
public
returns(bytes4);
| function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes memory _data
)
public
returns(bytes4);
| 8,046 |
39 | // fallback function - reverts transaction/ | function () external payable {
revert();
}
| function () external payable {
revert();
}
| 49,735 |
139 | // parses the passed in action arguments to get the arguments for a deposit action _args general action arguments structurereturn arguments for a deposit action / | function _parseDepositArgs(ActionArgs memory _args) internal pure returns (DepositArgs memory) {
require(
(_args.actionType == ActionType.DepositLongOption) || (_args.actionType == ActionType.DepositCollateral),
"A8"
);
require(_args.owner != address(0), "A9");
... | function _parseDepositArgs(ActionArgs memory _args) internal pure returns (DepositArgs memory) {
require(
(_args.actionType == ActionType.DepositLongOption) || (_args.actionType == ActionType.DepositCollateral),
"A8"
);
require(_args.owner != address(0), "A9");
... | 9,490 |
15 | // =============== |
IUniswapV2Router02 private _router;
|
IUniswapV2Router02 private _router;
| 10,779 |
51 | // Provides information about the current execution context, including thesender of the transaction and its data. While these are generally availablevia msg.sender and msg.data, they should not be accessed in such a directmanner, since when dealing with meta-transactions the account sending andpaying for execution may ... | abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solid... | abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solid... | 20,316 |
21 | // A token that defines fractional units as decimals. / | contract FractionalERC20 is ERC20 {
uint public decimals;
}
| contract FractionalERC20 is ERC20 {
uint public decimals;
}
| 35,757 |
99 | // require(address(_distributerAccount) != address(0)); | require(_wallet != address(0));
require(TOKENS_PER_KETHER > 0);
wallet = _wallet;
finalized = false;
publicSaleStarted = false;
tokensPerKEther = TOKENS_PER_KETHER;
tokenContract = _tokenContract;
| require(_wallet != address(0));
require(TOKENS_PER_KETHER > 0);
wallet = _wallet;
finalized = false;
publicSaleStarted = false;
tokensPerKEther = TOKENS_PER_KETHER;
tokenContract = _tokenContract;
| 30,000 |
2 | // User Application | mapping(address => mapping(uint16 => ApplicationConfiguration)) public appConfig; // app address => chainId => config
mapping(uint16 => ApplicationConfiguration) public defaultAppConfig; // default UA settings if no version specified
mapping(uint16 => mapping(uint16 => bytes)) public defaultAdapterParams;
| mapping(address => mapping(uint16 => ApplicationConfiguration)) public appConfig; // app address => chainId => config
mapping(uint16 => ApplicationConfiguration) public defaultAppConfig; // default UA settings if no version specified
mapping(uint16 => mapping(uint16 => bytes)) public defaultAdapterParams;
| 30,503 |
10 | // edit windows for claiming and purchasing planets _claimWindowOpens UNIX timestamp for claiming window opening time_claimWindowOpens UNIX timestamp for claiming window close time_claimWindowOpens UNIX timestamp for purchasing window opening time/ | function editWindows(
uint256 _purchaseWindowOpens,
uint256 _daoBurnWindowOpens,
uint256 _burnWindowOpens,
uint256 _claimWindowOpens,
uint256 _claimWindowCloses
| function editWindows(
uint256 _purchaseWindowOpens,
uint256 _daoBurnWindowOpens,
uint256 _burnWindowOpens,
uint256 _claimWindowOpens,
uint256 _claimWindowCloses
| 18,199 |
18 | // check if user doesn't have active loan | require(isBorrowed[msg.sender] == false, 'Error, loan already taken');
| require(isBorrowed[msg.sender] == false, 'Error, loan already taken');
| 22,912 |
71 | // proposed : the claimed owner of the cardid : the id of the card to check return whether proposed owns the card/ | function owns(address proposed, uint id) public view returns (bool) {
return ownerOf(id) == proposed;
}
| function owns(address proposed, uint id) public view returns (bool) {
return ownerOf(id) == proposed;
}
| 48,661 |
271 | // check that there are still tokens available to purchase zero and max uint256 represent infinite minting | require(
limit == 0 || limit == type(uint256).max || tokenId < limit + 1,
"sold out"
);
| require(
limit == 0 || limit == type(uint256).max || tokenId < limit + 1,
"sold out"
);
| 19,961 |
40 | // Edit CounterPart Address | function editCounterPart(uint256 _swapId, address payable _counterPart) public {
require(msg.sender == swapList[msg.sender][swapMatch[_swapId]].addressOne, "Message sender must be the swap creator");
swapList[msg.sender][swapMatch[_swapId]].addressTwo = _counterPart;
}
| function editCounterPart(uint256 _swapId, address payable _counterPart) public {
require(msg.sender == swapList[msg.sender][swapMatch[_swapId]].addressOne, "Message sender must be the swap creator");
swapList[msg.sender][swapMatch[_swapId]].addressTwo = _counterPart;
}
| 37,516 |
44 | // solhint-disable-next-line no-inline-assembly | assembly { codehash := extcodehash(account) }
| assembly { codehash := extcodehash(account) }
| 7,969 |
68 | // fallback for processing ether / | function() payable {
return buyTokens(msg.sender);
}
| function() payable {
return buyTokens(msg.sender);
}
| 29,106 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.