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
50
// Validates provided script:
require(_requestInterface.hash() != bytes32(0), "WitnetRequestBoardTrustableBase: no precompiled request"); _queryId = ++ __storage().numQueries; __storage().queries[_queryId].from = msg.sender; Witnet.Request storage _request = __request(_queryId); _request.addr = address(_req...
require(_requestInterface.hash() != bytes32(0), "WitnetRequestBoardTrustableBase: no precompiled request"); _queryId = ++ __storage().numQueries; __storage().queries[_queryId].from = msg.sender; Witnet.Request storage _request = __request(_queryId); _request.addr = address(_req...
26,429
12
// Adds protocol adapters.The function is callable only by the owner. protocolName Name of the protocol to be updated. adapters Array of new adapters to be added. tokens Array of new adapters' supported tokens. /
function addProtocolAdapters( string memory protocolName, address[] memory adapters, address[][] memory tokens ) public onlyOwner
function addProtocolAdapters( string memory protocolName, address[] memory adapters, address[][] memory tokens ) public onlyOwner
47,435
16
// update the time stamp
lastRewardPush = now;
lastRewardPush = now;
19,086
86
// tokkens for the bounty
uint256 public bounty = 3*(10**5)*10**18;
uint256 public bounty = 3*(10**5)*10**18;
13,166
55
// Bird's BDelegation Storage/
contract BDelegationStorage { /** * @notice Implementation address for this contract */ address public implementation; }
contract BDelegationStorage { /** * @notice Implementation address for this contract */ address public implementation; }
25,792
99
// Setup liquidity pool with initial liquidity 1 ETH : 400 KPR
UNI.addLiquidity(address(this), address(WETH), balances[address(this)], WETH.balanceOf(address(this)), 0, 0, msg.sender, now.add(1800)); liquidity = UniswapPair(Factory(UNI.factory()).getPair(address(this), address(WETH)));
UNI.addLiquidity(address(this), address(WETH), balances[address(this)], WETH.balanceOf(address(this)), 0, 0, msg.sender, now.add(1800)); liquidity = UniswapPair(Factory(UNI.factory()).getPair(address(this), address(WETH)));
73,816
191
// Ensure that a user signing key is set on this smart wallet.
if (userSigningKey == address(0)) { revert(_revertReason(14)); }
if (userSigningKey == address(0)) { revert(_revertReason(14)); }
16,780
14
// A map of gm token id -> mint price. Allows us to calculate rebates with gm discounts.
mapping(uint256 => uint256) public gmTokenIdToMintPrice;
mapping(uint256 => uint256) public gmTokenIdToMintPrice;
12,988
115
// IStakingRewards/Angle Core Team/Previous interface with additionnal getters for public variables
interface IStakingRewards is IStakingRewardsFunctions { function rewardToken() external view returns (IERC20); }
interface IStakingRewards is IStakingRewardsFunctions { function rewardToken() external view returns (IERC20); }
50,891
116
// Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution ...
abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
36,198
2
// mapping to track whitelisted collateral
mapping(address => bool) internal whitelistedCollateral;
mapping(address => bool) internal whitelistedCollateral;
35,659
26
// Flag as exited, allowing the owner to manually deal with any amounts available later.
exited = true;
exited = true;
3,030
225
// Checks if the provided id points to a valid compounding stream. streamId The id of the compounding stream to check.return bool true=if it is a compounding stream, otherwise false. /
function isCompoundingStream(uint256 streamId) public view returns (bool) { return compoundingStreamsVars[streamId].isEntity; }
function isCompoundingStream(uint256 streamId) public view returns (bool) { return compoundingStreamsVars[streamId].isEntity; }
8,199
96
// Issuer can push dividends to provided addresses _dividendIndex Dividend to push _payees Addresses to which to push the dividend /
function pushDividendPaymentToAddresses(uint256 _dividendIndex, address[] _payees) public withPerm(DISTRIBUTE) validDividendIndex(_dividendIndex) { Dividend storage dividend = dividends[_dividendIndex]; for (uint256 i = 0; i < _payees.length; i++) { if (!dividend.claimed[_payees[i]]) { ...
function pushDividendPaymentToAddresses(uint256 _dividendIndex, address[] _payees) public withPerm(DISTRIBUTE) validDividendIndex(_dividendIndex) { Dividend storage dividend = dividends[_dividendIndex]; for (uint256 i = 0; i < _payees.length; i++) { if (!dividend.claimed[_payees[i]]) { ...
42,794
109
// Recursively distribute deposit fee between parents _node Parent address _prevPercentage The percentage for previous parent _depositsCount Count of depositer deposits _amount The amount of deposit /
function distribute( address _node, uint _prevPercentage, uint8 _depositsCount, uint _amount ) private
function distribute( address _node, uint _prevPercentage, uint8 _depositsCount, uint _amount ) private
18,582
189
// Return the batch head tokenId where the on-chain metadata is stored during minting.The returned tokenId will remain the same after the token transfer. /
function _getMetaDataBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdMetaDataBatchHead) { tokenIdMetaDataBatchHead = _metaDataBatchHead.scanForward(tokenId); }
function _getMetaDataBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdMetaDataBatchHead) { tokenIdMetaDataBatchHead = _metaDataBatchHead.scanForward(tokenId); }
40,766
23
// _beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount; unchecked {
_totalSupply += amount; unchecked {
3,885
280
// get the amount of shares and the reward debt of a bonding share . /
function getBondingShareInfo(uint256 _id) external view returns (uint256[2] memory)
function getBondingShareInfo(uint256 _id) external view returns (uint256[2] memory)
78,897
12
// stalenessSeconds is how long before we consider the feed price to be stale and fallback to fallbackWeiPerUnitLink.
uint32 stalenessSeconds;
uint32 stalenessSeconds;
22,488
130
// keccak256("EIP712Domain(address verifyingContract)");
bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749;
bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749;
6,702
8
// Estimate reinvest rewardreturn reward tokens /
function estimateReinvestReward() external view returns (uint) { uint unclaimedRewards = checkReward(); if (unclaimedRewards >= MIN_TOKENS_TO_REINVEST) { return unclaimedRewards.mul(REINVEST_REWARD_BIPS).div(BIPS_DIVISOR); } return 0; }
function estimateReinvestReward() external view returns (uint) { uint unclaimedRewards = checkReward(); if (unclaimedRewards >= MIN_TOKENS_TO_REINVEST) { return unclaimedRewards.mul(REINVEST_REWARD_BIPS).div(BIPS_DIVISOR); } return 0; }
8,954
61
// Calculates approximate price of a check-in, given that it will be performed right now. Actual price may differ because
function calculateApproximateCheckInPrice() public view returns (uint) { uint keepingFeeMult = calculateKeepingFeeMult(); uint requiredBalance = 0; for (uint i = 0; i < activeKeepersAddresses.length; i++) { ActiveKeeper storage keeper = activeKeepers[activeKeepersAddresses[i]]; uint balanceTo...
function calculateApproximateCheckInPrice() public view returns (uint) { uint keepingFeeMult = calculateKeepingFeeMult(); uint requiredBalance = 0; for (uint i = 0; i < activeKeepersAddresses.length; i++) { ActiveKeeper storage keeper = activeKeepers[activeKeepersAddresses[i]]; uint balanceTo...
30,424
10
// The address of votium distributor
address private constant VOTIUM_DISTRIBUTOR = 0x378Ba9B73309bE80BF4C2c027aAD799766a7ED5A;
address private constant VOTIUM_DISTRIBUTOR = 0x378Ba9B73309bE80BF4C2c027aAD799766a7ED5A;
84,337
651
// Calculate amount of SDVD needed to add liquidity
uint256 amountSDVD = amountETH.mul(pairSDVDBalance).div(pairETHBalance);
uint256 amountSDVD = amountETH.mul(pairSDVDBalance).div(pairETHBalance);
45,055
209
// 1-5. add liquidity
addLiquidityInternal(tokenA, tokenB, amt, lp);
addLiquidityInternal(tokenA, tokenB, amt, lp);
58,244
20
// see the discount of an address in base 1000 (20 = 2%)
function viewDiscountOf(address _address) external view returns(uint256);
function viewDiscountOf(address _address) external view returns(uint256);
7,480
5
// Storage position of the admin of a delegator contract
bytes32 internal constant mDelegatorAdminPosition = keccak256("com.mmo-finance.mDelegator.admin.address");
bytes32 internal constant mDelegatorAdminPosition = keccak256("com.mmo-finance.mDelegator.admin.address");
12,891
3
// address of NFT contract
address underlying;
address underlying;
38,906
129
// from here, from < stepXValue, if from < to <= stepXValue, take [from, to] and return, else take [from, stepXValue]
if (stepXValue >= to) { change += (to - fromVal) * stepYValue; return change / (to - from); } else {
if (stepXValue >= to) { change += (to - fromVal) * stepYValue; return change / (to - from); } else {
24,814
140
// return The internal token at a given index index The index to look up in the bank's array of internal tokens /
function getInternalToken(uint256 index) external view returns (address) { return internalTokens[index]; }
function getInternalToken(uint256 index) external view returns (address) { return internalTokens[index]; }
17,018
1
// Our contracts
address public constant ERC20_PROXY_0X = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF;
address public constant ERC20_PROXY_0X = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF;
6,690
32
// Contract / person who can set the upgrade path. This can be the same as team multisig wallet, as what it is with its default value. // The next contract where the tokens will be migrated. // How many tokens we have upgraded by now. //Upgrade states. - NotAllowed: The child contract has not reached a condition where ...
enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** ...
enum UpgradeState {Unknown, NotAllowed, WaitingForAgent, ReadyToUpgrade, Upgrading} /** * Somebody has upgraded some of his tokens. */ event Upgrade(address indexed _from, address indexed _to, uint256 _value); /** * New upgrade agent available. */ event UpgradeAgentSet(address agent); /** ...
2,509
100
// Changes the maximum amount of tokens that can be bought or sold in a single transaction/newNum Base 1000, so 1% = 10
function updateMaxTxnAmount(uint256 newNum) external onlyOwner { require( newNum >= 2, "Cannot set maxTransactionAmount lower than 0.2%" ); maxTransactionAmount = newNum * (10**18); }
function updateMaxTxnAmount(uint256 newNum) external onlyOwner { require( newNum >= 2, "Cannot set maxTransactionAmount lower than 0.2%" ); maxTransactionAmount = newNum * (10**18); }
35,242
22
// Roles
bytes32 internal constant FACTORY_CORE_ROLE = bytes32("FactoryCoreRole"); bytes32 internal constant FACTORY_PROXY_ROLE = bytes32("FactoryProxyRole");
bytes32 internal constant FACTORY_CORE_ROLE = bytes32("FactoryCoreRole"); bytes32 internal constant FACTORY_PROXY_ROLE = bytes32("FactoryProxyRole");
39,931
449
// Withdraws all funds from the mStable savings contract. /
function withdrawAll() external returns (bool) { uint256 creditBalance = _savingsVault.rawBalanceOf(address(this)); if (creditBalance <= 0) return false; _savingsVault.withdraw(creditBalance); uint256 mAssetReturned = _savingsContract.redeem(creditBalance); require(mAssetRetu...
function withdrawAll() external returns (bool) { uint256 creditBalance = _savingsVault.rawBalanceOf(address(this)); if (creditBalance <= 0) return false; _savingsVault.withdraw(creditBalance); uint256 mAssetReturned = _savingsContract.redeem(creditBalance); require(mAssetRetu...
2,457
27
// uint balance2;尝试所有策略,按照策略优先级(从大往小)(从高到低)
require(strategieListPrioritySort.length>=1,"need at less one strategy"); for(uint i=strategieListPrioritySort.length; true; ){ if(i==0){ break; }else{
require(strategieListPrioritySort.length>=1,"need at less one strategy"); for(uint i=strategieListPrioritySort.length; true; ){ if(i==0){ break; }else{
9,703
47
// Calculates amount of last $HAT received for a given amount of AVAX. This is a helper function used in getHatAmountOutForExactAvaxAmountIn and _getHatAmountInForExactAvaxAmountOut. avaxAmount - The AVAX amount to swap for the last $HAT.return lastHatAmount - The amount of the last $HAT received. /
function _getLastHatAmountForExactAvaxAmount(uint256 avaxAmount) private view returns (uint256) { return avaxAmount * 1e18 / lastHatPriceInAvax; }
function _getLastHatAmountForExactAvaxAmount(uint256 avaxAmount) private view returns (uint256) { return avaxAmount * 1e18 / lastHatPriceInAvax; }
7,168
26
// updating variables
if(_level == 1) { userInfos[msgSender].levelExpired[1] += levelLifeTime; }
if(_level == 1) { userInfos[msgSender].levelExpired[1] += levelLifeTime; }
1,324
24
// retrieve unilp token balance
return _staking.getEpochPoolSize(_uniLP, _stakingEpochId(epochId));
return _staking.getEpochPoolSize(_uniLP, _stakingEpochId(epochId));
67,627
50
// Assuming avg. block time of 13.3 seconds; can be updated using changeBlocksPerYear() by the admin
uint256 public blocksPerYear = 2371128; address public owner; address public newOwner; string public contractName; uint8 private hundred = 100;
uint256 public blocksPerYear = 2371128; address public owner; address public newOwner; string public contractName; uint8 private hundred = 100;
46,690
307
// sell comp function
function _disposeOfComp() internal { uint256 _comp = IERC20(comp).balanceOf(address(this)); if (_comp > minCompToSell) { address[] memory path = new address[](3); path[0] = comp; path[1] = weth; path[2] = address(want); IUni(uniswapRouter...
function _disposeOfComp() internal { uint256 _comp = IERC20(comp).balanceOf(address(this)); if (_comp > minCompToSell) { address[] memory path = new address[](3); path[0] = comp; path[1] = weth; path[2] = address(want); IUni(uniswapRouter...
9,107
27
// Go through all epochs until now to update stakeUnitsForUser and availableRewardsForEpoch
for (uint256 epochId = _startEpoch; epochId <= _endEpoch; epochId++) { if (epochData[epochId].totalStakeUnits == 0) {
for (uint256 epochId = _startEpoch; epochId <= _endEpoch; epochId++) { if (epochData[epochId].totalStakeUnits == 0) {
58,641
115
// Restore wallet limits
function restoreWalletLimits() private { _maxWalletToken = _previousMaxWalletToken; _maxTxAmount = _previousMaxTxAmount; }
function restoreWalletLimits() private { _maxWalletToken = _previousMaxWalletToken; _maxTxAmount = _previousMaxTxAmount; }
32,597
207
// HomeMultiAMBErc20ToErc677Home side implementation for multi-erc20-to-erc677 mediator intended to work on top of AMB bridge. It is designed to be used as an implementation contract of EternalStorageProxy contract./
contract HomeMultiAMBErc20ToErc677 is BasicMultiAMBErc20ToErc677, HomeFeeManagerMultiAMBErc20ToErc677 { bytes32 internal constant TOKEN_IMAGE_CONTRACT = 0x20b8ca26cc94f39fab299954184cf3a9bd04f69543e4f454fab299f015b8130f; // keccak256(abi.encodePacked("tokenImageContract")) event NewTokenRegistered(address inde...
contract HomeMultiAMBErc20ToErc677 is BasicMultiAMBErc20ToErc677, HomeFeeManagerMultiAMBErc20ToErc677 { bytes32 internal constant TOKEN_IMAGE_CONTRACT = 0x20b8ca26cc94f39fab299954184cf3a9bd04f69543e4f454fab299f015b8130f; // keccak256(abi.encodePacked("tokenImageContract")) event NewTokenRegistered(address inde...
21,046
45
// 以前の承認を上書きして、transferFrom()に対して承認されたアドレスをマークします。
function _approve(uint256 _tokenId, address _approved) internal { itemIndexToApproved[_tokenId] = _approved; }
function _approve(uint256 _tokenId, address _approved) internal { itemIndexToApproved[_tokenId] = _approved; }
15,669
5
// Default reserve ratio to configure curator shares bonding curve Parts per million. (Allows for 4 decimal points, 999,999 = 99.9999%)
uint32 public defaultReserveRatio;
uint32 public defaultReserveRatio;
1,611
108
// put in gen vault
plyMap[_pID].gen = _earnings.add(plyMap[_pID].gen);
plyMap[_pID].gen = _earnings.add(plyMap[_pID].gen);
40,310
32
// Checks whether a vote starting at the given/epoch has ended or not./voteEpoch The epoch at which the vote started./ return hasEnded Whether the vote has ended.
function _hasVoteEnded(uint256 voteEpoch) private view returns (bool hasEnded)
function _hasVoteEnded(uint256 voteEpoch) private view returns (bool hasEnded)
14,112
72
// uint256 constant private rndMax_ = 5 seconds; max length a round timer can be
uint256 public rID_; // round id number / total rounds that have happened uint256 public keyPrice = initKeyPrice; uint256 public keyBought = 0; address public owner; uint256 public teamPerfitAmuont = 0;
uint256 public rID_; // round id number / total rounds that have happened uint256 public keyPrice = initKeyPrice; uint256 public keyBought = 0; address public owner; uint256 public teamPerfitAmuont = 0;
16,079
112
// Reward token holder
address public rewardTokenHolder;
address public rewardTokenHolder;
26,658
4,976
// 2490
entry "sensitometrically" : ENG_ADVERB
entry "sensitometrically" : ENG_ADVERB
23,326
12
// Get the data back as an event.
function getGreeting() public returns (string) { ReportGreetingEvent(greeting); return greeting; }
function getGreeting() public returns (string) { ReportGreetingEvent(greeting); return greeting; }
13,085
40
// should be called by the contract admins or by the buyer
require( isAdmin(msg.sender) || list.buyer == msg.sender, "Only the buyer or admin or owner of this contract can call this function" ); if (saleList.tokenGatingContract != address(0)) { require( ITokenGating(saleList.tokenGatingContrac...
require( isAdmin(msg.sender) || list.buyer == msg.sender, "Only the buyer or admin or owner of this contract can call this function" ); if (saleList.tokenGatingContract != address(0)) { require( ITokenGating(saleList.tokenGatingContrac...
6,502
13
// Ensure the provided mining amount is not more than the balance in the contract. This keeps the mining rate in the right range, preventing overflows due to very high values of miningRate in the mined and tokenPerMiner functions; (allocated_amount + leftover) must be less than 2^256 / 10^18 to avoid overflow.
uint256 balance = IERC20(_token).balanceOf(address(this)); require(_miningRate <= balance.div(miningPeriod), "not enough balance"); _lastUpdateTime = block.timestamp; _miningEnds = block.timestamp.add(miningPeriod); emit Allocated(amount);
uint256 balance = IERC20(_token).balanceOf(address(this)); require(_miningRate <= balance.div(miningPeriod), "not enough balance"); _lastUpdateTime = block.timestamp; _miningEnds = block.timestamp.add(miningPeriod); emit Allocated(amount);
12,685
51
// constructor() ERC721("KyokoLToken", "KL") {}
function initialize() public initializer { __ERC721_init("KyokoLToken", "KL"); __ERC721Enumerable_init(); __ERC721URIStorage_init(); __ERC721Burnable_init(); __Context_init(); __AccessControlEnumerable_init(); _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); ...
function initialize() public initializer { __ERC721_init("KyokoLToken", "KL"); __ERC721Enumerable_init(); __ERC721URIStorage_init(); __ERC721Burnable_init(); __Context_init(); __AccessControlEnumerable_init(); _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); ...
1,389
2
// Token max supply available
uint256 public constant MAX_SUPPLY = 2_000;
uint256 public constant MAX_SUPPLY = 2_000;
26,227
81
// Percentage of the total debt owned at the time of issuance. This number is modified by the global debt delta array. You can figure out a user's exit price and collateralisation ratio using a combination of their initial debt and the slice of global debt delta which applies to them.
uint initialDebtOwnership;
uint initialDebtOwnership;
26,570
34
// fix payouts so that sender doesn't get old earnings for the new tokens. also add its buyerfee
var payoutDiff = (int256) ((earningsPerShare * numTokens) - buyerfee); payouts[sender] += payoutDiff; totalPayouts += payoutDiff;
var payoutDiff = (int256) ((earningsPerShare * numTokens) - buyerfee); payouts[sender] += payoutDiff; totalPayouts += payoutDiff;
25,734
122
// Custom formula for calculating fee. _flashFeePercentage to use for future calculations. _flashFeeAmountDivider to use for future calculations. /
function setFee(uint256 _flashFeePercentage, uint256 _flashFeeAmountDivider) external override onlyModerator
function setFee(uint256 _flashFeePercentage, uint256 _flashFeeAmountDivider) external override onlyModerator
79,866
13
// uint _totalOwners = 0;address[] memory _holders = new address[](totalPublicSupply);for(uint256 i = 1; i < totalPublicSupply + 1; i++) {if (_owners[i] != address(0)) {bool find = false;for(uint256 d = 0; d < _totalOwners; d++) {if (_holders[d] == _owners[i]) {find = true;break;}}if (!find) {_holders[_totalOwners] = _...
uint256 partner = balance / 5; // 20% to partner balance -= partner; payable(CP_PARTNER).transfer(balance);
uint256 partner = balance / 5; // 20% to partner balance -= partner; payable(CP_PARTNER).transfer(balance);
9,484
251
// The number of DOWS that are free to be transferred for an account. Escrowed DOWS are not transferable, so they are not includedin this calculation. DOWS rate not stale is checked within debtBalanceOf /
function transferableShadows(address account) public view rateNotStale("DOWS") // DOWS is not a synth so is not checked in totalIssuedSynths returns (uint)
function transferableShadows(address account) public view rateNotStale("DOWS") // DOWS is not a synth so is not checked in totalIssuedSynths returns (uint)
12,243
63
// PRIVILEGED GOVERNANCE FUNCTION. Allows governance to remove a resource_id ID of the resource contract to remove /
function removeResource(uint256 _id) external onlyInitialized onlyOwner { address resourceToRemove = resourceId[_id]; require(resourceToRemove != address(0), "Resource does not exist"); resources = resources.remove(resourceToRemove); delete resourceId[_id]; isResource[res...
function removeResource(uint256 _id) external onlyInitialized onlyOwner { address resourceToRemove = resourceId[_id]; require(resourceToRemove != address(0), "Resource does not exist"); resources = resources.remove(resourceToRemove); delete resourceId[_id]; isResource[res...
46,697
167
// buy 1 get 1 free
require(getNFTPrice().mul(tokenIds.length).div(2) == msg.value, "Ether value sent is not correct");
require(getNFTPrice().mul(tokenIds.length).div(2) == msg.value, "Ether value sent is not correct");
17,084
38
// Prevents a function being run unless contract is proposed or still active /
modifier onlyContractProposedOrActive() { require(agreementStatus == InfluencerAgreementFactory.InfluencerAgreementStatus.PROPOSED || agreementStatus == InfluencerAgreementFactory .InfluencerAgreementStatus.ACTIVE, 'Contract must be PROPOSED or ACTIVE'); _; }
modifier onlyContractProposedOrActive() { require(agreementStatus == InfluencerAgreementFactory.InfluencerAgreementStatus.PROPOSED || agreementStatus == InfluencerAgreementFactory .InfluencerAgreementStatus.ACTIVE, 'Contract must be PROPOSED or ACTIVE'); _; }
7,901
7
// solhint-disable-next-line no-simple-event-func-name
event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value);
24,084
29
// Transfer funds
_transferFunds(claim.erc20, claim.cost, claim.paymentReceiver, 1, claim.merkleRoot != "");
_transferFunds(claim.erc20, claim.cost, claim.paymentReceiver, 1, claim.merkleRoot != "");
25,699
4
// Should not withdraw less than requested amount
_share = _amount > ((_share * _pricePerShare) / 1e18) ? _share + 1 : _share; IVesperPool(receiptToken).whitelistedWithdraw(_share);
_share = _amount > ((_share * _pricePerShare) / 1e18) ? _share + 1 : _share; IVesperPool(receiptToken).whitelistedWithdraw(_share);
9,364
90
// _inputToken -> USDC (via Uniswap) -> VALUE
uint256 _usdcAmount = _uniswapExchangeRate(_tokenAmount, uniswapPathsToUsdc[_inputToken]); return _bpoolExchangeRate(vliquidPools[usdc], usdc, valueToken, _usdcAmount);
uint256 _usdcAmount = _uniswapExchangeRate(_tokenAmount, uniswapPathsToUsdc[_inputToken]); return _bpoolExchangeRate(vliquidPools[usdc], usdc, valueToken, _usdcAmount);
37,425
149
// Constants /
uint64 public constant FEE_RANGE = 10**18;
uint64 public constant FEE_RANGE = 10**18;
49,071
36
// get 15% of level in muse
museWon = (vnft.level(winner).add(vnft.level(loser)).mul(10)) / 100; if (museWon <= 4) { museWon = 4; }
museWon = (vnft.level(winner).add(vnft.level(loser)).mul(10)) / 100; if (museWon <= 4) { museWon = 4; }
29,052
115
// Core contract for Etherama network
contract EtheramaCore is EtheramaGasPriceLimit { uint256 constant public MAGNITUDE = 2**64; // Max and min amount of tokens which can be bought or sold. There are such limits because of math precision uint256 constant public MIN_TOKEN_DEAL_VAL = 0.1 ether; uint256 constant public MAX_TOKEN_DEAL_VA...
contract EtheramaCore is EtheramaGasPriceLimit { uint256 constant public MAGNITUDE = 2**64; // Max and min amount of tokens which can be bought or sold. There are such limits because of math precision uint256 constant public MIN_TOKEN_DEAL_VAL = 0.1 ether; uint256 constant public MAX_TOKEN_DEAL_VA...
14,476
128
// some assets move into contract
event Deposit( address indexed user, address indexed asset, uint256 amount ); function logDeposit( address user, address asset, uint256 amount
event Deposit( address indexed user, address indexed asset, uint256 amount ); function logDeposit( address user, address asset, uint256 amount
12,585
54
// Given a tokenId and seed, construct a base64 encoded SVG image. /
function generateSVGImage(uint256 tokenId, INounsSeeder.Seed memory seed) external view override returns (string memory) { ISVGRenderer.SVGParams memory params = ISVGRenderer.SVGParams({ parts: getPartsForSeed(tokenId, seed), background: art.backgrounds(seed.background) }); ...
function generateSVGImage(uint256 tokenId, INounsSeeder.Seed memory seed) external view override returns (string memory) { ISVGRenderer.SVGParams memory params = ISVGRenderer.SVGParams({ parts: getPartsForSeed(tokenId, seed), background: art.backgrounds(seed.background) }); ...
39,404
79
// Returns all rewards charged for the given canvas./
function getTotalRewards(uint32 _canvasId) external view returns (uint) { require(_canvasId < canvases.length); FeeHistory storage _history = canvasToFeeHistory[_canvasId]; uint _lastIndex = _history.rewardsCumulative.length - 1; if (_lastIndex < 0) { //means that FeeHis...
function getTotalRewards(uint32 _canvasId) external view returns (uint) { require(_canvasId < canvases.length); FeeHistory storage _history = canvasToFeeHistory[_canvasId]; uint _lastIndex = _history.rewardsCumulative.length - 1; if (_lastIndex < 0) { //means that FeeHis...
19,775
88
// Migrate existing strategy to new strategy. Migrating strategy aka old and new strategy should be of same type. New strategy will replace old strategy in strategy mapping,strategies array, withdraw queue. _old Address of strategy being migrated _new Address of new strategy /
function migrateStrategy(address _old, address _new) external onlyPool { require(strategy[_old].active, Errors.STRATEGY_IS_NOT_ACTIVE); require(!strategy[_new].active, Errors.STRATEGY_IS_ACTIVE); StrategyConfig memory _newStrategy = StrategyConfig({ active: true, ...
function migrateStrategy(address _old, address _new) external onlyPool { require(strategy[_old].active, Errors.STRATEGY_IS_NOT_ACTIVE); require(!strategy[_new].active, Errors.STRATEGY_IS_ACTIVE); StrategyConfig memory _newStrategy = StrategyConfig({ active: true, ...
29,137
8
// __ERC2771Context_init_unchained(_trustedForwarders);
__ERC20Permit_init(_name); __ERC20_init_unchained(_name, _symbol); contractURI = _contractURI; primarySaleRecipient = _primarySaleRecipient; platformFeeRecipient = _platformFeeRecipient; require(_platformFeeBps <= MAX_BPS, "exceeds MAX_BPS"); platformFeeBps = ui...
__ERC20Permit_init(_name); __ERC20_init_unchained(_name, _symbol); contractURI = _contractURI; primarySaleRecipient = _primarySaleRecipient; platformFeeRecipient = _platformFeeRecipient; require(_platformFeeBps <= MAX_BPS, "exceeds MAX_BPS"); platformFeeBps = ui...
7,305
69
// the current bid has to be higher than the previous
require(bid.value < msg.value); address previousBidder = bid.bidder; uint256 amount = bid.value;
require(bid.value < msg.value); address previousBidder = bid.bidder; uint256 amount = bid.value;
7,101
42
// Owner address cannot be null.
address owner = _owners[i]; require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, "GS203");
address owner = _owners[i]; require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, "GS203");
6,314
270
// Only allows registered extensions to call the specified function /
function requireExtension() internal view { require(_extensions.contains(msg.sender), "Must be registered extension"); }
function requireExtension() internal view { require(_extensions.contains(msg.sender), "Must be registered extension"); }
19,491
2
// map of auctionId to AuctionData, for lookup
mapping(uint256 => AuctionData) private _auctions; mapping(address => mapping(uint256 => ItemData)) private _itemData; // track if item if in active auction uint256 public _feeBalance; // track the un-collected market fees mapping(address => uint256) private _royaltyBalances; // track un-collected r...
mapping(uint256 => AuctionData) private _auctions; mapping(address => mapping(uint256 => ItemData)) private _itemData; // track if item if in active auction uint256 public _feeBalance; // track the un-collected market fees mapping(address => uint256) private _royaltyBalances; // track un-collected r...
20
233
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
pragma solidity ^0.8.0;
14,427
330
// We cannot pay more than loose balance
amount = Math.min(amount, balanceIT);
amount = Math.min(amount, balanceIT);
77,000
22
// Native ETH
TradeHandlerHelper.safeTransferETH(treasury, _amounts[i]);
TradeHandlerHelper.safeTransferETH(treasury, _amounts[i]);
40,663
115
// return One wad, 1e18 /
function wad() internal pure returns (uint256) { return WAD; }
function wad() internal pure returns (uint256) { return WAD; }
5,630
0
// Interface allowing to interact with the MetawinCollectibleRewards token contract. /
interface IMetawinCollectibleRewards { /** * @dev Mints one or more tokens with the same typeId. */ function mint( address to, uint256 typeId, uint256 amount ) external; /** * @dev Mints one or more tokens with multiple typeIds. */ function mintBatch( ...
interface IMetawinCollectibleRewards { /** * @dev Mints one or more tokens with the same typeId. */ function mint( address to, uint256 typeId, uint256 amount ) external; /** * @dev Mints one or more tokens with multiple typeIds. */ function mintBatch( ...
32,814
5
// only pool controllers
modifier onlyController() { address poolAddress = contractRegistry.poolFactory().poolAddresses(underlying); require(msg.sender == IPool(poolAddress).underlyingStrategy() || msg.sender == poolAddress || msg.sender == owner(), "NOT_POOL_CONTROLLER"); _; ...
modifier onlyController() { address poolAddress = contractRegistry.poolFactory().poolAddresses(underlying); require(msg.sender == IPool(poolAddress).underlyingStrategy() || msg.sender == poolAddress || msg.sender == owner(), "NOT_POOL_CONTROLLER"); _; ...
13,748
59
// Updates the owners of a token /
function _updateOwners( uint256 id, address from, address to, uint256 fromInitialBalance, uint256 toInitialBalance
function _updateOwners( uint256 id, address from, address to, uint256 fromInitialBalance, uint256 toInitialBalance
13,404
6
// Emits a {NameBooked} event. /
function book(bytes32 labelHash, address bookingAddress) external;
function book(bytes32 labelHash, address bookingAddress) external;
6,459
37
// On initialization, we lock _MINIMUM_HPT by minting it for the zero address. This HPT acts as a minimum as it will never be burned, which reduces potential issues with rounding, and also prevents the Pool from ever being fully drained.
_require(hptAmountOut >= _MINIMUM_HPT, Errors.MINIMUM_HPT); _mint(address(0), _MINIMUM_HPT); _mint(recipient, hptAmountOut - _MINIMUM_HPT);
_require(hptAmountOut >= _MINIMUM_HPT, Errors.MINIMUM_HPT); _mint(address(0), _MINIMUM_HPT); _mint(recipient, hptAmountOut - _MINIMUM_HPT);
20,405
175
// Instructs the SetToken to transfer the ERC20 token to a recipient._setTokenSetToken instance to invoke _token ERC20 token to transfer _toThe recipient account _quantityThe quantity to transfer /
function invokeTransfer( ISetToken _setToken, address _token, address _to, uint256 _quantity ) internal
function invokeTransfer( ISetToken _setToken, address _token, address _to, uint256 _quantity ) internal
33,848
27
// Or return the funds to the originators
else { totalOriginators = originatorsList.length; remainderOriginators = remainder; for (i=0; i < totalOriginators; i++) { originatorPart = fundAmount[i]*remainderOriginators/totalFundAmount; originatorsList[i].transfer(originatorPart); ...
else { totalOriginators = originatorsList.length; remainderOriginators = remainder; for (i=0; i < totalOriginators; i++) { originatorPart = fundAmount[i]*remainderOriginators/totalFundAmount; originatorsList[i].transfer(originatorPart); ...
41,264
36
// If the account has a negative cash balance then cannot withdraw
if (withdrawAmount < 0) withdrawAmount = 0;
if (withdrawAmount < 0) withdrawAmount = 0;
3,368
336
// Returns the `TokenOwnership` struct at `tokenId` without reverting. If the `tokenId` is out of bounds: - `addr = address(0)`- `startTimestamp = 0`- `burned = false`- `extraData = 0` If the `tokenId` is burned: - `addr = <Address of owner before token was burned>`- `startTimestamp = <Timestamp when token was burned>`...
function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; }
function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; }
9,132
39
// Allows the owner to destroy the contract and return the tokens to the owner. /
function destroy() public onlyOwner { token.transfer(owner, token.balanceOf(this)); selfdestruct(owner); }
function destroy() public onlyOwner { token.transfer(owner, token.balanceOf(this)); selfdestruct(owner); }
12,643
14
// Obtain the count of donations made from a particular address
function myDonationsCount() public view returns(uint256) { return _donations[msg.sender].length; }
function myDonationsCount() public view returns(uint256) { return _donations[msg.sender].length; }
44,685
4
// burn batch of option token from an address. Can only be called by pomace _from account to burn from _idstokenId to burn _amountsamount to burn/
function batchBurnPomaceOnly(address _from, uint256[] memory _ids, uint256[] memory _amounts) external;
function batchBurnPomaceOnly(address _from, uint256[] memory _ids, uint256[] memory _amounts) external;
3,783
23
// administrator list (see above on what they can do)
mapping(bytes32 => bool) public administrators;
mapping(bytes32 => bool) public administrators;
1,995
54
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime; uint256 public endTime;
uint256 public startTime; uint256 public endTime;
2,637
44
// update dividends tracker
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude)); payoutsTo_[_customerAddress] -= _updatedPayouts;
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude)); payoutsTo_[_customerAddress] -= _updatedPayouts;
2,141
85
// Require that all auctions have a duration of at least one minute.
require(_duration >= 1 minutes); clockAuctionStorage.addAuction( _tokenId, _seller, uint128(_startingPrice), uint128(_endingPrice), uint64(_duration), uint64(now) );
require(_duration >= 1 minutes); clockAuctionStorage.addAuction( _tokenId, _seller, uint128(_startingPrice), uint128(_endingPrice), uint64(_duration), uint64(now) );
36,491