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
2
// A parameter object containing token swap data and a payment transaction payload /
struct TokenData { uint256 amountIn; uint256 amountOut; uint256 nativeOut; address tokenIn; address tokenOut; bytes path; bytes payload; }
struct TokenData { uint256 amountIn; uint256 amountOut; uint256 nativeOut; address tokenIn; address tokenOut; bytes path; bytes payload; }
37,198
167
// Claim all the COMP accrued by specific holders in specific markets for their supplies and/or borrows
function claimComp( address[] calldata holders, address[] calldata cTokens, bool borrowers, bool suppliers ) external; function markets(address cTokenAddress) external view
function claimComp( address[] calldata holders, address[] calldata cTokens, bool borrowers, bool suppliers ) external; function markets(address cTokenAddress) external view
30,099
65
// Update the sheet to sync with actions that occured on otherside of bridge/tokenId Id of the SheetFighter/HP New HP value/critical New luck value/heal New heal value/defense New defense value/attack New attack value
function syncBridgedSheet( uint256 tokenId, uint8 HP, uint8 critical, uint8 heal, uint8 defense, uint8 attack ) external;
function syncBridgedSheet( uint256 tokenId, uint8 HP, uint8 critical, uint8 heal, uint8 defense, uint8 attack ) external;
33,834
54
// Assign `amount_` of privately distributed tokens to someone identified with `to_` address. to_ Tokens owner group_ Group identifier of privately distributed tokens amount_ Number of tokens distributed with decimals part /
function assignReserved(address to_, uint8 group_, uint amount_) public onlyOwner { require(to_ != address(0) && (group_ & 0x1F) != 0); // SafeMath will check reserved[group_] >= amount reserved[group_] = reserved[group_].sub(amount_); balances[to_] = balances[to_].add(amount_); if (group_ == RESERVED_TEAM_GROUP) { teamReservedBalances[to_] = teamReservedBalances[to_].add(amount_); } else if (group_ == RESERVED_BOUNTY_GROUP) { bountyReservedBalances[to_] = bountyReservedBalances[to_].add(amount_); } emit ReservedTokensDistributed(to_, group_, amount_); }
function assignReserved(address to_, uint8 group_, uint amount_) public onlyOwner { require(to_ != address(0) && (group_ & 0x1F) != 0); // SafeMath will check reserved[group_] >= amount reserved[group_] = reserved[group_].sub(amount_); balances[to_] = balances[to_].add(amount_); if (group_ == RESERVED_TEAM_GROUP) { teamReservedBalances[to_] = teamReservedBalances[to_].add(amount_); } else if (group_ == RESERVED_BOUNTY_GROUP) { bountyReservedBalances[to_] = bountyReservedBalances[to_].add(amount_); } emit ReservedTokensDistributed(to_, group_, amount_); }
6,760
62
// Recover any residual ERC20 token/ETH to the multisig token ERC20 token address that is sent to this contract. Address 0 for ETH /
function recoverTokens(address token) external { if (token == address (0)) { MULTISIG.transfer(address(this).balance); } else { IERC20(token).safeTransfer(MULTISIG, IERC20(token).balanceOf(address(this))); } }
function recoverTokens(address token) external { if (token == address (0)) { MULTISIG.transfer(address(this).balance); } else { IERC20(token).safeTransfer(MULTISIG, IERC20(token).balanceOf(address(this))); } }
80,717
1,339
// We always SSTORE to the storage of ADDRESS.
address contractAddress = ovmADDRESS(); _putContractStorage( contractAddress, _key, _value );
address contractAddress = ovmADDRESS(); _putContractStorage( contractAddress, _key, _value );
57,173
19
// Returns the module address for a given token ID/_tokenId The token ID/ return The module address
function tokenIdToModule(uint256 _tokenId) public pure returns (address) { return address(uint160(_tokenId)); }
function tokenIdToModule(uint256 _tokenId) public pure returns (address) { return address(uint160(_tokenId)); }
11,901
193
// NOTE: use the larger of total assets or debt outstanding to book losses properly
(debtPayment, loss) = liquidatePosition(totalAssets > debtOutstanding ? totalAssets : debtOutstanding);
(debtPayment, loss) = liquidatePosition(totalAssets > debtOutstanding ? totalAssets : debtOutstanding);
10,723
1
// TODO: add access control rules under DAO
function setBlocksPerYear(uint256 _blocksPerYear) external { return _setUint(BLOCKS_PER_YEAR, _blocksPerYear); }
function setBlocksPerYear(uint256 _blocksPerYear) external { return _setUint(BLOCKS_PER_YEAR, _blocksPerYear); }
24,230
1
// Box Factory Helper contract for creating Boxes /
contract BoxFactory { event BoxCreated(address indexed owner, address box); function createBox( address token_address, uint256 goal, uint256 mininal_contribution, address receiver ) public returns (address) { address owner = msg.sender; address boxAddress = address(new Box( token_address, goal, mininal_contribution, receiver, owner )); emit BoxCreated(owner, boxAddress); return boxAddress; } }
contract BoxFactory { event BoxCreated(address indexed owner, address box); function createBox( address token_address, uint256 goal, uint256 mininal_contribution, address receiver ) public returns (address) { address owner = msg.sender; address boxAddress = address(new Box( token_address, goal, mininal_contribution, receiver, owner )); emit BoxCreated(owner, boxAddress); return boxAddress; } }
28,558
125
// Validate params
if (uint8(pk[0]) != (0x00 + 9)) { return -3; }
if (uint8(pk[0]) != (0x00 + 9)) { return -3; }
14,301
15
// Ejects a member address from having authorization to this wallet.
function eject(address _memberAddress) public onlyAdmin { require(roles[_memberAddress] == Role.MEMBER, "Attempted to eject non-MEMBER."); // Makes sure address is not an ADMIN. roles[_memberAddress] = Role.UNAUTHORIZED; }
function eject(address _memberAddress) public onlyAdmin { require(roles[_memberAddress] == Role.MEMBER, "Attempted to eject non-MEMBER."); // Makes sure address is not an ADMIN. roles[_memberAddress] = Role.UNAUTHORIZED; }
6,526
5
// Value to use to avoid any division by 0 or values near 0
uint private constant MIN_T_ANNUALISED = PRECISE_UNIT / SECONDS_PER_YEAR; // 1 second uint private constant MIN_VOLATILITY = PRECISE_UNIT / 10000; // 0.001% uint private constant VEGA_STANDARDISATION_MIN_DAYS = 7 days;
uint private constant MIN_T_ANNUALISED = PRECISE_UNIT / SECONDS_PER_YEAR; // 1 second uint private constant MIN_VOLATILITY = PRECISE_UNIT / 10000; // 0.001% uint private constant VEGA_STANDARDISATION_MIN_DAYS = 7 days;
33,664
36
// MANAGEMENT
if(_roleId == 2){ initBalance = 44444400; }
if(_roleId == 2){ initBalance = 44444400; }
47,389
10
// Check that the user has not registered previously:
require(!user.set, "User has been registered previously");
require(!user.set, "User has been registered previously");
11,946
31
// Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)From MonolithDAO Token.sol _spender The address which will spend the funds. _addedValue The amount of tokens to increase the allowance by. /
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
1,925
11
// We don't return the Rebalancer's address, but that can be queried in the Vault by calling `getPoolTokenInfo`.
return pool;
return pool;
11,957
69
// Private function to set a new account on a given role and emit a`RoleModified` event if the role holder has changed. role The role that the account will be set for. account The account to set as the designated role bearer. /
function _setRole(Role role, address account) private { RoleStatus storage storedRoleStatus = _roles[uint256(role)]; if (account != storedRoleStatus.account) { storedRoleStatus.account = account; emit RoleModified(role, account); } }
function _setRole(Role role, address account) private { RoleStatus storage storedRoleStatus = _roles[uint256(role)]; if (account != storedRoleStatus.account) { storedRoleStatus.account = account; emit RoleModified(role, account); } }
45,366
128
// decrease a user's productivity./Note the best practice will be restrict the callee to prove of productivity's contract address./ return true to confirm that the productivity removed success.
function decreaseProductivity(address user, uint256 value) external returns (bool);
function decreaseProductivity(address user, uint256 value) external returns (bool);
51,550
3
// Creates `_amount` token to `_to`. Must only be called by the minter._to The address of the destination account_amount The number of tokens to be minted/
function mint(address _to, uint256 _amount) external;
function mint(address _to, uint256 _amount) external;
2,084
14
// Validates the liquidation action reserveData The reserve data of the principal nftData The data of the underlying NFT loanData The loan data of the underlying NFT /
) internal view { require(nftData.bNftAddress != address(0), Errors.LPC_INVALIED_BNFT_ADDRESS); for(uint256 i = 0; i < reserveData.mTokenAddresses.length; i++) { require(reserveData.mTokenAddresses[i] != address(0), Errors.VL_INVALID_RESERVE_ADDRESS); } require(reserveData.configuration.getActive(), Errors.VL_NO_ACTIVE_RESERVE); require(nftData.configuration.getActive(), Errors.VL_NO_ACTIVE_NFT); require(loanData.state == DataTypes.LoanState.Auction, Errors.LPL_INVALID_LOAN_STATE); require(loanData.bidderAddress != address(0), Errors.LPL_INVALID_BIDDER_ADDRESS); }
) internal view { require(nftData.bNftAddress != address(0), Errors.LPC_INVALIED_BNFT_ADDRESS); for(uint256 i = 0; i < reserveData.mTokenAddresses.length; i++) { require(reserveData.mTokenAddresses[i] != address(0), Errors.VL_INVALID_RESERVE_ADDRESS); } require(reserveData.configuration.getActive(), Errors.VL_NO_ACTIVE_RESERVE); require(nftData.configuration.getActive(), Errors.VL_NO_ACTIVE_NFT); require(loanData.state == DataTypes.LoanState.Auction, Errors.LPL_INVALID_LOAN_STATE); require(loanData.bidderAddress != address(0), Errors.LPL_INVALID_BIDDER_ADDRESS); }
13,641
17
// otherwise, use the default ERC1155.isApprovedForAll()
return ERC1155.isApprovedForAll(_owner, _operator);
return ERC1155.isApprovedForAll(_owner, _operator);
5,985
21
// Constructs a condition ID from an oracle, a question ID, and the outcome slot count for the question./oracle The account assigned to report the result for the prepared condition./questionId An identifier for the question to be answered by the oracle./outcomeSlotCount The number of outcome slots which should be used for this condition. Must not exceed 256.
function getConditionId(address oracle, bytes32 questionId, uint outcomeSlotCount) external pure returns (bytes32) { return CTHelpers.getConditionId(oracle, questionId, outcomeSlotCount); }
function getConditionId(address oracle, bytes32 questionId, uint outcomeSlotCount) external pure returns (bytes32) { return CTHelpers.getConditionId(oracle, questionId, outcomeSlotCount); }
23,775
55
// exclude from whales or having max tokens limit
_isExcludedFromWhale[owner()]=true; _isExcludedFromWhale[address(this)]=true; _isExcludedFromWhale[address(0)]=true; _isExcludedFromWhale[marketingWallet]=true; _isExcludedFromWhale[devWallet]=true; _isExcludedFromWhale[buybackWallet]=true; _isExcludedFromWhale[uniswapV2Pair]=true; emit Transfer(address(0), _msgSender(), _tTotal);
_isExcludedFromWhale[owner()]=true; _isExcludedFromWhale[address(this)]=true; _isExcludedFromWhale[address(0)]=true; _isExcludedFromWhale[marketingWallet]=true; _isExcludedFromWhale[devWallet]=true; _isExcludedFromWhale[buybackWallet]=true; _isExcludedFromWhale[uniswapV2Pair]=true; emit Transfer(address(0), _msgSender(), _tTotal);
19,667
25
// Allows contributors to recover their ether in the case of a failed funding campaign.
function refund() external { if(isFinalized) throw; // prevents refund if operational if (block.number <= fundingEndBlock) throw; // prevents refund until sale period is over if(totalSupply >= tokenCreationMin) throw; // no refunds if we sold enough if(msg.sender == batFundDeposit) throw; // Brave Intl not entitled to a refund uint256 batVal = balances[msg.sender]; if (batVal == 0) throw; balances[msg.sender] = 0; totalSupply = safeSubtract(totalSupply, batVal); // extra safe uint256 ethVal = batVal / tokenExchangeRate; // should be safe; previous throws covers edges LogRefund(msg.sender, ethVal); // log it if (!msg.sender.send(ethVal)) throw; // if you're using a contract; make sure it works with .send gas limits }
function refund() external { if(isFinalized) throw; // prevents refund if operational if (block.number <= fundingEndBlock) throw; // prevents refund until sale period is over if(totalSupply >= tokenCreationMin) throw; // no refunds if we sold enough if(msg.sender == batFundDeposit) throw; // Brave Intl not entitled to a refund uint256 batVal = balances[msg.sender]; if (batVal == 0) throw; balances[msg.sender] = 0; totalSupply = safeSubtract(totalSupply, batVal); // extra safe uint256 ethVal = batVal / tokenExchangeRate; // should be safe; previous throws covers edges LogRefund(msg.sender, ethVal); // log it if (!msg.sender.send(ethVal)) throw; // if you're using a contract; make sure it works with .send gas limits }
13,513
35
// sourceTokenAmountUsed == swapAmount == loanLocal.collateral
coveredPrincipal = principalNeeded; withdrawAmount = destTokenAmountReceived - principalNeeded;
coveredPrincipal = principalNeeded; withdrawAmount = destTokenAmountReceived - principalNeeded;
42,977
9
// List of all stakes (investor => talent => Stake)
mapping(address => mapping(address => StakeData)) public stakes;
mapping(address => mapping(address => StakeData)) public stakes;
21,480
32
// Withdraw staked tokens without caring about rewards Needs to be for emergency. /
function emergencyWithdraw() external nonReentrant { UserInfo storage user = userInfo[msg.sender]; uint256 amountToTransfer = user.amount; user.amount = 0; user.rewardDebt = 0; if (amountToTransfer > 0) { stakedToken.safeTransfer(address(msg.sender), amountToTransfer); totalStaked = totalStaked.sub(amountToTransfer); } emit EmergencyWithdraw(msg.sender, user.amount); }
function emergencyWithdraw() external nonReentrant { UserInfo storage user = userInfo[msg.sender]; uint256 amountToTransfer = user.amount; user.amount = 0; user.rewardDebt = 0; if (amountToTransfer > 0) { stakedToken.safeTransfer(address(msg.sender), amountToTransfer); totalStaked = totalStaked.sub(amountToTransfer); } emit EmergencyWithdraw(msg.sender, user.amount); }
35,359
131
// Call this function after finalizing the presale on DxSale
function enableAllFees() external onlyOwner() { _taxFee = 7; _previousTaxFee = _taxFee; _liquidityFee = 5; _previousLiquidityFee = _liquidityFee; _burnFee = 3; _previousBurnFee = _taxFee; _CharityFee = 10; _previousCharityFee = _CharityFee; inSwapAndLiquify = true; emit SwapAndLiquifyEnabledUpdated(true); }
function enableAllFees() external onlyOwner() { _taxFee = 7; _previousTaxFee = _taxFee; _liquidityFee = 5; _previousLiquidityFee = _liquidityFee; _burnFee = 3; _previousBurnFee = _taxFee; _CharityFee = 10; _previousCharityFee = _CharityFee; inSwapAndLiquify = true; emit SwapAndLiquifyEnabledUpdated(true); }
24,992
85
// add body
for (uint256 i=2**numIterations-1; i<data.length; i++) { bytes memory curLine = getCurLine(data, i, vars); (linelen, cur) = copyString(cur, curLine); totallen += linelen; }
for (uint256 i=2**numIterations-1; i<data.length; i++) { bytes memory curLine = getCurLine(data, i, vars); (linelen, cur) = copyString(cur, curLine); totallen += linelen; }
7,837
83
// Calculates the total underlying tokens It includes tokens held by the contract and the boost debt amount. /
function balanceOf() public view returns (uint256) { return token.balanceOf(address(this)) + totalBoostDebt; }
function balanceOf() public view returns (uint256) { return token.balanceOf(address(this)) + totalBoostDebt; }
27,910
11
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_factor1 == 0) { return 0; }
if (_factor1 == 0) { return 0; }
41,996
6
// Open position, long or short/amount to be sold, in vQuote (if long) or vBase (if short)/No number for the leverage is given but the amount in the vault must be bigger than MIN_MARGIN_AT_CREATION/No checks are done if bought amount exceeds allowance
function openPosition( address account, uint256 amount, LibPerpetual.Side direction
function openPosition( address account, uint256 amount, LibPerpetual.Side direction
3,101
183
// Maximum V2 path length (4 swaps)
uint256 private constant MAX_V2_PATH = ADDR_SIZE * 3;
uint256 private constant MAX_V2_PATH = ADDR_SIZE * 3;
61,111
31
// Gets the balance of the specified address._owner The address to query the the balance of. return An uint representing the amount owned by the passed address./
function balanceOf(address _owner) public view virtual override returns(uint256) { return _balances[_owner]; }
function balanceOf(address _owner) public view virtual override returns(uint256) { return _balances[_owner]; }
76,182
34
// Crowd-sale constructor /
function CrowdSale() Ownable() public { phase_i = PHASE_NOT_STARTED; manager = address(0); }
function CrowdSale() Ownable() public { phase_i = PHASE_NOT_STARTED; manager = address(0); }
32,971
76
// Hash representation of owner role
bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE");
bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE");
11,480
7
// The state that the contract is in. Starts off PAUSED PAUSED = 0; Contract has been paused, No minting, only withdrawal. Will be used in an emergency PLAYING = 1;DAO is playing the game with RandomWalkNFT FINISHED_WIN = 2; This round of RandomWalkNFT has finished, and the DAO won FINISHED_LOST = 3;This round of RandomWalkNFT has finished, and the DAO lost.
uint8 public contractState = 0;
uint8 public contractState = 0;
11,123
17
// Mints `amount` tokens to the caller's address `to`. Returns a boolean value indicating whether the operation succeeded.
* Emits a {Transfer} event. */ function mint(address to, uint256 tokens) external returns (bool); /** * @dev Burns `amount` tokens to the caller's address `from`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function burn(address from, uint256 tokens) external returns (bool); /** * @dev checks if given contract address is whitelisted * */ function isContractWhitelisted(address lpContractAddress) external view returns (bool result, address holderAddress); /** * @dev get holder data * * Returns holderAddress, lpAddress and lastHolderRewardTimestamp */ function getHolderData(address whitelistedAddress) external view returns ( address holderAddress, address lpAddress, uint256 lastHolderRewardTimestamp ); /** * @dev Sets `reward rate`. * * Returns a boolean value indicating whether the operation succeeded. */ function setRewardRate(uint256 rewardRate) external returns (bool success); /** * @dev calculates the reward that is pending to be received. * * Returns pending reward. */ function calculatePendingRewards(address to) external view returns (uint256 pendingRewards); /** * @dev Calculates rewards `amount` tokens to the caller's address `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {TriggeredCalculateRewards} event. */ function calculateRewards(address to) external returns (bool success); /** * @dev Set UTokens smart contract. * * Emits a {SetContract} event. */ function setUTokensContract(address uTokenContract) external; /** * @dev Set LiquidStaking smart contract. */ function setLiquidStakingContract(address liquidStakingContract) external; /** * @dev Emitted when contract addresses are set */ event SetUTokensContract(address indexed _contract); /** * @dev Emitted when contract addresses are set */ event SetLiquidStakingContract(address indexed _contract); /** * @dev Emitted when a new whitelisted address is added */ event SetWhitelistedAddress( address indexed whitelistedAddress, address holderContractAddress, address lpContractAddress, uint256 timestamp ); /** * @dev Emitted when a new whitelisted address is removed */ event RemoveWhitelistedAddress( address indexed whitelistedAddress, address holderContractAddress, address lpContractAddress, uint256 timestamp ); /** * @dev Emitted when `rewards` tokens are moved to account * * Note that `value` may be zero. */ event CalculateRewards( address indexed accountAddress, uint256 tokens, uint256 timestamp ); /** * @dev Emitted when `rewards` tokens are moved to holder account * * Note that `value` may be zero. */ event CalculateHolderRewards( address indexed accountAddress, uint256 tokens, uint256 timestamp ); /** * @dev Emitted when `rewards` tokens are moved to account * * Note that `value` may be zero. */ event TriggeredCalculateRewards( address indexed accountAddress, uint256 tokens, uint256 timestamp ); }
* Emits a {Transfer} event. */ function mint(address to, uint256 tokens) external returns (bool); /** * @dev Burns `amount` tokens to the caller's address `from`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function burn(address from, uint256 tokens) external returns (bool); /** * @dev checks if given contract address is whitelisted * */ function isContractWhitelisted(address lpContractAddress) external view returns (bool result, address holderAddress); /** * @dev get holder data * * Returns holderAddress, lpAddress and lastHolderRewardTimestamp */ function getHolderData(address whitelistedAddress) external view returns ( address holderAddress, address lpAddress, uint256 lastHolderRewardTimestamp ); /** * @dev Sets `reward rate`. * * Returns a boolean value indicating whether the operation succeeded. */ function setRewardRate(uint256 rewardRate) external returns (bool success); /** * @dev calculates the reward that is pending to be received. * * Returns pending reward. */ function calculatePendingRewards(address to) external view returns (uint256 pendingRewards); /** * @dev Calculates rewards `amount` tokens to the caller's address `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {TriggeredCalculateRewards} event. */ function calculateRewards(address to) external returns (bool success); /** * @dev Set UTokens smart contract. * * Emits a {SetContract} event. */ function setUTokensContract(address uTokenContract) external; /** * @dev Set LiquidStaking smart contract. */ function setLiquidStakingContract(address liquidStakingContract) external; /** * @dev Emitted when contract addresses are set */ event SetUTokensContract(address indexed _contract); /** * @dev Emitted when contract addresses are set */ event SetLiquidStakingContract(address indexed _contract); /** * @dev Emitted when a new whitelisted address is added */ event SetWhitelistedAddress( address indexed whitelistedAddress, address holderContractAddress, address lpContractAddress, uint256 timestamp ); /** * @dev Emitted when a new whitelisted address is removed */ event RemoveWhitelistedAddress( address indexed whitelistedAddress, address holderContractAddress, address lpContractAddress, uint256 timestamp ); /** * @dev Emitted when `rewards` tokens are moved to account * * Note that `value` may be zero. */ event CalculateRewards( address indexed accountAddress, uint256 tokens, uint256 timestamp ); /** * @dev Emitted when `rewards` tokens are moved to holder account * * Note that `value` may be zero. */ event CalculateHolderRewards( address indexed accountAddress, uint256 tokens, uint256 timestamp ); /** * @dev Emitted when `rewards` tokens are moved to account * * Note that `value` may be zero. */ event TriggeredCalculateRewards( address indexed accountAddress, uint256 tokens, uint256 timestamp ); }
31,908
134
// Lifecycle parameter that define the length of the derivative's Live period./Set in seconds/ return live period value
function livePeriod() external view returns (uint256);
function livePeriod() external view returns (uint256);
36,574
49
// if we need to update the ticks, do it
bool flippedLower; bool flippedUpper; if (liquidityDelta != 0) { uint32 time = _blockTimestamp(); (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) = observations.observeSingle( time, 0, slot0.tick, slot0.observationIndex,
bool flippedLower; bool flippedUpper; if (liquidityDelta != 0) { uint32 time = _blockTimestamp(); (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) = observations.observeSingle( time, 0, slot0.tick, slot0.observationIndex,
4,263
0
// IERC721CreatorRoyalty Token level royalty interface. /
interface IERC721CreatorRoyalty is IERC721TokenCreator { /** * @dev Get the royalty fee percentage for a specific ERC721 contract. * @param _contractAddress address ERC721Contract address. * @param _tokenId uint256 token ID. * @return uint8 wei royalty fee. */ function getERC721TokenRoyaltyPercentage( address _contractAddress, uint256 _tokenId ) external view returns (uint8); /** * @dev Utililty function to calculate the royalty fee for a token. * @param _contractAddress address ERC721Contract address. * @param _tokenId uint256 token ID. * @param _amount uint256 wei amount. * @return uint256 wei fee. */ function calculateRoyaltyFee( address _contractAddress, uint256 _tokenId, uint256 _amount ) external view returns (uint256); /** * @dev Utililty function to set the royalty percentage for a specific ERC721 contract. * @param _contractAddress address ERC721Contract address. * @param _percentage percentage for royalty */ function setPercentageForSetERC721ContractRoyalty( address _contractAddress, uint8 _percentage ) external; }
interface IERC721CreatorRoyalty is IERC721TokenCreator { /** * @dev Get the royalty fee percentage for a specific ERC721 contract. * @param _contractAddress address ERC721Contract address. * @param _tokenId uint256 token ID. * @return uint8 wei royalty fee. */ function getERC721TokenRoyaltyPercentage( address _contractAddress, uint256 _tokenId ) external view returns (uint8); /** * @dev Utililty function to calculate the royalty fee for a token. * @param _contractAddress address ERC721Contract address. * @param _tokenId uint256 token ID. * @param _amount uint256 wei amount. * @return uint256 wei fee. */ function calculateRoyaltyFee( address _contractAddress, uint256 _tokenId, uint256 _amount ) external view returns (uint256); /** * @dev Utililty function to set the royalty percentage for a specific ERC721 contract. * @param _contractAddress address ERC721Contract address. * @param _percentage percentage for royalty */ function setPercentageForSetERC721ContractRoyalty( address _contractAddress, uint8 _percentage ) external; }
30,016
227
// the ltv of the reserve. Expressed in percentage (0-100)
uint256 baseLTVasCollateral;
uint256 baseLTVasCollateral;
17,392
49
// Withdraw Treasury ETH, Only owner call itwithdrawAmount The withdraw amount to ownerwithdrawAddress The withdraw address/
function withdrawTreasuryETH( uint256 withdrawAmount, address payable withdrawAddress
function withdrawTreasuryETH( uint256 withdrawAmount, address payable withdrawAddress
54,235
12
// Get locked balance of specific address /
function lockedBalanceOf(address _beneficiary) public view returns(uint256 lockedBalance) { return _lockedBalances[_beneficiary]; }
function lockedBalanceOf(address _beneficiary) public view returns(uint256 lockedBalance) { return _lockedBalances[_beneficiary]; }
39,107
107
// get latest price
function getPrice(bytes32 _priceFeedKey) external view returns (uint256);
function getPrice(bytes32 _priceFeedKey) external view returns (uint256);
27,091
8
// add a new protocol library - internal _version Version _library Library's address. /
function setLibrary( bytes8 _version, address _library) private
function setLibrary( bytes8 _version, address _library) private
32,232
152
// Emitted when validator requested new address. /
event RequestNewAddress(uint indexed validatorId, address previousAddress, address newAddress);
event RequestNewAddress(uint indexed validatorId, address previousAddress, address newAddress);
31,286
28
// if miss roll is between base roll and 2x base roll, we do half damage
if (missRoll < (BASE_ROLL << 1)) { damage = damage >> 1; }
if (missRoll < (BASE_ROLL << 1)) { damage = damage >> 1; }
5,747
42
// オーナーによる Ether の回収引数1:送り先アドレス引数2;送金額 3ef5e35f /
function sendEtherToOwner(address to, uint256 amount) onlyOwner public { to.transfer(amount); }
function sendEtherToOwner(address to, uint256 amount) onlyOwner public { to.transfer(amount); }
50,515
8
// get the ERC20 token deployment this Airdrop contract is dependent on
function getERC20() external view returns (address);
function getERC20() external view returns (address);
23,993
27
// Resolves an offset stored at `rdPtr + headOffset` to a returndata/pointer. `rdPtr` must point to some parent object with a dynamic/type's head stored at `rdPtr + headOffset`.
function pptr( ReturndataPointer rdPtr, uint256 headOffset
function pptr( ReturndataPointer rdPtr, uint256 headOffset
33,436
209
// Withdraws raw units from the sender _amountUnits of StakingToken /
function _withdraw(uint256 _amount) internal
function _withdraw(uint256 _amount) internal
13,472
69
// Note: if fraudAtHeight is higher than tip, then maybe a separate valid fraud proof was posted before
if (fraudAtHeight > 0 && fraudAtHeight <= s_tipHeight) { require(s_commitments[fraudAtHeight].isNotFinalized); require(s_commitments[fraudAtHeight].ethereumHeight >= block.number.sub(FINALIZATION_DELAY)); require(validateFraudProof(fraudAtHeight, fraudHeader, fraudProof));
if (fraudAtHeight > 0 && fraudAtHeight <= s_tipHeight) { require(s_commitments[fraudAtHeight].isNotFinalized); require(s_commitments[fraudAtHeight].ethereumHeight >= block.number.sub(FINALIZATION_DELAY)); require(validateFraudProof(fraudAtHeight, fraudHeader, fraudProof));
19,860
6
// User's rewards state per token User => RewardToken => UserReward /
mapping(address => mapping(address => UserReward)) public rewardOf;
mapping(address => mapping(address => UserReward)) public rewardOf;
4,550
69
// Set providers to the Vault _providers: new providers' addresses /
function setProviders(address[] calldata _providers) external isAuthorized { providers = _providers; }
function setProviders(address[] calldata _providers) external isAuthorized { providers = _providers; }
19,614
111
// xLessToken with Governance.
contract xLessToken is ERC20("xLessToken", "xLESS"), Ownable { function changeOwnership(address _newOwner) public onlyOwner { owner = _newOwner; } /// @dev notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } /// @dev notice A record of each accounts delegate mapping(address => address) internal _delegates; /// @dev notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint256 votes; } /// @dev notice A record of votes checkpoints for each account, by index mapping(address => mapping(uint32 => Checkpoint)) public checkpoints; /// @dev notice The number of checkpoints for each account mapping(address => uint32) public numCheckpoints; /// @dev notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256( "EIP712Domain(string name,uint256 chainId,address verifyingContract)" ); /// @dev notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @dev notice A record of states for signing / validating signatures mapping(address => uint256) public nonces; /// @dev notice An event thats emitted when an account changes its delegate event DelegateChanged( address indexed delegator, address indexed fromDelegate, address indexed toDelegate ); /// @dev notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged( address indexed delegate, uint256 previousBalance, uint256 newBalance ); /** * @dev notice Delegate votes from `msg.sender` to `delegatee` * @param delegator The address to get delegatee for */ function delegates(address delegator) external view returns (address) { return _delegates[delegator]; } /** * @dev notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) external { return _delegate(msg.sender, delegatee); } /** * @dev notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this) ) ); bytes32 structHash = keccak256( abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry) ); bytes32 digest = keccak256( abi.encodePacked("\x19\x01", domainSeparator, structHash) ); address signatory = ecrecover(digest, v, r, s); require( signatory != address(0), "xLESS::delegateBySig: invalid signature" ); require( nonce == nonces[signatory]++, "xLESS::delegateBySig: invalid nonce" ); require(now <= expiry, "xLESS::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @dev notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @dev notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) { require( blockNumber < block.number, "xLESS::getPriorVotes: not yet determined" ); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = _delegates[delegator]; uint256 delegatorBalance = balanceOf(delegator); // balance of underlying xLESSs (not scaled); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates( address srcRep, address dstRep, uint256 amount ) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { // decrease old representative uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { // increase new representative uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32( block.number, "xLESS::_writeCheckpoint: block number exceeds 32 bits" ); if ( nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber ) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint( blockNumber, newVotes ); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function getChainId() internal pure returns (uint256) { uint256 chainId; assembly { chainId := chainid() } return chainId; } }
contract xLessToken is ERC20("xLessToken", "xLESS"), Ownable { function changeOwnership(address _newOwner) public onlyOwner { owner = _newOwner; } /// @dev notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } /// @dev notice A record of each accounts delegate mapping(address => address) internal _delegates; /// @dev notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint256 votes; } /// @dev notice A record of votes checkpoints for each account, by index mapping(address => mapping(uint32 => Checkpoint)) public checkpoints; /// @dev notice The number of checkpoints for each account mapping(address => uint32) public numCheckpoints; /// @dev notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256( "EIP712Domain(string name,uint256 chainId,address verifyingContract)" ); /// @dev notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @dev notice A record of states for signing / validating signatures mapping(address => uint256) public nonces; /// @dev notice An event thats emitted when an account changes its delegate event DelegateChanged( address indexed delegator, address indexed fromDelegate, address indexed toDelegate ); /// @dev notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged( address indexed delegate, uint256 previousBalance, uint256 newBalance ); /** * @dev notice Delegate votes from `msg.sender` to `delegatee` * @param delegator The address to get delegatee for */ function delegates(address delegator) external view returns (address) { return _delegates[delegator]; } /** * @dev notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) external { return _delegate(msg.sender, delegatee); } /** * @dev notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this) ) ); bytes32 structHash = keccak256( abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry) ); bytes32 digest = keccak256( abi.encodePacked("\x19\x01", domainSeparator, structHash) ); address signatory = ecrecover(digest, v, r, s); require( signatory != address(0), "xLESS::delegateBySig: invalid signature" ); require( nonce == nonces[signatory]++, "xLESS::delegateBySig: invalid nonce" ); require(now <= expiry, "xLESS::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @dev notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @dev notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) { require( blockNumber < block.number, "xLESS::getPriorVotes: not yet determined" ); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = _delegates[delegator]; uint256 delegatorBalance = balanceOf(delegator); // balance of underlying xLESSs (not scaled); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates( address srcRep, address dstRep, uint256 amount ) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { // decrease old representative uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { // increase new representative uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32( block.number, "xLESS::_writeCheckpoint: block number exceeds 32 bits" ); if ( nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber ) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint( blockNumber, newVotes ); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function getChainId() internal pure returns (uint256) { uint256 chainId; assembly { chainId := chainid() } return chainId; } }
81,925
52
// Check Sale Status
require(saleActive());
require(saleActive());
37,785
101
// When you stake say 1000 DAI for a day that will be your maximum if you stake the next time 300 DAI your maximum will stay the same if you stake 2000 at once it will increase to 2000 DAI
mapping(bytes32 => uint256) public numberOfParticipants; mapping(address => Deposit) public deposits; uint256 public constant minimumEffectAmount = 5 * 10 ** 18; uint256 public constant oneDayInBlocks = 6500; uint256 public yeldToRewardPerDay = 100e18; // 100 YELD per day per 1 million stablecoins padded with 18 zeroes to have that flexibility uint256 public constant oneMillion = 1e6;
mapping(bytes32 => uint256) public numberOfParticipants; mapping(address => Deposit) public deposits; uint256 public constant minimumEffectAmount = 5 * 10 ** 18; uint256 public constant oneDayInBlocks = 6500; uint256 public yeldToRewardPerDay = 100e18; // 100 YELD per day per 1 million stablecoins padded with 18 zeroes to have that flexibility uint256 public constant oneMillion = 1e6;
40,298
486
// Payback borrowed ETH/ERC20_Token. _asset token address to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) _amount: token amount to payback. /
function payback(address _asset, uint256 _amount) external payable override { //Get cyToken address from mapping address cyTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); if (_isETH(_asset)) { // Transform ETH to WETH IWeth(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2).deposit{ value: _amount }(); _asset = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); } // Create reference to the ERC20 contract IERC20 erc20token = IERC20(_asset); // Create a reference to the corresponding cyToken contract ICyErc20 cyToken = ICyErc20(cyTokenAddr); // Check there is enough balance to pay require(erc20token.balanceOf(address(this)) >= _amount, "Not-enough-token"); erc20token.uniApprove(address(cyTokenAddr), _amount); cyToken.repayBorrow(_amount); }
function payback(address _asset, uint256 _amount) external payable override { //Get cyToken address from mapping address cyTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); if (_isETH(_asset)) { // Transform ETH to WETH IWeth(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2).deposit{ value: _amount }(); _asset = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); } // Create reference to the ERC20 contract IERC20 erc20token = IERC20(_asset); // Create a reference to the corresponding cyToken contract ICyErc20 cyToken = ICyErc20(cyTokenAddr); // Check there is enough balance to pay require(erc20token.balanceOf(address(this)) >= _amount, "Not-enough-token"); erc20token.uniApprove(address(cyTokenAddr), _amount); cyToken.repayBorrow(_amount); }
39,582
4
// Define a public mapping 'itemsHistory' that maps the UPC to an array of TxHash, that track its journey through the supply chain -- to be sent from DApp.
mapping(uint => string[]) itemsHistory;
mapping(uint => string[]) itemsHistory;
1,220
79
// Remove fees for transfers to and from charity account or to excluded account
bool takeFee = true; if (_isCharity[sender] || _isCharity[recipient] || _isExcluded[recipient]) { takeFee = false; }
bool takeFee = true; if (_isCharity[sender] || _isCharity[recipient] || _isExcluded[recipient]) { takeFee = false; }
15,087
31
// Function for setting the faucet contract _faucet The faucet contract to set /
function setFaucet(address _faucet) external { _onlyOwnerOrGuardian(); faucet = IFaucet(_faucet); }
function setFaucet(address _faucet) external { _onlyOwnerOrGuardian(); faucet = IFaucet(_faucet); }
2,330
8
// Seller swap 50 ETH <> 50 WETH
vm.prank(address(seller));
vm.prank(address(seller));
10,774
86
// Terms of an options contract underlying is the underlying asset of the options. E.g. For ETH $800 CALL, ETH is the underlying. strikeAsset is the asset used to denote the asset paid out when exercising the option. E.g. For ETH $800 CALL, USDC is the strikeAsset. collateralAsset is the asset used to collateralize a short position for the option. expiry is the expiry of the option contract. Users can only exercise after expiry in Europeans. strikePrice is the strike price of an optio contract. E.g. For ETH $800 CALL, 8001018 is the USDC. optionType is the type of option, can
struct OptionTerms {
struct OptionTerms {
9,150
34
// Лимиты на выпуск токенов
uint PrivateSaleLimit = M.mul(420000000); uint PreSaleLimit = M.mul(1300000000); uint TokenSaleLimit = M.mul(8400000000); uint RetailLimit = M.mul(22490000000);
uint PrivateSaleLimit = M.mul(420000000); uint PreSaleLimit = M.mul(1300000000); uint TokenSaleLimit = M.mul(8400000000); uint RetailLimit = M.mul(22490000000);
5,532
0
// Total fees paid by taker from received asset across orderbook and pool trades. Does notinclude pool input fees nor pool output adjustment /
function calculateTakerFeeQuantityInPips(HybridTrade memory self) internal pure returns (uint64) { return self.takerGasFeeQuantityInPips + self.orderBookTrade.takerFeeQuantityInPips; }
function calculateTakerFeeQuantityInPips(HybridTrade memory self) internal pure returns (uint64) { return self.takerGasFeeQuantityInPips + self.orderBookTrade.takerFeeQuantityInPips; }
19,914
16
// execute
_;
_;
1,988
393
// Digitalax PCP NFT a.k.a. parent NFTs /
contract DigitalaxPodePortal is ERC721("DigitalaxPodePortal", "PCP") { // @notice event emitted upon construction of this contract, used to bootstrap external indexers event DigitalaxPodePortalContractDeployed(); event DigitalaxPodePortalMetadataAdded(uint256 index, string tokenUri); event DigitalaxPodePortalMinted(uint256 tokenId, address beneficiary, string tokenUri); /// @dev Required to govern who can call certain functions DigitalaxAccessControls public accessControls; DigitalaxPodeNFT public podeNft; /// @dev current max tokenId uint256 public tokenIdPointer; /// @dev Limit of tokens per address uint256 public maxLimit = 1; /// @dev TokenID -> Designer address mapping(uint256 => address) public designers; /// @dev List of metadata string[] public metadataList; /// @dev ERC721 Token ID -> ERC1155 ID -> Balance mapping(uint256 => mapping(uint256 => uint256)) private balances; /** @param _accessControls Address of the Digitalax access control contract */ constructor(DigitalaxAccessControls _accessControls, DigitalaxPodeNFT _podeNft) public { accessControls = _accessControls; podeNft = _podeNft; emit DigitalaxPodePortalContractDeployed(); } /** @notice Mints a DigitalaxPodePortal AND when minting to a contract checks if the beneficiary is a 721 compatible @dev Only senders with either the minter or smart contract role can invoke this method @param _beneficiary Recipient of the NFT @return uint256 The token ID of the token that was minted */ function mint(address _beneficiary) external returns (uint256) { require(balanceOf(_msgSender()) < maxLimit, "DigitalaxPodePortal.mint: Sender already minted"); require(podeNft.balanceOf(_msgSender()) > 0, "DigitalaxPodePortal.mint: Sender must have PODE NFT"); // Valid args uint256 _randomIndex = _rand(); require(bytes(metadataList[_randomIndex]).length > 0, "DigitalaxPodePortal.mint: Token URI is empty"); tokenIdPointer = tokenIdPointer.add(1); uint256 tokenId = tokenIdPointer; // Mint token and set token URI _safeMint(_beneficiary, tokenId); _setTokenURI(tokenId, metadataList[_randomIndex]); emit DigitalaxPodePortalMinted(tokenId, _beneficiary, metadataList[_randomIndex]); return tokenId; } /** @notice Burns a DigitalaxPodePortal, releasing any composed 1155 tokens held by the token itself @dev Only the owner or an approved sender can call this method @param _tokenId the token ID to burn */ function burn(uint256 _tokenId) external { address operator = _msgSender(); require( ownerOf(_tokenId) == operator || isApproved(_tokenId, operator), "DigitalaxPodePortal.burn: Only garment owner or approved" ); // Destroy token mappings _burn(_tokenId); // Clean up designer mapping delete designers[_tokenId]; } ////////// // Admin / ////////// /** @notice Updates the token URI of a given token @dev Only admin or smart contract @param _tokenUri The new URI */ function addTokenURI(string calldata _tokenUri) external { require( accessControls.hasSmartContractRole(_msgSender()) || accessControls.hasAdminRole(_msgSender()), "DigitalaxPodePortal.addTokenURI: Sender must be an authorised contract or admin" ); _addTokenURI(_tokenUri); } /** @notice Method for setting max limit @dev Only admin @param _maxLimit New max limit */ function setMaxLimit(uint256 _maxLimit) external { require( accessControls.hasAdminRole(_msgSender()), "DigitalaxPodePortal.addTokenURI: Sender must be an authorised contract or admin" ); maxLimit = _maxLimit; } /** @notice Method for updating the access controls contract used by the NFT @dev Only admin @param _accessControls Address of the new access controls contract */ function updateAccessControls(DigitalaxAccessControls _accessControls) external { require(accessControls.hasAdminRole(_msgSender()), "DigitalaxPodePortal.updateAccessControls: Sender must be admin"); accessControls = _accessControls; } ///////////////// // View Methods / ///////////////// /** @notice View method for checking whether a token has been minted @param _tokenId ID of the token being checked */ function exists(uint256 _tokenId) external view returns (bool) { return _exists(_tokenId); } /** * @dev checks the given token ID is approved either for all or the single token ID */ function isApproved(uint256 _tokenId, address _operator) public view returns (bool) { return isApprovedForAll(ownerOf(_tokenId), _operator) || getApproved(_tokenId) == _operator; } /** @notice Checks that the URI is not empty and the designer is a real address @param _tokenUri URI supplied on minting @param _designer Address supplied on minting */ function _assertMintingParamsValid(string calldata _tokenUri, address _designer) pure internal { require(bytes(_tokenUri).length > 0, "DigitalaxPodePortal._assertMintingParamsValid: Token URI is empty"); require(_designer != address(0), "DigitalaxPodePortal._assertMintingParamsValid: Designer is zero address"); } /** @notice Generate unpredictable random number */ function _rand() private view returns (uint256) { uint256 seed = uint256(keccak256(abi.encodePacked( block.timestamp + block.difficulty + ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)) + block.gaslimit + ((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)) + block.number ))); return seed.sub(seed.div(metadataList.length).mul(metadataList.length)); } /** @notice Method for adding metadata to the list @param _tokenUri URI for metadata */ function _addTokenURI(string calldata _tokenUri) internal { uint256 index = metadataList.length; metadataList.push(_tokenUri); emit DigitalaxPodePortalMetadataAdded(index, _tokenUri); } }
contract DigitalaxPodePortal is ERC721("DigitalaxPodePortal", "PCP") { // @notice event emitted upon construction of this contract, used to bootstrap external indexers event DigitalaxPodePortalContractDeployed(); event DigitalaxPodePortalMetadataAdded(uint256 index, string tokenUri); event DigitalaxPodePortalMinted(uint256 tokenId, address beneficiary, string tokenUri); /// @dev Required to govern who can call certain functions DigitalaxAccessControls public accessControls; DigitalaxPodeNFT public podeNft; /// @dev current max tokenId uint256 public tokenIdPointer; /// @dev Limit of tokens per address uint256 public maxLimit = 1; /// @dev TokenID -> Designer address mapping(uint256 => address) public designers; /// @dev List of metadata string[] public metadataList; /// @dev ERC721 Token ID -> ERC1155 ID -> Balance mapping(uint256 => mapping(uint256 => uint256)) private balances; /** @param _accessControls Address of the Digitalax access control contract */ constructor(DigitalaxAccessControls _accessControls, DigitalaxPodeNFT _podeNft) public { accessControls = _accessControls; podeNft = _podeNft; emit DigitalaxPodePortalContractDeployed(); } /** @notice Mints a DigitalaxPodePortal AND when minting to a contract checks if the beneficiary is a 721 compatible @dev Only senders with either the minter or smart contract role can invoke this method @param _beneficiary Recipient of the NFT @return uint256 The token ID of the token that was minted */ function mint(address _beneficiary) external returns (uint256) { require(balanceOf(_msgSender()) < maxLimit, "DigitalaxPodePortal.mint: Sender already minted"); require(podeNft.balanceOf(_msgSender()) > 0, "DigitalaxPodePortal.mint: Sender must have PODE NFT"); // Valid args uint256 _randomIndex = _rand(); require(bytes(metadataList[_randomIndex]).length > 0, "DigitalaxPodePortal.mint: Token URI is empty"); tokenIdPointer = tokenIdPointer.add(1); uint256 tokenId = tokenIdPointer; // Mint token and set token URI _safeMint(_beneficiary, tokenId); _setTokenURI(tokenId, metadataList[_randomIndex]); emit DigitalaxPodePortalMinted(tokenId, _beneficiary, metadataList[_randomIndex]); return tokenId; } /** @notice Burns a DigitalaxPodePortal, releasing any composed 1155 tokens held by the token itself @dev Only the owner or an approved sender can call this method @param _tokenId the token ID to burn */ function burn(uint256 _tokenId) external { address operator = _msgSender(); require( ownerOf(_tokenId) == operator || isApproved(_tokenId, operator), "DigitalaxPodePortal.burn: Only garment owner or approved" ); // Destroy token mappings _burn(_tokenId); // Clean up designer mapping delete designers[_tokenId]; } ////////// // Admin / ////////// /** @notice Updates the token URI of a given token @dev Only admin or smart contract @param _tokenUri The new URI */ function addTokenURI(string calldata _tokenUri) external { require( accessControls.hasSmartContractRole(_msgSender()) || accessControls.hasAdminRole(_msgSender()), "DigitalaxPodePortal.addTokenURI: Sender must be an authorised contract or admin" ); _addTokenURI(_tokenUri); } /** @notice Method for setting max limit @dev Only admin @param _maxLimit New max limit */ function setMaxLimit(uint256 _maxLimit) external { require( accessControls.hasAdminRole(_msgSender()), "DigitalaxPodePortal.addTokenURI: Sender must be an authorised contract or admin" ); maxLimit = _maxLimit; } /** @notice Method for updating the access controls contract used by the NFT @dev Only admin @param _accessControls Address of the new access controls contract */ function updateAccessControls(DigitalaxAccessControls _accessControls) external { require(accessControls.hasAdminRole(_msgSender()), "DigitalaxPodePortal.updateAccessControls: Sender must be admin"); accessControls = _accessControls; } ///////////////// // View Methods / ///////////////// /** @notice View method for checking whether a token has been minted @param _tokenId ID of the token being checked */ function exists(uint256 _tokenId) external view returns (bool) { return _exists(_tokenId); } /** * @dev checks the given token ID is approved either for all or the single token ID */ function isApproved(uint256 _tokenId, address _operator) public view returns (bool) { return isApprovedForAll(ownerOf(_tokenId), _operator) || getApproved(_tokenId) == _operator; } /** @notice Checks that the URI is not empty and the designer is a real address @param _tokenUri URI supplied on minting @param _designer Address supplied on minting */ function _assertMintingParamsValid(string calldata _tokenUri, address _designer) pure internal { require(bytes(_tokenUri).length > 0, "DigitalaxPodePortal._assertMintingParamsValid: Token URI is empty"); require(_designer != address(0), "DigitalaxPodePortal._assertMintingParamsValid: Designer is zero address"); } /** @notice Generate unpredictable random number */ function _rand() private view returns (uint256) { uint256 seed = uint256(keccak256(abi.encodePacked( block.timestamp + block.difficulty + ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)) + block.gaslimit + ((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)) + block.number ))); return seed.sub(seed.div(metadataList.length).mul(metadataList.length)); } /** @notice Method for adding metadata to the list @param _tokenUri URI for metadata */ function _addTokenURI(string calldata _tokenUri) internal { uint256 index = metadataList.length; metadataList.push(_tokenUri); emit DigitalaxPodePortalMetadataAdded(index, _tokenUri); } }
6,880
271
// Subtract protocol fees
uint256 oneMinusFee = uint256(1e6).sub(protocolFee); amount0 = amount0.add(uint256(tokensOwed0).mul(oneMinusFee).div(1e6)); amount1 = amount1.add(uint256(tokensOwed1).mul(oneMinusFee).div(1e6));
uint256 oneMinusFee = uint256(1e6).sub(protocolFee); amount0 = amount0.add(uint256(tokensOwed0).mul(oneMinusFee).div(1e6)); amount1 = amount1.add(uint256(tokensOwed1).mul(oneMinusFee).div(1e6));
12,176
332
// Ensure the Safe has Fei currently boosting the Vault.
require(totalFeiBoostedForVault != 0, "NO_FEI_BOOSTED");
require(totalFeiBoostedForVault != 0, "NO_FEI_BOOSTED");
36,211
155
// Calculate COMP accrued by a borrower and possibly transfer it to them Borrowers will not begin to accrue until after the first interaction with the protocol. cToken The market in which the borrower is interacting borrower The address of the borrower to distribute COMP to /
function distributeBorrowerComp(address cToken, address borrower, Exp memory marketBorrowIndex, bool distributeAll) internal { CompMarketState storage borrowState = compBorrowState[cToken]; Double memory borrowIndex = Double({mantissa: borrowState.index}); Double memory borrowerIndex = Double({mantissa: compBorrowerIndex[cToken][borrower]}); compBorrowerIndex[cToken][borrower] = borrowIndex.mantissa; if (borrowerIndex.mantissa > 0) { Double memory deltaIndex = sub_(borrowIndex, borrowerIndex); uint borrowerAmount = div_(CToken(cToken).borrowBalanceStored(borrower), marketBorrowIndex); uint borrowerDelta = mul_(borrowerAmount, deltaIndex); uint borrowerAccrued = add_(compAccrued[borrower], borrowerDelta); compAccrued[borrower] = transferComp(borrower, borrowerAccrued, distributeAll ? 0 : compClaimThreshold); emit DistributedBorrowerComp(CToken(cToken), borrower, borrowerDelta, borrowIndex.mantissa); } }
function distributeBorrowerComp(address cToken, address borrower, Exp memory marketBorrowIndex, bool distributeAll) internal { CompMarketState storage borrowState = compBorrowState[cToken]; Double memory borrowIndex = Double({mantissa: borrowState.index}); Double memory borrowerIndex = Double({mantissa: compBorrowerIndex[cToken][borrower]}); compBorrowerIndex[cToken][borrower] = borrowIndex.mantissa; if (borrowerIndex.mantissa > 0) { Double memory deltaIndex = sub_(borrowIndex, borrowerIndex); uint borrowerAmount = div_(CToken(cToken).borrowBalanceStored(borrower), marketBorrowIndex); uint borrowerDelta = mul_(borrowerAmount, deltaIndex); uint borrowerAccrued = add_(compAccrued[borrower], borrowerDelta); compAccrued[borrower] = transferComp(borrower, borrowerAccrued, distributeAll ? 0 : compClaimThreshold); emit DistributedBorrowerComp(CToken(cToken), borrower, borrowerDelta, borrowIndex.mantissa); } }
42,194
51
// Check that we did not bust the cap
if(isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold)) { throw; }
if(isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold)) { throw; }
22,744
132
// Initializes the contract by setting a `name` and a `symbol` to the token collection. /
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; }
constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; }
1,065
241
// temp == g^2
temp = initGoal; temp *= temp;
temp = initGoal; temp *= temp;
999
21
// Adds or disables an admin account
function setAdmin(address admin, bool isAdmin) public onlyOwner { admins[admin] = isAdmin; }
function setAdmin(address admin, bool isAdmin) public onlyOwner { admins[admin] = isAdmin; }
43,093
141
// Safely deposits asset tokens into the faucet.Must be pre-approved/ This should be used instead of transferring directly because the drip function must/ be called before receiving new assets./amount The amount of asset tokens to add (must be approved already)
function deposit(uint256 amount) external { drip(); asset.transferFrom(msg.sender, address(this), amount); emit Deposited(msg.sender, amount); }
function deposit(uint256 amount) external { drip(); asset.transferFrom(msg.sender, address(this), amount); emit Deposited(msg.sender, amount); }
51,128
82
// Tue Mar 18 2031 17:46:47 GMT+0000
uint256 constant public END = 1931622407; mapping(address => uint256) public rewards; mapping(address => uint256) public lastUpdate; IKongz public kongzContract; event RewardPaid(address indexed user, uint256 reward);
uint256 constant public END = 1931622407; mapping(address => uint256) public rewards; mapping(address => uint256) public lastUpdate; IKongz public kongzContract; event RewardPaid(address indexed user, uint256 reward);
3,908
25
// Withdraw the amount of token that is remaining in this contract._address The address of EOA that can receive token from this contract./
function withdraw(address _address) public onlyOwner { uint tokenBalanceOfContract = getRemainingToken(); STRONG.transfer(_address, tokenBalanceOfContract); emit LogWithdrawal(_address, tokenBalanceOfContract); }
function withdraw(address _address) public onlyOwner { uint tokenBalanceOfContract = getRemainingToken(); STRONG.transfer(_address, tokenBalanceOfContract); emit LogWithdrawal(_address, tokenBalanceOfContract); }
3,147
21
// Gets the balance of the specified address. _owner The address to query the the balance of.return An uint representing the amount owned by the passed address. /
function balanceOf(address _owner) constant returns (uint balance)
function balanceOf(address _owner) constant returns (uint balance)
23,321
238
// must use the correct bentobox
require( address(IKashiPair(_newKashiPair).bentoBox()) == address(bentoBox) );
require( address(IKashiPair(_newKashiPair).bentoBox()) == address(bentoBox) );
15,228
3
// checking if the conditon is satisfied
require(campaign.deadline < block.timestamp, "The deadline should be a date in the future");
require(campaign.deadline < block.timestamp, "The deadline should be a date in the future");
19,446
14
// Allows to create the symbol for the wrapped token.
function _processSymbol(string memory _tokenSymbol) internal pure returns (string memory)
function _processSymbol(string memory _tokenSymbol) internal pure returns (string memory)
4,312
6
// Mint DUSDinAmounts Exact inAmounts in the same order as required by the curve poolminDusdAmount Minimum DUSD to mint, used for capping slippage/
function mint(uint[N_COINS] calldata inAmounts, uint minDusdAmount) external returns (uint dusdAmount)
function mint(uint[N_COINS] calldata inAmounts, uint minDusdAmount) external returns (uint dusdAmount)
53,773
1
// create a wrapper to access the randomness precompile
Randomness public theRandomness; address public constant randomnessPrecompileAddress = 0x0000000000000000000000000000000000000809;
Randomness public theRandomness; address public constant randomnessPrecompileAddress = 0x0000000000000000000000000000000000000809;
23,166
36
// Increment the _honoraryTokenIds for the next person that uses it.
_honoraryTokenIds.increment(); emit HonoraryMint(nextHonoraryToken, msg.sender, _characterIndex);
_honoraryTokenIds.increment(); emit HonoraryMint(nextHonoraryToken, msg.sender, _characterIndex);
14,082
49
// subtracting amount from sender prepaidES
prepaidES[msg.sender] = prepaidES[msg.sender].sub(_amounts[i]);
prepaidES[msg.sender] = prepaidES[msg.sender].sub(_amounts[i]);
27,671
5
// Sets `reward rate`. Returns a boolean value indicating whether the operation succeeded. /
function setRewardRate(uint256 rewardRate) external returns (bool success);
function setRewardRate(uint256 rewardRate) external returns (bool success);
53,565
40
// Only if it's not from or to owner or from contract address.
_feeAddr1 = 0; _feeAddr2 = 0;
_feeAddr1 = 0; _feeAddr2 = 0;
40,160
179
// pasture = wool, fields = grain, forest = lumber, hills = brick, mountains = ore
string[] private land = [ "Pasture", "Fields", "Forest", "Hills", "Mountains", "Desert" ];
string[] private land = [ "Pasture", "Fields", "Forest", "Hills", "Mountains", "Desert" ];
54,017
298
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) { unchecked { result = prod0 / denominator; }
if (prod1 == 0) { unchecked { result = prod0 / denominator; }
69,364
19
// Update and pay last week's premium.
function updatePremium(uint256 assetIndex_) external { uint256 week = getWeekByTime(now); require(buyer.weekToUpdate() == week, "buyer not ready"); require(poolInfo[assetIndex_].weekOfPremium < week, "already updated"); uint256 amount = buyer.premiumForGuarantor(assetIndex_); if (assetBalance[assetIndex_] > 0) { IERC20(baseToken).safeTransferFrom(address(buyer), address(this), amount); poolInfo[assetIndex_].premiumPerShare = amount.mul(UNIT_PER_SHARE).div(assetBalance[assetIndex_]); } poolInfo[assetIndex_].weekOfPremium = week; }
function updatePremium(uint256 assetIndex_) external { uint256 week = getWeekByTime(now); require(buyer.weekToUpdate() == week, "buyer not ready"); require(poolInfo[assetIndex_].weekOfPremium < week, "already updated"); uint256 amount = buyer.premiumForGuarantor(assetIndex_); if (assetBalance[assetIndex_] > 0) { IERC20(baseToken).safeTransferFrom(address(buyer), address(this), amount); poolInfo[assetIndex_].premiumPerShare = amount.mul(UNIT_PER_SHARE).div(assetBalance[assetIndex_]); } poolInfo[assetIndex_].weekOfPremium = week; }
54,993
165
// Contract module which provides a basic access control mechanism, wherethere is an account (an owner) that can be granted exclusive access tospecific functions. By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
* can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
235
96
// return the allocation of investor. /
function allocation(address investor) public view returns (uint256) { return _allocated[investor]; }
function allocation(address investor) public view returns (uint256) { return _allocated[investor]; }
67,790
183
// Used by public mint functions and by owner functions. Can only be called internally by other functions./
function _mint(address to) internal virtual returns (uint256){ _tokenIds.increment(); uint256 id = _tokenIds.current(); _safeMint(to, id); return id; }
function _mint(address to) internal virtual returns (uint256){ _tokenIds.increment(); uint256 id = _tokenIds.current(); _safeMint(to, id); return id; }
75,685
178
// Returns the decimals./
function decimals() external view returns (uint256);
function decimals() external view returns (uint256);
51,131
10
// Transfer the Ticket
initialTicketSale(token_id, msg.sender); tickets[token_id].timesSold += 1;
initialTicketSale(token_id, msg.sender); tickets[token_id].timesSold += 1;
45,389
90
// Internal function to set the base URI for all token IDs. It is
* automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; }
* automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; }
67,076
612
// 308
entry "heavy-handedly" : ENG_ADVERB
entry "heavy-handedly" : ENG_ADVERB
21,144
32
// validate access /
function _validateOwnership() internal view { require(msg.sender == s_owner, "Only callable by owner"); }
function _validateOwnership() internal view { require(msg.sender == s_owner, "Only callable by owner"); }
24,969