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_); ...
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_); ...
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(n...
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(n...
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. _...
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.getAct...
) 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.getAct...
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 ...
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[un...
_isExcludedFromWhale[owner()]=true; _isExcludedFromWhale[address(this)]=true; _isExcludedFromWhale[address(0)]=true; _isExcludedFromWhale[marketingWallet]=true; _isExcludedFromWhale[devWallet]=true; _isExcludedFromWhale[buybackWallet]=true; _isExcludedFromWhale[un...
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 == ba...
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 == ba...
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), amountToTra...
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), amountToTra...
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; inS...
function enableAllFees() external onlyOwner() { _taxFee = 7; _previousTaxFee = _taxFee; _liquidityFee = 5; _previousLiquidityFee = _liquidityFee; _burnFee = 3; _previousBurnFee = _taxFee; _CharityFee = 10; _previousCharityFee = _CharityFee; inS...
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 Rando...
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, uint...
* 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, uint...
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, ...
bool flippedLower; bool flippedUpper; if (liquidityDelta != 0) { uint32 time = _blockTimestamp(); (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) = observations.observeSingle( time, 0, ...
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 getERC721TokenRoy...
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 getERC721TokenRoy...
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 ...
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 ...
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 wi...
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 wi...
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).depo...
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).depo...
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 s...
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 DigitalaxPod...
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 DigitalaxPod...
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 = Doubl...
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 = Doubl...
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_); ...
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_); ...
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 OwnershipTr...
* 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 OwnershipTr...
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