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 |
|---|---|---|---|---|
15 | // See {ERC721EnviousDynamic-mint} / | function mint(address to) public virtual override {
_tokenTracker.increment();
_safeMint(to, _tokenTracker.current());
}
| function mint(address to) public virtual override {
_tokenTracker.increment();
_safeMint(to, _tokenTracker.current());
}
| 12,019 |
100 | // Multiplies two exponentials, returning a new exponential. / | function mulExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) {
(MathError err0, uint doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);
if (err0 != MathError.NO_ERROR) {
return (err0, Exp({mantissa: 0}));
}
// We add half the scale befo... | function mulExp(Exp memory a, Exp memory b) pure internal returns (MathError, Exp memory) {
(MathError err0, uint doubleScaledProduct) = mulUInt(a.mantissa, b.mantissa);
if (err0 != MathError.NO_ERROR) {
return (err0, Exp({mantissa: 0}));
}
// We add half the scale befo... | 3,553 |
2 | // Mint an LBR Ledger NFT numMints Number of mints / | function mint(uint256 numMints) external payable override nonReentrant {
require(_status, 'LBRLedger: Sale is paused');
require(
msg.value >= price() * numMints,
'LBRLedger: Not enough ether sent'
);
require(
totalSupply() + numMints <= MAX_SUPPLY,
'LBRLedger: New mint exceeds ... | function mint(uint256 numMints) external payable override nonReentrant {
require(_status, 'LBRLedger: Sale is paused');
require(
msg.value >= price() * numMints,
'LBRLedger: Not enough ether sent'
);
require(
totalSupply() + numMints <= MAX_SUPPLY,
'LBRLedger: New mint exceeds ... | 12,522 |
93 | // Contract CALL Opcodes // CALL opcodeSimply calls a particular code contract with the desired OVM contract context.Note: This is a raw function, so there are no listed (ABI-encoded) inputs / outputs.Below format of the bytes expected as input and written as output:calldata: variable-length bytes:[methodID (bytes4)][t... | function ovmCALL()
public
| function ovmCALL()
public
| 30,888 |
300 | // STETH contract address | address public immutable STETH;
| address public immutable STETH;
| 71,196 |
145 | // Check existence of a coin-------------------------Check whether a coin exists or notuint256 id The ID of the coin to check. / | modifier onlyExistingCoin(uint256 id) {
require(_coins[id].state != STATE_UNAVAILABLE,
'Coin id must exist.');
_;
}
| modifier onlyExistingCoin(uint256 id) {
require(_coins[id].state != STATE_UNAVAILABLE,
'Coin id must exist.');
_;
}
| 19,761 |
120 | // transfer the _target tokens to the launcher | IERC20(_target).safeTransfer(launcher, IERC20(_target).balanceOf(address(this)));
| IERC20(_target).safeTransfer(launcher, IERC20(_target).balanceOf(address(this)));
| 6,866 |
2 | // Withdraw wrapped ether to get ether | function withdraw(uint256) external;
| function withdraw(uint256) external;
| 27,277 |
25 | // eg. SUSHI - ETH | IERC20(sushi).safeTransfer(bar, amount0);
sushiOut = _toSUSHI(token1, amount1).add(amount0);
| IERC20(sushi).safeTransfer(bar, amount0);
sushiOut = _toSUSHI(token1, amount1).add(amount0);
| 27,549 |
81 | // pragma solidity 0.8.10; // pragma experimental ABIEncoderV2; / | interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, addr... | interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, addr... | 1,136 |
139 | // Add tokens to the account | balanceOf[account] = balanceOf[account] + amount;
| balanceOf[account] = balanceOf[account] + amount;
| 15,255 |
33 | // total amount of LP in this expiry (to use for units calculation) | uint256 totalStakeLP;
| uint256 totalStakeLP;
| 20,152 |
35 | // Start new tgr stage | function tgrSetLive() public only(projectWallet) isNotTgrLive isNotFrozenOnly {
tgrNumber +=1;
tgrStartBlock = block.number;
tgrAmountCollected = 0;
tgrContributedAmount = 0;
emit TGRStarted(tgrSettingsAmount,
tgrSettingsMinimalContribution,
... | function tgrSetLive() public only(projectWallet) isNotTgrLive isNotFrozenOnly {
tgrNumber +=1;
tgrStartBlock = block.number;
tgrAmountCollected = 0;
tgrContributedAmount = 0;
emit TGRStarted(tgrSettingsAmount,
tgrSettingsMinimalContribution,
... | 19,728 |
22 | // function to change owner | function changeOwnership(address _newOwner) onlyOwner external {
require(now > chronus.starting_time + chronus.race_duration + 60 minutes);
owner = _newOwner;
}
| function changeOwnership(address _newOwner) onlyOwner external {
require(now > chronus.starting_time + chronus.race_duration + 60 minutes);
owner = _newOwner;
}
| 8,472 |
111 | // Gets max profit | function getMaxProfit(uint divRate)
public
view
returns (uint)
| function getMaxProfit(uint divRate)
public
view
returns (uint)
| 56,615 |
31 | // Helper function that checks if one of the trustedIssuers is the old Attestations.sol contract and applies the escrow V1 check against minAttestations.attestationsAddress The address of Attestations.sol.identifier The hash of an identifier for which to look up attestations.account The account for which to look up att... | function hasCompletedV1AttestationsAsTrustedIssuer(
address attestationsAddress,
bytes32 identifier,
address account,
uint256 minAttestations,
address[] memory trustedIssuers
| function hasCompletedV1AttestationsAsTrustedIssuer(
address attestationsAddress,
bytes32 identifier,
address account,
uint256 minAttestations,
address[] memory trustedIssuers
| 37,546 |
3 | // Initializes this pool / | function baseInitialize(
IWasabiPoolFactory _factory,
IERC721 _nft,
address _optionNFT,
address _owner,
address _admin
| function baseInitialize(
IWasabiPoolFactory _factory,
IERC721 _nft,
address _optionNFT,
address _owner,
address _admin
| 26,106 |
81 | // Unlock time stamp. | uint256 public unlockTime;
| uint256 public unlockTime;
| 42,650 |
180 | // Update the _O5VoteNoConfidence mapping | _O5VoteNoConfidence[target] = true;
| _O5VoteNoConfidence[target] = true;
| 51,532 |
10 | // msg sender => withdraw event | mapping(address => bytes32) public withdrawalRoots;
| mapping(address => bytes32) public withdrawalRoots;
| 4,065 |
62 | // ------- Fee Setup -------- / | function applyTotalFees(uint256 rAmount, uint256 rSumFees) private {
uint256 collectedFee = rAmount.mul(rSumFees).div(100);
reflectionOwners[address(this)] = reflectionOwners[address(this)].add(collectedFee);
}
| function applyTotalFees(uint256 rAmount, uint256 rSumFees) private {
uint256 collectedFee = rAmount.mul(rSumFees).div(100);
reflectionOwners[address(this)] = reflectionOwners[address(this)].add(collectedFee);
}
| 43,599 |
133 | // add to the linearization | tmp_g1 = proof.grand_product_commitment.point_mul(grand_product_part_at_z);
tmp_g1.point_sub_assign(vk.permutation_commitments[STATE_WIDTH_OLD - 1].point_mul(last_permutation_part_at_z));
res.point_add_assign(tmp_g1);
res.point_mul_assign(state.v);
res.point_add_assign(proof.gr... | tmp_g1 = proof.grand_product_commitment.point_mul(grand_product_part_at_z);
tmp_g1.point_sub_assign(vk.permutation_commitments[STATE_WIDTH_OLD - 1].point_mul(last_permutation_part_at_z));
res.point_add_assign(tmp_g1);
res.point_mul_assign(state.v);
res.point_add_assign(proof.gr... | 10,989 |
231 | // Deposit and get the deposited token amount. | uint256 startingBalance = getTokenBalance();
STARK_PERPETUAL.deposit(starkKey, assetType, vaultId, quantizedAmount);
uint256 endingBalance = getTokenBalance();
uint256 tokenAmount = startingBalance.sub(endingBalance);
| uint256 startingBalance = getTokenBalance();
STARK_PERPETUAL.deposit(starkKey, assetType, vaultId, quantizedAmount);
uint256 endingBalance = getTokenBalance();
uint256 tokenAmount = startingBalance.sub(endingBalance);
| 38,534 |
453 | // VOTING FUNCTIONS // Commit a vote for a price request for `identifier` at `time`. `identifier`, `time` must correspond to a price request that's currently in the commit phase.Commits can be changed. Since transaction data is public, the salt will be revealed with the vote. While this is the system’s expected behavio... | function commitVote(
bytes32 identifier,
uint256 time,
bytes memory ancillaryData,
bytes32 hash
| function commitVote(
bytes32 identifier,
uint256 time,
bytes memory ancillaryData,
bytes32 hash
| 9,978 |
0 | // solhint-disable var-name-mixedcase / Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to invalidate the cached domain separator if the chain id changes. | bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
bytes32 private immutable _SALT;
| bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
bytes32 private immutable _SALT;
| 46,336 |
93 | // recompute unless we're on a lower tick boundary (i.e. already transitioned ticks), and haven't moved | state.tick = TickMath.getTickAtSqrtRatio(state.sqrtPriceX96);
| state.tick = TickMath.getTickAtSqrtRatio(state.sqrtPriceX96);
| 50,951 |
1 | // Construct a new money market underlying_ The address of the underlying asset pPIEImplementation_ The address of the PPIEImplementation controller_ The address of the Controller interestRateModel_ The address of the interest rate model initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18 initialRese... | constructor(
address underlying_,
address pPIEImplementation_,
address controller_,
address interestRateModel_,
uint initialExchangeRateMantissa_,
uint initialReserveFactorMantissa_,
string memory name_,
| constructor(
address underlying_,
address pPIEImplementation_,
address controller_,
address interestRateModel_,
uint initialExchangeRateMantissa_,
uint initialReserveFactorMantissa_,
string memory name_,
| 3,073 |
4 | // Cost in ETH of each Rascal minted with {mintWhitelist} / | uint256 public costWL;
| uint256 public costWL;
| 1,369 |
39 | // ----------------------------------------------------------------------------Burnable TokenToken that can be irreversibly burned (destroyed). ---------------------------------------------------------------------------- | contract BurnableToken is StandardToken, Ownable {
event BurnAdminAmount(address indexed burner, uint256 value);
function burnAdminAmount(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply_ = ... | contract BurnableToken is StandardToken, Ownable {
event BurnAdminAmount(address indexed burner, uint256 value);
function burnAdminAmount(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply_ = ... | 57,698 |
302 | // Anchor pool | contract CoFiXAnchorPool is CoFiXBase, ICoFiXAnchorPool {
/* ******************************************************************************************
* Note: In order to unify the authorization entry, all transferFrom operations are carried
* out in the CoFiXRouter, and the CoFiXPool needs to be fi... | contract CoFiXAnchorPool is CoFiXBase, ICoFiXAnchorPool {
/* ******************************************************************************************
* Note: In order to unify the authorization entry, all transferFrom operations are carried
* out in the CoFiXRouter, and the CoFiXPool needs to be fi... | 46,673 |
5 | // populate mapping in the reverse direction | allPairs.push(pair);
emit PairCreated(token0, token1, pair, allPairs.length);
| allPairs.push(pair);
emit PairCreated(token0, token1, pair, allPairs.length);
| 8,996 |
32 | // 50% Universal | level = 1;
| level = 1;
| 44,955 |
8 | // Set Base URI / | function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
| function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
| 31,246 |
62 | // This is denominated in Fragments, because the gons-fragments conversion might change before it's fully paid. | mapping (address => mapping (address => uint256)) private _allowedFragments;
| mapping (address => mapping (address => uint256)) private _allowedFragments;
| 12,688 |
158 | // Mints and transfers the number of NFT's to the sender. / | function mint(uint256 _amount) public payable canMint(_amount) {
require(mintingActive, 'Minting is not currently active');
if (!allowListOnly) {
require(_amount <= maxMintAmount, 'Cannot go over the purchase limit.');
}
require(price * _amount <= msg.value, 'Insufficien... | function mint(uint256 _amount) public payable canMint(_amount) {
require(mintingActive, 'Minting is not currently active');
if (!allowListOnly) {
require(_amount <= maxMintAmount, 'Cannot go over the purchase limit.');
}
require(price * _amount <= msg.value, 'Insufficien... | 52,285 |
29 | // Emits one {CallExecuted} event per transaction in the batch. Requirements: - the caller must have the 'executor' role. / | function executeBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata datas,
bytes32 predecessor,
bytes32 salt
) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {
require(targets.length == values.length, "TimelockController: lengt... | function executeBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata datas,
bytes32 predecessor,
bytes32 salt
) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {
require(targets.length == values.length, "TimelockController: lengt... | 23,617 |
96 | // Creates new token with token ID specified and assigns an ownership `_to` for this tokenUnsafe: doesn't execute `onERC721Received` on the receiver. Prefer the use of `saveMint` instead of `mint`.Should have a restricted access handled by the implementation_to an address to mint token to _tokenId ID of the token to mi... | function mint(address _to, uint256 _tokenId) external;
| function mint(address _to, uint256 _tokenId) external;
| 40,447 |
82 | // 34710 is the value that solidity is currently emittingIt includes callGas (700) + callVeryLow (3, to pay for SUB)+ callValueTransferGas (9000) + callNewAccountGas(25000, in case the destination address does not exist and needs creating) | sub(gas, 34710),
destination,
0, // transfer value in wei
dataAddress,
mload(data), // Size of the input, in bytes. Stored in position 0 of the array.
outputAddress,
0 // Output is ignored, therefore the output ... | sub(gas, 34710),
destination,
0, // transfer value in wei
dataAddress,
mload(data), // Size of the input, in bytes. Stored in position 0 of the array.
outputAddress,
0 // Output is ignored, therefore the output ... | 45,142 |
26 | // Verify ECDSA signature signer Expected signer digest Signature preimage v v r r s s / | function _verify(
address signer,
bytes32 digest,
uint8 v,
bytes32 r,
bytes32 s
| function _verify(
address signer,
bytes32 digest,
uint8 v,
bytes32 r,
bytes32 s
| 3,973 |
14 | // Event logged when a new address is authorized. | event AuthorizedAddressAdded(
address indexed target,
address indexed caller
);
| event AuthorizedAddressAdded(
address indexed target,
address indexed caller
);
| 43,402 |
78 | // triggered when a stake has been removed from the contract_user staker address _amount unstaked amount / | event Unstaked(address indexed _user, uint256 _amount);
| event Unstaked(address indexed _user, uint256 _amount);
| 19,828 |
248 | // Claims outstanding rewards for the sender.First updates outstanding reward allocation and then transfers. / | function claimReward() public {
_claimReward(_msgSender());
}
| function claimReward() public {
_claimReward(_msgSender());
}
| 57,971 |
13 | // Governance message is old. | error OldGovernanceMessage();
| error OldGovernanceMessage();
| 12,751 |
59 | // Transfer tokens from the caller to a new holder. / | function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all... | function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all... | 49,686 |
33 | // See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on`transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address. / | function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
| function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
| 35,828 |
3 | // Thrown if the plugin subdomain doesn't match the regex `[0-9a-z\-]` | error InvalidPluginSubdomain(string subdomain);
| error InvalidPluginSubdomain(string subdomain);
| 8,167 |
51 | // The NokuConsumptionPlan contract implements a flexible pricing plan, manageable by the contract owner, which can be: - extended by inserting a new service with its associated fee - modified by updating an existing service fee - reduced by removing an existing service with its associated fee - queried to obtain the c... | contract NokuConsumptionPlan is NokuPricingPlan, Ownable {
using SafeMath for uint256;
event LogNokuConsumptionPlanCreated(address indexed caller, address indexed nokuMasterToken, address indexed tokenBurner);
event LogServiceAdded(bytes32 indexed serviceName, uint indexed index, uint indexed serviceFee);
... | contract NokuConsumptionPlan is NokuPricingPlan, Ownable {
using SafeMath for uint256;
event LogNokuConsumptionPlanCreated(address indexed caller, address indexed nokuMasterToken, address indexed tokenBurner);
event LogServiceAdded(bytes32 indexed serviceName, uint indexed index, uint indexed serviceFee);
... | 39,172 |
13 | // Call settleAuction on the roboNouns contract. | uint256 mintedNounId = roboNounsToken.mint(expectedBlockNumber);
| uint256 mintedNounId = roboNounsToken.mint(expectedBlockNumber);
| 34,549 |
31 | // Validate that address and string array lengths match. Validate address array is not emptyand contains no duplicate elements.A Array of addresses B Array of strings / | function validatePairsWithArray(address[] memory A, string[] memory B) internal pure {
require(A.length == B.length, "Array length mismatch");
_validateLengthAndUniqueness(A);
}
| function validatePairsWithArray(address[] memory A, string[] memory B) internal pure {
require(A.length == B.length, "Array length mismatch");
_validateLengthAndUniqueness(A);
}
| 6,320 |
62 | // / | function approveAndCall(address from, address to, address token, uint256 tokens, uint256 relayerReward,
| function approveAndCall(address from, address to, address token, uint256 tokens, uint256 relayerReward,
| 37,018 |
61 | // Function to record an M-Bill transaction to mMetaData | function recordMData(address _accountAddress, uint256 _valIn, uint256 _valOut, address _coParty, uint256 _shareCap) external isApproved {
require(isUserRegistered(_accountAddress) == true, "Address provided is not linked to a Kyama account.");
require(_valIn >= 0, "Invalid deposit amount.");
... | function recordMData(address _accountAddress, uint256 _valIn, uint256 _valOut, address _coParty, uint256 _shareCap) external isApproved {
require(isUserRegistered(_accountAddress) == true, "Address provided is not linked to a Kyama account.");
require(_valIn >= 0, "Invalid deposit amount.");
... | 52,785 |
4 | // Initialize vault contract. _treasuryAddress address of treasury where part of flash loan fee is sent. _flashLoanProviderAddress provider of flash loans _maxCapacity max capacity for a vault / | function initialize(
address _treasuryAddress,
address _flashLoanProviderAddress,
uint256 _maxCapacity
| function initialize(
address _treasuryAddress,
address _flashLoanProviderAddress,
uint256 _maxCapacity
| 25,143 |
161 | // Returns an URI for a given token ID.Throws if the token ID does not exist. May return an empty string. _tokenId - uint256 ID of the token queriedreturn token URI / | function tokenURI(uint256 _tokenId) external view returns (string memory) {
require(_exists(_tokenId), "ERC721Metadata: received a URI query for a nonexistent token");
(uint256 optionId, uint256 issuedId) = _decodeTokenId(_tokenId);
return string(abi.encodePacked(baseURI, wearables[optionI... | function tokenURI(uint256 _tokenId) external view returns (string memory) {
require(_exists(_tokenId), "ERC721Metadata: received a URI query for a nonexistent token");
(uint256 optionId, uint256 issuedId) = _decodeTokenId(_tokenId);
return string(abi.encodePacked(baseURI, wearables[optionI... | 57,639 |
190 | // Owner can't liquidate themselves | require(msg.sender != vaultOwner, "Owner can't liquidate themselves");
uint256 amtCollateral = calculateCollateralToPay(
oTokensToLiquidate,
Number(1, 0)
);
uint256 amtIncentive = calculateCollateralToPay(
oTokensToLiquidate,
liquidationIn... | require(msg.sender != vaultOwner, "Owner can't liquidate themselves");
uint256 amtCollateral = calculateCollateralToPay(
oTokensToLiquidate,
Number(1, 0)
);
uint256 amtIncentive = calculateCollateralToPay(
oTokensToLiquidate,
liquidationIn... | 43,464 |
5 | // Temporary value used in the many-to-one proxy constructor. The many-to-one proxy contract is deployed with create2 and uses static initialization code for simple address derivation, so it calls the proxy manager in the constructor to get this address in order to save it as an immutable in the bytecode. | address internal _implementationHolder;
| address internal _implementationHolder;
| 43,561 |
104 | // Swap the targetToken for depositToken | temp.tokensToSwap = _getTokenAmount(address(poolInfo.targetToken), temp.buyAmount);
require(temp.tokensToSwap > 0, "bad token swap");
address[] memory uniswapPath = new address[](3);
uniswapPath[0] = address(poolInfo.targetToken);
uniswapPath[1] = address(weth... | temp.tokensToSwap = _getTokenAmount(address(poolInfo.targetToken), temp.buyAmount);
require(temp.tokensToSwap > 0, "bad token swap");
address[] memory uniswapPath = new address[](3);
uniswapPath[0] = address(poolInfo.targetToken);
uniswapPath[1] = address(weth... | 7,834 |
2 | // Treasure wallet. | address public treasureWallet;
| address public treasureWallet;
| 14,332 |
14 | // to check number of token for given Eth | function NativeToToken(uint256 _amount) public view returns (uint256) {
uint256 EthToUsd = (_amount * (getLatestPrice())) / (1 ether);
uint256 numberOfTokens = (EthToUsd * (tokenPerUsd)) / (1e8);
return numberOfTokens;
}
| function NativeToToken(uint256 _amount) public view returns (uint256) {
uint256 EthToUsd = (_amount * (getLatestPrice())) / (1 ether);
uint256 numberOfTokens = (EthToUsd * (tokenPerUsd)) / (1e8);
return numberOfTokens;
}
| 167 |
173 | // 1 = Gold Token 2 = Mint Token 3 = Promotional Token | uint256 internal MAX_TOKEN_COUNT = 3;
| uint256 internal MAX_TOKEN_COUNT = 3;
| 51,266 |
79 | // Called to `msg.sender` after executing a swap via IUniswapV3Poolswap./In the implementation you must pay the pool tokens owed for the swap./ The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory./ amount0Delta and amount1Delta can both be 0 if no tokens were swapp... | function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
| function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
| 3,119 |
315 | // borrow the amount we want | ironBankToken.borrow(amount);
| ironBankToken.borrow(amount);
| 47,232 |
112 | // Queries the amount of unclaimed rewards for the pool member in a given epoch and feeHandlerreturn 0 if PoolMaster has not called claimRewardMasterreturn 0 if PoolMember has previously claimed reward for the epochreturn 0 if PoolMember has not stake for the epochreturn 0 if PoolMember has not delegated it stake to th... | function getUnclaimedRewardsMember(
address _poolMember,
uint256 _epoch,
address _feeHandler
| function getUnclaimedRewardsMember(
address _poolMember,
uint256 _epoch,
address _feeHandler
| 28,425 |
33 | // Remove a fuse pool | function removeFusePool(address pool_address) public onlyByOwnGov {
require(pool_address != address(0), "Zero address detected");
require(fuse_pools[pool_address] == true, "Address nonexistant");
// Delete from the mapping
delete fuse_pools[pool_address];
// 'Delete... | function removeFusePool(address pool_address) public onlyByOwnGov {
require(pool_address != address(0), "Zero address detected");
require(fuse_pools[pool_address] == true, "Address nonexistant");
// Delete from the mapping
delete fuse_pools[pool_address];
// 'Delete... | 37,688 |
17 | // WAS permit | IUniswapV2ERC20(address(stakingToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
stakingToken.safeTransferFrom(user, address(this), amount);
userLastBalanceInPeriod[currentPeriod][user] = _balances[user];
uint256 longTermStake = (Math.max(periodEnds[currentPeriod],bl... | IUniswapV2ERC20(address(stakingToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
stakingToken.safeTransferFrom(user, address(this), amount);
userLastBalanceInPeriod[currentPeriod][user] = _balances[user];
uint256 longTermStake = (Math.max(periodEnds[currentPeriod],bl... | 30,284 |
1 | // returns true if keeper should call setStopLossPrimer for strategy | function canUpdateStopLoss() external view returns (bool);
| function canUpdateStopLoss() external view returns (bool);
| 33,138 |
229 | // Do not distribute rewards before games begin | if (block.timestamp < startTime) {
return 0;
}
| if (block.timestamp < startTime) {
return 0;
}
| 18,570 |
35 | // Add address to Early Investors | function addtoEarlyInvestors(address _address, uint _transferPercent, uint _transferPercentTotal) public onlyOwner{
addOfEarlyInvestor[_address] = true;
emit EventEarlyInvestor(_address, true);
lockupHolderMap[_address] = LockupHolderDetails({
transferPercent: _transferPerce... | function addtoEarlyInvestors(address _address, uint _transferPercent, uint _transferPercentTotal) public onlyOwner{
addOfEarlyInvestor[_address] = true;
emit EventEarlyInvestor(_address, true);
lockupHolderMap[_address] = LockupHolderDetails({
transferPercent: _transferPerce... | 34,093 |
7 | // Returns an URI for a given token ID | function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
| function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
| 931 |
0 | // Keep track of which Ethereum addresses we've sent Ether and our YTKN ERC20 token to | mapping (address => bool) public sentEtherAddresses;
mapping (address => bool) public sentYTKNAddresses;
| mapping (address => bool) public sentEtherAddresses;
mapping (address => bool) public sentYTKNAddresses;
| 8,419 |
102 | // 计算(rAmount, rTransferAmount, rFee, tTransferAmount, tFee); | function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, c... | function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, c... | 21,902 |
21 | // rounds to zero if xy < RAY / 2 | function rdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, RAY), y / 2) / y;
}
| function rdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, RAY), y / 2) / y;
}
| 2,196 |
41 | // then update the grantedToken; | grantedToken[msg.sender] = grantedToken[msg.sender].sub(releasable(msg.sender));
grantedToken[_to] = grantedToken[_to].sub(releasable(_to));
| grantedToken[msg.sender] = grantedToken[msg.sender].sub(releasable(msg.sender));
grantedToken[_to] = grantedToken[_to].sub(releasable(_to));
| 5,894 |
5 | // Buys a land for a specific price (payable)/The land must be for sale before other user calls this method. If the same user had the higher bid before, it gets refunded into the pending withdrawals. On success, emits the LandBought event. Executes a ERC721 safeTransferFrom/tokenId The id of the land to be bought | function buyLand(uint tokenId) external payable {
require(msg.sender != nonFungibleContract.ownerOf(tokenId), "You cant buy your own land");
Offer memory offer = landIdToOfferForSale[tokenId];
require(offer.isForSale, "Item is not for sale");
require(offer.seller == nonFungi... | function buyLand(uint tokenId) external payable {
require(msg.sender != nonFungibleContract.ownerOf(tokenId), "You cant buy your own land");
Offer memory offer = landIdToOfferForSale[tokenId];
require(offer.isForSale, "Item is not for sale");
require(offer.seller == nonFungi... | 22,430 |
135 | // Hash the primary sales module data | for (uint256 i = 0; i < primarySaleModulesConfig_.length; i++) {
configHash_ = keccak256(
abi.encodePacked(
configHash_,
primarySaleModulesConfig_[i].templateId,
primarySaleModulesConfig_[i].configData
)
);
}
| for (uint256 i = 0; i < primarySaleModulesConfig_.length; i++) {
configHash_ = keccak256(
abi.encodePacked(
configHash_,
primarySaleModulesConfig_[i].templateId,
primarySaleModulesConfig_[i].configData
)
);
}
| 37,153 |
553 | // ABI encodes an order and hash with a selector to be passed into/an EIP1271 compliant `isValidSignature` function. | function _encodeEIP1271OrderWithHash(
LibOrder.Order memory order,
bytes32 orderHash
)
private
pure
returns (bytes memory encoded)
| function _encodeEIP1271OrderWithHash(
LibOrder.Order memory order,
bytes32 orderHash
)
private
pure
returns (bytes memory encoded)
| 12,440 |
90 | // transfer from taker to maker because order is an offer | transferTokenToBuyer(order.assetType, order.tokenAddress, order.tokenId,
order.tokenQuantity, order.taker, order.maker);
distributeRevenue(order.price, order.maker, order, order.erc20PaymentContract);
emit Sale(order);
| transferTokenToBuyer(order.assetType, order.tokenAddress, order.tokenId,
order.tokenQuantity, order.taker, order.maker);
distributeRevenue(order.price, order.maker, order, order.erc20PaymentContract);
emit Sale(order);
| 8,949 |
258 | // Migration contract address | MintverseNFTShared public migrationTarget;
mapping(address => bool) public sharedProxyAddresses;
| MintverseNFTShared public migrationTarget;
mapping(address => bool) public sharedProxyAddresses;
| 19,885 |
34 | // Decrease the amount of tokens that an owner allowed to a spender.Approve should be called when allowed[_spender] == 0. To decrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds. _s... | function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
| function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
| 5,247 |
110 | // As opposed to {transferFrom}, this imposes no restrictions on msg.sender. from current owner of the token to address to receive the ownership of the given token ID tokenId uint256 ID of the token to be transferred / | function _transferFrom(address from, address to, uint256 tokenId) internal {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_clearApproval(tokenId);
_ownedTokensCount[from].decrement... | function _transferFrom(address from, address to, uint256 tokenId) internal {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_clearApproval(tokenId);
_ownedTokensCount[from].decrement... | 14,864 |
73 | // no action will be taken if winningOptionVotes are less than QUORUM | if (winningOptionVotes < QUORUM) {
revert("QUORUM not reached!");
}
| if (winningOptionVotes < QUORUM) {
revert("QUORUM not reached!");
}
| 16,123 |
43 | // Refund transaction - return the bet amount of a roll that was not processed in a due timeframe. Processing such blocks is not possible due to EVM limitations (see BET_EXPIRATION_BLOCKS comment above for details). In case you ever find yourself in a situation like this, just contact the dice2.win support, however not... | function refundBet(uint commit) external {
// Check that bet is in 'active' state.
Game storage game = games[commit];
uint bet1Amount = game.bet1Amount;
uint bet2Amount = game.bet2Amount;
uint bet3Amount = game.bet3Amount;
uint bet4Amount = game.bet4Amount;
uint bet5Amount = game.bet5Amoun... | function refundBet(uint commit) external {
// Check that bet is in 'active' state.
Game storage game = games[commit];
uint bet1Amount = game.bet1Amount;
uint bet2Amount = game.bet2Amount;
uint bet3Amount = game.bet3Amount;
uint bet4Amount = game.bet4Amount;
uint bet5Amount = game.bet5Amoun... | 47,564 |
0 | // For a reward to be issued, user state must be set to 99, meaning "Rewardable" this is to be considered the final state of users in issuer contracts | mapping(uint256 => mapping(address => uint8)) internal memberState_;
| mapping(uint256 => mapping(address => uint8)) internal memberState_;
| 41,854 |
32 | // Make sure we are not done yet. | modifier canMint() {
require(!released);
_;
}
| modifier canMint() {
require(!released);
_;
}
| 42,436 |
9 | // Override isApprovedForAll owner The owner of the Nouns operator The operator to check if approved / | function isApprovedForAll(address _owner, address operator) public view override(IERC721, ERC721) returns (bool) {
require(blockList[operator] == false, 'Operator has been denied by contract owner.');
if (authorized[operator] == true) {
return true;
}
return super.isApp... | function isApprovedForAll(address _owner, address operator) public view override(IERC721, ERC721) returns (bool) {
require(blockList[operator] == false, 'Operator has been denied by contract owner.');
if (authorized[operator] == true) {
return true;
}
return super.isApp... | 30,013 |
18 | // Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`. | * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
funct... | * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
funct... | 26,187 |
70 | // ----------------------------------------Management---------------------------------------- |
address public managementContractAddress;
|
address public managementContractAddress;
| 28,341 |
36 | // The total amount of tokens which are in the auxiliary buffer. | uint256 public totalBuffered;
| uint256 public totalBuffered;
| 30,167 |
25 | // Calculate and mint LPs to be awarded | actualLP = R_ * totalSupply() >> 64;
require(actualLP > minLP, "DFP: No deal");
_mint(msg.sender, actualLP);
| actualLP = R_ * totalSupply() >> 64;
require(actualLP > minLP, "DFP: No deal");
_mint(msg.sender, actualLP);
| 22,566 |
10 | // Shortcut for the actual value | if (_blockNum >= pastShots[pastShots.length.sub(1)].blockNum) {
return pastShots[pastShots.length.sub(1)].value;
}
| if (_blockNum >= pastShots[pastShots.length.sub(1)].blockNum) {
return pastShots[pastShots.length.sub(1)].value;
}
| 1,990 |
11 | // See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length. / | function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new ui... | function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new ui... | 3,600 |
9 | // calculate inflation and adjust ve balances accordingly | function calculate_growth(uint _minted) public view returns (uint) {
return _ve.totalSupply() * _minted / _token.totalSupply();
}
| function calculate_growth(uint _minted) public view returns (uint) {
return _ve.totalSupply() * _minted / _token.totalSupply();
}
| 24,955 |
15 | // A Secondary contract can only be used by its primary account (the one that created it). / | contract Secondary {
address private _primary;
/**
* @dev Emitted when the primary contract changes.
*/
event PrimaryTransferred(
address recipient
);
/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
*/
constructor () internal ... | contract Secondary {
address private _primary;
/**
* @dev Emitted when the primary contract changes.
*/
event PrimaryTransferred(
address recipient
);
/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
*/
constructor () internal ... | 1,036 |
240 | // In some circumstance, we should not burn TIGER on transfer, eg: Transfer from owner to distribute bounty, from depositing to swap for liquidity | function addTransferBurnExceptAddress(address _transferBurnExceptAddress) public onlyOwner {
tiger.addTransferBurnExceptAddress(_transferBurnExceptAddress);
}
| function addTransferBurnExceptAddress(address _transferBurnExceptAddress) public onlyOwner {
tiger.addTransferBurnExceptAddress(_transferBurnExceptAddress);
}
| 17,551 |
20 | // Just helper for array summ. / | function getArraySum(uint256[] memory _array) external pure returns (uint256) {
return _getArraySum(_array);
}
| function getArraySum(uint256[] memory _array) external pure returns (uint256) {
return _getArraySum(_array);
}
| 11,754 |
43 | // Send ETH to xfBot PoolShare | uint256 xfAmt = EthTaxBalanceXF;
if (xfAmt > 0) {
(bool success, ) = payable(xfPoolShare).call{value: xfAmt}("");
| uint256 xfAmt = EthTaxBalanceXF;
if (xfAmt > 0) {
(bool success, ) = payable(xfPoolShare).call{value: xfAmt}("");
| 32,400 |
254 | // verify signature based on contract key, contract group, token amount, and the msg sender | function verifySignature(
bytes memory _signature
| function verifySignature(
bytes memory _signature
| 40,948 |
1 | // Store the function selector of `checkDelegateForAll(address,address)`. | mstore(0x00, 0x9c395bc2)
| mstore(0x00, 0x9c395bc2)
| 36,875 |
135 | // to avoid stack too deep error | uint256 endBlock = auction.endBlock;
if (block.number >= endBlock.sub(auctionExtensionInterval)) {
auction.endBlock = endBlock.add(auctionExtensionInterval);
}
| uint256 endBlock = auction.endBlock;
if (block.number >= endBlock.sub(auctionExtensionInterval)) {
auction.endBlock = endBlock.add(auctionExtensionInterval);
}
| 29,741 |
135 | // Returns the combination of two storage arrays. A The first array B The second arrayreturn Returns A appended by a / | function sExtend(address[] storage A, address[] storage B) internal {
uint256 length = B.length;
for (uint256 i = 0; i < length; i++) {
A.push(B[i]);
}
}
| function sExtend(address[] storage A, address[] storage B) internal {
uint256 length = B.length;
for (uint256 i = 0; i < length; i++) {
A.push(B[i]);
}
}
| 26,952 |
107 | // referral system | if(msg.data.length == 20 && referralSystemOn == 1) {
referrer = bytesToAddress(bytes(msg.data));
require(referrer != msg.sender);
| if(msg.data.length == 20 && referralSystemOn == 1) {
referrer = bytesToAddress(bytes(msg.data));
require(referrer != msg.sender);
| 11,364 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.