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
207
// Returns Minter /
function minter() internal view returns (IMinter) { return IMinter(controller.getContract(keccak256("Minter"))); }
function minter() internal view returns (IMinter) { return IMinter(controller.getContract(keccak256("Minter"))); }
30,503
356
// getHandAsSvg returns the SVG XML for a hand, which can be rendered as an img src in a UIhandId uint16 ID of the hand from 0 - 1325return string SVG XML of a hand of 2 cards /
function getHandAsSvg(uint16 handId) public validHandId(handId) view returns (string memory) { (uint8 card1, uint8 card2) = getHandAsCardIds(handId); string[4] memory parts; parts[0] = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 148 ...
function getHandAsSvg(uint16 handId) public validHandId(handId) view returns (string memory) { (uint8 card1, uint8 card2) = getHandAsCardIds(handId); string[4] memory parts; parts[0] = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 148 ...
64,279
79
// if (currentTC[transactionId] == 0){ transactions[transactionId] = Transaction({ destination: destination, value: value, data: data, executed: false }); transactionCount += 1; } else{
transactionBatch[transactionId][currentTC[transactionId]] = Transaction({ destination: destination, value: value, data: data, executed: false });
transactionBatch[transactionId][currentTC[transactionId]] = Transaction({ destination: destination, value: value, data: data, executed: false });
12,996
55
// for which policy have we called?
uint policyId;
uint policyId;
62,123
76
// R(1 - P)6 /(1 + (T - 1)0.002)
function mediumRiskPremium(Decimal.D256 memory debtRatio, Decimal.D256 memory price, uint256 expirationPeriod) private pure returns (Decimal.D256 memory) { return multiplier(debtRatio, price).mul( Decimal.D256({ value: 6e18 }).div( Decimal.one().add(Decimal.D256({ value: 2e15 })....
function mediumRiskPremium(Decimal.D256 memory debtRatio, Decimal.D256 memory price, uint256 expirationPeriod) private pure returns (Decimal.D256 memory) { return multiplier(debtRatio, price).mul( Decimal.D256({ value: 6e18 }).div( Decimal.one().add(Decimal.D256({ value: 2e15 })....
35,469
0
// Executes once when a contract is created to initialize state variables_oracle - address of the specific Chainlink node that a contract makes an API call from _jobId - specific job for :_oracle: to run; each job is unique and returns different types of data _fee - node operator price per API call / data request _link...
constructor( address _oracle, bytes32 _jobId, uint256 _fee, address _link
constructor( address _oracle, bytes32 _jobId, uint256 _fee, address _link
20,643
371
// Update claimed interest fees and net deposits, mint RFT, emit events, and return no error
_interestFeesClaimed = _interestFeesClaimed.add(amountUsd); _netDeposits = _netDeposits.add(int256(amountUsd)); require(rariFundToken.mint(_interestFeeMasterBeneficiary, rftAmount), "Failed to mint output tokens."); emit Deposit("USD", _interestFeeMasterBeneficiary, _interestFeeMasterBen...
_interestFeesClaimed = _interestFeesClaimed.add(amountUsd); _netDeposits = _netDeposits.add(int256(amountUsd)); require(rariFundToken.mint(_interestFeeMasterBeneficiary, rftAmount), "Failed to mint output tokens."); emit Deposit("USD", _interestFeeMasterBeneficiary, _interestFeeMasterBen...
10,975
254
// adjust dai to art
(, uint rate,,,uint dust) = VatLike2(address(cdpManager.vat())).ilks(ilk); uint daiDebt = art * rate / 1e27; if(daiDebt < MIN_ORDER) return 0; // do nothing uint orderSize = daiDebt / 10; if(orderSize < MIN_ORDER) orderSize = MIN_ORDER;
(, uint rate,,,uint dust) = VatLike2(address(cdpManager.vat())).ilks(ilk); uint daiDebt = art * rate / 1e27; if(daiDebt < MIN_ORDER) return 0; // do nothing uint orderSize = daiDebt / 10; if(orderSize < MIN_ORDER) orderSize = MIN_ORDER;
37,158
3
// Marketer contractJunghoon Seo - <jh.seo@battleent.com> /
contract Marketer is IMarketer { mapping (bytes32 => address) marketerInfo; function generateMarketerKey() external returns(bytes32) { bytes32 key = bytes32(keccak256(abi.encodePacked(msg.sender))); return key; } function setMarketerKey(bytes32 _key) external { marketerInfo[_ke...
contract Marketer is IMarketer { mapping (bytes32 => address) marketerInfo; function generateMarketerKey() external returns(bytes32) { bytes32 key = bytes32(keccak256(abi.encodePacked(msg.sender))); return key; } function setMarketerKey(bytes32 _key) external { marketerInfo[_ke...
21,825
74
// merkle proof verifier, used only during first launch
function merkleVerify(bytes32[] memory proof, bytes32 root, bytes32 leaf) private pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // ...
function merkleVerify(bytes32[] memory proof, bytes32 root, bytes32 leaf) private pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // ...
15,482
18
// AVAX Mainnet
wrapped = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7; // WAVAX factory = 0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10; // TraderJoe router = 0x60aE616a2155Ee3d9A68541Ba4544862310933d4; // TraderJoe
wrapped = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7; // WAVAX factory = 0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10; // TraderJoe router = 0x60aE616a2155Ee3d9A68541Ba4544862310933d4; // TraderJoe
22,339
529
// storage // initializer //Initizalize Hypervisor/ access control: only proxy constructor/ state machine: can only be called once/ state scope: set initialization variables/ token transfer: none/ownerAddress address The admin address/rewardPoolFactory address The factory to use for deploying the RewardPool/powerSwitch...
constructor( address ownerAddress, address rewardPoolFactory, address powerSwitchFactory, address stakingToken, address rewardToken, RewardScaling memory rewardScaling ) {
constructor( address ownerAddress, address rewardPoolFactory, address powerSwitchFactory, address stakingToken, address rewardToken, RewardScaling memory rewardScaling ) {
33,660
6
// 获取账户_spender可以从账户_owner中转出token的数量
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
12,840
119
// useful addon to limit one call per block - to be used with multiple different excluding methods - e.g. mint and burn /
mapping(address => uint) public lastblock; constructor () internal {
mapping(address => uint) public lastblock; constructor () internal {
35,295
445
// Interface for securely interacting with Chainlink aggregators /
interface IOracleAdapter { struct Value { uint256 value; uint256 periodEnd; } /// @notice Event fired when asset's pricing source (aggregator) is updated event AssetSourceUpdated(address indexed asset, address indexed source); /// @notice Event fired when the TVL aggregator address...
interface IOracleAdapter { struct Value { uint256 value; uint256 periodEnd; } /// @notice Event fired when asset's pricing source (aggregator) is updated event AssetSourceUpdated(address indexed asset, address indexed source); /// @notice Event fired when the TVL aggregator address...
69,233
80
// CONFIG START
uint256 private initialSupply; uint256 private denominator = 100; uint256 private swapThreshold = 0.0000005 ether; // The contract will only swap to ETH, once the fee tokens reach the specified threshold uint256 private devTaxBuy; uint256 private marketingTaxBuy; uint256 private l...
uint256 private initialSupply; uint256 private denominator = 100; uint256 private swapThreshold = 0.0000005 ether; // The contract will only swap to ETH, once the fee tokens reach the specified threshold uint256 private devTaxBuy; uint256 private marketingTaxBuy; uint256 private l...
44,126
5
// TIME SETTINGS
uint256 moonRaffleLiveSecs = 518400; // 6 DAYS default uint256 winnerCalcSecs = 345600; // 4 DAYS default uint256 claimSecs = 15552000; // 180 DAYS default uint256 latestMoonRaffleCompleteTime = 0; bool latestMoonRaffleSeeded = true;
uint256 moonRaffleLiveSecs = 518400; // 6 DAYS default uint256 winnerCalcSecs = 345600; // 4 DAYS default uint256 claimSecs = 15552000; // 180 DAYS default uint256 latestMoonRaffleCompleteTime = 0; bool latestMoonRaffleSeeded = true;
37,793
9
// The specified block needs to be the first block not finalized (this way we always revert to a guaranteed valid block and don't revert multiple times)
require(blockIdx == S.numBlocksFinalized, "PREV_BLOCK_NOT_FINALIZED");
require(blockIdx == S.numBlocksFinalized, "PREV_BLOCK_NOT_FINALIZED");
12,015
15
// This creates a mapping with all data storage
mapping (address => uint256) private _balanceOf; mapping (address => mapping (address => uint256)) private _allowance; mapping (address => bool) public frozenAccount;
mapping (address => uint256) private _balanceOf; mapping (address => mapping (address => uint256)) private _allowance; mapping (address => bool) public frozenAccount;
36,013
87
// Change the base amount required as a deposit to challenge a submission. _submissionChallengeBaseDeposit The new base amount of wei required to challenge a submission. /
function changeSubmissionChallengeBaseDeposit(uint256 _submissionChallengeBaseDeposit) external onlyGovernor { submissionChallengeBaseDeposit = _submissionChallengeBaseDeposit; }
function changeSubmissionChallengeBaseDeposit(uint256 _submissionChallengeBaseDeposit) external onlyGovernor { submissionChallengeBaseDeposit = _submissionChallengeBaseDeposit; }
42,253
100
// If the entire position is being removed, delete it instead.
if ( tokensToRemove.isEqual(positionData.tokensOutstanding) && positionData.collateral.isEqual(collateralToRemove) ) { _deleteSponsorPosition(sponsor); return; }
if ( tokensToRemove.isEqual(positionData.tokensOutstanding) && positionData.collateral.isEqual(collateralToRemove) ) { _deleteSponsorPosition(sponsor); return; }
30,041
575
// Sets the timestamp of a given claim at which the Claim's details has been updated. _claimId Claim Id of claim which has been changed. _dateUpd timestamp at which claim is updated. /
function setClaimdateUpd(uint _claimId, uint _dateUpd) external onlyInternal { allClaims[_claimId].dateUpd = _dateUpd; }
function setClaimdateUpd(uint _claimId, uint _dateUpd) external onlyInternal { allClaims[_claimId].dateUpd = _dateUpd; }
54,729
51
// A wallet that is required to unlock reserve tokens
address public financeWallet;
address public financeWallet;
48,025
60
// Bad interface
if(!upgradeAgent.isUpgradeAgent()) throw;
if(!upgradeAgent.isUpgradeAgent()) throw;
25,638
5
// Events /
event AssetMinted(uint256 tokenId, address sender); event SaleActivation(bool isActive);
event AssetMinted(uint256 tokenId, address sender); event SaleActivation(bool isActive);
50,451
2
// Gas optimization: this is cheaper than requiring '_a' not being zero, but the benefit is lost if '_b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) return 0; uint c = _a * _b; return c / _a == _b ? c : UINT_MAX;
if (_a == 0) return 0; uint c = _a * _b; return c / _a == _b ? c : UINT_MAX;
9,815
1
// map of nft and token id to Issuance metadata
mapping (address => mapping (uint => IssuanceData)) lookup;
mapping (address => mapping (uint => IssuanceData)) lookup;
26,157
41
// Minus 2y locked tokens
remainingTokens = remainingTokens.sub(totalSupplyLocked2Y);
remainingTokens = remainingTokens.sub(totalSupplyLocked2Y);
23,716
2
// This is payable because at some point we want to allow the LOCK to capture a fee on 2ndarymarket transactions... /
function transferFrom( address _from, address _recipient, uint _tokenId ) public payable
function transferFrom( address _from, address _recipient, uint _tokenId ) public payable
24,567
2
// events
event Deposit(uint256, address indexed); event Withdraw(uint256, address indexed); event NewReserves(uint256, uint256); event LongXAUminted(uint256, address indexed); event ShortXAUminted(uint256, address indexed); event LongXAUredeemed(uint256, address indexed); event ShortXAUredeemed(ui...
event Deposit(uint256, address indexed); event Withdraw(uint256, address indexed); event NewReserves(uint256, uint256); event LongXAUminted(uint256, address indexed); event ShortXAUminted(uint256, address indexed); event LongXAUredeemed(uint256, address indexed); event ShortXAUredeemed(ui...
3,383
22
// Allow user to buy someone else's NFT
function buyToken(uint id, uint amount, address nftOwner) payable public { require(winner == 0, "We already have a winner, the market is closed"); require( msg.value == transferPrice[id][nftOwner] * amount, "The value sent must match the price"); require(amount <= ba...
function buyToken(uint id, uint amount, address nftOwner) payable public { require(winner == 0, "We already have a winner, the market is closed"); require( msg.value == transferPrice[id][nftOwner] * amount, "The value sent must match the price"); require(amount <= ba...
15,713
83
// Transfer tokens from DeFi protocol to beneficiary amounts Array of amounts to withdraw, in order of supportedTokens()return new balances of each token /
function withdraw(address beneficiary, uint256[] calldata amounts) external;
function withdraw(address beneficiary, uint256[] calldata amounts) external;
21,663
167
// Get total supply minted
function totalSupply() public view returns (uint) { return _tokenIds.current(); }
function totalSupply() public view returns (uint) { return _tokenIds.current(); }
58,061
7
// adds a liquidity pool _liquidityPool liquidity pool/
function addLiquidityPool(address _liquidityPool) external only(BANCOR_CONVERTER_REGISTRY) { addItem(liquidityPools, _liquidityPool); }
function addLiquidityPool(address _liquidityPool) external only(BANCOR_CONVERTER_REGISTRY) { addItem(liquidityPools, _liquidityPool); }
44,494
148
// Returns the message sender (defaults to `msg.sender`). If you are writing GSN compatible contracts, you need to override this function. /
function _msgSenderERC721A() internal view virtual returns (address) {
function _msgSenderERC721A() internal view virtual returns (address) {
114
1
// assert(b > 0);Solidity automatically throws when dividing by 0
uint256 c = a / b;
uint256 c = a / b;
6,927
4
// Key: gameListId
struct GameList{ int256 questionId; // 2 items int256 currencyId; // which currency // currencyQuantity items uint revealTime; // gameParticipateStartTime int256 lifeLengthId; // 3 items string property; // 1 items bool isActivity; // bool isClose; //...
struct GameList{ int256 questionId; // 2 items int256 currencyId; // which currency // currencyQuantity items uint revealTime; // gameParticipateStartTime int256 lifeLengthId; // 3 items string property; // 1 items bool isActivity; // bool isClose; //...
7,246
32
// Returns the user account data across all the reserves user The address of the userreturn totalCollateralBase The total collateral of the user in the base currency used by the price feedreturn totalDebtBase The total debt of the user in the base currency used by the price feedreturn availableBorrowsBase The borrowing...
function getUserAccountData(
function getUserAccountData(
39,135
2
// Returns address of oracle currency (0x0 for ETH)/
function getCurrencyAddress() external view returns(address) { return currencyAddress; }
function getCurrencyAddress() external view returns(address) { return currencyAddress; }
35,579
52
// Validate whether same data is present for customer
bytes32 savedDataHash = viewCustomer(customerName, password); require( customers[customerName].dataHash != savedDataHash, "This customer data is up to date" );
bytes32 savedDataHash = viewCustomer(customerName, password); require( customers[customerName].dataHash != savedDataHash, "This customer data is up to date" );
19,594
1
// Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).
mapping(address => bool) private _defaultOperators;
mapping(address => bool) private _defaultOperators;
22,623
103
// Make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); ethAmount = address(this).balance.sub(ethAmount); emit SwapedTokenF...
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); ethAmount = address(this).balance.sub(ethAmount); emit SwapedTokenF...
4,612
194
// Bonus muliplier for early FFARM makers.
uint256[] public REWARD_MULTIPLIER = [1]; uint256[] public HALVING_AT_BLOCK; // init in constructor function uint256 public FINISH_BONUS_AT_BLOCK;
uint256[] public REWARD_MULTIPLIER = [1]; uint256[] public HALVING_AT_BLOCK; // init in constructor function uint256 public FINISH_BONUS_AT_BLOCK;
13,829
23
// Calculate the price of a token in the pool with givenprecision-adjusted balances and a particular D.This is accomplished via solving the invariant iteratively.See the StableSwap paper and Curve.fi implementation for further details. x_12 + x1(sum' - (Ann - 1)D / (Ann)) = D(n + 1) / (n(2n)prod'A)x_12 + bx_1 = cx_1 = ...
function getYD( uint256 a, uint8 tokenIndex, uint256[] memory xp, uint256 d
function getYD( uint256 a, uint8 tokenIndex, uint256[] memory xp, uint256 d
6,536
65
// Builds up to 4 rects given a buffer (array of strings, each contiguous group of 4 strings belonging to asingle rect. /
function getChunk( uint256 cursor, string[16] memory buffer, bool isRainbow
function getChunk( uint256 cursor, string[16] memory buffer, bool isRainbow
18,456
0
// emitted when an account has claimed some tokens /
event Claimed(address indexed account, uint256 amount);
event Claimed(address indexed account, uint256 amount);
12,295
72
// 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 //inject PUBLIC FUNC TO EXTERNAL returns (bool)
function increaseAllowance( address spender, uint256 addedValue ) public //inject PUBLIC FUNC TO EXTERNAL returns (bool)
50,836
183
// percentage of the fee to be calculated on the loan amount
uint256 private constant originationFeeRate = 0.00001 * 1e18; // 100% = 1e18; uint256 private constant flashloanFeeRate = 0.0006 * 1e18;
uint256 private constant originationFeeRate = 0.00001 * 1e18; // 100% = 1e18; uint256 private constant flashloanFeeRate = 0.0006 * 1e18;
9,562
197
// Topping 2
TIERS[4] = [1355, 1400, 1400, 1400];
TIERS[4] = [1355, 1400, 1400, 1400];
20,574
62
// function for get debt info/xHashhash of HTLC random number/ return leftTimethe left lock time
function getLeftLockedTime(Data storage self, bytes32 xHash) external view returns (uint)
function getLeftLockedTime(Data storage self, bytes32 xHash) external view returns (uint)
79,410
50
// Check is expiration date is past. /
function _isExpired(uint256 expiration) internal view returns (bool) { return expiration != 0 && (now >= expiration); }
function _isExpired(uint256 expiration) internal view returns (bool) { return expiration != 0 && (now >= expiration); }
10,043
121
// The interface for all permission related matters/These methods allow users to set and remove permissions to their positions
interface IDCAPermissionManager is IERC721 { /// @notice Set of possible permissions enum Permission { INCREASE, REDUCE, WITHDRAW, TERMINATE } /// @notice A set of permissions for a specific operator struct PermissionSet { // The address of the operator address operator; // The pe...
interface IDCAPermissionManager is IERC721 { /// @notice Set of possible permissions enum Permission { INCREASE, REDUCE, WITHDRAW, TERMINATE } /// @notice A set of permissions for a specific operator struct PermissionSet { // The address of the operator address operator; // The pe...
61,755
11
// withDraw ethereum when closed fund/
function withDrawEth(uint256 value) payable returns (bool success) { if(now <= closeTime ) throw; if(!isFundedMini) throw; if(this.balance < value) throw; if(msg.sender != owner) throw; if(!msg.sender.send(value)) return false; return true; }
function withDrawEth(uint256 value) payable returns (bool success) { if(now <= closeTime ) throw; if(!isFundedMini) throw; if(this.balance < value) throw; if(msg.sender != owner) throw; if(!msg.sender.send(value)) return false; return true; }
52,685
500
// ``` As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)and `uint256` (`UintSet`) are supported. /
library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSe...
library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSe...
4,196
133
// Check if msg.sender is known TIP-3 root /
modifier onlyTokenRoot() { require( msg.sender == token1 || msg.sender == token2 || msg.sender == lpTokenRootAddress, SwapPairErrors.CALLER_IS_NOT_TOKEN_ROOT ); _; }
modifier onlyTokenRoot() { require( msg.sender == token1 || msg.sender == token2 || msg.sender == lpTokenRootAddress, SwapPairErrors.CALLER_IS_NOT_TOKEN_ROOT ); _; }
1,303
34
// Tracks referralAmount and referralAccountsused in _reserveSwapp() internal function_referralAddress address of the referrer_value ETH amount referred during reservation/
function _trackReferrals(address _referralAddress, uint256 _value) private { if (referralAmount[_referralAddress] == 0) { referralAccounts[referralAccountCount] = _referralAddress; referralAccountCount++; } referralAmount[_referralAddress] += _value; }
function _trackReferrals(address _referralAddress, uint256 _value) private { if (referralAmount[_referralAddress] == 0) { referralAccounts[referralAccountCount] = _referralAddress; referralAccountCount++; } referralAmount[_referralAddress] += _value; }
49,781
0
// Constants for the bet types
bool private constant BET_TYPE_OVER = true; bool private constant BET_TYPE_UNDER = false; address payable public contractOwner; IERC20 private token;
bool private constant BET_TYPE_OVER = true; bool private constant BET_TYPE_UNDER = false; address payable public contractOwner; IERC20 private token;
28,129
147
// The Csa TOKEN!
CsaToken public Csa;
CsaToken public Csa;
33,361
19
// Checks with the Prize Pool if a specific token type may be awarded as an external prize/externalToken The address of the token to check/ return True if the token may be awarded, false otherwise
function canAwardExternal(address externalToken) external view returns (bool);
function canAwardExternal(address externalToken) external view returns (bool);
24,700
179
// The Prepaid Aggregator contract Handles aggregating data pushed in from off-chain, and unlockspayment for oracles as they report. Oracles' submissions are gathered inrounds, with each round aggregating the submissions for each oracle into asingle answer. The latest aggregated answer is exposed as well as historicala...
contract FluxAggregator is AggregatorV2V3Interface, Owned { using SafeMath for uint256; using SafeMath128 for uint128; using SafeMath64 for uint64; using SafeMath32 for uint32; struct Round { int256 answer; uint64 startedAt; uint64 updatedAt; uint32 answeredInRound; } struct RoundDetails...
contract FluxAggregator is AggregatorV2V3Interface, Owned { using SafeMath for uint256; using SafeMath128 for uint128; using SafeMath64 for uint64; using SafeMath32 for uint32; struct Round { int256 answer; uint64 startedAt; uint64 updatedAt; uint32 answeredInRound; } struct RoundDetails...
40,671
88
// Execute an (ready) operation containing a single transaction.
* Emits a {CallExecuted} event. * * Requirements: * * - the caller must have the 'executor' role. */ function execute( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt ) public payable virtual onlyRoleOrOp...
* Emits a {CallExecuted} event. * * Requirements: * * - the caller must have the 'executor' role. */ function execute( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt ) public payable virtual onlyRoleOrOp...
19,669
53
// if there is no lockingPeriod, add tokens to _unlockedTokens per address
if(lockingPeriod == 0) _unlockedTokens[to] = _unlockedTokens[to].add(tokens);
if(lockingPeriod == 0) _unlockedTokens[to] = _unlockedTokens[to].add(tokens);
15,482
97
// Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address. / Present in ERC777
function _mint(address account_, uint256 ammount_) internal virtual { require(account_ != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address( this ), account_, ammount_); _totalSupply = _totalSupply.add(ammount_); _balances[account_] = _balances[account_].ad...
function _mint(address account_, uint256 ammount_) internal virtual { require(account_ != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address( this ), account_, ammount_); _totalSupply = _totalSupply.add(ammount_); _balances[account_] = _balances[account_].ad...
19,569
7
// map vrf results to rollers
mapping(address => uint256) private s_results; event DiceRolled(uint256 indexed requestId, address indexed roller); event DiceLanded(uint256 indexed requestId, uint256 indexed result);
mapping(address => uint256) private s_results; event DiceRolled(uint256 indexed requestId, address indexed roller); event DiceLanded(uint256 indexed requestId, uint256 indexed result);
12,872
10
// Requires that the time provided is not more than 2 years in the future.
modifier onlyValidScheduledTime(uint256 time) { // timestamp + 2 years can never realistically overflow 256 bits. unchecked { if (time > block.timestamp + MAX_SCHEDULED_TIME_IN_THE_FUTURE) { // Prevent arbitrarily large values from accidentally being set. revert NFTDropMarketCore_Time_To...
modifier onlyValidScheduledTime(uint256 time) { // timestamp + 2 years can never realistically overflow 256 bits. unchecked { if (time > block.timestamp + MAX_SCHEDULED_TIME_IN_THE_FUTURE) { // Prevent arbitrarily large values from accidentally being set. revert NFTDropMarketCore_Time_To...
27,425
4
// Throws when uint265 value overflow
error UintOverflow();
error UintOverflow();
8,160
32
// Stake Star NFT to MasterChef
function enterStakingNFT(uint256 _tokenId) external { address _user = _msgSender(); PoolInfo memory pool; UserInfo storage user = userInfo[0][_user]; UserLpInfo storage userLp = userLpInfo[0][_user]; require(starNFT.ownerOf(_tokenId) == _user, "error"); farmLib.update...
function enterStakingNFT(uint256 _tokenId) external { address _user = _msgSender(); PoolInfo memory pool; UserInfo storage user = userInfo[0][_user]; UserLpInfo storage userLp = userLpInfo[0][_user]; require(starNFT.ownerOf(_tokenId) == _user, "error"); farmLib.update...
9,251
45
// Information isn't considered verified until at least MIN_RESPONSES oracles respond with thesameinformation
emit OracleReport(airline, flight, timestamp, statusCode); if ( oracleResponses[key].responses[statusCode].length >= MIN_RESPONSES ) { emit FlightStatusInfo(airline, flight, timestamp, statusCode);
emit OracleReport(airline, flight, timestamp, statusCode); if ( oracleResponses[key].responses[statusCode].length >= MIN_RESPONSES ) { emit FlightStatusInfo(airline, flight, timestamp, statusCode);
5,754
444
// Max gas fee percentage
uint256 internal constant MAX_GAS_FEE_PERCENTAGE = 103;
uint256 internal constant MAX_GAS_FEE_PERCENTAGE = 103;
15,800
120
// View function to see pending JIAOZIs on frontend.
function pendingJiaozi(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accJiaoziPerShare = pool.accJiaoziPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
function pendingJiaozi(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accJiaoziPerShare = pool.accJiaoziPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
38,272
30
// Main,Destiny Token.
contract DestinyTempleToken is IERC20{ address immutable private deployer; address private _destinySwap; bool initialized; address public constant LIQUIDITY = 0x7777777777777777777777777777777777777777; address constant internal DESTINY_RECORDER = 0x99995D080A1bfa91d065dD14C567089D103BfBB9; address...
contract DestinyTempleToken is IERC20{ address immutable private deployer; address private _destinySwap; bool initialized; address public constant LIQUIDITY = 0x7777777777777777777777777777777777777777; address constant internal DESTINY_RECORDER = 0x99995D080A1bfa91d065dD14C567089D103BfBB9; address...
31,403
5
// Emits a {Deposit} event Requirements:- (`tokenIn`) must be a valid base token. /
function deposit( address receiver, address tokenIn, uint256 amountTokenToDeposit, uint256 minSharesOut ) external payable returns (uint256 amountSharesOut);
function deposit( address receiver, address tokenIn, uint256 amountTokenToDeposit, uint256 minSharesOut ) external payable returns (uint256 amountSharesOut);
22,569
8
// array of Experience structs
Experience[] private _experience;
Experience[] private _experience;
9,133
7
// Zaps from a single token into the LP pool/_curve The address of the curve/_zapAmount The amount to zap, denominated in the ERC20's decimal placing/_deadline Deadline for this zap to be completed by/_minLPAmount Min LP amount to get/isFromBase Is the zap originating from the base? (if base, then not USDC)/ return uin...
function zap( address _curve, uint256 _zapAmount, uint256 _deadline, uint256 _minLPAmount, bool isFromBase
function zap( address _curve, uint256 _zapAmount, uint256 _deadline, uint256 _minLPAmount, bool isFromBase
10,457
202
// How many active tranches we have
uint public trancheCount;
uint public trancheCount;
38,598
1
// The strike price of the option. This is the price at which the option can be exercised. /
uint256 public strikePrice;
uint256 public strikePrice;
25,593
34
// NOTE: is relay banned or not
mapping (address => bool) public blacklist;
mapping (address => bool) public blacklist;
72,489
3
// Gets address of cryptopunk smart contract /
function punkContract() public view returns (address) { return address(_punkContract); }
function punkContract() public view returns (address) { return address(_punkContract); }
42
6
// The number of decimal places of precision in the price ratio of a triggerPrice
uint256 constant private PRICE_BASE = 10 ** 18;
uint256 constant private PRICE_BASE = 10 ** 18;
28,060
114
// Public function to create the ProductionUnitToken contracts.
function createProductionUnit1() public { require(productionUnitTokenContracts.length == 0); createProductionUnitTokenContract(10, 10, 10, 0.0000001 ether, 0.00000001 ether, 1, firstUnitStartTime); }
function createProductionUnit1() public { require(productionUnitTokenContracts.length == 0); createProductionUnitTokenContract(10, 10, 10, 0.0000001 ether, 0.00000001 ether, 1, firstUnitStartTime); }
45,755
127
// Transfer ownership to the admin address who becomes owner of the contract
transferOwnership(_admin);
transferOwnership(_admin);
27,257
39
// Calculate the number of tokens based on the current stage _value The amount of weireturn The number of tokens /
function calculateTokenAmount(uint256 _value) public view returns (uint256) { var tokenAmount = uint256(0); var tokenAmountCurrentStage = uint256(0); var tokenAmountNextStage = uint256(0); var stage1TokensNoDec = stage1Tokens / (10 ** decimals); var stage2TokensNoDec = st...
function calculateTokenAmount(uint256 _value) public view returns (uint256) { var tokenAmount = uint256(0); var tokenAmountCurrentStage = uint256(0); var tokenAmountNextStage = uint256(0); var stage1TokensNoDec = stage1Tokens / (10 ** decimals); var stage2TokensNoDec = st...
27,345
63
// Modifier to protect an initializer function from being invoked twice. /
modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true;
modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true;
4,231
40
// Calculates the current supply interest rate per block cash The total amount of cash the market has borrows The total amount of borrows the market has outstanding reserves The total amount of reserves the market has reserveFactorMantissa The current reserve factor the market hasreturn The supply rate per block (as a ...
function getSupplyRate( uint256 cash, uint256 borrows, uint256 reserves,
function getSupplyRate( uint256 cash, uint256 borrows, uint256 reserves,
27,311
131
// team renounce blacklist commands
function renounceBlacklist() public onlyOwner { blacklistRenounced = true; }
function renounceBlacklist() public onlyOwner { blacklistRenounced = true; }
5,992
77
// Creates a vesting contract that vests its balance of Cnus token to the_beneficiary, gradually in periodic interval until all of the balance will havevested by periodrelease count time. _beneficiary address of the beneficiary to whom vested tokens are transferred _startInUnixEpochTime the time (as Unix time) at which...
function createNewVesting( address _beneficiary, uint256 _startInUnixEpochTime, uint256 _releasePeriodInSeconds, uint256 _releaseCount ) public onlyOwner
function createNewVesting( address _beneficiary, uint256 _startInUnixEpochTime, uint256 _releasePeriodInSeconds, uint256 _releaseCount ) public onlyOwner
46,722
72
// _tier1StartTime setter. /
function setTier1StartTime(uint256 newTime) public { require(msg.sender == _owner, "Msg sender needs to be the owner"); _tier1StartTime = newTime; }
function setTier1StartTime(uint256 newTime) public { require(msg.sender == _owner, "Msg sender needs to be the owner"); _tier1StartTime = newTime; }
41,988
197
// Mapping from token ID to whether the Kami was minted before reveal
mapping (uint256 => bool) private _mintedBeforeReveal;
mapping (uint256 => bool) private _mintedBeforeReveal;
45,624
1
// ========== VIEWS ========== // ---------- Internal ---------- // @inheritdoc BaseTokenInitializable
function _getPrefix() internal virtual override returns (string memory) { return "w"; }
function _getPrefix() internal virtual override returns (string memory) { return "w"; }
48,851
8
// Set the descriptor. Only callable by the grounders. /
function setDescriptor(IPlacesDescriptor placesDescriptor) external onlyGrounders
function setDescriptor(IPlacesDescriptor placesDescriptor) external onlyGrounders
7,766
153
// Set the address of the InterestModel contractinterestModelAddr The address of the InterestModel contract return true (TODO: validate results)/
function setInterestModel(address interestModelAddr) onlyOwner public returns (bool)
function setInterestModel(address interestModelAddr) onlyOwner public returns (bool)
20,606
145
// the percentage of the total reward to be swap to HAT and to be burned
uint256 swapAndBurn;
uint256 swapAndBurn;
974
79
// get next stake id
function _next_stake_id() internal returns (uint)
function _next_stake_id() internal returns (uint)
24,499
23
// Returns true iff the _seller holds at least _numCoupons coupons.
function sellerHasTheCoupons(address _seller, uint256 _epoch, uint256 _numCoupons) public view returns (bool) { return ( ESDS.balanceOfCoupons(_seller, _epoch) >= _numCoupons ); }
function sellerHasTheCoupons(address _seller, uint256 _epoch, uint256 _numCoupons) public view returns (bool) { return ( ESDS.balanceOfCoupons(_seller, _epoch) >= _numCoupons ); }
33,705
291
// Gets the official ENS reverse registrar./
function getENSReverseRegistrar() public view returns (ENSReverseRegistrar) { return ENSReverseRegistrar(getENSRegistry().owner(ADDR_REVERSE_NODE)); }
function getENSReverseRegistrar() public view returns (ENSReverseRegistrar) { return ENSReverseRegistrar(getENSRegistry().owner(ADDR_REVERSE_NODE)); }
62,196
48
// register the deposit/
{ TokenDeposit(_tokenAddr,_from,_amount); nonce++; if (tokenBalances[_tokenAddr] == 0) { tokens.push(_tokenAddr); tokenBalances[_tokenAddr] = ERC20(_tokenAddr).balanceOf(this); } else { tokenBalances[_tokenAddr] += _amount; } }
{ TokenDeposit(_tokenAddr,_from,_amount); nonce++; if (tokenBalances[_tokenAddr] == 0) { tokens.push(_tokenAddr); tokenBalances[_tokenAddr] = ERC20(_tokenAddr).balanceOf(this); } else { tokenBalances[_tokenAddr] += _amount; } }
5,376
57
// check result against bet and pay if win
checkBetResult(wheelResult, playerSpinned, blockHash, shaPlayer);
checkBetResult(wheelResult, playerSpinned, blockHash, shaPlayer);
5,849
142
// Returns the total supply /
function totalSupply() external view virtual returns (uint256) { return supply; }
function totalSupply() external view virtual returns (uint256) { return supply; }
48,804
3,568
// 1786
entry "palaeoecologically" : ENG_ADVERB
entry "palaeoecologically" : ENG_ADVERB
22,622
56
// Transfer payment into contract
uint _amountOwed = Loans[_loanID].Loan_Info.Amount_Owed_Next_Payment; if (_onBehalf) { require(ERC20(_asset).transferFrom(msg.sender, address(this), _amountOwed), "Caller lacks funds or approval to make payment."); }
uint _amountOwed = Loans[_loanID].Loan_Info.Amount_Owed_Next_Payment; if (_onBehalf) { require(ERC20(_asset).transferFrom(msg.sender, address(this), _amountOwed), "Caller lacks funds or approval to make payment."); }
18,927