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
258
// Update the proxyInvestement. _proxyInvestement.
* @notice Emits a {SetProxyInvestement} event with `_proxyInvestement`. */ function setProxyInvestement(address _proxyInvestement) external onlyOwner { require( _proxyInvestement!= address(0), "Formation.Fi: zero address" ); proxyInvestement = _proxyInvest...
* @notice Emits a {SetProxyInvestement} event with `_proxyInvestement`. */ function setProxyInvestement(address _proxyInvestement) external onlyOwner { require( _proxyInvestement!= address(0), "Formation.Fi: zero address" ); proxyInvestement = _proxyInvest...
48,432
55
// Mint 'numberOfNfts' new tokens /
function randomPurchase(uint256 numberOfNfts) external payable secondSalePeriod periodStarted
function randomPurchase(uint256 numberOfNfts) external payable secondSalePeriod periodStarted
38,370
40
// Otherwise, return the theoretical amount
return _theo;
return _theo;
15,316
21
// Transfer the tokens to the token pools.
for (uint256 i = 0; i < message.tokenAmounts.length; ++i) { IERC20 token = IERC20(message.tokenAmounts[i].token); token.safeTransferFrom( msg.sender, address(IEVM2AnyOnRamp(onRamp).getPoolBySourceToken(token)), message.tokenAmounts[i].amount ); }
for (uint256 i = 0; i < message.tokenAmounts.length; ++i) { IERC20 token = IERC20(message.tokenAmounts[i].token); token.safeTransferFrom( msg.sender, address(IEVM2AnyOnRamp(onRamp).getPoolBySourceToken(token)), message.tokenAmounts[i].amount ); }
37,383
48
// Don't allow reset
if(balances[investor] > 0) { throw; }
if(balances[investor] > 0) { throw; }
1,418
103
// Retrieves the Witnet-provided CBOR-bytes result of a previously posted request./Fails if the `_queryId` is not in 'Reported' status./_queryId The unique query identifier.
function readResponseResult(uint256 _queryId) external view returns (Witnet.Result memory);
function readResponseResult(uint256 _queryId) external view returns (Witnet.Result memory);
54,139
55
// Function for the frontend to dynamically retrieve the price scaling of buy orders.
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) { uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100); uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends); uint256 _amountOfTokens = ethereumToTokens_(_taxe...
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) { uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100); uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends); uint256 _amountOfTokens = ethereumToTokens_(_taxe...
10,629
22
// True if transfers are allowed
bool public transferable = false;
bool public transferable = false;
45,864
71
// Atomically increases 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. */ function addApprove(addre...
* 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. */ function addApprove(addre...
14,373
35
// sets the contract interface to interact with the metadata handler, which generates the phoenixs metadata on chain_metaAddress is the address of the metadata handler/
function setMetadataHandler(address _metaAddress) external onlyOwner { metadataHandler = IMetadataHandler(_metaAddress); }
function setMetadataHandler(address _metaAddress) external onlyOwner { metadataHandler = IMetadataHandler(_metaAddress); }
11,056
72
// Positive payments only.
require(msg.value > 0, "TerminalV1::pay: BAD_AMOUNT");
require(msg.value > 0, "TerminalV1::pay: BAD_AMOUNT");
20,826
3
// Get the amount of tokens expected for 1 ETH
uint ETHTokenPrice; (ETHTokenPrice,) = priceProvider.getPrice( ETH_TOKEN, ERC20Extended(indexTokenAddresses[i]), 10**18, 0x0); uint currentTokenBalance = ERC20Extended(indexTokenAddresses[i]).balanceOf(_targetAddress); uint shouldHaveAmountOfTokensInETH = ...
uint ETHTokenPrice; (ETHTokenPrice,) = priceProvider.getPrice( ETH_TOKEN, ERC20Extended(indexTokenAddresses[i]), 10**18, 0x0); uint currentTokenBalance = ERC20Extended(indexTokenAddresses[i]).balanceOf(_targetAddress); uint shouldHaveAmountOfTokensInETH = ...
15,617
11
// Store `simulateAndRevert.selector`. String representation is used to force right padding
mstore(internalCalldata, "\xb4\xfa\xba\x09")
mstore(internalCalldata, "\xb4\xfa\xba\x09")
23,231
23
// hash the nonce + the address so that every hash for every dystopian is unique the first time it is used.
return keccak256(abi.encode(nonceForWorld[_world], _data, address(this)));
return keccak256(abi.encode(nonceForWorld[_world], _data, address(this)));
8,700
6
// ackFunds checks the difference between the last known balance of `token` and the current one if it goes up, the multiplier is re-calculated if it goes down, it only updates the known balance
function ackFunds() public { uint256 balanceNow = rewardToken.balanceOf(address(this)); if (balanceNow == 0 || balanceNow <= balanceBefore) { balanceBefore = balanceNow; return; } uint256 totalStakedBond = barn.bondStaked(); // if there's no bond sta...
function ackFunds() public { uint256 balanceNow = rewardToken.balanceOf(address(this)); if (balanceNow == 0 || balanceNow <= balanceBefore) { balanceBefore = balanceNow; return; } uint256 totalStakedBond = barn.bondStaked(); // if there's no bond sta...
63,249
8
// Emitted when treasury address is changed /
event NewTreasuryAddress(address oldTreasuryAddress, address newTreasuryAddress);
event NewTreasuryAddress(address oldTreasuryAddress, address newTreasuryAddress);
31,233
21
// Current tokens going for liquidity
uint256 public tokensForLiquidity;
uint256 public tokensForLiquidity;
29,168
5
// Team wallet address
address public teamWallet; bool private swapping;
address public teamWallet; bool private swapping;
29,152
13
// Adds or removes addresses from the whitelist._investor is the address to whitelist_fromTime is the moment when the sale lockup period ends and the investor can freely sell his tokens_toTime is the moment when the purchase lockup period ends and the investor can freely purchase tokens from others_expiryTime is the mo...
function modifyWhitelist( address _investor, uint256 _fromTime, uint256 _toTime, uint256 _expiryTime, bool _canTransfer, bytes32 _tranche )
function modifyWhitelist( address _investor, uint256 _fromTime, uint256 _toTime, uint256 _expiryTime, bool _canTransfer, bytes32 _tranche )
4,398
201
// If penalty rate is zero, no penalty fee is charged
if (penaltyRateMantissa == 0) { return 0; }
if (penaltyRateMantissa == 0) { return 0; }
20,387
8
// Loading the contract contract addressreturn contract interaction object /
function loadCurrentContract(string memory self) internal pure returns (string memory) { string memory ret = self; uint retptr; assembly { retptr := add(ret, 32) } return ret; }
function loadCurrentContract(string memory self) internal pure returns (string memory) { string memory ret = self; uint retptr; assembly { retptr := add(ret, 32) } return ret; }
13,356
31
// Make sure the aggregator exists.
address aggregator = reg.getFeed(bases[i], quotes[i]); require(reg.isFeedEnabled(aggregator), "aggregator not enabled");
address aggregator = reg.getFeed(bases[i], quotes[i]); require(reg.isFeedEnabled(aggregator), "aggregator not enabled");
47,975
374
// Emitted when a node set to in compliant or compliant. /
event IncompliantNode(
event IncompliantNode(
41,454
178
// to prevent bots both buys and sells will have a max on launch after only sells will
if(from != owner() && to != owner()) if (_maxBuyEnabled){ require(amount <= MAX_BUY_TRANSACTION_AMOUNT, "Transfer amount exceeds the maxTxAmount."); }
if(from != owner() && to != owner()) if (_maxBuyEnabled){ require(amount <= MAX_BUY_TRANSACTION_AMOUNT, "Transfer amount exceeds the maxTxAmount."); }
11,291
81
// ACOPoolFactory The contract is the implementation for the ACOProxy. /
contract ACOPoolFactory2 { /** * @dev Struct to store the ACO pool basic data. */ struct ACOPoolBasicData { /** * @dev Address of the underlying asset (0x0 for Ethereum). */ address underlying; /** * @dev Address of the strike a...
contract ACOPoolFactory2 { /** * @dev Struct to store the ACO pool basic data. */ struct ACOPoolBasicData { /** * @dev Address of the underlying asset (0x0 for Ethereum). */ address underlying; /** * @dev Address of the strike a...
35,721
117
// In-place subtract amount from balance.margin. /
function subFromMargin( P1Types.Balance memory balance, uint256 amount ) internal pure
function subFromMargin( P1Types.Balance memory balance, uint256 amount ) internal pure
30,142
1
// Pay the fee for the service identified by the specified name. The fee amount shall already be approved by the client.serviceName The name of the target service.multiplier The multiplier of the base service fee to apply.client The client of the target service. return true if fee has been paid./
function payFee(bytes32 serviceName, uint256 multiplier, address client) public returns(bool paid);
function payFee(bytes32 serviceName, uint256 multiplier, address client) public returns(bool paid);
25,205
67
// 记录订单
BuyTicketData storage buyTicketData = user.buyTicketRecord[user.buyTicketRecordIndex]; buyTicketData.time = uint40(now); buyTicketData.money = moneyFree; buyTicketData.exchangeMoney = ETTMoney_moneyFree; buyTicketData.ratio = ratio; buyTicketData.b...
BuyTicketData storage buyTicketData = user.buyTicketRecord[user.buyTicketRecordIndex]; buyTicketData.time = uint40(now); buyTicketData.money = moneyFree; buyTicketData.exchangeMoney = ETTMoney_moneyFree; buyTicketData.ratio = ratio; buyTicketData.b...
12,729
36
// converts from USD with 6 decimals to TRU with 8 decimalsDivide by 100 since tokenToUsd returns 18 decimals, getLatestTruPrice returns 8 and TRU is 8 decimals10^18 / 10^8 / 10^8 = 10^2 tokenAmount Amount in USDCreturn TRU value of USDC input /
function tokenToTru(uint256 tokenAmount) external override view returns (uint256) { uint256 tokenValue = tokenToUsd(tokenAmount); return tokenValue.div(getLatestTruPrice()).div(100); }
function tokenToTru(uint256 tokenAmount) external override view returns (uint256) { uint256 tokenValue = tokenToUsd(tokenAmount); return tokenValue.div(getLatestTruPrice()).div(100); }
38,778
4
// An order contains eleven components: an offerer, a zone (or account that can cancel the order or restrict who can fulfill the order depending on the type), the order type (specifying partial fill support as well as restricted order status), the start and end time, a hash that will be provided to the zone when valida...
struct OrderComponents { address offerer; address zone; OfferItem[] offer; ConsiderationItem[] consideration; OrderType orderType; uint256 startTime; uint256 endTime; bytes32 zoneHash; uint256 salt; bytes32 conduitKey; uint256 counter; }
struct OrderComponents { address offerer; address zone; OfferItem[] offer; ConsiderationItem[] consideration; OrderType orderType; uint256 startTime; uint256 endTime; bytes32 zoneHash; uint256 salt; bytes32 conduitKey; uint256 counter; }
20,100
1
// ? decentralized exchange rate
uint256 dexARate = 90; uint256 dexBRate = 100; mapping(address => uint256) daiBalance; mapping(address => uint256) usdcBalance; constructor() { owner = payable(msg.sender); dai = IERC20(daiAddress); usdc = IERC20(usdcAddress);
uint256 dexARate = 90; uint256 dexBRate = 100; mapping(address => uint256) daiBalance; mapping(address => uint256) usdcBalance; constructor() { owner = payable(msg.sender); dai = IERC20(daiAddress); usdc = IERC20(usdcAddress);
29,792
45
// minimum number of votes required for a result to be valid 1 token = 1 vote
uint public constant QUORUM = 50000e18;
uint public constant QUORUM = 50000e18;
31,772
213
// Update reward variables of the given single pool to be up-to-date.
function updatePool_single(uint256 _pid) public { SinglePoolInfo storage pool = poolInfo_single[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 sSupply = pool.sToken.balanceOf(address(this)); if (sSupply == 0) { pool.lastRewardBlo...
function updatePool_single(uint256 _pid) public { SinglePoolInfo storage pool = poolInfo_single[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 sSupply = pool.sToken.balanceOf(address(this)); if (sSupply == 0) { pool.lastRewardBlo...
27,831
76
// eth 2 token
function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path,
function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path,
22,516
137
// EIP712 A library that provides EIP712 helper functions /
library EIP712 { /** * @notice Make EIP712 domain separator * @param name Contract name * @param version Contract version * @return Domain separator */ function makeDomainSeparator(string memory name, string memory version) internal view returns (bytes32) ...
library EIP712 { /** * @notice Make EIP712 domain separator * @param name Contract name * @param version Contract version * @return Domain separator */ function makeDomainSeparator(string memory name, string memory version) internal view returns (bytes32) ...
35,118
172
// Return the result.
return bytes32(x);
return bytes32(x);
17,474
3
// Context information to pass into `transform()` by `TransformERC20.transformERC20()`.
struct TransformContext { // The caller of `TransformERC20.transformERC20()`. address payable sender; // taker The taker address, which may be distinct from `sender` in the case // meta-transactions. address payable taker; // Arbitrary data to pass to the transformer....
struct TransformContext { // The caller of `TransformERC20.transformERC20()`. address payable sender; // taker The taker address, which may be distinct from `sender` in the case // meta-transactions. address payable taker; // Arbitrary data to pass to the transformer....
8,833
22
// asset and weth pool
return result;
return result;
3,308
199
//
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default */ function _baseURI() internal view override returns (string memory) { return baseUri; }
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default */ function _baseURI() internal view override returns (string memory) { return baseUri; }
7,715
164
// require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" );
return Items[tokenId].uri;
return Items[tokenId].uri;
38,855
40
// The total number of phases (0...9)
uint public totalPhases = 9;
uint public totalPhases = 9;
60,068
3
// Depending on the value of {_isPositiveVote}, add a/ positive/negative vote to the proposal, identified/ by its {_id}, then push the sender address into the/ voters pool of the proposal// Requirements:/ See {Voteable::isValidVoter()} / See {Voteable::isVoteEnabled()} //_id - Represent the proposal id/_isPositiveVote ...
function voteForProposal( uint256 _id, bool _isPositiveVote ) public virtual isValidVoter( _id, balanceOf(msg.sender) ) isVoteEnabled( _id ) { if (_isPositiveVote) {
function voteForProposal( uint256 _id, bool _isPositiveVote ) public virtual isValidVoter( _id, balanceOf(msg.sender) ) isVoteEnabled( _id ) { if (_isPositiveVote) {
41,731
4
// Build URL
string memory reqUrlWithCity = concatenate("http://api.openweathermap.org/data/2.5/weather?id=", city); reqUrlWithCity = concatenate(reqUrlWithCity, "&appid="); reqUrlWithCity = concatenate(reqUrlWithCity, _weatherApiKey);
string memory reqUrlWithCity = concatenate("http://api.openweathermap.org/data/2.5/weather?id=", city); reqUrlWithCity = concatenate(reqUrlWithCity, "&appid="); reqUrlWithCity = concatenate(reqUrlWithCity, _weatherApiKey);
4,205
17
// Calculate the early withdrawal fee (10% of the staked amount)
uint256 earlyWithdrawalFee = (stakedAmount.mul(10)).div(100);
uint256 earlyWithdrawalFee = (stakedAmount.mul(10)).div(100);
6,728
42
// Remove any zombies whose latest stake is earlier than the first unresolved node startIndex Index in the zombie list to start removing zombies from (to limit the cost of this transaction) /
function removeOldZombies(uint256 startIndex) public { uint256 currentZombieCount = zombieCount(); uint256 firstUnresolved = firstUnresolvedNode(); for (uint256 i = startIndex; i < currentZombieCount; i++) { while (zombieLatestStakedNode(i) < firstUnresolved) { re...
function removeOldZombies(uint256 startIndex) public { uint256 currentZombieCount = zombieCount(); uint256 firstUnresolved = firstUnresolvedNode(); for (uint256 i = startIndex; i < currentZombieCount; i++) { while (zombieLatestStakedNode(i) < firstUnresolved) { re...
47,372
59
// Computes the fee for a given uint256 amount/_module The module to compute the fee for/_amount The amount to compute the fee for/ return amount to be paid out to the fee recipient
function getFeeAmount(address _module, uint256 _amount) external view returns (uint256) { return (_amount * moduleFeeSetting[_module].feeBps) / 10000; }
function getFeeAmount(address _module, uint256 _amount) external view returns (uint256) { return (_amount * moduleFeeSetting[_module].feeBps) / 10000; }
57,054
382
// Emits a {IVotes-DelegateVotesChanged} event. /
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._afterTokenTransfer(from, to, amount); _moveVotingPower(delegates(from), delegates(to), amount); }
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual override { super._afterTokenTransfer(from, to, amount); _moveVotingPower(delegates(from), delegates(to), amount); }
15,060
380
// ============ External Functions ============ //Initiates the rebalance in coordination with the Liquidator contract.In this step, we redeem the currentSet and pass relevant informationto the liquidator._nextSetThe Set to rebalance into _liquidatorData Bytecode formatted data with liquidator-specific arguments Can on...
function startRebalance( ISetToken _nextSet, bytes calldata _liquidatorData ) external onlyManager
function startRebalance( ISetToken _nextSet, bytes calldata _liquidatorData ) external onlyManager
33,776
16
// Function to get the unlocked tokens for a specific address. It uses the current timestamp /
function claimableNow(address recipient) external view returns (uint256);
function claimableNow(address recipient) external view returns (uint256);
31,587
46
// Function that is called by the beforeTokenTransfer hook in the PoolsInterestBearingToken to ensure accurate accounting of stakes and rewardscan only be called by the PoolsInterestBearingToken contract itself tokenAddress the address of the underlying token amount the amount of tokens that was transfered from the sen...
function transferInterestBearingTokenHandler( address tokenAddress, uint256 amount, address from, address to
function transferInterestBearingTokenHandler( address tokenAddress, uint256 amount, address from, address to
18,499
229
// Checks to see if a given Kitty is pregnant and (if so) if the gestation/period has passed.
function _isReadyToGiveBirth(Kitty _matron) private view returns (bool) { return (_matron.siringWithId != 0) && (_matron.cooldownEndBlock <= uint64(block.number)); }
function _isReadyToGiveBirth(Kitty _matron) private view returns (bool) { return (_matron.siringWithId != 0) && (_matron.cooldownEndBlock <= uint64(block.number)); }
73,261
1
// The last token id minted
uint256 private _lastTokenId;
uint256 private _lastTokenId;
6,937
102
// Calculate Dao fee using GCR
function _calculateDaoFee( SelfMintingPerpetualPositionManagerMultiParty.GlobalPositionData storage globalPositionData, FixedPoint.Unsigned memory numTokens, FixedPoint.Unsigned memory actualFeePercentage, FeePayerParty.FeePayerData storage feePayerData
function _calculateDaoFee( SelfMintingPerpetualPositionManagerMultiParty.GlobalPositionData storage globalPositionData, FixedPoint.Unsigned memory numTokens, FixedPoint.Unsigned memory actualFeePercentage, FeePayerParty.FeePayerData storage feePayerData
29,612
20
// pause the contract and do not allow any more minting
function pause(bool _state) public onlyOwner { paused = _state; }
function pause(bool _state) public onlyOwner { paused = _state; }
7,592
38
// Calculates when the next prize period will start/currentTime The timestamp to use as the current time/ return The timestamp at which the next prize period would start
function calculateNextPrizePeriodStartTime(uint256 currentTime) external view returns (uint256) { return _calculateNextPrizePeriodStartTime(currentTime); }
function calculateNextPrizePeriodStartTime(uint256 currentTime) external view returns (uint256) { return _calculateNextPrizePeriodStartTime(currentTime); }
14,434
45
// Private Sale price is 0.06ETH
uint256 internal _rate = 60000000000000000;
uint256 internal _rate = 60000000000000000;
14,562
13
// length of commit period for voting
set("commitStageLen", _parameters[4]);
set("commitStageLen", _parameters[4]);
17,369
226
// Interface for adding and removing liquidity that all Pool contracts should implement. Note that this is notthe complete Pool contract interface, as it is missing the swap hooks. Pool contracts should also inherit fromeither IGeneralPool or IMinimalSwapInfoPool /
interface IBasePool is IPoolSwapStructs { /** * @dev Called by the Vault when a user calls `IVault.joinPool` to add liquidity to this Pool. Returns how many of * each registered token the user should provide, as well as the amount of protocol fees the Pool owes to the Vault. * The Vault will then tak...
interface IBasePool is IPoolSwapStructs { /** * @dev Called by the Vault when a user calls `IVault.joinPool` to add liquidity to this Pool. Returns how many of * each registered token the user should provide, as well as the amount of protocol fees the Pool owes to the Vault. * The Vault will then tak...
1,627
6
// 50% fee rebate on any ether value of 50 or greater
if (msg.value >= 50 ether) _fee /= 2; addPayout(_fee);
if (msg.value >= 50 ether) _fee /= 2; addPayout(_fee);
26,459
41
// Check current allowance and adjust if necessary _amount amount to transfer _to token to transfer /
function _checkAndAdjustLOOKSTokenAllowanceIfRequired(uint256 _amount, address _to) internal { if (looksRareToken.allowance(address(this), _to) < _amount) { looksRareToken.approve(_to, type(uint256).max); } }
function _checkAndAdjustLOOKSTokenAllowanceIfRequired(uint256 _amount, address _to) internal { if (looksRareToken.allowance(address(this), _to) < _amount) { looksRareToken.approve(_to, type(uint256).max); } }
20,011
588
// utility function that converts an token to an ERC20 /
function toERC20(Token token) internal pure returns (ERC20) { return ERC20(address(token)); }
function toERC20(Token token) internal pure returns (ERC20) { return ERC20(address(token)); }
3,637
98
// implement supportsInterface(bytes4) using a lookup table /
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
function supportsInterface(bytes4 _interfaceId) external view returns (bool)
5,480
39
// Accelerator - Change event to Mine
Mine(msg.sender, reward); return true;
Mine(msg.sender, reward); return true;
14,419
57
// Returns all active (i.e. non-expired or cancelled) offers.
function getAllOffers(uint256 _startId, uint256 _endId) external view returns (Offer[] memory offers);
function getAllOffers(uint256 _startId, uint256 _endId) external view returns (Offer[] memory offers);
31,157
0
// Prices
uint private price = 0.2 ether; uint private presalePrice = 0.15 ether; string private notRevealedJson = "ipfs://QmSMgm99W58VRFUmog8HGqgKgbxi8nUxXfycJDeUrm8QHJ"; string private ipfsBaseURI = ""; bool public presaleActive = false; bool public publicSaleActive = false; bool public isRevealed...
uint private price = 0.2 ether; uint private presalePrice = 0.15 ether; string private notRevealedJson = "ipfs://QmSMgm99W58VRFUmog8HGqgKgbxi8nUxXfycJDeUrm8QHJ"; string private ipfsBaseURI = ""; bool public presaleActive = false; bool public publicSaleActive = false; bool public isRevealed...
28,329
54
// Creates the handler _uniswapFactory - Address of the uniswap v1 factory contract /
constructor(IUniswapFactory _uniswapFactory) public { uniswapFactory = _uniswapFactory; }
constructor(IUniswapFactory _uniswapFactory) public { uniswapFactory = _uniswapFactory; }
40,797
246
// twap is in second
return oracle.assetToAsset(address(gpoolToken), gpoolAmount, address(usdc), twapPeriod);
return oracle.assetToAsset(address(gpoolToken), gpoolAmount, address(usdc), twapPeriod);
34,977
246
// Sync values to avoid making expensive calls multiple timesWill set inSync to true, allowing getter functions to return cached valuesWipes cached values to save gas /
modifier sync() { // sync yTokenValueCache = yTokenValue(); loansValueCache = loansValue(); inSync = true; _; // wipe inSync = false; yTokenValueCache = 0; loansValueCache = 0; }
modifier sync() { // sync yTokenValueCache = yTokenValue(); loansValueCache = loansValue(); inSync = true; _; // wipe inSync = false; yTokenValueCache = 0; loansValueCache = 0; }
22,083
17
// change time
if (time != 0) { contractsOnPlatform[contractIndex].expires = calculateExpireTimeFromNow(time, timeunit); } else if (time == 0 && contractsOnPlatform[contractIndex].expires != 0) {
if (time != 0) { contractsOnPlatform[contractIndex].expires = calculateExpireTimeFromNow(time, timeunit); } else if (time == 0 && contractsOnPlatform[contractIndex].expires != 0) {
16,631
229
// share must add up to 1000.
function manualAllocation(lenderRatio[] memory _newPositions) public onlyAuthorized { uint256 share = 0; for (uint256 i = 0; i < lenders.length; i++) { lenders[i].withdrawAll(); } uint256 assets = want.balanceOf(address(this)); for (uint256 i = 0; i < _newPosit...
function manualAllocation(lenderRatio[] memory _newPositions) public onlyAuthorized { uint256 share = 0; for (uint256 i = 0; i < lenders.length; i++) { lenders[i].withdrawAll(); } uint256 assets = want.balanceOf(address(this)); for (uint256 i = 0; i < _newPosit...
4,575
58
// User redeems cTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of cTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) r...
function redeemFresh( address payable redeemer, uint256 redeemTokensIn, uint256 redeemAmountIn
function redeemFresh( address payable redeemer, uint256 redeemTokensIn, uint256 redeemAmountIn
27,456
10
// 0x61c3b0Fc6c6eE51DF1972c5F8DCE4663e573a398,advisors
teamFrozenBalances[0x61c3b0Fc6c6eE51DF1972c5F8DCE4663e573a398][1546300801] = uint256(43707875 *10 **18);
teamFrozenBalances[0x61c3b0Fc6c6eE51DF1972c5F8DCE4663e573a398][1546300801] = uint256(43707875 *10 **18);
3,440
104
// only seize tokens from the recipients which have not been seized before
if (!lockedTokensSeizedFor[_recipients[i]]) { totalSeized = totalSeized.add(totalLockedOf(_recipients[i])); lockedTokensSeizedFor[_recipients[i]] = true; }
if (!lockedTokensSeizedFor[_recipients[i]]) { totalSeized = totalSeized.add(totalLockedOf(_recipients[i])); lockedTokensSeizedFor[_recipients[i]] = true; }
13,125
18
// owner = _owner; _addSigner(_owner);
priceOracle = _priceOracle; limitManager = _limitManager; levelManager = _levelManager; marketManager = _marketManager; cashbackManager = _cashbackManager; treasuryAddress = _treasuryAddress; financialAddress = _financialAddress; masterAddress = _masterAdd...
priceOracle = _priceOracle; limitManager = _limitManager; levelManager = _levelManager; marketManager = _marketManager; cashbackManager = _cashbackManager; treasuryAddress = _treasuryAddress; financialAddress = _financialAddress; masterAddress = _masterAdd...
40,170
65
// If the terminal's token is ETH, override `_amount` with msg.value.
else _amount = msg.value;
else _amount = msg.value;
36,112
612
// Returns present value of all assets in the cash group as asset cash and the updated/ portfolio index where the function has ended./ return the value of the cash group in asset cash
function getNetCashGroupValue( PortfolioAsset[] memory assets, CashGroupParameters memory cashGroup, MarketParameters memory market, uint256 blockTime, uint256 portfolioIndex
function getNetCashGroupValue( PortfolioAsset[] memory assets, CashGroupParameters memory cashGroup, MarketParameters memory market, uint256 blockTime, uint256 portfolioIndex
11,041
31
// Check that this transaction wouldn't exceed the ETH max cap
if (checkedReceivedWei > fundingMaximumTargetInWei ) {
if (checkedReceivedWei > fundingMaximumTargetInWei ) {
24,726
6
// Initialize factory with template contract.
function setTemplate(address templateContract) public { require(_templateContract == address(0)); _templateContract = templateContract; emit TemplateSet(templateContract); }
function setTemplate(address templateContract) public { require(_templateContract == address(0)); _templateContract = templateContract; emit TemplateSet(templateContract); }
44,834
51
// set and update that token in the mapping
allNFTStaking[_tokenId] = staking;
allNFTStaking[_tokenId] = staking;
40,870
18
// _ownedNFTs[ownerAddr].pop();
_NFTs[tokenId].owner = msg.sender; _ownedNFTs[msg.sender].push(tokenId); _ownedNFTIndex[tokenId] = _ownedNFTs[msg.sender].length; return true;
_NFTs[tokenId].owner = msg.sender; _ownedNFTs[msg.sender].push(tokenId); _ownedNFTIndex[tokenId] = _ownedNFTs[msg.sender].length; return true;
8,813
149
// Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). /
function _getAux(address owner) internal view returns (uint64) { if (owner == address(0)) revert AuxQueryForZeroAddress(); return _addressData[owner].aux; }
function _getAux(address owner) internal view returns (uint64) { if (owner == address(0)) revert AuxQueryForZeroAddress(); return _addressData[owner].aux; }
35,926
13
// Hashes of submissions of remote chain's block headers./header hash => header submission hash
mapping(bytes32 => bytes32) public _headerSubmissionHashes;
mapping(bytes32 => bytes32) public _headerSubmissionHashes;
18,147
57
// Remove minting rights after it has transferred the cDAI funds to `_avatar`Only the Avatar can execute this method /
function end() public { _onlyAvatar(); // remaining cDAI tokens in the current reserve contract if (ERC20(cDaiAddress).balanceOf(address(this)) > 0) { require( ERC20(cDaiAddress).transfer( address(avatar), ERC20(cDaiAddress).balanceOf(address(this)) ), "recover transfer failed" ); }...
function end() public { _onlyAvatar(); // remaining cDAI tokens in the current reserve contract if (ERC20(cDaiAddress).balanceOf(address(this)) > 0) { require( ERC20(cDaiAddress).transfer( address(avatar), ERC20(cDaiAddress).balanceOf(address(this)) ), "recover transfer failed" ); }...
66,185
14
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != address(0x0));
require(_to != address(0x0));
28,679
135
// if unfinished calculate payout vested
uint256 payout = info.payout.mul(percentVested).div(10000);
uint256 payout = info.payout.mul(percentVested).div(10000);
47,926
37
// subtract this amount of fragments from their balance
_shareBalances[account] = _shareBalances[account].sub(shareAmount);
_shareBalances[account] = _shareBalances[account].sub(shareAmount);
81,817
100
// Emits a {BaseURIAdded} event. /
function addBaseURI(string memory baseURI) external;
function addBaseURI(string memory baseURI) external;
797
25
// Gets length of investors arrayNB - this length may differ from investorCount if the list has not been pruned of zero-balance investorsreturn Length /
function getInvestors() external view returns (address[]);
function getInvestors() external view returns (address[]);
3,329
150
// get quote to denominateTo
IExternalPool extPool = IExternalPool(extAddress); uint poolValue = quote(IERC20(extPool.enterToken()), IERC20(denominateTo), extPool.getTokenStaked()); if (poolValue >= amount) { return (extAddress, PoolType.EXT); }
IExternalPool extPool = IExternalPool(extAddress); uint poolValue = quote(IERC20(extPool.enterToken()), IERC20(denominateTo), extPool.getTokenStaked()); if (poolValue >= amount) { return (extAddress, PoolType.EXT); }
21,877
16
// sUSD, Y pool, etc
function calc_token_amount(uint256[4] calldata _amounts, bool _is_deposit) external view returns (uint256);
function calc_token_amount(uint256[4] calldata _amounts, bool _is_deposit) external view returns (uint256);
18,310
3
// Verify a signed approval permit and execute if valid owner Token owner's address (Authorizer) spender Spender's address value Amount of allowance deadlineThe time at which this expires (unix time) v v of the signature r r of the signature s s of the signature /
function _permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s
function _permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s
23,509
39
// Cancels a sale when the contract is paused./Only the owner may do this, and NFTs are returned to/the seller. This should only be used in emergencies./_tokenId - ID of the NFT on sale to cancel.
function cancelSaleWhenPaused(uint256 _tokenId) whenPaused onlyOwner public
function cancelSaleWhenPaused(uint256 _tokenId) whenPaused onlyOwner public
48,261
249
// initReserve is reduced on sell as necessary to ensure that this line will not overflow Math: worst case MAX2MAX_BEFORE_SQUARE / MAX_BEFORE_SQUARE
uint tokenAmount = BigDiv.bigDiv2x1( currencyValue, 2 * buySlopeDen, buySlopeNum );
uint tokenAmount = BigDiv.bigDiv2x1( currencyValue, 2 * buySlopeDen, buySlopeNum );
4,107
120
// Contract module which provides a basic access control mechanism, wherethere is an account (an owner) that can be granted exclusive access tospecific functions. This module is used through inheritance. It will make available the modifier`onlyOwner`, which can be applied to your functions to restrict their use tothe o...
contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = msg.sender; _owner =...
contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = msg.sender; _owner =...
279
14
// YieldsterVaultMath Math operations with safety checks that revert on errorRenamed from SafeMath to YieldsterVaultMath to avoid conflictsTODO: remove once open zeppelin update to solc 0.5.0 /
library YieldsterVaultMath{ /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://githu...
library YieldsterVaultMath{ /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://githu...
37,805
20
// Throws if called by any sender that doesn't match one of the supplied contract or is the latest version of that contract/
modifier onlyLatestContract(string memory _contractName, address _contractAddress) { require(_contractAddress == getAddress(keccak256(abi.encodePacked("contract.address", _contractName))), "Invalid or outdated contract"); _; }
modifier onlyLatestContract(string memory _contractName, address _contractAddress) { require(_contractAddress == getAddress(keccak256(abi.encodePacked("contract.address", _contractName))), "Invalid or outdated contract"); _; }
9,735
4
// Event emitted when a new governance is proposed.
event GovernanceProposed(address indexed newGovernance);
event GovernanceProposed(address indexed newGovernance);
17,763
130
// if lock exists use extend or send the tokens there directy to increase the amount
require(block.timestamp > liquidityUnlockTime[addy], "Already locked"); require(lockDays >= 1, "<1 day"); uint256 time = block.timestamp + (lockDays * 1 days); liquidityUnlockTime[addy] = time; SafeTransfer._pullUnderlying(IERC20(addy), msg.sender, amt);
require(block.timestamp > liquidityUnlockTime[addy], "Already locked"); require(lockDays >= 1, "<1 day"); uint256 time = block.timestamp + (lockDays * 1 days); liquidityUnlockTime[addy] = time; SafeTransfer._pullUnderlying(IERC20(addy), msg.sender, amt);
6,453
10
// Get the metadata for a Party instance./instance The address of the instance./tokenId The ID of the token to get the metadata for./ return metadata The encoded metadata.
function getMetadata(address instance, uint256 tokenId) external view returns (bytes memory) { IMetadataProvider provider = getProvider[instance]; return address(provider) != address(0) ? provider.getMetadata(instance, tokenId) : bytes(""); }
function getMetadata(address instance, uint256 tokenId) external view returns (bytes memory) { IMetadataProvider provider = getProvider[instance]; return address(provider) != address(0) ? provider.getMetadata(instance, tokenId) : bytes(""); }
39,981
92
// {TransparentUpgradeableProxy-upgradeToAndCall}.Requirements:- This contract must be the admin of `proxy`. /
function upgradeAndCall(TransparentUpgradeableProxy proxy, address implementation, bytes memory data) public payable onlyOwner { proxy.upgradeToAndCall{value: msg.value}(implementation, data);
function upgradeAndCall(TransparentUpgradeableProxy proxy, address implementation, bytes memory data) public payable onlyOwner { proxy.upgradeToAndCall{value: msg.value}(implementation, data);
9,566