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 |
|---|---|---|---|---|
0 | // SPDX-License-Identifier: Unlicensed | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
... | interface IERC20 {
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
... | 6,678 |
17 | // Collect Nut tokens | function collect() external {
require(distStarted, 'dist not started');
uint epochId = (block.number.sub(DIST_START_BLOCK)).div(BLOCKS_PER_EPOCH);
require(epochId > 0, 'collect: not ready');
address lender = msg.sender;
uint numOfPools = pools.length < MAX_NUM_POOLS ? pool... | function collect() external {
require(distStarted, 'dist not started');
uint epochId = (block.number.sub(DIST_START_BLOCK)).div(BLOCKS_PER_EPOCH);
require(epochId > 0, 'collect: not ready');
address lender = msg.sender;
uint numOfPools = pools.length < MAX_NUM_POOLS ? pool... | 81,755 |
37 | // the lp amount to be withdrawn based on asset amount | _adjustOuts[i - 1] = Adjust({ adapter: _adapters[i - 1], amount: _lpAmount, minReceive: 0 });
| _adjustOuts[i - 1] = Adjust({ adapter: _adapters[i - 1], amount: _lpAmount, minReceive: 0 });
| 13,521 |
17 | // The removed implementation of the ownership renouncing | function renounceOwnership() public onlyOwner {
revert("not implemented");
}
| function renounceOwnership() public onlyOwner {
revert("not implemented");
}
| 37,448 |
6 | // This is never hit, these values should not be reflected when checking locals. | TestEnum enum4 = TestEnum.FIRST;
bool b3 = true;
x = 7;
| TestEnum enum4 = TestEnum.FIRST;
bool b3 = true;
x = 7;
| 47,940 |
118 | // Sets `amount` as the allowance of `spender` over `owner`'s tokens,given `owner`'s signed approval. | * IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp i... | * IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp i... | 3,044 |
148 | // ========== ADDRESS RESOLVER CONFIGURATION ========== // ========== CONSTRUCTOR ========== / | {
require(_proxy != address(0), "_proxy cannot be 0");
require(_owner != address(0), "_owner cannot be 0");
currencyKey = _currencyKey;
}
| {
require(_proxy != address(0), "_proxy cannot be 0");
require(_owner != address(0), "_owner cannot be 0");
currencyKey = _currencyKey;
}
| 3,389 |
149 | // approve swap allowance | ERC20(bid[_bidder].token).approve(uniswapRouter, ERC20(bid[_bidder].token).totalSupply());
| ERC20(bid[_bidder].token).approve(uniswapRouter, ERC20(bid[_bidder].token).totalSupply());
| 37,821 |
5 | // Sets the fulfillment permission for a given node. Use `true` to allow, `false` to disallow. senders The addresses of the authorized Chainlink node / | function setAuthorizedSenders(address[] calldata senders) external override validateAuthorizedSenderSetter {
require(senders.length > 0, "Must have at least 1 authorized sender");
// Set previous authorized senders to false
uint256 authorizedSendersLength = s_authorizedSenderList.length;
for (uint256 ... | function setAuthorizedSenders(address[] calldata senders) external override validateAuthorizedSenderSetter {
require(senders.length > 0, "Must have at least 1 authorized sender");
// Set previous authorized senders to false
uint256 authorizedSendersLength = s_authorizedSenderList.length;
for (uint256 ... | 28,071 |
11 | // the price of the previous token | nextTokenPrice = nextTokenPrice * 10000 / nextTokenPriceMultiplier;
nextTokenPriceMultiplier = nextTokenPriceMultiplier_;
| nextTokenPrice = nextTokenPrice * 10000 / nextTokenPriceMultiplier;
nextTokenPriceMultiplier = nextTokenPriceMultiplier_;
| 28,099 |
28 | // An event to make the transfer easy to find on the blockchain | Transfer(_from, _to, _amount);
| Transfer(_from, _to, _amount);
| 16,388 |
121 | // Fire worker function ✅ | function fireWorker(
Project storage _project,
Application storage _application,
uint256 applicationId
| function fireWorker(
Project storage _project,
Application storage _application,
uint256 applicationId
| 29,191 |
134 | // This function is what other minters will call to mint new tokens | function minter_mint(address m_address, uint256 m_amount) public onlyMinters {
super._mint(m_address, m_amount);
emit TokenMinterMinted(msg.sender, m_address, m_amount);
}
| function minter_mint(address m_address, uint256 m_amount) public onlyMinters {
super._mint(m_address, m_amount);
emit TokenMinterMinted(msg.sender, m_address, m_amount);
}
| 37,589 |
170 | // DEPLOY POOL / A balancer pool with canWhitelistLPs does not initially whitelist the controller This must be manually set | crp.whitelistLiquidityProvider(address(this));
crpaddress = address(crp);
idle.approve(crpaddress, balances[0]); // approve transfer of idle
weth.approve(crpaddress, balances[1]); // approve transfer of idle
| crp.whitelistLiquidityProvider(address(this));
crpaddress = address(crp);
idle.approve(crpaddress, balances[0]); // approve transfer of idle
weth.approve(crpaddress, balances[1]); // approve transfer of idle
| 15,508 |
66 | // DoTx in user balance (tickets bought) & reward | uint256 reward = getCurrentReward(wars[warIndex].winningHouse, msg.sender, warIndex);
uint256 balance = getUserDoTxInBalance(warIndex, msg.sender);
dotxToken.transfer(msg.sender, reward.add(balance));
emit ClaimReward(warIndex, reward, balance, msg.sender, "CLAIM");
| uint256 reward = getCurrentReward(wars[warIndex].winningHouse, msg.sender, warIndex);
uint256 balance = getUserDoTxInBalance(warIndex, msg.sender);
dotxToken.transfer(msg.sender, reward.add(balance));
emit ClaimReward(warIndex, reward, balance, msg.sender, "CLAIM");
| 6,121 |
158 | // deal interest | uint256 repayInterest = cfilAmount;
if(uInfo.LoanCFil.NowInterest < cfilAmount){
repayInterest = uInfo.LoanCFil.NowInterest;
}
| uint256 repayInterest = cfilAmount;
if(uInfo.LoanCFil.NowInterest < cfilAmount){
repayInterest = uInfo.LoanCFil.NowInterest;
}
| 17,008 |
15 | // check that the reserve is enabled for borrowing | require(core.isReserveBorrowingEnabled(_reserve), "Reserve is not enabled for borrowing");
| require(core.isReserveBorrowingEnabled(_reserve), "Reserve is not enabled for borrowing");
| 2,443 |
50 | // Do the fixed-point division inline to save gas. | result = wrap((unwrap(log2(x)) * uUNIT) / uLOG2_10);
| result = wrap((unwrap(log2(x)) * uUNIT) / uLOG2_10);
| 5,503 |
21 | // Interface of the ERC20 standard as defined in the EIP. Does not includethe optional functions; to access them see `ERC20Detailed`. / | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @de... | 1,272 |
26 | // Callback for chainlink, this function pays the influencer / | function fulfillWithdraw(
bytes32 _requestId,
bytes32 _viewCount
)
external
recordChainlinkFulfillment(_requestId)
| function fulfillWithdraw(
bytes32 _requestId,
bytes32 _viewCount
)
external
recordChainlinkFulfillment(_requestId)
| 50,197 |
20 | // mutableParams_ structure with all mutable params of the strategy/spotTick current spot tick of PancakeV3Pool of pancakeSwapVault/pool PancakeV3Pool of pancakeSwapVault/uniV3Nft Nft of PancakeSwap position/ return newInterval expected interval after reblance/ return neededNewInterval flag that is true if it is needed... | function calculateNewPosition(
MutableParams memory mutableParams_,
int24 spotTick,
IPancakeV3Pool pool,
uint256 uniV3Nft
| function calculateNewPosition(
MutableParams memory mutableParams_,
int24 spotTick,
IPancakeV3Pool pool,
uint256 uniV3Nft
| 16,789 |
1 | // the following code is to allow the Kyber trade to fail silently and not revert if it does, preventing a "bubble up" / send unused source token back | sourceToken.safeTransfer(
returnToSenderAddress,
maxSourceTokenAmount-sourceTokenAmountUsed
);
| sourceToken.safeTransfer(
returnToSenderAddress,
maxSourceTokenAmount-sourceTokenAmountUsed
);
| 27,940 |
592 | // Pulls collateral tokens from the sender to store in the Pool self Data type the library is attached to numTokens The number of tokens to pull / | function pullCollateral(
ISynthereumPoolOnChainPriceFeedStorage.Storage storage self,
address from,
FixedPoint.Unsigned memory numTokens
| function pullCollateral(
ISynthereumPoolOnChainPriceFeedStorage.Storage storage self,
address from,
FixedPoint.Unsigned memory numTokens
| 64,423 |
21 | // It's a buy | tax = (amount * buyTaxRate) / 100;
| tax = (amount * buyTaxRate) / 100;
| 35,028 |
92 | // Swaps `amountIn` of one token for as much as possible of another token/params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata/ return amountOut The amount of the received token | function exactInputSingle(ExactInputSingleParams calldata params)
external
payable
returns (uint256 amountOut);
| function exactInputSingle(ExactInputSingleParams calldata params)
external
payable
returns (uint256 amountOut);
| 44,805 |
0 | // sha3('renew(string,uint)') | bytes4 constant RENEW_SIGNATURE = 0x14b1a4fc;
constructor (
ERC677 _rif,
NodeOwner _nodeOwner,
address _pool,
AbstractNamePrice _namePrice
| bytes4 constant RENEW_SIGNATURE = 0x14b1a4fc;
constructor (
ERC677 _rif,
NodeOwner _nodeOwner,
address _pool,
AbstractNamePrice _namePrice
| 12,580 |
99 | // jBondsAt.tokens += jb_.tokens | jBondsAt.tokens = jBondsAt.tokens.add(jb_.tokens);
| jBondsAt.tokens = jBondsAt.tokens.add(jb_.tokens);
| 22,819 |
34 | // AOContentFactory The purpose of this contract is to allow content creator to stake network AO ions and/or primordial AO+ ionson his/her content / | contract AOContentFactory is TheAO {
using SafeMath for uint256;
address public settingTAOId;
address public aoSettingAddress;
address public aoTreasuryAddress;
address public aoContentAddress;
address public aoStakedContentAddress;
address public aoContentHostAddress;
address public aoEarningAddress;
address... | contract AOContentFactory is TheAO {
using SafeMath for uint256;
address public settingTAOId;
address public aoSettingAddress;
address public aoTreasuryAddress;
address public aoContentAddress;
address public aoStakedContentAddress;
address public aoContentHostAddress;
address public aoEarningAddress;
address... | 1,343 |
322 | // Record date of partnership creation. | partnershipContracts[_hisContract].created = uint40(now);
| partnershipContracts[_hisContract].created = uint40(now);
| 13,508 |
80 | // See {IERC20-transfer}.OwnershipTransferred Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
| function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
| 28,426 |
68 | // Interactions X1 - X5 | token.permit(from, to, amount, deadline, v, r, s);
| token.permit(from, to, amount, deadline, v, r, s);
| 38,547 |
259 | // Admin Functions //Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.newPendingAdmin New pending admin. return uint 0=success, otherwise a failure (see Er... | function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);
}
// Save current value, if any, for inclusion in log
... | function _setPendingAdmin(address payable newPendingAdmin) external returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);
}
// Save current value, if any, for inclusion in log
... | 41,748 |
59 | // Implementation of the {IERC20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {ERC20MinterPauser}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allowances.... |
function __ERC20_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
}
|
function __ERC20_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
}
| 7,084 |
20 | // Transfer staked UNI tokens from the crowd proposal contract back to the author | IUni(uni).transfer(author, IUni(uni).balanceOf(address(this)));
emit CrowdProposalTerminated(address(this), author);
| IUni(uni).transfer(author, IUni(uni).balanceOf(address(this)));
emit CrowdProposalTerminated(address(this), author);
| 4,888 |
338 | // current token weight | uint tokenWeightBefore = IBPool(address(bPool)).getDenormalizedWeight(token);
| uint tokenWeightBefore = IBPool(address(bPool)).getDenormalizedWeight(token);
| 33,651 |
1 | // address of the priceFeed smart contract StableCoin/USD | address priceFeedAddress;
bool blocked;
| address priceFeedAddress;
bool blocked;
| 27,774 |
5 | // Per-market mapping of "accounts in this asset" | mapping(address => bool) accountMembership;
| mapping(address => bool) accountMembership;
| 31,337 |
41 | // sending money for marketing | marketingFund.transfer(msg.value.mul(marketingPercent).div(100));
| marketingFund.transfer(msg.value.mul(marketingPercent).div(100));
| 35,323 |
5 | // string | string f;
| string f;
| 19,105 |
36 | // Blacklist | if (blacklistMode) {
require(!isBlacklisted[sender] && !isBlacklisted[recipient],"Blacklisted");
}
| if (blacklistMode) {
require(!isBlacklisted[sender] && !isBlacklisted[recipient],"Blacklisted");
}
| 25,545 |
65 | // Nonce 0 means that the closer never received a transfer, therefore never received a balance proof, or he is intentionally not providing the latest transfer, in which case the closing party is going to lose the tokens that were transferred to him. | if (nonce > 0) {
recovered_partner_address = recoverAddressFromBalanceProof(
channel_identifier,
balance_hash,
nonce,
additional_hash,
signature
);
| if (nonce > 0) {
recovered_partner_address = recoverAddressFromBalanceProof(
channel_identifier,
balance_hash,
nonce,
additional_hash,
signature
);
| 16,902 |
73 | // Function for selling tokens in crowd time./ | function sell(address _investor, uint256 _amount) internal
| function sell(address _investor, uint256 _amount) internal
| 7,185 |
108 | // data.WriteUint8(3, rocket.m_Unused3); | data.WriteUint32(4, rocket.m_TopSpeed);
data.WriteUint32(8, rocket.m_Thrust);
data.WriteUint32(12, rocket.m_Weight);
data.WriteUint32(16, rocket.m_FuelCapacity);
data.WriteUint16(20, rocket.m_StockId);
| data.WriteUint32(4, rocket.m_TopSpeed);
data.WriteUint32(8, rocket.m_Thrust);
data.WriteUint32(12, rocket.m_Weight);
data.WriteUint32(16, rocket.m_FuelCapacity);
data.WriteUint16(20, rocket.m_StockId);
| 18,298 |
12 | // game not started. | prevFee_used = 0;
| prevFee_used = 0;
| 54,062 |
84 | // Modifier with the conditions to be able to unmintbased on option exerciseType. / | modifier unmintWindow() {
require(_isTradeWindow() || _isExerciseWindow(), "PodOption: not in unmint window");
_;
}
| modifier unmintWindow() {
require(_isTradeWindow() || _isExerciseWindow(), "PodOption: not in unmint window");
_;
}
| 36,060 |
371 | // Rewards are bonded by default | del.bondedAmount = currentBondedAmount;
del.fees = currentFees;
| del.bondedAmount = currentBondedAmount;
del.fees = currentFees;
| 42,746 |
12 | // =============================WITHDRAWAL FUNCTIONS ============================= IF VAULT EXISTS, WITHDRAW TO VAULT ELSE WITHDRAW TO OWNER | function withdrawAll() public{
payable(owner()).transfer(address(this).balance);
}
| function withdrawAll() public{
payable(owner()).transfer(address(this).balance);
}
| 55,461 |
91 | // used by vault reward bond | VAULT_REWARD,
| VAULT_REWARD,
| 24,804 |
95 | // If taker not specified, then can't specify IDs | require(
offer.takerIds.length == 0,
"If trade is offered to anybody, cannot specify tokens from taker."
);
| require(
offer.takerIds.length == 0,
"If trade is offered to anybody, cannot specify tokens from taker."
);
| 30,838 |
26 | // check does auction has winner / | {
/* if we have someone who has palced a bet */
if(listings[_tokenId].highestBidder != address(0) && listings[_tokenId].highestBid > 0) {
if(listings[_tokenId].reservePrice > 0) {
if(listings[_tokenId].reservePrice <= listings[_tokenId].highestBid) {
r... | {
/* if we have someone who has palced a bet */
if(listings[_tokenId].highestBidder != address(0) && listings[_tokenId].highestBid > 0) {
if(listings[_tokenId].reservePrice > 0) {
if(listings[_tokenId].reservePrice <= listings[_tokenId].highestBid) {
r... | 42,000 |
441 | // Pull final fee from liquidator. | collateralCurrency.safeTransferFrom(msg.sender, address(this), finalFeeBond.rawValue);
emit LiquidationCreated(
sponsor,
msg.sender,
liquidationId,
tokensLiquidated.rawValue,
lockedCollateral.rawValue,
liquidatedCollateral.rawValue... | collateralCurrency.safeTransferFrom(msg.sender, address(this), finalFeeBond.rawValue);
emit LiquidationCreated(
sponsor,
msg.sender,
liquidationId,
tokensLiquidated.rawValue,
lockedCollateral.rawValue,
liquidatedCollateral.rawValue... | 12,051 |
342 | // 2. Exit cooldown if necessary | if (_exitCooldown) {
_balances[_account].raw += oldBalance.cooldownUnits;
_balances[_account].cooldownTimestamp = 0;
_balances[_account].cooldownUnits = 0;
}
| if (_exitCooldown) {
_balances[_account].raw += oldBalance.cooldownUnits;
_balances[_account].cooldownTimestamp = 0;
_balances[_account].cooldownUnits = 0;
}
| 63,187 |
24 | // hasERC721TokenSold// Check whether the ERC721 token has sold at least once. _contractAddress address ERC721Contract address. _tokenId uint256 token ID.return bool of whether the token has sold. / | function hasERC721TokenSold(address _contractAddress, uint256 _tokenId)
external
override
view
returns (bool)
| function hasERC721TokenSold(address _contractAddress, uint256 _tokenId)
external
override
view
returns (bool)
| 55,308 |
58 | // Information isn't considered verified until at least MIN_RESPONSES oracles respond with thesameinformation | emit OracleReport( flight, statusCode);
if (oracleResponses[key].responses[statusCode].length >= MIN_RESPONSES) {
emit FlightStatusInfo( flight, statusCode);
| emit OracleReport( flight, statusCode);
if (oracleResponses[key].responses[statusCode].length >= MIN_RESPONSES) {
emit FlightStatusInfo( flight, statusCode);
| 4,092 |
14 | // the last action happened in the current epoch | else {
if (last >= 1 && checkpoints[last - 1].epochId == currentEpoch) {
checkpoints[last - 1].multiplier = computeNewMultiplier(
getCheckpointBalance(checkpoints[last - 1]),
checkpoints[last - 1].multiplier,
... | else {
if (last >= 1 && checkpoints[last - 1].epochId == currentEpoch) {
checkpoints[last - 1].multiplier = computeNewMultiplier(
getCheckpointBalance(checkpoints[last - 1]),
checkpoints[last - 1].multiplier,
... | 38,388 |
14 | // Calculate total reward / | function getRewardOfUser(address _user, uint256 _pid) external view returns (uint256) {
UserInfo storage user = users[_pid][_user];
uint256 pricePerFullShare = getPricePerFullShare(_pid);
return ((user.shares * pricePerFullShare) / 1e18 - user.totalInvested);
}
| function getRewardOfUser(address _user, uint256 _pid) external view returns (uint256) {
UserInfo storage user = users[_pid][_user];
uint256 pricePerFullShare = getPricePerFullShare(_pid);
return ((user.shares * pricePerFullShare) / 1e18 - user.totalInvested);
}
| 23,364 |
445 | // Balancer Labs Configurable Rights Pool Factory - create parameterized smart pools Rights are held in a corresponding struct in ConfigurableRightsPool Index values are as follows: 0: canPauseSwapping - can setPublicSwap back to false after turning it on by default, it is off on initialization and can only be turned o... | contract CRPFactory {
// State variables
// Keep a list of all Configurable Rights Pools
mapping(address => bool) private _isCrp;
// Event declarations
// Log the address of each new smart pool, and its creator
event LogNewCrp(address indexed caller, address indexed pool);
// Function de... | contract CRPFactory {
// State variables
// Keep a list of all Configurable Rights Pools
mapping(address => bool) private _isCrp;
// Event declarations
// Log the address of each new smart pool, and its creator
event LogNewCrp(address indexed caller, address indexed pool);
// Function de... | 14,206 |
44 | // get shareholder address and share amount at index | function getShareHolderAddressAndShareAtIndex(uint256 _index)
public
view
returns(address, uint256)
| function getShareHolderAddressAndShareAtIndex(uint256 _index)
public
view
returns(address, uint256)
| 45,264 |
75 | // caculate amount of token in presale stage | function calculateTokenPresale(uint value, uint decimals) /*internal*/ public constant returns (uint) {
uint multiplier = 10 ** decimals;
return value.mul(multiplier).div(PRESALE_TOKEN_IN_WEI);
}
| function calculateTokenPresale(uint value, uint decimals) /*internal*/ public constant returns (uint) {
uint multiplier = 10 ** decimals;
return value.mul(multiplier).div(PRESALE_TOKEN_IN_WEI);
}
| 69,246 |
115 | // changes the required number of owner signatures/_newRequired new number of signatures required All pending operations will be canceled! | function changeRequirement(uint _newRequired)
external
multiOwnedValidRequirement(_newRequired, m_numOwners)
onlymanyowners(keccak256(msg.data))
| function changeRequirement(uint _newRequired)
external
multiOwnedValidRequirement(_newRequired, m_numOwners)
onlymanyowners(keccak256(msg.data))
| 63,096 |
2 | // the powers of the given validators in the same order as above | uint256[] powers;
| uint256[] powers;
| 2,632 |
10 | // See {IERC1155-_mint}.to token recipientid token type IDamount minting tokens amountcost minting tokens fiat cost / | function mint(
address to,
uint256 id,
uint256 amount,
uint128 cost
) external override onlyCore {
super._mint(to, id, amount, "");
_balanceCosts[id][to] += cost;
}
| function mint(
address to,
uint256 id,
uint256 amount,
uint128 cost
) external override onlyCore {
super._mint(to, id, amount, "");
_balanceCosts[id][to] += cost;
}
| 8,663 |
14 | // return the amount minus the conversion fee and the conversion fee | uint256 fee = calculateFee(amount);
return (amount - fee, fee);
| uint256 fee = calculateFee(amount);
return (amount - fee, fee);
| 5,449 |
138 | // Otherwise, only trigger if it "makes sense" economically (gas cost is <N% of value moved) | uint256 credit = vault.creditAvailable();
return (profitFactor.mul(callCost) < credit.add(profit));
| uint256 credit = vault.creditAvailable();
return (profitFactor.mul(callCost) < credit.add(profit));
| 7,417 |
358 | // {add,remove}Liquidity functions to avoid stack too deep errors | struct ManageLiquidityInfo {
uint256 d0;
uint256 d1;
uint256 d2;
uint256 preciseA;
LPToken lpToken;
uint256 totalSupply;
uint256[] balances;
uint256[] multipliers;
}
| struct ManageLiquidityInfo {
uint256 d0;
uint256 d1;
uint256 d2;
uint256 preciseA;
LPToken lpToken;
uint256 totalSupply;
uint256[] balances;
uint256[] multipliers;
}
| 64,743 |
205 | // Checks if a certificate is correct data Certificate to control / | function _checkCertificate(
bytes memory data,
uint256 amount,
bytes4 functionID
)
internal
view
returns(bool)
| function _checkCertificate(
bytes memory data,
uint256 amount,
bytes4 functionID
)
internal
view
returns(bool)
| 7,198 |
93 | // Returns the method of a call./assembledData Bytes of the encoded transaction./ return Bytes4 function signature. | function findMethod(bytes memory assembledData)
internal
pure
returns (bytes4 method)
| function findMethod(bytes memory assembledData)
internal
pure
returns (bytes4 method)
| 4,705 |
124 | // Global Variables | EIP20Interface public token;
PLCRVoting public voting;
uint public PROCESSBY = 604800; // 7 days
string constant NEW_REGISTRY = "_newRegistry";
bytes32 constant NEW_REGISTRY_KEC = keccak256(abi.encodePacked(NEW_REGISTRY));
bytes32 constant DISPENSATION_PCT_KEC = keccak256(abi.encodePacked("dispensationPct"... | EIP20Interface public token;
PLCRVoting public voting;
uint public PROCESSBY = 604800; // 7 days
string constant NEW_REGISTRY = "_newRegistry";
bytes32 constant NEW_REGISTRY_KEC = keccak256(abi.encodePacked(NEW_REGISTRY));
bytes32 constant DISPENSATION_PCT_KEC = keccak256(abi.encodePacked("dispensationPct"... | 22,202 |
1 | // Internal contract base inherited by InternalExtension to allow access to `_internal` modifier for functions that should only be callable by other Extensions of the current contract thus keeping the functions 'internal' with respects to Extendable contract scope. Modify your functions with `_internal` to restrict cal... | * function yourFunction() public _internal {}
*/
contract Internal {
modifier _internal() {
require(msg.sender == address(this), "external caller not allowed");
_;
}
} | * function yourFunction() public _internal {}
*/
contract Internal {
modifier _internal() {
require(msg.sender == address(this), "external caller not allowed");
_;
}
} | 24,284 |
0 | // Callback for IUniswapV3PoolActionsmint/Any contract that calls IUniswapV3PoolActionsmint must implement this interface | interface IUniswapV3MintCallback {
/// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.
/// @dev In the implementation you must pay the pool tokens owed for the minted liquidity.
/// The caller of this method must be checked to be a UniswapV3Pool deployed by the... | interface IUniswapV3MintCallback {
/// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.
/// @dev In the implementation you must pay the pool tokens owed for the minted liquidity.
/// The caller of this method must be checked to be a UniswapV3Pool deployed by the... | 42,474 |
61 | // Remove a partner. / | function removePartner(address investor) onlyOwner public returns (bool) {
require(partners[investor] && balances[investor] == 0);
partners[investor] = false;
PartnerRemoved(investor);
return !partners[investor];
}
| function removePartner(address investor) onlyOwner public returns (bool) {
require(partners[investor] && balances[investor] == 0);
partners[investor] = false;
PartnerRemoved(investor);
return !partners[investor];
}
| 46,956 |
230 | // VotingMaching->proposalId->ProposalInfo | mapping(address => mapping(bytes32 => ProposalInfo)) public proposalsInfo;
function mintReputation(uint256 _amount, address _beneficiary, bytes32 _proposalId)
external
onlyVotingMachine(_proposalId)
returns(bool)
| mapping(address => mapping(bytes32 => ProposalInfo)) public proposalsInfo;
function mintReputation(uint256 _amount, address _beneficiary, bytes32 _proposalId)
external
onlyVotingMachine(_proposalId)
returns(bool)
| 10,005 |
63 | // Set SDVD amount | amountSDVD = amountSDVDReceived;
| amountSDVD = amountSDVDReceived;
| 12,483 |
413 | // ============ V3 Internal Functions ============ //The unit shares must result in a quantity greater than the number of natural units outstanding.In other words, it must be greater than 0 / | function validateUnitShares(uint256 _newUnitShares) internal view {
require(
_newUnitShares > 0,
"Unitshares is 0"
);
}
| function validateUnitShares(uint256 _newUnitShares) internal view {
require(
_newUnitShares > 0,
"Unitshares is 0"
);
}
| 33,795 |
13 | // The default tip configured for casting a vote | uint256 tip;
| uint256 tip;
| 10,117 |
23 | // Gas: 27653 | addr.setA(2);
| addr.setA(2);
| 47,667 |
34 | // Returns true if the caller is privileged. / | function isPriviledged() public view returns (bool) {
return _msgSender() == _privileged;
}
| function isPriviledged() public view returns (bool) {
return _msgSender() == _privileged;
}
| 17,479 |
25 | // allocated amount of TOS | function cap() external view returns (uint256);
| function cap() external view returns (uint256);
| 55,657 |
13 | // bitwise OR them and add the address into the init code memory | mstore(pos, or(first32, addrBytesShifted))
| mstore(pos, or(first32, addrBytesShifted))
| 3,878 |
191 | // Checks contract initialization/ |
modifier isInitialized()
|
modifier isInitialized()
| 2,597 |
132 | // количество оладельцев | function OwnersCount() public pure returns (uint8) {
return OWNERS_COUNT;
}
| function OwnersCount() public pure returns (uint8) {
return OWNERS_COUNT;
}
| 32,458 |
34 | // decrease the loan's debt by a currencyAmount a change of the loan debt updates the rate debt and total debt | function decDebt(uint loan, uint currencyAmount) external auth {
uint rate = loanRates[loan];
require(block.timestamp == rates[rate].lastUpdated, "rate-group-not-updated");
uint pieAmount = toPie(rates[rate].chi, currencyAmount);
pie[loan] = safeSub(pie[loan], pieAmount);
ra... | function decDebt(uint loan, uint currencyAmount) external auth {
uint rate = loanRates[loan];
require(block.timestamp == rates[rate].lastUpdated, "rate-group-not-updated");
uint pieAmount = toPie(rates[rate].chi, currencyAmount);
pie[loan] = safeSub(pie[loan], pieAmount);
ra... | 10,332 |
28 | // Handle overflow, the result must be < 2256 | require(prod1 < denominator);
| require(prod1 < denominator);
| 4,278 |
14 | // if not implemented, or returns empty data, return empty string | if (!success || data.length == 0) {
return "";
}
| if (!success || data.length == 0) {
return "";
}
| 35,909 |
39 | // Check the balance | require(msg.value >= price(_count), "Not enough ETH for transaction");
for (uint256 i = 0; i < _count; i++) {
| require(msg.value >= price(_count), "Not enough ETH for transaction");
for (uint256 i = 0; i < _count; i++) {
| 38,597 |
23 | // Active sale is an operational sale capable of minting and selling tokensThe sale is active when all the requirements below are met: 1. `finalId` is not reached (`nextId <= finalId`)Function is marked as virtual to be overridden in the helper test smart contract (mock) in order to test how it affects the sale process... | function isActive() public view virtual returns(bool) {
// evaluate sale state based on the internal state variables and return
return nextId <= finalId;
}
| function isActive() public view virtual returns(bool) {
// evaluate sale state based on the internal state variables and return
return nextId <= finalId;
}
| 40,407 |
58 | // Retrieve the token balance of any single address. / | function balanceOf(address _customerAddress)
view
public
returns(uint256)
| function balanceOf(address _customerAddress)
view
public
returns(uint256)
| 5,218 |
215 | // upperPrice | uint160 sqrtRatioBX96;
| uint160 sqrtRatioBX96;
| 24,364 |
29 | // Add new grain contract to portfolio _grainCategory - Grain category _grainContractInfo - Grain Contract's details _grainAmount - amount of grain in tonsreturn success / | function addNewGrainContract(
string memory _grainCategory,
string memory _grainContractInfo,
uint256 _grainAmount
| function addNewGrainContract(
string memory _grainCategory,
string memory _grainContractInfo,
uint256 _grainAmount
| 79,887 |
34 | // Transfer the balance from owner&39;s account to another account | function transferTokens(address _to, uint256 _amount) private returns(bool success) {
require( _to != 0x0);
require(balances[address(this)] >= _amount && _amount > 0);
balances[address(this)] = (balances[address(this)]).sub(_amount);
balances[_to] = (balances[_to]).add(_amount... | function transferTokens(address _to, uint256 _amount) private returns(bool success) {
require( _to != 0x0);
require(balances[address(this)] >= _amount && _amount > 0);
balances[address(this)] = (balances[address(this)]).sub(_amount);
balances[_to] = (balances[_to]).add(_amount... | 29,810 |
5 | // AmazingERC20 Implementation of the AmazingERC20 / | contract AmazingERC20 is ERC20Mintable, ERC20Burnable, ERC1363, TokenRecover, ServicePayer {
constructor (
string memory name,
string memory symbol,
uint8 decimals,
uint256 initialBalance,
address payable feeReceiver
)
ERC1363(name, symbol)
ServicePayer(f... | contract AmazingERC20 is ERC20Mintable, ERC20Burnable, ERC1363, TokenRecover, ServicePayer {
constructor (
string memory name,
string memory symbol,
uint8 decimals,
uint256 initialBalance,
address payable feeReceiver
)
ERC1363(name, symbol)
ServicePayer(f... | 43,960 |
23 | // This skin belongs to current account | if (count == id) {
| if (count == id) {
| 58,561 |
41 | // Set maximum ROLL reward that a user can receive per bet. | function setMaxReward(uint _maxReward) external onlyOwner {
maxReward = _maxReward;
}
| function setMaxReward(uint _maxReward) external onlyOwner {
maxReward = _maxReward;
}
| 19,546 |
10 | // Add a new minter. _account Address of the minter / | function addMinter(address _account) external onlyGovernor {
_addMinter(_account);
}
| function addMinter(address _account) external onlyGovernor {
_addMinter(_account);
}
| 2,047 |
1 | // verifies that an amount is greater than zero | modifier greaterThanZero(uint256 _amount) {
require(_amount > 0);
_;
}
| modifier greaterThanZero(uint256 _amount) {
require(_amount > 0);
_;
}
| 15,015 |
9 | // @inheritdoc IPrizeDistributionSource | function getPrizeDistributions(uint32[] calldata _drawIds)
external
view
override
returns (IPrizeDistributionBuffer.PrizeDistribution[] memory)
| function getPrizeDistributions(uint32[] calldata _drawIds)
external
view
override
returns (IPrizeDistributionBuffer.PrizeDistribution[] memory)
| 24,592 |
14 | // Sets the token locking address./ This is only set once, and can't be changed afterwards./_tokenLockingAddress Address of the locking contract | function setTokenLocking(address _tokenLockingAddress) public;
| function setTokenLocking(address _tokenLockingAddress) public;
| 2,597 |
0 | // Stakeholder variables |
SpigotState private state;
|
SpigotState private state;
| 29,579 |
51 | // Returns the address of the current owner. / | function owner() public view returns (address) {
return _owner;
}
| function owner() public view returns (address) {
return _owner;
}
| 3,265 |
3 | // force settlement of the system at a given price (sai per gem). This is nearly the equivalent of biting all cups at once. Important consideration: the gems associated with free skr can be tapped to make sai whole. | function cage(uint price) internal {
require(!tub.off() && price != 0);
caged = era();
tub.drip(); // collect remaining fees
tap.heal(); // absorb any pending fees
fit = rmul(wmul(price, vox.par()), tub.per());
// Most gems we can get per sai is the full balance o... | function cage(uint price) internal {
require(!tub.off() && price != 0);
caged = era();
tub.drip(); // collect remaining fees
tap.heal(); // absorb any pending fees
fit = rmul(wmul(price, vox.par()), tub.per());
// Most gems we can get per sai is the full balance o... | 20,438 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.