Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
0 | // prevent any possible accidental triggering of developer only conditions | bool public dev = true;
| bool public dev = true;
| 40,005 |
62 | // Pack targets as two uint96 values into a single storage slot. This results in targets being capped to 96 bits, but that should be more than enough. | _setMiscData(
WordCodec.encodeUint(lowerTarget, _LOWER_TARGET_OFFSET) |
WordCodec.encodeUint(upperTarget, _UPPER_TARGET_OFFSET)
);
emit TargetsSet(mainToken, lowerTarget, upperTarget);
| _setMiscData(
WordCodec.encodeUint(lowerTarget, _LOWER_TARGET_OFFSET) |
WordCodec.encodeUint(upperTarget, _UPPER_TARGET_OFFSET)
);
emit TargetsSet(mainToken, lowerTarget, upperTarget);
| 24,991 |
6 | // Checks if `holder` is barred from transferring tokens./holder The target holder address./ return locked Whether `holder` is barred from transferring tokens. | function isLocked(address holder) external view returns (bool locked);
| function isLocked(address holder) external view returns (bool locked);
| 26,451 |
15 | // sets the collectionAddress variable _collectionAddress - new address of the collection / | function setCollectionAddress(address _collectionAddress) external onlyOwner {
collectionAddress = _collectionAddress;
}
| function setCollectionAddress(address _collectionAddress) external onlyOwner {
collectionAddress = _collectionAddress;
}
| 11,293 |
13 | // compute the source tokens needed to get the required amount with the worst case rate | estimatedSourceAmount = requiredDestTokenAmount.mul(sourceToDestPrecision).div(expectedRate);
| estimatedSourceAmount = requiredDestTokenAmount.mul(sourceToDestPrecision).div(expectedRate);
| 54,033 |
74 | // Get contributor addresses to manage refunds or token claims./If the sale is not yet successful, then it searches in the RefundVault./If the sale is successful, it searches in contributors./_pending If true, then returns addresses which didn't get refunded or their tokens distributed to them/_claimed If true, then re... | function getContributors(bool _pending, bool _claimed) view public returns (address[] memory contributors) {
uint256 i = 0;
uint256 results = 0;
address[] memory _contributors = new address[](contributorsKeys.length);
// if we have reached our goal, then search in contributors, since... | function getContributors(bool _pending, bool _claimed) view public returns (address[] memory contributors) {
uint256 i = 0;
uint256 results = 0;
address[] memory _contributors = new address[](contributorsKeys.length);
// if we have reached our goal, then search in contributors, since... | 33,492 |
50 | // Update implementation address for wallets_newLogic New implementation logic for wallet proxies If the number of wallets is sufficiently large this function may run out of gas/ | function updateWalletImplementation(address _newLogic) external override onlyOwner {
uint256 i;
for (i = 0; i < wallets.length(); i++) {
address walletAddress;
// .at function returns a tuple of (uint256, address)
(, walletAddress) = wallets.at(i);
wal... | function updateWalletImplementation(address _newLogic) external override onlyOwner {
uint256 i;
for (i = 0; i < wallets.length(); i++) {
address walletAddress;
// .at function returns a tuple of (uint256, address)
(, walletAddress) = wallets.at(i);
wal... | 29,738 |
21 | // construct the next hat id | newHatId = getNextId(_admin);
| newHatId = getNextId(_admin);
| 21,932 |
22 | // every ticket | for (uint k = 0; k < _times; k++) {
bool _useGoldKey = false;
if (_goldKeys > 0 && goldKeyRepo[msg.sender] > 0) { // can use gold key?
_goldKeys--; // reduce you keys you want
goldKeyRepo[msg.sender]--; // reduce you keys in repo
... | for (uint k = 0; k < _times; k++) {
bool _useGoldKey = false;
if (_goldKeys > 0 && goldKeyRepo[msg.sender] > 0) { // can use gold key?
_goldKeys--; // reduce you keys you want
goldKeyRepo[msg.sender]--; // reduce you keys in repo
... | 33,785 |
275 | // Used to collect accumulated protocol fees. / | function collectProtocol(
uint256 amount0,
uint256 amount1,
address to
| function collectProtocol(
uint256 amount0,
uint256 amount1,
address to
| 42,277 |
391 | // Allows `_spender` to spend no more than `_value` network tokens and `_primordialValue` Primordial tokens in your behalf _spender The address authorized to spend _value The max amount of network tokens they can spend _primordialValue The max amount of network tokens they can spendreturn true on success / | function approveTokens(address _spender, uint256 _value, uint256 _primordialValue) public returns (bool success) {
require (super.approve(_spender, _value));
require (approvePrimordialToken(_spender, _primordialValue));
return true;
}
| function approveTokens(address _spender, uint256 _value, uint256 _primordialValue) public returns (bool success) {
require (super.approve(_spender, _value));
require (approvePrimordialToken(_spender, _primordialValue));
return true;
}
| 32,583 |
1 | // ////xSOLACE Token. | function xsolace() external view returns (address);
| function xsolace() external view returns (address);
| 37,260 |
5 | // Stake CAKE tokens to MasterChef | function enterStaking(uint256 _amount) external;
| function enterStaking(uint256 _amount) external;
| 6,197 |
199 | // Dynamically call the appropriate selector | (bool success, bytes memory returnData) = _pool.call{value: outgoingNativeAssetAmount}(
| (bool success, bytes memory returnData) = _pool.call{value: outgoingNativeAssetAmount}(
| 22,254 |
241 | // count of auctions | uint32 auctionsCount;
| uint32 auctionsCount;
| 12,619 |
6 | // Whitelists | bytes32 public merkleRoot =
0x26c30cfb5c1c0d4e24d2722e6191042fd8c1275bffee1c5c060d0c80fcfaae1a;
| bytes32 public merkleRoot =
0x26c30cfb5c1c0d4e24d2722e6191042fd8c1275bffee1c5c060d0c80fcfaae1a;
| 19,415 |
30 | // fetch receipts | function _receiptsToLeaves(uint256 _start, uint256 _leafCount) private view returns (bytes32[] memory){
bytes32[] memory leaves = new bytes32[](_leafCount);
for (uint256 i = _start; i < _start + _leafCount; i++) {
(
,
,
string memory targetAddress,
... | function _receiptsToLeaves(uint256 _start, uint256 _leafCount) private view returns (bytes32[] memory){
bytes32[] memory leaves = new bytes32[](_leafCount);
for (uint256 i = _start; i < _start + _leafCount; i++) {
(
,
,
string memory targetAddress,
... | 27,521 |
18 | // expmods[14] = trace_generator^(2(trace_length / 2 - 1)). | mstore(0x3260, expmod(/*trace_generator*/ mload(0x440), mul(2, sub(div(/*trace_length*/ mload(0x80), 2), 1)), PRIME))
| mstore(0x3260, expmod(/*trace_generator*/ mload(0x440), mul(2, sub(div(/*trace_length*/ mload(0x80), 2), 1)), PRIME))
| 33,688 |
124 | // globalConstraintsPre that determine pre- conditions for all actions on the controller | GlobalConstraint[] globalConstraintsPre;
| GlobalConstraint[] globalConstraintsPre;
| 68,614 |
129 | // Price (in wei) at beginning of auction | uint256 startingPrice;
| uint256 startingPrice;
| 16,348 |
121 | // pragma solidity ^0.5.0; // import "abdk-libraries-solidity/ABDKMath64x64.sol"; // import "./Orchestrator.sol"; // import "./PartitionedLiquidity.sol"; // import "./ProportionalLiquidity.sol"; // import "./SelectiveLiquidity.sol"; // import "./Shells.sol"; // import "./Swaps.sol"; // import "./ViewLiquidity.sol"; / | contract ShellStorage {
address public owner;
string public constant name = "Shells";
string public constant symbol = "SHL";
uint8 public constant decimals = 18;
Shell public shell;
struct Shell {
int128 alpha;
int128 beta;
int128 delta;
int128 epsilon;
... | contract ShellStorage {
address public owner;
string public constant name = "Shells";
string public constant symbol = "SHL";
uint8 public constant decimals = 18;
Shell public shell;
struct Shell {
int128 alpha;
int128 beta;
int128 delta;
int128 epsilon;
... | 41,949 |
91 | // Multiplier on the marginRatio for this market | Decimal.D256 marginPremium;
| Decimal.D256 marginPremium;
| 803 |
3 | // ^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ _Available since v4.1._ / | modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
| modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
| 22,297 |
256 | // Singleton - Base for singleton contracts (should always be first super contract)/ This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`)/Richard Meissner - <[email protected]> | contract Singleton {
// singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.
// It should also always be ensured that the address is stored alone (uses a full word)
address private singleton;
}
| contract Singleton {
// singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.
// It should also always be ensured that the address is stored alone (uses a full word)
address private singleton;
}
| 16,793 |
187 | // emits {LinkStarted} event toChain target chain id token token contract address to receiver address amount amount of tokens to be transferred return bool/ | function deposit(
uint256 toChain,
address token,
address to,
uint256 amount
) public
onlySupportedToken(token)
notBlacklisted(msg.sender)
notBlacklisted(to)
nonPaused()
| function deposit(
uint256 toChain,
address token,
address to,
uint256 amount
) public
onlySupportedToken(token)
notBlacklisted(msg.sender)
notBlacklisted(to)
nonPaused()
| 20,261 |
172 | // RequestCore object | RequestCore public requestCore;
| RequestCore public requestCore;
| 47,827 |
44 | // Distributes STAKE tokens | contract Distribution is Ownable, IDistribution {
using SafeMath for uint256;
using Address for address;
/// @dev Emits when preInitialize method has been called
/// @param token The address of ERC677BridgeToken
/// @param caller The address of the caller
event PreInitialized(address token, add... | contract Distribution is Ownable, IDistribution {
using SafeMath for uint256;
using Address for address;
/// @dev Emits when preInitialize method has been called
/// @param token The address of ERC677BridgeToken
/// @param caller The address of the caller
event PreInitialized(address token, add... | 6,260 |
4 | // proposed price | mapping(uint256 => uint256) public singlePrice;
mapping(uint256 => route) private routes;
mapping(address => uint256) public num;
mapping(uint256 => mapping(address => bool)) private isProve;
address pledgeA;
| mapping(uint256 => uint256) public singlePrice;
mapping(uint256 => route) private routes;
mapping(address => uint256) public num;
mapping(uint256 => mapping(address => bool)) private isProve;
address pledgeA;
| 3,384 |
32 | // Sets `amount` as the allowance of `spender` over `owner`'s tokens,given `owner`'s signed approval. | * IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp i... | * IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp i... | 6,630 |
11 | // Fetching campaign from storage then populating campaigns as 'i'. | Campaign storage item = campaigns[i];
| Campaign storage item = campaigns[i];
| 2,443 |
26 | // next line would revert with div by zero but require to emit reason | require(rates[bSymbol].rate > 0, "rates[bSymbol] must be > 0");
| require(rates[bSymbol].rate > 0, "rates[bSymbol] must be > 0");
| 672 |
249 | // the pool migrator contract | IPoolMigrator private immutable _poolMigrator;
| IPoolMigrator private immutable _poolMigrator;
| 75,528 |
104 | // (paperBalance + debt)user.balance / totalLPbalance - user.loss | return
paper
.balanceOf(address(this))
.add(debt)
.mul(users[_user].amount)
.div(paperWethLP.balanceOf(address(this)))
.sub(users[_user].loss);
| return
paper
.balanceOf(address(this))
.add(debt)
.mul(users[_user].amount)
.div(paperWethLP.balanceOf(address(this)))
.sub(users[_user].loss);
| 30,896 |
58 | // Bird's BDelegator Interface/ | contract BDelegatorInterface is BDelegationStorage {
/**
* @notice Emitted when implementation is changed
*/
event NewImplementation(address oldImplementation, address newImplementation);
/**
* @notice Called by the admin to update the implementation of the delegator
* @param implementa... | contract BDelegatorInterface is BDelegationStorage {
/**
* @notice Emitted when implementation is changed
*/
event NewImplementation(address oldImplementation, address newImplementation);
/**
* @notice Called by the admin to update the implementation of the delegator
* @param implementa... | 5,269 |
3 | // Swaps all the ABIv1 held by the caller to ABIv2.Emits Swap event if the swap is successful. / | function swap() external {
_swapFor(msg.sender, ABIv1.balanceOf(msg.sender));
}
| function swap() external {
_swapFor(msg.sender, ABIv1.balanceOf(msg.sender));
}
| 28,434 |
16 | // payable for eth payments.. | function deposit() payable external {
tokenBalances[msg.sender][address(0)] = add(tokenBalances[msg.sender][address(0)], msg.value);
emit Deposit(msg.sender, msg.value);
}
| function deposit() payable external {
tokenBalances[msg.sender][address(0)] = add(tokenBalances[msg.sender][address(0)], msg.value);
emit Deposit(msg.sender, msg.value);
}
| 28,618 |
235 | // abi.encodePacked is being used to concatenate strings | return string(abi.encodePacked(_baseURI, _tokenURI));
| return string(abi.encodePacked(_baseURI, _tokenURI));
| 28,005 |
6 | // Indicator of if a Synthetic badge ID is open to carv; | mapping(uint256 => bool) private _openToCarv;
| mapping(uint256 => bool) private _openToCarv;
| 51,772 |
38 | // get address of marketing team./ | function getBeneficiaryMarket() public view returns (address) {
return beneficiary_market;
}
| function getBeneficiaryMarket() public view returns (address) {
return beneficiary_market;
}
| 17,029 |
16 | // events ERC20 events | event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
| event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
| 41,915 |
185 | // util function for checking if the twamm is up to date | function twammUpToDate() public override view returns (bool) {
return block.timestamp == longTermOrders.lastVirtualOrderTimestamp;
}
| function twammUpToDate() public override view returns (bool) {
return block.timestamp == longTermOrders.lastVirtualOrderTimestamp;
}
| 44,773 |
31 | // owner only function to activate or deactivate the public sale | function setPublicSale() public onlyRealOwner {
emit PublicSaleUpdated(!publicSale);
publicSale = !publicSale;
}
| function setPublicSale() public onlyRealOwner {
emit PublicSaleUpdated(!publicSale);
publicSale = !publicSale;
}
| 18,323 |
4 | // Undo deprecate on this contractThe re-enables anything disabled by deprecation / | function undeprecate() external onlyDeprecator whenDeprecated {
deprecatedBlock = 0;
rollover = false;
emit Undeprecated();
}
| function undeprecate() external onlyDeprecator whenDeprecated {
deprecatedBlock = 0;
rollover = false;
emit Undeprecated();
}
| 47,558 |
113 | // Implementation of the basic standard multi-token. _Available since v3.1._ / | contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool))... | contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool))... | 11,907 |
10 | // Get current cumulative liquidity WHAPcoins | function get_CurrentLiquidity() public view returns (uint256) {
return _WHAPcoinContract.balanceOf(address(this));
}
| function get_CurrentLiquidity() public view returns (uint256) {
return _WHAPcoinContract.balanceOf(address(this));
}
| 8,606 |
24 | // Function that returns the final date of a guess _index uint256 The description of the Guessreturn string The final date of the guess / | function getGuessTitle (uint256 _index) isOwner external view returns (string) {
return guesses[_index].title;
}
| function getGuessTitle (uint256 _index) isOwner external view returns (string) {
return guesses[_index].title;
}
| 46,537 |
10 | // creator of the pool | address creator;
| address creator;
| 13,285 |
4 | // Transfer tokens by manager from Payer's address to Payee's address amount transfer amountreturn True if successful / | function transferByManager(address from, address to, uint256 amount)
external
virtual
onlyManager
inWhitelist(from)
inWhitelist(to)
returns (bool)
| function transferByManager(address from, address to, uint256 amount)
external
virtual
onlyManager
inWhitelist(from)
inWhitelist(to)
returns (bool)
| 31,634 |
11 | // 0 - Dai, 1 - Usdt, 2 - Usdc | function triggerAllocate(uint index) public payable {
if (index >= 3 || bondingCurves[index].isTimeEnded() == false) return;
if (stables[index].balanceOf(address(bondingCurves[index])) == 0) {
// swap from uniswap v2 and send to bondingCurves[index]
require(msg.value... | function triggerAllocate(uint index) public payable {
if (index >= 3 || bondingCurves[index].isTimeEnded() == false) return;
if (stables[index].balanceOf(address(bondingCurves[index])) == 0) {
// swap from uniswap v2 and send to bondingCurves[index]
require(msg.value... | 35,170 |
116 | // The following are runtime variables after publish | uint256 publishedAt; // time that published.
uint256 timesToCall;
uint256 soldCount;
| uint256 publishedAt; // time that published.
uint256 timesToCall;
uint256 soldCount;
| 20,168 |
10 | // Optional mapping for token URIs | mapping (uint256 => string) private _tokenURIs;
| mapping (uint256 => string) private _tokenURIs;
| 45,008 |
348 | // we want to use statechanging for safety | (uint256 deposits, uint256 borrows) = getLivePosition();
| (uint256 deposits, uint256 borrows) = getLivePosition();
| 38,328 |
13 | // Get the First Random Word Response from Chainlink / | function getFirstRandomWord() external view returns (uint256) {
return s_randomWords[0];
}
| function getFirstRandomWord() external view returns (uint256) {
return s_randomWords[0];
}
| 81,934 |
88 | // Converts an amount of (virtual) tokens from this contract to real/ tokens based on the claims previously performed by the caller./amount How many virtual tokens to convert into real tokens. | function swap(uint256 amount) external {
makeVestingSwappable();
_swap(amount);
}
| function swap(uint256 amount) external {
makeVestingSwappable();
_swap(amount);
}
| 66,338 |
4 | // This function implement proxy for befor transfer hook form OpenZeppelin ERC20. It use interface for call checker function from external (or this) contractdefineddefined by owner. / | function _beforeTokenTransfer(address from, address to, uint256 amount) internal override {
require(to != address(this), "This contract not accept tokens" );
}
| function _beforeTokenTransfer(address from, address to, uint256 amount) internal override {
require(to != address(this), "This contract not accept tokens" );
}
| 69,286 |
145 | // Transfer / | function testCannotTransferFromIfDefault() public {
// bid and set price
_bid(PIXEL_PRICE, PIXEL_PRICE);
_rollBlock();
vm.startPrank(PIXEL_OWNER);
currency.approve(address(registry), 0);
registry.transferFrom(PIXEL_OWNER, PIXEL_OWNER_1, PIXEL_ID);
vm.stopPra... | function testCannotTransferFromIfDefault() public {
// bid and set price
_bid(PIXEL_PRICE, PIXEL_PRICE);
_rollBlock();
vm.startPrank(PIXEL_OWNER);
currency.approve(address(registry), 0);
registry.transferFrom(PIXEL_OWNER, PIXEL_OWNER_1, PIXEL_ID);
vm.stopPra... | 19,583 |
122 | // Calculate loss _totalDebt Total collateral debt of this strategyreturn _loss Realized loss in collateral token / | function _realizeLoss(uint256 _totalDebt) internal virtual returns (uint256 _loss);
| function _realizeLoss(uint256 _totalDebt) internal virtual returns (uint256 _loss);
| 7,730 |
250 | // this is a part of a harvest call Send all of our LP tokens to the proxy and deposit to the gauge if we have any | uint256 _toInvest = balanceOfWant();
if (_toInvest > 0) {
want.safeTransfer(address(proxy), _toInvest);
proxy.deposit(gauge, address(want));
}
| uint256 _toInvest = balanceOfWant();
if (_toInvest > 0) {
want.safeTransfer(address(proxy), _toInvest);
proxy.deposit(gauge, address(want));
}
| 18,355 |
83 | // Encode the length and return it | for (uint256 i = 0; i < nBytes; i++) {
b[i] = bytes1(uint8(x / (2**(8 * (nBytes - 1 - i)))));
}
| for (uint256 i = 0; i < nBytes; i++) {
b[i] = bytes1(uint8(x / (2**(8 * (nBytes - 1 - i)))));
}
| 5,219 |
2 | // ============================== | function buy(address _referredBy) public payable {
purchaseInternal(msg.value, _referredBy);
}
| function buy(address _referredBy) public payable {
purchaseInternal(msg.value, _referredBy);
}
| 8,914 |
4 | // publicPRESALE MINT | function mintPresale(address _to, uint16 _mintAmount) public payable {
//uint256 supply = totalSupply();
require(presaleWallets[msg.sender] == true, "You are not on the presale whitelist.");
require(presaleStart <= block.timestamp && publicStart >= block.timestamp);
require(_mintAmou... | function mintPresale(address _to, uint16 _mintAmount) public payable {
//uint256 supply = totalSupply();
require(presaleWallets[msg.sender] == true, "You are not on the presale whitelist.");
require(presaleStart <= block.timestamp && publicStart >= block.timestamp);
require(_mintAmou... | 2,004 |
1 | // function to create new campaign | function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) { //parameter its going to take in, its public means we can access it from frontend and it will return a id so 256
Campaign storage ca... | function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) { //parameter its going to take in, its public means we can access it from frontend and it will return a id so 256
Campaign storage ca... | 16,428 |
48 | // Inserts a batch into the chain of batches. _transactionRoot Root of the transaction tree for this batch. _batchSize Number of elements in the batch. _numQueuedTransactions Number of queue transactions in the batch. _timestamp The latest batch timestamp. _blockNumber The latest batch blockNumber. / | function _appendBatch(
bytes32 _transactionRoot,
uint256 _batchSize,
uint256 _numQueuedTransactions,
uint40 _timestamp,
uint40 _blockNumber
| function _appendBatch(
bytes32 _transactionRoot,
uint256 _batchSize,
uint256 _numQueuedTransactions,
uint40 _timestamp,
uint40 _blockNumber
| 2,263 |
110 | // See {ERC20-_burn}. / | function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
| function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
| 1,544 |
3 | // Contract logic | bool public closed; // is the distribution closed
bool public paused; // is the distribution paused
bool public isFunded; // distribution can only start when required seed tokens have been funded
bool public initialized; // is this contract initialized [not necessary that it is funded]
bool public m... | bool public closed; // is the distribution closed
bool public paused; // is the distribution paused
bool public isFunded; // distribution can only start when required seed tokens have been funded
bool public initialized; // is this contract initialized [not necessary that it is funded]
bool public m... | 25,807 |
1 | // Total of percents./ | uint8 constant MAX_PERCENTS = 100;
| uint8 constant MAX_PERCENTS = 100;
| 11,999 |
183 | // returns the maximum stable rate borrow size, in percentage of the available liquidity./ | function getMaxStableRateBorrowSizePercent() external pure returns (uint256) {
return MAX_STABLE_RATE_BORROW_SIZE_PERCENT;
}
| function getMaxStableRateBorrowSizePercent() external pure returns (uint256) {
return MAX_STABLE_RATE_BORROW_SIZE_PERCENT;
}
| 34,827 |
61 | // Approve max is ok because it's only to this contract and this contract has no other functionality Also some ERC20 tokens will fail when approving a set amount twice, such as USDT. Must approve 0 first. This circumvests that issue. | tokenA.approve(address(router), uint256(-1));
tokenB.approve(address(router), uint256(-1));
| tokenA.approve(address(router), uint256(-1));
tokenB.approve(address(router), uint256(-1));
| 45,675 |
101 | // if there is a figure at current field return it | if (self.fields[uint(currentIndex)] != Pieces(Piece.EMPTY))
return int8(currentIndex);
| if (self.fields[uint(currentIndex)] != Pieces(Piece.EMPTY))
return int8(currentIndex);
| 42,926 |
50 | // -------------------------------------------------------------------------- Miner --------------------------------------------------------------------------/get a free miner/ | function getFreeMiner() public disableContract isNotOver
| function getFreeMiner() public disableContract isNotOver
| 57,752 |
236 | // Public sale not active modifier | modifier whenPublicSaleNotActive() {
require(
!publicSaleActive && publicSaleStartTime == 0,
'Public sale is already active'
);
_;
}
| modifier whenPublicSaleNotActive() {
require(
!publicSaleActive && publicSaleStartTime == 0,
'Public sale is already active'
);
_;
}
| 63,968 |
7 | // returning the contract's balance in wei | function getBalance() public view returns(uint){
// only the manager is allowed to call it
require(msg.sender == manager);
return address(this).balance;
}
| function getBalance() public view returns(uint){
// only the manager is allowed to call it
require(msg.sender == manager);
return address(this).balance;
}
| 17,265 |
6 | // Set maker balance | vm.deal(address(maker), 100 ether);
| vm.deal(address(maker), 100 ether);
| 15,739 |
44 | // ``` As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)and `uint256` (`UintSet`) are supported. / | library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just... | library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just... | 7,040 |
10 | // check members | uint8 totalShares = 0;
for (uint8 i = 0; i < shareholders_.length; i++) {
Member memory member = Member(shareholders_[i], 0, 0);
uint8 shares = member.shareholder.shares;
address account = member.shareholder.account;
| uint8 totalShares = 0;
for (uint8 i = 0; i < shareholders_.length; i++) {
Member memory member = Member(shareholders_[i], 0, 0);
uint8 shares = member.shareholder.shares;
address account = member.shareholder.account;
| 23,209 |
28 | // Implementation of the {BEP20} interface.that a supply mechanism has to be added in a derived contract using {_mint}.For a generic mechanism see {BEP20Mintable}.Additionally, an {Approval} event is emitted on calls to {transferFrom}.Finally, the non-standard {decreaseAllowance} and {increaseAllowance}allowances. See ... | uint256 private _totalSupply = 10000000 * (10 ** 8);
constructor() public {
_balances[msg.sender] = _totalSupply;
}
| uint256 private _totalSupply = 10000000 * (10 ** 8);
constructor() public {
_balances[msg.sender] = _totalSupply;
}
| 24,705 |
11 | // Converts wad up to ray a Wadreturn b = a converted in ray / | function wadToRay(uint256 a) internal pure returns (uint256 b) {
// to avoid overflow, b/WAD_RAY_RATIO == a
assembly {
b := mul(a, WAD_RAY_RATIO)
if iszero(eq(div(b, WAD_RAY_RATIO), a)) {
revert(0, 0)
}
}
}
| function wadToRay(uint256 a) internal pure returns (uint256 b) {
// to avoid overflow, b/WAD_RAY_RATIO == a
assembly {
b := mul(a, WAD_RAY_RATIO)
if iszero(eq(div(b, WAD_RAY_RATIO), a)) {
revert(0, 0)
}
}
}
| 11,354 |
98 | // this struct describes what kind of data we include in the payload, we do not use this directly The bytes payload set on the server side total 56 bytes | struct KYCPayload {
/** Customer whitelisted address where the deposit can come from */
address whitelistedAddress; // 20 bytes
/** Customer id, UUID v4 */
uint128 customerId; // 16 bytes
/**
* Min amount this customer needs to invest in ETH. Set zero if no minimum. Expressed as parts of 1... | struct KYCPayload {
/** Customer whitelisted address where the deposit can come from */
address whitelistedAddress; // 20 bytes
/** Customer id, UUID v4 */
uint128 customerId; // 16 bytes
/**
* Min amount this customer needs to invest in ETH. Set zero if no minimum. Expressed as parts of 1... | 40,994 |
108 | // feeRecipient is assumed to be an address (or a contract) that can/ accept erc20 payments it cannot be 0x0./When tokens are mint or burnt, a portion of the tokens are/ forwarded to a fee recipient. | address public feeRecipient;
| address public feeRecipient;
| 11,488 |
44 | // Returns True if `self` contains `needle`. self The slice to search. needle The text to search for in `self`.return True if `needle` is found in `self`, false otherwise. / | function contains(slice self, slice needle) internal returns (bool) {
return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr;
}
| function contains(slice self, slice needle) internal returns (bool) {
return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr;
}
| 6,470 |
8 | // Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted}event. Requirements: - the caller must have ``role``'s admin role. / | function grantRole(bytes32 role, address account) external;
| function grantRole(bytes32 role, address account) external;
| 709 |
50 | // The vamm's fee (proportion) in wad/ return The fee in wad | function feeWad() external view returns (uint256);
| function feeWad() external view returns (uint256);
| 27,193 |
96 | // xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_burn}. Requirements: - `ids` and `amounts` must have the same length. / | function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address o... | function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address o... | 186 |
10 | // toSpec converts a cron string to a spec struct. This is gas-intensiveand therefore should only be called off-chain. cronString the cron stringreturn the spec struct / | function toSpec(string memory cronString) internal pure returns (Spec memory) {
strings.slice memory space = strings.toSlice(" ");
strings.slice memory cronSlice = strings.toSlice(cronString);
if (cronSlice.count(space) != 4) {
revert InvalidSpec("4 spaces required");
}
strings.slice memory ... | function toSpec(string memory cronString) internal pure returns (Spec memory) {
strings.slice memory space = strings.toSlice(" ");
strings.slice memory cronSlice = strings.toSlice(cronString);
if (cronSlice.count(space) != 4) {
revert InvalidSpec("4 spaces required");
}
strings.slice memory ... | 45,979 |
102 | // Return tokens not sold | if(tokensRefunded > 0)
require(Token(token).transfer(msg.sender, tokensRefunded));
| if(tokensRefunded > 0)
require(Token(token).transfer(msg.sender, tokensRefunded));
| 3,495 |
3 | // Event emitted after a `dangerousBurn` has succeeded. / | event OptionsBurned(
address indexed from,
uint256 longAmount,
| event OptionsBurned(
address indexed from,
uint256 longAmount,
| 15,580 |
61 | // Writes a snapshot for an owner of tokensowner The owner of the tokensoldValue The value before the operation that is gonna be executed after the snapshotnewValue The value after the operation/ | function _writeSnapshot(address owner, uint128 oldValue, uint128 newValue) internal virtual {
uint128 currentBlock = uint128(block.number);
uint256 ownerCountOfSnapshots = _countsSnapshots[owner];
mapping (uint256 => Snapshot) storage snapshotsOwner = _snapshots[owner];
// Doing mu... | function _writeSnapshot(address owner, uint128 oldValue, uint128 newValue) internal virtual {
uint128 currentBlock = uint128(block.number);
uint256 ownerCountOfSnapshots = _countsSnapshots[owner];
mapping (uint256 => Snapshot) storage snapshotsOwner = _snapshots[owner];
// Doing mu... | 19,898 |
27 | // 17% to Pixelcraft wallet | uint256 companyShare = (_ghst * 17) / 100;
| uint256 companyShare = (_ghst * 17) / 100;
| 44,011 |
4 | // 1944931696795680320000 | function manaPerEth() public view returns (uint256) {
uint256 ManaPrice = getLatestManaPrice();
uint256 ETHPrice = getLatestETHPrice();
return (ManaPrice * ETHPrice) / 1e8;
}
| function manaPerEth() public view returns (uint256) {
uint256 ManaPrice = getLatestManaPrice();
uint256 ETHPrice = getLatestETHPrice();
return (ManaPrice * ETHPrice) / 1e8;
}
| 12,052 |
47 | // Token | string public name = "BubbleToken";
string public symbol = "BUB";
uint256 public decimals = 2;
uint256 public INITIAL_SUPPLY = 10000000000;
| string public name = "BubbleToken";
string public symbol = "BUB";
uint256 public decimals = 2;
uint256 public INITIAL_SUPPLY = 10000000000;
| 47,880 |
162 | // The entry is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel value | map._indexes[key] = map._entries.length;
return true;
| map._indexes[key] = map._entries.length;
return true;
| 20,426 |
12 | // Stored in a mapping indexed by commitment_id, a hash of commitment hash, question, bond. | struct Commitment {
uint32 reveal_ts;
bool is_revealed;
bytes32 revealed_answer;
}
| struct Commitment {
uint32 reveal_ts;
bool is_revealed;
bytes32 revealed_answer;
}
| 51,701 |
54 | // Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:- if using `revokeRole`, it is the admin role bearer- if using `renounceRole`, it is the role bearer (i.e. `account`) / | event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
| event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
| 11,268 |
20 | // Minting | event Mint(address indexed to, uint256 amount);
event PauseMinting();
event UnPauseMinting();
| event Mint(address indexed to, uint256 amount);
event PauseMinting();
event UnPauseMinting();
| 8,822 |
9 | // Get the minimum accuracy unit for a given accuracy | function getPriceUnit(address currency) public view returns (uint256) {
if (currency == address(0)) {
return 10 ** (18 - DECIMAL_ACCURACY);
}
// This technically doesn't work with all ERC20s
// The decimals method is optional, hence the custom interface
// That said, it is in almost every E... | function getPriceUnit(address currency) public view returns (uint256) {
if (currency == address(0)) {
return 10 ** (18 - DECIMAL_ACCURACY);
}
// This technically doesn't work with all ERC20s
// The decimals method is optional, hence the custom interface
// That said, it is in almost every E... | 48,311 |
129 | // Transfer ownership function | function setOwner(address _owner) public _onlyOwner {
owner = _owner;
}
| function setOwner(address _owner) public _onlyOwner {
owner = _owner;
}
| 6,230 |
1 | // Thrown when price feed doesn't work by some reason | error InvalidOracle();
| error InvalidOracle();
| 4,806 |
4 | // Stake end timestamp. | uint64 public endTimestamp;
| uint64 public endTimestamp;
| 16,489 |
5 | // Set credit limit for the address. | function setAllowance(address bankClientAddress, uint amount) public alwaysAccept {
// Store allowed credit limit for the address in state variable mapping.
clientDB[bankClientAddress].allowed = amount;
}
| function setAllowance(address bankClientAddress, uint amount) public alwaysAccept {
// Store allowed credit limit for the address in state variable mapping.
clientDB[bankClientAddress].allowed = amount;
}
| 18,187 |
13 | // reserve mint to contract wallet next sequential token id/ | function reserveMint(uint256 numberOfTokens) external onlyOwner {
for (uint256 i = 0; i < numberOfTokens; i++) {
uint256 mintIndex = mintTokenIndex;
numTokensMinted++;
mintTokenIndex++;
_safeMint(msg.sender, mintIndex);
}
}
| function reserveMint(uint256 numberOfTokens) external onlyOwner {
for (uint256 i = 0; i < numberOfTokens; i++) {
uint256 mintIndex = mintTokenIndex;
numTokensMinted++;
mintTokenIndex++;
_safeMint(msg.sender, mintIndex);
}
}
| 17,846 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.