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
157
// Add any contributor structure (For every kind of contributors: Team/Pre-ICO/ICO/Test)_adr Address of the contributor to be added_initialContributionDay Initial Contribution of the contributor to be added/
function addContributor(uint contributorId, address _adr, uint _initialContributionDay) internal onlyOwner { require(contributorId <= maxAddresses); //address should not be an existing contributor require(!isValidContributorAddress(_adr)); //TimeMint should not be already allocated ...
function addContributor(uint contributorId, address _adr, uint _initialContributionDay) internal onlyOwner { require(contributorId <= maxAddresses); //address should not be an existing contributor require(!isValidContributorAddress(_adr)); //TimeMint should not be already allocated ...
27,664
10
// Update valueTimesBlocks of pools and the lender when they stake or unstake/token Base token of the pool./lender Address of the lender./incAmount amount stake/decAmount amount unstake
function updateVtb(address token, address lender, uint incAmount, uint decAmount) external override onlyNutmeg { require(incAmount == 0 || decAmount == 0, 'updateVtb: update amount is invalid'); uint amount = incAmount.add(decAmount); require(amount > 0, 'updateVtb: update amount should be ...
function updateVtb(address token, address lender, uint incAmount, uint decAmount) external override onlyNutmeg { require(incAmount == 0 || decAmount == 0, 'updateVtb: update amount is invalid'); uint amount = incAmount.add(decAmount); require(amount > 0, 'updateVtb: update amount should be ...
6,062
6
// ROSE
['EB004C', '820E1D'],
['EB004C', '820E1D'],
5,160
482
// add y^05(20! / 05!)
z = (z * y) / FIXED_1; res += z * 0x000c0135dca04000;
z = (z * y) / FIXED_1; res += z * 0x000c0135dca04000;
33,273
159
// Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}. Requirements: - The caller must own the token or be an approved operator. /
function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); }
function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); }
1,090
208
// Give the token to `_customer`
uint256 rnid = uint256(roomnights.length - 1); return rnid;
uint256 rnid = uint256(roomnights.length - 1); return rnid;
35,277
27
// Function to display reward balance
function viewReward() public view returns (uint twitterToken, uint facebookToken, uint contentToken, uint youtubeToken, uint telegramToken, uint instagramToken, uint quizToken, uint partnershipToken){ return (RewardDestribution['twitter'],RewardDestribution['facebook'], RewardDestribution['content'], Reward...
function viewReward() public view returns (uint twitterToken, uint facebookToken, uint contentToken, uint youtubeToken, uint telegramToken, uint instagramToken, uint quizToken, uint partnershipToken){ return (RewardDestribution['twitter'],RewardDestribution['facebook'], RewardDestribution['content'], Reward...
21,078
1
// bytes private constant _ROLE_ADMIN_SIGNATURE = abi.encodeWithSignature('ROLE_ADMIN()');
bytes private constant _ROLE_BANNED_SIGNATURE = abi.encodeWithSignature( 'ROLE_BANNED()' ); bytes private constant _GET_BANNED_MEMBER_COUNT_SIGNATURE = abi.encodeWithSignature( 'getBannedMemberCount()' ); bytes4 private constant _iBLACKLIST_ID = type(iBlacklist).interf...
bytes private constant _ROLE_BANNED_SIGNATURE = abi.encodeWithSignature( 'ROLE_BANNED()' ); bytes private constant _GET_BANNED_MEMBER_COUNT_SIGNATURE = abi.encodeWithSignature( 'getBannedMemberCount()' ); bytes4 private constant _iBLACKLIST_ID = type(iBlacklist).interf...
48,953
47
// TaxWallet can remove limits from Contract
require(msg.sender == _taxWallet, "LEEK: Caller Not TaxWallet"); _maxTxAmount = _tTotal; _maxWalletSize=_tTotal; emit MaxTxAmountUpdated(_tTotal);
require(msg.sender == _taxWallet, "LEEK: Caller Not TaxWallet"); _maxTxAmount = _tTotal; _maxWalletSize=_tTotal; emit MaxTxAmountUpdated(_tTotal);
2,671
28
// maxBuy
uint256 incrementCount = (block.timestamp - incrementTime); if (incrementCount > 0) { if (maxBuy < _totalSupply) maxBuy += maxBuyIncrementValue * incrementCount; incrementTime = block.timestamp; }
uint256 incrementCount = (block.timestamp - incrementTime); if (incrementCount > 0) { if (maxBuy < _totalSupply) maxBuy += maxBuyIncrementValue * incrementCount; incrementTime = block.timestamp; }
11,085
10
// Update metadata base URI and contract URI/baseUri new base URI/newContractUri new contract URI (can be an empty string)
function updateMetadataBase( address target, string memory baseUri, string memory newContractUri
function updateMetadataBase( address target, string memory baseUri, string memory newContractUri
18,600
71
// !!!DO NOT move up, we need the handlers to current exchange rate.
_redeemLocal.exchangeRate = getCurrentExchangeRateByHandler( _redeemLocal.handlers, _redeemLocal.token ); _redeemLocal.redeemTotalAmount = withdrawFromHandlers( _redeemLocal.defaultHandler, _redeemLocal.handlers, _redeemLocal.amounts ...
_redeemLocal.exchangeRate = getCurrentExchangeRateByHandler( _redeemLocal.handlers, _redeemLocal.token ); _redeemLocal.redeemTotalAmount = withdrawFromHandlers( _redeemLocal.defaultHandler, _redeemLocal.handlers, _redeemLocal.amounts ...
3,806
9
// Last round ID where isBadData is false and price is within maximum deviation
uint80 public lastCorrectRoundId;
uint80 public lastCorrectRoundId;
26,255
226
// Contract in charge of setting registered fee formula schemes to contract /
contract FormulaHolder is Ownable { AbstractFees public formula; /* @dev Constructor. Requires that given formula is a valid contract. * @param _formula The fee formula contract. */ constructor(AbstractFees _formula) public { require(_formula != AbstractFees(0), "Supplied formula is null"...
contract FormulaHolder is Ownable { AbstractFees public formula; /* @dev Constructor. Requires that given formula is a valid contract. * @param _formula The fee formula contract. */ constructor(AbstractFees _formula) public { require(_formula != AbstractFees(0), "Supplied formula is null"...
15,422
217
// If this has been called twice in the same block, shortcircuit to reduce gas
if(timeDelta == 0) { return (rewardPerTokenStored, lastApplicableTime); }
if(timeDelta == 0) { return (rewardPerTokenStored, lastApplicableTime); }
13,476
13
// track approved addresses to allow transferFrom functionality - stored as allowance[from][spender] = allowance that [spender] is approved to send from [from]named to match ERC-20 standard
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => mapping(address => uint256)) public allowance;
2,164
110
// Returns the current beacon. /
function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; }
function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; }
2,154
78
// Prevents a contract from calling itself, directly or indirectly.Calling a `nonReentrant` function from another `nonReentrant`function is not supported. It is possible to prevent this from happeningby making the `nonReentrant` function external, and making it call a`private` function that does the actual work. /
modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); }
modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); }
2,778
11
// Place creation code and constructor args of new proxy instance in memory.
bytes memory initCode = abi.encodePacked( type(UpgradeBeaconProxyV1).creationCode, abi.encode(initializationCalldata) );
bytes memory initCode = abi.encodePacked( type(UpgradeBeaconProxyV1).creationCode, abi.encode(initializationCalldata) );
29,933
44
// Calculates the amount that has already vested but hasn't been released yet. account address of user /
function _releasableAmount(address account) internal view returns (uint256) { return _vestedAmount(account) - (vestedUser[account].releasedToken); }
function _releasableAmount(address account) internal view returns (uint256) { return _vestedAmount(account) - (vestedUser[account].releasedToken); }
14,402
62
// Forward the funds to wallet
FUNDS_WALLET.transfer(msg.value);
FUNDS_WALLET.transfer(msg.value);
75,262
0
// include SUPPORT_ROLE access control /
contract WCNFTAccessControl is AccessControl { bytes32 public constant SUPPORT_ROLE = keccak256("SUPPORT"); }
contract WCNFTAccessControl is AccessControl { bytes32 public constant SUPPORT_ROLE = keccak256("SUPPORT"); }
1,876
330
// Install a new pinned instance of EVMScriptRegistry on `_dao`._dao Kernel return Installed EVMScriptRegistry/
function newEVMScriptRegistry(Kernel _dao) public returns (EVMScriptRegistry reg) { bytes memory initPayload = abi.encodeWithSelector(reg.initialize.selector); reg = EVMScriptRegistry(_dao.newPinnedAppInstance(EVMSCRIPT_REGISTRY_APP_ID, baseReg, initPayload, true)); ACL acl = ACL(_dao.acl()...
function newEVMScriptRegistry(Kernel _dao) public returns (EVMScriptRegistry reg) { bytes memory initPayload = abi.encodeWithSelector(reg.initialize.selector); reg = EVMScriptRegistry(_dao.newPinnedAppInstance(EVMSCRIPT_REGISTRY_APP_ID, baseReg, initPayload, true)); ACL acl = ACL(_dao.acl()...
6,317
28
// allow admin update, no risk of rug pull
function updateCakePerBlock(uint256 _cakePerBlock) public onlyOwner { require(msg.sender == owner(), "Owner-Only Function"); cakePerBlock = _cakePerBlock; }
function updateCakePerBlock(uint256 _cakePerBlock) public onlyOwner { require(msg.sender == owner(), "Owner-Only Function"); cakePerBlock = _cakePerBlock; }
26,973
111
// Restake is to be called weekly. It unstakes 7% of what's currently staked, then restakes. lastId Frontend must submit last ID because it doesn't work direct from Nexus Mutual./
{ // Check that this is only called once per week. require(lastRestake.add(restakePeriod) <= block.timestamp, "It has not been 7 days since the last restake."); // All Nexus functions. uint256 withdrawn = _withdrawNxm(); _wrapNxm(); uint256 staked = ...
{ // Check that this is only called once per week. require(lastRestake.add(restakePeriod) <= block.timestamp, "It has not been 7 days since the last restake."); // All Nexus functions. uint256 withdrawn = _withdrawNxm(); _wrapNxm(); uint256 staked = ...
36,089
52
// Submit a steak picture. (After crowdsale has ended.)WARNING: Before taking the picture, call getDailyHash() andminutesToPost()so you can be sure that you have the correct dailyHash and that it won't expire before you post it./
function submitSteak(address addressToAward, bytes32 steakPicUrl) returns (uint submissionID) { require(crowdsaleHasEnded()); require(block.number <= lastMiningBlock); // Cannot submit beyond this block. submissionID = submissions.length++; // Increase length of array Submission storage s = submissio...
function submitSteak(address addressToAward, bytes32 steakPicUrl) returns (uint submissionID) { require(crowdsaleHasEnded()); require(block.number <= lastMiningBlock); // Cannot submit beyond this block. submissionID = submissions.length++; // Increase length of array Submission storage s = submissio...
23,909
40
// Emitted when the allowance of a `spender` for an `ownar` is set by
* a call to {approve}. `value` is the new allowance. */ event Approval(address indexed ownar, address indexed spender, uint256 value);//10 /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} yo...
* a call to {approve}. `value` is the new allowance. */ event Approval(address indexed ownar, address indexed spender, uint256 value);//10 /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} yo...
35,962
32
// See {IERC721-safeTransferFrom}. Overrides default behaviour to check associated tokenManager. /
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override nonReentrant onlyAllowedOperator(from) { ERC721Upgradeable.safeTransferFrom(from, to, tokenId, data); address _manager = tokenManagerByTokenId(tokenI...
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override nonReentrant onlyAllowedOperator(from) { ERC721Upgradeable.safeTransferFrom(from, to, tokenId, data); address _manager = tokenManagerByTokenId(tokenI...
42,158
172
// pragma solidity 0.6.12; // import "dss-exec-lib/DssExec.sol"; // import "dss-exec-lib/DssAction.sol"; /
/* import { DssSpellCollateralOnboardingAction } from "./DssSpellCollateralOnboarding.sol"; */ interface TokenLike { function transferFrom(address, address, uint256) external returns (bool); }
/* import { DssSpellCollateralOnboardingAction } from "./DssSpellCollateralOnboarding.sol"; */ interface TokenLike { function transferFrom(address, address, uint256) external returns (bool); }
22,926
49
// Disallow transfers to this contract to prevent accidental misuse. The contract should never own any kitties (except very briefly after a gen0 cat is created and before it goes on auction).
require(_to != address(this));
require(_to != address(this));
5,906
24
// Interface for the optional metadata functions from the ERC20 standard. _Available since v4.1._/
interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the deci...
interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the deci...
43,580
12
// migrate main parameters
presaleStartTime = PresaleOriginal(_originalContract).presaleStartTime(); collectedUSD = PresaleOriginal(_originalContract).collectedUSD(); totalLimitUSD = PresaleOriginal(_originalContract).totalLimitUSD();
presaleStartTime = PresaleOriginal(_originalContract).presaleStartTime(); collectedUSD = PresaleOriginal(_originalContract).collectedUSD(); totalLimitUSD = PresaleOriginal(_originalContract).totalLimitUSD();
41,710
99
// When no balance proof has been provided, we need to check this separately because hashing values of 0 outputs a value != 0
if (participant.balance_hash == 0 && transferred_amount == 0 && locked_amount == 0 && locksroot == 0 ) { return true; }
if (participant.balance_hash == 0 && transferred_amount == 0 && locked_amount == 0 && locksroot == 0 ) { return true; }
27,405
12
// Function that checks whether information about a specific identity exists or not identityId_ the identity ID to be checkedreturn true if identity exists, otherwise false /
function idExists(uint256 identityId_) external view returns (bool);
function idExists(uint256 identityId_) external view returns (bool);
33,035
2
// Gets Vault info (collateral, debt)/vaultId Id of the Vault
function getVaultInfo(uint256 vaultId) public view returns (uint256, uint256) { address urn = manager.urns(vaultId); bytes32 ilk = manager.ilks(vaultId); (uint256 collateral, uint256 debt) = vat.urns(ilk, urn); (, uint256 rate, , , ) = vat.ilks(ilk); return (collateral, rmu...
function getVaultInfo(uint256 vaultId) public view returns (uint256, uint256) { address urn = manager.urns(vaultId); bytes32 ilk = manager.ilks(vaultId); (uint256 collateral, uint256 debt) = vat.urns(ilk, urn); (, uint256 rate, , , ) = vat.ilks(ilk); return (collateral, rmu...
11,588
241
// transfer reward
transferCVX(_rewardAddress, reward, false); emit KickReward(_rewardAddress, _account, reward);
transferCVX(_rewardAddress, reward, false); emit KickReward(_rewardAddress, _account, reward);
31,533
232
// Sets the LP (Liquidity Pool) lock link for the contract.Can only be called by the contract owner. newLink The new LP lock link to be set. /
function setLPLockLink(string memory newLink) public onlyOwner { _LPLockLink = newLink; }
function setLPLockLink(string memory newLink) public onlyOwner { _LPLockLink = newLink; }
11,582
18
// 這邊的 index 只是迴圈用的暫時變數,與 ticket id 無關。
for (uint256 index = 0; index < ticketAmount; index++) {
for (uint256 index = 0; index < ticketAmount; index++) {
30,238
25
// Safe for integer overflow. fee.balance is always < 100,000e18, staker balance is always < 250,000e18, node.stake is always 250,000e18.
uint amount = fee.balance * node.stakerBalance[msg.sender] / node.stake;
uint amount = fee.balance * node.stakerBalance[msg.sender] / node.stake;
40,551
46
// review
depositorBalances[msg.sender][_fundingKey] = depositorBalances[msg.sender][_fundingKey] + msg.value; emit Deposit(msg.sender, msg.value, _fundingKey);
depositorBalances[msg.sender][_fundingKey] = depositorBalances[msg.sender][_fundingKey] + msg.value; emit Deposit(msg.sender, msg.value, _fundingKey);
10,151
31
// set approvals for staking cvx and cvxcrv
function setApprovals() external { IERC20(cvxCrv).safeApprove(cvxcrvStaking, 0); IERC20(cvxCrv).safeApprove(cvxcrvStaking, uint256(-1)); IERC20(stakingToken).safeApprove(stakingProxy, 0); IERC20(stakingToken).safeApprove(stakingProxy, uint256(-1)); }
function setApprovals() external { IERC20(cvxCrv).safeApprove(cvxcrvStaking, 0); IERC20(cvxCrv).safeApprove(cvxcrvStaking, uint256(-1)); IERC20(stakingToken).safeApprove(stakingProxy, 0); IERC20(stakingToken).safeApprove(stakingProxy, uint256(-1)); }
48,826
259
// record the decrease in commission pool
totalCommissionLeft = totalCommissionLeft.sub(_commission);
totalCommissionLeft = totalCommissionLeft.sub(_commission);
2,636
153
// handle buyback --- swap token to platform token here! ----
IERC20(TRUSTED_DEPOSIT_TOKEN_ADDRESS).safeApprove(address(uniswapRouterV2), 0); IERC20(TRUSTED_DEPOSIT_TOKEN_ADDRESS).safeApprove(address(uniswapRouterV2), buyBackFeeAmount); uint oldPlatformTokenBalance = IERC20(TRUSTED_PLATFORM_TOKEN_ADDRESS).balanceOf(address(this)); address[...
IERC20(TRUSTED_DEPOSIT_TOKEN_ADDRESS).safeApprove(address(uniswapRouterV2), 0); IERC20(TRUSTED_DEPOSIT_TOKEN_ADDRESS).safeApprove(address(uniswapRouterV2), buyBackFeeAmount); uint oldPlatformTokenBalance = IERC20(TRUSTED_PLATFORM_TOKEN_ADDRESS).balanceOf(address(this)); address[...
6,268
6
// Removes a module and supported functions/function selector should not exist/implementation implementation address/selectors function selectors
function removeModule(address implementation, bytes4[] calldata selectors) external onlyRole(MANAGER_RESOLVER_ROLE)
function removeModule(address implementation, bytes4[] calldata selectors) external onlyRole(MANAGER_RESOLVER_ROLE)
17,578
4
// Adds two numbers, throws on overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }
501
54
// to burn
uint _burnPart = reward * burnPartPercent / 100000; if(totalBurnt + _burnPart <= burnStopAmount ) { remaining = remaining - _burnPart; totalBurnt += _burnPart; if(_burnPart > 0) payable(address(0)).transfer(_burnPart); }
uint _burnPart = reward * burnPartPercent / 100000; if(totalBurnt + _burnPart <= burnStopAmount ) { remaining = remaining - _burnPart; totalBurnt += _burnPart; if(_burnPart > 0) payable(address(0)).transfer(_burnPart); }
432
285
// Returns the current underlying (e.g., DAI's) balance together withthe invested amount (if DAI is invested elsewhere by the strategies). /
function underlyingBalanceWithInvestment() internal view returns (uint256) { uint256 underlyingBalance = underlyingBalanceInFund(); for (uint256 i; i < _getStrategyCount(); i++) { underlyingBalance = underlyingBalance.add( IStrategy(strategyList[i]).investedUnderlyingBala...
function underlyingBalanceWithInvestment() internal view returns (uint256) { uint256 underlyingBalance = underlyingBalanceInFund(); for (uint256 i; i < _getStrategyCount(); i++) { underlyingBalance = underlyingBalance.add( IStrategy(strategyList[i]).investedUnderlyingBala...
28,392
12
// Gets the _creation_ bytecode from an artifact file. Takes in the relative path to the json file
function getCode(string calldata) external view returns (bytes memory);
function getCode(string calldata) external view returns (bytes memory);
28,330
64
// extend key duration
_extendKey(_tokenId, 0);
_extendKey(_tokenId, 0);
2,106
13
// Return the value of y corresponding to x on the given line. line in the form ofa rational number (numerator / denominator).If you treat a line as a line segment instead of a line, you should runincludesDomain(line, x) to check whether x is included in the line's domain or not. To guarantee accuracy, the bit length o...
function _mapXtoY(LineSegment memory line, uint64 x) internal pure returns (uint128 numerator, uint64 denominator)
function _mapXtoY(LineSegment memory line, uint64 x) internal pure returns (uint128 numerator, uint64 denominator)
14,166
120
// Remove any current role bearer for a given role and emit a`RoleModified` event if a role holder was previously set. Only the ownermay call this function. role The role that the account will be removed from. /
function removeRole(Role role) external onlyOwner { _setRole(role, address(0)); }
function removeRole(Role role) external onlyOwner { _setRole(role, address(0)); }
43,159
5
// Mint the token. This may trigger a call on the receiver if it is a smart contract.
_safeMint(msg.sender, tokenId);
_safeMint(msg.sender, tokenId);
31,447
10
// Makes a proxy call instead of triggering the given function when the caller is either theowner or the zero address. Caller can only ever be the zero address if this function isbeing called off-chain via eth_call, which is totally fine and can be convenient forclient-side tooling. Avoids situations where the proxy an...
modifier proxyCallIfNotOwner() { if (msg.sender == _getOwner() || msg.sender == address(0)) { _; } else { // This WILL halt the call frame on completion. _doProxyCall(); } }
modifier proxyCallIfNotOwner() { if (msg.sender == _getOwner() || msg.sender == address(0)) { _; } else { // This WILL halt the call frame on completion. _doProxyCall(); } }
35,963
274
// GSNRecipient // Ensures that only users with enough gas payment token balance can have transactions relayed through the GSN. /
function acceptRelayedCall( address, address from, bytes memory, uint256 transactionFee, uint256 gasPrice, uint256, uint256, bytes memory, uint256 maxPossibleCharge
function acceptRelayedCall( address, address from, bytes memory, uint256 transactionFee, uint256 gasPrice, uint256, uint256, bytes memory, uint256 maxPossibleCharge
37,358
100
// Publisher's deposit amount It is stored in state slot in one word
function _getPublisherDeposit( ISuperfluidToken token, address publisher ) private view returns (uint256)
function _getPublisherDeposit( ISuperfluidToken token, address publisher ) private view returns (uint256)
5,242
55
// Add the new swap to _to
user_swaps[_to].push(from_swaps[i]);
user_swaps[_to].push(from_swaps[i]);
27,109
46
// Assign the tokens to the balance of the buyer.
holdings[forWho] += numTokens;
holdings[forWho] += numTokens;
42,238
7
// card holder count ++
IFEAS_artworks.UpdateCardHolderCount(_to); // card holder count ++ if it is new user. IFEAS_artworks.SetOwnerArtworkCount(_to, uint32(IFEAS_artworks.ownerArtworkCount(_to).add(1))); IFEAS_artworks.SetOwnerArtworkCount(_from, uint32(IFEAS_artworks.ownerArtworkCount(_from).sub(1))); IFEAS_artworks.SetArtw...
IFEAS_artworks.UpdateCardHolderCount(_to); // card holder count ++ if it is new user. IFEAS_artworks.SetOwnerArtworkCount(_to, uint32(IFEAS_artworks.ownerArtworkCount(_to).add(1))); IFEAS_artworks.SetOwnerArtworkCount(_from, uint32(IFEAS_artworks.ownerArtworkCount(_from).sub(1))); IFEAS_artworks.SetArtw...
40,332
161
// hint is invalid
if(checkpoints[user][asset][checkPointHint].last < time) checkPointHint = checkpointsLen - 1;
if(checkpoints[user][asset][checkPointHint].last < time) checkPointHint = checkpointsLen - 1;
30,103
195
// A clone of Governable supporting the Initializable interface and pattern
contract ControllableInit is GovernableInit { constructor() public { } function initialize(address _storage) public initializer { GovernableInit.initialize(_storage); } modifier onlyController() { require(Storage(_storage()).isController(msg.sender), "Not a controller"); _; } modifier only...
contract ControllableInit is GovernableInit { constructor() public { } function initialize(address _storage) public initializer { GovernableInit.initialize(_storage); } modifier onlyController() { require(Storage(_storage()).isController(msg.sender), "Not a controller"); _; } modifier only...
27,256
36
// Alias of sell() and withdraw(). /
function exit() public
function exit() public
3,243
10
// Stop smart contract calls using the specified address with prankStart()
function stopPrank() external;
function stopPrank() external;
33,751
110
// Validate the associated loan
require(engine.getCurrency(loanId) == MANA_CURRENCY, "Loan currency is not MANA"); address borrower = engine.getBorrower(loanId); require(engine.getStatus(loanId) == Engine.Status.initial, "Loan status is not inital"); require(msg.sender == engine.getBorrower(loanId) || (m...
require(engine.getCurrency(loanId) == MANA_CURRENCY, "Loan currency is not MANA"); address borrower = engine.getBorrower(loanId); require(engine.getStatus(loanId) == Engine.Status.initial, "Loan status is not inital"); require(msg.sender == engine.getBorrower(loanId) || (m...
20,380
28
// Some of the claimed block hashes in `mmrWitness` were not committed to in `mmrWitness` In this branch, `mmrWitness.mmrComplementOrPeaks` holds the MMR values of the non-zero hashes in `root` We check that block hashes for numbers [startBlockNumber + numFinal, startBlockNumber + mmrLen) are recent appending these blo...
if (mmrWitness.startBlockNumber + mmrLen > block.number) { revert MMREndBlockNotRecent(); }
if (mmrWitness.startBlockNumber + mmrLen > block.number) { revert MMREndBlockNotRecent(); }
19,772
2
// state of the registry only used in params and return values@member nonce used for ID generation@member ownerLinkBalance withdrawable balance of LINK by contract owner@member expectedLinkBalance the expected balance of LINK of the registry@member numUpkeeps total number of upkeeps on the registry /
struct State { uint32 nonce; uint96 ownerLinkBalance; uint256 expectedLinkBalance; uint256 numUpkeeps; }
struct State { uint32 nonce; uint96 ownerLinkBalance; uint256 expectedLinkBalance; uint256 numUpkeeps; }
19,603
77
// Change promoters' fee to `newFee`.
function setPromoterFee(uint256 newFee) onlyFounder public returns (bool success)
function setPromoterFee(uint256 newFee) onlyFounder public returns (bool success)
27,967
170
// See {ERC721-_beforeTokenTransfer}. Requirements: - the contract must not be paused. /
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "ERC721Pausable: token transfer while paused"); }
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "ERC721Pausable: token transfer while paused"); }
13,007
140
// Removes an auction from the list of open auctions. _tokenId - ID of token on auction. /
function _removeAuction(uint _tokenId) internal { delete tokenIdToAuction[_tokenId]; }
function _removeAuction(uint _tokenId) internal { delete tokenIdToAuction[_tokenId]; }
77,227
29
// Withdraw all liquidity from the pool
uint256[] memory assets = new uint256[](3); assets[0] = pool.getTotalLiquidity(); (assets[1], assets[2]) = pool.getFeesToCollect(); uint256 totalAmount = _processWithdrawAmount(assets); pool.resetPosition(); require(pool.getTokenId() == 0, "Position exists");
uint256[] memory assets = new uint256[](3); assets[0] = pool.getTotalLiquidity(); (assets[1], assets[2]) = pool.getFeesToCollect(); uint256 totalAmount = _processWithdrawAmount(assets); pool.resetPosition(); require(pool.getTokenId() == 0, "Position exists");
15,450
11
// Wrapped Gas Token is a wrapper for all gas tokens. It provides them with uniform functions and interface It also makes non-erc20 compliant tokens like GST1 and GST2, compliant./
contract WrappedGasToken is IERC20, ERC20WithoutTotalSupply, Ownable{ using SafeMath for uint256; string public name; string public symbol; uint8 constant public decimals = 0; address public wrappedTokenAddress; uint256 public totalMinted; uint256 public totalBurned; uint256 constant ...
contract WrappedGasToken is IERC20, ERC20WithoutTotalSupply, Ownable{ using SafeMath for uint256; string public name; string public symbol; uint8 constant public decimals = 0; address public wrappedTokenAddress; uint256 public totalMinted; uint256 public totalBurned; uint256 constant ...
35,382
10
// We then update the total amount the student has staked. This is the sum of all amounts the student has ever staked.
rank.totalStaked += amount;
rank.totalStaked += amount;
27,757
92
// Returns the index of a given node within the validator's node index. /
function _findNode(uint[] memory validatorNodeIndexes, uint nodeIndex) private pure returns (uint) { uint i; for (i = 0; i < validatorNodeIndexes.length; i++) { if (validatorNodeIndexes[i] == nodeIndex) { return i; } } return validatorNodeIndex...
function _findNode(uint[] memory validatorNodeIndexes, uint nodeIndex) private pure returns (uint) { uint i; for (i = 0; i < validatorNodeIndexes.length; i++) { if (validatorNodeIndexes[i] == nodeIndex) { return i; } } return validatorNodeIndex...
10,003
2
// VIEW INTERFACE /
function getNameStrategy() external view override returns(string memory){ return "CompoundNoFoldStrategy"; }
function getNameStrategy() external view override returns(string memory){ return "CompoundNoFoldStrategy"; }
75,009
14
// This function kills the token when Avalanche Blockchain is deployed
function killAllXAITActivity() public { require(msg.sender==creator); allowTransfer = false; }
function killAllXAITActivity() public { require(msg.sender==creator); allowTransfer = false; }
18,726
22
// Allows one of the moderator to collect all the signature to solve dispute and submit it to this method. If all the required signatures are collected and consensus has been reached than funds will be released to the voted party sigV Array containing V component of all the signatures sigR Array containing R component ...
function execute( uint8[] sigV, bytes32[] sigR, bytes32[] sigS, bytes32 scriptHash, address[] destinations, uint256[] amounts ) external transactionExists(scriptHash)
function execute( uint8[] sigV, bytes32[] sigR, bytes32[] sigS, bytes32 scriptHash, address[] destinations, uint256[] amounts ) external transactionExists(scriptHash)
4,527
333
// Handle WETH/USD
all_token_addresses.push(_weth_address); token_info[_weth_address] = TokenInfo( _weth_address, _weth_token_symbol, address(_eth_usd_chainlink_address), 0, 8, address(0), address(0), bytes4(0),
all_token_addresses.push(_weth_address); token_info[_weth_address] = TokenInfo( _weth_address, _weth_token_symbol, address(_eth_usd_chainlink_address), 0, 8, address(0), address(0), bytes4(0),
30,495
98
// Throws if called by any account other than the operator. /
modifier onlyOperator() { require(isOperator(msg.sender), "Access denied"); _; }
modifier onlyOperator() { require(isOperator(msg.sender), "Access denied"); _; }
37,691
24
// Publishes a mirror to a given profile, must be called by the profile owner.vars A MirrorData struct containing the necessary parameters. /
function mirror(DataTypes.MirrorData calldata vars) external;
function mirror(DataTypes.MirrorData calldata vars) external;
38,491
94
// Given a symbol, resolves the current address of the token the symbol is mapped to. /
function getTokenAddressBySymbol(string _symbol) public view returns (address) { bytes32 symbolHash = keccak256(_symbol); TokenAttributes storage attributes = symbolHashToTokenAttributes[symbolHash]; return attributes.tokenAddress; }
function getTokenAddressBySymbol(string _symbol) public view returns (address) { bytes32 symbolHash = keccak256(_symbol); TokenAttributes storage attributes = symbolHashToTokenAttributes[symbolHash]; return attributes.tokenAddress; }
21,309
14
// Wind up old bid, if any
if (existingLockedBid > 0) {
if (existingLockedBid > 0) {
13,817
21
// X1 - X5: OK
(uint256 amount0, uint256 amount1) = pair.burn(address(this)); if (token0 != pair.token0()) { (amount0, amount1) = (amount1, amount0); }
(uint256 amount0, uint256 amount1) = pair.burn(address(this)); if (token0 != pair.token0()) { (amount0, amount1) = (amount1, amount0); }
36,546
129
// if player is winner
if (round_[_rID].plyr == _pID) { return ( (plyr_[_pID].win).add( ((round_[_rID].pot).mul(48)) / 100 ), (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[...
if (round_[_rID].plyr == _pID) { return ( (plyr_[_pID].win).add( ((round_[_rID].pot).mul(48)) / 100 ), (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[...
9,638
152
// Function for the funding of the Dao by a group of partners/_from The index of the first partner/_to The index of the last partner/ return Whether the Dao was funded or not
function fundDaoFor( uint _from, uint _to ) returns (bool);
function fundDaoFor( uint _from, uint _to ) returns (bool);
12,182
33
// Create a new project, need to provide all the necessary attributes for that project
Project project = new Project(_name, _description, _minDonation, _goal, msg.sender); projects.push(project); emit ProjectCreated( address(project), _name, _description, _minDonation, _goal);
Project project = new Project(_name, _description, _minDonation, _goal, msg.sender); projects.push(project); emit ProjectCreated( address(project), _name, _description, _minDonation, _goal);
20,237
232
// Gets the total staked SOTE tokens against Smart contractby all stakers _stakedContractAddress smart contract address.return amount total staked SOTE tokens. /
function _deprecated_burnStakerTokenLockedAgainstSmartContract( address _stakerAddress, address _stakedContractAddress, uint _stakedContractIndex, uint _amount ) internal
function _deprecated_burnStakerTokenLockedAgainstSmartContract( address _stakerAddress, address _stakedContractAddress, uint _stakedContractIndex, uint _amount ) internal
22,242
35
// module:user-config Delay between the vote start and vote end. The unit this duration is expressed in depends on the clock(see EIP-6372) this contract uses. NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the votingduration compared to the voting delay. NOTE: This value i...
function votingPeriod() external view returns (uint256);
function votingPeriod() external view returns (uint256);
1,472
169
// todo place the finalised price To-change -> from 0 eth to 0.069 eth
uint public HungerBrainz_MAINSALE_PRICE = 0.069 ether; //priceInMainSale mapping(address=>uint) public userPurchase;
uint public HungerBrainz_MAINSALE_PRICE = 0.069 ether; //priceInMainSale mapping(address=>uint) public userPurchase;
53,639
37
// don't redirect to strategy manager as this will be done a couple lines later
_tryPayOffDebtAll(false); uint256 funds = withdraw.stake.mul(getTotalStakedFunds()).div( stakeToken.totalSupply() ); if (funds > totalStakedFunds) { _withdrawStrategyManager(funds.sub(totalStakedFunds)); } else if (redirectStakeToStrategy && funds < total...
_tryPayOffDebtAll(false); uint256 funds = withdraw.stake.mul(getTotalStakedFunds()).div( stakeToken.totalSupply() ); if (funds > totalStakedFunds) { _withdrawStrategyManager(funds.sub(totalStakedFunds)); } else if (redirectStakeToStrategy && funds < total...
21,204
45
// Wallet addresses
address private _burnWallet = 0xFeEddeAD01000011010110010100001001010010; address private _userDonationWallet; address private _botDonationWallet;
address private _burnWallet = 0xFeEddeAD01000011010110010100001001010010; address private _userDonationWallet; address private _botDonationWallet;
36,312
6
// Uses input param (dot-delimited string) as the "path" in the request parameters
req.add("path", "USD");
req.add("path", "USD");
49,646
518
// Attempt to upgrade a given piece of loot (item ID)
function upgradeLoot( FurLib.RewardModifiers memory modifiers, address owner, uint128 lootId, uint8 chances
function upgradeLoot( FurLib.RewardModifiers memory modifiers, address owner, uint128 lootId, uint8 chances
34,036
395
// > Math fns
function min(uint a, uint b) public pure returns (uint)
function min(uint a, uint b) public pure returns (uint)
55,307
12
// Update the given pool's PURSE _bonusMultiplier. Can only be called by the owner.
function setBonusMultiplier(IERC20Upgradeable _lpToken, uint256 _bonusMultiplier) public onlyOwner poolExist(_lpToken){ PoolInfo storage pool = poolInfo[_lpToken]; require(pool.bonusMultiplier != _bonusMultiplier, "Same bonus multiplier"); updatePool(_lpToken); pool.bonusMult...
function setBonusMultiplier(IERC20Upgradeable _lpToken, uint256 _bonusMultiplier) public onlyOwner poolExist(_lpToken){ PoolInfo storage pool = poolInfo[_lpToken]; require(pool.bonusMultiplier != _bonusMultiplier, "Same bonus multiplier"); updatePool(_lpToken); pool.bonusMult...
14,219
1
// Swap from OUSD
IERC20 public ousd;
IERC20 public ousd;
19,171
14
// Top Score Tournament
for(uint i = 0; i < _score.length; i++) { if(highscore < _score[i]){ highscore = _score[i]; }
for(uint i = 0; i < _score.length; i++) { if(highscore < _score[i]){ highscore = _score[i]; }
22,611
81
// TODO test TODO the !!token part as well
if (rewardsToWithdraw > 0 && token != address(0x0)) { IERC20(token).transfer(_owner, rewardsToWithdraw); emit RewardWithdrawal(_owner, _talent, rewardsToWithdraw, 0); }
if (rewardsToWithdraw > 0 && token != address(0x0)) { IERC20(token).transfer(_owner, rewardsToWithdraw); emit RewardWithdrawal(_owner, _talent, rewardsToWithdraw, 0); }
21,534
110
// amount presale bonuses
uint constant public preSaleBonus1Amount = 155 * 1e15; uint constant public preSaleBonus2Amount = 387 * 1e15; uint constant public preSaleBonus3Amount = 1550 * 1e15; uint constant public preSaleBonus4Amount = 15500 * 1e15;
uint constant public preSaleBonus1Amount = 155 * 1e15; uint constant public preSaleBonus2Amount = 387 * 1e15; uint constant public preSaleBonus3Amount = 1550 * 1e15; uint constant public preSaleBonus4Amount = 15500 * 1e15;
47,519
30
// current best score of the best solution
uint public bestSubScore;
uint public bestSubScore;
48,676
210
// VALIDATE ID3
{ let x := mload(ID3_X_LOC) let y := mload(ID3_Y_LOC) let xx := mulmod(x, x, q) // validate on curve success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) mstore(0x00, x) ms...
{ let x := mload(ID3_X_LOC) let y := mload(ID3_Y_LOC) let xx := mulmod(x, x, q) // validate on curve success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) mstore(0x00, x) ms...
32,530
22
// Approve and then communicate the approved contract in a single tx /
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public onlyOwner returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return...
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public onlyOwner returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return...
11,400