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 |
|---|---|---|---|---|
293 | // Gets the net-asset value of the Rise Token in specified token This function may revert if _quote token is not configured in Rari Fuse Price Oracle _shares The amount of Rise Token _quote The token address used as quotereturn _value The net-asset value of the Rise Token in token decimals precision (ex: USDC is 1e6) / | function value(
uint256 _shares,
address _quote
| function value(
uint256 _shares,
address _quote
| 16,639 |
9 | // Set type of Oracle | constructor() public {
wards[msg.sender] = 1;
}
| constructor() public {
wards[msg.sender] = 1;
}
| 16,095 |
10 | // Events/ Emitted when a new token is created. tokenId The ID of the created token. uri The URI of the token's metadata. timestamp The timestamp of the event. / | event TokenCreated(uint256 tokenId, string uri, uint256 timestamp);
| event TokenCreated(uint256 tokenId, string uri, uint256 timestamp);
| 24,460 |
57 | // ensure that the country is the same as the current token ID | require(tokenId / LOCATION_MULTIPLIER == country, 'Country not valid');
Commitment memory existingCommitment = _validateAndDeleteCommitment(country, commitment);
delete _tokenChallengeExpirations[_msgSender()];
emit TokenChallengeCompleted(_msgSender(), tokenId);
| require(tokenId / LOCATION_MULTIPLIER == country, 'Country not valid');
Commitment memory existingCommitment = _validateAndDeleteCommitment(country, commitment);
delete _tokenChallengeExpirations[_msgSender()];
emit TokenChallengeCompleted(_msgSender(), tokenId);
| 52,329 |
2 | // The timestamp when tokens can be redeemed. | uint256 public immutable override unlockTimestamp;
| uint256 public immutable override unlockTimestamp;
| 54,575 |
120 | // Leaves the contract without owner. It will not be possible to call`onlyOwner` functions anymore. NOTE: Renouncing ownership will leave the contract without an owner,thereby removing any functionality that is only available to the owner. NOTE: This function is not safe, as it doesn’t check owner is calling it.Make su... | function _renounceOwnership() internal {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| function _renounceOwnership() internal {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| 31,820 |
766 | // trader that opened the swap | address indexed buyer,
| address indexed buyer,
| 7,776 |
157 | // transfer funds from the caller in the from reserve token | ensureTransferFrom(_fromToken, msg.sender, this, _amount);
| ensureTransferFrom(_fromToken, msg.sender, this, _amount);
| 25,267 |
158 | // Contract module which provides a basic access control mechanism, wherethere is an account (an minter) that can be granted exclusive access tospecific functions. By default, the minter account will be the one that deploys the contract. This | * can later be changed with {transferMintership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyMinter`, which can be applied to your functions to restrict their use to
* the minter.
*/
contract Mintable is Context {
/**
* @dev So here we seperate the rights of ... | * can later be changed with {transferMintership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyMinter`, which can be applied to your functions to restrict their use to
* the minter.
*/
contract Mintable is Context {
/**
* @dev So here we seperate the rights of ... | 16,966 |
46 | // offchain wei/token balances do not exceed onchain total wei/token | require(weiBalances[0].add(weiBalances[1]) <= channel.weiBalances[2], "wei must be conserved");
require(tokenBalances[0].add(tokenBalances[1]) <= channel.tokenBalances[2], "tokens must be conserved");
| require(weiBalances[0].add(weiBalances[1]) <= channel.weiBalances[2], "wei must be conserved");
require(tokenBalances[0].add(tokenBalances[1]) <= channel.tokenBalances[2], "tokens must be conserved");
| 23,252 |
88 | // Calculate uniswap time-weighted average price Underflow is a property of the accumulators: https:uniswap.org/audit.htmlorgc9b3190 | FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(uint224((nowCumulativePrice - oldCumulativePrice) / timeElapsed));
uint rawUniswapPriceMantissa = priceAverage.decode112with18();
uint unscaledPriceMantissa = mul(rawUniswapPriceMantissa, conversionFactor);
uint anchorPrice;... | FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(uint224((nowCumulativePrice - oldCumulativePrice) / timeElapsed));
uint rawUniswapPriceMantissa = priceAverage.decode112with18();
uint unscaledPriceMantissa = mul(rawUniswapPriceMantissa, conversionFactor);
uint anchorPrice;... | 12,884 |
26 | // team | address payable internal MARK = 0x35e9034f47cc00b8A9b555fC1FDB9598b2c245fD;
address payable internal JARED = 0x5eCb4D3B4b451b838242c3CF8404ef18f5C486aB;
address payable internal LOUIS = 0x454f203260a74C0A8B5c0a78fbA5B4e8B31dCC63;
address payable internal LOTTO = 0x1EF0Bab01329a6CE39e92eA6B88828430B1Cd91... | address payable internal MARK = 0x35e9034f47cc00b8A9b555fC1FDB9598b2c245fD;
address payable internal JARED = 0x5eCb4D3B4b451b838242c3CF8404ef18f5C486aB;
address payable internal LOUIS = 0x454f203260a74C0A8B5c0a78fbA5B4e8B31dCC63;
address payable internal LOTTO = 0x1EF0Bab01329a6CE39e92eA6B88828430B1Cd91... | 32,923 |
52 | // Sets `newManager` as the manager for `account`. A manager of anaccount is able to set interface implementers for it. By default, each account is its own manager. Passing a value of `0x0` in`newManager` will reset the manager to this initial state. | * Emits a {ManagerChanged} event.
*
* Requirements:
*
* - the caller must be the current manager for `account`.
*/
function setManager(address account, address newManager) external;
/**
* @dev Returns the manager for `account`.
*
* See {setManager}.
*/
func... | * Emits a {ManagerChanged} event.
*
* Requirements:
*
* - the caller must be the current manager for `account`.
*/
function setManager(address account, address newManager) external;
/**
* @dev Returns the manager for `account`.
*
* See {setManager}.
*/
func... | 31,556 |
1 | // mint VOLT to the target address and deplete the buffer/ pausable and depletes the msg.sender's buffer/to the recipient address of the minted VOLT/amount the amount of VOLT to mint | function mintVolt(address to, uint256 amount)
external
virtual
override
whenNotPaused
{
_depleteIndividualBuffer(msg.sender, amount);
_mintVolt(to, amount);
}
| function mintVolt(address to, uint256 amount)
external
virtual
override
whenNotPaused
{
_depleteIndividualBuffer(msg.sender, amount);
_mintVolt(to, amount);
}
| 9,550 |
10 | // The initial global index | uint256 public constant globalInitialIndex = 1e36;
uint256 public inflationSpeed = 0;
| uint256 public constant globalInitialIndex = 1e36;
uint256 public inflationSpeed = 0;
| 20,096 |
34 | // TODO: handle order outside of the book, where next or prev is nil | Order storage order = book.orders[id];
| Order storage order = book.orders[id];
| 5,049 |
10 | // function for the developer to change the address./ | function changeDev(address payable _dev) external returns (bool) {
require(msg.sender == dev, "change developer: not the current developer");
dev = _dev;
}
| function changeDev(address payable _dev) external returns (bool) {
require(msg.sender == dev, "change developer: not the current developer");
dev = _dev;
}
| 49,180 |
1 | // The governor unsets oracle token factor for a token. | event UnsetTokenFactor(address indexed token);
| event UnsetTokenFactor(address indexed token);
| 47,515 |
116 | // send fees | provider0.token.safeTransfer(feesController.feesTo(), feesAmount0);
provider1.token.safeTransfer(feesController.feesTo(), feesAmount1);
uint256 spentAmount0;
uint256 spentAmount1;
uint256 liquidity;
uint256[] memory returnedValues = new uint256[](3);
| provider0.token.safeTransfer(feesController.feesTo(), feesAmount0);
provider1.token.safeTransfer(feesController.feesTo(), feesAmount1);
uint256 spentAmount0;
uint256 spentAmount1;
uint256 liquidity;
uint256[] memory returnedValues = new uint256[](3);
| 60,063 |
89 | // See {IERC1155-safeTransferFrom}. / | function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
| function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
| 32,679 |
26 | // -------------------------------------------------------------------------- //erc20 // -------------------------------------------------------------------------- / | function name() public pure returns (string memory) {
return _name;
}
| function name() public pure returns (string memory) {
return _name;
}
| 27,572 |
257 | // Get the next harvest delay. | uint64 newHarvestDelay = nextHarvestDelay;
| uint64 newHarvestDelay = nextHarvestDelay;
| 55,489 |
41 | // New round reset count | if (HighJackpot[msg.sender] != 1){
HighJackpot[msg.sender] = 1;
}
| if (HighJackpot[msg.sender] != 1){
HighJackpot[msg.sender] = 1;
}
| 34,225 |
109 | // ORG.JSON storage update orgId ORGiD hash orgJsonHash ORG.JSON keccak256 hash orgJsonUri ORG.JSON URI orgJsonUriBackup1 ORG.JSON URI backup orgJsonUriBackup2 ORG.JSON URI backup / | function _updateOrgJson(
bytes32 orgId,
bytes32 orgJsonHash,
string memory orgJsonUri,
string memory orgJsonUriBackup1,
string memory orgJsonUriBackup2
| function _updateOrgJson(
bytes32 orgId,
bytes32 orgJsonHash,
string memory orgJsonUri,
string memory orgJsonUriBackup1,
string memory orgJsonUriBackup2
| 66,755 |
306 | // Check and update atomic volume limit | _checkAndUpdateAtomicVolume(sourceSusdValue);
| _checkAndUpdateAtomicVolume(sourceSusdValue);
| 38,121 |
24 | // Transfer tokens from one address to another.Note that while this function emits an Approval event, this is not required as per the specification,and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want to transfer to... | function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
| function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
| 422 |
13 | // If Red and Blue have exploded at the same time, return the amounted invested | if (red.lastUpdate == blue.lastUpdate && red.lastUpdate + DELAY < block.timestamp) {
for (i = 0; i < red.members.length; i++) {
balances[red.members[i]] += INVEST_AMOUNT;
}
| if (red.lastUpdate == blue.lastUpdate && red.lastUpdate + DELAY < block.timestamp) {
for (i = 0; i < red.members.length; i++) {
balances[red.members[i]] += INVEST_AMOUNT;
}
| 23,641 |
1 | // disable transfers | function _transfer(address _from, address _to, uint256 _amount) internal override {
revert("NON_TRANSFERABLE");
}
| function _transfer(address _from, address _to, uint256 _amount) internal override {
revert("NON_TRANSFERABLE");
}
| 28,779 |
4 | // MasterCopy - Base for master copy contracts (should always be first super contract)/ This contract is tightly coupled to our proxy contract (see `proxies/Proxy.sol`)/Richard Meissner - <richard@gnosis.io> | contract MasterCopy is SelfAuthorized {
event ChangedMasterCopy(address masterCopy);
// masterCopy 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... | contract MasterCopy is SelfAuthorized {
event ChangedMasterCopy(address masterCopy);
// masterCopy 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... | 1,861 |
36 | // Start the game Start a new game. Initialize game opponent, game time and status._gameOpponent The game opponent contract address_gameTime The game begin time. optional/ | function beginGame(address _gameOpponent, uint64 _gameTime) onlyOwner public {
require(_gameOpponent != address(this));
// 1514764800 = 2018-01-01
require(_gameTime == 0 || (_gameTime > 1514764800));
gameOpponent = _gameOpponent;
gameTime = _gameTime;
status = 0;
... | function beginGame(address _gameOpponent, uint64 _gameTime) onlyOwner public {
require(_gameOpponent != address(this));
// 1514764800 = 2018-01-01
require(_gameTime == 0 || (_gameTime > 1514764800));
gameOpponent = _gameOpponent;
gameTime = _gameTime;
status = 0;
... | 31,175 |
36 | // Add the FRAX and the collateral to the metapool | uint256 min_lp_out = (_MIM_Convex_AMOunt.add(threeCRV_received)).mul(slippage_metapool).div(PRICE_PRECISION);
metapool_LP_received = mim3crv_metapool.add_liquidity([_MIM_Convex_AMOunt, threeCRV_received], min_lp_out);
| uint256 min_lp_out = (_MIM_Convex_AMOunt.add(threeCRV_received)).mul(slippage_metapool).div(PRICE_PRECISION);
metapool_LP_received = mim3crv_metapool.add_liquidity([_MIM_Convex_AMOunt, threeCRV_received], min_lp_out);
| 49,290 |
313 | // We need to calculate what the updated cash will be after we transfer out to the user | (err, localResults.updatedCash) = sub(localResults.currentCash, amount);
if (err != Error.NO_ERROR) {
| (err, localResults.updatedCash) = sub(localResults.currentCash, amount);
if (err != Error.NO_ERROR) {
| 3,722 |
3 | // Record the from chain txs that have been processed | mapping(uint64 => mapping(bytes32 => bool)) FromChainTxExist;
| mapping(uint64 => mapping(bytes32 => bool)) FromChainTxExist;
| 48,044 |
75 | // 0.000001 TOKEN | require(balance >= decimal / MIN_BALANCE, "ERR_MIN_BALANCE");
_totalWeight = _totalWeight.badd(denorm);
require(_totalWeight <= MAX_TOTAL_WEIGHT, "ERR_MAX_TOTAL_WEIGHT");
_records[token] = Record({
bound: true,
index: _tokens.length,
denorm: denorm,
... | require(balance >= decimal / MIN_BALANCE, "ERR_MIN_BALANCE");
_totalWeight = _totalWeight.badd(denorm);
require(_totalWeight <= MAX_TOTAL_WEIGHT, "ERR_MAX_TOTAL_WEIGHT");
_records[token] = Record({
bound: true,
index: _tokens.length,
denorm: denorm,
... | 26,632 |
60 | // Deposit multiple tokens to the vault. Quantities should be in theorder of the addresses of the tokens being deposited. _tokens Array of the addresses of the ERC20 tokens_quantities Array of the number of tokens to deposit / | function batchDeposit(
| function batchDeposit(
| 17,300 |
1 | // set the configuration of the LayerZero messaging library of the specified version_version - messaging library version_chainId - the chainId for the pending config change_configType - type of configuration. every messaging library has its own convention._config - configuration in the bytes. can encode arbitrary conte... | function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;
| function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;
| 16,444 |
47 | // settles accrued interest for all active loans from a loan pool/loanId existing loan id | function settleInterest(bytes32 loanId) external;
function setDepositAmount(
bytes32 loanId,
uint256 depositValueAsLoanToken,
uint256 depositValueAsCollateralToken
) external;
function transferLoan(bytes32 loanId, address newOwner) external;
| function settleInterest(bytes32 loanId) external;
function setDepositAmount(
bytes32 loanId,
uint256 depositValueAsLoanToken,
uint256 depositValueAsCollateralToken
) external;
function transferLoan(bytes32 loanId, address newOwner) external;
| 5,447 |
13 | // Return aggregated normalized amount. | function getAggregatedNormalizedAmount() external view override onlyOwner returns (uint256) {
return aggregatedNormalizedAmount;
}
| function getAggregatedNormalizedAmount() external view override onlyOwner returns (uint256) {
return aggregatedNormalizedAmount;
}
| 16,497 |
2 | // note: this is not the way to do this for production, but we're taking a shortcut for a hackathon | mapping(uint256 => mapping(uint256 => bool)) public familyMembers; // familyID => personID => valid
mapping(uint256 => uint256) public familyMembersCount; // familyID => person count
mapping(uint256 => mapping(uint256 => uint256)) public familyRoles; // familyID => personID => role
mapping(uint256 => ma... | mapping(uint256 => mapping(uint256 => bool)) public familyMembers; // familyID => personID => valid
mapping(uint256 => uint256) public familyMembersCount; // familyID => person count
mapping(uint256 => mapping(uint256 => uint256)) public familyRoles; // familyID => personID => role
mapping(uint256 => ma... | 24,764 |
45 | // new "memory end" including padding (the string isn't larger than 32 bytes) | mstore(0x40, add(result, 0x40))
| mstore(0x40, add(result, 0x40))
| 2,015 |
60 | // Returns an amount in eth equivilent to USD at the set rate | function usdToEth(uint) public constant returns(uint);
| function usdToEth(uint) public constant returns(uint);
| 16,854 |
93 | // Create a mask of 1's where new cards should go. | uint _newMask;
for (uint _i=0; _i<5; _i++) {
if (_draws & 2**_i == 0) continue;
_newMask |= 63 * (2**(6*_i));
}
| uint _newMask;
for (uint _i=0; _i<5; _i++) {
if (_draws & 2**_i == 0) continue;
_newMask |= 63 * (2**(6*_i));
}
| 82,971 |
443 | // Decrease the number of votes delegated to the previous representative. | if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
| if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld.sub(amount);
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
| 39,571 |
158 | // Allocates swap fees accured in the contract. / | function allocateFees() public {
require(msg.sender == strategist || msg.sender == governance, "not authorized");
uint256 balance = IERC20(acBtc).balanceOf(address(this));
if (balance > 0 && reserveRate > 0 && reserve != address(0x0)) {
uint256 reserveAmount = balance.mul(reserv... | function allocateFees() public {
require(msg.sender == strategist || msg.sender == governance, "not authorized");
uint256 balance = IERC20(acBtc).balanceOf(address(this));
if (balance > 0 && reserveRate > 0 && reserve != address(0x0)) {
uint256 reserveAmount = balance.mul(reserv... | 55,382 |
2 | // Mints tokens to the recipients in amounts specified This function should be protected by a role so that it is not callable by any address recipients addresses to airdrop tokens to amounts amount of tokens to airdrop to recipients / | function airdrop(address[] calldata recipients, uint256[] calldata amounts) external;
| function airdrop(address[] calldata recipients, uint256[] calldata amounts) external;
| 28,107 |
170 | // owner gets the first 10 Bats | _safeMint( t1, 1);
| _safeMint( t1, 1);
| 38,495 |
26 | // This is used to mint new tokensCan only be executed by the staking, and merged miner validator contracts_recipient This is the person who will received the mint tokens_amount This is the amount of tokens that they will receive and which will be generated / | function mint(
address _recipient,
uint256 _amount)
public
onlyMinters
returns (bool)
| function mint(
address _recipient,
uint256 _amount)
public
onlyMinters
returns (bool)
| 941 |
55 | // Converts a `uint` to its ASCII `string` decimal representation. / | function toString(uint value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
... | function toString(uint value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
... | 34,283 |
92 | // column0_row14/ mload(0x1440), memory/address_diff_0 = column6_row2 - column6_row0. | let val := addmod(/*column6_row2*/ mload(0x1a80), sub(PRIME, /*column6_row0*/ mload(0x1a40)), PRIME)
mstore(0x2500, val)
| let val := addmod(/*column6_row2*/ mload(0x1a80), sub(PRIME, /*column6_row0*/ mload(0x1a40)), PRIME)
mstore(0x2500, val)
| 20,231 |
2 | // Tests if a transfer can occur between the from/to addresses and returns an error string when it would failcompliance The Compliance addresstoken The address of the token that triggered the checkinitiator The address initiating the transferfrom The address of the senderto The address of the receivertokens The number ... | function test(ICompliance compliance, IT0ken token, address initiator, address from, address to, uint256 tokens)
external
view
| function test(ICompliance compliance, IT0ken token, address initiator, address from, address to, uint256 tokens)
external
view
| 40,282 |
171 | // debit balance of caller for holdOption, credit exercisedOptions | balances[holderTicketAddress][msg.sender] =
safeSub(balances[holderTicketAddress][msg.sender], ticketsExcercised);
exercisedOptions[holderTicketAddress] =
safeAdd(exercisedOptions[holderTicketAddress], ticketsExcercised);
| balances[holderTicketAddress][msg.sender] =
safeSub(balances[holderTicketAddress][msg.sender], ticketsExcercised);
exercisedOptions[holderTicketAddress] =
safeAdd(exercisedOptions[holderTicketAddress], ticketsExcercised);
| 3,536 |
8 | // Provable callback function | function __callback(bytes32 myid, string memory result) public {
// require(msg.sender != provable_cbAddress());
numberOfPosts = parseInt(result);
if (numberOfPosts >= adQuota) {
influencerPayout();
}
emit LogAdConfirmations(numberOfPosts);
}
| function __callback(bytes32 myid, string memory result) public {
// require(msg.sender != provable_cbAddress());
numberOfPosts = parseInt(result);
if (numberOfPosts >= adQuota) {
influencerPayout();
}
emit LogAdConfirmations(numberOfPosts);
}
| 38,684 |
2 | // Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0)return block number as int / | function arbBlockNumber() external view returns (uint256);
| function arbBlockNumber() external view returns (uint256);
| 19,518 |
294 | // Assume it is the test ENS | if (ens.owner(node) != address(this)) {
| if (ens.owner(node) != address(this)) {
| 76,673 |
13 | // epoch finalized/_epochNumber number of the epoch being finalized/_epochHash claim being submitted by this epoch | event FinalizeEpoch(uint256 indexed _epochNumber, bytes32 _epochHash);
| event FinalizeEpoch(uint256 indexed _epochNumber, bytes32 _epochHash);
| 43,151 |
89 | // Mapping for the counters of songs minted for each song | mapping(uint256 => uint256) private _songSerials;
| mapping(uint256 => uint256) private _songSerials;
| 27,908 |
54 | // Reference to contest contract ownership of player tokens | address public contestContractAddress;
| address public contestContractAddress;
| 12,298 |
8 | // Function Modifiers//Blocks a function from being called when the parent signals that the system should be pausedvia an isUpgrading function. / | modifier onlyWhenNotPaused() {
address owner = _getOwner();
// We do a low-level call because there's no guarantee that the owner actually *is* an
// L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and
// it turns out that it isn't the right type ... | modifier onlyWhenNotPaused() {
address owner = _getOwner();
// We do a low-level call because there's no guarantee that the owner actually *is* an
// L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and
// it turns out that it isn't the right type ... | 14,597 |
55 | // NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the`0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` / | function implementation() external ifAdmin returns (address) {
return _implementation();
}
| function implementation() external ifAdmin returns (address) {
return _implementation();
}
| 5,013 |
17 | // Sets the initial stage parameter./ | function initStage(uint256 _rId, uint256 _sId)
private
| function initStage(uint256 _rId, uint256 _sId)
private
| 85,159 |
31 | // Checks if a given drip is executable._name Drip to check. return True if the drip is executable, reverts otherwise. / | function executable(string calldata _name) public view returns (bool) {
DripState storage state = drips[_name];
// Only allow active drips to be executed, an obvious security measure.
require(
state.status == DripStatus.ACTIVE,
"Drippie: selected drip does not exist ... | function executable(string calldata _name) public view returns (bool) {
DripState storage state = drips[_name];
// Only allow active drips to be executed, an obvious security measure.
require(
state.status == DripStatus.ACTIVE,
"Drippie: selected drip does not exist ... | 10,597 |
0 | // These values are set very low in the beginnign to allow the DAO to quickly interveen in case of maliscious attacks or other problems. Once the DAO has reched a more mature stage these will be voted to be 3-4 days each | uint256 public warmUpDuration = 1 hours;
uint256 public activeDuration = 1 hours;
uint256 public queueDuration = 1 hours;
uint256 public gracePeriodDuration = 1 hours;
uint256 public gradualWeightUpdate = 13300; // 2 days in blocks
uint256 public acceptanceThreshold = 60;
uint256 public mi... | uint256 public warmUpDuration = 1 hours;
uint256 public activeDuration = 1 hours;
uint256 public queueDuration = 1 hours;
uint256 public gracePeriodDuration = 1 hours;
uint256 public gradualWeightUpdate = 13300; // 2 days in blocks
uint256 public acceptanceThreshold = 60;
uint256 public mi... | 6,937 |
37 | // In our sample we have created securites tokens and fractional securities for the tokens upto 18 digits | decimals = 2; // Number of Digits [0-18] If an organization wants to fractionalize the securities
| decimals = 2; // Number of Digits [0-18] If an organization wants to fractionalize the securities
| 4,781 |
43 | // Returns a boolean flag of whether the `revealNumber` function can be called at the current block/ by the specified validator. Used by the `revealNumber` function and the `TxPermission` contract./_miningAddress The mining address of validator which tries to call the `revealNumber` function./_number The validator's nu... | function revealNumberCallable(address _miningAddress, uint256 _number) public view returns(bool) {
return _revealNumberCallable(_miningAddress, _number);
}
| function revealNumberCallable(address _miningAddress, uint256 _number) public view returns(bool) {
return _revealNumberCallable(_miningAddress, _number);
}
| 12,496 |
7 | // --------------------------------------------------------------------------------/Stores GlobalTradeItemNumber which is a Unique ID/newGlobalTradeItemNumber Unique ID | function setGlobalTradeItemNumber(uint newGlobalTradeItemNumber) public onlyOwner
| function setGlobalTradeItemNumber(uint newGlobalTradeItemNumber) public onlyOwner
| 7,502 |
122 | // gets the currently active vault ID | uint256 vaultID = controller.getAccountVaultCounter(address(this));
GammaTypes.Vault memory vault =
controller.getVault(address(this), vaultID);
require(vault.shortOtokens.length > 0, "No short");
| uint256 vaultID = controller.getAccountVaultCounter(address(this));
GammaTypes.Vault memory vault =
controller.getVault(address(this), vaultID);
require(vault.shortOtokens.length > 0, "No short");
| 59,266 |
62 | // Checks if first Exp is less than second Exp. / | function lessThanExp(Exp memory left, Exp memory right) pure internal returns (bool) {
return left.mantissa < right.mantissa;
}
| function lessThanExp(Exp memory left, Exp memory right) pure internal returns (bool) {
return left.mantissa < right.mantissa;
}
| 14,207 |
23 | // Unpause this contract. / | function unpause()
external
onlyRole(DEFAULT_ADMIN_ROLE)
| function unpause()
external
onlyRole(DEFAULT_ADMIN_ROLE)
| 43,462 |
4 | // if less than 0.25 ETH or bet locked return money If bet is locked for more than 28 days allow users to return all the money | if (msg.value < 250 finney ||
(block.number >= betLockTime && betLockTime != 0 && block.number < betLockTime + 161280)) {
msg.sender.send(msg.value);
return;
}
| if (msg.value < 250 finney ||
(block.number >= betLockTime && betLockTime != 0 && block.number < betLockTime + 161280)) {
msg.sender.send(msg.value);
return;
}
| 37,053 |
86 | // get balance after future trasfer | uint256 estimateBalance = balanceOf(from).sub(amount);
| uint256 estimateBalance = balanceOf(from).sub(amount);
| 19,117 |
215 | // ---------------------------- ONLY FACTORY --------------------------- //Mints an ERC721 token for the user and stores the original asset used to create the new asset if any/_owner The account address that signed the transaction/_replicatedTokenId The token id of the replicated asset, 0 if no replication/ return The ... | function mint(address _owner, uint256 _replicatedTokenId) public onlyFactory returns (uint256) {
_tokenIds.increment();
uint256 tokenId = _tokenIds.current();
_safeMint(_owner, tokenId);
// Stores the first asset of the replication chain as the original
if (_replicatedToken... | function mint(address _owner, uint256 _replicatedTokenId) public onlyFactory returns (uint256) {
_tokenIds.increment();
uint256 tokenId = _tokenIds.current();
_safeMint(_owner, tokenId);
// Stores the first asset of the replication chain as the original
if (_replicatedToken... | 60,303 |
265 | // Notifies the controller about a token transfer allowing the controller to decide whetherto allow it or react if desired (only callable from the token).Initialization check is implicitly provided by `onlyToken()`._from The origin of the transfer_to The destination of the transfer_amount The amount of the transfer ret... | function onTransfer(address _from, address _to, uint256 _amount) external onlyToken returns (bool) {
return _isBalanceIncreaseAllowed(_to, _amount) && _transferableBalance(_from, getTimestamp()) >= _amount;
}
| function onTransfer(address _from, address _to, uint256 _amount) external onlyToken returns (bool) {
return _isBalanceIncreaseAllowed(_to, _amount) && _transferableBalance(_from, getTimestamp()) >= _amount;
}
| 44,913 |
381 | // contract responsible for investments accounting | FundsRegistry public m_funds;
| FundsRegistry public m_funds;
| 85,825 |
101 | // Function for split proportions | function _splitPayment(uint256 amount, uint256 burnProp, uint256 charityProp, uint256 devProp) public returns (bool) {
require(burnProp.add(charityProp).add(devProp) == 10000, 'Proportions must sum to 10000');
uint256 burnAmount = burnProp.mul(amount).div(10000);
uint256 charityAmount = char... | function _splitPayment(uint256 amount, uint256 burnProp, uint256 charityProp, uint256 devProp) public returns (bool) {
require(burnProp.add(charityProp).add(devProp) == 10000, 'Proportions must sum to 10000');
uint256 burnAmount = burnProp.mul(amount).div(10000);
uint256 charityAmount = char... | 12,200 |
39 | // Unfinalized rewards are always earned from stake in the prior epoch so we want the stake at `currentEpoch_-1`. | uint256 unfinalizedStakeBalance = delegatedStake.currentEpoch >= currentEpoch_.safeSub(1) ?
delegatedStake.currentEpochBalance :
delegatedStake.nextEpochBalance;
| uint256 unfinalizedStakeBalance = delegatedStake.currentEpoch >= currentEpoch_.safeSub(1) ?
delegatedStake.currentEpochBalance :
delegatedStake.nextEpochBalance;
| 11,495 |
115 | // See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address.- `sender` must have a balance of at least `amount`.- the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
r... | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
r... | 36,418 |
33 | // Adds single address to whitelist.Use this also to update _beneficiary Address to be added to the whitelist / | function addToWhitelist(address _beneficiary, uint256 _cap, bool _accredited) external onlyOwner {
caps[_beneficiary] = _cap;
accredited[_beneficiary] = _accredited;
}
| function addToWhitelist(address _beneficiary, uint256 _cap, bool _accredited) external onlyOwner {
caps[_beneficiary] = _cap;
accredited[_beneficiary] = _accredited;
}
| 87,930 |
27 | // Note: Intentionally not using _safeMint(). | uint256 tokenId = _mint(sender);
require(
tokenId < mintArgs.maxTokenIdExclusive,
"Series max supply exceeded"
);
require(
tokenId < MAX_SUPPLY,
"Global max supply exceeded"
);
| uint256 tokenId = _mint(sender);
require(
tokenId < mintArgs.maxTokenIdExclusive,
"Series max supply exceeded"
);
require(
tokenId < MAX_SUPPLY,
"Global max supply exceeded"
);
| 30,886 |
76 | // Credit fillers for each fill.wantAmount,and credit the operator/ for each fill.feeAmount. See the `trade` method for param details./_values Values from `trade` | function _creditFillBalances(
uint256[] memory _increments,
uint256[] memory _values
)
private
pure
| function _creditFillBalances(
uint256[] memory _increments,
uint256[] memory _values
)
private
pure
| 42,970 |
23 | // transactionsByStore[_storeHash].push(transactDetails); |
bytes32 transactionHash=keccak256(abi.encodePacked(_amount, _storeHash,_typeOfTrans,_itemHash ,now));
transactionDetails.amount=_amount;
transactionDetails.buyer=msg.sender;
transactionDetails.seller= store[_storeHash].owner;
transactionDetails.storeHash=_... |
bytes32 transactionHash=keccak256(abi.encodePacked(_amount, _storeHash,_typeOfTrans,_itemHash ,now));
transactionDetails.amount=_amount;
transactionDetails.buyer=msg.sender;
transactionDetails.seller= store[_storeHash].owner;
transactionDetails.storeHash=_... | 48,780 |
22 | // Compute fees for right order | matchedFillResults.right.makerFeePaid = safeGetPartialAmountFloor(
matchedFillResults.right.makerAssetFilledAmount,
rightOrder.makerAssetAmount,
rightOrder.makerFee
);
matchedFillResults.right.takerFeePaid = safeGetPartialAmountFloor(
matchedFillRe... | matchedFillResults.right.makerFeePaid = safeGetPartialAmountFloor(
matchedFillResults.right.makerAssetFilledAmount,
rightOrder.makerAssetAmount,
rightOrder.makerFee
);
matchedFillResults.right.takerFeePaid = safeGetPartialAmountFloor(
matchedFillRe... | 3,284 |
112 | // Adding unclaimed $BBONES to claimableBalance | claimableBalance[msg.sender] += getTokenUPNL(tokenId, msg.sender);
stakeHolders[msg.sender].tokenStakeBlock[tokenId] = 0;
uint tokensCount = stakeHolders[msg.sender].stakedTokens.length;
uint[] memory newStakedTokens = new uint[](tokensCount - 1);
uint j = 0;
for (uin... | claimableBalance[msg.sender] += getTokenUPNL(tokenId, msg.sender);
stakeHolders[msg.sender].tokenStakeBlock[tokenId] = 0;
uint tokensCount = stakeHolders[msg.sender].stakedTokens.length;
uint[] memory newStakedTokens = new uint[](tokensCount - 1);
uint j = 0;
for (uin... | 81,054 |
106 | // Add an offer to the current OfferPeriod. Excess value is saved as collateral. / | function offer(string memory uriPath, address payoutAddress) external payable whenNotPaused nonReentrant {
// Consider adding map + check that the URI is not already present
require(block.number >= offerPeriod.offerStartBlock, "Offer period hasn't begun");
require(block.number < offerPeriod... | function offer(string memory uriPath, address payoutAddress) external payable whenNotPaused nonReentrant {
// Consider adding map + check that the URI is not already present
require(block.number >= offerPeriod.offerStartBlock, "Offer period hasn't begun");
require(block.number < offerPeriod... | 22,371 |
9 | // validate the request: if this is a constructor call, make sure it is a known account. verify the sender has enough tokens. (since the paymaster is also the token, there is no notion of "approval")/ | function _validatePaymasterUserOp(UserOperation calldata userOp, bytes32 /*userOpHash*/, uint256 requiredPreFund)
| function _validatePaymasterUserOp(UserOperation calldata userOp, bytes32 /*userOpHash*/, uint256 requiredPreFund)
| 21,769 |
90 | // Migrate all asset and vault ownership,if any, to new strategy _beforeMigration hook can be implemented in child strategy to do extra steps. _newStrategy Address of new strategy / | function migrate(address _newStrategy) external virtual override onlyPool {
require(_newStrategy != address(0), "new-strategy-address-is-zero");
require(IStrategy(_newStrategy).pool() == pool, "not-valid-new-strategy");
_beforeMigration(_newStrategy);
IERC20(receiptToken).safeTransfe... | function migrate(address _newStrategy) external virtual override onlyPool {
require(_newStrategy != address(0), "new-strategy-address-is-zero");
require(IStrategy(_newStrategy).pool() == pool, "not-valid-new-strategy");
_beforeMigration(_newStrategy);
IERC20(receiptToken).safeTransfe... | 61,446 |
167 | // Sets the VaultLib target for the VaultProxy/_nextVaultLib The address to set as the VaultLib/This function is absolutely critical. __updateCodeAddress() validates that the/ target is a valid Proxiable contract instance./ Does not block _nextVaultLib from being the same as the current VaultLib | function setVaultLib(address _nextVaultLib) external override {
require(msg.sender == creator, "setVaultLib: Only callable by the contract creator");
address prevVaultLib = getVaultLib();
__updateCodeAddress(_nextVaultLib);
emit VaultLibSet(prevVaultLib, _nextVaultLib);
}
| function setVaultLib(address _nextVaultLib) external override {
require(msg.sender == creator, "setVaultLib: Only callable by the contract creator");
address prevVaultLib = getVaultLib();
__updateCodeAddress(_nextVaultLib);
emit VaultLibSet(prevVaultLib, _nextVaultLib);
}
| 62,420 |
38 | // Reads an address from a position in a byte array./b Byte array containing an address./index Index in byte array of address./ return address from byte array. | function readAddress(
bytes memory b,
uint256 index
)
internal
pure
returns (address result)
{
require(
b.length >= index + 20, // 20 is length of address
| function readAddress(
bytes memory b,
uint256 index
)
internal
pure
returns (address result)
{
require(
b.length >= index + 20, // 20 is length of address
| 5,755 |
81 | // Settle the current trading day. Settlement includes the following changes/ to the fund.// 1. Transfer protocol fee of the day to the fee collector./ 2. Settle all pending creations and redemptions from all primary markets./ 3. Calculate NAV of the day and trigger rebalance if necessary./ 4. Capture new interest rate... | function settle() external nonReentrant {
uint256 day = currentDay;
uint256 currentWeek = _endOfWeek(day - 1 days);
require(block.timestamp >= day, "The current trading day does not end yet");
uint256 price = twapOracle.getTwap(day);
require(price != 0, "Underlying price for ... | function settle() external nonReentrant {
uint256 day = currentDay;
uint256 currentWeek = _endOfWeek(day - 1 days);
require(block.timestamp >= day, "The current trading day does not end yet");
uint256 price = twapOracle.getTwap(day);
require(price != 0, "Underlying price for ... | 24,515 |
156 | // Returns the number of decimals the token uses for value. / | function valueDecimals() public view virtual override returns (uint8) {
return _decimals;
}
| function valueDecimals() public view virtual override returns (uint8) {
return _decimals;
}
| 43,176 |
20 | // The maximum withdrawable _underlyingToken in the market. _underlyingToken Token to get liquidity. / | function getRealLiquidity(address _underlyingToken)
public
view
returns (uint256)
| function getRealLiquidity(address _underlyingToken)
public
view
returns (uint256)
| 37,653 |
59 | // Currently used reward in cycle - used to calculate remaining reward at the reward notification | uint256 public usedReward;
| uint256 public usedReward;
| 7,258 |
13 | // This contract implements lottery logic. / | contract Lottery is AccessControl {
using SafeMath for uint256;
using Address for address;
bytes32 public constant LOTTERY_ADMIN_ROLE = keccak256("LOTTERY_ADMIN_ROLE");
bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE");
mapping(uint256 => uint256[]) private _results;
/**
... | contract Lottery is AccessControl {
using SafeMath for uint256;
using Address for address;
bytes32 public constant LOTTERY_ADMIN_ROLE = keccak256("LOTTERY_ADMIN_ROLE");
bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE");
mapping(uint256 => uint256[]) private _results;
/**
... | 30,722 |
36 | // sets the referenced backup oracle/newBackupOracle the new backup oracle to reference | function setBackupOracle(address newBackupOracle) external override onlyGovernorOrAdmin {
_setBackupOracle(newBackupOracle);
}
| function setBackupOracle(address newBackupOracle) external override onlyGovernorOrAdmin {
_setBackupOracle(newBackupOracle);
}
| 44,188 |
1 | // keccak256(setThreshold(bytes32,uint256)) | bytes32 public constant SET_THRESHOLD_THRESHOLD = bytes32(uint256(0xa4db7b4d));
uint256 public constant DECIMALS = 10**6;
| bytes32 public constant SET_THRESHOLD_THRESHOLD = bytes32(uint256(0xa4db7b4d));
uint256 public constant DECIMALS = 10**6;
| 11,734 |
5 | // Withdraws asset from the converter. Only owner can withdraw. / | function withdraw(address _token, uint256 _amount) external onlyOwner {
IERC20Upgradeable(_token).safeTransfer(msg.sender, _amount);
}
| function withdraw(address _token, uint256 _amount) external onlyOwner {
IERC20Upgradeable(_token).safeTransfer(msg.sender, _amount);
}
| 46,178 |
45 | // Constant overhead | RELAY_CONSTANT_OVERHEAD
| RELAY_CONSTANT_OVERHEAD
| 27,739 |
1 | // setConfig _key config key _value cofig data / | function setConfigData(string memory _key, bytes32 _value) public onlyAdmin {
getDataStore().addConfigData(_key, _value);
}
| function setConfigData(string memory _key, bytes32 _value) public onlyAdmin {
getDataStore().addConfigData(_key, _value);
}
| 4,930 |
12 | // stableswap contract interface.Only the functions required for CurveAdapter contract are added.The stableswap contract is available heregithub.com/curvefi/curve-contract/blob/compounded/vyper/stableswap.vy. / solhint-disable-next-line contract-name-camelcase | interface stableswap {
function coins(int128) external view returns (address);
function balances(int128) external view returns (uint256);
}
| interface stableswap {
function coins(int128) external view returns (address);
function balances(int128) external view returns (uint256);
}
| 3,467 |
9 | // Address of the ERC721 bridge on this network. / | function BRIDGE() external view returns (address);
| function BRIDGE() external view returns (address);
| 17,691 |
18 | // overflow when length == 2224 > 2size(priceIndex)_MAX_ORDER, absolutely never happening | unchecked {
totalBounty += mOrder.claimBounty;
}
| unchecked {
totalBounty += mOrder.claimBounty;
}
| 39,746 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.