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 |
|---|---|---|---|---|
131 | // Remove dial votes from total votes | postCappedVotes -= dialVotes[k];
| postCappedVotes -= dialVotes[k];
| 18,959 |
8 | // Domin | whitelistedAddresses.push(0xde4F53f2735467330B8b884abdd0d131aA98ef82);
| whitelistedAddresses.push(0xde4F53f2735467330B8b884abdd0d131aA98ef82);
| 17,531 |
308 | // registering the optional erc721 metadata interface with ERC165.sol using the ID specified in the standard: https:eips.ethereum.org/EIPS/eip-721 | _registerInterface(0x5b5e139f);
| _registerInterface(0x5b5e139f);
| 32,331 |
18 | // get the current available amount to be withdrawn | uint256 eligibleWithdrawalAmount = IXVSVault(xvsVault).getEligibleWithdrawalAmount(xvs, pid, user.contractAddress);
require(eligibleWithdrawalAmount > 0, "Nothing to withdraw");
| uint256 eligibleWithdrawalAmount = IXVSVault(xvsVault).getEligibleWithdrawalAmount(xvs, pid, user.contractAddress);
require(eligibleWithdrawalAmount > 0, "Nothing to withdraw");
| 38,044 |
312 | // Returns an `AddressSlot` with member `value` located at `slot`. / | function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly {
r.slot := slot
}
}
| function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly {
r.slot := slot
}
}
| 31,764 |
22 | // 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,
uint value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| function functionCallWithValue(
address target,
bytes memory data,
uint value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
| 1,453 |
0 | // Phuture price oracle interface/Aggregates all price oracles and works with them through IPriceOracle interface | interface IPhuturePriceOracle is IPriceOracle {
/// @notice Initializes price oracle
/// @param _registry Index registry address
/// @param _base Base asset
function initialize(address _registry, address _base) external;
/// @notice Assigns given oracle to specified asset. Then oracle will be used to manage asset price
/// @param _asset Asset to register
/// @param _oracle Oracle to assign
function setOracleOf(address _asset, address _oracle) external;
/// @notice Removes oracle of specified asset
/// @param _asset Asset to remove oracle from
function removeOracleOf(address _asset) external;
/// @notice Converts to index amount
/// @param _baseAmount Amount in base
/// @param _indexDecimals Index's decimals
/// @return Asset per base in UQ with index decimals
function convertToIndex(uint _baseAmount, uint8 _indexDecimals) external view returns (uint);
/// @notice Checks if the given asset has oracle assigned
/// @param _asset Asset to check
/// @return Returns boolean flag defining if the given asset has oracle assigned
function containsOracleOf(address _asset) external view returns (bool);
/// @notice Price oracle assigned to the given `_asset`
/// @param _asset Asset to obtain price oracle for
/// @return Returns price oracle assigned to the `_asset`
function priceOracleOf(address _asset) external view returns (address);
}
| interface IPhuturePriceOracle is IPriceOracle {
/// @notice Initializes price oracle
/// @param _registry Index registry address
/// @param _base Base asset
function initialize(address _registry, address _base) external;
/// @notice Assigns given oracle to specified asset. Then oracle will be used to manage asset price
/// @param _asset Asset to register
/// @param _oracle Oracle to assign
function setOracleOf(address _asset, address _oracle) external;
/// @notice Removes oracle of specified asset
/// @param _asset Asset to remove oracle from
function removeOracleOf(address _asset) external;
/// @notice Converts to index amount
/// @param _baseAmount Amount in base
/// @param _indexDecimals Index's decimals
/// @return Asset per base in UQ with index decimals
function convertToIndex(uint _baseAmount, uint8 _indexDecimals) external view returns (uint);
/// @notice Checks if the given asset has oracle assigned
/// @param _asset Asset to check
/// @return Returns boolean flag defining if the given asset has oracle assigned
function containsOracleOf(address _asset) external view returns (bool);
/// @notice Price oracle assigned to the given `_asset`
/// @param _asset Asset to obtain price oracle for
/// @return Returns price oracle assigned to the `_asset`
function priceOracleOf(address _asset) external view returns (address);
}
| 2,912 |
18 | // this flow is to prevent transferring ownership to wrong wallet by mistake | function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(now, owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
| function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(now, owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
| 36,265 |
29 | // This function unstakes locked in amount and burns 5%, this also updates amounts on total supply | function unstake(uint256 amount, bytes memory data) public override returns (bool) {
require(amount <= stakedbalances[msg.sender]);
require(amount <= totalstaked);
require(amount < 20, "Amount to low to process");
stakedbalances[msg.sender] = stakedbalances[msg.sender].sub(amount);
totalstaked = totalstaked.sub(amount);
uint256 burned = cutForBurn(amount);
totalSupply_ = totalSupply_.sub(burned);
balances[burnaddress] = balances[burnaddress].add(burned);
balances[msg.sender] = balances[msg.sender].add(amount.sub(burned));
emit Unstaked(msg.sender, amount.sub(burned), stakedbalances[msg.sender], data);
emit Transfer(msg.sender, msg.sender, amount.sub(burned));
emit Transfer(msg.sender, burnaddress, burned);
return true;
}
| function unstake(uint256 amount, bytes memory data) public override returns (bool) {
require(amount <= stakedbalances[msg.sender]);
require(amount <= totalstaked);
require(amount < 20, "Amount to low to process");
stakedbalances[msg.sender] = stakedbalances[msg.sender].sub(amount);
totalstaked = totalstaked.sub(amount);
uint256 burned = cutForBurn(amount);
totalSupply_ = totalSupply_.sub(burned);
balances[burnaddress] = balances[burnaddress].add(burned);
balances[msg.sender] = balances[msg.sender].add(amount.sub(burned));
emit Unstaked(msg.sender, amount.sub(burned), stakedbalances[msg.sender], data);
emit Transfer(msg.sender, msg.sender, amount.sub(burned));
emit Transfer(msg.sender, burnaddress, burned);
return true;
}
| 70,367 |
23 | // return the full vesting schedule entries vest for a given user. / | function checkAccountSchedule(
address pool,
address token,
address account
| function checkAccountSchedule(
address pool,
address token,
address account
| 81,047 |
3 | // Only "Spot" for now | enum RateTypes { Spot, Fixed }
/// @dev if a rate is quoted against USD or ETH
enum RateBase { Usd, Eth }
/**
* @dev if a rate is expressed in a number of ...
* the base currency units for one quoted currency unit (i.e. "Direct"),
* or the quoted currency units per one base currency unit (i.e. "Indirect")
*/
enum QuoteType { Direct, Indirect }
struct PriceFeed {
address feed;
address asset;
RateBase base;
QuoteType side;
uint8 decimals;
uint16 maxDelaySecs;
// 0 - highest; default for now, as only one feed for an asset supported
uint8 priority;
}
| enum RateTypes { Spot, Fixed }
/// @dev if a rate is quoted against USD or ETH
enum RateBase { Usd, Eth }
/**
* @dev if a rate is expressed in a number of ...
* the base currency units for one quoted currency unit (i.e. "Direct"),
* or the quoted currency units per one base currency unit (i.e. "Indirect")
*/
enum QuoteType { Direct, Indirect }
struct PriceFeed {
address feed;
address asset;
RateBase base;
QuoteType side;
uint8 decimals;
uint16 maxDelaySecs;
// 0 - highest; default for now, as only one feed for an asset supported
uint8 priority;
}
| 42,365 |
39 | // Gets a trait from the current collection using the provided "traitIndex" and "index".Used in minting function. traitIndex The index which indicates what type of trait it is [0-9]. index The index of the specific trait to grab. Variable array size depending on collection.return Trait object. / | function getTraitFromCurrentCollection(uint256 traitIndex, uint256 index) public view
| function getTraitFromCurrentCollection(uint256 traitIndex, uint256 index) public view
| 37,212 |
19 | // getter balace in this contract and boba gateway _tokenAddress address/ | function getTotalBalance(address _tokenAddress) public view returns (uint256) {
(uint256 reward, ) = getReward(_tokenAddress);
uint256 amount = getPoolAmount(_tokenAddress);
return amount.add(reward);
}
| function getTotalBalance(address _tokenAddress) public view returns (uint256) {
(uint256 reward, ) = getReward(_tokenAddress);
uint256 amount = getPoolAmount(_tokenAddress);
return amount.add(reward);
}
| 25,792 |
189 | // Account will receive netfCash amount. Deduct that from the fCash claim and add the remaining back to the nToken to net off the nToken's position fCashToNToken = -fCashShare netfCash = fCashClaim + fCashShare fCashToNToken = -(netfCash - fCashClaim) fCashToNToken = fCashClaim - netfCash | fCashToNToken = fCashClaim.sub(netfCash[i]);
| fCashToNToken = fCashClaim.sub(netfCash[i]);
| 3,480 |
77 | // This is to support Native meta transactions never use msg.sender directly, use _msgSender() instead | function _msgSender() internal view returns (address sender) {
return ContextMixin.msgSender();
}
| function _msgSender() internal view returns (address sender) {
return ContextMixin.msgSender();
}
| 21,814 |
23 | // To change the approve amount you first have to reduce the addresses`allowance to zero by calling `approve(_spender, 0)` if it is notalready 0 to mitigate the race condition described here:https:github.com/ethereum/EIPs/issues/20issuecomment-263524729 | require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
| 2,953 |
12 | // See {IIdentityRegistry-setClaimTopicsRegistry}. / | function setClaimTopicsRegistry(address _claimTopicsRegistry) external override onlyOwner {
_tokenTopicsRegistry = IClaimTopicsRegistry(_claimTopicsRegistry);
emit ClaimTopicsRegistrySet(_claimTopicsRegistry);
}
| function setClaimTopicsRegistry(address _claimTopicsRegistry) external override onlyOwner {
_tokenTopicsRegistry = IClaimTopicsRegistry(_claimTopicsRegistry);
emit ClaimTopicsRegistrySet(_claimTopicsRegistry);
}
| 7,401 |
56 | // Set the configuration timestamp is now. | uint256 _configured = block.timestamp;
| uint256 _configured = block.timestamp;
| 27,336 |
9 | // this function allows to approve all the tokens the address owns at once / | function approveAll(address _to) public {
uint256[] memory tokens = tokensOf(msg.sender);
for (uint256 t = 0; t < tokens.length; t++) {
approve(_to, tokens[t]);
}
}
| function approveAll(address _to) public {
uint256[] memory tokens = tokensOf(msg.sender);
for (uint256 t = 0; t < tokens.length; t++) {
approve(_to, tokens[t]);
}
}
| 11,383 |
66 | // |/Throws if called by any account other than the Controller contract | modifier onlyController() {
require(_controller == msg.sender, "WMB:E-108");
_;
}
| modifier onlyController() {
require(_controller == msg.sender, "WMB:E-108");
_;
}
| 70,753 |
2,314 | // 1159 | entry "sixtiethly" : ENG_ADVERB
| entry "sixtiethly" : ENG_ADVERB
| 21,995 |
191 | // If there's no limit or if the limit is greater than the start distance, apply the discount rate of the base. | if (_limitLength == 0 || _limitLength > _startDistance) {
| if (_limitLength == 0 || _limitLength > _startDistance) {
| 40,728 |
104 | // Claim rewardToken and convert rewardToken into collateral token.Calculate interest fee on earning from rewardToken and transfer balance minusfee to pool. Transferring collateral to pool will increase pool share price. / | function _claimComp() internal {
address[] memory markets = new address[](1);
markets[0] = address(cToken);
comptroller.claimComp(address(this), markets);
uint256 amt = IERC20(rewardToken).balanceOf(address(this));
if (amt != 0) {
IUniswapV2Router02 uniswapRouter = IUniswapV2Router02(controller.uniswapRouter());
address[] memory path = _getPath(rewardToken, address(collateralToken));
uint256 amountOut = uniswapRouter.getAmountsOut(amt, path)[path.length - 1];
if (amountOut != 0) {
IERC20(rewardToken).safeApprove(address(uniswapRouter), 0);
IERC20(rewardToken).safeApprove(address(uniswapRouter), amt);
uniswapRouter.swapExactTokensForTokens(amt, 1, path, address(this), now + 30);
uint256 _collateralEarned = collateralToken.balanceOf(address(this));
uint256 _fee = _collateralEarned.mul(controller.interestFee(pool)).div(1e18);
collateralToken.safeTransfer(pool, _collateralEarned.sub(_fee));
}
}
}
| function _claimComp() internal {
address[] memory markets = new address[](1);
markets[0] = address(cToken);
comptroller.claimComp(address(this), markets);
uint256 amt = IERC20(rewardToken).balanceOf(address(this));
if (amt != 0) {
IUniswapV2Router02 uniswapRouter = IUniswapV2Router02(controller.uniswapRouter());
address[] memory path = _getPath(rewardToken, address(collateralToken));
uint256 amountOut = uniswapRouter.getAmountsOut(amt, path)[path.length - 1];
if (amountOut != 0) {
IERC20(rewardToken).safeApprove(address(uniswapRouter), 0);
IERC20(rewardToken).safeApprove(address(uniswapRouter), amt);
uniswapRouter.swapExactTokensForTokens(amt, 1, path, address(this), now + 30);
uint256 _collateralEarned = collateralToken.balanceOf(address(this));
uint256 _fee = _collateralEarned.mul(controller.interestFee(pool)).div(1e18);
collateralToken.safeTransfer(pool, _collateralEarned.sub(_fee));
}
}
}
| 22,452 |
75 | // Flag to check if rewards for a fraud proof are claimable | bool canClaim;
| bool canClaim;
| 6,211 |
9 | // Address of the curator | address public curator;
| address public curator;
| 9,294 |
37 | // Internal variables | uint256 internal totalSupply_;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowances;
| uint256 internal totalSupply_;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowances;
| 45,406 |
17 | // if the allowance isn't 0, it can only be updated to 0 to prevent an allowance change immediately after withdrawal | require(_value == 0 || allowance[msg.sender][_spender] == 0);
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| require(_value == 0 || allowance[msg.sender][_spender] == 0);
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
| 43,355 |
116 | // Credit Eanrings to Balance | referralBalance_[referrer] = SafeMath.add(referralBalance_[referrer], ethToReferrer);
userData[referrer].affRewardsSum = SafeMath.add(userData[referrer].affRewardsSum, ethToReferrer);
| referralBalance_[referrer] = SafeMath.add(referralBalance_[referrer], ethToReferrer);
userData[referrer].affRewardsSum = SafeMath.add(userData[referrer].affRewardsSum, ethToReferrer);
| 180 |
105 | // common errors | string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin'
string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small
| string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin'
string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small
| 3,310 |
21 | // mapping to return what to add according to x index | mapping(uint256 => uint256) public x_addition;
| mapping(uint256 => uint256) public x_addition;
| 51,143 |
2 | // Transfer a token. This throws on insufficient balance. | function transfer(address to, uint256 amount) public {
require(balanceOf[msg.sender] >= amount, "insufficient balance");
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
}
| function transfer(address to, uint256 amount) public {
require(balanceOf[msg.sender] >= amount, "insufficient balance");
balanceOf[msg.sender] -= amount;
balanceOf[to] += amount;
emit Transfer(msg.sender, to, amount);
}
| 35,424 |
94 | // Posts a data request into the WRB in expectation that it will be relayed and resolved in Witnet with a total reward that equals to msg.value./_dr The bytes corresponding to the Protocol Buffers serialization of the data request output./_tallyReward The amount of value that will be detracted from the transaction value and reserved for rewarding the reporting of the final result (aka tally) of the data request./ return The unique identifier of the data request. | function postDataRequest(bytes calldata _dr, uint256 _tallyReward) external payable returns(uint256);
| function postDataRequest(bytes calldata _dr, uint256 _tallyReward) external payable returns(uint256);
| 32,132 |
255 | // Create their synths | synths[sUSD].issue(from, amount);
| synths[sUSD].issue(from, amount);
| 30,156 |
9 | // Returns true if there is a price deviation. ethTotals Balance of each token in ethers. / | function hasDeviation(uint256[] memory ethTotals)
internal
view
returns (bool)
| function hasDeviation(uint256[] memory ethTotals)
internal
view
returns (bool)
| 72,385 |
10 | // Mapping of coin balances | mapping (address => uint256) public balanceOf;
| mapping (address => uint256) public balanceOf;
| 9,203 |
327 | // Calculate fee in underlyings and send them to feeAddressamount : in idleTokens redeemed : in underlying currPrice : current idleToken pricereturn : net value in underlying / | function _getFee(uint256 amount, uint256 redeemed, uint256 currPrice) internal returns (uint256) {
uint256 avgPrice = userAvgPrices[msg.sender];
if (currPrice < avgPrice) {
return redeemed;
}
// 10**23 -> ONE_18 * FULL_ALLOC
uint256 feeDue = amount.mul(currPrice.sub(avgPrice)).mul(fee).div(10**23);
_transferTokens(token, feeAddress, feeDue);
return redeemed.sub(feeDue);
}
| function _getFee(uint256 amount, uint256 redeemed, uint256 currPrice) internal returns (uint256) {
uint256 avgPrice = userAvgPrices[msg.sender];
if (currPrice < avgPrice) {
return redeemed;
}
// 10**23 -> ONE_18 * FULL_ALLOC
uint256 feeDue = amount.mul(currPrice.sub(avgPrice)).mul(fee).div(10**23);
_transferTokens(token, feeAddress, feeDue);
return redeemed.sub(feeDue);
}
| 15,867 |
47 | // The parameters an offeror sets when making an offer for NFTs. assetContract The contract of the NFTs for which the offer is being made.tokenId The tokenId of the NFT for which the offer is being made.quantity The quantity of NFTs wanted.currency The currency offered for the NFTs.totalPrice The total offer amount for the NFTs.expirationTimestamp The timestamp at and after which the offer cannot be accepted. / | struct OfferParams {
address assetContract;
uint256 tokenId;
uint256 quantity;
address currency;
uint256 totalPrice;
uint256 expirationTimestamp;
}
| struct OfferParams {
address assetContract;
uint256 tokenId;
uint256 quantity;
address currency;
uint256 totalPrice;
uint256 expirationTimestamp;
}
| 27,262 |
226 | // note if we call this interface, we must ensure that the oldest observation preserved in pool is older than 2h ago | function _getAvgTickFromTarget(address pool, uint32 targetTimestamp, int56 latestTickCumu, uint32 latestTimestamp)
private
view
returns (int24 tick)
| function _getAvgTickFromTarget(address pool, uint32 targetTimestamp, int56 latestTickCumu, uint32 latestTimestamp)
private
view
returns (int24 tick)
| 28,460 |
8 | // emit EventRoll(IFEAS_roll.GetIdToPlayer(queryId), IFEAS_roll.GetIdToRollTarget(queryId), IFEAS_roll.GetIdToRollProb(queryId), won, rn1, rn2, IFEAS_artworks.GetArtworksLength()); have to issue and transfer card here. don't forget to mark into idToWonPrizeTransfered[] mapping variable. prize could be sent multiple times without this flag. |
if(IFEAS_roll.GetIdToWonPrizeTransfered(queryId) != true){
if(won == true){
RollWin(queryId);
}else{
|
if(IFEAS_roll.GetIdToWonPrizeTransfered(queryId) != true){
if(won == true){
RollWin(queryId);
}else{
| 26,321 |
3 | // The next token ID of the NFT that can be claimed. | uint256 nextTokenIdToClaim;
| uint256 nextTokenIdToClaim;
| 43,733 |
8 | // Get user balance----------------Return the amount of the in-contract balance of the user return uint256The balance of the user in the smallest unit (like wei). / | function getBalance() external view returns (uint256) {
return users[msg.sender].balance;
}
| function getBalance() external view returns (uint256) {
return users[msg.sender].balance;
}
| 35,243 |
584 | // Keep track of in XDRs in our fee pool. | recentFeePeriods[0].feesToDistribute = recentFeePeriods[0].feesToDistribute.add(xdrAmount);
| recentFeePeriods[0].feesToDistribute = recentFeePeriods[0].feesToDistribute.add(xdrAmount);
| 30,896 |
30 | // Get the percentage of protocol volume rewards for the account/account to get the percentage of protocol volume rewards for/ return the percentage of protocol volume rewards for the account | function getAMMBonusPercentage(address account) public view returns (uint) {
uint baseReward = getBaseReward(account);
if (baseReward == 0) {
return 0;
}
return
_getTotalAMMVolume(account) >= baseReward.mul(AMMVolumeRewardsMultiplier)
? maxAMMVolumeRewardsPercentage.mul(ONE_PERCENT)
: _getTotalAMMVolume(account).mul(ONE_PERCENT).mul(maxAMMVolumeRewardsPercentage).div(
baseReward.mul(AMMVolumeRewardsMultiplier)
);
}
| function getAMMBonusPercentage(address account) public view returns (uint) {
uint baseReward = getBaseReward(account);
if (baseReward == 0) {
return 0;
}
return
_getTotalAMMVolume(account) >= baseReward.mul(AMMVolumeRewardsMultiplier)
? maxAMMVolumeRewardsPercentage.mul(ONE_PERCENT)
: _getTotalAMMVolume(account).mul(ONE_PERCENT).mul(maxAMMVolumeRewardsPercentage).div(
baseReward.mul(AMMVolumeRewardsMultiplier)
);
}
| 18,882 |
34 | // An event thats emitted when the minter address is changed | event MinterChanged(address minter, address newMinter);
| event MinterChanged(address minter, address newMinter);
| 990 |
131 | // This event emits when distributed funds are withdrawn by a token holder. by the address of the receiver of funds fundsWithdrawn the amount of funds that were withdrawn / | event FundsWithdrawn(address indexed by, uint256 fundsWithdrawn);
| event FundsWithdrawn(address indexed by, uint256 fundsWithdrawn);
| 32,439 |
43 | // Set edition id start to be 1 not 0 | atEditionId.increment();
| atEditionId.increment();
| 60,812 |
167 | // Set the address of the new owner of the contract/Set _newOwner to address(0) to renounce any ownership./_newOwner The address of the new owner of the contract | function transferOwnership(address _newOwner) external;
| function transferOwnership(address _newOwner) external;
| 8,886 |
31 | // Handle non-overflow cases, 256 by 256 division. | if (prod1 == 0) {
return prod0 / denominator;
}
| if (prod1 == 0) {
return prod0 / denominator;
}
| 2,500 |
1 | // The address of the Radcoin ERC20 token contract. | Radcoin public radcoin;
/*//////////////////////////////////////////////////////////////
MINT CONSTANTS
| Radcoin public radcoin;
/*//////////////////////////////////////////////////////////////
MINT CONSTANTS
| 38,802 |
9 | // Create an iterator./self The RLP item./ return An 'Iterator' over the item. | function iterator(RLPLib.RLPItem memory self) internal pure returns (RLPLib.Iterator memory it) {
if (!isList(self))
revert();
uint ptr = self._unsafe_memPtr + _payloadOffset(self);
it._unsafe_item = self;
it._unsafe_nextPtr = ptr;
}
| function iterator(RLPLib.RLPItem memory self) internal pure returns (RLPLib.Iterator memory it) {
if (!isList(self))
revert();
uint ptr = self._unsafe_memPtr + _payloadOffset(self);
it._unsafe_item = self;
it._unsafe_nextPtr = ptr;
}
| 9,473 |
8 | // After getting money from the vault, do something with it./amount The amount received from the vault./Since investment is often gas-intensive and may require off-chain data, this will often be unimplemented./Strategists will call custom functions for handling deployment of capital. | function _afterInvest(uint256 amount) internal virtual {}
/// @notice Withdraw vault's underlying asset from strategy.
/// @param amount The amount to withdraw.
/// @return The amount of `asset` divested from the strategy
function divest(uint256 amount) external onlyVault returns (uint256) {
return _divest(amount);
}
| function _afterInvest(uint256 amount) internal virtual {}
/// @notice Withdraw vault's underlying asset from strategy.
/// @param amount The amount to withdraw.
/// @return The amount of `asset` divested from the strategy
function divest(uint256 amount) external onlyVault returns (uint256) {
return _divest(amount);
}
| 18,247 |
36 | // The fee information, including platform fee, bounty fee and withdraw fee. | FeeInfo public feeInfo;
| FeeInfo public feeInfo;
| 22,365 |
3 | // Should only be called if it's `eligibleForClaim`.Otherwise, it could throw a 'division by zero' error orreturns zero / | function calculateIndemnity(
BenefitFlightDelay storage self,
uint64 claimedIndemnity,
uint64 scheduledTime,
uint64 actualTime
| function calculateIndemnity(
BenefitFlightDelay storage self,
uint64 claimedIndemnity,
uint64 scheduledTime,
uint64 actualTime
| 18,240 |
33 | // retrieve the size of the code at address `addr` | size := extcodesize(addr)
| size := extcodesize(addr)
| 50,454 |
29 | // UUID identifying this campaign | string uuid;
| string uuid;
| 4,425 |
7 | // support ERC20, ERC721 | function burn(uint256) external;
| function burn(uint256) external;
| 44,570 |
58 | // Polyline end | appendBytes(svg, mload(add(polylineEnds, mul(iCol, 0x20))))
| appendBytes(svg, mload(add(polylineEnds, mul(iCol, 0x20))))
| 84,774 |
4 | // See {ERC20Mintable-mint}. Requirements: - `value` must not cause the total supply to go over the cap. / | function _mint(address account, uint256 value) internal {
require(
_supplyCap == 0 || totalSupply().add(value) <= _supplyCap,
"Cap exceeded"
);
super._mint(account, value);
}
| function _mint(address account, uint256 value) internal {
require(
_supplyCap == 0 || totalSupply().add(value) <= _supplyCap,
"Cap exceeded"
);
super._mint(account, value);
}
| 43,765 |
3 | // called by the BURNER_ROLE to burn tokens / | function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
| function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
super._burn(tokenId);
}
| 18,788 |
119 | // profits are calculated | uint fee = payout.mul( terms.fee ).div( 10000 );
uint profit = value.sub( payout ).sub( fee );
| uint fee = payout.mul( terms.fee ).div( 10000 );
uint profit = value.sub( payout ).sub( fee );
| 24,585 |
202 | // ПЬЯНСТВОВАТЬ->[ПЬЯНСТ]-ВО-ВАТЬ^^^^^^ | syllab_rule SYLLABER_430 language=Russian
| syllab_rule SYLLABER_430 language=Russian
| 40,502 |
0 | // Callback for IUniswapV3PoolActionsswap/Any contract that calls IUniswapV3PoolActionsswap must implement this interface | interface IUniswapV3SwapCallback {
/// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
/// @dev 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 swapped.
/// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
/// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
/// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
}
| interface IUniswapV3SwapCallback {
/// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
/// @dev 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 swapped.
/// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
/// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
/// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
/// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
}
| 3,938 |
39 | // Trigger on any successful call to approve(address spender, uint amount)// Trigger when tokens are transferred, including zero value transfers//_parameters The address of system parameters contract / | constructor(address _parameters) public Auth(_parameters) {}
/**
* @notice Only Vault can mint USDP
* @dev Mints 'amount' of tokens to address 'to', and MUST fire the
* Transfer event
* @param to The address of the recipient
* @param amount The amount of token to be minted
**/
function mint(address to, uint amount) external onlyVault {
require(to != address(0), "Unit Protocol: ZERO_ADDRESS");
balanceOf[to] = balanceOf[to].add(amount);
totalSupply = totalSupply.add(amount);
emit Transfer(address(0), to, amount);
}
| constructor(address _parameters) public Auth(_parameters) {}
/**
* @notice Only Vault can mint USDP
* @dev Mints 'amount' of tokens to address 'to', and MUST fire the
* Transfer event
* @param to The address of the recipient
* @param amount The amount of token to be minted
**/
function mint(address to, uint amount) external onlyVault {
require(to != address(0), "Unit Protocol: ZERO_ADDRESS");
balanceOf[to] = balanceOf[to].add(amount);
totalSupply = totalSupply.add(amount);
emit Transfer(address(0), to, amount);
}
| 20,099 |
145 | // called through LINK's transferAndCall to update available fundsin the same transaction as the funds were transferred to the aggregator _data is mostly ignored. It is checked for length, to be surenothing strange is passed in. / | function onTokenTransfer(address, uint256, bytes calldata _data)
external
| function onTokenTransfer(address, uint256, bytes calldata _data)
external
| 56,075 |
0 | // bZx shared storage | contract BZxStorage is BZxObjects, BZxEvents, ReentrancyGuard, Ownable, GasTracker {
uint256 internal constant MAX_UINT = 2**256 - 1;
/* solhint-disable var-name-mixedcase */
address public bZRxTokenContract;
address public bZxEtherContract;
address public wethContract;
address payable public vaultContract;
address public oracleRegistryContract;
address public bZxTo0xContract;
address public bZxTo0xV2Contract;
bool public DEBUG_MODE = false;
/* solhint-enable var-name-mixedcase */
// Loan Orders
mapping (bytes32 => LoanOrder) public orders; // mapping of loanOrderHash to on chain loanOrders
mapping (bytes32 => LoanOrderAux) public orderAux; // mapping of loanOrderHash to on chain loanOrder auxiliary parameters
mapping (bytes32 => uint256) public orderFilledAmounts; // mapping of loanOrderHash to loanTokenAmount filled
mapping (bytes32 => uint256) public orderCancelledAmounts; // mapping of loanOrderHash to loanTokenAmount cancelled
mapping (bytes32 => address) public orderLender; // mapping of loanOrderHash to lender (only one lender per order)
// Loan Positions
mapping (uint256 => LoanPosition) public loanPositions; // mapping of position ids to loanPositions
mapping (bytes32 => mapping (address => uint256)) public loanPositionsIds; // mapping of loanOrderHash to mapping of trader address to position id
// Lists
mapping (address => bytes32[]) public orderList; // mapping of lenders and trader addresses to array of loanOrderHashes
mapping (bytes32 => mapping (address => ListIndex)) public orderListIndex; // mapping of loanOrderHash to mapping of lenders and trader addresses to ListIndex objects
mapping (bytes32 => uint256[]) public orderPositionList; // mapping of loanOrderHash to array of order position ids
PositionRef[] public positionList; // array of loans that need to be checked for liquidation or expiration
mapping (uint256 => ListIndex) public positionListIndex; // mapping of position ids to ListIndex objects
// Interest
mapping (address => mapping (address => uint256)) public tokenInterestOwed; // mapping of lender address to mapping of interest token address to amount of interest owed for all loans (assuming they go to full term)
mapping (address => mapping (address => mapping (address => LenderInterest))) public lenderOracleInterest; // mapping of lender address to mapping of oracle to mapping of interest token to LenderInterest objects
mapping (bytes32 => LenderInterest) public lenderOrderInterest; // mapping of loanOrderHash to LenderInterest objects
mapping (uint256 => TraderInterest) public traderLoanInterest; // mapping of position ids to TraderInterest objects
// Other Storage
mapping (address => address) public oracleAddresses; // mapping of oracles to their current logic contract
mapping (bytes32 => mapping (address => bool)) public preSigned; // mapping of hash => signer => signed
mapping (address => mapping (address => bool)) public allowedValidators; // mapping of signer => validator => approved
// General Purpose
mapping (bytes => uint256) internal dbUint256;
mapping (bytes => uint256[]) internal dbUint256Array;
mapping (bytes => address) internal dbAddress;
mapping (bytes => address[]) internal dbAddressArray;
mapping (bytes => bool) internal dbBool;
mapping (bytes => bool[]) internal dbBoolArray;
mapping (bytes => bytes32) internal dbBytes32;
mapping (bytes => bytes32[]) internal dbBytes32Array;
mapping (bytes => bytes) internal dbBytes;
mapping (bytes => bytes[]) internal dbBytesArray;
}
| contract BZxStorage is BZxObjects, BZxEvents, ReentrancyGuard, Ownable, GasTracker {
uint256 internal constant MAX_UINT = 2**256 - 1;
/* solhint-disable var-name-mixedcase */
address public bZRxTokenContract;
address public bZxEtherContract;
address public wethContract;
address payable public vaultContract;
address public oracleRegistryContract;
address public bZxTo0xContract;
address public bZxTo0xV2Contract;
bool public DEBUG_MODE = false;
/* solhint-enable var-name-mixedcase */
// Loan Orders
mapping (bytes32 => LoanOrder) public orders; // mapping of loanOrderHash to on chain loanOrders
mapping (bytes32 => LoanOrderAux) public orderAux; // mapping of loanOrderHash to on chain loanOrder auxiliary parameters
mapping (bytes32 => uint256) public orderFilledAmounts; // mapping of loanOrderHash to loanTokenAmount filled
mapping (bytes32 => uint256) public orderCancelledAmounts; // mapping of loanOrderHash to loanTokenAmount cancelled
mapping (bytes32 => address) public orderLender; // mapping of loanOrderHash to lender (only one lender per order)
// Loan Positions
mapping (uint256 => LoanPosition) public loanPositions; // mapping of position ids to loanPositions
mapping (bytes32 => mapping (address => uint256)) public loanPositionsIds; // mapping of loanOrderHash to mapping of trader address to position id
// Lists
mapping (address => bytes32[]) public orderList; // mapping of lenders and trader addresses to array of loanOrderHashes
mapping (bytes32 => mapping (address => ListIndex)) public orderListIndex; // mapping of loanOrderHash to mapping of lenders and trader addresses to ListIndex objects
mapping (bytes32 => uint256[]) public orderPositionList; // mapping of loanOrderHash to array of order position ids
PositionRef[] public positionList; // array of loans that need to be checked for liquidation or expiration
mapping (uint256 => ListIndex) public positionListIndex; // mapping of position ids to ListIndex objects
// Interest
mapping (address => mapping (address => uint256)) public tokenInterestOwed; // mapping of lender address to mapping of interest token address to amount of interest owed for all loans (assuming they go to full term)
mapping (address => mapping (address => mapping (address => LenderInterest))) public lenderOracleInterest; // mapping of lender address to mapping of oracle to mapping of interest token to LenderInterest objects
mapping (bytes32 => LenderInterest) public lenderOrderInterest; // mapping of loanOrderHash to LenderInterest objects
mapping (uint256 => TraderInterest) public traderLoanInterest; // mapping of position ids to TraderInterest objects
// Other Storage
mapping (address => address) public oracleAddresses; // mapping of oracles to their current logic contract
mapping (bytes32 => mapping (address => bool)) public preSigned; // mapping of hash => signer => signed
mapping (address => mapping (address => bool)) public allowedValidators; // mapping of signer => validator => approved
// General Purpose
mapping (bytes => uint256) internal dbUint256;
mapping (bytes => uint256[]) internal dbUint256Array;
mapping (bytes => address) internal dbAddress;
mapping (bytes => address[]) internal dbAddressArray;
mapping (bytes => bool) internal dbBool;
mapping (bytes => bool[]) internal dbBoolArray;
mapping (bytes => bytes32) internal dbBytes32;
mapping (bytes => bytes32[]) internal dbBytes32Array;
mapping (bytes => bytes) internal dbBytes;
mapping (bytes => bytes[]) internal dbBytesArray;
}
| 30,842 |
83 | // liquidityFee = 1% | uint256 liquidityFee = tAmount.div(100);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
uint256 tTransferAmount = tAmount.sub(tFee.mul(3));
| uint256 liquidityFee = tAmount.div(100);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
uint256 tTransferAmount = tAmount.sub(tFee.mul(3));
| 5,850 |
9 | // Used to return the details of a document with a known name (`string`). _name Name of the documentreturn string The data associated with the document.return uint256 the timestamp at which the document was last modified. / | function getDocument(string calldata _name) external view returns (string memory, uint256) {
return (
_documents[_name].data,
uint256(_documents[_name].lastModified)
);
}
| function getDocument(string calldata _name) external view returns (string memory, uint256) {
return (
_documents[_name].data,
uint256(_documents[_name].lastModified)
);
}
| 42,865 |
30 | // XXX: added linter disable solhint-disable-next-line not-rely-on-time | require(block.timestamp <= expiry, "Uni::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
| require(block.timestamp <= expiry, "Uni::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
| 27,910 |
43 | // Safe to terminate immediately since no postfix modifiers are applied. | assembly {
stop()
}
| assembly {
stop()
}
| 30,391 |
178 | // Add a consideration item for each creator payout. | if (payoutAmount != 0) {
for (uint256 i = 0; i < creatorPayoutsLength; ) {
| if (payoutAmount != 0) {
for (uint256 i = 0; i < creatorPayoutsLength; ) {
| 15,100 |
38 | // Set the address that has the authority to approve users by KYC. ---- ICO-Platform Note ----The horizon-globex.com ICO platform shall register a fully licensed Swiss KYCprovider to assess each potential Contributor for KYC and AML under Swiss law.-- End ICO-Platform Note --who The address of the KYC provider. / | function setKycProvider(address who) public onlyOwner {
regulatorApprovedKycProvider = who;
}
| function setKycProvider(address who) public onlyOwner {
regulatorApprovedKycProvider = who;
}
| 5,603 |
68 | // exclude owner and this contract from fee | _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
| _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
| 6,096 |
58 | // Returns the addition of two unsigned integers, reverting with custom message on overflow. Counterpart to Solidity's `+` operator. Requirements:- Addition cannot overflow. / |
function add(
uint256 a,
uint256 b,
string memory errorMessage
|
function add(
uint256 a,
uint256 b,
string memory errorMessage
| 5,982 |
13 | // get total hearts by id with legacy contract totaled in | function getTotalHeartsByDappId(uint256 dapp_id) public view returns(uint256) {
return totals[dapp_id].add(firstContract.getTotalHeartsByDappId(dapp_id));
}
| function getTotalHeartsByDappId(uint256 dapp_id) public view returns(uint256) {
return totals[dapp_id].add(firstContract.getTotalHeartsByDappId(dapp_id));
}
| 45,813 |
0 | // A getter function for the current AppChallenge state/identityHash The unique hash of an `AppIdentity`/ return A `AppChallenge` object representing the state of the on-chain challenge | function getAppChallenge(bytes32 identityHash)
external
view
returns (LibStateChannelApp.AppChallenge memory)
| function getAppChallenge(bytes32 identityHash)
external
view
returns (LibStateChannelApp.AppChallenge memory)
| 29,913 |
12 | // flightSuretyData.createAirline(_address,_airlineName); | flightSuretyData.createAirline(_address);
| flightSuretyData.createAirline(_address);
| 24,147 |
62 | // Public Sale | if (now >= startPublicSaleStage && now < endPublicSaleStage && totalPublicSaleStage < maxPublicSaleStage){
tokens = weiAmount.mul(ratePublicSaleStage);
if (maxPublicSaleStage.sub(totalPublicSaleStage) < tokens){
tokens = maxPublicSaleStage.sub(totalPublicSaleStage);
weiAmount = tokens.div(ratePublicSaleStage);
backAmount = msg.value.sub(weiAmount);
}
| if (now >= startPublicSaleStage && now < endPublicSaleStage && totalPublicSaleStage < maxPublicSaleStage){
tokens = weiAmount.mul(ratePublicSaleStage);
if (maxPublicSaleStage.sub(totalPublicSaleStage) < tokens){
tokens = maxPublicSaleStage.sub(totalPublicSaleStage);
weiAmount = tokens.div(ratePublicSaleStage);
backAmount = msg.value.sub(weiAmount);
}
| 48,631 |
3 | // State of Basket Manager | bool internal _paused;
| bool internal _paused;
| 20,347 |
10 | // token contract address => resourceID | mapping (address => bytes32) public _tokenContractAddressToResourceID;
| mapping (address => bytes32) public _tokenContractAddressToResourceID;
| 3,655 |
60 | // voting weight using {IGovernor-getVotes} and call the {_countVote} internal function. Emits a {IGovernor-VoteCast} event. / | function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason,
bytes memory params
) internal virtual returns (uint256) {
ProposalCore storage proposal = _proposals[proposalId];
require(state(proposalId) == ProposalState.Active, "Governor: vote not currently active");
| function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason,
bytes memory params
) internal virtual returns (uint256) {
ProposalCore storage proposal = _proposals[proposalId];
require(state(proposalId) == ProposalState.Active, "Governor: vote not currently active");
| 3,356 |
40 | // Amount of issued tokens | uint256 public tokensIssued;
| uint256 public tokensIssued;
| 60,576 |
0 | // ERC721 ethereum "standard" interface / | contract ERC721 {
event Transfer(address _from, address _to, uint256 _tokenId);
event Approval(address _owner, address _approved, uint256 _tokenId);
function balanceOf(address _owner) public view returns (uint256 _balance);
function ownerOf(uint256 _tokenId) public view returns (address _owner);
function transfer(address _to, uint256 _tokenId) public;
function approve(address _to, uint256 _tokenId) public;
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function tokensOfOwner(address _owner) external view returns (uint256[] tokenIds);
function totalSupply() constant returns (uint256 totalSupply);
function tokenMetadata(uint256 _tokenId) constant returns (string infoUrl);
function name() constant returns (string name);
function symbol() constant returns (string symbol);
}
| contract ERC721 {
event Transfer(address _from, address _to, uint256 _tokenId);
event Approval(address _owner, address _approved, uint256 _tokenId);
function balanceOf(address _owner) public view returns (uint256 _balance);
function ownerOf(uint256 _tokenId) public view returns (address _owner);
function transfer(address _to, uint256 _tokenId) public;
function approve(address _to, uint256 _tokenId) public;
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function tokensOfOwner(address _owner) external view returns (uint256[] tokenIds);
function totalSupply() constant returns (uint256 totalSupply);
function tokenMetadata(uint256 _tokenId) constant returns (string infoUrl);
function name() constant returns (string name);
function symbol() constant returns (string symbol);
}
| 33,611 |
163 | // Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ | // function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// // benefit is lost if 'b' is also tested.
// // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
// if (a == 0) {
// return 0;
// }
// uint256 c = a * b;
// require(c / a == b, "SafeMath: multiplication overflow");
// return c;
// }
| // function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// // benefit is lost if 'b' is also tested.
// // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
// if (a == 0) {
// return 0;
// }
// uint256 c = a * b;
// require(c / a == b, "SafeMath: multiplication overflow");
// return c;
// }
| 71,264 |
75 | // Function that returns NFT's pending rewards | function pendingRewards(uint _NFT) public view returns(uint) {
NFT storage nft = NFTDetails[_NFT];
uint256 _accBNfyPerShare = accBNfyPerShare;
if (block.number > lastRewardBlock && totalStaked != 0) {
uint256 blocksToReward = block.number.sub(lastRewardBlock);
uint256 bnfyReward = blocksToReward.mul(getRewardPerBlock());
_accBNfyPerShare = _accBNfyPerShare.add(bnfyReward.mul(1e18).div(totalStaked));
}
return nft._LPDeposited.mul(_accBNfyPerShare).div(1e18).sub(nft._rewardDebt);
}
| function pendingRewards(uint _NFT) public view returns(uint) {
NFT storage nft = NFTDetails[_NFT];
uint256 _accBNfyPerShare = accBNfyPerShare;
if (block.number > lastRewardBlock && totalStaked != 0) {
uint256 blocksToReward = block.number.sub(lastRewardBlock);
uint256 bnfyReward = blocksToReward.mul(getRewardPerBlock());
_accBNfyPerShare = _accBNfyPerShare.add(bnfyReward.mul(1e18).div(totalStaked));
}
return nft._LPDeposited.mul(_accBNfyPerShare).div(1e18).sub(nft._rewardDebt);
}
| 12,413 |
13 | // Executes a single request | function executeRequest(address origin, uint256 identifier) external {
SeedData storage data = _seedData[origin][identifier];
require(
_lastBatchTimestamp + _batchCadence > block.timestamp,
"Seeder::executeRequest: Cannot seed individually during batch seeding"
);
require(
data.randomnessId == 0 && _batchToReq[data.batch] == 0,
"Seeder::generateSeed: Seed already generated"
);
require(
data.batch != 0,
"Seeder::generateSeed: Seed not yet requested"
);
if (LINK.balanceOf(address(this)) < _fee) {
LINK.transferFrom(address(msg.sender), address(this), _fee);
}
bytes32 linkReqID = requestRandomness(_keyHash, _fee);
data.randomnessId = linkReqID;
data.batch = 0;
if (LINK.balanceOf(address(this)) > 0) {
LINK.transfer(msg.sender, LINK.balanceOf(address(this)));
}
}
| function executeRequest(address origin, uint256 identifier) external {
SeedData storage data = _seedData[origin][identifier];
require(
_lastBatchTimestamp + _batchCadence > block.timestamp,
"Seeder::executeRequest: Cannot seed individually during batch seeding"
);
require(
data.randomnessId == 0 && _batchToReq[data.batch] == 0,
"Seeder::generateSeed: Seed already generated"
);
require(
data.batch != 0,
"Seeder::generateSeed: Seed not yet requested"
);
if (LINK.balanceOf(address(this)) < _fee) {
LINK.transferFrom(address(msg.sender), address(this), _fee);
}
bytes32 linkReqID = requestRandomness(_keyHash, _fee);
data.randomnessId = linkReqID;
data.batch = 0;
if (LINK.balanceOf(address(this)) > 0) {
LINK.transfer(msg.sender, LINK.balanceOf(address(this)));
}
}
| 18,129 |
293 | // Initiates a new rebase operation, provided the minimum time period has elapsed.The supply adjustment equals (_totalSupplyDeviationFromTargetRate) / rebaseLag Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate and targetRate is 1e18 / |
function rebase()
public
|
function rebase()
public
| 3,009 |
152 | // Add the gas reimbursment amount to the bounty. | self.paymentData.bountyOwed = measuredGasConsumption
.mul(self.txnData.gasPrice)
.add(self.paymentData.bountyOwed);
| self.paymentData.bountyOwed = measuredGasConsumption
.mul(self.txnData.gasPrice)
.add(self.paymentData.bountyOwed);
| 34,951 |
137 | // See {IERC721-approve}. / | function approve(address to, uint256 tokenId) public override {
| function approve(address to, uint256 tokenId) public override {
| 60,748 |
20 | // receive ETH | receive() external payable;
| receive() external payable;
| 22,365 |
10 | // Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call datais empty. / | receive() external payable virtual {
_fallback();
}
| receive() external payable virtual {
_fallback();
}
| 27,196 |
76 | // See {IERC165-supportsInterface}. / | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
| function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
| 1,139 |
41 | // Allows _spender to withdraw from your account multiple times, up to the _value amount. Ifthis function is called again it overwrites the current allowance with _value. _spender The address of the account able to transfer the tokens. _value The amount of tokens to be approved for transfer. / | function approve(
address _spender,
uint256 _value
)
public
returns (bool _success)
| function approve(
address _spender,
uint256 _value
)
public
returns (bool _success)
| 63,654 |
18 | // observation data array | Oracle.Observation[65535] public observations;
uint256 public totalFeeXCharged;
uint256 public totalFeeYCharged;
address private original;
address private swapModuleX2Y;
address private swapModuleY2X;
address private liquidityModule;
| Oracle.Observation[65535] public observations;
uint256 public totalFeeXCharged;
uint256 public totalFeeYCharged;
address private original;
address private swapModuleX2Y;
address private swapModuleY2X;
address private liquidityModule;
| 30,470 |
173 | // Either retrieves the option token if it already exists, or deploy it closeParams is the struct with details on previous option and strike selection details vaultParams is the struct with vault general data underlying is the address of the underlying asset of the option collateralAsset is the address of the collateral asset of the option strikePrice is the strike price of the option expiry is the expiry timestamp of the option isPut is whether the option is a putreturn the address of the option / | function getOrDeployOtoken(
CloseParams calldata closeParams,
Vault.VaultParams storage vaultParams,
address underlying,
address collateralAsset,
uint256 strikePrice,
uint256 expiry,
bool isPut
| function getOrDeployOtoken(
CloseParams calldata closeParams,
Vault.VaultParams storage vaultParams,
address underlying,
address collateralAsset,
uint256 strikePrice,
uint256 expiry,
bool isPut
| 17,312 |
142 | // Calculate byte length of array | let arrayByteLen := mul(mload(addressArray), 32)
| let arrayByteLen := mul(mload(addressArray), 32)
| 43,401 |
194 | // The MILKYWAY_Token! | MilkyWayToken public milk;
| MilkyWayToken public milk;
| 40,619 |
921 | // An Implementation of IExchangeV3./This contract supports upgradability proxy, therefore its constructor/must do NOTHING./Brecht Devos - <[email protected]>/Daniel Wang- <[email protected]> | contract ExchangeV3 is IExchangeV3, ReentrancyGuard, ERC1155Holder, ERC721Holder
| contract ExchangeV3 is IExchangeV3, ReentrancyGuard, ERC1155Holder, ERC721Holder
| 20,000 |
44 | // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such that denominatorinv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for four bits. That is, denominatorinv = 1 mod 2^4. | uint256 inverse = (3 * denominator) ^ 2;
| uint256 inverse = (3 * denominator) ^ 2;
| 34,342 |
39 | // Mint a ParagonsDAO Player ID NFT for PDT (Whitelist). Requires a signature with the dummy address for validation. nameOn-chain username for the minter. signatureSignature to verify whitelist. / | function whitelistMint(bytes32 name, bytes memory signature) external nonReentrant {
// Verify Signature
if (!verifyAddressSigner(signature)) revert InvalidSignature();
// Can only claim once
if (_playerClaimed[msg.sender]) revert AlreadyClaimed();
// Must pass a non-empty name string
if (name == 0x0) revert InvalidName();
// Start with token id 1
_tokenIds.increment();
uint256 tokenID = _tokenIds.current();
// Update PlayerManagement
IPlayerManagement pm = IPlayerManagement(_addressRegistry.playerMgmt());
pm.initializePlayerData(tokenID, name);
// Update address to id mapping
_playerId[msg.sender] = tokenID;
// Update claimed mapping
_playerClaimed[msg.sender] = true;
// Claim event
emit PlayerClaimed(msg.sender, tokenID, false, name);
// Transfer PDT to treasury if cost > 0
IERC20 pdt = IERC20(_addressRegistry.pdt());
uint256 pdtCost = pm.getPdpMintCost(true);
if (pdtCost > 0) {
if (pdtCost > pdt.balanceOf(msg.sender)) revert BalanceTooLow();
pdt.transferFrom(msg.sender, _addressRegistry.treasury(), pdtCost);
}
// Mint NFT
_mint(msg.sender, tokenID);
}
| function whitelistMint(bytes32 name, bytes memory signature) external nonReentrant {
// Verify Signature
if (!verifyAddressSigner(signature)) revert InvalidSignature();
// Can only claim once
if (_playerClaimed[msg.sender]) revert AlreadyClaimed();
// Must pass a non-empty name string
if (name == 0x0) revert InvalidName();
// Start with token id 1
_tokenIds.increment();
uint256 tokenID = _tokenIds.current();
// Update PlayerManagement
IPlayerManagement pm = IPlayerManagement(_addressRegistry.playerMgmt());
pm.initializePlayerData(tokenID, name);
// Update address to id mapping
_playerId[msg.sender] = tokenID;
// Update claimed mapping
_playerClaimed[msg.sender] = true;
// Claim event
emit PlayerClaimed(msg.sender, tokenID, false, name);
// Transfer PDT to treasury if cost > 0
IERC20 pdt = IERC20(_addressRegistry.pdt());
uint256 pdtCost = pm.getPdpMintCost(true);
if (pdtCost > 0) {
if (pdtCost > pdt.balanceOf(msg.sender)) revert BalanceTooLow();
pdt.transferFrom(msg.sender, _addressRegistry.treasury(), pdtCost);
}
// Mint NFT
_mint(msg.sender, tokenID);
}
| 31,051 |
6 | // Withdraw NFT LP token Withdraw NFT LP token from staking pool _tokenId NFT LP Token ID / | function withdraw(uint256 _tokenId)
external
payable
returns (string memory _eventName, bytes memory _eventParam)
| function withdraw(uint256 _tokenId)
external
payable
returns (string memory _eventName, bytes memory _eventParam)
| 13,547 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.