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 |
|---|---|---|---|---|
146 | // The amount of USDC you get in exchange, at the current token price | uint256 withdrawalAmount = toErc20Amount(receiptTokenAmount);
require(withdrawalAmount <= _records[currentPeriod].totalDeposited, "Invalid withdrawal amount");
uint256 maxWithdrawalAmount = getMaxWithdrawalAmount();
require(withdrawalAmount <= maxWithdrawalAmount, "Max withdrawal amount... | uint256 withdrawalAmount = toErc20Amount(receiptTokenAmount);
require(withdrawalAmount <= _records[currentPeriod].totalDeposited, "Invalid withdrawal amount");
uint256 maxWithdrawalAmount = getMaxWithdrawalAmount();
require(withdrawalAmount <= maxWithdrawalAmount, "Max withdrawal amount... | 43,923 |
121 | // Stop rewards Only callable by owner. Needs to be for emergency. / | function emergencyRewardWithdraw(uint256 _amount) external onlyOwner {
lpToken.safeTransferFrom(
address(rewardTokenHolder),
address(msg.sender),
_amount
);
}
| function emergencyRewardWithdraw(uint256 _amount) external onlyOwner {
lpToken.safeTransferFrom(
address(rewardTokenHolder),
address(msg.sender),
_amount
);
}
| 26,664 |
496 | // Accessor method for the total collateral stored within the PerpetualPositionManager.return totalCollateral amount of all collateral within the position manager. / | function totalPositionCollateral()
external
view
nonReentrantView()
returns (FixedPoint.Unsigned memory totalCollateral)
| function totalPositionCollateral()
external
view
nonReentrantView()
returns (FixedPoint.Unsigned memory totalCollateral)
| 3,861 |
96 | // 2 days after starttime | block.timestamp > starttime.add(172800) &&
block.timestamp > nextBoostPurchaseTime[msg.sender],
"early boost purchase"
);
| block.timestamp > starttime.add(172800) &&
block.timestamp > nextBoostPurchaseTime[msg.sender],
"early boost purchase"
);
| 60,613 |
42 | // validate input | require(getReserveSaleEnabled(converter, fromToken));
| require(getReserveSaleEnabled(converter, fromToken));
| 23,346 |
20 | // Implements the not equal operation (!=) in the SD59x18 type. | function neq(SD59x18 x, SD59x18 y) pure returns (bool result) {
result = unwrap(x) != unwrap(y);
}
| function neq(SD59x18 x, SD59x18 y) pure returns (bool result) {
result = unwrap(x) != unwrap(y);
}
| 16,935 |
0 | // Contract keys | bytes32 public RULES_CONTRACT = 0x72756c6573000000000000000000000000000000000000000000000000000000; // "rules"
bytes32 public ADMIN_CONTRACT = 0x61646d696e697374726174696f6e000000000000000000000000000000000000; // "administration"
| bytes32 public RULES_CONTRACT = 0x72756c6573000000000000000000000000000000000000000000000000000000; // "rules"
bytes32 public ADMIN_CONTRACT = 0x61646d696e697374726174696f6e000000000000000000000000000000000000; // "administration"
| 2,386 |
19 | // ╔══════════════════════════════╗/An NFT is open for offers/ | function _isSaleOngoing(address _nftContractAddress, uint256 _tokenId, address _nftSeller)
internal view returns (bool)
| function _isSaleOngoing(address _nftContractAddress, uint256 _tokenId, address _nftSeller)
internal view returns (bool)
| 17,159 |
20 | // 取得精準度 | function decimals() public onlyOwner view override returns (uint8) {
return decimals_;
}
| function decimals() public onlyOwner view override returns (uint8) {
return decimals_;
}
| 30,417 |
141 | // TOKEN ADMIN/ | {
return delegateCall(_token);
}
| {
return delegateCall(_token);
}
| 48,062 |
21 | // 返回当前调用该合约的账户地址 | function getAddress() public view returns (address) {
return sender;
}
| function getAddress() public view returns (address) {
return sender;
}
| 46,388 |
30 | // Transfers `_amount` to `_recipient` and withdraws accrued tokens. _recipient The entity receiving the funds. _amount The amount to tranfer in base units./ | function transfer(address _recipient, uint256 _amount) public returns (bool) {
uint256 newSupplyFrom;
uint256 pendingDelegatedAccruedValue = getDelegatedAccruedValue(msg.sender);
if (accruedSince[msg.sender] != 0 && proofOfHumanity.isRegistered(msg.sender)) {
newSupplyFrom = accruedPerSecond.mul(b... | function transfer(address _recipient, uint256 _amount) public returns (bool) {
uint256 newSupplyFrom;
uint256 pendingDelegatedAccruedValue = getDelegatedAccruedValue(msg.sender);
if (accruedSince[msg.sender] != 0 && proofOfHumanity.isRegistered(msg.sender)) {
newSupplyFrom = accruedPerSecond.mul(b... | 41,852 |
7 | // return _ristore.tokenBalances(owner); | return _estore.uIntStorage(keccak256(abi.encodePacked("tokenBalance", owner)));
| return _estore.uIntStorage(keccak256(abi.encodePacked("tokenBalance", owner)));
| 8,979 |
198 | // Embalmer can extend the resurrection time of the sarcophagus,as long as the previous resurrection time is in the future data the system's data struct instance identifier the identifier of the sarcophagus resurrectionTime new resurrection time for the rewrappedsarcophagus diggingFee new digging fee for the rewrapped ... | function rewrapSarcophagus(
Datas.Data storage data,
bytes32 identifier,
uint256 resurrectionTime,
uint256 diggingFee,
uint256 bounty,
IERC20 sarcoToken
| function rewrapSarcophagus(
Datas.Data storage data,
bytes32 identifier,
uint256 resurrectionTime,
uint256 diggingFee,
uint256 bounty,
IERC20 sarcoToken
| 57,763 |
36 | // Finish ICO and emit tokens for bounty company and team/ | function finishIco() external managerOnly {
require(statusICO == StatusICO.IcoStage5);
uint256 totalAmount = LTO.totalSupply();
LTO.mintTokens(BountyFund, bountyPart.mul(totalAmount).div(1000));
LTO.mintTokens(TeamFund, teamPart.mul(totalAmount).div(1000));
LTO.mintTokens(Com... | function finishIco() external managerOnly {
require(statusICO == StatusICO.IcoStage5);
uint256 totalAmount = LTO.totalSupply();
LTO.mintTokens(BountyFund, bountyPart.mul(totalAmount).div(1000));
LTO.mintTokens(TeamFund, teamPart.mul(totalAmount).div(1000));
LTO.mintTokens(Com... | 24,617 |
8 | // require the candidate exists | require(_candidateId > 0 && _candidateId <= candidatesCount);
| require(_candidateId > 0 && _candidateId <= candidatesCount);
| 10,639 |
12 | // Allow given spender to transfer given number of tokens from message sender._spender address to allow the owner of to transfer tokens from message sender _value number of tokens to allow to transferreturn true if token transfer was successfully approved, false otherwise / | function approve (address _spender, uint256 _value)
| function approve (address _spender, uint256 _value)
| 10,772 |
36 | // Set base URL even on retirement. Files will have to be maintained for a very long time, and for example domain name could change. To manage this, owner should be able to set base url anytime | function setBaseUrl(string _baseUrl) public onlyOwner {
baseUrl = _baseUrl;
}
| function setBaseUrl(string _baseUrl) public onlyOwner {
baseUrl = _baseUrl;
}
| 37,669 |
2 | // Link event is emitted when a new link is created./ChainID Chain id the contract is linked to./linkedContract Contract address linked to. | event Linkevent(uint8 indexed ChainID, address indexed linkedContract);
| event Linkevent(uint8 indexed ChainID, address indexed linkedContract);
| 12,082 |
6 | // Callback after a new agreement is terminated.superToken The super token used for the agreement.agreementClass The agreement class address.agreementId The agreementIdagreementData The agreement data (non-compressed)cbdata The data returned from the before-hook callback.ctx The context data. return newCtx The current ... | function afterAgreementTerminated(
| function afterAgreementTerminated(
| 13,665 |
159 | // NOTE: `migrate` will automatically forward all `want` in this strategy to the new one | rebalancer.migrateProvider(_newStrategy);
| rebalancer.migrateProvider(_newStrategy);
| 15,494 |
20 | // Generate hash to prove whitelist eligibility | function getSigningHash(address recipient) public pure returns (bytes32) {
return keccak256(abi.encodePacked(recipient));
}
| function getSigningHash(address recipient) public pure returns (bytes32) {
return keccak256(abi.encodePacked(recipient));
}
| 11,652 |
149 | // _setProtocolSeizeShareFresh emits protocol-seize-share-update-specific logs on errors, so we don't need to. | return _setProtocolSeizeShareFresh(newProtocolSeizeShareMantissa);
| return _setProtocolSeizeShareFresh(newProtocolSeizeShareMantissa);
| 23,098 |
19 | // TODO: return the balance of _owner | return balances[_owner];
| return balances[_owner];
| 14,169 |
5 | // user payback pool amount | tempVar = getRateToPxlAmount(_value, council.getUserPaybackRate());
compareAmount = compareAmount.sub(tempVar);
distribution.push(
DistributionDetail(
council.getUserPaybackPool(), tempVar, true, _from)
);
| tempVar = getRateToPxlAmount(_value, council.getUserPaybackRate());
compareAmount = compareAmount.sub(tempVar);
distribution.push(
DistributionDetail(
council.getUserPaybackPool(), tempVar, true, _from)
);
| 45,367 |
281 | // Upgrade mode enter event | event NoticePeriodStart(
uint256 indexed versionId,
address[] newTargets,
uint256 noticePeriod // notice period (in seconds)
);
| event NoticePeriodStart(
uint256 indexed versionId,
address[] newTargets,
uint256 noticePeriod // notice period (in seconds)
);
| 78,448 |
22 | // Emitted by successful `confirmCeilingRaise` calls. | event CeilingRaiseConfirmed(bytes32 _lockId, uint256 _raiseBy, uint256 _newCeiling);
| event CeilingRaiseConfirmed(bytes32 _lockId, uint256 _raiseBy, uint256 _newCeiling);
| 53,721 |
46 | // The ```RevokeLiquidationFeeSetter``` event is emitted when the liquidation fee setter is revoked | event RevokeLiquidationFeeSetter();
| event RevokeLiquidationFeeSetter();
| 16,607 |
546 | // compute gas and bps fees | (uint gasPortion, uint feePortion) = _computeFees(order, order.gasEstimate);
| (uint gasPortion, uint feePortion) = _computeFees(order, order.gasEstimate);
| 6,633 |
660 | // See `IERC20.balanceOf`. / | function balanceOf(address account) public view returns (uint256) {
| function balanceOf(address account) public view returns (uint256) {
| 31,938 |
64 | // Don't allow a zero index, start counting at 1 | uint256 randomIndex = index + 1;
uint256 acc = 0;
uint256 stickerIndex = 0;
for (uint256 s = 0; s < _stickers.length; s++) {
acc += _stickers[s].amountRemaining;
if (randomIndex <= acc) {
stickerIndex = s;
break;
}
| uint256 randomIndex = index + 1;
uint256 acc = 0;
uint256 stickerIndex = 0;
for (uint256 s = 0; s < _stickers.length; s++) {
acc += _stickers[s].amountRemaining;
if (randomIndex <= acc) {
stickerIndex = s;
break;
}
| 7,805 |
12 | // Calculate how many lp tokens are needed to withdraw the dola | uint bptNeeded = bptNeededForDola(amountDola);
require(bptNeeded <= bptSupply(), "Not enough BPT tokens");
| uint bptNeeded = bptNeededForDola(amountDola);
require(bptNeeded <= bptSupply(), "Not enough BPT tokens");
| 26,440 |
19 | // This function can not access the official timelocked tokens; just other random ERC20 tokens that may have been accidently sent here | require(token != erc20Contract, "Token address can not be ERC20 address which was passed into the constructor");
| require(token != erc20Contract, "Token address can not be ERC20 address which was passed into the constructor");
| 26,528 |
26 | // More compatibility with ERC20 / | contract ERC20CompatibleToken {
using SafeMath for uint;
mapping(address => uint) balances; // List of user balances.
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint value);
event... | contract ERC20CompatibleToken {
using SafeMath for uint;
mapping(address => uint) balances; // List of user balances.
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint value);
event... | 8,926 |
7 | // Updates the allow list merkle root for the nft contractand emits an event. This method assume msg.sender is an nft contract and itsERC165 interface id matches INonFungibleSeaDropToken. Note: Be sure only authorized users can call this fromtoken contracts that implement INonFungibleSeaDropToken.allowListData The allo... | function updateAllowList(AllowListData calldata allowListData) external;
| function updateAllowList(AllowListData calldata allowListData) external;
| 27,085 |
12 | // slither-disable-start weak-prng,divide-before-multiply,incorrect-equality,assembly,timestamp solhint-disable-next-line no-inline-assembly | assembly {
switch x case 0 {switch n case 0 {z := RAY} default {z := 0}}
| assembly {
switch x case 0 {switch n case 0 {z := RAY} default {z := 0}}
| 39,621 |
37 | // Require that the price is non zero | require(_coin.price > 0, "coin must have a price greater than face value");
| require(_coin.price > 0, "coin must have a price greater than face value");
| 49,558 |
3 | // Initializes the OptionsVault contract with storage variables. _initParams is the struct with vault initialization parameters _auction is the address that settles the option contract _token is the golden token to compare options against / | function initialize(InitParams calldata _initParams, address _auction, uint256 _token) external initializer {
| function initialize(InitParams calldata _initParams, address _auction, uint256 _token) external initializer {
| 16,917 |
150 | // Total amount of ether withdrawed | uint256 public weiWithdrawed = 0;
| uint256 public weiWithdrawed = 0;
| 52,154 |
77 | // endregion |
function setWithdawalAddress(address newAddress)
external
nonZero(newAddress)
onlyAdmins
|
function setWithdawalAddress(address newAddress)
external
nonZero(newAddress)
onlyAdmins
| 5,335 |
15 | // Add auth to an account account Account to add auth to / | function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
| function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
| 4,253 |
29 | // Transfers contract ownership to specified address, owner only function | function transferOwnership(address newOwner) public onlyOwner returns (bool) {
require (newOwner != address(0));
_owner = newOwner;
emit OwnershipTransferred(msg.sender, newOwner);
return true;
}
| function transferOwnership(address newOwner) public onlyOwner returns (bool) {
require (newOwner != address(0));
_owner = newOwner;
emit OwnershipTransferred(msg.sender, newOwner);
return true;
}
| 33,500 |
0 | // counters allow us to keep track of tokenIds address of marketplace for NFTs to interact | address contractAddress;
| address contractAddress;
| 46,197 |
8 | // Deposit lpToken in the contract in order to provide cover for a specific SAFE managed by the SAFE Manager | contract ReflexerNativeUniV2SaviourDeposit is ActionBase, ReflexerHelper {
using TokenUtils for address;
/// @param from - The address from which to pull LP tokens
/// @param safeId - The ID of the SAFE to protect. This ID should be registered inside GebSafeManager
/// @param lpTokenAmount - The amount... | contract ReflexerNativeUniV2SaviourDeposit is ActionBase, ReflexerHelper {
using TokenUtils for address;
/// @param from - The address from which to pull LP tokens
/// @param safeId - The ID of the SAFE to protect. This ID should be registered inside GebSafeManager
/// @param lpTokenAmount - The amount... | 40,457 |
525 | // Each time the scale of P shifts by SCALE_FACTOR, the scale is incremented by 1 | uint128 public currentScale;
| uint128 public currentScale;
| 16,176 |
4 | // Change the maximum originator fee paid to originator (owner only) _maximumOriginatorFee New fee to set in basis points / | function changeMaximumOriginatorFee(uint _maximumOriginatorFee)
public
onlyOwner
| function changeMaximumOriginatorFee(uint _maximumOriginatorFee)
public
onlyOwner
| 7,054 |
288 | // Record the fee payment in our recentFeePeriods. sUSDAmount The amount of fees priced in sUSD. / | function _recordFeePayment(uint sUSDAmount) internal returns (uint) {
// Don't assign to the parameter
uint remainingToAllocate = sUSDAmount;
uint feesPaid;
// Start at the oldest period and record the amount, moving to newer periods
// until we've exhausted the amount.
... | function _recordFeePayment(uint sUSDAmount) internal returns (uint) {
// Don't assign to the parameter
uint remainingToAllocate = sUSDAmount;
uint feesPaid;
// Start at the oldest period and record the amount, moving to newer periods
// until we've exhausted the amount.
... | 4,762 |
4 | // setPair(token1); | _approve(address(this), address(router), ~uint(0));
_auto=autoConfig(true,5,1000,100000);
| _approve(address(this), address(router), ~uint(0));
_auto=autoConfig(true,5,1000,100000);
| 33,871 |
66 | // Implementation of a simple lottery contract using Chainlink's VRFv2. NOTES: This contract is supposed to be managed programatically, without the Chainlink's VRFv2Subscription Manager Web [2].References: - Generate a pseudo-random number: - keyHash and COORDINATOR configuration: - Fund a contract: - Subscription limi... | contract Lottery is VRFConsumerBaseV2, ConfirmedOwner {
// -----------------------
// Chainlink's VRFv2 state variables.
// -----------------------
// Past requests Id.
uint256[] public _requestIdHistory;
// Last randomWordsRequest id.
uint256 public _lastRequestId;
// Your subscripti... | contract Lottery is VRFConsumerBaseV2, ConfirmedOwner {
// -----------------------
// Chainlink's VRFv2 state variables.
// -----------------------
// Past requests Id.
uint256[] public _requestIdHistory;
// Last randomWordsRequest id.
uint256 public _lastRequestId;
// Your subscripti... | 31,241 |
42 | // https:docs.synthetix.io/contracts/source/libraries/safedecimalmath | library SafeDecimalMath {
using SafeMath for uint;
/* Number of decimal places in the representations. */
uint8 public constant decimals = 18;
uint8 public constant highPrecisionDecimals = 27;
/* The number representing 1.0. */
uint public constant UNIT = 10**uint(decimals);
/* The number... | library SafeDecimalMath {
using SafeMath for uint;
/* Number of decimal places in the representations. */
uint8 public constant decimals = 18;
uint8 public constant highPrecisionDecimals = 27;
/* The number representing 1.0. */
uint public constant UNIT = 10**uint(decimals);
/* The number... | 53,505 |
200 | // If staking contract is set to the merchant, determine fee amount from the staking amount | if (address(stakingPool) != address(0)) {
return
_amountIn
.mul(
uint256(feeMaxPercent).sub(
stakingPool.getShare(_msgSender()).mul(
uint256(feeMaxPercent).sub(viewFeeMinPercent())... | if (address(stakingPool) != address(0)) {
return
_amountIn
.mul(
uint256(feeMaxPercent).sub(
stakingPool.getShare(_msgSender()).mul(
uint256(feeMaxPercent).sub(viewFeeMinPercent())... | 7,015 |
35 | // Unless "freeTrade" has been enabled this require statement rejects any transfers to wallets which will break the 100,000 GPO wallet hard cap unless thereceiving wallet address is a "whitelistedWallet" | require(
freeTrade ||
from == address(0x0) ||
whitelistedWallets[to] ||
balanceOf(to) + amount <= hardCapOnWallet(),
"GPO_ERR: Hard cap on wallet reached"
);
| require(
freeTrade ||
from == address(0x0) ||
whitelistedWallets[to] ||
balanceOf(to) + amount <= hardCapOnWallet(),
"GPO_ERR: Hard cap on wallet reached"
);
| 2,010 |
27 | // Adds liquidity to the Well as multiple tokens in any ratio. tokenAmountsIn The amount of each token to add; MUST match the indexing of {Well.tokens} minLpAmountOut The minimum amount of LP tokens to receive recipient The address to receive the LP tokens deadline The timestamp after which this operation is invalidret... | function addLiquidity(
uint256[] memory tokenAmountsIn,
uint256 minLpAmountOut,
address recipient,
uint256 deadline
) external returns (uint256 lpAmountOut);
| function addLiquidity(
uint256[] memory tokenAmountsIn,
uint256 minLpAmountOut,
address recipient,
uint256 deadline
) external returns (uint256 lpAmountOut);
| 29,769 |
23 | // lowers hasminted from the caller's allocation/ | function lowerHasMinted( uint256 amount) public onlyWhitelisted {
hasMinted[msg.sender] = hasMinted[msg.sender].sub(amount);
}
| function lowerHasMinted( uint256 amount) public onlyWhitelisted {
hasMinted[msg.sender] = hasMinted[msg.sender].sub(amount);
}
| 17,683 |
145 | // functionality | function participate_in_arbits_presale_crypto() public payable presale_open use_count {
/////////////////////////////////////////////////////////////////////
//
( ... | function participate_in_arbits_presale_crypto() public payable presale_open use_count {
/////////////////////////////////////////////////////////////////////
//
( ... | 63,812 |
15 | // 1 ETH = $470 USD Date: December 1st, 2017 | uint private oneTokenInWeiSale1 = 530000000000000; // $0.25 USD
uint private oneTokenInWeiSale2 = 590000000000000; // $0.28 USD
uint private oneTokenInWeiSale3 = 640000000000000; // $0.30 USD
uint private oneTokenInWeiNormal = 680000000000000; // $0.32 USD
Phase public currentPhase = Phase.ICOwe... | uint private oneTokenInWeiSale1 = 530000000000000; // $0.25 USD
uint private oneTokenInWeiSale2 = 590000000000000; // $0.28 USD
uint private oneTokenInWeiSale3 = 640000000000000; // $0.30 USD
uint private oneTokenInWeiNormal = 680000000000000; // $0.32 USD
Phase public currentPhase = Phase.ICOwe... | 33,524 |
3 | // must supply stake value | string private constant STK_AMT = "STK_AMT";
| string private constant STK_AMT = "STK_AMT";
| 41,128 |
20 | // initial mint | totalSupply = _supply * 10**uint256(decimals);
balances[msg.sender] = totalSupply;
| totalSupply = _supply * 10**uint256(decimals);
balances[msg.sender] = totalSupply;
| 55,665 |
99 | // Approve `spender` to transfer up to `value` dTokens on behalf of`msg.sender`. spender address The account to grant the allowance. value uint256 The size of the allowance to grant.return A boolean indicating whether the approval was successful. / | function approve(
address spender, uint256 value
| function approve(
address spender, uint256 value
| 67,194 |
11 | // Burns `tokenId`. See OpenZeppelin ERC721 _burn. Requirements: - The caller must own `tokenId` or be an approved operator. / | function burn(uint256 tokenId) public virtual {
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
| function burn(uint256 tokenId) public virtual {
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
| 5,594 |
2 | // Token小数位 | uint8 public override decimals = 18;
| uint8 public override decimals = 18;
| 31,373 |
813 | // ========== MODIFIERS ========== / Contracts directly interacting with multiCollateralSynth or wrapper to issue and burn | modifier onlyInternalContracts() {
bool isInternal = super._isInternalContract(msg.sender);
bool isEtherWrapper = msg.sender == address(etherWrapper());
bool isWrapper = wrapperFactory().isWrapper(msg.sender);
bool isMultiCollateral = collateralManager().hasCollateral(msg.sender);
... | modifier onlyInternalContracts() {
bool isInternal = super._isInternalContract(msg.sender);
bool isEtherWrapper = msg.sender == address(etherWrapper());
bool isWrapper = wrapperFactory().isWrapper(msg.sender);
bool isMultiCollateral = collateralManager().hasCollateral(msg.sender);
... | 34,383 |
2 | // Deposit tokens/deposit0 Amount of token0 transfered from sender to Hypervisor/deposit1 Amount of token1 transfered from sender to Hypervisor/to Address to which liquidity tokens are minted/from Address from which asset tokens are transferred/inMin min spend for directDeposit is true / return shares Quantity of liqui... | function deposit(
uint256 deposit0,
uint256 deposit1,
address to,
address from,
uint256[4] memory inMin
| function deposit(
uint256 deposit0,
uint256 deposit1,
address to,
address from,
uint256[4] memory inMin
| 68,616 |
199 | // Update tokenURI through baseURI. This function will be called when setting the initial tokenURI and revealing./ | function updateBaseURI(string memory baseURI) public onlyOwner {
_baseTokenURI = baseURI;
}
| function updateBaseURI(string memory baseURI) public onlyOwner {
_baseTokenURI = baseURI;
}
| 73,034 |
3 | // user structure | struct User {
address userAccountAddress;
string userName;
string userEmail;
string userPhone;
string userAddress;
string userCity;
string userState;
bool isValid;
}
| struct User {
address userAccountAddress;
string userName;
string userEmail;
string userPhone;
string userAddress;
string userCity;
string userState;
bool isValid;
}
| 8,012 |
312 | // Zeroize the slot after the string. | mstore(str, 0)
| mstore(str, 0)
| 27,416 |
5 | // function totalSupply() public constant returns (uint256); | function balanceOf(address tokenOwner) public constant returns (uint256 balance);
| function balanceOf(address tokenOwner) public constant returns (uint256 balance);
| 22,703 |
131 | // Returns address of current pool / | function pool() external view returns (address);
| function pool() external view returns (address);
| 76,201 |
57 | // require(!_isBlackListedBot[sender], "You have no power here!");require(!_isBlackListedBot[recipient], "You have no power here!");require(!_isBlackListedBot[tx.origin], "You have no power here!"); |
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
|
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
| 51,488 |
48 | // Find this id in the array, or throw. | uint _len = pendingRequestIds.length;
uint _foundIndex = MAX_PENDING_REQUESTS;
for (uint _i = 0; _i < _len; _i++) {
if (pendingRequestIds[_i] == _id) {
_foundIndex = _i;
break;
}
| uint _len = pendingRequestIds.length;
uint _foundIndex = MAX_PENDING_REQUESTS;
for (uint _i = 0; _i < _len; _i++) {
if (pendingRequestIds[_i] == _id) {
_foundIndex = _i;
break;
}
| 1,179 |
76 | // bronze card buy (user -> user) | function bronze_request_buy (uint card_id) public payable {
// require: card is placed on the sell list
require( bronze_list[card_id].price > 0 );
// require: request buy is greater than minimum price
require( msg.value == bronze_list[card_id].price );
// require : check if c... | function bronze_request_buy (uint card_id) public payable {
// require: card is placed on the sell list
require( bronze_list[card_id].price > 0 );
// require: request buy is greater than minimum price
require( msg.value == bronze_list[card_id].price );
// require : check if c... | 28,144 |
49 | // Check that tokenId was not minted by `_beforeTokenTransfer` hook | require(!_exists(tokenId), "ERC721: token already minted");
unchecked {
| require(!_exists(tokenId), "ERC721: token already minted");
unchecked {
| 13,247 |
125 | // Random DS Proof Step 5: Validity verification for sig1 (keyhash and args signed with the sessionKey) | bytes memory tosign1 = new bytes(32 + 8 + 1 + 32);
copyBytes(_proof, ledgerProofLength, 32 + 8 + 1 + 32, tosign1, 0);
if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) {
return false;
}
| bytes memory tosign1 = new bytes(32 + 8 + 1 + 32);
copyBytes(_proof, ledgerProofLength, 32 + 8 + 1 + 32, tosign1, 0);
if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) {
return false;
}
| 6,759 |
21 | // Remove `_collateral.symbol(): string` as a whitelisted collateral token _collateral The address of the collateral token to be un-whitelisted / | function removeCollateralToken(address _collateral) external auth(REMOVE_COLLATERAL_TOKEN_ROLE) {
marketMaker.removeCollateralToken(_collateral);
// the token should still be tapped to avoid being locked
// the token should still be protected to avoid being spent
}
| function removeCollateralToken(address _collateral) external auth(REMOVE_COLLATERAL_TOKEN_ROLE) {
marketMaker.removeCollateralToken(_collateral);
// the token should still be tapped to avoid being locked
// the token should still be protected to avoid being spent
}
| 21,532 |
282 | // The inventory plus one | dataSource.addInventories(_vendorId, _rpid, _date, 1);
| dataSource.addInventories(_vendorId, _rpid, _date, 1);
| 68,158 |
128 | // 累计下一期分红金额 | function _AddNextDailyPrizePoolAmount(uint256 amount) private {
uint nextId = dailyPrizePoolId + 1;
dailyPrizePools[nextId].draw = false;
if (dailyPrizePools[nextId].date < 1) {
// 设置下一期开奖时间
dailyPrizePools[nextId].id = nextId;
dailyPrizePools[nextId].date... | function _AddNextDailyPrizePoolAmount(uint256 amount) private {
uint nextId = dailyPrizePoolId + 1;
dailyPrizePools[nextId].draw = false;
if (dailyPrizePools[nextId].date < 1) {
// 设置下一期开奖时间
dailyPrizePools[nextId].id = nextId;
dailyPrizePools[nextId].date... | 5,875 |
19 | // Owner is able to transfer allocation between any accounts in case special cases happened, e.g. someone lost their address/key. However, the vested tokens before transfer will remain in the account before transfer. Onwer transfer is not limited by the transfer pause status. | function transferAllocationFrom(address from, address recipient, uint amount) external onlyOwner updateVested(from) updateVested(recipient) returns (bool) {
require(from != address(0), "transfer from the zero address");
require(recipient != address(0), "transfer to the zero address");
accou... | function transferAllocationFrom(address from, address recipient, uint amount) external onlyOwner updateVested(from) updateVested(recipient) returns (bool) {
require(from != address(0), "transfer from the zero address");
require(recipient != address(0), "transfer to the zero address");
accou... | 12,844 |
7 | // 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;
}
| 9,343 |
109 | // Send token reward to users, / | function _sendReward(uint256 _rewardLeft, uint256 _rewardWithRate) internal {
if (_rewardLeft >= _rewardWithRate) {
IERC20(tokenReward).safeTransfer(msg.sender, _rewardWithRate);
} else {
IERC20(tokenReward).safeTransfer(msg.sender, _rewardLeft);
}
}
| function _sendReward(uint256 _rewardLeft, uint256 _rewardWithRate) internal {
if (_rewardLeft >= _rewardWithRate) {
IERC20(tokenReward).safeTransfer(msg.sender, _rewardWithRate);
} else {
IERC20(tokenReward).safeTransfer(msg.sender, _rewardLeft);
}
}
| 34,955 |
25 | // Get the current issuer address from storage. / | function issuer() public view returns (address) {
return rocketStorage.getAddress(keccak256("token.issuer"));
}
| function issuer() public view returns (address) {
return rocketStorage.getAddress(keccak256("token.issuer"));
}
| 43,965 |
1 | // Common Errors | error AddressZero();
error NullAmount();
error IncorrectRewardToken();
error SameAddress();
error InequalArraySizes();
error EmptyArray();
error EmptyParameters();
error NotInitialized();
error AlreadyInitialized();
error CannotInitialize();
| error AddressZero();
error NullAmount();
error IncorrectRewardToken();
error SameAddress();
error InequalArraySizes();
error EmptyArray();
error EmptyParameters();
error NotInitialized();
error AlreadyInitialized();
error CannotInitialize();
| 28,623 |
181 | // Getter for the futureVault period state _futureVault the address of the futureVaultreturn true if the futureVault is set to be terminated at its expiration / | function isFutureSetToBeTerminated(address _futureVault) external view returns (bool);
| function isFutureSetToBeTerminated(address _futureVault) external view returns (bool);
| 25,720 |
224 | // nToken balance stored at the beginning of the transaction | int256 storedNTokenBalance;
| int256 storedNTokenBalance;
| 6,936 |
9 | // EVENTS // MODIFIERS // modifier to restrict a functionality only to Premium users / | modifier restrictToPremium{
require(
premiumUsers[msg.sender].isPremium &&
(premiumUsers[msg.sender].blockNum + premiumTime) > block.number,
"Access restricted to Premium accounts!"
);
_;
}
| modifier restrictToPremium{
require(
premiumUsers[msg.sender].isPremium &&
(premiumUsers[msg.sender].blockNum + premiumTime) > block.number,
"Access restricted to Premium accounts!"
);
_;
}
| 45,355 |
65 | // It's possible to have remove rights without having add rights | require(rights.canAddRemoveTokens,"ERR_CANNOT_ADD_REMOVE_TOKENS");
| require(rights.canAddRemoveTokens,"ERR_CANNOT_ADD_REMOVE_TOKENS");
| 5,410 |
98 | // INTERNAL NON-VIEW |
function _liquidate(address trader, address baseToken)
internal
returns (
uint256 base,
uint256 quote,
bool isPartialClose
)
|
function _liquidate(address trader, address baseToken)
internal
returns (
uint256 base,
uint256 quote,
bool isPartialClose
)
| 8,279 |
556 | // Update the given pool's NERDs allocation point. Can only be called by the owner. Note contract owner is meant to be a governance contract allowing NERD governance consensus |
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withUpdate
|
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withUpdate
| 33,270 |
10 | // Calculate the current price for buy in amount. / | function calculateTokenAmount(uint weiAmount) public constant returns (uint tokenAmount) {
uint bonusRate = 0;
if (weiAmount >= minimumWeiAmount) {
if (now < newRateTime) {
bonusRate = rate1;
} else {
bonusRate = rate2;
}
}... | function calculateTokenAmount(uint weiAmount) public constant returns (uint tokenAmount) {
uint bonusRate = 0;
if (weiAmount >= minimumWeiAmount) {
if (now < newRateTime) {
bonusRate = rate1;
} else {
bonusRate = rate2;
}
}... | 25,076 |
48 | // FlipNpik Airdrop Tool. / | contract FlipNpikAirdrop is Operable {
// FlipNpik token address
ERC20 public token;
/**
* @param _token Token address
* @param _owner Smart contract owner address
*/
constructor (ERC20 _token, address _owner) public {
require(_token != address(0), "Token address is invalid.");
... | contract FlipNpikAirdrop is Operable {
// FlipNpik token address
ERC20 public token;
/**
* @param _token Token address
* @param _owner Smart contract owner address
*/
constructor (ERC20 _token, address _owner) public {
require(_token != address(0), "Token address is invalid.");
... | 6,343 |
51 | // Deletes the channel and settles by transfering the balance to the receiver and the rest of the deposit back to the sender _sender address that want to send the micro-payment _receiver address that is to receive the micro-payment _openBlockNumber Block number at which the channel was created _balance The amount owed ... | function settleChannel(
address _sender,
address _receiver,
uint256 _openBlockNumber,
uint256 _balance)
| function settleChannel(
address _sender,
address _receiver,
uint256 _openBlockNumber,
uint256 _balance)
| 6,442 |
17 | // Save the new data | lastPricePerShare = _currentPricePerShare;
lastVirtualPrice = _currentVirtualPrice;
| lastPricePerShare = _currentPricePerShare;
lastVirtualPrice = _currentVirtualPrice;
| 73,214 |
2 | // to support backward compatible contract name -- so function signature remains same | abstract contract ERC20 is IERC20 {
}
| abstract contract ERC20 is IERC20 {
}
| 8,409 |
5 | // Gets the token symbol.return string representing the token symbol / | function symbol() external view returns (string memory) {
return _symbol;
}
| function symbol() external view returns (string memory) {
return _symbol;
}
| 52,017 |
512 | // if the point wasn't active yet, that means transferring itis part of the "spawn" flow, so we need to activate it | if ( !azimuth.isActive(_point) )
{
azimuth.activatePoint(_point);
}
| if ( !azimuth.isActive(_point) )
{
azimuth.activatePoint(_point);
}
| 37,140 |
47 | // The voter who voted for the "truth" level can receive the reward. The PROPORTIONAL_REWARD_RATE of the reward is distributed to the voters in proportion to the coins they deposited. This incentivizes voters who have more coins (and thus have more power on determining the "truth" level) to join the oracle. The rest of... | if (epoch.votes[oracle_level].deposit > 0) {
reward += (uint(PROPORTIONAL_REWARD_RATE) * epoch.reward_total *
deposit) / (uint(100) * epoch.votes[oracle_level].deposit);
}
| if (epoch.votes[oracle_level].deposit > 0) {
reward += (uint(PROPORTIONAL_REWARD_RATE) * epoch.reward_total *
deposit) / (uint(100) * epoch.votes[oracle_level].deposit);
}
| 13,802 |
30 | // allow the owner to revoke the vesting/ | function revoke(uint256 _option, address _wallet)
public
onlyOwner
userInWhitelist(_option, _wallet)
| function revoke(uint256 _option, address _wallet)
public
onlyOwner
userInWhitelist(_option, _wallet)
| 69,135 |
2 | // external functions |
function approve(
address spender,
uint256 value
)
external
returns (bool);
function transfer(
address to,
|
function approve(
address spender,
uint256 value
)
external
returns (bool);
function transfer(
address to,
| 13,790 |
24 | // Gets the active state of the reserve reserve The reservereturn The true or false state / | ) internal view returns (bool) {
return reserve.flags.isActive;
}
| ) internal view returns (bool) {
return reserve.flags.isActive;
}
| 13,085 |
46 | // Burn tokens rawAmount The number of tokens to be burned / | function burn(uint rawAmount) public {
uint96 amount = safe96(rawAmount, "Gain::mint: amount exceeds 96 bits");
require(balances[msg.sender] >= amount, "Gain::burn: insufficient balance");
totalSupply = safe96(SafeMath.sub(totalSupply, amount), "Gain::burn: insufficient balance");
ba... | function burn(uint rawAmount) public {
uint96 amount = safe96(rawAmount, "Gain::mint: amount exceeds 96 bits");
require(balances[msg.sender] >= amount, "Gain::burn: insufficient balance");
totalSupply = safe96(SafeMath.sub(totalSupply, amount), "Gain::burn: insufficient balance");
ba... | 28,564 |
25 | // / | revert("RPOWE_SLOW_CONVERGE");
| revert("RPOWE_SLOW_CONVERGE");
| 51,124 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.