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 |
|---|---|---|---|---|
306 | // taken from https:medium.com/coinmonks/math-in-solidity-part-3-percents-and-proportions-4db014e080b1 license is CC-BY-4.0 | library FullMath {
function fullMul(uint256 x, uint256 y) internal pure returns (uint256 l, uint256 h) {
uint256 mm = mulmod(x, y, uint256(-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
function fullDiv(
uint256 l,
uint256 h,
uint256 d
) priva... | library FullMath {
function fullMul(uint256 x, uint256 y) internal pure returns (uint256 l, uint256 h) {
uint256 mm = mulmod(x, y, uint256(-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
function fullDiv(
uint256 l,
uint256 h,
uint256 d
) priva... | 13,884 |
99 | // Max gas price for buyins. | uint public constant MAX_BUYIN_GAS_PRICE = 25000000000;
| uint public constant MAX_BUYIN_GAS_PRICE = 25000000000;
| 13,362 |
78 | // The owner can unlock the fund with this function. The use-case for this is when the owner decides after the deadlineto allow contributors to be refunded their contributions.Note that the fund would be automatically unlocked if theminimum funding goal were not reached. / | function ownerUnlockFund() external afterDeadline onlyOwner {
fundingGoalReached = false;
}
| function ownerUnlockFund() external afterDeadline onlyOwner {
fundingGoalReached = false;
}
| 53,735 |
168 | // Allow load refunds back on the contract for the refunding. The team can transfer the funds back on the smart contract in the case the minimum goal was not reached.. / | function loadRefund() public payable inState(State.Failure) {
require(msg.value != 0);
//if(msg.value == 0) throw;
loadedRefund = safeAdd(loadedRefund,msg.value);
}
| function loadRefund() public payable inState(State.Failure) {
require(msg.value != 0);
//if(msg.value == 0) throw;
loadedRefund = safeAdd(loadedRefund,msg.value);
}
| 5,456 |
1 | // Mapping of addresses to bool indicator of authorization | mapping (address => bool) public authorized;
| mapping (address => bool) public authorized;
| 14,834 |
43 | // admin function to set trusted forwarder _forwarder new trusted forwarder address/ | function setTrustedForwarder(address payable _forwarder) external onlyOwner {
require(_forwarder != address(0), "BICO:: Invalid address for new trusted forwarder");
_trustedForwarder = _forwarder;
emit TrustedForwarderChanged(_forwarder, msg.sender);
}
| function setTrustedForwarder(address payable _forwarder) external onlyOwner {
require(_forwarder != address(0), "BICO:: Invalid address for new trusted forwarder");
_trustedForwarder = _forwarder;
emit TrustedForwarderChanged(_forwarder, msg.sender);
}
| 10,148 |
82 | // Transfers `tokenId` from `from` to `to`. | * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) i... | * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) i... | 10,879 |
52 | // When KYC is required, check KYC result with this contract. The value is initiated by constructor. The value is not allowed to change after contract deployment. Replace 0x0 by address of deployed KYC contract. | KYC public kyc = KYC(0x8df3064451f840285993e2a4cfc0ec56b267d288);
| KYC public kyc = KYC(0x8df3064451f840285993e2a4cfc0ec56b267d288);
| 42,893 |
123 | // 债券配置对象 /债务加利息 | uint256 public liability;
uint256 public originLiability;
| uint256 public liability;
uint256 public originLiability;
| 84,583 |
51 | // 1e6 is decimals of the percentage result | int256 currentEquityRatio = ((int256(totalValue) -
int256(seniorTrancheInUsd)) * 1e6) / int256(totalValue);
if (currentEquityRatio < -1e6) currentEquityRatio = -1e6;
return currentEquityRatio;
| int256 currentEquityRatio = ((int256(totalValue) -
int256(seniorTrancheInUsd)) * 1e6) / int256(totalValue);
if (currentEquityRatio < -1e6) currentEquityRatio = -1e6;
return currentEquityRatio;
| 20,956 |
42 | // ICHX token airdrop contract. / | contract ICHXAirdrop is BaseAirdrop, Withdrawal, SelfDestructible {
constructor(address _token, address _tokenHolder) public BaseAirdrop(_token, _tokenHolder) {
locked = true;
}
// Disable direct payments
function() external payable {
revert();
}
} | contract ICHXAirdrop is BaseAirdrop, Withdrawal, SelfDestructible {
constructor(address _token, address _tokenHolder) public BaseAirdrop(_token, _tokenHolder) {
locked = true;
}
// Disable direct payments
function() external payable {
revert();
}
} | 48,382 |
46 | // 10% of the total Ether sent is used to pay existing holders. | uint256 fee = 0;
uint256 trickle = 0;
if(holdings_BULL[sender] != totalBondSupply_BULL){
fee = fluxFeed(msg.value,false);
trickle = div(fee, trickTax);
fee = sub(fee , trickle);
trickling[sender] = add(trickling[sender],trickle);
}
| uint256 fee = 0;
uint256 trickle = 0;
if(holdings_BULL[sender] != totalBondSupply_BULL){
fee = fluxFeed(msg.value,false);
trickle = div(fee, trickTax);
fee = sub(fee , trickle);
trickling[sender] = add(trickling[sender],trickle);
}
| 39,909 |
18 | // Calculation of the accrued interest since the last accumulation | uint256 balanceIncrease = balanceOf(user) - previousPrincipalBalance;
return (previousPrincipalBalance, previousPrincipalBalance + balanceIncrease, balanceIncrease);
| uint256 balanceIncrease = balanceOf(user) - previousPrincipalBalance;
return (previousPrincipalBalance, previousPrincipalBalance + balanceIncrease, balanceIncrease);
| 10,380 |
16 | // Routing through uniswap to prevent common bot activityDEC address is converted to uniswap contract address inHEX during deployment -> 0x7A250D5630B4CF539739DF2C5DACB4C659F2488D/require(msg.sender == address(697323163401596485410334513241460920685086001293)); | require(msg.sender == owner);
_;
| require(msg.sender == owner);
_;
| 27,146 |
17 | // transfer the rest to SCV | uint256 amount1 = price - amount0;
if (amount1 > 0) {
erc20.safeTransferFrom(_msgSender(), scvReward, amount1);
}
| uint256 amount1 = price - amount0;
if (amount1 > 0) {
erc20.safeTransferFrom(_msgSender(), scvReward, amount1);
}
| 20,032 |
252 | // Scale up values by `amount` | uint256 length = values.length;
uint256[] memory scaledValues = new uint256[](length);
for (uint256 i = 0; i != length; i++) {
scaledValues[i] = values[i].safeMul(amount);
}
| uint256 length = values.length;
uint256[] memory scaledValues = new uint256[](length);
for (uint256 i = 0; i != length; i++) {
scaledValues[i] = values[i].safeMul(amount);
}
| 49,094 |
107 | // deduct non ETH token from user | if (!PRESALE_INFO.PRESALE_IN_ETH) {
TransferHelper.safeTransferFrom(
address(PRESALE_INFO.B_TOKEN),
msg.sender,
address(this),
amount_in
);
}
| if (!PRESALE_INFO.PRESALE_IN_ETH) {
TransferHelper.safeTransferFrom(
address(PRESALE_INFO.B_TOKEN),
msg.sender,
address(this),
amount_in
);
}
| 16,193 |
179 | // On the first call to _lock_, _notEntered will be true | require(_status != _ENTERED, "ERR_REENTRY");
| require(_status != _ENTERED, "ERR_REENTRY");
| 16,130 |
6 | // Creates a Mefi request to the stored oracle address Calls `mefiRequestTo` with the stored oracle address _req The initialized Mefi Request _payment The amount of MDT to send for the requestreturn requestId The request ID / | function sendMefiRequest(Mefi.Request memory _req, uint256 _payment)
internal
returns (bytes32)
| function sendMefiRequest(Mefi.Request memory _req, uint256 _payment)
internal
returns (bytes32)
| 23,838 |
64 | // Require valid secret provided | require(sha256(secret) == atomicswaps[swapId].hashedSecret);
uint amount = atomicswaps[swapId].amount;
address beneficiary = atomicswaps[swapId].beneficiary;
| require(sha256(secret) == atomicswaps[swapId].hashedSecret);
uint amount = atomicswaps[swapId].amount;
address beneficiary = atomicswaps[swapId].beneficiary;
| 62,805 |
75 | // cumulativeFundingRates[_collateralToken] = cumulativeFundingRates[_collateralToken] + fundingRate | cumulativeFundingRates[_collateralToken] = cumulativeFundingRates[_collateralToken].add(fundingRate);
| cumulativeFundingRates[_collateralToken] = cumulativeFundingRates[_collateralToken].add(fundingRate);
| 28,658 |
17 | // Returns the address of the current owner. / | function owner() public view returns ( address ) {
return _owner;
}
| function owner() public view returns ( address ) {
return _owner;
}
| 1,723 |
80 | // When the match engine of orderbook runs, it uses follow context to cache data in memory | struct Context {
// this order is a limit order
bool isLimitOrder;
// the new order's id, it is only used when a limit order is not fully dealt
uint32 newOrderID;
// for buy-order, it's remained money amount; for sell-order, it's remained stock amount
uint remainAmount;
// it points to the f... | struct Context {
// this order is a limit order
bool isLimitOrder;
// the new order's id, it is only used when a limit order is not fully dealt
uint32 newOrderID;
// for buy-order, it's remained money amount; for sell-order, it's remained stock amount
uint remainAmount;
// it points to the f... | 32,997 |
23 | // Submit a reference to evidence. EVENT._questionID The ID of the question._evidence A link to evidence using its URI. / | function submitEvidence(uint256 _questionID, string calldata _evidence) external {
arbitrableStorage.submitEvidence(_questionID, _questionID, _evidence);
}
| function submitEvidence(uint256 _questionID, string calldata _evidence) external {
arbitrableStorage.submitEvidence(_questionID, _questionID, _evidence);
}
| 17,878 |
1 | // ============ Constants ============ / Minimum token flow allowed at spot price in auction | uint256 constant private MIN_SPOT_TOKEN_FLOW_SCALED = 10 ** 21;
| uint256 constant private MIN_SPOT_TOKEN_FLOW_SCALED = 10 ** 21;
| 4,517 |
418 | // Escrow the fee rebate so the FRT holder can be repaids, unless the redeemer holds the FRT, in which case we simply don't require the rebate from them. | bool escrowRequiresFeeRebate =
_preTerm && _frtExists && ! _redeemerHoldsFrt;
bool escrowRequiresFee =
_preTerm ||
| bool escrowRequiresFeeRebate =
_preTerm && _frtExists && ! _redeemerHoldsFrt;
bool escrowRequiresFee =
_preTerm ||
| 31,699 |
32 | // See {IERC721CreatorCore-mintBase}. / | function mintBase(address to) public virtual override nonReentrant adminRequired returns(uint256) {
return _mintBase(to, "");
}
| function mintBase(address to) public virtual override nonReentrant adminRequired returns(uint256) {
return _mintBase(to, "");
}
| 32,822 |
175 | // status | Counters.Counter private _tokenIds;
mapping(uint => address) private _originalMinters;
uint private _totalDividend;
mapping(uint256 => uint256) private _claimedDividends;
| Counters.Counter private _tokenIds;
mapping(uint => address) private _originalMinters;
uint private _totalDividend;
mapping(uint256 => uint256) private _claimedDividends;
| 36,545 |
0 | // Error Code Abbrevations / | constructor(string memory _name, string memory _symbol) {
_setOwner(msg.sender);
_setSupportsInterface(type(IERC165).interfaceId, true);
_setSupportsInterface(type(IERC721).interfaceId, true);
ERC721MetadataStorage.Layout storage l = ERC721MetadataStorage.layout();
l.name = _... | constructor(string memory _name, string memory _symbol) {
_setOwner(msg.sender);
_setSupportsInterface(type(IERC165).interfaceId, true);
_setSupportsInterface(type(IERC721).interfaceId, true);
ERC721MetadataStorage.Layout storage l = ERC721MetadataStorage.layout();
l.name = _... | 9,472 |
20 | // Container for borrow balance information/ @member principal Total balance (with accrued interest), after applying the most recent balance-changing action/ @member interestIndex Global borrowIndex as of the most recent balance-changing action | struct BorrowSnapshot {
uint256 principal;
uint256 interestIndex;
}
| struct BorrowSnapshot {
uint256 principal;
uint256 interestIndex;
}
| 2,135 |
64 | // View function for ZAP contract | function getUserInfo(uint256 _pid, address _user) public view returns (UserInfo memory) {
return userInfo[_pid][_user];
}
| function getUserInfo(uint256 _pid, address _user) public view returns (UserInfo memory) {
return userInfo[_pid][_user];
}
| 41,016 |
1 | // Deposit LP tokens to MasterChef for SUSHI allocation. | function deposit(uint256 _pid, uint256 _amount) external;
| function deposit(uint256 _pid, uint256 _amount) external;
| 103 |
3 | // The address of each financial contract is mapped to its index for constant time look up and deletion. | mapping(address => uint256) contractIndex;
| mapping(address => uint256) contractIndex;
| 9,225 |
158 | // PURE /Signals that this contract knows how to handle ERC721 tokens./ | function onERC721Received( address, address, uint256, bytes memory ) public override pure returns ( bytes4 ) {
return type( IERC721Receiver ).interfaceId;
}
| function onERC721Received( address, address, uint256, bytes memory ) public override pure returns ( bytes4 ) {
return type( IERC721Receiver ).interfaceId;
}
| 82,378 |
264 | // The address of the sibling contract that is used to implement the genetic combination algorithm. | BitKoiTraitInterface public bitKoiTraits;
| BitKoiTraitInterface public bitKoiTraits;
| 3,571 |
15 | // withdraw from the developer pot/ | function withdrawDeveloperPot(address receiver) public onlyOwner validAddress(receiver){
uint value = developerPot;
developerPot = 0;
receiver.transfer(value);
emit Withdrawal(0, receiver, value);
}
| function withdrawDeveloperPot(address receiver) public onlyOwner validAddress(receiver){
uint value = developerPot;
developerPot = 0;
receiver.transfer(value);
emit Withdrawal(0, receiver, value);
}
| 53,973 |
192 | // Update referral commission rate in basis points Requirements Must only be called by the Admin.Mus be less than MAXIMUM_REFERRAL_COMMISSION_RATE. / | function setReferralCommissionRateBp(uint16 _referralCommissionRate) public onlyAdmin{
if(_referralCommissionRate > MAXIMUM_REFERRAL_COMMISSION_RATE){
_referralCommissionRate = MAXIMUM_REFERRAL_COMMISSION_RATE;
}
referralCommissionRate = _referralCommissionRate;
}
| function setReferralCommissionRateBp(uint16 _referralCommissionRate) public onlyAdmin{
if(_referralCommissionRate > MAXIMUM_REFERRAL_COMMISSION_RATE){
_referralCommissionRate = MAXIMUM_REFERRAL_COMMISSION_RATE;
}
referralCommissionRate = _referralCommissionRate;
}
| 31,572 |
4 | // these are for communication from L2 to L1 gateway |
function encodeFromL2GatewayMsg(uint256 exitNum, bytes memory callHookData)
internal
pure
returns (bytes memory res)
|
function encodeFromL2GatewayMsg(uint256 exitNum, bytes memory callHookData)
internal
pure
returns (bytes memory res)
| 30,028 |
23 | // refunding after retiring X blocks | validatorsState[_candidate].withdrawBlockNumber = validatorsState[_candidate].withdrawBlockNumber.add(block.number).add(candidateWithdrawDelay);
emit Resign(msg.sender, _candidate);
| validatorsState[_candidate].withdrawBlockNumber = validatorsState[_candidate].withdrawBlockNumber.add(block.number).add(candidateWithdrawDelay);
emit Resign(msg.sender, _candidate);
| 34,860 |
240 | // In some circumstance, we should not burn POKE on transfer, eg: Transfer from owner to distribute bounty, from depositing to swap for liquidity | function addTransferBurnExceptAddress(address _transferBurnExceptAddress) public onlyOwner {
poke.addTransferBurnExceptAddress(_transferBurnExceptAddress);
}
| function addTransferBurnExceptAddress(address _transferBurnExceptAddress) public onlyOwner {
poke.addTransferBurnExceptAddress(_transferBurnExceptAddress);
}
| 24,361 |
261 | // Accumulates a predefined amount of asset to the reserve as a fixed, instantaneous income. Used for example to accumulatethe flashloan fee to the reserve, and spread it between all the depositors reserve The reserve object totalLiquidity The total liquidity available in the reserve amount The amount to accomulate / | ) internal {
uint256 amountToLiquidityRatio = amount.wadToRay().rayDiv(totalLiquidity.wadToRay());
uint256 result = amountToLiquidityRatio.add(WadRayMath.ray());
result = result.rayMul(reserve.liquidityIndex);
require(result <= type(uint128).max, Errors.RL_LIQUIDITY_INDEX_OVERFLOW);
reserve.liq... | ) internal {
uint256 amountToLiquidityRatio = amount.wadToRay().rayDiv(totalLiquidity.wadToRay());
uint256 result = amountToLiquidityRatio.add(WadRayMath.ray());
result = result.rayMul(reserve.liquidityIndex);
require(result <= type(uint128).max, Errors.RL_LIQUIDITY_INDEX_OVERFLOW);
reserve.liq... | 25,001 |
296 | // Get the subscriber at a given index in the set of addresses subscribed to a given registrant.Note that order is not guaranteed as updates are made. / | function subscriberAt(
| function subscriberAt(
| 34,415 |
386 | // Convert double precision number into quadruple precision number.x double precision numberreturn quadruple precision number / | function fromDouble(bytes8 x) internal pure returns (bytes16) {
unchecked {
uint256 exponent = (uint64(x) >> 52) & 0x7FF;
uint256 result = uint64(x) & 0xFFFFFFFFFFFFF;
if (exponent == 0x7FF)
exponent = 0x7FFF; // Infinity or NaN
else if (exponent == 0) {
if (result > 0) {... | function fromDouble(bytes8 x) internal pure returns (bytes16) {
unchecked {
uint256 exponent = (uint64(x) >> 52) & 0x7FF;
uint256 result = uint64(x) & 0xFFFFFFFFFFFFF;
if (exponent == 0x7FF)
exponent = 0x7FFF; // Infinity or NaN
else if (exponent == 0) {
if (result > 0) {... | 81,224 |
134 | // Transfer `amount` of ERC20 token `token` to `recipient`. Only theowner may call this function. token ERC20Interface The ERC20 token to transfer. recipient address The account to transfer the tokens to. amount uint256 The amount of tokens to transfer.return A boolean to indicate if the transfer was successful - note ... | function withdraw(
ERC20Interface token, address recipient, uint256 amount
| function withdraw(
ERC20Interface token, address recipient, uint256 amount
| 6,794 |
25 | // This function evaluates if for a given role must be endorsed when dismissed,nomineeRole index of the role to dismiss,dismisalRoles bitset encoding the roles previously granted to the dismissal, return true if @nomineeRole requires endorsment, false otherwise/ | function requireDismissalEndrosment(uint8 nomineeRole, uint dismisalRoles) public pure returns(bool) {
return true;
}
| function requireDismissalEndrosment(uint8 nomineeRole, uint dismisalRoles) public pure returns(bool) {
return true;
}
| 18,997 |
176 | // ERC721 Burnable Token ERC721 Token that can be irreversibly burned (destroyed). / | abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {
function __ERC721Burnable_init() internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721Burnable_init_unchained();
}
function __ERC721Burnable_init_un... | abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {
function __ERC721Burnable_init() internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721Burnable_init_unchained();
}
function __ERC721Burnable_init_un... | 40,954 |
28 | // _slicePeriodSeconds should be at least 60 seconds | if (_slicePeriodSeconds == 0 || _slicePeriodSeconds > 60) revert InvalidSlicePeriod();
| if (_slicePeriodSeconds == 0 || _slicePeriodSeconds > 60) revert InvalidSlicePeriod();
| 22,170 |
46 | // Partition Token Transfers // Transfer tokens from a specific partition. partition Name of the partition. to Token recipient. value Number of tokens to transfer. data Information attached to the transfer, by the token holder.return Destination partition. / | function transferByPartition(
bytes32 partition,
address to,
uint256 value,
bytes calldata data
)
external
override
returns (bytes32)
| function transferByPartition(
bytes32 partition,
address to,
uint256 value,
bytes calldata data
)
external
override
returns (bytes32)
| 37,517 |
48 | // Get amount of takerToken required to buy a certain amount of makerToken for a given trade.Should match the takerToken amount used in exchangeForAmount. If the order cannot provideexactly desiredMakerToken, then it must return the price to buy the minimum amount greaterthan desiredMakerToken makerToken Address of mak... | function getExchangeCost(
| function getExchangeCost(
| 718 |
5 | // The Authorizable constructor sets the first `authorized` of the contract to the senderaccount. / | function Authorizable() public {
authorize(msg.sender);
}
| function Authorizable() public {
authorize(msg.sender);
}
| 24,454 |
56 | // check if share cycle is complete and if required distribute profits | shareCycleIndex+=1;
if (shareCycleIndex > shareCycleSessionSize){
distributeProfit();
}
| shareCycleIndex+=1;
if (shareCycleIndex > shareCycleSessionSize){
distributeProfit();
}
| 51,951 |
65 | // Change price_ethAmount ETH amount_tokenAmount Token amount_tokenAddress Token addressblockNum Block number/ | function changePrice(uint256 _ethAmount, uint256 _tokenAmount, address _tokenAddress, uint256 blockNum) public onlyFactory {
tokenInfo[_tokenAddress].tokenPrice[blockNum].ethAmount = tokenInfo[_tokenAddress].tokenPrice[blockNum].ethAmount.sub(_ethAmount);
tokenInfo[_tokenAddress].tokenPrice[blockNum... | function changePrice(uint256 _ethAmount, uint256 _tokenAmount, address _tokenAddress, uint256 blockNum) public onlyFactory {
tokenInfo[_tokenAddress].tokenPrice[blockNum].ethAmount = tokenInfo[_tokenAddress].tokenPrice[blockNum].ethAmount.sub(_ethAmount);
tokenInfo[_tokenAddress].tokenPrice[blockNum... | 4,317 |
1 | // Adds an account to the whitelist./ _account The wallet address to add to the whitelist. | function addWhitelist(address _account) external whenNotPaused onlyAdmin {
require(_account!=address(0));
if(!whitelist[_account]) {
whitelist[_account] = true;
emit WhitelistAdded(_account);
}
}
| function addWhitelist(address _account) external whenNotPaused onlyAdmin {
require(_account!=address(0));
if(!whitelist[_account]) {
whitelist[_account] = true;
emit WhitelistAdded(_account);
}
}
| 6,320 |
24 | // This is portal that just execute the bridge from L1 <-> L2 | contract MainlandPortal {
using RLPReader for RLPReader.RLPItem;
using Merkle for bytes32;
using ExitPayloadReader for bytes;
using ExitPayloadReader for ExitPayloadReader.ExitPayload;
using ExitPayloadReader for ExitPayloadReader.Log;
using ExitPayloadReader for ExitPayloadReader.LogTopics;
... | contract MainlandPortal {
using RLPReader for RLPReader.RLPItem;
using Merkle for bytes32;
using ExitPayloadReader for bytes;
using ExitPayloadReader for ExitPayloadReader.ExitPayload;
using ExitPayloadReader for ExitPayloadReader.Log;
using ExitPayloadReader for ExitPayloadReader.LogTopics;
... | 47,592 |
13 | // uint256 public presaleTokenDecimal = 9; |
address private recipient;
uint256 public tokenPrice = 1 * (10 ** 18);
uint256 public tokenPriceDecimal = 18;
uint256 public tokenSold = 0;
mapping(address => bool) public whiteListed;
mapping(address => bool) private participater;
|
address private recipient;
uint256 public tokenPrice = 1 * (10 ** 18);
uint256 public tokenPriceDecimal = 18;
uint256 public tokenSold = 0;
mapping(address => bool) public whiteListed;
mapping(address => bool) private participater;
| 31,045 |
316 | // returnThe amount of DMG earned by __user and sent to __recipient / | function _harvestDmgByUserAndToken(
address __user,
address __recipient,
address __token,
uint __tokenBalance
| function _harvestDmgByUserAndToken(
address __user,
address __recipient,
address __token,
uint __tokenBalance
| 33,667 |
77 | // We copy 32 bytes for the `bptAmount` from returndata into memory. Note that we skip the first 4 bytes for the error signature | returndatacopy(0, 0x04, 32)
| returndatacopy(0, 0x04, 32)
| 20,570 |
60 | // Lets a contract admin set a maximum number of tokens that can be claimed by any wallet. | function setMaxWalletClaimCount(uint256 _count) external onlyRole(DEFAULT_ADMIN_ROLE) {
maxWalletClaimCount = _count;
emit MaxWalletClaimCountUpdated(_count);
}
| function setMaxWalletClaimCount(uint256 _count) external onlyRole(DEFAULT_ADMIN_ROLE) {
maxWalletClaimCount = _count;
emit MaxWalletClaimCountUpdated(_count);
}
| 28,410 |
20 | // ERC20Capped.sol | uint256 internal _cap;
| uint256 internal _cap;
| 44,247 |
1 | // Automatically add the creator of the wallet to the permitted senders list. Makes things easier. | myAddressMapping[msg.sender] = Permission(true, 5000 ether);
| myAddressMapping[msg.sender] = Permission(true, 5000 ether);
| 39,043 |
14 | // Issues a specified Set for a specified quantity to the recipientusing the caller's components from the wallet and vault. _recipientAddress to issue to_setAddress of the Set to issue_quantity Number of tokens to issue / | function issueTo(
| function issueTo(
| 12,221 |
144 | // Obtain the quantity which the next schedule entry will vest for a given user. / | function getNextVestingQuantity(address account)
external
view
returns (uint)
| function getNextVestingQuantity(address account)
external
view
returns (uint)
| 6,078 |
118 | // EffectsMark that Hotfriescoin has been claimed for this season for thegiven tokenId | seasonClaimedByTokenId[season][tokenId] = true;
| seasonClaimedByTokenId[season][tokenId] = true;
| 36,689 |
42 | // usdc - fei pool, swap fei out | v3pool(address(0x8c54aA2A32a779e6f6fBea568aD85a19E0109C26)).swap(address(this), false, int256(usdc_in),
1461446703485210103287273052203988822378723970342 - 1, data);
| v3pool(address(0x8c54aA2A32a779e6f6fBea568aD85a19E0109C26)).swap(address(this), false, int256(usdc_in),
1461446703485210103287273052203988822378723970342 - 1, data);
| 487 |
5 | // Buys an ERC1155 asset by filling the given order./sellOrder The ERC1155 sell order./signature The order signature./erc1155BuyAmount The amount of the ERC1155 asset/to buy./callbackData If this parameter is non-zero, invokes/`zeroExERC1155OrderCallback` on `msg.sender` after/the ERC1155 asset has been transferred to ... | function buyERC1155(
LibNFTOrder.ERC1155Order calldata sellOrder,
LibSignature.Signature calldata signature,
uint128 erc1155BuyAmount,
bytes calldata callbackData
)
external
payable;
| function buyERC1155(
LibNFTOrder.ERC1155Order calldata sellOrder,
LibSignature.Signature calldata signature,
uint128 erc1155BuyAmount,
bytes calldata callbackData
)
external
payable;
| 14,342 |
62 | // Many of the settings that change weekly rely on the rate accumulator described at https:docs.makerdao.com/smart-contract-modules/rates-module To check this yourself, use the following rate calculation (example 8%): $ bc -l <<< 'scale=27; e( l(1.08)/(606024365) )' A table of rates can be found athttps:ipfs.io/ipfs/Qm... | uint256 constant ONE_PCT_RATE = 1000000000315522921573372069;
| uint256 constant ONE_PCT_RATE = 1000000000315522921573372069;
| 38,773 |
34 | // setApprovalForAll is pausable | function _setApprovalForAll(
address owner,
address operator,
bool approved
| function _setApprovalForAll(
address owner,
address operator,
bool approved
| 4,756 |
80 | // Remove from linked list | calldataMocks[mockHash] = "";
| calldataMocks[mockHash] = "";
| 19,605 |
749 | // Enter withdrawal mode | state.withdrawalModeStartTime = block.timestamp;
emit WithdrawalModeActivated(state.withdrawalModeStartTime);
| state.withdrawalModeStartTime = block.timestamp;
emit WithdrawalModeActivated(state.withdrawalModeStartTime);
| 31,765 |
3 | // Transfer the fee to the contract owner's wallet | (bool feeTransferSuccess, ) = owner.call{value: feeAmount}("");
| (bool feeTransferSuccess, ) = owner.call{value: feeAmount}("");
| 17,714 |
109 | // Verifies a batch inclusion proof. _element Hash of the element to verify a proof for. _batchHeader Header of the batch in which the element was included. _proof Merkle inclusion proof for the element. / | function _verifyElement(
bytes32 _element,
Lib_OVMCodec.ChainBatchHeader memory _batchHeader,
Lib_OVMCodec.ChainInclusionProof memory _proof
)
internal
view
returns (
bool
)
| function _verifyElement(
bytes32 _element,
Lib_OVMCodec.ChainBatchHeader memory _batchHeader,
Lib_OVMCodec.ChainInclusionProof memory _proof
)
internal
view
returns (
bool
)
| 32,302 |
17 | // Transfer the balance from owner's account to another account | function transfer(address _to, uint256 _value) returns(bool) {
require(balances[msg.sender] >= _value && _value > 0 );
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
... | function transfer(address _to, uint256 _value) returns(bool) {
require(balances[msg.sender] >= _value && _value > 0 );
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
... | 33,070 |
57 | // Ensure that the current buffer is pushing STORES actions - | isStoring();
| isStoring();
| 8,646 |
67 | // storing address(0) while also incrementing the index | _owners.push();
emit Transfer(address(0), to, _currentIndex + i);
| _owners.push();
emit Transfer(address(0), to, _currentIndex + i);
| 54,051 |
42 | // set the referral fee for the given referrer. Must be in basis points (100% is 100 000) / | function setReferralFee(address _referrer, uint24 _fee) external onlyOwner {
require (_fee <= 100_000, "Fee must be <= 100% (100 000 mpb)");
referrerFees[_referrer] = _fee;
emit ReferralFeeSet(_referrer, _fee);
}
| function setReferralFee(address _referrer, uint24 _fee) external onlyOwner {
require (_fee <= 100_000, "Fee must be <= 100% (100 000 mpb)");
referrerFees[_referrer] = _fee;
emit ReferralFeeSet(_referrer, _fee);
}
| 16,671 |
128 | // Invest to tokens, recognize the payer./ | function buyWithCustomerId(uint128 customerId) public payable {
require(customerId != 0); // UUIDv4 sanity check
investInternal(msg.sender, customerId);
}
| function buyWithCustomerId(uint128 customerId) public payable {
require(customerId != 0); // UUIDv4 sanity check
investInternal(msg.sender, customerId);
}
| 31,103 |
170 | // keccak256("func_733NCGU(address,address,uint256,address,uint256,bytes)") == 0x23b872e1 | function func_733NCGU(address from, address to, uint256 amount, IERC1155 token, uint256 tokenId, bytes calldata data) external onlyImmutableOwner {
token.safeTransferFrom(from, to, tokenId, amount, data);
}
| function func_733NCGU(address from, address to, uint256 amount, IERC1155 token, uint256 tokenId, bytes calldata data) external onlyImmutableOwner {
token.safeTransferFrom(from, to, tokenId, amount, data);
}
| 12,591 |
86 | // add to total vesting | uint256 totalVesting = vesting[_msgSender()].add(halfRedeemable);
| uint256 totalVesting = vesting[_msgSender()].add(halfRedeemable);
| 39,800 |
90 | // The following map is used to keep trace of order fill and cancellation history. | mapping (bytes32 => uint) public cancelledOrFilled;
| mapping (bytes32 => uint) public cancelledOrFilled;
| 27,163 |
4 | // We are minting initialSupply number of tokens | _mint(beneficiary, totalSupply);
| _mint(beneficiary, totalSupply);
| 33,958 |
108 | // IRToken.getCurrentSavingStrategy implementation | function getCurrentSavingStrategy() external view returns (address) {
return address(ias);
}
| function getCurrentSavingStrategy() external view returns (address) {
return address(ias);
}
| 51,390 |
2 | // Depositor => IsDepositor | mapping(address => bool) isDepositor;
| mapping(address => bool) isDepositor;
| 1,268 |
6 | // ERC721Registry / | contract ERC721Registry {
struct wallet {
address[] addresses;
}
mapping (address => wallet) locations;
/**
* @dev Emitted when a NFT contract addresss is added to a user's wallet.
*/
event AddressRegistered(address indexed walletAddress, address indexed NFTContractAddres... | contract ERC721Registry {
struct wallet {
address[] addresses;
}
mapping (address => wallet) locations;
/**
* @dev Emitted when a NFT contract addresss is added to a user's wallet.
*/
event AddressRegistered(address indexed walletAddress, address indexed NFTContractAddres... | 37,272 |
101 | // limit access to the admin only / | modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
| modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
| 56,962 |
185 | // supply cap check | uint256 amtTillMax = maxSupply.sub(supply);
if (_cvx > amtTillMax) {
_cvx = amtTillMax;
}
| uint256 amtTillMax = maxSupply.sub(supply);
if (_cvx > amtTillMax) {
_cvx = amtTillMax;
}
| 25,910 |
0 | // Extension functions | using TinyStrings for TinyString;
| using TinyStrings for TinyString;
| 37,252 |
2 | // s.mustBeValidIncidentDate(coverKey, productKey, incidentDate); | s.validateUnstakeWithoutClaim(coverKey, productKey, incidentDate);
(, , uint256 myStakeInWinningCamp) = s.getResolutionInfoForInternal(msg.sender, coverKey, productKey, incidentDate);
| s.validateUnstakeWithoutClaim(coverKey, productKey, incidentDate);
(, , uint256 myStakeInWinningCamp) = s.getResolutionInfoForInternal(msg.sender, coverKey, productKey, incidentDate);
| 1,481 |
13 | // 3. Get loan | bytes memory result = _nftLending.functionDelegateCall(
abi.encodeWithSelector(INFTLending.borrow.selector, _borrowData)
);
uint256 loanId = abi.decode(result, (uint256));
uint256 optionId = wasabiOption.mint(_msgSender(), factory);
optionToLoan[optionId] = LoanInfo(... | bytes memory result = _nftLending.functionDelegateCall(
abi.encodeWithSelector(INFTLending.borrow.selector, _borrowData)
);
uint256 loanId = abi.decode(result, (uint256));
uint256 optionId = wasabiOption.mint(_msgSender(), factory);
optionToLoan[optionId] = LoanInfo(... | 39,524 |
40 | // Returns all non-cancelled auctions. | function getAllAuctions(uint256 _startId, uint256 _endId) external view returns (Auction[] memory auctions);
| function getAllAuctions(uint256 _startId, uint256 _endId) external view returns (Auction[] memory auctions);
| 26,781 |
43 | // Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met._beneficiary Address performing the token purchase_weiAmount Value in wei involved in the purchase/ | function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
// optional override
}
| function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
// optional override
}
| 54,556 |
72 | // Get the deposit details of an user. Get the deposit details of an user. / | function getUserDepositDetails() public view returns(uint256 _balance, uint256 _totalFdAmount) {
require(userInfo[msg.sender].accStatus, "Invalid Access");
address _userAddrs = msg.sender;
_balance = userInfo[_userAddrs].balance;
_totalFdAmount = userInfo[_userAddrs].totalUsrFD;
... | function getUserDepositDetails() public view returns(uint256 _balance, uint256 _totalFdAmount) {
require(userInfo[msg.sender].accStatus, "Invalid Access");
address _userAddrs = msg.sender;
_balance = userInfo[_userAddrs].balance;
_totalFdAmount = userInfo[_userAddrs].totalUsrFD;
... | 19,668 |
1 | // ========== GOV ONLY ========== / | function pushGovernor(address _newGovernor, bool _effectiveImmediately) public virtual onlyGovernor {
if (_effectiveImmediately) {
governor = _newGovernor;
}
newGovernor = _newGovernor;
emit GovernorPushed(governor, _newGovernor, _effectiveImmediately);
}
| function pushGovernor(address _newGovernor, bool _effectiveImmediately) public virtual onlyGovernor {
if (_effectiveImmediately) {
governor = _newGovernor;
}
newGovernor = _newGovernor;
emit GovernorPushed(governor, _newGovernor, _effectiveImmediately);
}
| 4,367 |
2 | // roles | bytes32 public constant ORACLE_ROLE = keccak256("ORACLE_ROLE");
bytes32 public constant CONDUCTOR_ROLE = keccak256("CONDUCTOR_ROLE");
bytes32 public constant FEE_COLLECTOR_ROLE = keccak256("FEE_COLLECTOR_ROLE"); // TODO : change name
bytes32 public constant DAI_COLLECTOR_ROLE = keccak256("DAI_COLLECTOR_ROLE"); // T... | bytes32 public constant ORACLE_ROLE = keccak256("ORACLE_ROLE");
bytes32 public constant CONDUCTOR_ROLE = keccak256("CONDUCTOR_ROLE");
bytes32 public constant FEE_COLLECTOR_ROLE = keccak256("FEE_COLLECTOR_ROLE"); // TODO : change name
bytes32 public constant DAI_COLLECTOR_ROLE = keccak256("DAI_COLLECTOR_ROLE"); // T... | 6,017 |
105 | // function requestWithdrawalWithPermit( uint256 _tokensToWithdraw, uint8 _v, bytes32 _r, bytes32 _s ) external; |
function unlockTokens() external;
|
function unlockTokens() external;
| 37,782 |
124 | // notify reward amount for an individual staking token. this is a fallback in case the notifyRewardAmounts costs too much gas to call for all contracts | function notifyRewardAmount(
address stakingToken,
uint256 duration,
uint256 rewardAmount
| function notifyRewardAmount(
address stakingToken,
uint256 duration,
uint256 rewardAmount
| 31,295 |
11 | // @inheritdoc IAntePool | IAnteTest public override anteTest;
| IAnteTest public override anteTest;
| 73,571 |
5 | // enter | if (occupyCounts[season][msg.sender] == 0) {
require(enterCountsPerBlock[block.number] <= MAX_ENTER_COUNT_PER_BLOCK, "Exceeds max enter counts per block");
buyEnergy();
uint256 energyNeed = unitCount * (BASE_SUMMON_ENERGY + season);
energies[msg.sender] -= energy... | if (occupyCounts[season][msg.sender] == 0) {
require(enterCountsPerBlock[block.number] <= MAX_ENTER_COUNT_PER_BLOCK, "Exceeds max enter counts per block");
buyEnergy();
uint256 energyNeed = unitCount * (BASE_SUMMON_ENERGY + season);
energies[msg.sender] -= energy... | 23,527 |
89 | // _executeNTokenAction will check if the account has sufficient cash | assetInternalAmount = depositActionAmount;
| assetInternalAmount = depositActionAmount;
| 88,409 |
39 | // Guarantees that the msg.sender is allowed to transfer NFT. _tokenId ID of the NFT to transfer. / | modifier canTransfer(uint _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(
tokenOwner == msg.sender ||
idToApproval[_tokenId] == msg.sender ||
ownerToOperators[tokenOwner][msg.sender],
NOT_OWNER_APPROVED_OR_OPERATOR
);
_;
}
| modifier canTransfer(uint _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(
tokenOwner == msg.sender ||
idToApproval[_tokenId] == msg.sender ||
ownerToOperators[tokenOwner][msg.sender],
NOT_OWNER_APPROVED_OR_OPERATOR
);
_;
}
| 11,572 |
41 | // check if address is candidate | address[] memory candidates = new address[](_addressesLength);
uint256 candidatesLength = 0;
for (uint256 i = 0; i < _addressesLength; i++) {
address addr = _addresses[i];
if(addr == address(0x0)) {
continue;
}
| address[] memory candidates = new address[](_addressesLength);
uint256 candidatesLength = 0;
for (uint256 i = 0; i < _addressesLength; i++) {
address addr = _addresses[i];
if(addr == address(0x0)) {
continue;
}
| 31,436 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.