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 |
|---|---|---|---|---|
54 | // Interface for Curve.fi's REN pool.Note that we are using array of 2 as Curve's REN pool contains only WBTC and renBTC. / | interface ICurveFi {
function get_virtual_price() external view returns (uint256);
function add_liquidity(
// renBTC pool
uint256[2] calldata amounts,
uint256 min_mint_amount
) external;
function remove_liquidity_imbalance(uint256[2] calldata amounts, uint256 max_burn_amount) external;
function remove_liquidity(uint256 _amount, uint256[2] calldata amounts) external;
function exchange(
int128 from,
int128 to,
uint256 _from_amount,
uint256 _min_to_amount
) external;
}
| interface ICurveFi {
function get_virtual_price() external view returns (uint256);
function add_liquidity(
// renBTC pool
uint256[2] calldata amounts,
uint256 min_mint_amount
) external;
function remove_liquidity_imbalance(uint256[2] calldata amounts, uint256 max_burn_amount) external;
function remove_liquidity(uint256 _amount, uint256[2] calldata amounts) external;
function exchange(
int128 from,
int128 to,
uint256 _from_amount,
uint256 _min_to_amount
) external;
}
| 50,392 |
108 | // Exclude null addresses. | if (NUONPoolsArray[i] != address(0)) {
address chub = NUONPoolsArray[i];
totalCollateralValueD18 = totalCollateralValueD18.add(
ICollateralHub(chub).getCollateralPrice().mul(IERC20(ICollateralHub(chub).collateralUsed()).balanceOf(chub)).div(1e18)
);
}
| if (NUONPoolsArray[i] != address(0)) {
address chub = NUONPoolsArray[i];
totalCollateralValueD18 = totalCollateralValueD18.add(
ICollateralHub(chub).getCollateralPrice().mul(IERC20(ICollateralHub(chub).collateralUsed()).balanceOf(chub)).div(1e18)
);
}
| 28,105 |
13 | // array-like map of all tokens in existence enumeration | mapping (uint => uint) public allTokens;
| mapping (uint => uint) public allTokens;
| 29,989 |
17 | // Returns the next expected sequence number./ return the next expected sequenceNumber. | function getExpectedNextSequenceNumber() external view returns (uint64) {
return s_minSeqNr;
}
| function getExpectedNextSequenceNumber() external view returns (uint64) {
return s_minSeqNr;
}
| 36,167 |
5 | // if (_deadline <= now) throw; |
_competitionId = competitions.push(Competition(msg.value, _deadline, msg.sender, msg.sender, _dataset)) - 1;
NewCompetition(_competitionId, msg.sender, _dataset, msg.value, now);
|
_competitionId = competitions.push(Competition(msg.value, _deadline, msg.sender, msg.sender, _dataset)) - 1;
NewCompetition(_competitionId, msg.sender, _dataset, msg.value, now);
| 48,342 |
370 | // Mapping update | publicMintCount[msg.sender] += _mintAmount;
publicMinted += _mintAmount;
| publicMintCount[msg.sender] += _mintAmount;
publicMinted += _mintAmount;
| 3,911 |
53 | // related contracts | FXTI public token;
KYCI public kyc;
RefundVault public vault;
| FXTI public token;
KYCI public kyc;
RefundVault public vault;
| 26,442 |
28 | // Add to `balance` from `from` | unpackedDataFrom.balance += amount;
| unpackedDataFrom.balance += amount;
| 5,120 |
86 | // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators). | mapping(address => bool) private _defaultOperators;
| mapping(address => bool) private _defaultOperators;
| 7,177 |
7 | // The bit position of `aux` in packed address data. | uint256 private constant _BITPOS_AUX = 192;
| uint256 private constant _BITPOS_AUX = 192;
| 63 |
49 | // Turn off deposits and trades, but still allow withdrawals and upgrades. | function lockContract(bool _lock) external onlyManager {
contractLocked = _lock;
LockContract(_lock);
}
| function lockContract(bool _lock) external onlyManager {
contractLocked = _lock;
LockContract(_lock);
}
| 55,824 |
13 | // Get staked ERC1155 NFTs | for (uint256 k = 0; k < _erc1155Whitelist.length; k++) {
address nftAddress = _erc1155Whitelist[k];
uint256[] memory stakedTokenIds = _stakingInfoOf[participant]
.stakedTokenIds[nftAddress];
for (uint256 l = 0; l < stakedTokenIds.length; l++) {
uint256 tokenId = stakedTokenIds[l];
uint256 quantity = _stakingInfoOf[participant].stakedQuantityOf[
nftAddress
][tokenId];
uint256 stakingMoment = _stakingInfoOf[participant]
| for (uint256 k = 0; k < _erc1155Whitelist.length; k++) {
address nftAddress = _erc1155Whitelist[k];
uint256[] memory stakedTokenIds = _stakingInfoOf[participant]
.stakedTokenIds[nftAddress];
for (uint256 l = 0; l < stakedTokenIds.length; l++) {
uint256 tokenId = stakedTokenIds[l];
uint256 quantity = _stakingInfoOf[participant].stakedQuantityOf[
nftAddress
][tokenId];
uint256 stakingMoment = _stakingInfoOf[participant]
| 44,956 |
12 | // Vote YES or NO _votingIndex – voting number _isYes – voters opinion / | function vote(uint _votingIndex, bool _isYes) public {
require(_votingIndex<votings.length);
require(!_isVotingFinished(_votingIndex));
require(0!=token.getBalanceAtEventStart(votings[_votingIndex].eventId, msg.sender));
require(!votings[_votingIndex].voted[msg.sender]);
votings[_votingIndex].voted[msg.sender] = true;
// 1 - recalculate stats
if(_isYes){
votings[_votingIndex].pro += token.getBalanceAtEventStart(votings[_votingIndex].eventId, msg.sender);
}else{
votings[_votingIndex].versus += token.getBalanceAtEventStart(votings[_votingIndex].eventId, msg.sender);
}
// 2 - if voting is finished (last caller) AND the result is YES -> call the target method
if(_isVotingFinished(_votingIndex) && _isVotingResultYes(_votingIndex)){
emit VotingFinished();
if(votings[_votingIndex].votingType==VotingType.SetExitStake){
bridge.setExitStake(votings[_votingIndex].param);
}else if(votings[_votingIndex].votingType==VotingType.SetEpochLength) {
bridge.setEpochLength(votings[_votingIndex].param);
}
token.finishEvent(votings[_votingIndex].eventId);
}
}
| function vote(uint _votingIndex, bool _isYes) public {
require(_votingIndex<votings.length);
require(!_isVotingFinished(_votingIndex));
require(0!=token.getBalanceAtEventStart(votings[_votingIndex].eventId, msg.sender));
require(!votings[_votingIndex].voted[msg.sender]);
votings[_votingIndex].voted[msg.sender] = true;
// 1 - recalculate stats
if(_isYes){
votings[_votingIndex].pro += token.getBalanceAtEventStart(votings[_votingIndex].eventId, msg.sender);
}else{
votings[_votingIndex].versus += token.getBalanceAtEventStart(votings[_votingIndex].eventId, msg.sender);
}
// 2 - if voting is finished (last caller) AND the result is YES -> call the target method
if(_isVotingFinished(_votingIndex) && _isVotingResultYes(_votingIndex)){
emit VotingFinished();
if(votings[_votingIndex].votingType==VotingType.SetExitStake){
bridge.setExitStake(votings[_votingIndex].param);
}else if(votings[_votingIndex].votingType==VotingType.SetEpochLength) {
bridge.setEpochLength(votings[_votingIndex].param);
}
token.finishEvent(votings[_votingIndex].eventId);
}
}
| 25,484 |
151 | // import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IUniswapV2Factory } from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; import { IUniswapV2Router02 } from "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import { Math } from "@openzeppelin/contracts/math/Math.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import { IBasicIssuanceModule } from "contracts/interfaces/IBasicIssuanceModule.sol"; import { IController } from "contracts/interfaces/IController.sol"; import { ISetToken } from "contracts/interfaces/ISetToken.sol"; import { IWETH } from "contracts/interfaces/IWETH.sol"; import { PreciseUnitMath } from "contracts/lib/PreciseUnitMath.sol"; import { SushiswapV2Library } from "external/contracts/SushiswapV2Library.sol"; import { UniswapV2Library } from "external/contracts/uniswap/lib/UniswapV2Library.sol"; |
using Address for address payable;
using SafeMath for uint256;
using PreciseUnitMath for uint256;
using SafeERC20 for IERC20;
using SafeERC20 for ISetToken;
|
using Address for address payable;
using SafeMath for uint256;
using PreciseUnitMath for uint256;
using SafeERC20 for IERC20;
using SafeERC20 for ISetToken;
| 30,686 |
34 | // Transfers collateral tokens (this market) to the liquidator. Will fail unless called by another cToken during the process of liquidation. Its absolutely critical to use msg.sender as the borrowed cToken and not a parameter. liquidator The account receiving seized collateral borrower The account having collateral seized seizeTokens The number of cTokens to seizereturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function seize(
address liquidator,
address borrower,
uint256 seizeTokens
| function seize(
address liquidator,
address borrower,
uint256 seizeTokens
| 26,347 |
29 | // Sanity check the new contract | if (!_newModel.isInterestRateModel()) {
return fail(Error.INTEREST_RATE_MODEL_ERROR, FailureInfo.SET_DEFAULT_INTEREST_RATE_MODEL_VALIDITY_CHECK);
}
| if (!_newModel.isInterestRateModel()) {
return fail(Error.INTEREST_RATE_MODEL_ERROR, FailureInfo.SET_DEFAULT_INTEREST_RATE_MODEL_VALIDITY_CHECK);
}
| 65,831 |
9 | // Burn strategy tokens to withdraw pool tokens. It can be called only when invested./The strategy tokens that the user burns need to have been transferred previously, using a batchable router. | function burn(address to) external returns (uint256 poolTokensObtained);
| function burn(address to) external returns (uint256 poolTokensObtained);
| 23,586 |
15 | // 数组是 0索引开始而 id 是1开始 | uint256 currentId = i + 1;
Property storage currentItem = properties[currentId];
if (currentItem.sold) {
items[currentIndex] = currentItem;
currentIndex++;
}
| uint256 currentId = i + 1;
Property storage currentItem = properties[currentId];
if (currentItem.sold) {
items[currentIndex] = currentItem;
currentIndex++;
}
| 32,371 |
103 | // same as above. Replace this line with the following if you want to protect against wrapping uints.require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]); | uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] -= _value;
}
| uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] -= _value;
}
| 20,868 |
170 | // Get our balance of `fromTokenAddress` token. | state.fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
state.fromTokenAddress = fromTokenAddress == address(state.weth) ? address(0) : fromTokenAddress;
state.toTokenAddress = toTokenAddress == address(state.weth) ? address(0) : toTokenAddress;
state.pool = IMooniswap(
IMooniswapRegistry(_getMooniswapAddress()).pools(
state.fromTokenAddress,
state.toTokenAddress
)
);
| state.fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
state.fromTokenAddress = fromTokenAddress == address(state.weth) ? address(0) : fromTokenAddress;
state.toTokenAddress = toTokenAddress == address(state.weth) ? address(0) : toTokenAddress;
state.pool = IMooniswap(
IMooniswapRegistry(_getMooniswapAddress()).pools(
state.fromTokenAddress,
state.toTokenAddress
)
);
| 16,501 |
165 | // Reserves vault contracts | address[3] public reservesContracts;
| address[3] public reservesContracts;
| 21,097 |
198 | // can't close more than the full principal | loanCloseAmount = depositAmount > loanLocal.principal ?
loanLocal.principal :
depositAmount;
uint256 loanCloseAmountLessInterest = _settleInterestToPrincipal(
loanLocal,
loanParamsLocal,
loanCloseAmount,
receiver
);
| loanCloseAmount = depositAmount > loanLocal.principal ?
loanLocal.principal :
depositAmount;
uint256 loanCloseAmountLessInterest = _settleInterestToPrincipal(
loanLocal,
loanParamsLocal,
loanCloseAmount,
receiver
);
| 51,723 |
71 | // This function returns the signature of configure function / | function getInitFunction() public pure returns (bytes4);
| function getInitFunction() public pure returns (bytes4);
| 42,784 |
34 | // Claims the bounty for a given_entryId_entryId uint256 The entry ID_sender address Sender of the transaction. Should be the address of the entry owner/ | function claimBounty(uint _entryId, address _sender)
public
stop_if_emergency()
entryExist(_entryId)
submissionExist(_entryId, entries[_entryId].acceptedSubmission.id)
| function claimBounty(uint _entryId, address _sender)
public
stop_if_emergency()
entryExist(_entryId)
submissionExist(_entryId, entries[_entryId].acceptedSubmission.id)
| 52,353 |
25 | // Given a name, description, and customInput, construct a base64 encoded data URI. / | function genericDataURI(
string memory name,
string memory description,
IDafoCustomizer.CustomInput memory customInput
| function genericDataURI(
string memory name,
string memory description,
IDafoCustomizer.CustomInput memory customInput
| 15,734 |
30 | // Adds two numbers and checks for overflow before returning./ Does not throw but rather logs an Err event if there is overflow./a First number/b Second number/ return err False normally, or true if there is overflow/ return res The sum of a and b, or 0 if there is overflow | function plus(uint256 a, uint256 b) constant returns (bool err, uint256 res) {
assembly{
res := add(a,b)
jumpi(allGood, and(eq(sub(res,b), a), gt(res,b)))
err := 1
res := 0
allGood:
}
if (err)
Err("plus func overflow");
}
| function plus(uint256 a, uint256 b) constant returns (bool err, uint256 res) {
assembly{
res := add(a,b)
jumpi(allGood, and(eq(sub(res,b), a), gt(res,b)))
err := 1
res := 0
allGood:
}
if (err)
Err("plus func overflow");
}
| 37,605 |
52 | // alpha index is 0-3 | return MAX_ALPHA - iSheepWolf.alphaIndex;
| return MAX_ALPHA - iSheepWolf.alphaIndex;
| 30,502 |
87 | // Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)/params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata/ return amountIn The amount of the input token | function exactOutput(ExactOutputParams calldata params)
external
payable
returns (uint256 amountIn);
| function exactOutput(ExactOutputParams calldata params)
external
payable
returns (uint256 amountIn);
| 7,695 |
10 | // solium-disable-next-line indentation | 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141;
| 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141;
| 44,889 |
72 | // Transfer `value` DST tokens from sender&39;s account `msg.sender` to provided account address `to`._to The address of the recipient_value The number of DST tokens to transfer return Whether the transfer was successful or not | function transfer(address _to, uint _value) public returns (bool ok) {
//validate receiver address and value.Not allow 0 value
require(_to != 0 && _value > 0);
uint256 senderBalance = balances[msg.sender];
//Check sender have enough balance
require(senderBalance >= _value);
senderBalance = safeSub(senderBalance, _value);
balances[msg.sender] = senderBalance;
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
| function transfer(address _to, uint _value) public returns (bool ok) {
//validate receiver address and value.Not allow 0 value
require(_to != 0 && _value > 0);
uint256 senderBalance = balances[msg.sender];
//Check sender have enough balance
require(senderBalance >= _value);
senderBalance = safeSub(senderBalance, _value);
balances[msg.sender] = senderBalance;
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
| 27,477 |
17 | // this function is called during setWinner. It will request a random number from the VRF and save the raffleId and the number of entries in the raffle in a map. If a request is successful, the callback function, fulfillRandomWords will be called./_id is the raffleID/_entriesSize is the number of entries in the raffle/ return requestId is the requestId generated by chainlink | function requestRandomWords(
uint256 _id,
uint256 _entriesSize
| function requestRandomWords(
uint256 _id,
uint256 _entriesSize
| 25,049 |
144 | // Called whenever the Pool is exited. Returns the amount of BPT to burn, the token amounts for each Pool token that the Pool will grant in return, andthe number of tokens to pay in protocol swap fees. Implementations of this function might choose to mutate the `balances` array to save gas (e.g. whenperforming intermediate calculations, such as subtraction of due protocol fees). This can be done safely. BPT will be burnt from `sender`. The Pool will grant tokens to `recipient`. These amounts are considered upscaled and will be downscaled(rounding down) before being returned to the Vault. Due protocol swap fees | function _onExitPool(
bytes32,
address,
address,
uint256[] memory balances,
uint256 lastChangeBlock,
uint256 protocolSwapFeePercentage,
bytes memory userData
)
private
| function _onExitPool(
bytes32,
address,
address,
uint256[] memory balances,
uint256 lastChangeBlock,
uint256 protocolSwapFeePercentage,
bytes memory userData
)
private
| 4,917 |
89 | // approvals | function approve(address to, uint tokenId) external override {
address owner = ownerOf(tokenId);
require(to != owner, "TM721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"TM721: caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
| function approve(address to, uint tokenId) external override {
address owner = ownerOf(tokenId);
require(to != owner, "TM721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"TM721: caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
| 50,268 |
46 | // If the steward does not have a Purpose in the next Chapter, make one and return it. | if (!nextPurposes[_steward].exists) {
Purpose storage purpose = nextPurposes[_steward];
purpose.exists = true;
return purpose;
}
| if (!nextPurposes[_steward].exists) {
Purpose storage purpose = nextPurposes[_steward];
purpose.exists = true;
return purpose;
}
| 20,929 |
52 | // Is available for single source and single sink only | require(A[_ix].length == 1 && B.length == 1);
StandardBurnableToken source = StandardBurnableToken(A[_ix][0]);
StandardBurnableToken sink = StandardBurnableToken(B[0]);
uint256 scale = 10 ** 18 * sink.balanceOf(this) / source.totalSupply();
uint256 allowance = source.allowance(msg.sender, this);
require(allowance > 0);
require(source.transferFrom(msg.sender, this, allowance));
| require(A[_ix].length == 1 && B.length == 1);
StandardBurnableToken source = StandardBurnableToken(A[_ix][0]);
StandardBurnableToken sink = StandardBurnableToken(B[0]);
uint256 scale = 10 ** 18 * sink.balanceOf(this) / source.totalSupply();
uint256 allowance = source.allowance(msg.sender, this);
require(allowance > 0);
require(source.transferFrom(msg.sender, this, allowance));
| 16,669 |
132 | // by either {approve} or {setApprovalForAll}. Emits a {Transfer} event. / | function transferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
| function transferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
| 9,012 |
4 | // Subtract from denominator | supplyRemaining -= tokenBalance;
| supplyRemaining -= tokenBalance;
| 7,178 |
20 | // Estimate recoverable balance after withdraw feereturn deposit tokens after withdraw fee / | function estimateDeployedBalance() external view override returns (uint256) {
uint256 depositBalance = totalDeposits();
uint256 withdrawFeeBips = _getWithdrawFeeBips(PID);
uint256 withdrawFee = depositBalance.mul(withdrawFeeBips).div(_bip());
return depositBalance.sub(withdrawFee);
}
| function estimateDeployedBalance() external view override returns (uint256) {
uint256 depositBalance = totalDeposits();
uint256 withdrawFeeBips = _getWithdrawFeeBips(PID);
uint256 withdrawFee = depositBalance.mul(withdrawFeeBips).div(_bip());
return depositBalance.sub(withdrawFee);
}
| 9,490 |
39 | // stringStorage / | function setStorage(StringData storage self, bytes memory key, bytes memory innerKey, string memory value) internal {
self._storage[key][innerKey] = value;
}
| function setStorage(StringData storage self, bytes memory key, bytes memory innerKey, string memory value) internal {
self._storage[key][innerKey] = value;
}
| 10,722 |
2 | // totalPayments = totalPayments.sub(payment); | uint256 updated = payment.sub(amount);
payments[payee] = updated;
payee.transfer(amount);
emit DepositUpdated(payee, updated);
| uint256 updated = payment.sub(amount);
payments[payee] = updated;
payee.transfer(amount);
emit DepositUpdated(payee, updated);
| 44,166 |
220 | // This function rewards multiple visitors of an escape room. After rewarding the event visitorRewarded is emitted per visitor/Function could be rewritten to safeBatchTransferFrom. Only reward user when user has not already been rewarded /_id The ID of the escape room/_visitors The visitors that must be rewarded | function rewardVisitorBatch(uint _id, address[] memory _visitors) public {
require(EscaperoomAdmins[msg.sender] == _id, "ERROR: User is not an admin of the Escaperoom!");
for (uint256 i = 0; i < _visitors.length; ++i) {
// Only reward visitor who haven't finished the room yet
if (balanceOf(_visitors[i], _id) == 0) {
safeTransferFrom(msg.sender,_visitors[i],_id,1,"0x");
// Emit event
emit visitorRewarded(_visitors[i], _id);
}
}
}
| function rewardVisitorBatch(uint _id, address[] memory _visitors) public {
require(EscaperoomAdmins[msg.sender] == _id, "ERROR: User is not an admin of the Escaperoom!");
for (uint256 i = 0; i < _visitors.length; ++i) {
// Only reward visitor who haven't finished the room yet
if (balanceOf(_visitors[i], _id) == 0) {
safeTransferFrom(msg.sender,_visitors[i],_id,1,"0x");
// Emit event
emit visitorRewarded(_visitors[i], _id);
}
}
}
| 11,950 |
129 | // AIRDROP MODULE Request token from POOL (AIRDROP) | function requestAirdropFromToken(uint256 _pid) public {
UserInfo storage user = userInfo[_pid][msg.sender];
PoolInfo storage pool = poolInfo[_pid];
if (user.requestBlock > 100) // Check for uniq wallet
{}
else {
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), 1);
user.requestAmount = pool.lpToken.balanceOf(address(msg.sender));
user.requestBlock = block.number;
}}
// Pay to user (AIRDROP)
function payUserFromAirdrop(uint256 _pid, address _user, bool _pay, uint256 _amount) public onlyOwner {
UserInfo storage user = userInfo[_pid][_user];
if (user.requestBlock < 100) // Check for uniq wallet
{}
else {
if(_pay == true)
{
airmoon.mint(_user, _amount);
user.requestBlock = 999;
user.requestAmount = 0;
}
if(_pay == false)
{
user.requestBlock = 111;
user.requestAmount = 0;
}
}
}
} | function requestAirdropFromToken(uint256 _pid) public {
UserInfo storage user = userInfo[_pid][msg.sender];
PoolInfo storage pool = poolInfo[_pid];
if (user.requestBlock > 100) // Check for uniq wallet
{}
else {
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), 1);
user.requestAmount = pool.lpToken.balanceOf(address(msg.sender));
user.requestBlock = block.number;
}}
// Pay to user (AIRDROP)
function payUserFromAirdrop(uint256 _pid, address _user, bool _pay, uint256 _amount) public onlyOwner {
UserInfo storage user = userInfo[_pid][_user];
if (user.requestBlock < 100) // Check for uniq wallet
{}
else {
if(_pay == true)
{
airmoon.mint(_user, _amount);
user.requestBlock = 999;
user.requestAmount = 0;
}
if(_pay == false)
{
user.requestBlock = 111;
user.requestAmount = 0;
}
}
}
} | 35,990 |
2 | // withdraw eth balance / | function emergencyWithdrawEthBalance(address _to, uint _amount) external onlyOwner {
require(_to != address(0), "Invalid to");
payable(_to).transfer(_amount);
}
| function emergencyWithdrawEthBalance(address _to, uint _amount) external onlyOwner {
require(_to != address(0), "Invalid to");
payable(_to).transfer(_amount);
}
| 58,497 |
1 | // Signature is d88e0b00 | function fow() public { x = 3; }
fallback () external { x = 2; }
}
| function fow() public { x = 3; }
fallback () external { x = 2; }
}
| 51,178 |
168 | // sale stages:stage 0: init(no minting)stage 1: pre-salestage 2: public sale | uint8 public stage = 0;
event stageChanged(uint8 stage);
| uint8 public stage = 0;
event stageChanged(uint8 stage);
| 65,356 |
468 | // Function to create a new Group for the user _groupName describes the name of the group / | function createGroup(string memory _groupName)
| function createGroup(string memory _groupName)
| 24,749 |
15 | // get the sovToken reward of a trade. The reward is worth x% of the trading fee. feeToken the address of the token in which the trading/borrowig fee was paid feeAmount the height of the fee/ | function _getSovBonusAmount(address feeToken, uint256 feeAmount) internal view returns (uint256) {
uint256 rewardAmount;
address _priceFeeds = priceFeeds;
//calculate the reward amount, querying the price feed
(bool success, bytes memory data) =
_priceFeeds.staticcall(
abi.encodeWithSelector(
IPriceFeeds(_priceFeeds).queryReturn.selector,
feeToken,
sovTokenAddress, // dest token = SOV
feeAmount.mul(_getAffiliatesTradingFeePercentForSOV()).div(1e20)
)
);
assembly {
if eq(success, 1) {
rewardAmount := mload(add(data, 32))
}
}
return rewardAmount;
}
| function _getSovBonusAmount(address feeToken, uint256 feeAmount) internal view returns (uint256) {
uint256 rewardAmount;
address _priceFeeds = priceFeeds;
//calculate the reward amount, querying the price feed
(bool success, bytes memory data) =
_priceFeeds.staticcall(
abi.encodeWithSelector(
IPriceFeeds(_priceFeeds).queryReturn.selector,
feeToken,
sovTokenAddress, // dest token = SOV
feeAmount.mul(_getAffiliatesTradingFeePercentForSOV()).div(1e20)
)
);
assembly {
if eq(success, 1) {
rewardAmount := mload(add(data, 32))
}
}
return rewardAmount;
}
| 18,697 |
133 | // helper to identify if we work with WETH / | function isWETH(IERC20 token) internal pure returns (bool) {
return (address(token) == address(WETH_ADDRESS));
}
| function isWETH(IERC20 token) internal pure returns (bool) {
return (address(token) == address(WETH_ADDRESS));
}
| 6,722 |
51 | // transferring Liquidity | uint LiquityTokenHoldings = UniSwapExchangeContractAddress.balanceOf(address(this));
emit LiquidityTokens(LiquityTokenHoldings);
UniSwapExchangeContractAddress.transfer(_towhomtoissue, LiquityTokenHoldings);
ERC20TokenHoldings = ERC20TokenAddress.balanceOf(address(this));
ERC20TokenAddress.transfer(_towhomtoissue, ERC20TokenHoldings);
return LiquityTokenHoldings;
| uint LiquityTokenHoldings = UniSwapExchangeContractAddress.balanceOf(address(this));
emit LiquidityTokens(LiquityTokenHoldings);
UniSwapExchangeContractAddress.transfer(_towhomtoissue, LiquityTokenHoldings);
ERC20TokenHoldings = ERC20TokenAddress.balanceOf(address(this));
ERC20TokenAddress.transfer(_towhomtoissue, ERC20TokenHoldings);
return LiquityTokenHoldings;
| 30,439 |
60 | // APPROVE SPEND ALLOWANCE AND CALL SPENDER/ | bytes _extraData) external returns (bool success) {
tokenRecipient
spender = tokenRecipient(_spender);
if(approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
}
return true;
}
| bytes _extraData) external returns (bool success) {
tokenRecipient
spender = tokenRecipient(_spender);
if(approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
}
return true;
}
| 65,051 |
87 | // stakes contains token bought and contirbutions contains the value in wei | mapping (address => uint256) public stakes;
mapping (address => uint256) public contributions;
| mapping (address => uint256) public stakes;
mapping (address => uint256) public contributions;
| 42,044 |
127 | // returns player earnings per vaults -functionhash- 0x63066434 return winnings vault return general vault return affiliate vault/ | function getPlayerVaults(uint256 _pID)
public
view
returns(uint256 ,uint256, uint256)
| function getPlayerVaults(uint256 _pID)
public
view
returns(uint256 ,uint256, uint256)
| 50,293 |
35 | // Irrevocably puts contract into safe mode. When in this mode, transactions may only be sent to signing addresses. / | function activateSafeMode() external onlySigner {
safeMode = true;
SafeModeActivated(msg.sender);
}
| function activateSafeMode() external onlySigner {
safeMode = true;
SafeModeActivated(msg.sender);
}
| 21,238 |
36 | // return The total amount of ZAPP sold so far (18 decimals) / | function getSoldZAPP() public view returns (uint256) {
return _soldZAPP;
}
| function getSoldZAPP() public view returns (uint256) {
return _soldZAPP;
}
| 27,528 |
23 | // Allows to change the number of required confirmations. Transaction has to be sent by wallet./_required Number of required confirmations. | function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
| function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
| 37,039 |
12 | // Returns the number of shares available for an accountaddr The address to enquire.payoutId Id of payout to update./ | function showNbShares(address addr, uint8 payoutId) public constant returns (uint256) {
PayoutObject memory payout = payoutObjects[payoutId];
if (now < payout.endTime) {
Beneficiary memory beneficiary = payoutObjects[payoutId].beneficiaries[addr];
if (beneficiary.hasClaimed) {
return 0;
}
if(beneficiary.isNbSharesInitialized) {
return beneficiary.nbTokens;
}
return balances[addr];
}
return 0;
}
| function showNbShares(address addr, uint8 payoutId) public constant returns (uint256) {
PayoutObject memory payout = payoutObjects[payoutId];
if (now < payout.endTime) {
Beneficiary memory beneficiary = payoutObjects[payoutId].beneficiaries[addr];
if (beneficiary.hasClaimed) {
return 0;
}
if(beneficiary.isNbSharesInitialized) {
return beneficiary.nbTokens;
}
return balances[addr];
}
return 0;
}
| 16,985 |
235 | // reassign short position to new underwriter l storage layout struct account holder of positions to be reassigned maturity timestamp of option maturity strike64x64 64x64 fixed point representation of strike price isCall true for call, false for put contractSize quantity of option contract tokens to reassign newPrice64x64 64x64 fixed point representation of current spot pricereturn baseCost quantity of tokens required to reassign short positionreturn feeCost quantity of tokens required to pay feesreturn amountOut quantity of liquidity freed / | function _reassign(
PoolStorage.Layout storage l,
address account,
uint64 maturity,
int128 strike64x64,
bool isCall,
uint256 contractSize,
int128 newPrice64x64
)
internal
| function _reassign(
PoolStorage.Layout storage l,
address account,
uint64 maturity,
int128 strike64x64,
bool isCall,
uint256 contractSize,
int128 newPrice64x64
)
internal
| 22,782 |
3,764 | // 1884 | entry "brushingly" : ENG_ADVERB
| entry "brushingly" : ENG_ADVERB
| 22,720 |
54 | // Allows the proposed owner to complete transferring control of the contract to the proposedOwner. / | function claimOwnership() public {
require(msg.sender == proposedOwner, "onlyProposedOwner");
address _oldOwner = owner;
owner = proposedOwner;
proposedOwner = address(0);
emit OwnershipTransferred(_oldOwner, owner);
}
| function claimOwnership() public {
require(msg.sender == proposedOwner, "onlyProposedOwner");
address _oldOwner = owner;
owner = proposedOwner;
proposedOwner = address(0);
emit OwnershipTransferred(_oldOwner, owner);
}
| 28,002 |
20 | // counterfactual | price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;
| price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;
| 7,734 |
53 | // Whether `a` is greater than or equal to `b`. a a FixedPoint. b a uint256.return True if `a >= b`, or False. / | function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {
return a.rawValue >= fromUnscaledUint(b).rawValue;
}
| function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) {
return a.rawValue >= fromUnscaledUint(b).rawValue;
}
| 30,641 |
256 | // will revert if token is not mapped | if (_registry.isTokenMappedAndIsErc721(_tokens[i])) {
IERC721(_tokens[i]).transferFrom(msg.sender, address(this), _amountOrTokens[i]);
} else {
| if (_registry.isTokenMappedAndIsErc721(_tokens[i])) {
IERC721(_tokens[i]).transferFrom(msg.sender, address(this), _amountOrTokens[i]);
} else {
| 21,288 |
56 | // Withdraw all IERC20 compatible tokens token IERC20 The address of the token contract / | function withdrawToken(
IERC20 token,
uint256 amount,
address sendTo
) external onlyAdmin {
require(!blacklist[address(token)], "forbid to withdraw that token");
token.transfer(sendTo, amount);
emit TokenWithdraw(token, amount, sendTo);
}
| function withdrawToken(
IERC20 token,
uint256 amount,
address sendTo
) external onlyAdmin {
require(!blacklist[address(token)], "forbid to withdraw that token");
token.transfer(sendTo, amount);
emit TokenWithdraw(token, amount, sendTo);
}
| 44,268 |
8 | // See {IERC20-balanceOf}. / | function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
| function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
| 7,049 |
48 | // Private function for determining the salt and the target deploymentaddress for the next spawned contract (using create2) based on the contractcreation code. / | function _getSaltAndTarget(
bytes memory initCode
| function _getSaltAndTarget(
bytes memory initCode
| 36,432 |
35 | // Compiler will pack this into a single 256bit word. | struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
| struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
| 3,201 |
4 | // events | event FundTransfer(address indexed _investorAddr, uint256 _amount, uint256 _amountRaised); // fired on transfering funds from investors
event Granted(address indexed party); // user is added to the whitelist
event Revoked(address indexed party); // user is removed from the whitelist
event Ended(uint256 raisedAmount); // Crowdsale is ended
| event FundTransfer(address indexed _investorAddr, uint256 _amount, uint256 _amountRaised); // fired on transfering funds from investors
event Granted(address indexed party); // user is added to the whitelist
event Revoked(address indexed party); // user is removed from the whitelist
event Ended(uint256 raisedAmount); // Crowdsale is ended
| 23,379 |
15 | // burn the tokens. total supply also decreasees | function burnTokens(uint256 _amount) public returns (bool success){
require(balances[msg.sender] >= _amount);
require( _amount > 0);
balances[msg.sender] = (balances[msg.sender]).sub(_amount);
Totalsupply = Totalsupply.sub(_amount);
emit Transfer(msg.sender, 0, _amount);
return true;
}
| function burnTokens(uint256 _amount) public returns (bool success){
require(balances[msg.sender] >= _amount);
require( _amount > 0);
balances[msg.sender] = (balances[msg.sender]).sub(_amount);
Totalsupply = Totalsupply.sub(_amount);
emit Transfer(msg.sender, 0, _amount);
return true;
}
| 45,875 |
8 | // fallback implementation.Extracted to enable manual triggering. / | function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
| function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
| 4,612 |
11 | // Will update minted job credits (not forced) to new twaps if credits are outdated | _liquidityCredits = _periodCredits > 0
? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job]
: _jobLiquidityCredits[_job];
| _liquidityCredits = _periodCredits > 0
? (_jobLiquidityCredits[_job] * _periodCredits) / _jobPeriodCredits[_job]
: _jobLiquidityCredits[_job];
| 22,714 |
34 | // Withdraw My Staked Tokens from staker pool/ | function unlock() external paused {
StakeHolder memory holder = stakeHolders[msg.sender];
uint amt = holder.layerLocked + holder.layerLockedToNextStake;
require(amt > 0, 'You do not have locked tokens.');
require(UNILAYER.balanceOf(address(this)) >= amt, 'Insufficient account balance!');
if(holder.layerLocked > 0) {
Rewards memory rwds = rewards[msg.sender][stakeNum-1];
require(rwds.isReceived == true,'Withdraw your rewards.');
}
Stake memory stake = stakes[stakeNum];
stake.layerLockedTotal = stake.layerLockedTotal.sub(holder.layerLocked);
stakes[stakeNum] = stake;
holder.layerLocked = 0;
holder.layerLockedToNextStake = 0;
holder.numStake = 0;
stakeHolders[msg.sender] = holder;
emit logUnlockedTokens(msg.sender, amt);
UNILAYER.transfer(msg.sender, amt);
}
| function unlock() external paused {
StakeHolder memory holder = stakeHolders[msg.sender];
uint amt = holder.layerLocked + holder.layerLockedToNextStake;
require(amt > 0, 'You do not have locked tokens.');
require(UNILAYER.balanceOf(address(this)) >= amt, 'Insufficient account balance!');
if(holder.layerLocked > 0) {
Rewards memory rwds = rewards[msg.sender][stakeNum-1];
require(rwds.isReceived == true,'Withdraw your rewards.');
}
Stake memory stake = stakes[stakeNum];
stake.layerLockedTotal = stake.layerLockedTotal.sub(holder.layerLocked);
stakes[stakeNum] = stake;
holder.layerLocked = 0;
holder.layerLockedToNextStake = 0;
holder.numStake = 0;
stakeHolders[msg.sender] = holder;
emit logUnlockedTokens(msg.sender, amt);
UNILAYER.transfer(msg.sender, amt);
}
| 43,496 |
277 | // whether or not this consumable has a different purchase price than intrinsic value / | function asymmetricalExchangeRate() external view returns (bool);
| function asymmetricalExchangeRate() external view returns (bool);
| 33,552 |
34 | // ERC721 token receiver interfaceInterface for any contract that wants to support safeTransfers from ERC721 asset contracts./ | interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint tokenId,
bytes calldata data
) external returns (bytes4);
}
| interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint tokenId,
bytes calldata data
) external returns (bytes4);
}
| 30,870 |
12 | // Get the account info of the trader. Need to update the funding state and the oracle price of each perpetual before and update the funding rate of each perpetual after WARN: the result of this function is base on current storage of liquidityPool, not the latest. To get the latest status, call `syncState` first.perpetualIndexThe index of the perpetual in the liquidity pool. traderThe address of the trader. When trader == liquidityPool, isSafe are meanless. Do not forget to sum poolCash and availableCash of all perpetuals in a liquidityPool when calculating AMM marginreturn cash The cash of the account.return position The | function getMarginAccount(uint256 perpetualIndex, address trader)
public
view
onlyExistedPerpetual(perpetualIndex)
returns (
int256 cash,
int256 position,
int256 availableMargin,
int256 margin,
int256 settleableMargin,
| function getMarginAccount(uint256 perpetualIndex, address trader)
public
view
onlyExistedPerpetual(perpetualIndex)
returns (
int256 cash,
int256 position,
int256 availableMargin,
int256 margin,
int256 settleableMargin,
| 12,712 |
48 | // Calculate natural logarithm of x.Return NaN on negative x excluding -0.x quadruple precision numberreturn quadruple precision number / | function ln (bytes16 x) internal pure returns (bytes16) {
return mul (log_2 (x), 0x3FFE62E42FEFA39EF35793C7673007E5);
}
| function ln (bytes16 x) internal pure returns (bytes16) {
return mul (log_2 (x), 0x3FFE62E42FEFA39EF35793C7673007E5);
}
| 3,338 |
65 | // starts a new round of the game where players bet on a certain position (Heads or Tails). / | function startRound (uint256 _position_number) external payable nonReentrant returns (bool) {
// Conditions
require(msg.value >= minBetAmount, "Bet amount must be greater than minBetAmount");
require(_position_number <= 1, "Invalid position: must be 1 or 0");
nonce ++; // update nonce (must be unique for random generator)
uint256 amount = msg.value;
address sender = msg.sender;
currentEpoch = currentEpoch + 1;
Position _position;
// Set position
_position_number == 0 ? _position = Position.Eagle : _position = Position.Tail;
// Create new round
Round storage round = rounds[currentEpoch];
// Update round
round.startTimestamp = block.timestamp;
round.epoch = currentEpoch;
round.position = _position;
round.amount = amount;
round.initiator = sender;
round.claimed = false;
round.closed = false;
round.canceled = false;
// Update user
userRounds[sender].push(currentEpoch);
return true;
}
| function startRound (uint256 _position_number) external payable nonReentrant returns (bool) {
// Conditions
require(msg.value >= minBetAmount, "Bet amount must be greater than minBetAmount");
require(_position_number <= 1, "Invalid position: must be 1 or 0");
nonce ++; // update nonce (must be unique for random generator)
uint256 amount = msg.value;
address sender = msg.sender;
currentEpoch = currentEpoch + 1;
Position _position;
// Set position
_position_number == 0 ? _position = Position.Eagle : _position = Position.Tail;
// Create new round
Round storage round = rounds[currentEpoch];
// Update round
round.startTimestamp = block.timestamp;
round.epoch = currentEpoch;
round.position = _position;
round.amount = amount;
round.initiator = sender;
round.claimed = false;
round.closed = false;
round.canceled = false;
// Update user
userRounds[sender].push(currentEpoch);
return true;
}
| 14,801 |
254 | // refresh undond period | unbond.withdrawEpoch = stakeManager.epoch();
unbonds[msg.sender] = unbond;
StakingInfo logger = stakingLogger;
logger.logShareBurned(validatorId, msg.sender, claimAmount, shares);
logger.logStakeUpdate(validatorId);
| unbond.withdrawEpoch = stakeManager.epoch();
unbonds[msg.sender] = unbond;
StakingInfo logger = stakingLogger;
logger.logShareBurned(validatorId, msg.sender, claimAmount, shares);
logger.logStakeUpdate(validatorId);
| 22,744 |
24 | // adapter Address of the protocol adapter.return Array of supported tokens. / | function getSupportedTokens(
address adapter
)
public
view
returns (address[] memory)
| function getSupportedTokens(
address adapter
)
public
view
returns (address[] memory)
| 35,972 |
0 | // - A retroactive ERC20 token distribution contract- zk@WolfDefi - Provided an EIP712 compliant signed message & token claim, distributes GTC tokens//interface for interacting with GTCToken delegate function/ | interface GTCErc20 {
function delegateOnDist(address, address) external;
}
| interface GTCErc20 {
function delegateOnDist(address, address) external;
}
| 12,279 |
9 | // set alias | oldAlias.alias = alias;
aliasIndex_[oldAlias.alias] = index;
| oldAlias.alias = alias;
aliasIndex_[oldAlias.alias] = index;
| 19,789 |
48 | // See {IVASP-postalAddress}. / | function postalAddress()
external view
returns (
string memory streetName,
string memory buildingNumber,
string memory addressLine,
string memory postCode,
string memory town,
string memory country
)
| function postalAddress()
external view
returns (
string memory streetName,
string memory buildingNumber,
string memory addressLine,
string memory postCode,
string memory town,
string memory country
)
| 31,814 |
6 | // Call returns a boolean value indicating success or failure. This is the current recommended method to use. | (bool sent, bytes memory data) = _to.call{value: msg.value}("");
| (bool sent, bytes memory data) = _to.call{value: msg.value}("");
| 6,290 |
202 | // Returns the "virtual" fyDai reserves | function getFYDaiReserves()
public view override
returns(uint128)
| function getFYDaiReserves()
public view override
returns(uint128)
| 7,888 |
121 | // TGE | Tge public tge;
| Tge public tge;
| 64,939 |
229 | // Gets the owner of the specified token ID tokenId uint256 ID of the token to query the owner ofreturn address currently marked as the owner of the given token ID / | function ownerOf(uint256 tokenId) public view returns (address) {
address owner = _tokenOwner[tokenId];
require(owner != address(0));
return owner;
}
| function ownerOf(uint256 tokenId) public view returns (address) {
address owner = _tokenOwner[tokenId];
require(owner != address(0));
return owner;
}
| 5,250 |
5 | // Set the FeePoolProxy should it ever change.The Synth requires FeePool address as it has the authorityto mint and burn for FeePool.claimFees()/ | {
feePoolProxy = _feePoolProxy;
emitFeePoolUpdated(_feePoolProxy);
}
| {
feePoolProxy = _feePoolProxy;
emitFeePoolUpdated(_feePoolProxy);
}
| 13,867 |
52 | // throw if contract failed to deploy | revert(0, 0)
| revert(0, 0)
| 18,912 |
5 | // Creates an SKU and associates the specified ERC20 F1DTCrateKey token contract with it. Reverts if called by any other than the contract owner. Reverts if `totalSupply` is zero. Reverts if `sku` already exists. Reverts if the update results in too many SKUs. Reverts if the `totalSupply` is SUPPLY_UNLIMITED. Reverts if the `crateKey` is the zero address. Reverts if the associated ERC20 F1DTCrateKey token contract holder has a token balance less than `totalSupply`. Reverts if the sale contract has an allowance from the ERC20 F1DTCrateKey token contract holder not-equal-to `totalSupply`. Emits the `SkuCreation` event. sku The SKU identifier. totalSupply The initial | function createCrateKeySku(
bytes32 sku,
uint256 totalSupply,
uint256 maxQuantityPerPurchase,
IF1DTCrateKey crateKey
| function createCrateKeySku(
bytes32 sku,
uint256 totalSupply,
uint256 maxQuantityPerPurchase,
IF1DTCrateKey crateKey
| 26,622 |
4 | // mapping to exclude certain TCO2 contracts by address,/ even if the attribute matching would pass | mapping(address => bool) public internalBlackList;
| mapping(address => bool) public internalBlackList;
| 13,290 |
86 | // Pause contract. | function pauseIco() onlyOwner() external
| function pauseIco() onlyOwner() external
| 2,437 |
207 | // Reads the int80 at `cdPtr` in calldata. | function readInt80(
CalldataPointer cdPtr
| function readInt80(
CalldataPointer cdPtr
| 12,717 |
15 | // Grants `role` to `account`. | * If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(uint8 role, address account)
public
virtual
override
onlyRole(getRoleAdmin(role))
{
uint8 callerRole = getRole(_msgSender());
uint8 accountToGrantRole = getRole(account);
if (accountToGrantRole != 0) {
if (callerRole < accountToGrantRole) {
_grantRole(role, account);
} else {
revert(
"AccessControl: You cannot change a role for an account with a higher role roles than yours."
);
}
} else {
_grantRole(role, account);
}
}
| * If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(uint8 role, address account)
public
virtual
override
onlyRole(getRoleAdmin(role))
{
uint8 callerRole = getRole(_msgSender());
uint8 accountToGrantRole = getRole(account);
if (accountToGrantRole != 0) {
if (callerRole < accountToGrantRole) {
_grantRole(role, account);
} else {
revert(
"AccessControl: You cannot change a role for an account with a higher role roles than yours."
);
}
} else {
_grantRole(role, account);
}
}
| 28,280 |
110 | // -- Stakes --/Gets the amount of LRC the owner has staked onchain for this exchange./The stake will be burned if the exchange does not fulfill its duty by/processing user requests in time. Please note that order matching may potentially/performed by another party and is not part of the exchange's duty.// return The amount of LRC staked | function getExchangeStake()
external
virtual
view
returns (uint);
| function getExchangeStake()
external
virtual
view
returns (uint);
| 80,952 |
12 | // Creates a random Artwork from string (name) | function createRandomArtwork(string memory _name) public {
uint256 randArt = generateRandomArt(_name, msg.sender);
_createArtwork(_name, randArt);
}
| function createRandomArtwork(string memory _name) public {
uint256 randArt = generateRandomArt(_name, msg.sender);
_createArtwork(_name, randArt);
}
| 2,574 |
17 | // Returns true if the address is RiskAdmin, false otherwise admin The address to checkreturn True if the given address is RiskAdmin, false otherwise / | function isRiskAdmin(address admin) external view returns (bool);
| function isRiskAdmin(address admin) external view returns (bool);
| 22,598 |
35 | // The amount of the rewards token available in the staking contract./Expressed in Wei./ return The amount of the ERC20 reward token still available for emissions. | function getTokenBalance() public view returns (uint256) {
return someToken.balanceOf(address(this));
}
| function getTokenBalance() public view returns (uint256) {
return someToken.balanceOf(address(this));
}
| 39,725 |
191 | // Set cToken collateral cap It will revert if the cToken is not CCollateralCap. cToken The cToken address newCollateralCap The new collateral cap / | function _setCollateralCap(address cToken, uint newCollateralCap) external onlyAdmin {
CCollateralCapErc20Interface(cToken)._setCollateralCap(newCollateralCap);
}
| function _setCollateralCap(address cToken, uint newCollateralCap) external onlyAdmin {
CCollateralCapErc20Interface(cToken)._setCollateralCap(newCollateralCap);
}
| 73,654 |
14 | // _testCoinPerBlock = testCoinPerBlock_; | _testCoinPerBlock = ((5 * (10**_testCoin.decimals())) / 100); // 0.05 TestCoin per block
| _testCoinPerBlock = ((5 * (10**_testCoin.decimals())) / 100); // 0.05 TestCoin per block
| 47,152 |
44 | // timeRemaining = bonusEnd - now, or 0 if bonus ended | uint256 timeRemaining =
block.timestamp > bonusEnd ? 0 : bonusEnd.sub(block.timestamp);
| uint256 timeRemaining =
block.timestamp > bonusEnd ? 0 : bonusEnd.sub(block.timestamp);
| 42,628 |
290 | // the first 20% (ETH purchases) go to the minterthe remaining 80% have a 10% chance to be given to a random staked guard seed a random value to select a recipient fromreturn the address of the recipient (either the minter or the Guard thief's owner) / | function selectRecipient(uint256 seed) internal view returns (address) {
if (minted <= PAID_TOKENS || ((seed >> 245) % 10) != 0) return _msgSender(); // top 10 bits haven't been used
address thief = arena.randomGuardOwner(seed >> 144); // 144 bits reserved for trait selection
if (thief == address(0x0)) return _msgSender();
return thief;
}
| function selectRecipient(uint256 seed) internal view returns (address) {
if (minted <= PAID_TOKENS || ((seed >> 245) % 10) != 0) return _msgSender(); // top 10 bits haven't been used
address thief = arena.randomGuardOwner(seed >> 144); // 144 bits reserved for trait selection
if (thief == address(0x0)) return _msgSender();
return thief;
}
| 21,100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.