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
150
// '(quantity == 1) << _BITPOS_NEXT_INITIALIZED'.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
36,371
37
// Repays the specified amount. _loanId The Id of the loan. _payment The amount being paid split into principal and interest. _owedAmount The total amount owed at the called timestamp. /
function _repayLoan( uint256 _loanId, Payment memory _payment, uint256 _owedAmount
function _repayLoan( uint256 _loanId, Payment memory _payment, uint256 _owedAmount
2,456
55
// Approve the metapool LP tokens for the vault contract
frax3crv_metapool.approve(address(stakedao_vault), _metapool_lp_in);
frax3crv_metapool.approve(address(stakedao_vault), _metapool_lp_in);
43,849
29
// File @openzeppelin/contracts/token/ERC20/ERC20.sol@v4.1.0
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; constructor (string memory name_, string memo...
contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; constructor (string memory name_, string memo...
9,075
138
// Overrides ERC1155MintBurn to change the batch birth events to creator transfers, and to set _supply
function _batchMint( address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data
function _batchMint( address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data
14,060
103
// Deposit the tokens into the farm
IDelorean(_farm).stake(_amount);
IDelorean(_farm).stake(_amount);
2,791
16
// Returns the admin address set via {setAdminAddress}./ return adminAddress address of the admin
function getAdminAddress() external view returns (address adminAddress) { return _adminAddress; }
function getAdminAddress() external view returns (address adminAddress) { return _adminAddress; }
37,974
5
// Smart Contract constructor /
constructor(address _billingAddress, address _offeringAddress) { billing = Billing(_billingAddress); offering = Offering(_offeringAddress); }
constructor(address _billingAddress, address _offeringAddress) { billing = Billing(_billingAddress); offering = Offering(_offeringAddress); }
7,039
76
// update the allowance value in storage
transferAllowances[_from][msg.sender] = _allowance;
transferAllowances[_from][msg.sender] = _allowance;
17,753
66
// _wallet Vault address /
function RefundVault(address _wallet) public { require(_wallet != address(0)); wallet = _wallet; state = State.Active; }
function RefundVault(address _wallet) public { require(_wallet != address(0)); wallet = _wallet; state = State.Active; }
50,380
1
// A group of Card structs.
struct CardGroup { Card[] cards; }
struct CardGroup { Card[] cards; }
48,662
142
// Ability to get voting results/ return number of tokens/ return total votes/ return agree/ return the opposite
function getVote() external view returns (uint, uint, uint, uint) { return ( totalSupply(), votedCounter[uint(VoteType.agree)] + votedCounter[uint(VoteType.disagree)], votedCounter[uint(VoteType.agree)], votedCounter[uint(VoteType.disagree)] ); ...
function getVote() external view returns (uint, uint, uint, uint) { return ( totalSupply(), votedCounter[uint(VoteType.agree)] + votedCounter[uint(VoteType.disagree)], votedCounter[uint(VoteType.agree)], votedCounter[uint(VoteType.disagree)] ); ...
16,012
114
// Gets the unlockable tokens of a specified address_of The address to query the the unlockable token count of/
function getUnlockableTokens(address _of)
function getUnlockableTokens(address _of)
31,767
1,151
// UniswapIncentive constructor/_core Fei Core to reference/_oracle Oracle to reference/_pair Uniswap Pair to incentivize/_router Uniswap Router
constructor( address _core, address _oracle, address _pair, address _router, uint32 _growthRate
constructor( address _core, address _oracle, address _pair, address _router, uint32 _growthRate
39,817
30
// Append storage space
properties.push();
properties.push();
16,974
5
// TestMarketToken/Phil Elsasser <phil@marketprotcol.io>
contract TestMarketToken { function testInitialBalance() public { MarketToken marketToken = new MarketToken(0, 0); Assert.equal( marketToken.balanceOf(this), marketToken.INITIAL_SUPPLY(), "init supply allocated to creator" ); } /// @dev tests fun...
contract TestMarketToken { function testInitialBalance() public { MarketToken marketToken = new MarketToken(0, 0); Assert.equal( marketToken.balanceOf(this), marketToken.INITIAL_SUPPLY(), "init supply allocated to creator" ); } /// @dev tests fun...
14,829
53
// Only shareRevenue can call this method. Currently _token is soETH.
function distribute(address _token) external { address shareRevenue = sodaMaster.strategyByKey(MK_STRATEGY_SHARE_REVENUE); require(msg.sender == shareRevenue, "sender not share-revenue"); address dev = sodaMaster.dev(); uint256 amount = IERC20(_token).balanceOf(address(this)); ...
function distribute(address _token) external { address shareRevenue = sodaMaster.strategyByKey(MK_STRATEGY_SHARE_REVENUE); require(msg.sender == shareRevenue, "sender not share-revenue"); address dev = sodaMaster.dev(); uint256 amount = IERC20(_token).balanceOf(address(this)); ...
51,979
119
// Adds or removes collections in blacklist /
function updateBlacklist(address[] memory collections, bool status) public onlyOwner
function updateBlacklist(address[] memory collections, bool status) public onlyOwner
40,556
133
// Admin function for setting the voting periodnewVotingPeriod new voting period, in blocks/
function __setVotingPeriod(uint newVotingPeriod) external { require(msg.sender == admin, "GovernorBravo::__setVotingPeriod: admin only"); require(newVotingPeriod >= MIN_VOTING_PERIOD && newVotingPeriod <= MAX_VOTING_PERIOD, "GovernorBravo::__setVotingPeriod: invalid voting period"); uint old...
function __setVotingPeriod(uint newVotingPeriod) external { require(msg.sender == admin, "GovernorBravo::__setVotingPeriod: admin only"); require(newVotingPeriod >= MIN_VOTING_PERIOD && newVotingPeriod <= MAX_VOTING_PERIOD, "GovernorBravo::__setVotingPeriod: invalid voting period"); uint old...
9,688
1
// while loop [not recomended or rarely used]
function whileLoop() public { uint j; while(j < 5) { j++; } }
function whileLoop() public { uint j; while(j < 5) { j++; } }
18,557
15
// We do not check if auction is over because the whitelist will be uploaded after the auction.
if(whitelistClaimed[msg.sender]) revert AlreadyClaimed(); if(totalSupply >= secondEvolutionOffset) revert MintedOut(); if(!isWhitelisted(msg.sender, signature)) revert NotWhitelisted(); if(msg.value < whitelistPrice) revert ValueTooLow(); whitelistClaimed[msg.sender] = true; ...
if(whitelistClaimed[msg.sender]) revert AlreadyClaimed(); if(totalSupply >= secondEvolutionOffset) revert MintedOut(); if(!isWhitelisted(msg.sender, signature)) revert NotWhitelisted(); if(msg.value < whitelistPrice) revert ValueTooLow(); whitelistClaimed[msg.sender] = true; ...
25,818
157
// YVAULT tokens created per block.
uint256 private yvaultPerBlock;
uint256 private yvaultPerBlock;
20,041
65
// Transfer `amount` of ERC20 token `token` to `recipient`. Only theowner may call this function. token ERC20Interface The ERC20 token to transfer. recipient address The account to transfer the tokens to. amount uint256 The amount of tokens to transfer.return A boolean to indicate if the transfer was successful - note ...
function withdraw( ERC20Interface token, address recipient, uint256 amount
function withdraw( ERC20Interface token, address recipient, uint256 amount
24,061
193
// Lock the resolver from any further modifications.This can only be called from the owner/ return _success if the operation is successful
function lock_resolver_forever() if_owner public returns (bool _success)
function lock_resolver_forever() if_owner public returns (bool _success)
53,282
17
// IERC165 supports an interfaceId/interfaceId The interfaceId to check/ return true if the interfaceId is supported
function supportsInterface(bytes4 interfaceId) external pure returns (bool) { return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; }
function supportsInterface(bytes4 interfaceId) external pure returns (bool) { return interfaceId == type(IAny2EVMMessageReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; }
37,070
10
// Reverts if `account` does not have `PORTFOLIO_ROLE` /
modifier onlyPortfolio(address account) { if (!hasRole(PORTFOLIO_ROLE, account)) { revert NotPortfolio(account); } _; }
modifier onlyPortfolio(address account) { if (!hasRole(PORTFOLIO_ROLE, account)) { revert NotPortfolio(account); } _; }
21,003
8
// Emitted when the collateral has been restored on the pool. amountOut Amount of the premium sold. collateralIn Amount of collateral restored. /
event RestoreCollateral(uint256 amountOut, uint256 collateralIn);
event RestoreCollateral(uint256 amountOut, uint256 collateralIn);
16,569
27
// babylonian method (https:en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method)
function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } }
function sqrt(uint256 y) internal pure returns (uint256 z) { if (y > 3) { z = y; uint256 x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } }
10,197
199
// Decrease the lock balance of a specific person.
function decreaseLockBalance(address _holder, uint256 _value) public onlyOwner returns (bool)
function decreaseLockBalance(address _holder, uint256 _value) public onlyOwner returns (bool)
53,189
9
// After factory deployment, this is thie first function the teacher writes and setsthe contract creator as the TEACHER and the multisig wallet as the ADMIN & Default Admin.
function initialize(address _teacher, address _factoryAddress) public initializer { _grantRole(DEFAULT_ADMIN_ROLE, peaceAntzCouncil); _grantRole(ADMIN, peaceAntzCouncil); _grantRole(TEACHER, _teacher); factoryAddress = _factoryAddress; factory = CourseFactory(factoryAddress);...
function initialize(address _teacher, address _factoryAddress) public initializer { _grantRole(DEFAULT_ADMIN_ROLE, peaceAntzCouncil); _grantRole(ADMIN, peaceAntzCouncil); _grantRole(TEACHER, _teacher); factoryAddress = _factoryAddress; factory = CourseFactory(factoryAddress);...
23,465
12
// return the og component
IERC1155(maxContract).safeTransferFrom( address(this), msg.sender, uint(ogMaxId), 1, "" );
IERC1155(maxContract).safeTransferFrom( address(this), msg.sender, uint(ogMaxId), 1, "" );
19,394
23
// Increase the value of the Vault of each slot by 1
a.Token[sub[i]]._value += 1;
a.Token[sub[i]]._value += 1;
14,156
202
// Now we need to compute e^x, where x is small (in particular, it is smaller than x9). We use the Taylor series expansion for e^x: 1 + x + (x^2 / 2!) + (x^3 / 3!) + ... + (x^n / n!).
int256 seriesSum = ONE_20; // The initial one in the sum, with 20 decimal places. int256 term; // Each term in the sum, where the nth term is (x^n / n!).
int256 seriesSum = ONE_20; // The initial one in the sum, with 20 decimal places. int256 term; // Each term in the sum, where the nth term is (x^n / n!).
13,391
139
// SROOTX and WETH
if (isSpecialBear(stakes[_addr][i].nft_id)) { uint256 dd_srootx = calDay(stakes[_addr][i].claimedDate_SROOT); uint256 dd_weth = dd_srootx; claimAmountOfSROOTxToken = claimAmountOfSROOTxToken.add(200 * (10**18) * dd_srootx); ...
if (isSpecialBear(stakes[_addr][i].nft_id)) { uint256 dd_srootx = calDay(stakes[_addr][i].claimedDate_SROOT); uint256 dd_weth = dd_srootx; claimAmountOfSROOTxToken = claimAmountOfSROOTxToken.add(200 * (10**18) * dd_srootx); ...
27,775
245
// Increment the position count if the default position is > 0
if (_defaultPositionVirtualUnit(component) > 0) { positionCount++; }
if (_defaultPositionVirtualUnit(component) > 0) { positionCount++; }
73,461
65
// Returns true if the pending transaction has been confirmed or if the given address has signed the transaction. _add, a former or active Unbank Owner address
function knowIfAlreadySignTransactionByAddress ( address _add ) external notNull(_add) view returns (bool)
function knowIfAlreadySignTransactionByAddress ( address _add ) external notNull(_add) view returns (bool)
39,399
5
// Array of keys -> TIMESTAMPs of requests
uint256 [] public keyList; function isEntity(uint256 entityTimestamp) public returns(bool isIndeed)
uint256 [] public keyList; function isEntity(uint256 entityTimestamp) public returns(bool isIndeed)
39,571
67
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data)public returns(bool) { require(!frozenAccount[msg.sender]); // Check if sender is frozen require(!frozenAccount[_to]); // Check if recipient is frozen if (isContract(_to)) { return transferToContract(_to, _value, _data); } else { return transferToAd...
function transfer(address _to, uint _value, bytes _data)public returns(bool) { require(!frozenAccount[msg.sender]); // Check if sender is frozen require(!frozenAccount[_to]); // Check if recipient is frozen if (isContract(_to)) { return transferToContract(_to, _value, _data); } else { return transferToAd...
28,175
28
// This function performs three actions:/ 1. Deploys a new proxy for the caller/ 2. Delegate calls to the provided target, returning the data it gets back, and bubbling up any potential revert./ 3. Installs the provided plugin on the newly deployed proxy.//Emits a {DeployProxy} and an {InstallPlugin} event.// Requireme...
function deployAndExecuteAndInstallPlugin( address target, bytes calldata data, IPRBProxyPlugin plugin ) external returns (IPRBProxy proxy);
function deployAndExecuteAndInstallPlugin( address target, bytes calldata data, IPRBProxyPlugin plugin ) external returns (IPRBProxy proxy);
33,805
122
// Rebalances the fees pool. Needed in every AddLiquidity / RemoveLiquidity call
function rebalanceFeesPool( uint256 marketId, uint256 liquidityShares, MarketAction action
function rebalanceFeesPool( uint256 marketId, uint256 liquidityShares, MarketAction action
30,560
15
// Get pairAddress
address factoryAddress; address pairAddress; if (routerAddress == 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) factoryAddress = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f; else factoryAddress = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac; assembly {
address factoryAddress; address pairAddress; if (routerAddress == 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) factoryAddress = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f; else factoryAddress = 0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac; assembly {
29,714
31
// Allows anyone to execute a confirmed transaction./transactionId Transaction ID.
function executeTransaction(uint transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId)
function executeTransaction(uint transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId)
3,591
9
// Sample buy quotes from KyberDmm./router Router to look up tokens and amounts/path Token route. Should be takerToken -> makerToken./makerTokenAmounts Maker token buy amount for each sample./ return pools The pool addresses involved in the multi path trade/ return takerTokenAmounts Taker amounts sold at each maker tok...
function sampleBuysFromKyberDmm( address router, address[] memory path, uint256[] memory makerTokenAmounts ) public view returns (address[] memory pools, uint256[] memory takerTokenAmounts)
function sampleBuysFromKyberDmm( address router, address[] memory path, uint256[] memory makerTokenAmounts ) public view returns (address[] memory pools, uint256[] memory takerTokenAmounts)
28,261
12
// Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance./
event Approval(address indexed owner, address indexed spender, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
3,324
11
// calculate how many array tokens correspond to the LP tokens that we got
uint256 amountArrayToMint = _calculateArrayGivenLPTokenAmount(amountLPReturned); require(amountArrayToMint + virtualSupply <= maxSupply, 'minted array > total supply'); require(token.transferFrom(msg.sender, address(this), amount), 'transfer from user to contract failed'); require(toke...
uint256 amountArrayToMint = _calculateArrayGivenLPTokenAmount(amountLPReturned); require(amountArrayToMint + virtualSupply <= maxSupply, 'minted array > total supply'); require(token.transferFrom(msg.sender, address(this), amount), 'transfer from user to contract failed'); require(toke...
50,795
442
// VAULT OPERATIONS // Helper function that helps to save gas for writing values into the roundPricePerShare map.Writing `1` into the map makes subsequent writes warm, reducing the gas from 20k to 5k.Having 1 initialized beforehand will not be an issue as long as we round down share calculations to 0. numRounds is the ...
function initRounds(uint256 numRounds) external nonReentrant { require(numRounds < 52, "numRounds >= 52"); uint256 _round = vaultState.round; for (uint256 i = 0; i < numRounds; i++) { uint256 index = _round + i; require(index >= _round, "Overflow"); requi...
function initRounds(uint256 numRounds) external nonReentrant { require(numRounds < 52, "numRounds >= 52"); uint256 _round = vaultState.round; for (uint256 i = 0; i < numRounds; i++) { uint256 index = _round + i; require(index >= _round, "Overflow"); requi...
51,775
0
// The company's trade mark, label, brand name. It also acts as the Name of all the Governance tokens created for this pool.
string public trademark;
string public trademark;
34,038
10
// transfer eth to winners.
for (uint256 i = 0; i < list.length; i++) { list[i].transfer(reward); }
for (uint256 i = 0; i < list.length; i++) { list[i].transfer(reward); }
20,859
31
// Indicator that this is a admin part contract (for inspection)
function isMDelegatorAdminImplementation() public pure returns (bool); function _supportMarket(uint240 mToken) external returns (uint); function _setPriceOracle(PriceOracle newOracle) external returns (uint); function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint); function _s...
function isMDelegatorAdminImplementation() public pure returns (bool); function _supportMarket(uint240 mToken) external returns (uint); function _setPriceOracle(PriceOracle newOracle) external returns (uint); function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint); function _s...
5,355
9
// Returns all IDs of registered Credential Item prices.return bytes32[] /
function getAllIds() external view returns (bytes32[]);
function getAllIds() external view returns (bytes32[]);
630
2
// ERC20
event Transfer( address indexed from, address indexed to, uint256 tokens ); string public name = "DFI DEX"; string public symbol = "DFDX"; uint8 constant public decimals = 0; uint256 public totalSupply_ = 900000000; uint256 constant internal tokenPriceInitial_ = 27000...
event Transfer( address indexed from, address indexed to, uint256 tokens ); string public name = "DFI DEX"; string public symbol = "DFDX"; uint8 constant public decimals = 0; uint256 public totalSupply_ = 900000000; uint256 constant internal tokenPriceInitial_ = 27000...
20,629
121
// Add a symbol to a token that has already been registered and confirmedtokenAddress The address of the `IERC20` compliant token contract the symbol willidentify symbol The symbol identifying the token asset /
function addTokenSymbol(IERC20 tokenAddress, string calldata symbol) external onlyAdmin
function addTokenSymbol(IERC20 tokenAddress, string calldata symbol) external onlyAdmin
26,831
3
// Status of Message: 0 - None - message has not been proven or processed 1 - Proven - message inclusion proof has been validated 2 - Processed - message has been dispatched to recipient
enum MessageStatus { None, Proven, Processed }
enum MessageStatus { None, Proven, Processed }
20,647
88
// add Tx hash for the hash string uploaded to blockchain _hash is input value of hash _txHash is the Tx hash value generated by action of inserting hashreturn bool,true is successful and false is failed /
function addTxIdForOnchainData(string memory _hash, string memory _txHash) public onlyOwner returns (bool)
function addTxIdForOnchainData(string memory _hash, string memory _txHash) public onlyOwner returns (bool)
2,385
9
// Creates the campaign. Total time limit is `commitTimeLimit_` + `revealTimeLimit_`. /
function cCreateCampaign( uint256 commitTimeLimit_, uint256 revealTimeLimit_ ) public returns ( uint256 campaignNum_
function cCreateCampaign( uint256 commitTimeLimit_, uint256 revealTimeLimit_ ) public returns ( uint256 campaignNum_
24,329
136
// Sets bid minimum raise percentage value _bidMinimumRaisePerMillion - amount, from 0 to 999,999 /
function setBidMinimumRaisePerMillion(uint256 _bidMinimumRaisePerMillion) external;
function setBidMinimumRaisePerMillion(uint256 _bidMinimumRaisePerMillion) external;
37,784
107
// This is the first function a player will be using in order to start playing. This function allows /to register to an existing or a new board, depending on the current available boards./Upon registeration the player will pay the board's stakes and will be the black or white player./The black player also creates the b...
function registerPlayerToBoard(uint tableStakes) external payable allowedValuesOnly(msg.value) whenNotPaused returns(uint) { // Make sure the value and tableStakes are the same require (msg.value == tableStakes); GoBoard storage boardToJoin; uint boardIDToJoin; // Ch...
function registerPlayerToBoard(uint tableStakes) external payable allowedValuesOnly(msg.value) whenNotPaused returns(uint) { // Make sure the value and tableStakes are the same require (msg.value == tableStakes); GoBoard storage boardToJoin; uint boardIDToJoin; // Ch...
33,033
21
// Emitted when not in live state
error NotLive();
error NotLive();
22,718
69
// if upgraded transfer the jackpot seed to the new version
vaults[nextVersion].totalReturns = jackpotSeed; jackpotSeed = 0;
vaults[nextVersion].totalReturns = jackpotSeed; jackpotSeed = 0;
34,872
41
// verify the access permission
require(isSenderInRole(ROLE_URI_MANAGER), "access denied");
require(isSenderInRole(ROLE_URI_MANAGER), "access denied");
38,638
4
// Source: https:ethereum.stackexchange.com/questions/9142/how-to-convert-a-string-to-bytes32
function stringToBytes32(string memory source) returns (bytes32 result) { bytes memory tempEmptyStringTest = bytes(source); if (tempEmptyStringTest.length == 0) { return 0x0; } assembly { result := mload(add(source, 32)) } }
function stringToBytes32(string memory source) returns (bytes32 result) { bytes memory tempEmptyStringTest = bytes(source); if (tempEmptyStringTest.length == 0) { return 0x0; } assembly { result := mload(add(source, 32)) } }
21,471
4
// Emitted when borrow cap guardian is changed
event NewBorrowCapGuardian( address oldBorrowCapGuardian, address newBorrowCapGuardian );
event NewBorrowCapGuardian( address oldBorrowCapGuardian, address newBorrowCapGuardian );
28,873
12
// Hash of the transaction the output belongs to./Byte order corresponds to the Bitcoin internal byte order.
bytes32 txHash;
bytes32 txHash;
10,832
29
// Equivalent to `(xWAD) / y` rounded up.
function divWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`. if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) { ...
function divWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`. if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) { ...
23,915
186
// Add an ERC-20 contract as being a valid payment method. If passed a contract which has not been added it will assume the default value of zero. This should not be used to create new payment tokens._erc20TokenContract address of ERC-20 contract in question/
function enableERC20ContractAsPayment(address _erc20TokenContract) public onlyTeamOrOwner { allowedTokenContracts[_erc20TokenContract].isActive = true; }
function enableERC20ContractAsPayment(address _erc20TokenContract) public onlyTeamOrOwner { allowedTokenContracts[_erc20TokenContract].isActive = true; }
9,733
89
// still store it to work with EIP-1967
_changeAdmin(initAdmin);
_changeAdmin(initAdmin);
45,500
3
// Fallbacks to return ETH flippantly sent
receive() payable external { require(false); }
receive() payable external { require(false); }
48,308
14
// Sets `token`'s balance in a General Pool to the result of the `mutation` function when called with thecurrent balance and `amount`. This function assumes `poolId` exists, corresponds to the General specialization setting, and that `token` isregistered for that Pool. Returns the managed balance delta as a result of t...
function _updateGeneralPoolBalance( bytes32 poolId, IERC20 token, function(bytes32, uint256) returns (bytes32) mutation, uint256 amount
function _updateGeneralPoolBalance( bytes32 poolId, IERC20 token, function(bytes32, uint256) returns (bytes32) mutation, uint256 amount
33,809
1
// Post-release data
string release; // Proof string of perception bool released; // Whether this proof has been released or not uint releaseTime; // Unix timestamp of the proof's release uint releaseBlockNum; // Latest block number during proof release
string release; // Proof string of perception bool released; // Whether this proof has been released or not uint releaseTime; // Unix timestamp of the proof's release uint releaseBlockNum; // Latest block number during proof release
55,996
9
// recoveredAddress is not validator or has been visited
if (validatorIndex >= validators_.length || validatorIndexVisited[validatorIndex]) { continue; }
if (validatorIndex >= validators_.length || validatorIndexVisited[validatorIndex]) { continue; }
37,698
2
// Returns the amount of tokens owned by `account`. /
function balanceOf(address account) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
74,367
4
// only managers can mint & burn tokens
function mint(address _to, uint256 _amount) public{ require(Managers[msg.sender], "Only manager can mint"); _mint(_to, _amount); }
function mint(address _to, uint256 _amount) public{ require(Managers[msg.sender], "Only manager can mint"); _mint(_to, _amount); }
39,189
73
// 15 months lockup period
lockPeriod = 15 days * 30; require(timePassed >= lockPeriod); require (tokensForReservedFund >0);
lockPeriod = 15 days * 30; require(timePassed >= lockPeriod); require (tokensForReservedFund >0);
44,876
3
// fired whenever theres a withdraw
event onWithdraw ( uint256 indexed playerID, address playerAddress, bytes32 playerName, uint256 ethOut, uint256 timeStamp );
event onWithdraw ( uint256 indexed playerID, address playerAddress, bytes32 playerName, uint256 ethOut, uint256 timeStamp );
5,108
180
// Mapping from token ID to approved address
mapping (uint256 => address) private _tokenApprovals;
mapping (uint256 => address) private _tokenApprovals;
6,311
5
// Proof of a derivative specification/Verifies that contract is a derivative specification/ return true if contract is a derivative specification
function isDerivativeSpecification() external pure returns (bool);
function isDerivativeSpecification() external pure returns (bool);
14,379
26
// even though this is constant we want to make sure that it&39;s actually callable on Ethereum so we don&39;t accidentally package the constant code in with an SC using BBLib. This function _must_ be external.
return BB_VERSION;
return BB_VERSION;
18,350
160
// Change the creator address for given token _to Address of the new creator _idToken IDs to change creator of /
function _setCreator(address _to, uint256 _id) internal creatorOnly(_id)
function _setCreator(address _to, uint256 _id) internal creatorOnly(_id)
769
51
// Calculate bond price and leverage by black-scholes formula. bondType type of target bond. points coodinates of polyline which is needed for price calculation untilMaturity Remaining period of target bond in second /
) public pure returns (uint256 price, uint256 leverageE8) { if (bondType == BondType.LBT_SHAPE) { (price, leverageE8) = _calcLbtShapePriceAndLeverage( points, spotPrice, volatilityE8, untilMaturity ); } else if (...
) public pure returns (uint256 price, uint256 leverageE8) { if (bondType == BondType.LBT_SHAPE) { (price, leverageE8) = _calcLbtShapePriceAndLeverage( points, spotPrice, volatilityE8, untilMaturity ); } else if (...
76,848
15
// checks if token is enabled
function tokenEnabled(uint256 _tokenType) public view returns (bool) { return enabledTokens.length > enabledTokenIndex[_tokenType] && enabledTokens[enabledTokenIndex[_tokenType]] == _tokenType; }
function tokenEnabled(uint256 _tokenType) public view returns (bool) { return enabledTokens.length > enabledTokenIndex[_tokenType] && enabledTokens[enabledTokenIndex[_tokenType]] == _tokenType; }
34,976
20
// Determines the ratio of past verdicts that the arbiter has responded toarbiter The address of the arbiterreturn number of bounties responded to, number of bounties considered /
function arbiterResponseRate(address arbiter) public view returns (uint256 num, uint256 den) { num = bountyResponses[arbiter]; den = numBounties; }
function arbiterResponseRate(address arbiter) public view returns (uint256 num, uint256 den) { num = bountyResponses[arbiter]; den = numBounties; }
3,076
20
// It is required that KEEP staked factory address is configured as this is a default choice factory. Fully backed factory and factory selector are optional for the system to work, hence they don't have to be provided.
require( _keepStakedFactory != address(0), "KEEP staked factory must be a nonzero address" ); newKeepStakedFactory = _keepStakedFactory; newFullyBackedFactory = _fullyBackedFactory; newFactorySelector = _factorySelector; keepFactoriesUpdateInitiat...
require( _keepStakedFactory != address(0), "KEEP staked factory must be a nonzero address" ); newKeepStakedFactory = _keepStakedFactory; newFullyBackedFactory = _fullyBackedFactory; newFactorySelector = _factorySelector; keepFactoriesUpdateInitiat...
41,481
86
// Transfers ETH rewards amount (if ETH rewards is configured) to Forecasting contract
function mintETHRewards(address _contract, uint256 _amount) public onlyManager();
function mintETHRewards(address _contract, uint256 _amount) public onlyManager();
51,497
5
// Modifier that requires the airline to fulfill a minimun funding /
modifier requireMinimumFunding() { require( msg.value >= airlineRegistrationFee, "Funding requirement not met" ); _; }
modifier requireMinimumFunding() { require( msg.value >= airlineRegistrationFee, "Funding requirement not met" ); _; }
15,143
56
// A publicly accessible function that allows the current single creatorassigned to this contract to change to another address. /
function changeSingleCreator(address _newCreatorAddress) public { require(_newCreatorAddress != address(0)); require(msg.sender == singleCreatorAddress, "Not approved to change single creator."); singleCreatorAddress = _newCreatorAddress; emit SingleCreatorChanged(singleCreatorAddres...
function changeSingleCreator(address _newCreatorAddress) public { require(_newCreatorAddress != address(0)); require(msg.sender == singleCreatorAddress, "Not approved to change single creator."); singleCreatorAddress = _newCreatorAddress; emit SingleCreatorChanged(singleCreatorAddres...
6,575
81
// Pause the ACB in emergency cases. Only the genesis account can call this method.
function pause()
function pause()
10,547
129
// STEP 1: calculate deposit required for the flow
{ (uint256 liquidationPeriod, ) = _decode3PsData(token); ISuperfluidGovernance gov = ISuperfluidGovernance(ISuperfluid(msg.sender).getGovernance()); minimumDeposit = gov.getConfigAsUint256( ISuperfluid(msg.sender), token, SUPERTOKEN_MINIMUM...
{ (uint256 liquidationPeriod, ) = _decode3PsData(token); ISuperfluidGovernance gov = ISuperfluidGovernance(ISuperfluid(msg.sender).getGovernance()); minimumDeposit = gov.getConfigAsUint256( ISuperfluid(msg.sender), token, SUPERTOKEN_MINIMUM...
34,612
136
// Increase the _amount of tokens that an owner has allowed to a _spender.This method should be used instead of approve() to avoid the double approval vulnerabilitydescribed above. _spender The address which will spend the funds. _addedValue The _amount of tokens to increase the allowance by. /
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool)
function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool)
5,327
106
// Limit the nubmer of zero order assets the owner can create every day
uint256 public zoDailyLimit = 1000; // we can create 4 * 1000 = 4000 0-order asset each day uint256[4] public zoCreated;
uint256 public zoDailyLimit = 1000; // we can create 4 * 1000 = 4000 0-order asset each day uint256[4] public zoCreated;
42,433
7
// percentage fee for a destination
function feePercent(string calldata destination) external view returns (uint256);
function feePercent(string calldata destination) external view returns (uint256);
25,277
1
// See {ERC20-_mint}. Requirements: - the caller must be the owner. /
function mint(address to, uint256 amount) public virtual onlyOwner { _mint(to, amount); }
function mint(address to, uint256 amount) public virtual onlyOwner { _mint(to, amount); }
33,980
100
// The maximum RiskParam values that can be set
struct RiskLimits { uint64 marginRatioMax; uint64 liquidationSpreadMax; uint64 earningsRateMax; uint64 marginPremiumMax; uint64 spreadPremiumMax; uint128 minBorrowedValueMax; }
struct RiskLimits { uint64 marginRatioMax; uint64 liquidationSpreadMax; uint64 earningsRateMax; uint64 marginPremiumMax; uint64 spreadPremiumMax; uint128 minBorrowedValueMax; }
36,100
34
// we do not want to allow the lendee to close the loan and then draw again but if the loan was closed be seizing collateral, then lendee should still be ableto draw the full amount
require(!ticket.closed || ticket.collateralSeized, "NFTPawnShop: ticket closed"); ticket.loanAmount.sub(ticket.loanAmountDrawn).sub(amount, "NFTPawnShop: Insufficient loan balance"); ticket.loanAmountDrawn = ticket.loanAmountDrawn + amount; IERC20(ticket.loanAsset).transfer(msg.sender, a...
require(!ticket.closed || ticket.collateralSeized, "NFTPawnShop: ticket closed"); ticket.loanAmount.sub(ticket.loanAmountDrawn).sub(amount, "NFTPawnShop: Insufficient loan balance"); ticket.loanAmountDrawn = ticket.loanAmountDrawn + amount; IERC20(ticket.loanAsset).transfer(msg.sender, a...
10,002
6
// (fomo3d long only) fired whenever a player tries a reload after round timerhit zero, and causes end round to be ran.
event onReLoadAndDistribute ( address playerAddress, bytes32 playerName, uint256 compressedData, uint256 compressedIDs, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot,
event onReLoadAndDistribute ( address playerAddress, bytes32 playerName, uint256 compressedData, uint256 compressedIDs, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot,
7,607
17
// Numerator for cobb douglas alpha factor.
uint32 public cobbDouglasAlphaNumerator;
uint32 public cobbDouglasAlphaNumerator;
25,122
12
// destroy tokens and send corresponding Eth to the specified address. _recipient The address which will recieve the Eth /
function validateWithdraw(address _recipient) onlyOwner() { uint256 tokens = withdrawRequestBalanceOf[_recipient]; require(tokens > 0); uint256 amount = tokens.div(getPrice()); totalSupply = totalSupply.sub(tokens); balances[_recipient] = balances[_recipient].sub(tokens); withdrawRequestBal...
function validateWithdraw(address _recipient) onlyOwner() { uint256 tokens = withdrawRequestBalanceOf[_recipient]; require(tokens > 0); uint256 amount = tokens.div(getPrice()); totalSupply = totalSupply.sub(tokens); balances[_recipient] = balances[_recipient].sub(tokens); withdrawRequestBal...
23,984
39
// Phases list, see schedule in constructor
mapping (uint => Phase) phases;
mapping (uint => Phase) phases;
36,223
178
// Returns current price of dutch auction
function dutchAuction() public view returns (uint256 price) { if (auctionStartAt == 0) { return STARTING_PRICE; } else { uint256 timeElapsed = block.timestamp - auctionStartAt; uint256 timeElapsedMultiplier = timeElapsed / 300; uint256 priceDeduction =...
function dutchAuction() public view returns (uint256 price) { if (auctionStartAt == 0) { return STARTING_PRICE; } else { uint256 timeElapsed = block.timestamp - auctionStartAt; uint256 timeElapsedMultiplier = timeElapsed / 300; uint256 priceDeduction =...
24,899
27
// Make sure it is PHX we are receiving
require(msg.sender == phxAddress);
require(msg.sender == phxAddress);
3,505
441
// ROUND
function newRound( string memory roundName, uint128 _price, uint32 _quota, uint16 _amountPerUser, bool _isActive, bool _isPublic, bool _isMerkle, address _tokenAddress
function newRound( string memory roundName, uint128 _price, uint32 _quota, uint16 _amountPerUser, bool _isActive, bool _isPublic, bool _isMerkle, address _tokenAddress
28,507