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
158
// can later be changed with {transferOwnership}./ Initializes the contract setting the deployer as the initial owner. /
constructor() { _setOwner(_msgSender()); }
constructor() { _setOwner(_msgSender()); }
143
65
// Set a wallet address so that it has to pay transaction fees
function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; }
function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; }
595
281
// Admin Functions Put an evil address into blacklist
function blacklistAddress(address addr) public { require(hasRole(MANAGER_ROLE, msg.sender), "Caller is not a manager"); _state.accounts[addr].isBlacklisted = true; }
function blacklistAddress(address addr) public { require(hasRole(MANAGER_ROLE, msg.sender), "Caller is not a manager"); _state.accounts[addr].isBlacklisted = true; }
75,368
10
// Claim phygital NFT phygitalClaimRequest The phygital claim request signature The signature /
function claimPhygital( PhygitalClaimRequest calldata phygitalClaimRequest, bytes calldata signature
function claimPhygital( PhygitalClaimRequest calldata phygitalClaimRequest, bytes calldata signature
9,882
73
// If no default or external position remaining then remove component from components array
if (_setToken.getExternalPositionRealUnit(_component, _module) != 0) { address[] memory positionModules = _setToken.getExternalPositionModules(_component); if (_setToken.getDefaultPositionRealUnit(_component) == 0 && positionModules.length == 1) { require(...
if (_setToken.getExternalPositionRealUnit(_component, _module) != 0) { address[] memory positionModules = _setToken.getExternalPositionModules(_component); if (_setToken.getDefaultPositionRealUnit(_component) == 0 && positionModules.length == 1) { require(...
29,702
155
// Constructor for an oracle using only Chainlink with multiple pools to read from/_circuitChainlink Chainlink pool addresses (in order)/_circuitChainIsMultiplied Whether we should multiply or divide by this rate when computing Chainlink price
constructor(address[] memory _circuitChainlink, uint8[] memory _circuitChainIsMultiplied) { uint256 circuitLength = _circuitChainlink.length; require(circuitLength > 0, "106"); require(circuitLength == _circuitChainIsMultiplied.length, "104"); for (uint256 i = 0; i < circuitLength; i...
constructor(address[] memory _circuitChainlink, uint8[] memory _circuitChainIsMultiplied) { uint256 circuitLength = _circuitChainlink.length; require(circuitLength > 0, "106"); require(circuitLength == _circuitChainIsMultiplied.length, "104"); for (uint256 i = 0; i < circuitLength; i...
77,772
47
// Make it impossible for the sender to re-claim the same deposit.
bidToCheck.blindedBid = bytes32(0);
bidToCheck.blindedBid = bytes32(0);
40,948
79
// Opens a new channel between `participant1` and `participant2`/ and deposits for `participant1`. Can be called by anyone/participant1 Ethereum address of a channel participant/participant2 Ethereum address of the other channel participant/settle_timeout Number of blocks that need to be mined between a/ call to closeC...
function openChannelWithDeposit( address participant1, address participant2, uint256 settle_timeout, uint256 participant1_total_deposit ) public isSafe settleTimeoutValid(settle_timeout) returns (uint256)
function openChannelWithDeposit( address participant1, address participant2, uint256 settle_timeout, uint256 participant1_total_deposit ) public isSafe settleTimeoutValid(settle_timeout) returns (uint256)
58,212
85
// This is an admin mint function to mint a quantity to a specific address/to address to mint to/quantity quantity to mint/ return the id of the first minted NFT
function adminMint(address to, uint256 quantity) external returns (uint256);
function adminMint(address to, uint256 quantity) external returns (uint256);
3,373
68
// `msg.sender` approves `spender` to spend `value` tokensspender The address of the account able to transfer the tokensvalue The amount of wei to be approved for transfer return Whether the approval was successful or not
function approve(address _spender, uint _value) public returns (bool ok) { //validate _spender address require(_spender != 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
function approve(address _spender, uint _value) public returns (bool ok) { //validate _spender address require(_spender != 0); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
81,622
275
// Gets the amount1 delta between two prices/Calculates liquidity(sqrt(upper) - sqrt(lower))/sqrtRatioAX96 A sqrt price/sqrtRatioBX96 Another sqrt price/liquidity The amount of usable liquidity/roundUp Whether to round the amount up, or down/ return amount1 Amount of token1 required to cover a position of size liquidit...
function getAmount1Delta( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity, bool roundUp
function getAmount1Delta( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity, bool roundUp
2,545
32
// Deposit `_value` tokens for `msg.sender` and lock for `_duration` _value Amount to deposit _duration Epoch time until tokens unlock from now /
function createLock(uint256 _value, uint256 _duration) external nonReentrant { uint256 unlock_time = ((block.timestamp + _duration) / interval) * interval; // Locktime is rounded down to a multiple of interval LockedBalance memory _locked = locked[msg.sender]; require(_value > 0, "VE: INVAL...
function createLock(uint256 _value, uint256 _duration) external nonReentrant { uint256 unlock_time = ((block.timestamp + _duration) / interval) * interval; // Locktime is rounded down to a multiple of interval LockedBalance memory _locked = locked[msg.sender]; require(_value > 0, "VE: INVAL...
42,511
62
// uint256 from = player.last_payout > dep.time ? player.last_payout : dep.time;uint256 to = block.timestamp > dep.expire ? dep.expire : uint256(block.timestamp);
if(dep.status == 0) { uint256 _day_payout = _getInvestDayPayoutOf(dep.amount, dep.period); value += _day_payout; }
if(dep.status == 0) { uint256 _day_payout = _getInvestDayPayoutOf(dep.amount, dep.period); value += _day_payout; }
13,154
11
// Updates the borrow allowance of a user on the specific debt token. delegator The address delegating the borrowing power delegatee The address receiving the delegated borrowing power amount The allowance amount being delegated. /
function _approveDelegation(address delegator, address delegatee, uint256 amount) internal { _borrowAllowances[delegator][delegatee] = amount; emit BorrowAllowanceDelegated(delegator, delegatee, _underlyingAsset, amount); }
function _approveDelegation(address delegator, address delegatee, uint256 amount) internal { _borrowAllowances[delegator][delegatee] = amount; emit BorrowAllowanceDelegated(delegator, delegatee, _underlyingAsset, amount); }
18,848
34
// fees need to be deducted from the pool since fees are deducted from position.collateral and collateral is treated as part of the pool
_decreasePoolAmount(_collateralToken, usdToTokenMin(_collateralToken, fee));
_decreasePoolAmount(_collateralToken, usdToTokenMin(_collateralToken, fee));
13,643
100
// Hooks // Check for 'ERC1400TokensSender' user extension in ERC1820 registry and call it. partition Name of the partition (bytes32 to be left empty for transfers where partition is not specified). operator Address which triggered the balance decrease (through transfer or redemption). from Token holder. to Token recip...
function _callSenderExtension( bytes32 partition, address operator, address from, address to, uint256 value, bytes memory data, bytes memory operatorData ) internal
function _callSenderExtension( bytes32 partition, address operator, address from, address to, uint256 value, bytes memory data, bytes memory operatorData ) internal
12,262
43
// If not in list or in list but inactive
if (!status[epoch][validator].isIn) {
if (!status[epoch][validator].isIn) {
24,252
102
// check output via tokenA -> weth -> tokenB
address[] memory pathB = new address[](3); pathB[0] = _FromTokenContractAddress; pathB[1] = wethTokenAddress; pathB[2] = _ToTokenContractAddress; uint256 amtB = uniswapRouter.getAmountsOut( tokens2Trade, ...
address[] memory pathB = new address[](3); pathB[0] = _FromTokenContractAddress; pathB[1] = wethTokenAddress; pathB[2] = _ToTokenContractAddress; uint256 amtB = uniswapRouter.getAmountsOut( tokens2Trade, ...
34,849
49
//
* @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * h...
* @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * h...
38
97
// The amount to take as revenue, in basis points.
uint256 public immutable revenueBps;
uint256 public immutable revenueBps;
22,145
10
// Current price is smaller than target (>0.5%), swap token1 for token0 We divide the amount of reserve1 to send that would balance the price in two because an ammout of reserve0 is going to come out
address[] memory path = new address[](2); path[0] = address(token0); path[1] = address(token1);
address[] memory path = new address[](2); path[0] = address(token0); path[1] = address(token1);
34,285
45
// Fallback function for funding smart contract. /
function() external payable { fund(); }
function() external payable { fund(); }
39,842
5
// Ensure enough ETH is provided
_checkFunds(msg.value, quantity, publicMintStage.mintPrice);
_checkFunds(msg.value, quantity, publicMintStage.mintPrice);
30,967
2
// 'e' not encountered yet, minting integer part or decimals
if (decimals) {
if (decimals) {
35,170
115
// 检查挖矿权限/account 目标账号/ return flag 挖矿权限标记,只有1表示可以挖矿
function checkMinter(address account) external view returns (uint) { return _minters[account]; }
function checkMinter(address account) external view returns (uint) { return _minters[account]; }
14,169
173
// Emitted when the collected protocol fees are withdrawn by the factory owner/sender The address that collects the protocol fees/recipient The address that receives the collected protocol fees/amount0 The amount of token0 protocol fees that is withdrawn/amount0 The amount of token1 protocol fees that is withdrawn
event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
41,019
1
// The underlying asset contract
IERC721 immutable public tokenContract;
IERC721 immutable public tokenContract;
13,804
71
// Owner can move funds of successful fund to fundWallet
function finaliseICO() public returns (bool);
function finaliseICO() public returns (bool);
39,020
16
// payout must be greater than 0
require(_payoutPercentage > 0);
require(_payoutPercentage > 0);
110
77
// Creates mapping between a Storage ID and Storage/Handover submitter address then save in storage.
storageAddressMap[_storageID] = msg.sender;
storageAddressMap[_storageID] = msg.sender;
25,102
152
// Mints quantity tokens and transfers them to to. Requirements: - there must be quantity tokens remaining unminted in the total collection.- to cannot be the zero address.- quantity cannot be larger than the max batch size.
* Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bool isAdminMint, bytes memory _data ) internal { uint256 startTokenId = currentIndex; require(to != address(0), "ERC721A: mint to the zero address"); // We know if the first token in the batch doesn't...
* Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bool isAdminMint, bytes memory _data ) internal { uint256 startTokenId = currentIndex; require(to != address(0), "ERC721A: mint to the zero address"); // We know if the first token in the batch doesn't...
6,380
72
// decrease sender's token balance
walletTokenBalance[lockedToken[_id].tokenAddress][msg.sender] = walletTokenBalance[lockedToken[_id].tokenAddress][msg.sender].sub(lockedToken[_id].tokenAmount);
walletTokenBalance[lockedToken[_id].tokenAddress][msg.sender] = walletTokenBalance[lockedToken[_id].tokenAddress][msg.sender].sub(lockedToken[_id].tokenAmount);
28,856
3
// mapping from worker to its internal state
mapping(address => WorkerState) private stateOf; function isAvailable(address workerAddress) public override view returns (bool) { return stateOf[workerAddress] == WorkerState.Available; }
mapping(address => WorkerState) private stateOf; function isAvailable(address workerAddress) public override view returns (bool) { return stateOf[workerAddress] == WorkerState.Available; }
55,959
21
// Internal function that Withdraws a quantity of tokens from the vault. _token The address of the ERC20 token_quantityThe number of tokens to withdraw /
function withdrawInternal( address _token, uint256 _quantity ) internal
function withdrawInternal( address _token, uint256 _quantity ) internal
555
7
// Adds two numbers, throws on overflow.
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a, "add fail"); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a, "add fail"); return c; }
58,053
40
// In case the ratio >= scale, the calculation anyway leads to zero.
if (ratio >= LOCKED_PROFIT_RELEASE_SCALE) { return 0; }
if (ratio >= LOCKED_PROFIT_RELEASE_SCALE) { return 0; }
15,284
348
// Give permissions to new lsp contract and then hand over ownership.
longToken.addMinter(lspAddress); longToken.addBurner(lspAddress); longToken.resetOwner(lspAddress); shortToken.addMinter(lspAddress); shortToken.addBurner(lspAddress); shortToken.resetOwner(lspAddress); emit CreatedLongShortPair(lspAddress, msg.sender, address(l...
longToken.addMinter(lspAddress); longToken.addBurner(lspAddress); longToken.resetOwner(lspAddress); shortToken.addMinter(lspAddress); shortToken.addBurner(lspAddress); shortToken.resetOwner(lspAddress); emit CreatedLongShortPair(lspAddress, msg.sender, address(l...
74,501
12
// Sets the address that will receive the swap fees. account The address that will receive the swap fees. /
function setFeeReceiver(address payable account) external onlyOwner { _setFeeReceiver(account); }
function setFeeReceiver(address payable account) external onlyOwner { _setFeeReceiver(account); }
36,422
22
// Map each investor to a series of checkpoints
mapping(address => Checkpoint[]) checkpointBalances;
mapping(address => Checkpoint[]) checkpointBalances;
26,164
146
// returnAmount = isETH(toToken) ? toToken.balanceOf(address(this)) : address(this).balance;returnAmount = toToken.universalBalanceOf(address(this));
require (returnAmount >= minAmount, 'XTrinity slippage is too high');
require (returnAmount >= minAmount, 'XTrinity slippage is too high');
11,715
19
// DepositHandler /
contract DepositHandler is OracleManageable, ReentrancyGuard, IERC721Receiver { using SafeMath for uint; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant ERC721_REC...
contract DepositHandler is OracleManageable, ReentrancyGuard, IERC721Receiver { using SafeMath for uint; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant ERC721_REC...
32,170
38
// RewardPerTokenStored at last time accrue rewards to this account
uint rewardPerTokenUpdated;
uint rewardPerTokenUpdated;
47,646
76
// Get the content (a product code) of the last item in the array productCodes using the lastIndex we obtained above
keyToMove = storefronts[storeId].productCodes[lastIndex];
keyToMove = storefronts[storeId].productCodes[lastIndex];
51,749
1
// Get the total token supply
function totalSupply() public constant returns (uint256 _totalSupply);
function totalSupply() public constant returns (uint256 _totalSupply);
8,997
36
// _assetCategory Category of the asset - see { MultiToken.sol } _duration Loan duration in seconds _assetId ID of an ERC721 or ERC1155 token || 0 in case the token doesn't have IDs _assetAmount Amount of an ERC20 or ERC1155 token || 0 in case of NFTs _owner Address initiating the new Deedreturn Deed ID of the newly mi...
function create( address _assetAddress, MultiToken.Category _assetCategory, uint32 _duration, uint256 _assetId, uint256 _assetAmount, address _owner ) external onlyPWN returns (uint256) { id++;
function create( address _assetAddress, MultiToken.Category _assetCategory, uint32 _duration, uint256 _assetId, uint256 _assetAmount, address _owner ) external onlyPWN returns (uint256) { id++;
41,617
94
// caps have to be consistent with each other
require(_softCap <= _cap); softCap = _softCap; softCapTime = _softCapTime;
require(_softCap <= _cap); softCap = _softCap; softCapTime = _softCapTime;
42,050
28
// Next price will in 2 times more if it less then 1 ether.
if (sellingPrice >= 1 ether) drinkIdToPrice[_tokenId] = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 3), 2)); else drinkIdToPrice[_tokenId] = uint256(SafeMath.mul(sellingPrice, 2)); _transfer(oldOwner, newOwner, _tokenId);
if (sellingPrice >= 1 ether) drinkIdToPrice[_tokenId] = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 3), 2)); else drinkIdToPrice[_tokenId] = uint256(SafeMath.mul(sellingPrice, 2)); _transfer(oldOwner, newOwner, _tokenId);
9,804
60
// Array index check
require(id < _lockers.length, "Error: Unknown token definition");
require(id < _lockers.length, "Error: Unknown token definition");
67,413
28
// Swap for buyback
uint256 ethBought = 0; contractTokenBalance = buyback; contractTokenBalance = checkWithPool(contractTokenBalance); ethBought = swapEthBasedFees(contractTokenBalance);
uint256 ethBought = 0; contractTokenBalance = buyback; contractTokenBalance = checkWithPool(contractTokenBalance); ethBought = swapEthBasedFees(contractTokenBalance);
45,989
85
// Find amount of tokens ready to be withdrawn by a swap party. /
function _withdrawableAmount(SwapOffer _offer) internal view returns(uint256) { return _unlockedAmount(_offer.tokensForSwap).sub(_offer.withdrawnTokensForSwap); }
function _withdrawableAmount(SwapOffer _offer) internal view returns(uint256) { return _unlockedAmount(_offer.tokensForSwap).sub(_offer.withdrawnTokensForSwap); }
65,197
30
// BlokkoContracts takes Smartys token in escrow from client and supplier./Both can claim the tokens if they send a valid signed message.
contract BlokkoOrder is IERC777Recipient, IERC777Sender, ERC1820Implementer { IERC1820Registry private _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); bytes32 constant private TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient"); bytes32 constant public TOKENS_SENDE...
contract BlokkoOrder is IERC777Recipient, IERC777Sender, ERC1820Implementer { IERC1820Registry private _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); bytes32 constant private TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient"); bytes32 constant public TOKENS_SENDE...
3,620
534
// --- Contract setters ---
function setAddresses( address _borrowerOperationsAddress, address _troveManagerAddress, address _activePoolAddress, address _lusdTokenAddress, address _sortedTrovesAddress, address _priceFeedAddress, address _communityIssuanceAddress )
function setAddresses( address _borrowerOperationsAddress, address _troveManagerAddress, address _activePoolAddress, address _lusdTokenAddress, address _sortedTrovesAddress, address _priceFeedAddress, address _communityIssuanceAddress )
8,885
4
// -Infinity. /
bytes16 private constant NEGATIVE_INFINITY = 0xFFFF0000000000000000000000000000;
bytes16 private constant NEGATIVE_INFINITY = 0xFFFF0000000000000000000000000000;
11,503
1
// positive case
function pulsone() public payable{ uint256 j = 0; uint i = 100; for (; i < i; i++) { j++; } }
function pulsone() public payable{ uint256 j = 0; uint i = 100; for (; i < i; i++) { j++; } }
45,262
9
// Calculate the amount of underlying token available to withdrawwhen withdrawing via only single token tokenAmount the amount of LP token to burn tokenIndex index of which token will be withdrawnreturn availableTokenAmount calculated amount of underlying tokenavailable to withdraw /
function calculateRemoveLiquidityOneToken( uint256 tokenAmount, uint8 tokenIndex
function calculateRemoveLiquidityOneToken( uint256 tokenAmount, uint8 tokenIndex
25,971
19
// creating the bin corresponding to this contributor
uint256 amt = crowdFund.contributionAtIdx(contributorIdx); acc += amt;
uint256 amt = crowdFund.contributionAtIdx(contributorIdx); acc += amt;
8,905
200
// helper for sell pool in Bancor network converter type v2/
function sellPoolViaBancorV2( IERC20 _poolToken, uint256 _amount, bytes calldata _additionalData ) private returns(address[] memory connectorsAddress)
function sellPoolViaBancorV2( IERC20 _poolToken, uint256 _amount, bytes calldata _additionalData ) private returns(address[] memory connectorsAddress)
33,195
10
// This multiplication can't overflow, _secondsPassed will easily fit within 64-bits, and totalPriceChange will easily fit within 128-bits, their product will always fit within 256-bits.
int256 currentPriceChange = (totalPriceChange * int256(secondsPassed)) / int256(duration);
int256 currentPriceChange = (totalPriceChange * int256(secondsPassed)) / int256(duration);
15,190
8
// retrieve the size of the code, this needs assembly
let size := extcodesize(_addr)
let size := extcodesize(_addr)
45,263
4
// Struct & Mapping to store proposal details
uint256 constant PROJECT_OWNER_TRANSFER_DURATION = 3 days; // Sets the time from motion creation to possible amount transfer from the project owner's repository mapping(uint256 => Proposal) public proposals;
uint256 constant PROJECT_OWNER_TRANSFER_DURATION = 3 days; // Sets the time from motion creation to possible amount transfer from the project owner's repository mapping(uint256 => Proposal) public proposals;
15,722
20
// mouth
rarities[5] = [ 80, 225, 227, 228, 112, 240, 64, 160, 167,
rarities[5] = [ 80, 225, 227, 228, 112, 240, 64, 160, 167,
10,745
136
// Distributes ether to token holders as dividends./It reverts if the total supply of tokens is 0./ It emits the `DividendsDistributed` event if the amount of received ether is greater than 0./ About undistributed ether:/ In each distribution, there is a small amount of ether not distributed,/ the magnified amount of w...
function distributeDividends() public override payable { require(totalSupply() > 0); if (msg.value > 0) { magnifiedDividendPerShare = magnifiedDividendPerShare.add( (msg.value).mul(magnitude) / totalSupply() ); emit DividendsDistributed(msg.sender, msg.value); totalDividendsD...
function distributeDividends() public override payable { require(totalSupply() > 0); if (msg.value > 0) { magnifiedDividendPerShare = magnifiedDividendPerShare.add( (msg.value).mul(magnitude) / totalSupply() ); emit DividendsDistributed(msg.sender, msg.value); totalDividendsD...
32,184
59
// Event triggered when a new reward tier is added_index of the tier added_rate of added tier_price of added tier_enabled status of added tier/
event TierAdded(uint256 _index, uint256 _rate, uint256 _price, bool _enabled);
event TierAdded(uint256 _index, uint256 _rate, uint256 _price, bool _enabled);
48,985
10
// Eyebrow N°11 => Yokai Blood
function item_11() public pure returns (string memory) { return base(yokai("B50D5E"), "Yokai Blood"); }
function item_11() public pure returns (string memory) { return base(yokai("B50D5E"), "Yokai Blood"); }
22,502
250
// generate a random index
uint256 index = _random(supplyLeft); uint256 tokenAtPlace = indices[index]; uint256 tokenId;
uint256 index = _random(supplyLeft); uint256 tokenAtPlace = indices[index]; uint256 tokenId;
8,607
27
// we need to be net short the asset.
uint expectedShort = uint(-expectedHedge);
uint expectedShort = uint(-expectedHedge);
35,734
0
// Define a variable to store the access key smart contract
TokenERC1155 public accessKeysCollection; constructor( string memory _name, string memory _symbol, address _royaltyRecipient, uint128 _royaltyBps,
TokenERC1155 public accessKeysCollection; constructor( string memory _name, string memory _symbol, address _royaltyRecipient, uint128 _royaltyBps,
12,074
47
// This event MUST be emitted by `onRoyaltiesReceived()`.
event RoyaltiesReceived( address indexed _royaltyRecipient, address indexed _buyer, uint256 indexed _tokenId, address _tokenPaid, uint256 _amount, bytes32 _metadata );
event RoyaltiesReceived( address indexed _royaltyRecipient, address indexed _buyer, uint256 indexed _tokenId, address _tokenPaid, uint256 _amount, bytes32 _metadata );
59,146
124
// true up earned amount to vBZRX vesting schedule
lastSync = vestingLastSync[account]; multiplier = vestedBalanceForAmount( 1e36, 0, lastSync ); value = value .mul(multiplier); value /= 1e36; bz...
lastSync = vestingLastSync[account]; multiplier = vestedBalanceForAmount( 1e36, 0, lastSync ); value = value .mul(multiplier); value /= 1e36; bz...
43,227
19
// return Half ray, 1e27/2 /
function halfRay() internal pure returns (uint256) { return halfRAY; }
function halfRay() internal pure returns (uint256) { return halfRAY; }
8,554
6
// Initializes the contract by setting a `name` and a `symbol` to the token collection, and by setting supply caps, mint indexes, and reserves /
constructor() ERC721("Edgerunners", "EDGE")
constructor() ERC721("Edgerunners", "EDGE")
25,611
13
// abort deposit/withdraw requests/_uuid UUID used as an external identifier/ return Whether the transaction was successful or not (0: Successful)
function abortTransfer ( bytes16 _uuid
function abortTransfer ( bytes16 _uuid
2,612
57
// Requires that the token exists.
modifier tokenExists(uint256 tokenId) { require(ERC721._exists(tokenId), "ERC721Common: Token doesn't exist"); _; }
modifier tokenExists(uint256 tokenId) { require(ERC721._exists(tokenId), "ERC721Common: Token doesn't exist"); _; }
49,522
8
// Sets the configIds for an array of `assets` and `debts`assets erc-20 address array to set e-mode config debts erc-20 address array corresponding asset in mapping configIds from aaveV3 (refer to this contract title block) /
function setEModeConfig( address[] calldata assets, address[] calldata debts, uint8[] calldata configIds ) external onlyTimelock
function setEModeConfig( address[] calldata assets, address[] calldata debts, uint8[] calldata configIds ) external onlyTimelock
20,011
118
// Calculates the total underlying tokens It includes tokens held by the contract and held in MasterChef /
function balanceOf() public view returns (uint256) { (uint256 amount, ) = IMasterChef(masterchef).userInfo(address(this)); return token.balanceOf(address(this)).add(amount); }
function balanceOf() public view returns (uint256) { (uint256 amount, ) = IMasterChef(masterchef).userInfo(address(this)); return token.balanceOf(address(this)).add(amount); }
33,792
136
// View function to see pending Token/_nftId NFT for which pending tokens are to be viewed/ return pending reward for a given user.
function pendingToken(uint256 _nftId) external view returns (uint256) { NFTInfo storage nft = nftInfo[_nftId]; if (!nft.isStaked) { return 0; } (address baseToken, , uint256 amount) = lpToken.tokenMetadata(_nftId); amount /= liquidityProviders.BASE_DIVISOR(); ...
function pendingToken(uint256 _nftId) external view returns (uint256) { NFTInfo storage nft = nftInfo[_nftId]; if (!nft.isStaked) { return 0; } (address baseToken, , uint256 amount) = lpToken.tokenMetadata(_nftId); amount /= liquidityProviders.BASE_DIVISOR(); ...
24,674
4
// Fallback: reverts if Ether is sent to this smart contract by mistake
function() external { revert(); }
function() external { revert(); }
31,432
405
// Get information about a service provider given their address _serviceProvider - address of service provider /
function getServiceProviderDetails(address _serviceProvider) external view returns ( uint256 deployerStake, uint256 deployerCut, bool validBounds, uint256 numberOfEndpoints, uint256 minAccountStake, uint256 maxAccountStake)
function getServiceProviderDetails(address _serviceProvider) external view returns ( uint256 deployerStake, uint256 deployerCut, bool validBounds, uint256 numberOfEndpoints, uint256 minAccountStake, uint256 maxAccountStake)
45,335
4
// filter too small asset, saving gas
uint256 public minMintToken0; uint256 public minMintToken1; mapping(address => UserInfo) userInfo0; mapping(address => UserInfo) userInfo1; event Stake(bool _index0, address _user, uint256 _amount);
uint256 public minMintToken0; uint256 public minMintToken1; mapping(address => UserInfo) userInfo0; mapping(address => UserInfo) userInfo1; event Stake(bool _index0, address _user, uint256 _amount);
36,797
113
// KNEEL PEON! KNEEL BEFORE YOUR MASTER! /
function worship() public payable onlyAwake { assembly { if gt(sload(timestampUntilNextEpoch.slot), add(timestamp(), 1)) { mstore(0x00, ERROR_SIG) mstore(0x04, 0x20) mstore(0x24, 8) mstore(0x44, 'Too Soon') revert(0x...
function worship() public payable onlyAwake { assembly { if gt(sload(timestampUntilNextEpoch.slot), add(timestamp(), 1)) { mstore(0x00, ERROR_SIG) mstore(0x04, 0x20) mstore(0x24, 8) mstore(0x44, 'Too Soon') revert(0x...
80,878
53
// Official prices and timestamps by symbol hash
mapping(bytes32 => Price) public prices;
mapping(bytes32 => Price) public prices;
21,943
43
// Auto-LP varibales
bool private swapping; bool public swapEnabled = true; uint256 public addLiquityThresholdETH = 10**17; // 1 ETH = 10**18 | 0.1 ETH = 10**17 uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1_000_000_000_000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); u...
bool private swapping; bool public swapEnabled = true; uint256 public addLiquityThresholdETH = 10**17; // 1 ETH = 10**18 | 0.1 ETH = 10**17 uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1_000_000_000_000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); u...
57,978
78
// create local variable for unlock total
uint tokensToUnlock;
uint tokensToUnlock;
14,363
34
// version cache buster
string public constant version = "v2";
string public constant version = "v2";
53,652
2
// Public Functions//Accesses the batch storage container.return Reference to the batch storage container. /
function batches() public view returns ( iOVM_ChainStorageContainer )
function batches() public view returns ( iOVM_ChainStorageContainer )
15,223
62
// split the contract balance into halves add the marketing wallet
uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half);
uint256 half = contractTokenBalance.div(2); uint256 otherHalf = contractTokenBalance.sub(half);
68
0
// Address of securityToken this ConstraintModule is used by /
ISecurityToken private _securityToken;
ISecurityToken private _securityToken;
21,143
38
// Sell `amount` tokens to contract/ amount amount of tokens to be sold
function sell(uint256 amount) public { //require(this.balance >= amount * sellPrice); // checks if the contract has enough ether to buy require(balanceOf[msg.sender] >= amount * sellPrice); // checks if the contract has enough ether to buy _transfer(msg.sender, this, amount); ...
function sell(uint256 amount) public { //require(this.balance >= amount * sellPrice); // checks if the contract has enough ether to buy require(balanceOf[msg.sender] >= amount * sellPrice); // checks if the contract has enough ether to buy _transfer(msg.sender, this, amount); ...
20,936
186
// Token URI
function tokenURI(uint256 tokenId) public view virtual override returns (string memory)
function tokenURI(uint256 tokenId) public view virtual override returns (string memory)
1,447
24
// Hook for future use
_beforeUpdate();
_beforeUpdate();
19,911
9
// set claimed to 1 to avoid initial claim requirement for vestees calling `claim`
userData[_receivers[i]] = UserWeight({tranche: 1, weight: _weights[i], claimed: 1});
userData[_receivers[i]] = UserWeight({tranche: 1, weight: _weights[i], claimed: 1});
36,712
31
// tokens[0] = tokenAddress; tokens[1] = wethAddress;
token = _token; factory = _factory; weth = _weth; ANCHOR = duration(0,block.timestamp).mul(ONE_DAY); DOMAIN_SEPARATOR = keccak256(abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak25...
token = _token; factory = _factory; weth = _weth; ANCHOR = duration(0,block.timestamp).mul(ONE_DAY); DOMAIN_SEPARATOR = keccak256(abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak25...
42,659
12
// Utils/Helper Function to get Available Token by Token Id /
function getAvailableTokensByTokenId(uint256 id) public view returns (int)
function getAvailableTokensByTokenId(uint256 id) public view returns (int)
80,553
28
// Enum NOTE: You can add a new type at the end, but DO NOT CHANGE this order
enum DefiActions { YearnDeposit, YearnWithdraw } constructor(address _tokensTypes) public { tokensTypes = ITokensTypeStorage(_tokensTypes); }
enum DefiActions { YearnDeposit, YearnWithdraw } constructor(address _tokensTypes) public { tokensTypes = ITokensTypeStorage(_tokensTypes); }
26,150
4
// handle returndata
return handleReturnData();
return handleReturnData();
38,291
0
// Emitted when a token renounces its permission list/renouncedPermissionListAddress - The address of the renounced permission list
event PermissionListRenounced(address renouncedPermissionListAddress);
event PermissionListRenounced(address renouncedPermissionListAddress);
27,566
17
// all tokens are assumed to be in - since we want to import all of them
info.cUser = USER_INFO.getPerUserInfo(user, info.tokenInfo.ctoken, info.tokenInfo.ctoken, info.tokenInfo.underlying); info.importInfo = USER_INFO.getImportInfo(user, info.tokenInfo.ctoken, registry, sugarDaddy); info.scoreInfo = USER_INFO.getScoreInfo(user, jarConnector); info.compToken...
info.cUser = USER_INFO.getPerUserInfo(user, info.tokenInfo.ctoken, info.tokenInfo.ctoken, info.tokenInfo.underlying); info.importInfo = USER_INFO.getImportInfo(user, info.tokenInfo.ctoken, registry, sugarDaddy); info.scoreInfo = USER_INFO.getScoreInfo(user, jarConnector); info.compToken...
60,700
99
// calculate the number of tokens to take as a fee
uint256 liquidityFee = calculateTokenFee(amount, _feeDecimals, _feePercentage);
uint256 liquidityFee = calculateTokenFee(amount, _feeDecimals, _feePercentage);
12,057
16
// If the contract is initializing we ignore whether _initialized is set in order to support multiple inheritance patterns, but we only do this in the context of a constructor, and for the lowest level of initializers, because in other contexts the contract may have been reentered.
if (_initializing) { require( version == 1 && !AddressUpgradeable.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else {
if (_initializing) { require( version == 1 && !AddressUpgradeable.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else {
22,450
46
// elsethen check allowed token for board member
return currentTime() > time;
return currentTime() > time;
49,892