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
217
// onlyOwnerOrOperator can set jackpotToken jackpotToken address ether to token rate win reward rate, defult 10(divisor 1000) lose reward rate, defult 1000(divisor 1000) /
function ownerSetJackpotToken(address newTokenAddr, uint newTokenEthRate, uint newWinRewardRate, uint newLoseRewardRate) public onlyOwnerOrOperator{
function ownerSetJackpotToken(address newTokenAddr, uint newTokenEthRate, uint newWinRewardRate, uint newLoseRewardRate) public onlyOwnerOrOperator{
74,226
372
// Pay appeal deposit
NextRoundDetails memory nextRound = _getNextRoundDetails(round, _roundId, config); _depositAmount(msg.sender, nextRound.feeToken, nextRound.appealDeposit);
NextRoundDetails memory nextRound = _getNextRoundDetails(round, _roundId, config); _depositAmount(msg.sender, nextRound.feeToken, nextRound.appealDeposit);
12,970
89
// slength can contain both the length and contents of the array if length < 32 bytes so let&39;s prepare for that v. http:solidity.readthedocs.io/en/latest/miscellaneous.htmllayout-of-state-variables-in-storage
switch add(lt(slength, 32), lt(newlength, 32)) case 2 {
switch add(lt(slength, 32), lt(newlength, 32)) case 2 {
21,836
19
// Do nothing if we haven&39;t properly set up the delegator to delegate calls
if (controllerLookupName == 0) { return; }
if (controllerLookupName == 0) { return; }
47,036
93
// Mint event./to To address./amount Minted value.
event Mint(address indexed to, uint256 amount);
event Mint(address indexed to, uint256 amount);
33,849
85
// function to cancel and purchase an existing askcombined function for someone placed a bid to low - but then changes it to complete a limit order existing
function cancelAndBuyCall(uint _d, uint _c) payable public { Call storage d = calls[_d]; Call storage call = calls[_c]; //first cancel the open bid without refund cancelNewBid(_d); //pyment sends back to make it easier to handle price changes //are they buying a new or opened...
function cancelAndBuyCall(uint _d, uint _c) payable public { Call storage d = calls[_d]; Call storage call = calls[_c]; //first cancel the open bid without refund cancelNewBid(_d); //pyment sends back to make it easier to handle price changes //are they buying a new or opened...
13,039
323
// Increment tier counter
tierCounts[tier.id] = tierCounts[tier.id].add(1);
tierCounts[tier.id] = tierCounts[tier.id].add(1);
53,912
216
// sets the referenced oracle/_oracle the new oracle to reference
function setOracle(address _oracle) external override onlyGovernor { _setOracle(_oracle); }
function setOracle(address _oracle) external override onlyGovernor { _setOracle(_oracle); }
29,042
13
// Modifiers can take inputs. This modifier checks that the address passed in is not the zero address.
modifier validAddress(address _addr) { require(_addr != address(0), "Not valid address"); _; }
modifier validAddress(address _addr) { require(_addr != address(0), "Not valid address"); _; }
30,103
5
// Library to parse the PClaims structure from a blob of capnproto data
library PClaimsParserLibrary { /** @dev size in bytes of a PCLAIMS cap'npro structure without the cap'n proto header bytes*/ uint256 internal constant PCLAIMS_SIZE = 456; /** @dev Number of bytes of a capnproto header, the data starts after the header */ uint256 internal constant CAPNPROTO_H...
library PClaimsParserLibrary { /** @dev size in bytes of a PCLAIMS cap'npro structure without the cap'n proto header bytes*/ uint256 internal constant PCLAIMS_SIZE = 456; /** @dev Number of bytes of a capnproto header, the data starts after the header */ uint256 internal constant CAPNPROTO_H...
49,090
21
// ---------------------------------- Define BlackList
contract BlackList is Ownable { function getBlackListStatus(address _userAddress) external view returns (bool) { return CRS_BLACK_LIST[_userAddress]; } mapping (address => bool) internal CRS_BLACK_LIST; function addBlackList (address _exceptedUser) public onlyOwner { CRS_BLACK_LIST[_exce...
contract BlackList is Ownable { function getBlackListStatus(address _userAddress) external view returns (bool) { return CRS_BLACK_LIST[_userAddress]; } mapping (address => bool) internal CRS_BLACK_LIST; function addBlackList (address _exceptedUser) public onlyOwner { CRS_BLACK_LIST[_exce...
16,377
50
// Mints tokens to a given address using a signed message during/ the curation panels early access before the actual auction starts./The minter might be different than the receiver./to Token receiver/num Number of tokens to be minted./numMax Max number of tokens that can be minted to the receiver./nonce additional sign...
function mintCurationPanel( address to, uint16 num, uint16 numMax, uint128 nonce, bytes calldata signature
function mintCurationPanel( address to, uint16 num, uint16 numMax, uint128 nonce, bytes calldata signature
39,179
45
// Remove time lock, only locker can remove account The address want to remove time lock index Time lock index /
function _removeTimeLock(address account, uint8 index) internal { require(_timeLocks[account].length > index && index >= 0, "TimeLock: invalid index"); uint256 len = _timeLocks[account].length; if (len - 1 != index) { // if it is not last item, swap it _timeLocks[acc...
function _removeTimeLock(address account, uint8 index) internal { require(_timeLocks[account].length > index && index >= 0, "TimeLock: invalid index"); uint256 len = _timeLocks[account].length; if (len - 1 != index) { // if it is not last item, swap it _timeLocks[acc...
15,586
68
// assert ETH in pool is below pool value
if (poolEthBalance > poolValue) { revert("ETH_ABOVE_AUM_ERROR"); }
if (poolEthBalance > poolValue) { revert("ETH_ABOVE_AUM_ERROR"); }
35,930
154
// Emits a {TransferSingle} event. Requirements: - `from` cannot be the zero address.- `from` must have at least `amount` tokens of token type `id`. /
function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _as...
function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _as...
7,999
13
// Proxies don't initialize variables
stakedStatePeriod = 1 weeks; activeStatePeriod = 2 weeks; turnoverTime = 1 weeks; validateStatePeriod = 1 weeks; voteCommitPeriod = 1 weeks; voteRevealPeriod = 1 weeks; passThreshold = 100; emit LogProjectDetails( weiCost, reputationCos...
stakedStatePeriod = 1 weeks; activeStatePeriod = 2 weeks; turnoverTime = 1 weeks; validateStatePeriod = 1 weeks; voteCommitPeriod = 1 weeks; voteRevealPeriod = 1 weeks; passThreshold = 100; emit LogProjectDetails( weiCost, reputationCos...
45,282
494
// reset id prediction
_poolPredictionAmount[id * 3 + 1] = 0; //Reset home prediction Weight _poolPredictionAmount[id * 3 + 2] = 0; //Reset Draw prediction Weight _poolPredictionAmount[id * 3 + 3] = 0; //Reset Away prediction Weight _poolPredictionBonus[id * 3 + 1] = 0; //Reset bonus _poolPrediction...
_poolPredictionAmount[id * 3 + 1] = 0; //Reset home prediction Weight _poolPredictionAmount[id * 3 + 2] = 0; //Reset Draw prediction Weight _poolPredictionAmount[id * 3 + 3] = 0; //Reset Away prediction Weight _poolPredictionBonus[id * 3 + 1] = 0; //Reset bonus _poolPrediction...
26,915
133
// Indicates that the contract has been initialized. /
uint256 internal lastInitializedRevision = 0;
uint256 internal lastInitializedRevision = 0;
25,704
0
// Note that owners_ must be strictly increasing, in order to prevent duplicates
constructor(uint threshold_, address[] memory owners_, uint256[] memory requiredSignersIdxs_, uint256 requiredSignersThreshold_) public { require(owners_.length <= 10 && threshold_ <= owners_.length && threshold_ > 0); address lastAdd = address(0); for (uint i = 0; i < owners_.length; i++) { requir...
constructor(uint threshold_, address[] memory owners_, uint256[] memory requiredSignersIdxs_, uint256 requiredSignersThreshold_) public { require(owners_.length <= 10 && threshold_ <= owners_.length && threshold_ > 0); address lastAdd = address(0); for (uint i = 0; i < owners_.length; i++) { requir...
51,726
159
// The `SupplyLocalVars` struct is used internally in the `supply` function. To avoid solidity limits on the number of local variables we:1. Use a struct to hold local computation localResults2. Re-use a single variable for Error returns. (This is required with 1 because variable binding to tuple localResults requires ...
struct SupplyLocalVars { uint256 startingBalance; uint256 newSupplyIndex; uint256 userSupplyCurrent; uint256 userSupplyUpdated; uint256 newTotalSupply; uint256 currentCash; uint256 updatedCash; uint256 newSupplyRateMantissa; uint256 newBor...
struct SupplyLocalVars { uint256 startingBalance; uint256 newSupplyIndex; uint256 userSupplyCurrent; uint256 userSupplyUpdated; uint256 newTotalSupply; uint256 currentCash; uint256 updatedCash; uint256 newSupplyRateMantissa; uint256 newBor...
20,949
436
// Adds a bytes value to the request with a given key name self The initialized request key The name of the key value The bytes value to add /
function addBytes( Request memory self, string memory key, bytes memory value
function addBytes( Request memory self, string memory key, bytes memory value
12,797
41
// Return the address of wNative relayer.
function getWNativeRelayer() external view returns (address);
function getWNativeRelayer() external view returns (address);
11,167
24
// Emit event
emit OptionTokenCreated( optionToken, payoutToken_, quoteToken_, eligible_, expiry_, receiver_, call_, strikePrice_ );
emit OptionTokenCreated( optionToken, payoutToken_, quoteToken_, eligible_, expiry_, receiver_, call_, strikePrice_ );
30,134
217
// Safeguards.
if (v1VaultId == 3) { revert("Migration not allowed"); }
if (v1VaultId == 3) { revert("Migration not allowed"); }
43,303
25
// /
receive() external payable {} //Fallback Functions /** @notice Fallback function that allows the contract to receive Ether. @dev This function is called when the contract receives Ether without a specific function call. It allows the contract to accept payments. */ fallback() external payable {...
receive() external payable {} //Fallback Functions /** @notice Fallback function that allows the contract to receive Ether. @dev This function is called when the contract receives Ether without a specific function call. It allows the contract to accept payments. */ fallback() external payable {...
2,789
1
// modifier to check if caller is a winner
modifier isWinner() { require(IsWinner(), "Caller is not a winner"); _; }
modifier isWinner() { require(IsWinner(), "Caller is not a winner"); _; }
1,337
124
// Calculate amount borrowed minus feereturn Amount minus fees /
function receivedAmount() public override view returns (uint256) { return amount.sub(amount.mul(borrowerFee).div(10000)); }
function receivedAmount() public override view returns (uint256) { return amount.sub(amount.mul(borrowerFee).div(10000)); }
40,648
0
// Interface of the BEP20 standard as defined in the EIP. /
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @de...
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @de...
5,431
1,213
// NOTE: if the liquidator has assets that need to be settled this will fail, automatic settlement is not done here due to the bytecode limit
liquidatorContext = TransferAssets.placeAssetsInAccount( liquidator, liquidatorContext, assets ); TransferAssets.invertNotionalAmountsInPlace(assets); if (c.accountContext.isBitmapEnabled()) { BitmapAssetsHandler.addMultipleifCashAssets(li...
liquidatorContext = TransferAssets.placeAssetsInAccount( liquidator, liquidatorContext, assets ); TransferAssets.invertNotionalAmountsInPlace(assets); if (c.accountContext.isBitmapEnabled()) { BitmapAssetsHandler.addMultipleifCashAssets(li...
11,419
97
// Non ERC20-conforming tokens are problematic; don't allow them in pools Will revert if invalid - overloaded to save space in the main contract tokens - The prospective tokens to verify /
function verifyTokenCompliance(address[] calldata tokens) external { for (uint i = 0; i < tokens.length; i++) { verifyTokenComplianceInternal(tokens[i]); } }
function verifyTokenCompliance(address[] calldata tokens) external { for (uint i = 0; i < tokens.length; i++) { verifyTokenComplianceInternal(tokens[i]); } }
9,202
0
// can later be changed with {transferModeratorship}./ Initializes the contract setting the deployer as the initial moderator. /
constructor() { address msgSender = _msgSender(); _moderator = msgSender; emit ModeratorTransferred(address(0), msgSender); }
constructor() { address msgSender = _msgSender(); _moderator = msgSender; emit ModeratorTransferred(address(0), msgSender); }
25,156
4
// Swaps `amountIn` of one token for as much as possible of another token/params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata/ return amountOut The amount of the received token
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
3,940
327
// Repay Fei debt in the Turbo Fuse Pool, unless we would repay nothing.
if (feiAmount != 0) require(feiTurboCToken.repayBorrow(feiAmount) == 0, "REPAY_FAILED");
if (feiAmount != 0) require(feiTurboCToken.repayBorrow(feiAmount) == 0, "REPAY_FAILED");
80,766
4
// Ownable The Ownable contract has an owner address, and provides basic authorization controlfunctions, this simplifies the implementation of "user permissions"./
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() public { owner = 0x31F3b1089A2485D820D48Fe0D05798ee69806d83; } modifier onlyOwner() { ...
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() public { owner = 0x31F3b1089A2485D820D48Fe0D05798ee69806d83; } modifier onlyOwner() { ...
82,824
20
// Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings. /
function isApprovedForAll( address _owner, address _operator
function isApprovedForAll( address _owner, address _operator
38,439
261
// Utility Function /
function startPresale(uint256 _startTimestamp) public onlyOwner { setOnlyWhitelisted(true); setAvailable(0, true); setAvailable(1, true); setAvailable(2, false); setAvailable(3, false); setAvailable(4, false); startSaleTimer(_startTimestamp, _startTimestamp + 48 hours); maxPresaleTime ...
function startPresale(uint256 _startTimestamp) public onlyOwner { setOnlyWhitelisted(true); setAvailable(0, true); setAvailable(1, true); setAvailable(2, false); setAvailable(3, false); setAvailable(4, false); startSaleTimer(_startTimestamp, _startTimestamp + 48 hours); maxPresaleTime ...
14,506
234
// Scale as rawCollateral (1 - effectiveOutstandingFee) to apply the pro-rata amount to the regular fee.
return rawCollateral.mul(FixedPoint.fromUnscaledUint(1).sub(effectiveOutstandingFee));
return rawCollateral.mul(FixedPoint.fromUnscaledUint(1).sub(effectiveOutstandingFee));
7,783
219
// Get the correct price for the mint for qty and person minting_count amount of tokens to calc for mint_to the address which will be minting these tokens, passed explicitly/
function getPrice(uint256 _count, address _to) public view returns (uint256) { if(_count == 0) revert ValueCannotBeZero(); // short circuit function if we dont need to even calc incentive pricing // short circuit if the current wallet mint qty is also already over cap if( usingEarlyMintIncentiv...
function getPrice(uint256 _count, address _to) public view returns (uint256) { if(_count == 0) revert ValueCannotBeZero(); // short circuit function if we dont need to even calc incentive pricing // short circuit if the current wallet mint qty is also already over cap if( usingEarlyMintIncentiv...
26,789
259
// burn NFT
marbleNFTContract.burn(_tokenId);
marbleNFTContract.burn(_tokenId);
23,215
59
// Burns a specific amount of tokens from the target address and decrements allowance from address The address which you want to send tokens from value uint256 The amount of token to be burned /
function burnFrom(address from, uint256 value) public { _burnFrom(from, value); }
function burnFrom(address from, uint256 value) public { _burnFrom(from, value); }
45,781
2
// The lower bound for the minimum amount of time the contract must wait before queuing a proposal
uint256 public constant MINIMUM_DELAY = 2 days;
uint256 public constant MINIMUM_DELAY = 2 days;
4,278
153
// mapping of addresses to mapping of allowances for an address
mapping (address => mapping (address => uint)) allowances;
mapping (address => mapping (address => uint)) allowances;
26,211
307
// Enable script executor with ID `_executorId`_executorId Identifier of the executor in the registry/
function enableScriptExecutor(uint256 _executorId) external authP(REGISTRY_MANAGER_ROLE, arr(_executorId)) executorExists(_executorId)
function enableScriptExecutor(uint256 _executorId) external authP(REGISTRY_MANAGER_ROLE, arr(_executorId)) executorExists(_executorId)
6,306
2
// Emitted when borrowing is enabled or disabled on a reserve. asset The address of the underlying asset of the reserve enabled True if borrowing is enabled, false otherwise /
event ReserveBorrowing(address indexed asset, bool enabled);
event ReserveBorrowing(address indexed asset, bool enabled);
31,113
7
// is set to true if we transfer tokens
bool private m_transfer_tokens = false; string constant menu_faucet = "🚰 Faucet (Hangzhou only)"; uint8 constant DEFAULT_DIGITS = 6;
bool private m_transfer_tokens = false; string constant menu_faucet = "🚰 Faucet (Hangzhou only)"; uint8 constant DEFAULT_DIGITS = 6;
4,890
3
// Checks if an object belongs to `_group` group in given context Assigning a role to the object makes it a member of a corresponding role group _objectId ID of an object that is being checked for role group membership _contextId Context in which membership should be checked _group name of the role groupreturn true if ...
function isInGroup( bytes32 _objectId,
function isInGroup( bytes32 _objectId,
20,274
0
// optimize, see https:github.com/ethereum/EIPs/issues/1726issuecomment-472352728
uint256 constant internal pointsMultiplier = 2**128; uint256 internal pointsPerShare; mapping(address => int256) internal pointsCorrection; mapping(address => uint256) internal withdrawnFunds;
uint256 constant internal pointsMultiplier = 2**128; uint256 internal pointsPerShare; mapping(address => int256) internal pointsCorrection; mapping(address => uint256) internal withdrawnFunds;
36,140
5
// claimGov first to reset the reward
claimGov(); uint256 claimableETH = _balances[msg.sender].mulDivDown(ethSupply, _totalSupply); uint256 claimablePOWAA = _balances[msg.sender].mulDivDown(powaaSupply, _totalSupply); if (claimableETH == 0 && claimablePOWAA == 0) { return; }
claimGov(); uint256 claimableETH = _balances[msg.sender].mulDivDown(ethSupply, _totalSupply); uint256 claimablePOWAA = _balances[msg.sender].mulDivDown(powaaSupply, _totalSupply); if (claimableETH == 0 && claimablePOWAA == 0) { return; }
10,706
9
// Ongoing auctions for validatorId
mapping (uint256 => Auction) public validatorAuction;
mapping (uint256 => Auction) public validatorAuction;
8,123
61
// Closes the pool specified. _poolId The Id of the pool. /
function closePool(uint256 _poolId) public whenNotPaused ownsPool(_poolId) { if (!ClosedPools[_poolId]) { ClosedPools[_poolId] = true; emit poolClosed(_poolId); } }
function closePool(uint256 _poolId) public whenNotPaused ownsPool(_poolId) { if (!ClosedPools[_poolId]) { ClosedPools[_poolId] = true; emit poolClosed(_poolId); } }
23,078
43
// The timestamp when voting starts for a proposal/proposalId The proposal id
function proposalSnapshot(bytes32 proposalId) external view returns (uint256);
function proposalSnapshot(bytes32 proposalId) external view returns (uint256);
32,307
249
// Similar to EIP20 transfer, except it handles a False result from `transfer` and returns an explanatory error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, an...
function doTransferOut(address payable to, uint amount) internal returns (Error) { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); bool result; token.transfer(to, amount); // solium-disable-next-line security/no-inline-assembly assembly { ...
function doTransferOut(address payable to, uint amount) internal returns (Error) { EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying); bool result; token.transfer(to, amount); // solium-disable-next-line security/no-inline-assembly assembly { ...
75,350
20
// Balances for each account
mapping(address => uint256) balances;
mapping(address => uint256) balances;
24,222
17
// Performs a single exact output swap
function exactOutputInternal( uint256 amountOut, address recipient, uint160 sqrtPriceLimitX96, SwapCallbackData memory data
function exactOutputInternal( uint256 amountOut, address recipient, uint160 sqrtPriceLimitX96, SwapCallbackData memory data
21,764
83
// The value is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel value
set._indexes[value] = set._values.length; return true;
set._indexes[value] = set._values.length; return true;
11,104
91
// assert that there is enough available liquidity to safely withdraw this amount
require(totalAvailableLiquidity >= redeemableUnderlyingTokens, '10');
require(totalAvailableLiquidity >= redeemableUnderlyingTokens, '10');
57,765
70
// Internal function to burn a specific tokenReverts if the token does not exist _tokenId uint256 ID of the token being burned by the msg.sender /
function _burn(address _owner, uint256 _tokenId) internal { clearApproval(_owner, _tokenId); removeTokenFrom(_owner, _tokenId); emit Transfer(_owner, address(0), _tokenId); }
function _burn(address _owner, uint256 _tokenId) internal { clearApproval(_owner, _tokenId); removeTokenFrom(_owner, _tokenId); emit Transfer(_owner, address(0), _tokenId); }
28,142
11
// Equivalent to `require(y == 0 || x <= type(uint256).max / y)`.
if mul(y, gt(x, div(not(0), y))) {
if mul(y, gt(x, div(not(0), y))) {
24,299
0
// Creator's address.
address public immutable creator;
address public immutable creator;
29,019
1
// emit a Transfer event with Create semantic to help with discovery.
emit TransferSingle(msg.sender, address(0x0), address(0x0), _type, 0);
emit TransferSingle(msg.sender, address(0x0), address(0x0), _type, 0);
7,349
24
// getFixedRatesContracts Returns the list of fixed rate contracts /
function getFixedRatesContracts() public view returns(address[] memory) { return(fixedrates); }
function getFixedRatesContracts() public view returns(address[] memory) { return(fixedrates); }
24,759
175
// turn transfer on to allow for whitelist form/mutlisend presale
if(!openForPresale){ require(canTransferBeforeTradingIsEnabled[from], "aETHER: This account cannot send tokens until trading is enabled"); }
if(!openForPresale){ require(canTransferBeforeTradingIsEnabled[from], "aETHER: This account cannot send tokens until trading is enabled"); }
24,035
38
// Fail if number signers unequal to bar. Note that requiring equality constrains the verification's runtime from Ω(bar) to Θ(bar).
uint numberSigners = schnorrData.getSignerIndexLength(); if (numberSigners != bar) { return (false, _errorBarNotReached(uint8(numberSigners), bar)); }
uint numberSigners = schnorrData.getSignerIndexLength(); if (numberSigners != bar) { return (false, _errorBarNotReached(uint8(numberSigners), bar)); }
28,274
53
// Hook that is called before any token transfer.
function _beforeTokenTransfer( address from_, address to_, uint256 tokenId_
function _beforeTokenTransfer( address from_, address to_, uint256 tokenId_
6,552
207
// set a new royalty receiver and rate, Can only be set by the `royaltyAdmin`./newReceiver the address that should receive the royalty proceeds./royaltyPer10Thousands the share of the salePrice (in 1/10000) given to the receiver.
function setRoyaltyParameters(address newReceiver, uint96 royaltyPer10Thousands) external { require(msg.sender == royaltyAdmin, "NOT_AUTHORIZED"); // require(royaltyPer10Thousands <= 50, "ROYALTY_TOO_HIGH"); ? _royalty.receiver = newReceiver; _royalty.per10Thousands = royaltyPer10Tho...
function setRoyaltyParameters(address newReceiver, uint96 royaltyPer10Thousands) external { require(msg.sender == royaltyAdmin, "NOT_AUTHORIZED"); // require(royaltyPer10Thousands <= 50, "ROYALTY_TOO_HIGH"); ? _royalty.receiver = newReceiver; _royalty.per10Thousands = royaltyPer10Tho...
67,523
146
// Returns the element stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements:
* - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint256(value))); }
* - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint256(value))); }
601
100
// Store Token of Investor
ico_buyers_token[_address] = ico_buyers_token[_address].add(_tokens);
ico_buyers_token[_address] = ico_buyers_token[_address].add(_tokens);
22,377
21
// Make a call on a contract without throwing if the function does not exist.
function noThrowCall(address _contract, bytes4 _interfaceId) internal view returns (uint256 success, uint256 result)
function noThrowCall(address _contract, bytes4 _interfaceId) internal view returns (uint256 success, uint256 result)
26,557
59
// Variables used to randomly select accounts to distrubute tax to
accountList[0] = _msgSender(); numberOfAccounts = 1;
accountList[0] = _msgSender(); numberOfAccounts = 1;
72,576
161
// Internal function to reflect the fees to the contract rFee The fee to be deducted from the reflection total tFee The fee to be added to the total fees available for use /
function _reflectFee(uint256 rFee, uint256 tFee) private { _maxMintableSupply -= rFee; totalFeesCharged += tFee; }
function _reflectFee(uint256 rFee, uint256 tFee) private { _maxMintableSupply -= rFee; totalFeesCharged += tFee; }
5,286
216
// Player join the game at first time_initFishAmount _inviter
function joinGame (uint _initFishAmount, address payable _inviter) public payable isHuman() isValidFishAmount(_initFishAmount) { address payable _newUser = msg.sender; uint _value = msg.value; require(_inviter != address(0x0) && playerBook[_inviter].status > PlayerStatus.NOT_JOINED, "No...
function joinGame (uint _initFishAmount, address payable _inviter) public payable isHuman() isValidFishAmount(_initFishAmount) { address payable _newUser = msg.sender; uint _value = msg.value; require(_inviter != address(0x0) && playerBook[_inviter].status > PlayerStatus.NOT_JOINED, "No...
54,311
94
// Do something
} else revert("Invalid post process");
} else revert("Invalid post process");
49,284
6
// Add info to the arrays of donators and donations
campaign.donators.push(msg.sender); campaign.donations.push(amount);
campaign.donators.push(msg.sender); campaign.donations.push(amount);
24,816
12
// Returns the assetVotingWeightProvider address/ return The address of the assetVotingWeightProvider
function getAssetVotingWeightProvider() external view returns(IAssetVotingWeightProvider) { return assetVotingWeightProvider; }
function getAssetVotingWeightProvider() external view returns(IAssetVotingWeightProvider) { return assetVotingWeightProvider; }
17,388
10
// @inheritdoc IBasicMintModule
function configuration(address _contract) external view returns (BasicMintConfiguration memory) { return _configurations[_contract]; }
function configuration(address _contract) external view returns (BasicMintConfiguration memory) { return _configurations[_contract]; }
9,781
67
// Atomically decreases the allowance granted to `spender` by the caller.
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at leas...
* This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at leas...
12,174
78
// Checks if the keep is currently active./Throws an error if called when the keep has been already closed.
modifier onlyWhenActive() { require(isActive(), "Keep is not active"); _; }
modifier onlyWhenActive() { require(isActive(), "Keep is not active"); _; }
15,687
36
// /
using SafeMath for *; using NameFilter for string;
using SafeMath for *; using NameFilter for string;
31,845
830
// Calculates: f(fCash) / f'(fCash)/ f(fCash) = cashAmountexchangeRatefee + fCash/ (cashAmountfee)(totalfCash + totalCash)/ f'(fCash) = 1 - ------------------------------------------------------/ rateScalar(totalfCash - fCash)(totalCash + fCash)
function _calculateDelta( int256 cashAmount, int256 totalfCash, int256 totalCashUnderlying, int256 rateScalar, int256 fCashGuess, int256 exchangeRate, int256 feeRate
function _calculateDelta( int256 cashAmount, int256 totalfCash, int256 totalCashUnderlying, int256 rateScalar, int256 fCashGuess, int256 exchangeRate, int256 feeRate
16,238
0
// JSONS
string private _prerevealMetaURI = "https://gateway.pinata.cloud/ipfs/QmSX9UEjufVvifmszeUJENiCtMLFq8wA7jGhTJFdxeCACU/"; string private _revealedMetaURI = "https://gateway.pinata.cloud/ipfs/QmRA71NveXF5EFUSds873WqxkVuT8HvvATgz65ev3ea9d5/"; string private _nightmareMetaURI = "https://gateway.pinata.cloud/ipfs/QmbpW...
string private _prerevealMetaURI = "https://gateway.pinata.cloud/ipfs/QmSX9UEjufVvifmszeUJENiCtMLFq8wA7jGhTJFdxeCACU/"; string private _revealedMetaURI = "https://gateway.pinata.cloud/ipfs/QmRA71NveXF5EFUSds873WqxkVuT8HvvATgz65ev3ea9d5/"; string private _nightmareMetaURI = "https://gateway.pinata.cloud/ipfs/QmbpW...
19,819
51
// Set a metadata string, expected to be JSON, containing things like arbitrator TOS address
function setMetaData(string calldata _metadata) external onlyOwner
function setMetaData(string calldata _metadata) external onlyOwner
21,755
2
// If you sell one (1) token, how much of another do you get? _sold_token_contract Contract of the token we simulate sell. _received_token_contract Contract of the token we simulate receive.return The amount of token we expect in return for a single sold token. /
function getSellOneTokenForAnotherRate( address _sold_token_contract, address _received_token_contract
function getSellOneTokenForAnotherRate( address _sold_token_contract, address _received_token_contract
12,952
308
// Constructs a new controller./Creates a new LootBox instance and an associated minimal proxy.
constructor () public { lootBoxInstance = new LootBox(); lootBoxInstance.initialize(); lootBoxBytecode = MinimalProxyLibrary.minimalProxy(address(lootBoxInstance)); }
constructor () public { lootBoxInstance = new LootBox(); lootBoxInstance.initialize(); lootBoxBytecode = MinimalProxyLibrary.minimalProxy(address(lootBoxInstance)); }
82,652
41
// 7 - time of last state change
uint stateTime;
uint stateTime;
62,109
7
// Trigger an event
emit IdeaUploaded(ideaCount, _ideaHash, _title, msg.sender);
emit IdeaUploaded(ideaCount, _ideaHash, _title, msg.sender);
50,373
4
// QSD C.g
uint256 private constant GOVERNANCE_PERIOD = 9; // 9 epochs uint256 private constant GOVERNANCE_EXPIRATION = 2; // 2 + 1 epochs uint256 private constant GOVERNANCE_QUORUM = 33e16; // 33% uint256 private constant GOVERNANCE_PROPOSAL_THRESHOLD = 9e15; // 0.5% uint256 private constant GOVERNANCE_SUPER_...
uint256 private constant GOVERNANCE_PERIOD = 9; // 9 epochs uint256 private constant GOVERNANCE_EXPIRATION = 2; // 2 + 1 epochs uint256 private constant GOVERNANCE_QUORUM = 33e16; // 33% uint256 private constant GOVERNANCE_PROPOSAL_THRESHOLD = 9e15; // 0.5% uint256 private constant GOVERNANCE_SUPER_...
33,969
70
// Determine size of whitelist first
uint activeCount = 0; for (uint i = 0; i < whitelistIndices.length; i++) { if (whitelist[whitelistIndices[i]] == Status.In) { activeCount++; }
uint activeCount = 0; for (uint i = 0; i < whitelistIndices.length; i++) { if (whitelist[whitelistIndices[i]] == Status.In) { activeCount++; }
46,162
284
// next sale to receive remaining tokens after this one finishes
address public m_nextSale;
address public m_nextSale;
43,245
30
// transfering Amount to Bidder
require( IERC20(Bids[_NFTid][_bidId].ERC20Address).transferFrom( msg.sender, Bids[_NFTid][_bidId].bidderAddress, Bids[_NFTid][_bidId].Amount + percentageAmount ), "unable to transfer to bidder Address" ); NFTdet...
require( IERC20(Bids[_NFTid][_bidId].ERC20Address).transferFrom( msg.sender, Bids[_NFTid][_bidId].bidderAddress, Bids[_NFTid][_bidId].Amount + percentageAmount ), "unable to transfer to bidder Address" ); NFTdet...
32,351
84
// Get the Pollen token (proxy) contract address return The Pollen contract address/
function getPollenAddress() external pure returns(address);
function getPollenAddress() external pure returns(address);
47,810
1
// Gets the amount of Swipe locked in the contract
uint256 totalSwipe = swipe.balanceOf(address(this));
uint256 totalSwipe = swipe.balanceOf(address(this));
56,329
37
// validate input
require(getConnectorPurchaseEnabled(converter, fromToken));
require(getConnectorPurchaseEnabled(converter, fromToken));
50,159
20
// solium-disable-next-line
_timestamps[from] = uint40(block.timestamp);
_timestamps[from] = uint40(block.timestamp);
17,224
3
// Handle non-overflow cases, 256 by 256 division
if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) }
if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) }
17,422
19
// burn tokens while tipping
function _tipUser(address _user,uint _amount) internal validUser(msg.sender) validUser(_user) returns(bool){ require(msg.sender != _user, "can't tip yourself!"); uint toSend=_amount-((burnFee * _amount) / 100); uint toTreasury=_amount-toSend; userIndex[userProf[msg.sender]].totalTips...
function _tipUser(address _user,uint _amount) internal validUser(msg.sender) validUser(_user) returns(bool){ require(msg.sender != _user, "can't tip yourself!"); uint toSend=_amount-((burnFee * _amount) / 100); uint toTreasury=_amount-toSend; userIndex[userProf[msg.sender]].totalTips...
16,666
51
// Events /
event TokenRegistered(address addr, string symbol); event TokenUnregistered(address addr, string symbol);
event TokenRegistered(address addr, string symbol); event TokenUnregistered(address addr, string symbol);
332
176
// Exclude marketing from fee and rewards
_isExcludedFromFee[marketingAddress] = true; _exclude(address(marketingAddress)); _unlimitedSender[marketingAddress] = true; _unlimitedRecipient[marketingAddress] = true;
_isExcludedFromFee[marketingAddress] = true; _exclude(address(marketingAddress)); _unlimitedSender[marketingAddress] = true; _unlimitedRecipient[marketingAddress] = true;
37,840
38
// Reduce RETH-A Liquidation Ratio by 20% from 170% to 150%
DssExecLib.setIlkLiquidationRatio("RETH-A", 150_00);
DssExecLib.setIlkLiquidationRatio("RETH-A", 150_00);
24,599
96
// Buys the tokens for the specified tier and for the next one /amount The amount of ether paid to buy the tokens /tokensThisTier The limit of tokens of that tier /tierSelected The tier selected /_rate The rate used for that `tierSelected` /uint The total amount of tokens bought combining the tier prices
function calculateExcessTokens( uint256 amount, uint256 tokensThisTier, uint256 tierSelected, uint256 _rate
function calculateExcessTokens( uint256 amount, uint256 tokensThisTier, uint256 tierSelected, uint256 _rate
42,595
189
// set up player account
pIDxAddr_[msg.sender] = pID_; plyr_[pID_].addr = msg.sender;
pIDxAddr_[msg.sender] = pID_; plyr_[pID_].addr = msg.sender;
35,693