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 |
|---|---|---|---|---|
5 | // Function reverts if the token contract cannot burn the specified amount for the given address. | modifier burnTokens(uint256 amount) {
_;
microFunderToken.burn(msg.sender, amount);
}
| modifier burnTokens(uint256 amount) {
_;
microFunderToken.burn(msg.sender, amount);
}
| 20,003 |
36 | // Reference to contract tracking NFT ownership | ToonInterface[] public toonContracts;
mapping(address => uint256) addressToIndex;
| ToonInterface[] public toonContracts;
mapping(address => uint256) addressToIndex;
| 30,527 |
444 | // Claim asset, transfer the given amount assets to receiver | function claim(address receiver, uint amount) external returns (uint);
| function claim(address receiver, uint amount) external returns (uint);
| 31,012 |
13 | // return star info | function tokenIdToStarInfo(uint256 _tokenId) public view returns (string, string, string, string, string) {
return (
tokenIdToStarInfo[_tokenId].name,
tokenIdToStarInfo[_tokenId].story,
tokenIdToStarInfo[_tokenId].coordinates.ra,
tokenIdToStarInfo[_tokenId].coordinates.dec,
... | function tokenIdToStarInfo(uint256 _tokenId) public view returns (string, string, string, string, string) {
return (
tokenIdToStarInfo[_tokenId].name,
tokenIdToStarInfo[_tokenId].story,
tokenIdToStarInfo[_tokenId].coordinates.ra,
tokenIdToStarInfo[_tokenId].coordinates.dec,
... | 8,780 |
96 | // See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to... | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to... | 23,163 |
96 | // Indicates that the contract is in the process of being initialized. / | bool private initializing;
| bool private initializing;
| 10,818 |
18 | // int256 snapshotUsdAmount = ask.amount; uint256 currentUsd = strategy.getUnderlying(IERC20(ask.lpAddress), ask.lpAmount) ; uint256 marginAmount = bid.marginAmount; |
uint256 minLiquidationAmount = ask.amount.mul(PRECISION).mul(liquidationLine + PRECISION).div(PRECISION);
require(minLiquidationAmount >= bid.marginAmount.mul(PRECISION).add(
strategy.getUnderlying(IERC20(ask.lpAddress), ask.lpAmount).mul(PRECISION))
);
uint256 inAmount;
... |
uint256 minLiquidationAmount = ask.amount.mul(PRECISION).mul(liquidationLine + PRECISION).div(PRECISION);
require(minLiquidationAmount >= bid.marginAmount.mul(PRECISION).add(
strategy.getUnderlying(IERC20(ask.lpAddress), ask.lpAmount).mul(PRECISION))
);
uint256 inAmount;
... | 31,807 |
324 | // ((avgPriceoldBalance) + (senderAvgPricenewQty)) / totBalance | userAvgPrices[usr] = userAvgPrices[usr].mul(usrBal.sub(qty)).add(price.mul(qty)).div(usrBal);
| userAvgPrices[usr] = userAvgPrices[usr].mul(usrBal.sub(qty)).add(price.mul(qty)).div(usrBal);
| 22,575 |
51 | // Mapping from owner address to mapping of operator addresses. / | mapping (address => mapping (address => bool)) internal ownerToOperators;
| mapping (address => mapping (address => bool)) internal ownerToOperators;
| 40,535 |
48 | // create uniswap pair | uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
| uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_setAutomatedMarketMakerPair(address(uniswapV2Pair), true);
| 11,178 |
6 | // Send `_valueWei` of our ether to `_toAddress`, including `_extraGasIncluded` gas above the usual 2300 gas stipend with the send call. This needs care because there is no way to tell if _toAddress is externally owned or is another contract - and sending ether to a contract address will invoke its fallback function; t... | function carefulSendWithFixedGas(
address _toAddress,
uint _valueWei,
uint _extraGasIncluded
| function carefulSendWithFixedGas(
address _toAddress,
uint _valueWei,
uint _extraGasIncluded
| 42,328 |
600 | // thrown when amount of shares received is above the max set by caller | error MaxSharesError();
| error MaxSharesError();
| 30,502 |
305 | // Most things are main sequence | return ObjectClass.MainSequence;
| return ObjectClass.MainSequence;
| 21,530 |
0 | // Token Params | string public name;
string public symbol;
| string public name;
string public symbol;
| 45,696 |
20 | // Adjust total accounting supply accordingly - Subtracting on withdraws | if (_isWithdraw) {
uint256 diffBalancesAccounting = prevBalancesAccounting.sub(newBalancesAccounting);
_balancesAccounting[self] = _balancesAccounting[self].sub(diffBalancesAccounting);
_totalSupplyAccounting = _totalSupplyAccounting.sub(diffBalancesAccounting... | if (_isWithdraw) {
uint256 diffBalancesAccounting = prevBalancesAccounting.sub(newBalancesAccounting);
_balancesAccounting[self] = _balancesAccounting[self].sub(diffBalancesAccounting);
_totalSupplyAccounting = _totalSupplyAccounting.sub(diffBalancesAccounting... | 41,976 |
284 | // What is the percentage of the withdrawn debt (as a high precision int) of the total debt after? | uint debtPercentage = debtToRemove.divideDecimalRoundPrecise(newTotalDebtIssued);
| uint debtPercentage = debtToRemove.divideDecimalRoundPrecise(newTotalDebtIssued);
| 30,177 |
211 | // Allows owner to set Max mints per tx _newMaxMint maximum amount of tokens allowed to mint per tx. Must be >= 1 / | function setMaxMint(uint256 _newMaxMint) public onlyTeamOrOwner {
require(_newMaxMint >= 1, "Max mint must be at least 1");
maxBatchSize = _newMaxMint;
}
| function setMaxMint(uint256 _newMaxMint) public onlyTeamOrOwner {
require(_newMaxMint >= 1, "Max mint must be at least 1");
maxBatchSize = _newMaxMint;
}
| 4,682 |
194 | // Returns the total quantity for a token ID _id uint256 ID of the token to queryreturn amount of token in existence / | function totalSupply(uint256 _id) public view virtual returns (uint256) {
return tokenSupply[_id];
}
| function totalSupply(uint256 _id) public view virtual returns (uint256) {
return tokenSupply[_id];
}
| 45,716 |
92 | // Ensure that a non-zero recipient has been supplied. | if (recipient == address(0)) {
revert(_REVERTREASON31(1));
}
| if (recipient == address(0)) {
revert(_REVERTREASON31(1));
}
| 27,269 |
8 | // subtract the amount allowed to the sender | allowed[_from][msg.sender] = _allowance.safeSub(_value);
| allowed[_from][msg.sender] = _allowance.safeSub(_value);
| 1,309 |
53 | // Add a verified address to the Security Token whitelistThe Issuer can add an address to the whitelist by themselves bycreating their own KYC provider and using it to verify the accountsthey want to add to the whitelist. _whitelistAddress Address attempting to join ST whitelistreturn bool success / | function addToWhitelist(address _whitelistAddress) onlyOwner public returns (bool success) {
shareholders[_whitelistAddress].allowed = true;
emit LogNewWhitelistedAddress(_whitelistAddress);
return true;
}
| function addToWhitelist(address _whitelistAddress) onlyOwner public returns (bool success) {
shareholders[_whitelistAddress].allowed = true;
emit LogNewWhitelistedAddress(_whitelistAddress);
return true;
}
| 34,605 |
36 | // (uint8 TradeActionType, uint8 MarketIndex, uint88 tokenAmount, uint32 minImpliedRate, uint32 maxImpliedRate, uint88 unused) | RemoveLiquidity,
| RemoveLiquidity,
| 40,156 |
51 | // Get raw pointers for source and destination | uint sourcePointer;
uint destinationPointer;
assembly {
sourcePointer := add(add(source, 32), offset)
destinationPointer := add(destination, 32)
}
| uint sourcePointer;
uint destinationPointer;
assembly {
sourcePointer := add(add(source, 32), offset)
destinationPointer := add(destination, 32)
}
| 1,942 |
5 | // use the signature as the seed | res.seed = uint256(keccak256(abi.encodePacked(_r, _s, _v)));
res.fulfilled = true;
emit EpochProcessed(_epoch);
| res.seed = uint256(keccak256(abi.encodePacked(_r, _s, _v)));
res.fulfilled = true;
emit EpochProcessed(_epoch);
| 6,586 |
156 | // ============ External Functions ============ / | receive() external payable {
// required for weth.withdraw() to work properly
require(msg.sender == WETH, "ExchangeIssuance: Direct deposits not allowed");
}
| receive() external payable {
// required for weth.withdraw() to work properly
require(msg.sender == WETH, "ExchangeIssuance: Direct deposits not allowed");
}
| 30,689 |
119 | // Provide a signal to the keeper that `harvest()` should be called. The keeper will provide the estimated gas cost that they would pay to call `harvest()`, and this function should use that estimate to make a determination if calling it is "worth it" for the keeper. This is not the only consideration into issuing this... | function harvestTrigger(uint256 callCost)
public
view
virtual
returns (bool)
| function harvestTrigger(uint256 callCost)
public
view
virtual
returns (bool)
| 28,645 |
142 | // 32 is the length in bytes of hash, enforced by the type signature above | return
keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
);
| return
keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
);
| 9,435 |
0 | // The token being sold | IERC20 private _token;
| IERC20 private _token;
| 1,875 |
14 | // return zero if input amount is zero | if (inputWei.isZero()) {
return Types.AssetAmount({
sign: true,
denomination: Types.AssetDenomination.Par,
ref: Types.AssetReference.Delta,
value: 0
});
| if (inputWei.isZero()) {
return Types.AssetAmount({
sign: true,
denomination: Types.AssetDenomination.Par,
ref: Types.AssetReference.Delta,
value: 0
});
| 30,001 |
10 | // On-chain randomness. | string memory inputForRandomness = string(abi.encodePacked(
keyPrefix,
tokenId, // Note: No need to use toString() here.
seed
));
uint256 rand = random(inputForRandomness);
| string memory inputForRandomness = string(abi.encodePacked(
keyPrefix,
tokenId, // Note: No need to use toString() here.
seed
));
uint256 rand = random(inputForRandomness);
| 14,299 |
162 | // Returns the URI for a given token ID. May return an empty string. | * If a base URI is set (via {_setBaseURI}), it is added as a prefix to the
* token's own URI (via {_setTokenURI}).
*
* If there is a base URI but no token URI, the token's ID will be used as
* its URI when appending it to the base URI. This pattern for autogenerated
* token URIs can lead t... | * If a base URI is set (via {_setBaseURI}), it is added as a prefix to the
* token's own URI (via {_setTokenURI}).
*
* If there is a base URI but no token URI, the token's ID will be used as
* its URI when appending it to the base URI. This pattern for autogenerated
* token URIs can lead t... | 56,544 |
7 | // EVENTS |
event BoxesMinted(address indexed account, uint256 boxesPrice, uint256 amountOfLand, uint256 packId, uint256 noOfPacks, uint256 noOfItems, uint256 noOfMercenaries);
event SetPrice(address indexed sender, uint256 newPrice, bytes indicator);
event SetLandAmount(address indexed sender, uint256 newPrice);
... |
event BoxesMinted(address indexed account, uint256 boxesPrice, uint256 amountOfLand, uint256 packId, uint256 noOfPacks, uint256 noOfItems, uint256 noOfMercenaries);
event SetPrice(address indexed sender, uint256 newPrice, bytes indicator);
event SetLandAmount(address indexed sender, uint256 newPrice);
... | 19,839 |
628 | // ComptrollerCore Storage for the comptroller is at this address, while execution is delegated to the `comptrollerImplementation`.CTokens should reference this contract as their comptroller. / | contract Unitroller is UnitrollerAdminStorage, ComptrollerErrorReporter {
/**
* @notice Emitted when pendingComptrollerImplementation is changed
*/
event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);
/**
* @notice Emitted when pendingComptr... | contract Unitroller is UnitrollerAdminStorage, ComptrollerErrorReporter {
/**
* @notice Emitted when pendingComptrollerImplementation is changed
*/
event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);
/**
* @notice Emitted when pendingComptr... | 7,674 |
653 | // Internal setter for the voting delay. | * Emits a {VotingDelaySet} event.
*/
function _setVotingDelay(uint256 newVotingDelay) internal virtual {
emit VotingDelaySet(_votingDelay, newVotingDelay);
_votingDelay = newVotingDelay;
}
| * Emits a {VotingDelaySet} event.
*/
function _setVotingDelay(uint256 newVotingDelay) internal virtual {
emit VotingDelaySet(_votingDelay, newVotingDelay);
_votingDelay = newVotingDelay;
}
| 28,110 |
61 | // refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties. | struct ReserveData {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current supply rate. Expressed in ray
uint128 curr... | struct ReserveData {
//stores the reserve configuration
ReserveConfigurationMap configuration;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
//variable borrow index. Expressed in ray
uint128 variableBorrowIndex;
//the current supply rate. Expressed in ray
uint128 curr... | 11,868 |
876 | // Retrieve the most recent entry from the debt ledger / | function lastDebtLedgerEntry() external view returns (uint) {
return debtLedger[debtLedger.length - 1];
}
| function lastDebtLedgerEntry() external view returns (uint) {
return debtLedger[debtLedger.length - 1];
}
| 81,444 |
149 | // Transfer underlying balance to a specified address. to The address to transfer to. value The amount to be transferred.return True on success, false otherwise. / | function transferUnderlying(address to, uint256 value)
external
validRecipient(to)
returns (bool)
| function transferUnderlying(address to, uint256 value)
external
validRecipient(to)
returns (bool)
| 70,442 |
2 | // Default is ETH | Currency currency;
ApplicationStatus status;
Details details;
Rewards rewards;
bytes32[] assignedOracleTypes;
mapping(bytes32 => uint256) assignedRewards;
mapping(bytes32 => bool) oracleTypeRewardPaidOut;
mapping(bytes32 => string) oracleTypeMessages;
| Currency currency;
ApplicationStatus status;
Details details;
Rewards rewards;
bytes32[] assignedOracleTypes;
mapping(bytes32 => uint256) assignedRewards;
mapping(bytes32 => bool) oracleTypeRewardPaidOut;
mapping(bytes32 => string) oracleTypeMessages;
| 14,670 |
22 | // staking function | function onERC721Received(address /*operator*/, address from, uint256 tokenId, bytes calldata data) external override returns (bytes4) {
require(!paused(), "Contract paused");
address nftAddress = _bytesToAddress(data);
require(_nftRegistered[nftAddress], "Invalid NFT address");
req... | function onERC721Received(address /*operator*/, address from, uint256 tokenId, bytes calldata data) external override returns (bytes4) {
require(!paused(), "Contract paused");
address nftAddress = _bytesToAddress(data);
require(_nftRegistered[nftAddress], "Invalid NFT address");
req... | 33,280 |
98 | // Do transfer | address _from = tokenOwner;
address _to = msg.sender;
| address _from = tokenOwner;
address _to = msg.sender;
| 15,688 |
20 | // Collateral Management | IFujiERC1155(fujiERC1155).mint(msg.sender, vAssets.collateralID, _collateralAmount, "");
emit Deposit(msg.sender, vAssets.collateralAsset, _collateralAmount);
| IFujiERC1155(fujiERC1155).mint(msg.sender, vAssets.collateralID, _collateralAmount, "");
emit Deposit(msg.sender, vAssets.collateralAsset, _collateralAmount);
| 39,482 |
19 | // the reason for this flow is to protect owners from sending ownership to unintended address due to human error | function acceptOwnership() public
| function acceptOwnership() public
| 32,490 |
420 | // set contract royalties;/This can only be set once, because we are of the idea that royalties/Amounts should never change after they have been set/Once default values are set, it will be used for all royalties inquiries/recipient the default royalties recipient/value the default royalties value | function _setDefaultRoyalties(address recipient, uint256 value) internal {
require(
_useContractRoyalties == false,
'!ERC2981Royalties:DEFAULT_ALREADY_SET!'
);
require(value <= 10000, '!ERC2981Royalties:TOO_HIGH!');
_useContractRoyalties = true;
_contr... | function _setDefaultRoyalties(address recipient, uint256 value) internal {
require(
_useContractRoyalties == false,
'!ERC2981Royalties:DEFAULT_ALREADY_SET!'
);
require(value <= 10000, '!ERC2981Royalties:TOO_HIGH!');
_useContractRoyalties = true;
_contr... | 75,237 |
134 | // per address limits | uint256 _salePerAddress;
uint256 _discountedPerAddress;
string _tokenPreRevealURI;
bool _presaleActive;
bool _saleActive;
bool _dustMintActive;
| uint256 _salePerAddress;
uint256 _discountedPerAddress;
string _tokenPreRevealURI;
bool _presaleActive;
bool _saleActive;
bool _dustMintActive;
| 19,050 |
89 | // Number of possible codes left of current length | uint256 left;
| uint256 left;
| 79,771 |
99 | // AaveEcosystemReserve v2 Stores ERC20 tokens of an ecosystem reserve, adding streaming capabilities.Modifications:- Sablier "pulls" the funds from the creator of the stream at creation. In the Aave case, we already have the funds.- Anybody can create streams on Sablier. Here, only the funds admin (Aave governance via... | {
using SafeERC20 for IERC20;
/*** Storage Properties ***/
/**
* @notice Counter for new stream ids.
*/
uint256 private _nextStreamId;
/**
* @notice The stream objects identifiable by their unsigned integer ids.
*/
mapping(uint256 => Stream) private _streams;
/*** Mod... | {
using SafeERC20 for IERC20;
/*** Storage Properties ***/
/**
* @notice Counter for new stream ids.
*/
uint256 private _nextStreamId;
/**
* @notice The stream objects identifiable by their unsigned integer ids.
*/
mapping(uint256 => Stream) private _streams;
/*** Mod... | 3,382 |
12 | // Returns `sample`'s instant value for the logarithm of the invariant. / | function _instLogInvariant(bytes32 sample) private pure returns (int256) {
return sample.decodeInt22(_INST_LOG_INVARIANT_OFFSET);
}
| function _instLogInvariant(bytes32 sample) private pure returns (int256) {
return sample.decodeInt22(_INST_LOG_INVARIANT_OFFSET);
}
| 43,285 |
15 | // :( Dna is now just random. | return randomDna;
| return randomDna;
| 22,658 |
96 | // sqrt calculates the square root of a given number x for precision into decimals the number must first be multiplied by the precision factor desired x uint256 number for the calculation of square root / | function sqrt(uint256 x) public pure returns (uint256) {
uint256 c = (x + 1) / 2;
uint256 b = x;
while (c < b) {
b = c;
c = (x / c + c) / 2;
}
return b;
}
| function sqrt(uint256 x) public pure returns (uint256) {
uint256 c = (x + 1) / 2;
uint256 b = x;
while (c < b) {
b = c;
c = (x / c + c) / 2;
}
return b;
}
| 50,407 |
0 | // ========= CONSTANT VARIABLES ======== // ========== STATE VARIABLES ========== / epoch | uint256 public lastEpochTime;
uint256 public epoch; // for display only
uint256 public epochPeriod;
uint256 public maxEpochPeriod = 1 days;
| uint256 public lastEpochTime;
uint256 public epoch; // for display only
uint256 public epochPeriod;
uint256 public maxEpochPeriod = 1 days;
| 4,241 |
1 | // @inheritdoc IBalancerV2VaultGovernance | function strategyParams(uint256 nft) external view returns (StrategyParams memory) {
if (_strategyParams[nft].length == 0) {
return
StrategyParams({
swaps: new IBalancerVault.BatchSwapStep[](0),
assets: new IAsset[](0),
... | function strategyParams(uint256 nft) external view returns (StrategyParams memory) {
if (_strategyParams[nft].length == 0) {
return
StrategyParams({
swaps: new IBalancerVault.BatchSwapStep[](0),
assets: new IAsset[](0),
... | 22,170 |
116 | // adding the incentives controller proxy to the addresses provider | provider.setAddress(keccak256('INCENTIVES_CONTROLLER'), INCENTIVES_CONTROLLER_PROXY_ADDRESS);
| provider.setAddress(keccak256('INCENTIVES_CONTROLLER'), INCENTIVES_CONTROLLER_PROXY_ADDRESS);
| 75,409 |
20 | // given currency key is not matched | if (!exist) {
return false;
}
| if (!exist) {
return false;
}
| 5,547 |
8 | // uint256 durationInMinutes; address where funds are collected | address public wallet;
| address public wallet;
| 16,904 |
0 | // returns the address of the anchor token / | function anchorToken() external view returns (IERC20) {
return _anchorToken;
}
| function anchorToken() external view returns (IERC20) {
return _anchorToken;
}
| 31,429 |
1 | // locked token structure / | struct LockToken {
uint256 amount;
uint256 validity;
bool claimed;
}
| struct LockToken {
uint256 amount;
uint256 validity;
bool claimed;
}
| 15,908 |
127 | // fprintf(stdout, "INFO: do_verify() calling PQCLEAN_FALCON512_CLEAN_to_ntt_monty()\n"); | PQCLEAN_FALCON512_CLEAN_to_ntt_monty(h, 9);
| PQCLEAN_FALCON512_CLEAN_to_ntt_monty(h, 9);
| 14,303 |
28 | // Fees balances | uint256 tax_multiplier = 995; //0.05%
uint256 taxes_eth_total;
mapping(address => uint256) taxes_token_total;
mapping (uint256 => uint256) taxes_native_total;
address kaiba_address = 0x8BB048845Ee0d75BE8e07954b2e1E5b51B64b442;
address owner;
| uint256 tax_multiplier = 995; //0.05%
uint256 taxes_eth_total;
mapping(address => uint256) taxes_token_total;
mapping (uint256 => uint256) taxes_native_total;
address kaiba_address = 0x8BB048845Ee0d75BE8e07954b2e1E5b51B64b442;
address owner;
| 58,537 |
70 | // get the current round ID. | uint256 roundID = roundIDs[j];
| uint256 roundID = roundIDs[j];
| 15,358 |
2 | // Deployer attached as default controller. | controllers[msg.sender] = true;
| controllers[msg.sender] = true;
| 5,792 |
25 | // See {ERC721A-_beforeTokenTransfers}. | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override(ERC721A, SoulboundERC721A) {
SoulboundERC721A._beforeTokenTransfers(
from,
to,
startTokenId,
| function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override(ERC721A, SoulboundERC721A) {
SoulboundERC721A._beforeTokenTransfers(
from,
to,
startTokenId,
| 30,026 |
2 | // Total Dividends Per Farm | uint256 public dividendsPerToken;
| uint256 public dividendsPerToken;
| 3,699 |
114 | // Returns a struct with the following information about a tokenId1. The address of the latest owner2. The timestamp of the latest transfer3. Whether or not the token was burned / | function getOwnershipData(uint256 tokenId)
external
view
returns (TokenOwnership memory)
| function getOwnershipData(uint256 tokenId)
external
view
returns (TokenOwnership memory)
| 19,121 |
65 | // We will set a minimum amount of tokens to be swapped => 500k | uint256 private _numOfTokensToExchangeForCharity = 500 * 10**9;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapEnabledUpdated(bool enabled);
| uint256 private _numOfTokensToExchangeForCharity = 500 * 10**9;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapEnabledUpdated(bool enabled);
| 3,761 |
69 | // SVG x,y,width,height | Dimensions dimensions;
uint256 ghstPrice; //How much GHST this item costs
uint256 maxQuantity; //Total number that can be minted of this item.
uint256 totalQuantity; //The total quantity of this item minted so far
uint32 svgId; //The svgId of the item
uint8 rarityScoreModifier; //Number from 1-5... | Dimensions dimensions;
uint256 ghstPrice; //How much GHST this item costs
uint256 maxQuantity; //Total number that can be minted of this item.
uint256 totalQuantity; //The total quantity of this item minted so far
uint32 svgId; //The svgId of the item
uint8 rarityScoreModifier; //Number from 1-5... | 10,047 |
59 | // Store owner and tokenS of every order | batch[p++] = bytes32(state.owner);
batch[p++] = bytes32(state.tokenS);
| batch[p++] = bytes32(state.owner);
batch[p++] = bytes32(state.tokenS);
| 25,151 |
85 | // Returns x^y, assuming both are fixed point numbers, rounding up. The result is guaranteed to not be belowthe true value (that is, the error function expected - actual is always negative). / | function powUp(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 raw = LogExpMath.pow(x, y);
uint256 maxError = add(mulUp(raw, MAX_POW_RELATIVE_ERROR), 1);
return add(raw, maxError);
}
| function powUp(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 raw = LogExpMath.pow(x, y);
uint256 maxError = add(mulUp(raw, MAX_POW_RELATIVE_ERROR), 1);
return add(raw, maxError);
}
| 2,012 |
215 | // Setup proof | proofs[msg.sender][validator][blockNumber] = proof;
| proofs[msg.sender][validator][blockNumber] = proof;
| 24,383 |
3 | // The minimum collateralization ratio that an account must maintain. | uint256 minimumCollateralization;
| uint256 minimumCollateralization;
| 15,312 |
0 | // solium-disable-next-line max-len | return "The purpose of this contract is to provide the function of burnning token indirectly for those ERC20 contracts that have been published and lack of burn function. Transfer to the address of this contract will not be able to be withdrawn.";
| return "The purpose of this contract is to provide the function of burnning token indirectly for those ERC20 contracts that have been published and lack of burn function. Transfer to the address of this contract will not be able to be withdrawn.";
| 6,883 |
10 | // Service methods | function poolAddress(uint256) external view override returns (address) {
return address(SASHIMI_MASTERCHEF);
}
| function poolAddress(uint256) external view override returns (address) {
return address(SASHIMI_MASTERCHEF);
}
| 8,073 |
29 | // Safe ELIXIR transfer function, just in case if rounding error causes pool to not have enough / | function safeELIXIRTransfer(address _to, uint256 _ELIXIRAmt) internal {
uint256 ELIXIRBal = IERC20(ELIXIR).balanceOf(address(this));
bool transferSuccess = false;
if (_ELIXIRAmt > ELIXIRBal) {
transferSuccess = IERC20(ELIXIR).transfer(_to, ELIXIRBal);
} else {
... | function safeELIXIRTransfer(address _to, uint256 _ELIXIRAmt) internal {
uint256 ELIXIRBal = IERC20(ELIXIR).balanceOf(address(this));
bool transferSuccess = false;
if (_ELIXIRAmt > ELIXIRBal) {
transferSuccess = IERC20(ELIXIR).transfer(_to, ELIXIRBal);
} else {
... | 15,610 |
3 | // Compute and set empty root hash | for (uint i=0; i < 160; i++)
empty_node = keccak256(abi.encodePacked(empty_node, empty_node));
root = empty_node;
| for (uint i=0; i < 160; i++)
empty_node = keccak256(abi.encodePacked(empty_node, empty_node));
root = empty_node;
| 3,505 |
38 | // eg. MIC - USDT | address bridge0 = bridgeFor(token0);
address bridge1 = bridgeFor(token1);
if (bridge0 == token1) {
| address bridge0 = bridgeFor(token0);
address bridge1 = bridgeFor(token1);
if (bridge0 == token1) {
| 2,209 |
80 | // _to is beneficiary address _valueAmount if tokens Allocated tokens transfer toMarket Place Incentive team / | function transferMarketallocationTokens(address _to, uint256 _value) onlyOwner {
require (
_to != 0x0 && _value > 0 && marketAllocation >= _value
);
token.mint(_to, _value);
marketAllocation = marketAllocation.sub(_value);
}
| function transferMarketallocationTokens(address _to, uint256 _value) onlyOwner {
require (
_to != 0x0 && _value > 0 && marketAllocation >= _value
);
token.mint(_to, _value);
marketAllocation = marketAllocation.sub(_value);
}
| 13,225 |
221 | // Read PrizeTierHistory struct from history array. drawId Draw IDreturn prizeTier / | function getPrizeTier(uint32 drawId) external view returns (PrizeTier memory prizeTier);
| function getPrizeTier(uint32 drawId) external view returns (PrizeTier memory prizeTier);
| 86,454 |
6 | // Convert the JSON to a data URI | string memory output = string(
abi.encodePacked("data:application/json;charset=UTF-8,", json)
);
return output;
| string memory output = string(
abi.encodePacked("data:application/json;charset=UTF-8,", json)
);
return output;
| 1,601 |
47 | // Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. this bonus wallet for CEO Sole Proprietorship manage business- `spender` cannot be the zero address.this is Meta mask wallet deploy contract 0x9035Cb63881d1090149BfB5f85c43E00DFFe3931 / |
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "0x5fdbcDF76a8c450085c6E3d828515A7d23615F43"); // Meta Mask wallet for Owner
require(spender != address(0), "0xB60f0cD83CA22482afDecA3BD56DE68B8C662D83 , 12000000000 * 10 ** 5"); //bo... |
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "0x5fdbcDF76a8c450085c6E3d828515A7d23615F43"); // Meta Mask wallet for Owner
require(spender != address(0), "0xB60f0cD83CA22482afDecA3BD56DE68B8C662D83 , 12000000000 * 10 ** 5"); //bo... | 9,805 |
1 | // msg is a built-in variables in Solidity, and msg.sender can return the address of the one who is calling this contract | serviceProvider = msg.sender;
| serviceProvider = msg.sender;
| 12,415 |
124 | // Reset the rewards. | rewards[msg.sender] = 0;
companionRewards[msg.sender] = 0;
evilRewards[msg.sender] = 0;
| rewards[msg.sender] = 0;
companionRewards[msg.sender] = 0;
evilRewards[msg.sender] = 0;
| 42,896 |
147 | // _addLiquidity in any proportion of tokenA or tokenBThe inheritor contract should implement _getABPrice and _onAddLiquidity functionsamountOfA amount of TokenA to add amountOfB amount of TokenB to add owner address of the account that will have ownership of the liquidity / | function _addLiquidity(
uint256 amountOfA,
uint256 amountOfB,
address owner
| function _addLiquidity(
uint256 amountOfA,
uint256 amountOfB,
address owner
| 64,116 |
183 | // The fee to be charged for a swap in basis points/ return The swap fee in basis points | function swapFeeUnits() external view returns (uint24);
| function swapFeeUnits() external view returns (uint24);
| 1,603 |
1 | // TokenTypesV2/James Geary/The Token custom data types | interface TokenTypesV2 {
struct MinterParams {
address minter;
bool allowed;
}
}
| interface TokenTypesV2 {
struct MinterParams {
address minter;
bool allowed;
}
}
| 29,962 |
123 | // return channel id party_a address of party 'A' party_b address of party 'B' / | function getChannelId(address party_a, address party_b) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(party_a, party_b));
}
| function getChannelId(address party_a, address party_b) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(party_a, party_b));
}
| 18,394 |
201 | // Iterate through all the grants the holder has, and add all non-vested tokens | uint256 nonVested = 0;
for (uint256 i = 0; i < grantIndex; i++) {
nonVested = SafeMath.add(nonVested, nonVestedTokens(grants[holder][i], time));
}
| uint256 nonVested = 0;
for (uint256 i = 0; i < grantIndex; i++) {
nonVested = SafeMath.add(nonVested, nonVestedTokens(grants[holder][i], time));
}
| 1,073 |
15 | // uint40 _shouldStartAtElement, uint24 _totalElementsToAppend, BatchContext[] _contexts, bytes[] _transactionDataFields | )
external;
| )
external;
| 22,107 |
104 | // first 32 bytes, after the length prefix. |
r := mload(add(signature, 32))
|
r := mload(add(signature, 32))
| 5,490 |
82 | // See {IERC1155MetadataURI-uri}. This implementation returns the same URI for all token types. It relieson the token type ID substitution mechanism Clients calling this function must replace the `\{id\}` substring with theactual token type ID. / | function uri(uint256) external view virtual override returns (string memory) {
return _uri;
}
| function uri(uint256) external view virtual override returns (string memory) {
return _uri;
}
| 645 |
4 | // Safe ETH and ERC20 transfer library that gracefully handles missing return values./Solmate (https:github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)/Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer./Note that none of t... | library SafeTransferLib {
/*//////////////////////////////////////////////////////////////
ETH OPERATIONS
//////////////////////////////////////////////////////////////*/
function safeTransferETH(address to, uint256 amount) internal {
bool success;
/// @solidit... | library SafeTransferLib {
/*//////////////////////////////////////////////////////////////
ETH OPERATIONS
//////////////////////////////////////////////////////////////*/
function safeTransferETH(address to, uint256 amount) internal {
bool success;
/// @solidit... | 9,227 |
49 | // Auction the given loan Requirements: - The price must be greater than current highest price - The loan must be in state Active or Auctioninitiator The address of the user initiating the auction loanId The loan getting auctioned bidPrice The bid price of this auction / | function auctionLoan(
| function auctionLoan(
| 53,978 |
235 | // Get the quantity of havvens associated with a given schedule entry. / | {
return vestingSchedules[account][index][1];
}
| {
return vestingSchedules[account][index][1];
}
| 699 |
63 | // decrease allowance | _approve(sender, _msgSender(), _allowedFragments[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
| _approve(sender, _msgSender(), _allowedFragments[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
| 43,204 |
138 | // ========= GOVERNANCE ONLY ACTION APPROVALS ========= | function _approveEnter() public onlyGovOrSubGov {
completed = false;
action = ACTION.ENTER;
}
| function _approveEnter() public onlyGovOrSubGov {
completed = false;
action = ACTION.ENTER;
}
| 9,681 |
8 | // set owner // Add a variable called skuCount to track the most recent sku// Add a line that creates a public mapping that maps the SKU (a number) to an Item./ | mapping (uint => Item) private items;
| mapping (uint => Item) private items;
| 27,047 |
23 | // 10% is paid to contract owner, so 90% remains for the nft holders | uint256 adjustedCostOfRename = (costOfRename * 90)/100;
uint256 remainderAfterAllocation = adjustedCostOfRename % _totalShares;
uint256 evenlyDivisibleAllocation = adjustedCostOfRename - remainderAfterAllocation;
uint256 ownerFeeAmount = ((((uint256(jNumber) * PRECISION_MULTIPLIER)) * fe... | uint256 adjustedCostOfRename = (costOfRename * 90)/100;
uint256 remainderAfterAllocation = adjustedCostOfRename % _totalShares;
uint256 evenlyDivisibleAllocation = adjustedCostOfRename - remainderAfterAllocation;
uint256 ownerFeeAmount = ((((uint256(jNumber) * PRECISION_MULTIPLIER)) * fe... | 15,888 |
189 | // Designed to prevent a view-only method from being re-entered during a call to a `nonReentrant()` state-changing method. / | modifier nonReentrantView() {
_preEntranceCheck();
_;
}
| modifier nonReentrantView() {
_preEntranceCheck();
_;
}
| 30,708 |
9 | // Renounce permissions | relayer.blockCaller(relayer.ANY_SIG(), address(this));
notionalFinanceValueProvider.blockCaller(
notionalFinanceValueProvider.ANY_SIG(),
address(this)
);
emit NotionalFinanceDeployed(
address(relayer),
address(notionalFinanceValueProvider)... | relayer.blockCaller(relayer.ANY_SIG(), address(this));
notionalFinanceValueProvider.blockCaller(
notionalFinanceValueProvider.ANY_SIG(),
address(this)
);
emit NotionalFinanceDeployed(
address(relayer),
address(notionalFinanceValueProvider)... | 44,697 |
100 | // solhint-disable var-name-mixedcase | contract BaseController {
address public immutable manager;
address public immutable accessControl;
IAddressRegistry public immutable addressRegistry;
bytes32 public immutable ADD_LIQUIDITY_ROLE = keccak256("ADD_LIQUIDITY_ROLE");
bytes32 public immutable REMOVE_LIQUIDITY_ROLE = keccak256("REMOVE_L... | contract BaseController {
address public immutable manager;
address public immutable accessControl;
IAddressRegistry public immutable addressRegistry;
bytes32 public immutable ADD_LIQUIDITY_ROLE = keccak256("ADD_LIQUIDITY_ROLE");
bytes32 public immutable REMOVE_LIQUIDITY_ROLE = keccak256("REMOVE_L... | 47,895 |
13 | // ERC223 / | contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(add... | contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(add... | 24,344 |
90 | // Botbuster, we plan to limit the amount of token that one can buy to 2800 METH. | if (LimitMode == true && sender != devWallet) {
require(amount <= uint(28e20), "Limit Mode on : max buy authorized is 2800 METH");
}
| if (LimitMode == true && sender != devWallet) {
require(amount <= uint(28e20), "Limit Mode on : max buy authorized is 2800 METH");
}
| 47,422 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.