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 |
|---|---|---|---|---|
249 | // DATA TYPES / | struct BitKoi {
// The fish's genetic code - this will never change for any fish.
uint256 genes;
// The timestamp from the block when this fish came into existence.
uint64 spawnTime;
// The minimum timestamp after which this fish can engage in spawning
// activities again.
uint64 cooldownEndBlock;
// The ID of the parents of this fish, set to 0 for gen0 fish.
// With uint32 there's a limit of 4 billion fish
uint32 parent1Id;
uint32 parent2Id;
// Set to the index in the cooldown array (see below) that represents
// the current cooldown duration for this fish. This starts at zero
// for gen0 fish, and is initialized to floor(generation/2) for others.
// Incremented by one for each successful breeding action.
uint16 cooldownIndex;
// The "generation number" of this fish. Fish minted by the KP contract
// for sale are called "gen0" and have a generation number of 0. The
// generation number of all other fish is the larger of the two generation
// numbers of their parents, plus one.
uint16 generation;
}
| struct BitKoi {
// The fish's genetic code - this will never change for any fish.
uint256 genes;
// The timestamp from the block when this fish came into existence.
uint64 spawnTime;
// The minimum timestamp after which this fish can engage in spawning
// activities again.
uint64 cooldownEndBlock;
// The ID of the parents of this fish, set to 0 for gen0 fish.
// With uint32 there's a limit of 4 billion fish
uint32 parent1Id;
uint32 parent2Id;
// Set to the index in the cooldown array (see below) that represents
// the current cooldown duration for this fish. This starts at zero
// for gen0 fish, and is initialized to floor(generation/2) for others.
// Incremented by one for each successful breeding action.
uint16 cooldownIndex;
// The "generation number" of this fish. Fish minted by the KP contract
// for sale are called "gen0" and have a generation number of 0. The
// generation number of all other fish is the larger of the two generation
// numbers of their parents, plus one.
uint16 generation;
}
| 25,142 |
37 | // revoke debt transaction, which is used for source storeman group/ xHash hash of HTLC random number/ statusStatus, should be 'Locked' for asset or 'DebtLocked' for debt | function revokeDebtTx(Data storage self, bytes32 xHash, TxStatus status)
external
| function revokeDebtTx(Data storage self, bytes32 xHash, TxStatus status)
external
| 26,211 |
2 | // Function Modifiers// Enforces that the modified function is only callable by a specific cross-domain account. _sourceDomainAccount The only account on the originating domain which is authenticated to call this function. / | modifier onlyFromCrossDomainAccount(
address _sourceDomainAccount
| modifier onlyFromCrossDomainAccount(
address _sourceDomainAccount
| 49,572 |
4 | // address public WETH = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2; | IUniswapV2Router02 unisawp = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
| IUniswapV2Router02 unisawp = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
| 10,971 |
0 | // Define the Waka token contract | constructor(IERC20 _waka) public {
waka = _waka;
}
| constructor(IERC20 _waka) public {
waka = _waka;
}
| 7,703 |
120 | // tracks if a keeper has a pending dispute | mapping(address => bool) public disputes;
| mapping(address => bool) public disputes;
| 79,007 |
92 | // IAutoTrader dYdX Interface that Auto-Traders for Solo must implement in order to approve trades. / | contract IAutoTrader {
// ============ Public Functions ============
/**
* Allows traders to make trades approved by this smart contract. The active trader's account is
* the takerAccount and the passive account (for which this contract approves trades
* on-behalf-of) is the makerAccount.
*
* @param inputMarketId The market for which the trader specified the original amount
* @param outputMarketId The market for which the trader wants the resulting amount specified
* @param makerAccount The account for which this contract is making trades
* @param takerAccount The account requesting the trade
* @param oldInputPar The old principal amount for the makerAccount for the inputMarketId
* @param newInputPar The new principal amount for the makerAccount for the inputMarketId
* @param inputWei The change in token amount for the makerAccount for the inputMarketId
* @param data Arbitrary data passed in by the trader
* @return The AssetAmount for the makerAccount for the outputMarketId
*/
function getTradeCost(
uint256 inputMarketId,
uint256 outputMarketId,
Account.Info memory makerAccount,
Account.Info memory takerAccount,
Types.Par memory oldInputPar,
Types.Par memory newInputPar,
Types.Wei memory inputWei,
bytes memory data
)
public
returns (Types.AssetAmount memory);
}
| contract IAutoTrader {
// ============ Public Functions ============
/**
* Allows traders to make trades approved by this smart contract. The active trader's account is
* the takerAccount and the passive account (for which this contract approves trades
* on-behalf-of) is the makerAccount.
*
* @param inputMarketId The market for which the trader specified the original amount
* @param outputMarketId The market for which the trader wants the resulting amount specified
* @param makerAccount The account for which this contract is making trades
* @param takerAccount The account requesting the trade
* @param oldInputPar The old principal amount for the makerAccount for the inputMarketId
* @param newInputPar The new principal amount for the makerAccount for the inputMarketId
* @param inputWei The change in token amount for the makerAccount for the inputMarketId
* @param data Arbitrary data passed in by the trader
* @return The AssetAmount for the makerAccount for the outputMarketId
*/
function getTradeCost(
uint256 inputMarketId,
uint256 outputMarketId,
Account.Info memory makerAccount,
Account.Info memory takerAccount,
Types.Par memory oldInputPar,
Types.Par memory newInputPar,
Types.Wei memory inputWei,
bytes memory data
)
public
returns (Types.AssetAmount memory);
}
| 59,114 |
5,484 | // 2743 | entry "sulphamoylated" : ENG_ADJECTIVE
| entry "sulphamoylated" : ENG_ADJECTIVE
| 19,355 |
89 | // Whether we should store the @BlockInfo for this block on-chain. | bool storeBlockInfoOnchain;
| bool storeBlockInfoOnchain;
| 12,479 |
3 | // Percentage for minimum amount of members signatures required | uint256 percentage;
| uint256 percentage;
| 55,077 |
0 | // Private instances of contracts to handle Utokens and Stokens | IUTokensV2 public _uTokens;
ISTokensV2 public _sTokens;
| IUTokensV2 public _uTokens;
ISTokensV2 public _sTokens;
| 20,903 |
17 | // Increment the number of businesses and trigger the event | noOfBusinesses = add(noOfBusinesses, 1);
businessAddresses.push(_businessAddress);
emit BusinessAdded(_businessAddress);
| noOfBusinesses = add(noOfBusinesses, 1);
businessAddresses.push(_businessAddress);
emit BusinessAdded(_businessAddress);
| 34,935 |
842 | // Restores `value` from logarithmic space. `value` is expected to be the result of a call to `toLowResLog`,any other function that returns 4 decimals fixed point logarithms, or the sum of such values. / | function fromLowResLog(int256 value) internal pure returns (uint256) {
return uint256(LogExpMath.exp(value * _LOG_COMPRESSION_FACTOR));
}
| function fromLowResLog(int256 value) internal pure returns (uint256) {
return uint256(LogExpMath.exp(value * _LOG_COMPRESSION_FACTOR));
}
| 30,705 |
136 | // amount of pending reward, users can harvest this this value calculated when admin update the pool | uint256 pendingReward;
| uint256 pendingReward;
| 42,690 |
224 | // Delegation pool information. One per indexer. / | struct DelegationPool {
uint32 cooldownBlocks; // Blocks to wait before updating parameters
uint32 indexingRewardCut; // in PPM
uint32 queryFeeCut; // in PPM
uint256 updatedAtBlock; // Block when the pool was last updated
uint256 tokens; // Total tokens as pool reserves
uint256 shares; // Total shares minted in the pool
mapping(address => Delegation) delegators; // Mapping of delegator => Delegation
}
| struct DelegationPool {
uint32 cooldownBlocks; // Blocks to wait before updating parameters
uint32 indexingRewardCut; // in PPM
uint32 queryFeeCut; // in PPM
uint256 updatedAtBlock; // Block when the pool was last updated
uint256 tokens; // Total tokens as pool reserves
uint256 shares; // Total shares minted in the pool
mapping(address => Delegation) delegators; // Mapping of delegator => Delegation
}
| 84,312 |
113 | // Close loan / | function payBack(uint256 loanId, address token)
public
whenNotPaused
validateLoan(loanId, token)
returns(bool)
| function payBack(uint256 loanId, address token)
public
whenNotPaused
validateLoan(loanId, token)
returns(bool)
| 7,317 |
1 | // (keeper contract address => keeper info). | mapping (address => KeeperInfo) public keepers;
| mapping (address => KeeperInfo) public keepers;
| 32,811 |
59 | // solhint-disable-next-line not-rely-on-time | proposal.times[1] = now;
orgBoostedProposalsCnt[proposal.organizationId]++;
| proposal.times[1] = now;
orgBoostedProposalsCnt[proposal.organizationId]++;
| 15,600 |
45 | // Update whether or not to use the automatic public sale times for a given token / | function setTokenUsePublicSaleTimes(
uint256 _tokenId,
bool _usePublicSaleTimes
| function setTokenUsePublicSaleTimes(
uint256 _tokenId,
bool _usePublicSaleTimes
| 21,294 |
47 | // 1-2 star | if (stars < 3) return 1;
| if (stars < 3) return 1;
| 27,946 |
33 | // CoiPreSale This crowdsale contract filters investments made according to- time- amount invested (in Wei) and forwards them to a predefined wallet in case all the filtering conditions are met. / | contract CoiPreSale is Pausable {
using SafeMath for uint256;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
// track the investments made from each address
mapping(address => uint256) public investments;
// total amount of funds raised (in wei)
uint256 public weiRaised;
uint256 public minWeiInvestment;
uint256 public maxWeiInvestment;
/**
* @dev Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
*/
event Investment(address indexed purchaser,
address indexed beneficiary,
uint256 value,
bytes payload);
/**
* @dev Constructor
* @param _startTime the time to begin the crowdsale in seconds since the epoch
* @param _endTime the time to begin the crowdsale in seconds since the epoch. Must be later than _startTime.
* @param _minWeiInvestment the minimum amount for one single investment (in Wei)
* @param _maxWeiInvestment the maximum amount for one single investment (in Wei)
* @param _wallet the address to which funds will be directed to
*/
constructor(uint256 _startTime,
uint256 _endTime,
uint256 _minWeiInvestment,
uint256 _maxWeiInvestment,
address _wallet) public {
require(_endTime > _startTime);
require(_minWeiInvestment > 0);
require(_maxWeiInvestment > _minWeiInvestment);
require(_wallet != address(0));
startTime = _startTime;
endTime = _endTime;
minWeiInvestment = _minWeiInvestment;
maxWeiInvestment = _maxWeiInvestment;
wallet = _wallet;
}
/**
* @dev External payable function to receive funds and buy tokens.
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev Adapted Crowdsale#hasEnded
* @return true if crowdsale event has started
*/
function hasStarted() external view returns (bool) {
return now >= startTime;
}
/**
* @dev Adapted Crowdsale#hasEnded
* @return true if crowdsale event has ended
*/
function hasEnded() external view returns (bool) {
return now > endTime;
}
/**
* @dev Low level token purchase function
* @param beneficiary the wallet to which the investment should be credited
*/
function buyTokens(address beneficiary) public whenNotPaused payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// track how much wei is raised in total
weiRaised = weiRaised.add(weiAmount);
// track how much was transfered by the specific investor
investments[beneficiary] = investments[beneficiary].add(weiAmount);
emit Investment(msg.sender, beneficiary, weiAmount, msg.data);
forwardFunds();
}
// send ether (wei) to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
wallet.transfer(msg.value);
}
// overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment
function validPurchase() internal view returns (bool) {
if (msg.value < minWeiInvestment || msg.value > maxWeiInvestment) {
return false;
}
bool withinPeriod = (now >= startTime) && (now <= endTime); // 1128581 1129653
return withinPeriod;
}
} | contract CoiPreSale is Pausable {
using SafeMath for uint256;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
// track the investments made from each address
mapping(address => uint256) public investments;
// total amount of funds raised (in wei)
uint256 public weiRaised;
uint256 public minWeiInvestment;
uint256 public maxWeiInvestment;
/**
* @dev Event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
*/
event Investment(address indexed purchaser,
address indexed beneficiary,
uint256 value,
bytes payload);
/**
* @dev Constructor
* @param _startTime the time to begin the crowdsale in seconds since the epoch
* @param _endTime the time to begin the crowdsale in seconds since the epoch. Must be later than _startTime.
* @param _minWeiInvestment the minimum amount for one single investment (in Wei)
* @param _maxWeiInvestment the maximum amount for one single investment (in Wei)
* @param _wallet the address to which funds will be directed to
*/
constructor(uint256 _startTime,
uint256 _endTime,
uint256 _minWeiInvestment,
uint256 _maxWeiInvestment,
address _wallet) public {
require(_endTime > _startTime);
require(_minWeiInvestment > 0);
require(_maxWeiInvestment > _minWeiInvestment);
require(_wallet != address(0));
startTime = _startTime;
endTime = _endTime;
minWeiInvestment = _minWeiInvestment;
maxWeiInvestment = _maxWeiInvestment;
wallet = _wallet;
}
/**
* @dev External payable function to receive funds and buy tokens.
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev Adapted Crowdsale#hasEnded
* @return true if crowdsale event has started
*/
function hasStarted() external view returns (bool) {
return now >= startTime;
}
/**
* @dev Adapted Crowdsale#hasEnded
* @return true if crowdsale event has ended
*/
function hasEnded() external view returns (bool) {
return now > endTime;
}
/**
* @dev Low level token purchase function
* @param beneficiary the wallet to which the investment should be credited
*/
function buyTokens(address beneficiary) public whenNotPaused payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// track how much wei is raised in total
weiRaised = weiRaised.add(weiAmount);
// track how much was transfered by the specific investor
investments[beneficiary] = investments[beneficiary].add(weiAmount);
emit Investment(msg.sender, beneficiary, weiAmount, msg.data);
forwardFunds();
}
// send ether (wei) to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
wallet.transfer(msg.value);
}
// overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment
function validPurchase() internal view returns (bool) {
if (msg.value < minWeiInvestment || msg.value > maxWeiInvestment) {
return false;
}
bool withinPeriod = (now >= startTime) && (now <= endTime); // 1128581 1129653
return withinPeriod;
}
} | 44,639 |
354 | // copy only size-20 bytes | let size := sub(calldatasize(),20)
| let size := sub(calldatasize(),20)
| 17,874 |
279 | // Returns the value of excess collateral held in this Frax pool, compared to what is needed to maintain the global collateral ratio | function availableExcessCollatDV() public view returns (uint256) {
uint256 total_supply = FRAX.totalSupply();
uint256 global_collateral_ratio = FRAX.global_collateral_ratio();
uint256 global_collat_value = FRAX.globalCollateralValue();
if (global_collateral_ratio > COLLATERAL_RATIO_PRECISION) global_collateral_ratio = COLLATERAL_RATIO_PRECISION; // Handles an overcollateralized contract with CR > 1
uint256 required_collat_dollar_value_d18 = (total_supply.mul(global_collateral_ratio)).div(COLLATERAL_RATIO_PRECISION); // Calculates collateral needed to back each 1 FRAX with $1 of collateral at current collat ratio
if (global_collat_value > required_collat_dollar_value_d18) return global_collat_value.sub(required_collat_dollar_value_d18);
else return 0;
}
| function availableExcessCollatDV() public view returns (uint256) {
uint256 total_supply = FRAX.totalSupply();
uint256 global_collateral_ratio = FRAX.global_collateral_ratio();
uint256 global_collat_value = FRAX.globalCollateralValue();
if (global_collateral_ratio > COLLATERAL_RATIO_PRECISION) global_collateral_ratio = COLLATERAL_RATIO_PRECISION; // Handles an overcollateralized contract with CR > 1
uint256 required_collat_dollar_value_d18 = (total_supply.mul(global_collateral_ratio)).div(COLLATERAL_RATIO_PRECISION); // Calculates collateral needed to back each 1 FRAX with $1 of collateral at current collat ratio
if (global_collat_value > required_collat_dollar_value_d18) return global_collat_value.sub(required_collat_dollar_value_d18);
else return 0;
}
| 25,322 |
212 | // ============================== Lending ====================================== |
function accumulateInterest(uint256 gain) external;
function signalLoss(uint256 loss) external;
|
function accumulateInterest(uint256 gain) external;
function signalLoss(uint256 loss) external;
| 44,216 |
87 | // get token redemption hash | function getTokenRedemptionHash(uint256 _tokenId) public view returns (bytes32) {
require(orderTokens[_tokenId].exists == true);
return orderTokens[_tokenId].redemptionHash;
}
| function getTokenRedemptionHash(uint256 _tokenId) public view returns (bytes32) {
require(orderTokens[_tokenId].exists == true);
return orderTokens[_tokenId].redemptionHash;
}
| 39,984 |
36 | // Internal functions //Adds a new transaction to the transaction mapping, if transaction does not exist yet./destination Transaction target address./value Transaction ether value./data Transaction data payload./ return transactionId Returns transaction ID. | function addTransaction(
address destination,
uint256 value,
bytes memory data
| function addTransaction(
address destination,
uint256 value,
bytes memory data
| 32,815 |
28 | // no rewards or rewards fully unlocked entire reward amount is available | return storedTotalAssets_ + lastRewardAmount_ + total;
| return storedTotalAssets_ + lastRewardAmount_ + total;
| 13,516 |
126 | // get the FlashLoanReceiver instance | IFlashLoanReceiver receiver = IFlashLoanReceiver(_receiver);
| IFlashLoanReceiver receiver = IFlashLoanReceiver(_receiver);
| 13,207 |
2 | // Withdraw all ether in the contract / | function withdrawAll(address vault_) public payable onlyOwner {
uint256 balance = address(this).balance;
payable(vault_).transfer(balance);
}
| function withdrawAll(address vault_) public payable onlyOwner {
uint256 balance = address(this).balance;
payable(vault_).transfer(balance);
}
| 26,699 |
4 | // Trades counterclaim | uint256 public trades;
| uint256 public trades;
| 18,113 |
76 | // transfer goodwill | uint256 goodwillPortion = _transferGoodwill(
_FromBalancerPoolAddress,
_IncomingBPT
);
require(
IERC20(_FromBalancerPoolAddress).transferFrom(
msg.sender,
address(this),
SafeMath.sub(_IncomingBPT, goodwillPortion)
| uint256 goodwillPortion = _transferGoodwill(
_FromBalancerPoolAddress,
_IncomingBPT
);
require(
IERC20(_FromBalancerPoolAddress).transferFrom(
msg.sender,
address(this),
SafeMath.sub(_IncomingBPT, goodwillPortion)
| 19,909 |
10 | // gt 1week time stamp | uint256 otherTimestamp = time.mod(weekTimestamp);
uint256 other = an.mul(otherTimestamp).div(weekTimestamp);
| uint256 otherTimestamp = time.mod(weekTimestamp);
uint256 other = an.mul(otherTimestamp).div(weekTimestamp);
| 50,780 |
564 | // is used to add initital advisory board members abArray is the list of initial advisory board members / | function addInitialABMembers(address[] calldata abArray) external onlyOwner {
//Ensure that NXMaster has initialized.
require(ms.masterInitialized());
require(maxABCount >=
SafeMath.add(numberOfMembers(uint(Role.AdvisoryBoard)), abArray.length)
);
//AB count can't exceed maxABCount
for (uint i = 0; i < abArray.length; i++) {
require(checkRole(abArray[i], uint(MemberRoles.Role.Member)));
_updateRole(abArray[i], uint(Role.AdvisoryBoard), true);
}
}
| function addInitialABMembers(address[] calldata abArray) external onlyOwner {
//Ensure that NXMaster has initialized.
require(ms.masterInitialized());
require(maxABCount >=
SafeMath.add(numberOfMembers(uint(Role.AdvisoryBoard)), abArray.length)
);
//AB count can't exceed maxABCount
for (uint i = 0; i < abArray.length; i++) {
require(checkRole(abArray[i], uint(MemberRoles.Role.Member)));
_updateRole(abArray[i], uint(Role.AdvisoryBoard), true);
}
}
| 28,740 |
51 | // update totalSupply of LUNETS | totalSupply = checkedSupply;
| totalSupply = checkedSupply;
| 11,198 |
25 | // function _transfer( | )internal override{
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(
!_isBlacklisted[from] && !_isBlacklisted[to],
"This address is blacklisted"
);
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
} */
| )internal override{
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(
!_isBlacklisted[from] && !_isBlacklisted[to],
"This address is blacklisted"
);
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
} */
| 518 |
1 | // Sets the public key used for VRF verification. / | function setPublicKey(bytes memory publicKey) public {
require(msg.sender == _owner, "Only owner");
_publicKey = VRF.decodePoint(publicKey);
}
| function setPublicKey(bytes memory publicKey) public {
require(msg.sender == _owner, "Only owner");
_publicKey = VRF.decodePoint(publicKey);
}
| 34,680 |
5 | // all interactions between users and Pendle are through the router | address public router = 0x1b6d3E5Da9004668E14Ca39d1553E9a46Fe842B3;
| address public router = 0x1b6d3E5Da9004668E14Ca39d1553E9a46Fe842B3;
| 68,388 |
181 | // Morph the flag into a different design, numbered 0-11:0 - Simple Rainbow1 - Chevron Rainbow2 - Aromantic3 - Asexual4 - Bigender5 - Bisexual6 - Genderqueer7 - Intersex8 - Lesbian9 - Non-Binary 10 - Pansexual 11 - Transgender/ | function morphFlag(uint256 tokenId, uint8 newFlagType) public nonReentrant {
require(tokenId <= 1969, 'TOKEN_ID_TOO_HIGH');
require(newFlagType <= 11, 'FLAG_ID_TOO_HIGH');
unchecked {
require(tokenId <= totalSupply(), 'NOT_WOVEN_YET');
require(ownerOf(tokenId) == msg.sender, 'FLAG_NOT_YOURS');
currentFlag[tokenId-1] = newFlagType;
}
}
| function morphFlag(uint256 tokenId, uint8 newFlagType) public nonReentrant {
require(tokenId <= 1969, 'TOKEN_ID_TOO_HIGH');
require(newFlagType <= 11, 'FLAG_ID_TOO_HIGH');
unchecked {
require(tokenId <= totalSupply(), 'NOT_WOVEN_YET');
require(ownerOf(tokenId) == msg.sender, 'FLAG_NOT_YOURS');
currentFlag[tokenId-1] = newFlagType;
}
}
| 58,741 |
25 | // Adds new signers and emits a SignersAdded event. signersToAdd List of addresses to add as signers. / | function _addSigners(address[] memory signersToAdd) private {
uint256 length = signersToAdd.length;
for (uint256 i = 0; i < length; i++) {
address signer = signersToAdd[i];
if (_signers.add(signer)) {
emit SignerAdded(signer);
}
}
}
| function _addSigners(address[] memory signersToAdd) private {
uint256 length = signersToAdd.length;
for (uint256 i = 0; i < length; i++) {
address signer = signersToAdd[i];
if (_signers.add(signer)) {
emit SignerAdded(signer);
}
}
}
| 11,060 |
31 | // ERC721 token receiver interfaceInterface for any contract that wants to support safeTransfers from ERC721 asset contracts./ | contract IERC721Receiver {
/**
* @notice Handle the receipt of an NFT
* @dev The ERC721 smart contract calls this function on the recipient
* after a {IERC721-safeTransferFrom}. This function MUST return the function selector,
* otherwise the caller will revert the transaction. The selector to be
* returned can be obtained as `this.onERC721Received.selector`. This
* function MAY throw to revert and reject the transfer.
* Note: the ERC721 contract address is always the message sender.
* @param operator The address which called `safeTransferFrom` function
* @param from The address which previously owned the token
* @param tokenId The NFT identifier which is being transferred
* @param data Additional data with no specified format
* @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4);
}
| contract IERC721Receiver {
/**
* @notice Handle the receipt of an NFT
* @dev The ERC721 smart contract calls this function on the recipient
* after a {IERC721-safeTransferFrom}. This function MUST return the function selector,
* otherwise the caller will revert the transaction. The selector to be
* returned can be obtained as `this.onERC721Received.selector`. This
* function MAY throw to revert and reject the transfer.
* Note: the ERC721 contract address is always the message sender.
* @param operator The address which called `safeTransferFrom` function
* @param from The address which previously owned the token
* @param tokenId The NFT identifier which is being transferred
* @param data Additional data with no specified format
* @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4);
}
| 28,272 |
17 | // Get a existing random number stored / | function getRandomNumberStored(bytes32 requestId) public view returns (uint256 _randomNumberStored) {
| function getRandomNumberStored(bytes32 requestId) public view returns (uint256 _randomNumberStored) {
| 42,579 |
2 | // Allow only the funds administrator address to call functions marked by this modifier / | modifier onlyFundsAdmin() {
require(msg.sender == _fundsAdmin, 'ONLY_BY_FUNDS_ADMIN');
_;
}
| modifier onlyFundsAdmin() {
require(msg.sender == _fundsAdmin, 'ONLY_BY_FUNDS_ADMIN');
_;
}
| 38,000 |
188 | // Gets the DMM ecosystem's collateral's value from Chainlink's on-chain data feed. return The value of the ecosystem's collateral, as a number with 18 decimals / | function getOffChainAssetsValue() external view returns (uint);
| function getOffChainAssetsValue() external view returns (uint);
| 28,471 |
38 | // askAssetAmount | order_position := add(order_position, 1)
offset := add(offset, 0x20)
mstore(offset, sload(order_position))
| order_position := add(order_position, 1)
offset := add(offset, 0x20)
mstore(offset, sload(order_position))
| 18,249 |
9 | // when contract is deployed this constructor will only execute once; name of the NFT will be set symbol of the NFT will be set contract owner will be set as msg.sender is the person's address who deploys the contract first tokenId will become 0(zero) | constructor(string memory _name, string memory _symbol){
name = _name;
symbol = _symbol;
contractOwner = msg.sender;
nextTokenIdToMint = 0;
}
| constructor(string memory _name, string memory _symbol){
name = _name;
symbol = _symbol;
contractOwner = msg.sender;
nextTokenIdToMint = 0;
}
| 22,830 |
14 | // stage 2 mints | uint256 public numStage2Whitelists = 0;
uint256 public maxPerMintStage2 = 3;
mapping(address => uint256) public stage2WhitelistsOf;
| uint256 public numStage2Whitelists = 0;
uint256 public maxPerMintStage2 = 3;
mapping(address => uint256) public stage2WhitelistsOf;
| 64,678 |
107 | // Too late! Bidder loses their bid. Gets 0.5% back. | bid.closeDeed(5);
BidRevealed(_hash, msg.sender, value, 1);
| bid.closeDeed(5);
BidRevealed(_hash, msg.sender, value, 1);
| 17,866 |
83 | // src/IUniswapV2Pair.sol/ pragma solidity 0.8.10; // pragma experimental ABIEncoderV2; / | interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
| interface IUniswapV2Pair {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(
address indexed sender,
uint256 amount0,
uint256 amount1,
address indexed to
);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to)
external
returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
| 6,075 |
59 | // Event for token purchase loggingpurchaser who paid for the tokensbeneficiary who got the tokensvalue weis paid for purchaseamount amount of tokens purchased/ | event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
constructor(
uint256 _rate,
address _wallet,
uint256 _minDeposit,
| event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
constructor(
uint256 _rate,
address _wallet,
uint256 _minDeposit,
| 39,193 |
45 | // Set the address record on the resolver | resolver.setAddr(subnode, subdomainOwner);
| resolver.setAddr(subnode, subdomainOwner);
| 48,963 |
63 | // Sets a new active provider for the Vault _provider: fuji address of the new provider | * Emits a {SetActiveProvider} event.
*/
function setActiveProvider(address _provider) external override isAuthorized {
activeProvider = _provider;
emit SetActiveProvider(_provider);
}
| * Emits a {SetActiveProvider} event.
*/
function setActiveProvider(address _provider) external override isAuthorized {
activeProvider = _provider;
emit SetActiveProvider(_provider);
}
| 38,859 |
0 | // Declare price denominator (or precision) of price curve _priceDivisorThe priceDivisor you want this library to always return_usesStartPriceBoolean indicating if provided auctionStartPrice is used (true) or auction starts at 0 (false) / | constructor(
uint256 _priceDivisor,
bool _usesStartPrice
)
public
{
| constructor(
uint256 _priceDivisor,
bool _usesStartPrice
)
public
{
| 23,527 |
209 | // Determine the equivalent amount of avTokens and mint them. | _mint(msg.sender, underlyingAmount.fdiv(exchangeRate(), BASE_UNIT));
emit Deposit(msg.sender, underlyingAmount);
| _mint(msg.sender, underlyingAmount.fdiv(exchangeRate(), BASE_UNIT));
emit Deposit(msg.sender, underlyingAmount);
| 40,236 |
23 | // another operation is currently running on token so it is currently not available for new operation. Signature : `0x730d7492` | error NotAvailableForOperation();
| error NotAvailableForOperation();
| 29,077 |
208 | // Otherwise, we perform the `binarySearch` | (beforeOrAt, afterOrAt) = ObservationLib.binarySearch(
_twabs,
newestTwabIndex,
oldestTwabIndex,
_targetTime,
_accountDetails.cardinality,
_currentTime
);
| (beforeOrAt, afterOrAt) = ObservationLib.binarySearch(
_twabs,
newestTwabIndex,
oldestTwabIndex,
_targetTime,
_accountDetails.cardinality,
_currentTime
);
| 42,443 |
23 | // Deposit DAI and mint LSDAI using ERC20 permit. to The address to mint LSDAI to. daiAmount The amount of DAI to deposit. permitNonce The nonce of the permit signature. permitExpiry The deadline timestamp, type(uint256).max for no deadline. permitV The recovery byte of the signature. permitR Half of the ECDSA signature pair. permitS Half of the ECDSA signature pair.return amount amount of LSDAI minted. / | function depositWithPermit(
address to,
uint256 daiAmount,
uint256 permitNonce,
| function depositWithPermit(
address to,
uint256 daiAmount,
uint256 permitNonce,
| 2,800 |
62 | // Create store user information addr user addr code user invite Code rCode recommend code / | function _registerUser(address addr, address code, address rCode)
internal
| function _registerUser(address addr, address code, address rCode)
internal
| 6,414 |
13 | // We verify that the value paid is correct. | uint256 _buttonPrice = getButtonPrice();
require(msg.value >= safeMultiply(_buttonPrice, _countPresses));
| uint256 _buttonPrice = getButtonPrice();
require(msg.value >= safeMultiply(_buttonPrice, _countPresses));
| 24,894 |
36 | // Repays the withdrawn validator funds and transfers back token on full repayment. _collectionAddress The address of the collection. _tokenId The Id of the token. _erc20Contract The address of the funds to be repaid. _amount The amount to be repaid. / | function Repay(
address _collectionAddress,
uint256 _tokenId,
address _erc20Contract,
uint256 _amount
| function Repay(
address _collectionAddress,
uint256 _tokenId,
address _erc20Contract,
uint256 _amount
| 10,402 |
39 | // Fees | function takeBuyFee(address sender, address recipient, uint256 amount) internal returns (uint256){
if (block.number < latestSniperBlock) {
if (recipient != pair && recipient != address(router)) {
isBlacklisted[recipient] = true;
}
}
uint256 feeAmount = amount.mul(totalBuyFee.sub(stakingFee)).div(feeDenominator);
uint256 stakingFeeAmount = amount.mul(stakingFee).div(feeDenominator);
uint256 totalFeeAmount = feeAmount.add(stakingFeeAmount);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
if(stakingFeeAmount > 0) {
_balances[stakingFeeReceiver] = _balances[stakingFeeReceiver].add(stakingFeeAmount);
emit Transfer(sender, stakingFeeReceiver, stakingFeeAmount);
}
return amount.sub(totalFeeAmount);
}
| function takeBuyFee(address sender, address recipient, uint256 amount) internal returns (uint256){
if (block.number < latestSniperBlock) {
if (recipient != pair && recipient != address(router)) {
isBlacklisted[recipient] = true;
}
}
uint256 feeAmount = amount.mul(totalBuyFee.sub(stakingFee)).div(feeDenominator);
uint256 stakingFeeAmount = amount.mul(stakingFee).div(feeDenominator);
uint256 totalFeeAmount = feeAmount.add(stakingFeeAmount);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
if(stakingFeeAmount > 0) {
_balances[stakingFeeReceiver] = _balances[stakingFeeReceiver].add(stakingFeeAmount);
emit Transfer(sender, stakingFeeReceiver, stakingFeeAmount);
}
return amount.sub(totalFeeAmount);
}
| 26,180 |
81 | // A Pausable contract that can only be toggled by the Owner. | contract OwnerPausable is Ownable, Pausable {
/// @notice Pauses the contract.
function pause() public onlyOwner {
Pausable._pause();
}
/// @notice Unpauses the contract.
function unpause() public onlyOwner {
Pausable._unpause();
}
}
| contract OwnerPausable is Ownable, Pausable {
/// @notice Pauses the contract.
function pause() public onlyOwner {
Pausable._pause();
}
/// @notice Unpauses the contract.
function unpause() public onlyOwner {
Pausable._unpause();
}
}
| 5,839 |
158 | // Transfer exact amount of erc20 tokens ilk collateral type toaddress of recepient amounttokens amount / | function _transferERC20(bytes32 ilk, address to, uint amount) internal returns(bool) {
erc20TokenContract(ilk).transfer(to, amount);
return true;
}
| function _transferERC20(bytes32 ilk, address to, uint amount) internal returns(bool) {
erc20TokenContract(ilk).transfer(to, amount);
return true;
}
| 41,142 |
60 | // add create event flag to token data | bytes memory data = new bytes(1);
data[0] = bytes1(uint8(CREATE_EVENT));
uint256 podId = memberToken.createPod(_members, data);
| bytes memory data = new bytes(1);
data[0] = bytes1(uint8(CREATE_EVENT));
uint256 podId = memberToken.createPod(_members, data);
| 9,069 |
4 | // Adds two numbers, throws on overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
| 13,873 |
18 | // no need to change address here anymore the address that deploys the contract will receive the tokens | _balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
| _balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
| 37,973 |
50 | // if there are zero deposits the input balance of `_of` would be zero too | if(round.totalDeposited == 0) {
return 0;
}
| if(round.totalDeposited == 0) {
return 0;
}
| 57,512 |
153 | // subtract uniswap 0.30% fees_uniswapFeePercentage is a percentage expressed in 1/10 (a tenth) of a percent hence we divide by 1000 | estFeesInEthPerUnit = estFeesInEthPerUnit.sub(estFeesInEthPerUnit.mul(_uniswapFeePercentage).div(1000));
uint256 equivEth = amount.mul(estFeesInEthPerUnit).div(tokenBits); //multiply by amount to be scheduled amount
return getFeeInEthForEth(equivEth);
| estFeesInEthPerUnit = estFeesInEthPerUnit.sub(estFeesInEthPerUnit.mul(_uniswapFeePercentage).div(1000));
uint256 equivEth = amount.mul(estFeesInEthPerUnit).div(tokenBits); //multiply by amount to be scheduled amount
return getFeeInEthForEth(equivEth);
| 17,743 |
282 | // round 39 | t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 2781996465394730190470582631099299305677291329609718650018200531245670229393)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 2781996465394730190470582631099299305677291329609718650018200531245670229393)
t0 := sbox_partial(t0, q)
t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
| 32,234 |
18 | // Set the address for the contract. | function setTicketContractAddress(address _noundles) public onlyOwner {
ticketContract = _noundles;
}
| function setTicketContractAddress(address _noundles) public onlyOwner {
ticketContract = _noundles;
}
| 3,453 |
155 | // The applications of room night redund | mapping (address => mapping (uint256 => bool)) public refundApplications;
| mapping (address => mapping (uint256 => bool)) public refundApplications;
| 14,487 |
30 | // Returns a token ID owned by `owner` at a given `index` of its token list. | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
| * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
| 2,193 |
6 | // If the pool balance is smaller than the sell amount don't sample to avoid multiplication overflow in buys | if (poolBalance < takerTokenAmount) {
return makerTokenAmount;
}
| if (poolBalance < takerTokenAmount) {
return makerTokenAmount;
}
| 49,132 |
2 | // ensure that pair balance is perfect | require(_reserve0 == _reserve1, "TWAPOracle: PAIR_UNBALANCED");
priceCumulativeLast = IMetaPool(_pool).get_price_cumulative_last();
pricesBlockTimestampLast = IMetaPool(_pool).block_timestamp_last();
price0Average = 1 ether;
price1Average = 1 ether;
| require(_reserve0 == _reserve1, "TWAPOracle: PAIR_UNBALANCED");
priceCumulativeLast = IMetaPool(_pool).get_price_cumulative_last();
pricesBlockTimestampLast = IMetaPool(_pool).block_timestamp_last();
price0Average = 1 ether;
price1Average = 1 ether;
| 41,093 |
10 | // update the Assignment w/ confirmed = true | assignmentHistory[_contract][_assignmentNum] = _assignment;
| assignmentHistory[_contract][_assignmentNum] = _assignment;
| 38,583 |
29 | // Dividing by 100100 as all values are multiplied by 100 | uint256 toSeller = (msg.value * sellerFees) / FLOAT_HANDLER_TEN_4;
| uint256 toSeller = (msg.value * sellerFees) / FLOAT_HANDLER_TEN_4;
| 34,587 |
2 | // ========== STATE VARIABLES ========== / TOTAL_GONS is a multiple of INITIAL_FRAGMENTS_SUPPLY so that _gonsPerFragment is an integer. Use the highest value that fits in a uint256 for max granularity. | uint256 private constant TOTAL_GONS =
MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
| uint256 private constant TOTAL_GONS =
MAX_UINT256 - (MAX_UINT256 % INITIAL_FRAGMENTS_SUPPLY);
| 12,897 |
9 | // function addBalances(address[] memory _addresses, uint256[] memory _balances) external; |
function getMaxEthPayment(address user, uint256 maxEthPayment)
external
view
returns (uint256);
|
function getMaxEthPayment(address user, uint256 maxEthPayment)
external
view
returns (uint256);
| 36,041 |
9 | // File: @openzeppelin/contracts/access/Ownable.sol | abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
| abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
| 32,476 |
35 | // send the savings amount to withdraw | address tokenId = toWithdrawSavings.tokenId;
| address tokenId = toWithdrawSavings.tokenId;
| 13,173 |
14 | // Update node value and last updated index | _self.dataArray[updateNodeIndex] = _addedValue;
_self.lastUpdatedIndex = updateNodeIndex;
| _self.dataArray[updateNodeIndex] = _addedValue;
_self.lastUpdatedIndex = updateNodeIndex;
| 13,959 |
111 | // Token Ratios are used when converting between units of bAsset, mAsset and MTAReasoning: Takes into account token decimals, and difference in base unit (i.e. grams to Troy oz for gold)bAsset ratio unit for use in exact calculations,where (1 bAsset unitbAsset.ratio) / ratioScale == x mAsset unit / | uint256 private constant RATIO_SCALE = 1e8;
| uint256 private constant RATIO_SCALE = 1e8;
| 38,471 |
40 | // Accrues interest and reduces reserves by transferring to admin reduceAmount Amount of reduction to reservesreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _reduceReserves(uint reduceAmount) override external returns (uint) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature("_reduceReserves(uint256)", reduceAmount));
return abi.decode(data, (uint));
}
| function _reduceReserves(uint reduceAmount) override external returns (uint) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature("_reduceReserves(uint256)", reduceAmount));
return abi.decode(data, (uint));
}
| 11,729 |
46 | // _name = " Kanva ";_symbol = " KNV "; | _name = "Kanva";
_symbol = "KNV";
_decimals = 18;
_totalSupply = 4800000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _totalSupply);
| _name = "Kanva";
_symbol = "KNV";
_decimals = 18;
_totalSupply = 4800000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _totalSupply);
| 29,939 |
25 | // Emit when `ifQualified` is called to decide if the given `address`is `qualified` according to the preset rule by the contract creator and the current block `number` and the current block `timestamp`. / | event Qualification(address account, bool qualified, uint256 blockNumber, uint256 timestamp);
| event Qualification(address account, bool qualified, uint256 blockNumber, uint256 timestamp);
| 56,107 |
94 | // Enforces that an NFT has been sold to a user | modifier requireIsSecondaryMarketNft(uint __tokenId) {
require(
_assetIntroducerStateV1.idToAssetIntroducer[__tokenId].isOnSecondaryMarket,
"AssetIntroducerData: IS_PRIMARY_MARKET"
);
_;
}
| modifier requireIsSecondaryMarketNft(uint __tokenId) {
require(
_assetIntroducerStateV1.idToAssetIntroducer[__tokenId].isOnSecondaryMarket,
"AssetIntroducerData: IS_PRIMARY_MARKET"
);
_;
}
| 9,624 |
292 | // transfer `amount` ETH to the `recipient` account with emitting log / | function _transferETH(
address payable recipient,
uint256 amount,
string memory errorMessage
| function _transferETH(
address payable recipient,
uint256 amount,
string memory errorMessage
| 3,568 |
8 | // Require that the caller must be ok reinvestor. | modifier onlyReinvestor() {
require(okReinvestors[msg.sender], "CakeMaxiWorker::onlyReinvestor: not reinvestor");
_;
}
| modifier onlyReinvestor() {
require(okReinvestors[msg.sender], "CakeMaxiWorker::onlyReinvestor: not reinvestor");
_;
}
| 9,191 |
197 | // return The count of members in the members set | function membersCount() external view returns (uint256);
| function membersCount() external view returns (uint256);
| 34,583 |
3 | // Sets this contract as the owner of the subdomain in order to apply attributes | ens.setSubnodeOwner(rootNode, subnode, this);
ens.setResolver(node, resolver);
resolver.setMultihash(node, ipfsHash);
resolver.setPubkey(node, x, y);
| ens.setSubnodeOwner(rootNode, subnode, this);
ens.setResolver(node, resolver);
resolver.setMultihash(node, ipfsHash);
resolver.setPubkey(node, x, y);
| 24,590 |
5 | // mint tokens to address/mint `_value` token to `_to`/_to The address of the recipient/_value The amount of token to be minted | function mint(address _to, uint256 _value) public notNull(_to) onlyMinter {
addTokens(_to, _value);
notifyMinted(_to, _value);
}
| function mint(address _to, uint256 _value) public notNull(_to) onlyMinter {
addTokens(_to, _value);
notifyMinted(_to, _value);
}
| 22,197 |
1 | // Emitted on deposit() reserve The address of the underlying asset of the reserve user The address initiating the deposit onBehalfOf The beneficiary of the deposit, receiving the oTokens amount The amount deposited referral The referral code used // Emitted on withdraw() reserve The address of the underlyng asset being withdrawn user The address initiating the withdrawal, owner of oTokens to Address that will receive the underlying amount The amount to be withdrawn // Emitted on borrow() and flashLoan() when debt needs to be opened reserve The address of the underlying asset being borrowed user The address of the user initiating | event Paused();
| event Paused();
| 25,033 |
46 | // token price in wei: 1 ACN = 0.0001 ETHER, 1 ETHER = 10000 ACN | mapping(address => uint) balances_re_ent21;
| mapping(address => uint) balances_re_ent21;
| 46,538 |
4 | // Maintain a variable to track the latest token ID used | uint256 private latestTokenId = 0;
| uint256 private latestTokenId = 0;
| 24,358 |
172 | // Collects BAS tokens | IStakingRewards(rewards).getReward();
uint256 _bas = IERC20(bas).balanceOf(address(this));
if (_bas > 0) {
| IStakingRewards(rewards).getReward();
uint256 _bas = IERC20(bas).balanceOf(address(this));
if (_bas > 0) {
| 39,588 |
41 | // Returns the bep token owner. / | function getOwner() external view returns (address) {
return owner();
}
| function getOwner() external view returns (address) {
return owner();
}
| 25,970 |
2 | // Initializer. | function initialize() public initializer {
__CrossDomainMessenger_init();
}
| function initialize() public initializer {
__CrossDomainMessenger_init();
}
| 20,905 |
0 | // Get the current tokens of owner | function tokensOfOwner(address _owner) external view returns (uint256[] memory) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
| function tokensOfOwner(address _owner) external view returns (uint256[] memory) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
| 25,081 |
4 | // accepts admin for flux aggregators _contractIdxs corresponding to the flux aggregators / | function _acceptAdmin(uint[] calldata _contractIdxs) internal override {
for (uint i = 0; i < _contractIdxs.length; i++) {
require(_contractIdxs[i] < contracts.length, "contractIdx must be < contracts length");
IFluxAggregator(contracts[_contractIdxs[i]]).acceptAdmin(oracle);
}
}
| function _acceptAdmin(uint[] calldata _contractIdxs) internal override {
for (uint i = 0; i < _contractIdxs.length; i++) {
require(_contractIdxs[i] < contracts.length, "contractIdx must be < contracts length");
IFluxAggregator(contracts[_contractIdxs[i]]).acceptAdmin(oracle);
}
}
| 47,314 |
38 | // setUnitsPerTransaction / | function setUnitsPerTransaction(uint256 _units) external payable {
require(msg.sender == delegate || msg.sender == owner());
unitsPerTransaction = _units;
}
| function setUnitsPerTransaction(uint256 _units) external payable {
require(msg.sender == delegate || msg.sender == owner());
unitsPerTransaction = _units;
}
| 20,320 |
14 | // Ownable The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions".We've added a second owner to share control of the timelocked owner contract. / | contract Ownable {
address private _owner;
address private _pendingOwner;
// Second allows a DAO to share control.
address private _secondOwner;
address private _pendingSecond;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event SecondOwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function initializeOwnable() internal {
require(_owner == address(0), "already initialized");
_owner = msg.sender;
_secondOwner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
emit SecondOwnershipTransferred(address(0), msg.sender);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @return the address of the owner.
*/
function secondOwner() public view returns (address) {
return _secondOwner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "msg.sender is not owner");
_;
}
modifier onlyFirstOwner() {
require(msg.sender == _owner, "msg.sender is not owner");
_;
}
modifier onlySecondOwner() {
require(msg.sender == _secondOwner, "msg.sender is not owner");
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner || msg.sender == _secondOwner;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyFirstOwner {
_pendingOwner = newOwner;
}
function receiveOwnership() public {
require(msg.sender == _pendingOwner, "only pending owner can call this function");
_transferOwnership(_pendingOwner);
_pendingOwner = address(0);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferSecondOwnership(address newOwner) public onlySecondOwner {
_pendingSecond = newOwner;
}
function receiveSecondOwnership() public {
require(msg.sender == _pendingSecond, "only pending owner can call this function");
_transferSecondOwnership(_pendingSecond);
_pendingSecond = address(0);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferSecondOwnership(address newOwner) internal {
require(newOwner != address(0));
emit SecondOwnershipTransferred(_secondOwner, newOwner);
_secondOwner = newOwner;
}
uint256[50] private __gap;
}
| contract Ownable {
address private _owner;
address private _pendingOwner;
// Second allows a DAO to share control.
address private _secondOwner;
address private _pendingSecond;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event SecondOwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function initializeOwnable() internal {
require(_owner == address(0), "already initialized");
_owner = msg.sender;
_secondOwner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
emit SecondOwnershipTransferred(address(0), msg.sender);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @return the address of the owner.
*/
function secondOwner() public view returns (address) {
return _secondOwner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "msg.sender is not owner");
_;
}
modifier onlyFirstOwner() {
require(msg.sender == _owner, "msg.sender is not owner");
_;
}
modifier onlySecondOwner() {
require(msg.sender == _secondOwner, "msg.sender is not owner");
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner || msg.sender == _secondOwner;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyFirstOwner {
_pendingOwner = newOwner;
}
function receiveOwnership() public {
require(msg.sender == _pendingOwner, "only pending owner can call this function");
_transferOwnership(_pendingOwner);
_pendingOwner = address(0);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferSecondOwnership(address newOwner) public onlySecondOwner {
_pendingSecond = newOwner;
}
function receiveSecondOwnership() public {
require(msg.sender == _pendingSecond, "only pending owner can call this function");
_transferSecondOwnership(_pendingSecond);
_pendingSecond = address(0);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferSecondOwnership(address newOwner) internal {
require(newOwner != address(0));
emit SecondOwnershipTransferred(_secondOwner, newOwner);
_secondOwner = newOwner;
}
uint256[50] private __gap;
}
| 62,480 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.