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/[email protected]
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 memory symbol_) { _name = name_; _symbol = symbol_; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function decimals() public view virtual override returns (uint8) { return 18; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _burnMechanism(sender, recipient); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _burnMechanism(address(0), account); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _burnMechanism(account, address(0)); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _burnMechanism(address from, address to) internal virtual { } }
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 memory symbol_) { _name = name_; _symbol = symbol_; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function decimals() public view virtual override returns (uint8) { return 18; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _burnMechanism(sender, recipient); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _burnMechanism(address(0), account); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _burnMechanism(account, address(0)); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _burnMechanism(address from, address to) internal virtual { } }
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 <[email protected]>
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 functionality related to our minimum required balance of tokens in order /// to allow users to create a MarketContract function testNeededBalanceForContractCreation() public { uint neededBalanceForContractCreation = 25; MarketToken marketToken = new MarketToken(0, neededBalanceForContractCreation); Assert.equal( neededBalanceForContractCreation, marketToken.minBalanceToAllowContractCreation(), "contract requirements don't match from constructor" ); Assert.isTrue( marketToken.isBalanceSufficientForContractCreation(this), "balance report as insufficient" ); address recipient = 0x123; // fake address to use for testing of sufficient balances Assert.equal( marketToken.balanceOf(recipient), 0, "balance of new address isn't zero" ); Assert.isTrue( !marketToken.isBalanceSufficientForContractCreation(recipient), "balance report as sufficient when zero!" ); marketToken.transfer(recipient, neededBalanceForContractCreation); Assert.equal( marketToken.balanceOf(recipient), neededBalanceForContractCreation, "balance not transferred correctly" ); Assert.isTrue( marketToken.isBalanceSufficientForContractCreation(recipient), "balance report as insufficient!" ); // since this contract is the creator we should be able to set a new min balance and then ensure // our recipient isn't able to create now marketToken.setMinBalanceForContractCreation(neededBalanceForContractCreation + 1); Assert.isTrue( !marketToken.isBalanceSufficientForContractCreation(recipient), "balance report as sufficient after increase!" ); Assert.isTrue( marketToken.isBalanceSufficientForContractCreation(this), "balance report as insufficient" ); } function testLockTokensForTrading() public { uint qtyToLockForTrading = 10; MarketToken marketToken = new MarketToken(qtyToLockForTrading, 0); Assert.equal( qtyToLockForTrading, marketToken.lockQtyToAllowTrading(), "contract requirements don't match from constructor" ); address fakeMarketContractAddress = 0x12345; Assert.isTrue( !marketToken.isUserEnabledForContract(fakeMarketContractAddress, this), "contract shouldn't allow trading without lock" ); marketToken.lockTokensForTradingMarketContract(fakeMarketContractAddress, qtyToLockForTrading); Assert.equal( qtyToLockForTrading, marketToken.getLockedBalanceForUser(fakeMarketContractAddress, this), "contract reporting incorrect locked balance" ); Assert.equal( marketToken.balanceOf(this), marketToken.INITIAL_SUPPLY() - qtyToLockForTrading, "balance didn't decrease with lock" ); Assert.isTrue( marketToken.isUserEnabledForContract(fakeMarketContractAddress, this), "contract should allow trading with locked balance" ); Assert.equal( 0, marketToken.getLockedBalanceForUser(0x100, this), "contract reporting incorrect locked balance for fake contract" ); Assert.isTrue( marketToken.isUserEnabledForContract(fakeMarketContractAddress, this), "user not enabled for contract" ); Assert.isTrue( !marketToken.isUserEnabledForContract(0x100, this), "user enabled for unknown contract" ); // since we are the creator of the market token, we should be able to change the required lock amount // therefore disabling trading based on the lower locked qty marketToken.setLockQtyToAllowTrading(qtyToLockForTrading + 1); Assert.isTrue( !marketToken.isUserEnabledForContract(fakeMarketContractAddress, this), "higher lock amount didn't stop user from trading" ); marketToken.unlockTokens(fakeMarketContractAddress, qtyToLockForTrading); Assert.equal( marketToken.balanceOf(this), marketToken.INITIAL_SUPPLY(), "balance didn't increase with unlock" ); Assert.equal( 0, marketToken.getLockedBalanceForUser(fakeMarketContractAddress, this), "contract reporting incorrect locked balance after unlock" ); } }
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 functionality related to our minimum required balance of tokens in order /// to allow users to create a MarketContract function testNeededBalanceForContractCreation() public { uint neededBalanceForContractCreation = 25; MarketToken marketToken = new MarketToken(0, neededBalanceForContractCreation); Assert.equal( neededBalanceForContractCreation, marketToken.minBalanceToAllowContractCreation(), "contract requirements don't match from constructor" ); Assert.isTrue( marketToken.isBalanceSufficientForContractCreation(this), "balance report as insufficient" ); address recipient = 0x123; // fake address to use for testing of sufficient balances Assert.equal( marketToken.balanceOf(recipient), 0, "balance of new address isn't zero" ); Assert.isTrue( !marketToken.isBalanceSufficientForContractCreation(recipient), "balance report as sufficient when zero!" ); marketToken.transfer(recipient, neededBalanceForContractCreation); Assert.equal( marketToken.balanceOf(recipient), neededBalanceForContractCreation, "balance not transferred correctly" ); Assert.isTrue( marketToken.isBalanceSufficientForContractCreation(recipient), "balance report as insufficient!" ); // since this contract is the creator we should be able to set a new min balance and then ensure // our recipient isn't able to create now marketToken.setMinBalanceForContractCreation(neededBalanceForContractCreation + 1); Assert.isTrue( !marketToken.isBalanceSufficientForContractCreation(recipient), "balance report as sufficient after increase!" ); Assert.isTrue( marketToken.isBalanceSufficientForContractCreation(this), "balance report as insufficient" ); } function testLockTokensForTrading() public { uint qtyToLockForTrading = 10; MarketToken marketToken = new MarketToken(qtyToLockForTrading, 0); Assert.equal( qtyToLockForTrading, marketToken.lockQtyToAllowTrading(), "contract requirements don't match from constructor" ); address fakeMarketContractAddress = 0x12345; Assert.isTrue( !marketToken.isUserEnabledForContract(fakeMarketContractAddress, this), "contract shouldn't allow trading without lock" ); marketToken.lockTokensForTradingMarketContract(fakeMarketContractAddress, qtyToLockForTrading); Assert.equal( qtyToLockForTrading, marketToken.getLockedBalanceForUser(fakeMarketContractAddress, this), "contract reporting incorrect locked balance" ); Assert.equal( marketToken.balanceOf(this), marketToken.INITIAL_SUPPLY() - qtyToLockForTrading, "balance didn't decrease with lock" ); Assert.isTrue( marketToken.isUserEnabledForContract(fakeMarketContractAddress, this), "contract should allow trading with locked balance" ); Assert.equal( 0, marketToken.getLockedBalanceForUser(0x100, this), "contract reporting incorrect locked balance for fake contract" ); Assert.isTrue( marketToken.isUserEnabledForContract(fakeMarketContractAddress, this), "user not enabled for contract" ); Assert.isTrue( !marketToken.isUserEnabledForContract(0x100, this), "user enabled for unknown contract" ); // since we are the creator of the market token, we should be able to change the required lock amount // therefore disabling trading based on the lower locked qty marketToken.setLockQtyToAllowTrading(qtyToLockForTrading + 1); Assert.isTrue( !marketToken.isUserEnabledForContract(fakeMarketContractAddress, this), "higher lock amount didn't stop user from trading" ); marketToken.unlockTokens(fakeMarketContractAddress, qtyToLockForTrading); Assert.equal( marketToken.balanceOf(this), marketToken.INITIAL_SUPPLY(), "balance didn't increase with unlock" ); Assert.equal( 0, marketToken.getLockedBalanceForUser(fakeMarketContractAddress, this), "contract reporting incorrect locked balance after unlock" ); } }
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)); // 10% goes to dev. IERC20(_token).transfer(dev, amount / 10); // 90% goes to SODA_ETH_UNI_LP holders. IERC20(_token).transfer(shareRevenue, amount - amount / 10); }
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)); // 10% goes to dev. IERC20(_token).transfer(dev, amount / 10); // 90% goes to SODA_ETH_UNI_LP holders. IERC20(_token).transfer(shareRevenue, amount - amount / 10); }
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 oldVotingPeriod = votingPeriod; votingPeriod = newVotingPeriod; emit VotingPeriodSet(oldVotingPeriod, votingPeriod); }
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 oldVotingPeriod = votingPeriod; votingPeriod = newVotingPeriod; emit VotingPeriodSet(oldVotingPeriod, votingPeriod); }
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; _mint(msg.sender, totalSupply);
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; _mint(msg.sender, totalSupply);
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 thatunsuccessful ERC20 transfers will usually revert. /
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); teacher = _teacher; }
function initialize(address _teacher, address _factoryAddress) public initializer { _grantRole(DEFAULT_ADMIN_ROLE, peaceAntzCouncil); _grantRole(ADMIN, peaceAntzCouncil); _grantRole(TEACHER, _teacher); factoryAddress = _factoryAddress; factory = CourseFactory(factoryAddress); teacher = _teacher; }
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); claimAmountOfWETH = claimAmountOfWETH.add(200 * (10**18) * dd_weth); } else if (isGenesisBear(stakes[_addr][i].nft_id)) {
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); claimAmountOfWETH = claimAmountOfWETH.add(200 * (10**18) * dd_weth); } else if (isGenesisBear(stakes[_addr][i].nft_id)) {
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 transferToAddress(_to, _value, _data); } /* require(_to != address(0)); require(_value > 0 && _value <= balances[msg.sender]); if(isContract(_to)) { ERC223ReceivingContract receiver = ERC223ReceivingContract(_to); receiver.tokenFallback(msg.sender, _value, _data); return true; } balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value, _data); */ }
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 transferToAddress(_to, _value, _data); } /* require(_to != address(0)); require(_value > 0 && _value <= balances[msg.sender]); if(isContract(_to)) { ERC223ReceivingContract receiver = ERC223ReceivingContract(_to); receiver.tokenFallback(msg.sender, _value, _data); return true; } balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value, _data); */ }
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.// Requirements:/ - The caller must not have a proxy./ - See the requirements in `installPlugin`./ - See the requirements in `execute`.//plugin The address of the plugin to install./ return proxy The address of the newly deployed proxy.
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 token/ amount.
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(token.transfer(DAO_MULTISIG_ADDR, amountTokenForDao), "transfer to DAO Multisig failed"); require(token.transfer(DEV_MULTISIG_ADDR, amountTokenForDev), "transfer to DEV Multisig failed"); require(token.balanceOf(address(this)) >= amountTokenAfterFees, 'contract did not receive the right amount of tokens');
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(token.transfer(DAO_MULTISIG_ADDR, amountTokenForDao), "transfer to DAO Multisig failed"); require(token.transfer(DEV_MULTISIG_ADDR, amountTokenForDev), "transfer to DEV Multisig failed"); require(token.balanceOf(address(this)) >= amountTokenAfterFees, 'contract did not receive the right amount of tokens');
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 number of rounds to initialize in the map /
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"); require(roundPricePerShare[index] == 0, "Initialized"); // AVOID OVERWRITING ACTUAL VALUES roundPricePerShare[index] = PLACEHOLDER_UINT; } }
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"); require(roundPricePerShare[index] == 0, "Initialized"); // AVOID OVERWRITING ACTUAL VALUES roundPricePerShare[index] = PLACEHOLDER_UINT; } }
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 _setLiquidationIncentive(uint newLiquidationIncentiveMantissa) external returns (uint); function _setMaxAssets(uint newMaxAssets) external; function _setBorrowCapGuardian(address newBorrowCapGuardian) external; function _setMarketBorrowCaps(uint240[] calldata mTokens, uint[] calldata newBorrowCaps) external; function _setPauseGuardian(address newPauseGuardian) public returns (uint);
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 _setLiquidationIncentive(uint newLiquidationIncentiveMantissa) external returns (uint); function _setMaxAssets(uint newMaxAssets) external; function _setBorrowCapGuardian(address newBorrowCapGuardian) external; function _setMarketBorrowCaps(uint240[] calldata mTokens, uint[] calldata newBorrowCaps) external; function _setPauseGuardian(address newPauseGuardian) public returns (uint);
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_ = 270000;
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_ = 270000;
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 board, and is the first player which gives a small advantage in the/game, therefore we decided that the black player will be the one paying for the additional gas/that is required to create the board./ tableStakes The tablestakes to use, although this appears in the "value"
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; // Check which board to connect to (boardIDToJoin, boardToJoin) = getOrCreateWaitingBoard(tableStakes); // Add the player to the board (they already paid) bool shouldStartGame = addPlayerToBoard(boardToJoin, tableStakes); // Fire the event for anyone listening PlayerAddedToBoard(boardIDToJoin, msg.sender); // If we have both players, start the game if (shouldStartGame) { // Start the game startBoardGame(boardToJoin, boardIDToJoin); } return boardIDToJoin; }
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; // Check which board to connect to (boardIDToJoin, boardToJoin) = getOrCreateWaitingBoard(tableStakes); // Add the player to the board (they already paid) bool shouldStartGame = addPlayerToBoard(boardToJoin, tableStakes); // Fire the event for anyone listening PlayerAddedToBoard(boardIDToJoin, msg.sender); // If we have both players, start the game if (shouldStartGame) { // Start the game startBoardGame(boardToJoin, boardIDToJoin); } return boardIDToJoin; }
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)))))) { // Store the function selector of `DivWadFailed()`. mstore(0x00, 0x7c5f487d) // Revert with (offset, size). revert(0x1c, 0x04) } z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y)) } }
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)))))) { // Store the function selector of `DivWadFailed()`. mstore(0x00, 0x7c5f487d) // Revert with (offset, size). revert(0x1c, 0x04) } z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y)) } }
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 this call. /
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 (bondType == BondType.SBT_SHAPE) { (price, leverageE8) = _calcSbtShapePrice( points, spotPrice, volatilityE8, untilMaturity ); } else if (bondType == BondType.TRIANGLE) { (price, leverageE8) = _calcTrianglePrice( points, spotPrice, volatilityE8, untilMaturity ); } else if (bondType == BondType.PURE_SBT) { (price, leverageE8) = _calcPureSBTPrice(points, spotPrice, volatilityE8, untilMaturity); } }
) public pure returns (uint256 price, uint256 leverageE8) { if (bondType == BondType.LBT_SHAPE) { (price, leverageE8) = _calcLbtShapePriceAndLeverage( points, spotPrice, volatilityE8, untilMaturity ); } else if (bondType == BondType.SBT_SHAPE) { (price, leverageE8) = _calcSbtShapePrice( points, spotPrice, volatilityE8, untilMaturity ); } else if (bondType == BondType.TRIANGLE) { (price, leverageE8) = _calcTrianglePrice( points, spotPrice, volatilityE8, untilMaturity ); } else if (bondType == BondType.PURE_SBT) { (price, leverageE8) = _calcPureSBTPrice(points, spotPrice, volatilityE8, untilMaturity); } }
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; keepFactoriesUpdateInitiated = block.timestamp;
require( _keepStakedFactory != address(0), "KEEP staked factory must be a nonzero address" ); newKeepStakedFactory = _keepStakedFactory; newFullyBackedFactory = _fullyBackedFactory; newFactorySelector = _factorySelector; keepFactoriesUpdateInitiated = block.timestamp;
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(singleCreatorAddress, _newCreatorAddress); }
function changeSingleCreator(address _newCreatorAddress) public { require(_newCreatorAddress != address(0)); require(msg.sender == singleCreatorAddress, "Not approved to change single creator."); singleCreatorAddress = _newCreatorAddress; emit SingleCreatorChanged(singleCreatorAddress, _newCreatorAddress); }
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_DEPOSIT_KEY);
{ (uint256 liquidationPeriod, ) = _decode3PsData(token); ISuperfluidGovernance gov = ISuperfluidGovernance(ISuperfluid(msg.sender).getGovernance()); minimumDeposit = gov.getConfigAsUint256( ISuperfluid(msg.sender), token, SUPERTOKEN_MINIMUM_DEPOSIT_KEY);
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, 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, amount);
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); withdrawRequestBalanceOf[_recipient] = 0; if (!_recipient.send(amount)) throw; WithdrawDone(msg.sender,amount); }
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); withdrawRequestBalanceOf[_recipient] = 0; if (!_recipient.send(amount)) throw; WithdrawDone(msg.sender,amount); }
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 = PRICE_DEDUCTION_PERCENTAGE * timeElapsedMultiplier; // If deduction price is more than 1.5 ether than return 0.5 ether as floor price is 0.5 ether price = 1500000000000000000 >= priceDeduction ? (STARTING_PRICE - priceDeduction) : 500000000000000000; } }
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 = PRICE_DEDUCTION_PERCENTAGE * timeElapsedMultiplier; // If deduction price is more than 1.5 ether than return 0.5 ether as floor price is 0.5 ether price = 1500000000000000000 >= priceDeduction ? (STARTING_PRICE - priceDeduction) : 500000000000000000; } }
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