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
3
// Destroy this contract after the airdrop. /
function destruct() external onlyOwner { address _owner = owner(); DPS.transfer(_owner, DPS.balanceOf(address(this))); renounceOwnership(); selfdestruct(payable(_owner)); }
function destruct() external onlyOwner { address _owner = owner(); DPS.transfer(_owner, DPS.balanceOf(address(this))); renounceOwnership(); selfdestruct(payable(_owner)); }
29,831
56
// distribute bonus if earned and promo is ongoing and every nth buy trx
if( (now < bonusUntilDate && (addressToTrxCount[newOwner] % bonusFrequency) == 0) ) {
if( (now < bonusUntilDate && (addressToTrxCount[newOwner] % bonusFrequency) == 0) ) {
39,183
56
// Check is msg_sender is contract dev
modifier onlyOwner() { if (msg.sender != developer_address) { throw; } _; }
modifier onlyOwner() { if (msg.sender != developer_address) { throw; } _; }
13,144
1
// Can't enter if you're not a VIP
require(isVIP(_user), "Not fabulous enough"); if (compare(_priorStateName, DANCEFLOOR)) { message = "The DJ is spinning some decade-old Trap track that sounds like a T-Rex destroying the building with lasers. Time to chill."; } else if (compare(_priorStateName, RESTROOM)) {
require(isVIP(_user), "Not fabulous enough"); if (compare(_priorStateName, DANCEFLOOR)) { message = "The DJ is spinning some decade-old Trap track that sounds like a T-Rex destroying the building with lasers. Time to chill."; } else if (compare(_priorStateName, RESTROOM)) {
37,769
62
// user weighted average share of Pool since lastEvent
uint256 _userRateOnPeriod = userRateOnPeriod(_address); //can drop if pool size increases within period -> slows rewards generation
uint256 _userRateOnPeriod = userRateOnPeriod(_address); //can drop if pool size increases within period -> slows rewards generation
37,399
13
// execute the calldata on the target contract
(bool _success, bytes memory _returnData) = address(_sellerContract)
(bool _success, bytes memory _returnData) = address(_sellerContract)
31,377
19
// 记录发布
news.push(g); userNewsPool[msg.sender].publishedNews.push(id); emit publishSuccess(id, title, style, text, cover, g.date);
news.push(g); userNewsPool[msg.sender].publishedNews.push(id); emit publishSuccess(id, title, style, text, cover, g.date);
2,342
42
// Revokes `value` active votes for `group` group The validator group to revoke votes from. value The number of votes to revoke. lesser The group receiving fewer votes than the group for which the vote was revoked,or 0 if that group has the fewest votes of any validator group. greater The group receiving more votes tha...
function revokeActive( address group, uint256 value, address lesser, address greater, uint256 index
function revokeActive( address group, uint256 value, address lesser, address greater, uint256 index
36,806
138
// Whether the placeholder URI should be returned for all tokens.
bool public _isRevealed = false;
bool public _isRevealed = false;
19,338
1
// (periodType=>PeriodDefinition) period definitions by period type/period types are hourly / weekly / biWeekly / monthly / yearly
mapping(PeriodType => PeriodDefinition) public periodDefinitions;
mapping(PeriodType => PeriodDefinition) public periodDefinitions;
35,866
91
// register the supported interfaces to conform to ERC1155 via ERC165
_registerInterface(_INTERFACE_ID_ERC1155);
_registerInterface(_INTERFACE_ID_ERC1155);
19,761
108
// Events
event NewProposal( uint256 proposalID, string indexed proposalType, bytes proposalPayload ); event Voted(address boardMember, uint256 proposalId); event ProposalApprovedAndEnforced( uint256 proposalID, bytes payload, bool success,
event NewProposal( uint256 proposalID, string indexed proposalType, bytes proposalPayload ); event Voted(address boardMember, uint256 proposalId); event ProposalApprovedAndEnforced( uint256 proposalID, bytes payload, bool success,
7,162
5
// Check Extra Branch Limit
require( lvl <= getSettings().max_expansion && lvl > 0, "Expansion Level Invalid" );
require( lvl <= getSettings().max_expansion && lvl > 0, "Expansion Level Invalid" );
29,980
11
// 将tokenA和tokenB进行大小排序,确保tokenA小于tokenB
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
24,722
16
// Construct Coinweb contract.Set the founder balance as the total supply and emit Transfer event. /
constructor() public { balances[founder] = totalSupply; emit Transfer(address(0), founder, totalSupply); }
constructor() public { balances[founder] = totalSupply; emit Transfer(address(0), founder, totalSupply); }
11,659
29
// Tries to returns the value associated with `key`.O(1). Does not revert if `key` is not in the map./
function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based }
function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based }
28,141
5
// check is revealed
require(ISACTIVE, "Not active yet");
require(ISACTIVE, "Not active yet");
19,080
31
// Total number of vouchers in shared pool/
function totalInSharedPool() external view returns (uint256);
function totalInSharedPool() external view returns (uint256);
16,869
8
// Throws if the contract is paused. /
function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } }
function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } }
10,663
8
// Set fee recipient and Transfer ownership:
nativeToken.setFeeRecipient(address(avatar)); avatar.transferOwnership(address(controller)); nativeToken.transferOwnership(address(avatar)); nativeReputation.transferOwnership(address(controller));
nativeToken.setFeeRecipient(address(avatar)); avatar.transferOwnership(address(controller)); nativeToken.transferOwnership(address(avatar)); nativeReputation.transferOwnership(address(controller));
48,575
105
// swap buybackShare
if(buyBackFeeDivisor > 0) { swapTokensForEth(buybackShare); }
if(buyBackFeeDivisor > 0) { swapTokensForEth(buybackShare); }
27,299
66
// util func to compute new price
function _getNewPrice (uint256 originalPrice, uint256 reserve,
function _getNewPrice (uint256 originalPrice, uint256 reserve,
55,844
2
// Emitted when existing positions were memorialized for a given `NFT`. tokenId The `tokenId` of the `NFT`. indexes Bucket indexes of memorialized positions. /
event MemorializePosition( address indexed lender, uint256 tokenId, uint256[] indexes );
event MemorializePosition( address indexed lender, uint256 tokenId, uint256[] indexes );
35,463
115
// Retrieve collateral factor which is the % increase in borrow limit in precise units (75% = 751e16)
( , uint256 collateralFactorMantissa, ) = strategy.comptroller.markets(address(strategy.targetCollateralCToken)); uint256 netBorrowLimit = _actionInfo.collateralValue .preciseMul(collateralFactorMantissa) .preciseMul(PreciseUnitMath.preciseUnit().sub(execution.unutilizedLeverage...
( , uint256 collateralFactorMantissa, ) = strategy.comptroller.markets(address(strategy.targetCollateralCToken)); uint256 netBorrowLimit = _actionInfo.collateralValue .preciseMul(collateralFactorMantissa) .preciseMul(PreciseUnitMath.preciseUnit().sub(execution.unutilizedLeverage...
65,929
90
// staker => snapshots// staker => next claim // tokenId => token info // period => rewardsPerCycle /
modifier hasStarted() { require(startTimestamp != 0, "NftStaking: staking not started"); _; }
modifier hasStarted() { require(startTimestamp != 0, "NftStaking: staking not started"); _; }
31,253
301
// Attempt to update the funding rate.
OptimisticOracleInterface optimisticOracle = _getOptimisticOracle(); bytes32 identifier = fundingRate.identifier; bytes memory ancillaryData = _getAncillaryData();
OptimisticOracleInterface optimisticOracle = _getOptimisticOracle(); bytes32 identifier = fundingRate.identifier; bytes memory ancillaryData = _getAncillaryData();
5,687
3
// Patricia tree implementation/More info at: https:github.com/chriseth/patricia-trie
contract PatriciaTreeNoHash is IPatriciaTreeNoHash, PatriciaTreeBase { function insert(bytes32 key, bytes memory value) public { tree.insert(key, value); } function getProof(bytes32 key) public view returns (uint branchMask, bytes32[] memory _siblings) { return getProofFunctionality(key); } functio...
contract PatriciaTreeNoHash is IPatriciaTreeNoHash, PatriciaTreeBase { function insert(bytes32 key, bytes memory value) public { tree.insert(key, value); } function getProof(bytes32 key) public view returns (uint branchMask, bytes32[] memory _siblings) { return getProofFunctionality(key); } functio...
29,047
8
// Returns the integer division of two unsigned integers. Reverts with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming...
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold ...
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold ...
9,734
62
// Emitted when owner freezes an account /
event Freeze(address indexed frozenAccount);
event Freeze(address indexed frozenAccount);
17,606
40
// Sells your tokens for Ether. This Ether is assigned to the callers entry in the tokenBalance array, and therefore is shown as a dividend. A second call to withdraw() must be made to invoke the transfer of Ether back to your address.
function sellMyTokens() public { var balance = balanceOf(msg.sender); sell(balance); }
function sellMyTokens() public { var balance = balanceOf(msg.sender); sell(balance); }
3,339
32
// calculate weighted mean of data in oracleData array
aggregateData = ((w1*oracleData[0]/100)+(w2*oracleData[1]/100)+(w3*oracleData[2]/100))/3;
aggregateData = ((w1*oracleData[0]/100)+(w2*oracleData[1]/100)+(w3*oracleData[2]/100))/3;
34,676
301
// Switches to a new {IRelayHub} instance. This method is added for future-proofing: there's no reason to notuse the default instance. IMPORTANT: After upgrading, the {GSNRecipient} will no longer be able to receive relayed calls from the old{IRelayHub} instance. Additionally, all funds should be previously withdrawn v...
function _upgradeRelayHub(address newRelayHub) internal virtual { address currentRelayHub = _relayHub; require(newRelayHub != address(0), "GSNRecipient: new RelayHub is the zero address"); require(newRelayHub != currentRelayHub, "GSNRecipient: new RelayHub is the current one"); emit...
function _upgradeRelayHub(address newRelayHub) internal virtual { address currentRelayHub = _relayHub; require(newRelayHub != address(0), "GSNRecipient: new RelayHub is the zero address"); require(newRelayHub != currentRelayHub, "GSNRecipient: new RelayHub is the current one"); emit...
7,848
88
// Constructs the UBC ERC-20 contract. /
constructor() public ERC20('UBC', 'UBC') { // Mints 1 UBC to contract creator for initial Uniswap oracle deployment. // Will be burned after oracle deployment _mint(msg.sender, 1 * 10**18); }
constructor() public ERC20('UBC', 'UBC') { // Mints 1 UBC to contract creator for initial Uniswap oracle deployment. // Will be burned after oracle deployment _mint(msg.sender, 1 * 10**18); }
9,530
237
// Address of the NFT contract
address public immutable NFTAddress;
address public immutable NFTAddress;
23,204
15
// Transfer stake BLTC to this contract
coin.transfer(this,_stake); // this function throws if not successful
coin.transfer(this,_stake); // this function throws if not successful
10,270
2
// Constructor for the token
constructor(string memory initbaseURI, address _fundWallet) ERC721("HS Pepper Party Genesis", "HSPP") { require(_fundWallet != address(0), "Zero address error"); setBaseURI(initbaseURI); fundWallet = _fundWallet; }
constructor(string memory initbaseURI, address _fundWallet) ERC721("HS Pepper Party Genesis", "HSPP") { require(_fundWallet != address(0), "Zero address error"); setBaseURI(initbaseURI); fundWallet = _fundWallet; }
39,649
48
// Query if an address is an authorized operator for another address. Returns true if `_operator` is an approved operator for `_owner`, false otherwise. _owner The address that owns the NFTs. _operator The address that acts on behalf of the owner.return True if approved for all, false otherwise. /
function isApprovedForAll(
function isApprovedForAll(
36,835
81
// Function to return staker details of '_count' stakes in a pool starting from stake no '_startStakeNum' _poolId Id of the pool _startStakeNum Stake no (ex: 5th) in pool from which to start returning Staker data. _count No of stakes for which to return data. /
function getStakerInfoFrom( uint256 _poolId, uint256 _startStakeNum, uint256 _count
function getStakerInfoFrom( uint256 _poolId, uint256 _startStakeNum, uint256 _count
7,191
117
// If there is no AAVE incentive then below call will fail
try AToken(_receiptToken).getIncentivesController() { aaveIncentivesController = AaveIncentivesController(AToken(_receiptToken).getIncentivesController()); } catch {} //solhint-disable no-empty-blocks
try AToken(_receiptToken).getIncentivesController() { aaveIncentivesController = AaveIncentivesController(AToken(_receiptToken).getIncentivesController()); } catch {} //solhint-disable no-empty-blocks
40,323
48
// based on https:ethereum.stackexchange.com/a/56499/48410
function _toAsciiString(bytes20 data)
function _toAsciiString(bytes20 data)
15,582
26
// increase the token's supply
function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); if (value + currentSupply > totalSupply) throw; currentSupply = safeAdd(currentSupply, value); IncreaseSupply(value); }
function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); if (value + currentSupply > totalSupply) throw; currentSupply = safeAdd(currentSupply, value); IncreaseSupply(value); }
13,267
19
// fromToken or toToken equal shareToken ,update reward
if (fromToken == address(shareToken) || toToken == address(shareToken)) { uint newDevFund = newReward.mul(devFundRatio).div(10000); newReward = newReward.sub(newDevFund); devFund = devFund.add(newDevFund); totalRewarded = totalRewarded.add(newReward); ...
if (fromToken == address(shareToken) || toToken == address(shareToken)) { uint newDevFund = newReward.mul(devFundRatio).div(10000); newReward = newReward.sub(newDevFund); devFund = devFund.add(newDevFund); totalRewarded = totalRewarded.add(newReward); ...
28,308
7
// Add application to the index in the registryapp Application addresstoken Token addressindex Application index /
function addTokenAppToIndex(address app, address token, uint index) public;
function addTokenAppToIndex(address app, address token, uint index) public;
47,052
9
// Make an account an operator of the caller. See {isOperatorFor}. Emits an {AuthorizedOperator} event. Requirements - `operator` cannot be calling address. /
function authorizeOperator(address operator) external;
function authorizeOperator(address operator) external;
17,883
54
// sanity check on `shares` input
require(shares != 0, "DelegationManager._addShares: shares should not be zero!");
require(shares != 0, "DelegationManager._addShares: shares should not be zero!");
3,929
0
// Enumeration of the possible execution phases of the system
enum Phase {SubmissionPhase, AssignmentPhase, CommitmentPhase, RevealPhase, SelectionPhase, CompletedPhase}
enum Phase {SubmissionPhase, AssignmentPhase, CommitmentPhase, RevealPhase, SelectionPhase, CompletedPhase}
18,516
347
// Governance address is not updated until the new governanceaddress has called `acceptGovernance()` to accept this responsibility. /
function acceptGovernance() external { require(msg.sender == pendingGovernance, "PG"); emit TransferGovernance(governance, pendingGovernance); pendingGovernance = address(0); governance = msg.sender; }
function acceptGovernance() external { require(msg.sender == pendingGovernance, "PG"); emit TransferGovernance(governance, pendingGovernance); pendingGovernance = address(0); governance = msg.sender; }
6,749
211
// This struct is used for avoiding stack too deep error when passing too many var between functions
struct PositionResp { Position position; // the quote asset amount trader will send if open position, will receive if close Decimal.decimal exchangedQuoteAssetAmount; // if realizedPnl + realizedFundingPayment + margin is negative, it's the abs value of it Decimal.decimal bad...
struct PositionResp { Position position; // the quote asset amount trader will send if open position, will receive if close Decimal.decimal exchangedQuoteAssetAmount; // if realizedPnl + realizedFundingPayment + margin is negative, it's the abs value of it Decimal.decimal bad...
23,844
8
// Check if current price of hero is equal with the price entered to purchase the hero
require(msg.value == heroes[_heroId].currentPrice);
require(msg.value == heroes[_heroId].currentPrice);
35,585
238
// called by the owner to unpause, returns to normal state /
function unpause() public onlyOwner whenPaused returns (bool) { paused = false; Unpause(); return true; }
function unpause() public onlyOwner whenPaused returns (bool) { paused = false; Unpause(); return true; }
20,903
163
// Constructor. beneficiary The beneficiary of the deposits. /
constructor (address payable beneficiary) public { require(beneficiary != address(0), "RefundEscrow: beneficiary is the zero address"); _beneficiary = beneficiary; _state = State.Active; }
constructor (address payable beneficiary) public { require(beneficiary != address(0), "RefundEscrow: beneficiary is the zero address"); _beneficiary = beneficiary; _state = State.Active; }
9,047
56
// check that the vault doesn't already exist for this maturity
if(assetIdToMaturityToVault[_assetId][_maturities[i]] != address(0)) revert VaultAlreadyExists();
if(assetIdToMaturityToVault[_assetId][_maturities[i]] != address(0)) revert VaultAlreadyExists();
21,648
167
// Get LBT strike price in Collateral / USD /
function _getLBTStrikePrice( BondMakerInterface bondMaker, uint256 bondGroupID, bool isReversedOracle
function _getLBTStrikePrice( BondMakerInterface bondMaker, uint256 bondGroupID, bool isReversedOracle
33,184
15
// Get the `pos`-th received payment. pos Index of the received payment. Requirements: - `pos` must be a valid index. /
function receivedPaymentsData(uint256 pos) public view returns (Received memory) { if (pos >= receivedPaymentsCount()) revert OutOfBounds(); return _received[pos]; }
function receivedPaymentsData(uint256 pos) public view returns (Received memory) { if (pos >= receivedPaymentsCount()) revert OutOfBounds(); return _received[pos]; }
27,885
20
// 7 IN DATA / SET DATA / GET DATA / STRING / PUBLIC / ONLY OWNER / CONSTANT
string inData_7 = " une première phrase " ;
string inData_7 = " une première phrase " ;
5,783
90
// first step of payeeship transfer (safe transfer pattern) _transmitter transmitter address of oracle whose payee is changing _proposed new payee address can only be called by payee address /
function transferPayeeship( address _transmitter, address _proposed ) external
function transferPayeeship( address _transmitter, address _proposed ) external
11,691
13
// reverse-for-loops with unsigned integer/ solium-disable-next-line security/no-modify-for-iter-var / find the last non-zero byte in order to determine the length
if (result[i] != 0) { uint256 length = i + 1;
if (result[i] != 0) { uint256 length = i + 1;
30,883
44
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder)
prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder)
36,300
27
// Registers the current contract to OpenSea's operator filter,/ and subscribe to the default OpenSea operator blocklist./ Note: Will not revert nor update existing settings for repeated registration.
function _registerForOperatorFiltering() internal virtual { _registerForOperatorFiltering(_DEFAULT_SUBSCRIPTION, true); }
function _registerForOperatorFiltering() internal virtual { _registerForOperatorFiltering(_DEFAULT_SUBSCRIPTION, true); }
19,577
4
// Given a `bytes32` value, decode it into a method handler and return it data The packed data to decodereturn isStatic Whether the method is static (`view`) or notreturn handler The address of the handler contract implementing the `IFallbackMethod` or `IStaticFallbackMethod` interface /
function decode(bytes32 data) internal pure returns (bool isStatic, address handler) { // solhint-disable-next-line no-inline-assembly assembly { // set isStatic to true if the left-most byte of the data is not 0x00 isStatic := iszero(shr(248, data)) handler := sh...
function decode(bytes32 data) internal pure returns (bool isStatic, address handler) { // solhint-disable-next-line no-inline-assembly assembly { // set isStatic to true if the left-most byte of the data is not 0x00 isStatic := iszero(shr(248, data)) handler := sh...
20,148
25
// exact solution should not be used, a late points of the curve when many euroUlps are needed to increase by one nmkUlp this will lead to"indeterministic" inverse values that depend on the initial min and max and further binary division -> you can land at any of the euro value that is mapped to the same nmk value with...
if (val < neumarkUlps) { min = mid + 1; } else {
if (val < neumarkUlps) { min = mid + 1; } else {
12,048
49
// This function allows the controller to mint and issue tokens to the target address/This function is locked until mint_lock_expiry/Runs ERC20 _mint function/target Target address for the newly minted tokens/amount Amount of tokens to mint and issue
function mint_and_issue(address target, uint256 amount) public { require(block.timestamp > mint_lock_expiry, "minting is locked"); require(msg.sender == controller, "only controller"); _mint(target, amount); }
function mint_and_issue(address target, uint256 amount) public { require(block.timestamp > mint_lock_expiry, "minting is locked"); require(msg.sender == controller, "only controller"); _mint(target, amount); }
33,392
14
// sets a new minimum duration for each staking claim period only callable by owner _days amount of days the new staking claim period should at least last /
function setMinDuration(uint256 _days) external onlyOwner { emit MinPeriodDurationUpdated(minPeriodDuration / 1 days, _days); minPeriodDuration = _days * 1 days; }
function setMinDuration(uint256 _days) external onlyOwner { emit MinPeriodDurationUpdated(minPeriodDuration / 1 days, _days); minPeriodDuration = _days * 1 days; }
31,869
5
// Public mint
require(_quantity <= PUBLIC_MAX_PASSES, "LL420Bud: Surpassed quantity limit"); emit PublicMint(msg.sender, _quantity);
require(_quantity <= PUBLIC_MAX_PASSES, "LL420Bud: Surpassed quantity limit"); emit PublicMint(msg.sender, _quantity);
31,577
10
// Remove CAT application indexapp Application address/
function deleteCATAppIndex(address app) public;
function deleteCATAppIndex(address app) public;
4,030
155
// getter to determine if address is in whitelist /
function isWhitelisted(address _address) public view returns (bool) { return whitelist[_address]; }
function isWhitelisted(address _address) public view returns (bool) { return whitelist[_address]; }
29,893
30
// Verifies if the contract is upgradable/ return true if the contract upgradable
function isUpgradable(address _address) external view override returns(bool) { if (_address == witnet) { return true; } return false; }
function isUpgradable(address _address) external view override returns(bool) { if (_address == witnet) { return true; } return false; }
12,578
27
// get allowance
function allowance(address _owner, address _spender) public constant
function allowance(address _owner, address _spender) public constant
34,209
46
// account => index => KeyItem
mapping (address => mapping(uint256 => KeyItem)) keyData;
mapping (address => mapping(uint256 => KeyItem)) keyData;
58,406
8
// FIXED supply for now
uint _initialSupply = 10; uint _id = badges.push(_badge); _tokenCreators[_id] = msg.sender; balances[_id][msg.sender] = _initialSupply;
uint _initialSupply = 10; uint _id = badges.push(_badge); _tokenCreators[_id] = msg.sender; balances[_id][msg.sender] = _initialSupply;
21,896
540
// CRON jobs
address internal constant CRON_SEQUENCER = 0x238b4E35dAed6100C6162fAE4510261f88996EC9; address internal constant CRON_AUTOLINE_JOB = 0x67AD4000e73579B9725eE3A149F85C4Af0A61361; address internal constant CRON_LERP_JOB = 0x8F8f2FC1F0380B9Ff4fE5c3142d0811aC89E32fB; ...
address internal constant CRON_SEQUENCER = 0x238b4E35dAed6100C6162fAE4510261f88996EC9; address internal constant CRON_AUTOLINE_JOB = 0x67AD4000e73579B9725eE3A149F85C4Af0A61361; address internal constant CRON_LERP_JOB = 0x8F8f2FC1F0380B9Ff4fE5c3142d0811aC89E32fB; ...
14,170
9
// binary search for floor(log2(x))
int ilog2 = floorLog2(x); int z; if (ilog2 < 0) z = int(x << uint(-ilog2)); else z = int(x >> uint(ilog2));
int ilog2 = floorLog2(x); int z; if (ilog2 < 0) z = int(x << uint(-ilog2)); else z = int(x >> uint(ilog2));
48,064
4
// Mints aTokens to the reserve treasury amount The amount of tokens getting minted index The next liquidity index of the reserve /
function mintToTreasury(uint256 amount, uint256 index) external;
function mintToTreasury(uint256 amount, uint256 index) external;
39,082
396
// If interest was fully paid off, then set the last full payment as the previous due time
uint256 mostRecentLastDueTime; if (currentTime() < _nextDueTime) { uint256 secondsPerPeriod = paymentPeriodInDays.mul(SECONDS_PER_DAY); mostRecentLastDueTime = _nextDueTime.sub(secondsPerPeriod); } else {
uint256 mostRecentLastDueTime; if (currentTime() < _nextDueTime) { uint256 secondsPerPeriod = paymentPeriodInDays.mul(SECONDS_PER_DAY); mostRecentLastDueTime = _nextDueTime.sub(secondsPerPeriod); } else {
61,904
308
// MODULE ONLY: Hook called prior to issuance to sync positions on SetToken. Only callable by valid module._setToken Instance of the SetToken /
function moduleIssueHook(ISetToken _setToken, uint256 /* _setTokenQuantity */) external onlyModule(_setToken) { sync(_setToken); }
function moduleIssueHook(ISetToken _setToken, uint256 /* _setTokenQuantity */) external onlyModule(_setToken) { sync(_setToken); }
35,923
248
// if function does not exist then do nothing and return
if (!LibUtil.isZeroAddress(_facetAddress)) { revert FacetAddressIsNotZero(); }
if (!LibUtil.isZeroAddress(_facetAddress)) { revert FacetAddressIsNotZero(); }
8,925
28
// Get the total amount of tokens staked by `_accountAddress` at block number `_blockNumber` _accountAddress - Account requesting for _blockNumber - Block number at which we are requestingreturn The amount of tokens staked by the account at the given block number /
function totalStakedForAt( address _accountAddress, uint256 _blockNumber
function totalStakedForAt( address _accountAddress, uint256 _blockNumber
36,464
106
// Keeper resolved
event KeeperResolved(address indexed keeper, uint block); event AddCredit(address indexed credit, address indexed job, address indexed creditor, uint block, uint amount);
event KeeperResolved(address indexed keeper, uint block); event AddCredit(address indexed credit, address indexed job, address indexed creditor, uint block, uint amount);
11,232
115
// The converse of the above, resuming betting if a freeze had been put in place.
function resumeGame() public onlyOwnerOrBankroll { gameActive = true; }
function resumeGame() public onlyOwnerOrBankroll { gameActive = true; }
29,023
26
// require(amt >= minBet, "bet below minimum");
require(amt <= userBalance[msg.sender], "NSF "); require( matches[matchNumber].startTime > block.timestamp, "game started or not playing" );
require(amt <= userBalance[msg.sender], "NSF "); require( matches[matchNumber].startTime > block.timestamp, "game started or not playing" );
10,972
214
// withdraw the pool tokens from the wallet
systemStore.decSystemBalance(liquidity.poolToken, poolAmount); wallet.withdrawTokens(liquidity.poolToken, address(this), poolAmount);
systemStore.decSystemBalance(liquidity.poolToken, poolAmount); wallet.withdrawTokens(liquidity.poolToken, address(this), poolAmount);
85,096
34
// post a challenge-bond against the specified content bond a prospective challenger can discover the bonderAddr by calling the view fcn isContentBonded. if bonderAddr is zero, then initiate a challenge w/o a bonder. in that case the challenger will never get a reward. note: if posting a challenge to unbonded content, ...
function postChallengeBond(uint256 contentHash, address bonderAddr) public
function postChallengeBond(uint256 contentHash, address bonderAddr) public
3,876
217
// Unchecked because the only math done is incrementing the array index counter which cannot possibly overflow.
unchecked { for (uint256 i; i < _wearers.length; ++i) { balances[i] = balanceOf(_wearers[i], _hatIds[i]); }
unchecked { for (uint256 i; i < _wearers.length; ++i) { balances[i] = balanceOf(_wearers[i], _hatIds[i]); }
10,488
143
// Amount too high
uint256 internal constant AMOUNT_TOO_HIGH = 128;
uint256 internal constant AMOUNT_TOO_HIGH = 128;
15,956
156
// The TAL TOKEN!
TaalToken public taal; constructor( TaalToken _taal
TaalToken public taal; constructor( TaalToken _taal
49,752
2
// Stores a new value in the contract
function store(uint256 newValue) public { value = newValue; emit ValueChanged(newValue); }
function store(uint256 newValue) public { value = newValue; emit ValueChanged(newValue); }
12,557
3
// the current supply rate. Expressed in ray
uint128 currentLiquidityRate;
uint128 currentLiquidityRate;
4,257
459
// increase the total borrows by the compounded interest
reserve.increaseTotalBorrowsStableAndUpdateAverageRate( _balanceIncrease, user.stableBorrowRate );
reserve.increaseTotalBorrowsStableAndUpdateAverageRate( _balanceIncrease, user.stableBorrowRate );
7,087
0
// We use this price feed to pin the mint price in ETH to a fixed USD value. NOTE: ideally we would resolve the price feed at namehash("eth-usd.data.eth") but this doesn't work on testnets so we set the price-feed explicitly. mainnet = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419 goerli = 0xD4a33860578De61DBAbDc8BFdb98FD...
address public ETH_USD_FEED;
address public ETH_USD_FEED;
30,302
57
// Updates a validator's ECDSA and BLS keys. account The address under which the validator is registered. signer The address which the validator is using to sign consensus messages. ecdsaPublicKey The ECDSA public key corresponding to `signer`. blsPublicKey The BLS public key that the validator is using for consensus, ...
function updatePublicKeys( address account, address signer, bytes calldata ecdsaPublicKey, bytes calldata blsPublicKey, bytes calldata blsPop
function updatePublicKeys( address account, address signer, bytes calldata ecdsaPublicKey, bytes calldata blsPublicKey, bytes calldata blsPop
14,656
6
// Emitted when a proposal is executed./actor The address of the caller./callId The ID of the call./actions The array of actions executed./failureMap The failure map encoding which actions have failed./execResults The array with the results of the executed actions./The value of `callId` is defined by the component/cont...
event Executed( address indexed actor, bytes32 callId, Action[] actions, uint256 failureMap, bytes[] execResults );
event Executed( address indexed actor, bytes32 callId, Action[] actions, uint256 failureMap, bytes[] execResults );
13,365
33
// no dividend, set 6~8 level to 0
level = 0;
level = 0;
18,627
54
// transfer of token on behalf of the owner to another address. always require the owner has enough balance and the sender is allowed to transfer the given amountreturn the bool true if success._from The address to transfer from. _receiver The address to transfer to. _amount The amount to be transferred. /
function transferFrom(address _from, address _receiver, uint256 _amount) public whenNotPaused returns (bool) { require(_from != address(0)); require(_receiver != address(0)); require(_amount <= allowance(_from, msg.sender)); require(_amount <= getAvailableBalance(_from)); ret...
function transferFrom(address _from, address _receiver, uint256 _amount) public whenNotPaused returns (bool) { require(_from != address(0)); require(_receiver != address(0)); require(_amount <= allowance(_from, msg.sender)); require(_amount <= getAvailableBalance(_from)); ret...
8,771
9
// Groups section
// // function createGroup() public restricted{ // // }
// // function createGroup() public restricted{ // // }
46,006
1
// Restricted to members of the `minter` role. /
modifier onlyMinter() { if (!super.hasRole(MINTER_ROLE, msg.sender)) revert NoMinterRole(); _; }
modifier onlyMinter() { if (!super.hasRole(MINTER_ROLE, msg.sender)) revert NoMinterRole(); _; }
36,621
154
// Emits a {ApprovalForAll} event. /
function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); }
function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); }
3,157
10
// assert(b > 0);Solidity automatically throws when dividing by 0
uint256 c = a / b;
uint256 c = a / b;
8,341
136
// returns the address of the current admin
function admin() public view virtual returns (address) { return _admin; }
function admin() public view virtual returns (address) { return _admin; }
27,055
287
// To protect edge case when 1 DAI > 1.13 USD
if(dMemberInk > dink) dMemberInk = dink;
if(dMemberInk > dink) dMemberInk = dink;
28,024
2
// public key => validator is in pool
mapping(bytes => address) internal validatorsInPool;
mapping(bytes => address) internal validatorsInPool;
25,165