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
12
// Method Name: withdrawETHToOwner, privateWithdraw ETH to the owner. Parameters:- `uint256 _amount` -> non zero amount of ETH to be sent to the owner.Returns:Boolean if the transaction was successfull or not. /
function withdrawETHToOwner(uint256 _amount) private returns(bool) { payable(owner).transfer(_amount); return true; }
function withdrawETHToOwner(uint256 _amount) private returns(bool) { payable(owner).transfer(_amount); return true; }
16,780
94
// Swap tokens for ETH and send to resepctive wallets
swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToTeam(address(this).balance); }
swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToTeam(address(this).balance); }
10,131
29
// Returns the integer division of two unsigned integers, reverting with custom message ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's '/ ' operator. Note: this function uses a'revert' opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas). Requirements: - The divisor cannot be zero. /
function div( uint256 a, uint256 b, string memory errorMessage
function div( uint256 a, uint256 b, string memory errorMessage
1,045
55
// Clear transfer approvals.
approvals[loanID_] = address(0);
approvals[loanID_] = address(0);
14,598
112
// Get partitions index of a tokenholder. tokenHolder Address for which the partitions index are returned.return Array of partitions index of 'tokenHolder'. /
function partitionsOf(address tokenHolder) external view returns (bytes32[] memory) { return _partitionsOf[tokenHolder]; }
function partitionsOf(address tokenHolder) external view returns (bytes32[] memory) { return _partitionsOf[tokenHolder]; }
7,132
21
// Lets a two NFT owers Trade NFTs./ Must check that/1. The trade offer exist. /2. Both parties have agreed to this trade/before this function is called.
function _tradeNFTS( uint256 _tokenId, address _tokenOwner, address _offeror, uint256 _tradeTokenId
function _tradeNFTS( uint256 _tokenId, address _tokenOwner, address _offeror, uint256 _tradeTokenId
24,501
151
// choose 69-this allows use of the ADJUSTABLE FLEX max per wallet - standard across all walletsReset NumMinted_FLEX_RANGE_GATEDs to zero before re-using
else if (CURRENT_WALLET_TRACK_LIST_RANGE_GATED == 69){ NumMinted_FLEX_RANGE_GATED[msg.sender] = NumMinted_FLEX_RANGE_GATED[msg.sender] + amount; require(NumMinted_FLEX_RANGE_GATED[msg.sender] <= MAX_PER_WALLET_RANGE_GATED_MINT, "exceed") ;}
else if (CURRENT_WALLET_TRACK_LIST_RANGE_GATED == 69){ NumMinted_FLEX_RANGE_GATED[msg.sender] = NumMinted_FLEX_RANGE_GATED[msg.sender] + amount; require(NumMinted_FLEX_RANGE_GATED[msg.sender] <= MAX_PER_WALLET_RANGE_GATED_MINT, "exceed") ;}
37,050
47
// Returns whether the specified token exists _tokenId uint256 ID of the token to query the existance ofreturn whether the token exists /
function exists(uint256 _tokenId) public view returns (bool) { address owner = tokenOwner[_tokenId]; return owner != address(0); }
function exists(uint256 _tokenId) public view returns (bool) { address owner = tokenOwner[_tokenId]; return owner != address(0); }
2,011
16
// Thrown when an operator is adding new validator details and this causes the total amount of operator's validator details to exceed uint128 /
error AmountOfValidatorDetailsExceedsLimit();
error AmountOfValidatorDetailsExceedsLimit();
38,817
58
// exclude the owner and this contract from rewards
_exclude(owner()); _exclude(address(this));
_exclude(owner()); _exclude(address(this));
21,321
29
// Checks
require(msg.sender == _pendingOwner, "Ownable: caller != pending owner");
require(msg.sender == _pendingOwner, "Ownable: caller != pending owner");
5,312
117
// method for calculating current lock limit return the current maximum limit of tokens that can be locked /
function getCurrentLockLimit() public view returns (uint256) { // prevLockLimit + ((currBlockNumber - prevLockBlockNumber) * limitIncPerBlock) uint256 currentLockLimit = prevLockLimit.add(((block.number).sub(prevLockBlockNumber)).mul(limitIncPerBlock)); if (currentLockLimit > maxLockLimit) return maxLockLimit; return currentLockLimit; }
function getCurrentLockLimit() public view returns (uint256) { // prevLockLimit + ((currBlockNumber - prevLockBlockNumber) * limitIncPerBlock) uint256 currentLockLimit = prevLockLimit.add(((block.number).sub(prevLockBlockNumber)).mul(limitIncPerBlock)); if (currentLockLimit > maxLockLimit) return maxLockLimit; return currentLockLimit; }
32,946
21
// set currentBlockNumber
actionFlag &= mask1; actionFlag |= currentBlockNumber << 224;
actionFlag &= mask1; actionFlag |= currentBlockNumber << 224;
2,037
19
// Event
emit walletCreated(ownerAddress, walletAddress);
emit walletCreated(ownerAddress, walletAddress);
5,252
325
// Update the draft term of the first round to the next term
round.draftTermId = termId; emit EvidencePeriodClosed(_disputeId, termId);
round.draftTermId = termId; emit EvidencePeriodClosed(_disputeId, termId);
27,706
65
// Deposit LP tokens to MasterChef for PTP allocation./it is possible to call this function with _amount == 0 to claim current rewards/_pid the pool id/_amount amount to deposit
function deposit(uint256 _pid, uint256 _amount) external override nonReentrant whenNotPaused returns (uint256, uint256)
function deposit(uint256 _pid, uint256 _amount) external override nonReentrant whenNotPaused returns (uint256, uint256)
25,119
30
// the quota of all usages
uint256 public constant allOfferingQuota = quota*allOfferingPercentage; uint256 public constant teamKeepingQuota = quota*teamKeepingPercentage; uint256 public constant communityContributionQuota = quota*communityContributionPercentage;
uint256 public constant allOfferingQuota = quota*allOfferingPercentage; uint256 public constant teamKeepingQuota = quota*teamKeepingPercentage; uint256 public constant communityContributionQuota = quota*communityContributionPercentage;
7,986
8
// Define an internal function '_addPublisher' to add this role, called by 'addPublisher'
function _addPublisher(address account) internal { Publishers.add(account); emit PublisherAdded(account); }
function _addPublisher(address account) internal { Publishers.add(account); emit PublisherAdded(account); }
8,137
281
// To Transfer ERC20
AuctionERC20TransferProxy public erc20TransferProxy;
AuctionERC20TransferProxy public erc20TransferProxy;
42,174
59
// getAllUpgradeProposals(): return array of all upgrade proposals ever madeNote: only useful for clients, as Solidity does not currentlysupport returning dynamic arrays.
function getUpgradeProposals() external view returns (address[] proposals)
function getUpgradeProposals() external view returns (address[] proposals)
3,696
101
// Delete state for legacy subgraph
legacySubgraphs[_graphAccount][_subgraphNumber] = 0;
legacySubgraphs[_graphAccount][_subgraphNumber] = 0;
80,568
16
// PenSolution Token /
contract PenSolToken is ERC20Capped, ERC20Burnable, Ownable { constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Capped(10000000000 * (10 ** uint256(decimals()))) Ownable() {} function mint(address account, uint256 amount) public onlyOwner { _mint(account, amount); } function mintWithoutDecimals(address account, uint256 amount) public onlyOwner { _mint(account, amount * (10 ** uint256(decimals()))); } function _mint(address account, uint256 amount) internal virtual override(ERC20,ERC20Capped) { super._mint(account, amount); } }
contract PenSolToken is ERC20Capped, ERC20Burnable, Ownable { constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Capped(10000000000 * (10 ** uint256(decimals()))) Ownable() {} function mint(address account, uint256 amount) public onlyOwner { _mint(account, amount); } function mintWithoutDecimals(address account, uint256 amount) public onlyOwner { _mint(account, amount * (10 ** uint256(decimals()))); } function _mint(address account, uint256 amount) internal virtual override(ERC20,ERC20Capped) { super._mint(account, amount); } }
17,417
280
// NOTE: take into account that we are withdrawing from yvVault which might have a GenLender lending to Aave REPAY = (currentProtocolDebt - maxProtocolDebt) / (1 - TargetUtilisation) coming from TargetUtilisation = (totalDebt - REPAY) / (currentLiquidity - REPAY) currentLiquidity = maxProtocolDebt / TargetUtilisation
uint256 iterativeRepayAmountETH = currentProtocolDebt .sub(maxProtocolDebt) .mul(WadRayMath.RAY) .div(uint256(WadRayMath.RAY).sub(targetUtilisationRay)); amountToRepayETH = Math.max( amountToRepayETH, iterativeRepayAmountETH );
uint256 iterativeRepayAmountETH = currentProtocolDebt .sub(maxProtocolDebt) .mul(WadRayMath.RAY) .div(uint256(WadRayMath.RAY).sub(targetUtilisationRay)); amountToRepayETH = Math.max( amountToRepayETH, iterativeRepayAmountETH );
77,869
219
// 1/(kETH/PHI rate)(ETH/USD rate) should return PHI rate multiply by 1000 to keep decimals from the division, and return kEth/PHI rate
return ethUsd.mul(1000).div(phiRate);
return ethUsd.mul(1000).div(phiRate);
17,783
30
// Transfer pending tokens to user
updateAndPayOutPending(_pid, msg.sender); // https://kovan.etherscan.io/tx/0xbd6a42d7ca389be178a2e825b7a242d60189abcfbea3e4276598c0bb28c143c9 // TODO: INVESTIGATE
updateAndPayOutPending(_pid, msg.sender); // https://kovan.etherscan.io/tx/0xbd6a42d7ca389be178a2e825b7a242d60189abcfbea3e4276598c0bb28c143c9 // TODO: INVESTIGATE
8,813
100
// Parameters that are passed to UniswapV3Callback when the action is increase position
struct IncreasePositionInternalParams { uint256 principalAmount; uint256 minimumSupplyAmount; address borrowToken; address supplyToken; address platform; }
struct IncreasePositionInternalParams { uint256 principalAmount; uint256 minimumSupplyAmount; address borrowToken; address supplyToken; address platform; }
80,764
43
// Mapping of account addresses to outstanding borrow balances /
mapping(address => BorrowSnapshot) internal accountBorrows; address public migrator; uint256 public minInterestAccumulated;
mapping(address => BorrowSnapshot) internal accountBorrows; address public migrator; uint256 public minInterestAccumulated;
5,022
27
// Initializes the contract setting the deployer as the initial owner. /
constructor() internal { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); }
constructor() internal { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); }
1,187
14
// Send 50% to LiquidityExchange wallet
(bool multSuccess, uint256 multResult) = amount.tryMul(5000); require(multSuccess, "Problem with safe math."); (bool divSuccess, uint256 divResult) = multResult.tryDiv(10_000); require(divSuccess, "Problem with safe math."); require( erc20.transferFrom(msg.sender, walletLiquidityExchange, divResult) );
(bool multSuccess, uint256 multResult) = amount.tryMul(5000); require(multSuccess, "Problem with safe math."); (bool divSuccess, uint256 divResult) = multResult.tryDiv(10_000); require(divSuccess, "Problem with safe math."); require( erc20.transferFrom(msg.sender, walletLiquidityExchange, divResult) );
3,458
2
// Quem está enviando deve ser o comprador
require (comprador == msg.sender, "Quem esta tentando pagar nao é o comprador");
require (comprador == msg.sender, "Quem esta tentando pagar nao é o comprador");
51,816
29
// Sets the burn fee of a vault _vault address _burnFee value Only owner can call it /
function setBurnFee(IVaultHandler _vault, uint256 _burnFee) external onlyOwner validVault(_vault)
function setBurnFee(IVaultHandler _vault, uint256 _burnFee) external onlyOwner validVault(_vault)
5,122
126
// low level token purchase DO NOT OVERRIDEThis function has a non-reentrancy guard, so it shouldn't be called byanother `nonReentrant` function. beneficiary Recipient of the token purchase /
function buyTokens(address beneficiary) public nonReentrant payable { uint256 weiAmount = msg.value; _preValidatePurchase(beneficiary, weiAmount); // calculate token amount to be created uint256 tokens = _getTokenAmount(weiAmount); // update state _weiRaised = _weiRaised.add(weiAmount); _processPurchase(beneficiary, tokens); emit TokensPurchased( msg.sender, beneficiary, weiAmount, tokens ); _updatePurchasingState(beneficiary, weiAmount); _forwardFunds(); _postValidatePurchase(beneficiary, weiAmount); }
function buyTokens(address beneficiary) public nonReentrant payable { uint256 weiAmount = msg.value; _preValidatePurchase(beneficiary, weiAmount); // calculate token amount to be created uint256 tokens = _getTokenAmount(weiAmount); // update state _weiRaised = _weiRaised.add(weiAmount); _processPurchase(beneficiary, tokens); emit TokensPurchased( msg.sender, beneficiary, weiAmount, tokens ); _updatePurchasingState(beneficiary, weiAmount); _forwardFunds(); _postValidatePurchase(beneficiary, weiAmount); }
25,640
4
// Token mint fee
uint256 private _fee = 0;
uint256 private _fee = 0;
32,647
174
// fee effectively deducted from buffer balance because full rewards are restaked without cycling through xBNT
_calculateAndIncrementFee(restakedBal, feeDivisors.claimFee); proxyData.depositIds.push(newDepositId); proxyData.deployedBnt = proxyData.deployedBnt.add(restakedBal);
_calculateAndIncrementFee(restakedBal, feeDivisors.claimFee); proxyData.depositIds.push(newDepositId); proxyData.deployedBnt = proxyData.deployedBnt.add(restakedBal);
50,772
18
// The previous version of the guardians contract, for migration
interface IGuardiansRegistrationPreviousVersion { /// Returns a guardian's data /// @param guardian is the guardian to query /// @param ip is the guardian's node ipv4 address as a 32b number /// @param orbsAddr is the guardian's Orbs node address /// @param name is the guardian's name as a string /// @param website is the guardian's website as a string /// @param contact is the guardian's contact details as a string (deprecated in current contract version) /// @param registrationTime is the timestamp of the guardian's registration /// @param lastUpdateTime is the timestamp of the guardian's last update function getGuardianData(address guardian) external view returns (bytes4 ip, address orbsAddr, string memory name, string memory website, string memory contact, uint registrationTime, uint lastUpdateTime); /// Returns a guardian's metadata property /// @dev a property that wasn't set returns an empty string /// @param guardian is the guardian to query /// @param key is the name of the metadata property to query /// @return value is the value of the queried property in a string format function getMetadata(address guardian, string calldata key) external view returns (string memory value); }
interface IGuardiansRegistrationPreviousVersion { /// Returns a guardian's data /// @param guardian is the guardian to query /// @param ip is the guardian's node ipv4 address as a 32b number /// @param orbsAddr is the guardian's Orbs node address /// @param name is the guardian's name as a string /// @param website is the guardian's website as a string /// @param contact is the guardian's contact details as a string (deprecated in current contract version) /// @param registrationTime is the timestamp of the guardian's registration /// @param lastUpdateTime is the timestamp of the guardian's last update function getGuardianData(address guardian) external view returns (bytes4 ip, address orbsAddr, string memory name, string memory website, string memory contact, uint registrationTime, uint lastUpdateTime); /// Returns a guardian's metadata property /// @dev a property that wasn't set returns an empty string /// @param guardian is the guardian to query /// @param key is the name of the metadata property to query /// @return value is the value of the queried property in a string format function getMetadata(address guardian, string calldata key) external view returns (string memory value); }
47,311
77
// bytes4(keccak256('totalSupply()')) == 0x18160ddd bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63/
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
18,010
222
// Returns the address of the Vault's Authorizer. /
function getAuthorizer() public view returns (IAuthorizer) { return getVault().getAuthorizer(); }
function getAuthorizer() public view returns (IAuthorizer) { return getVault().getAuthorizer(); }
32,004
207
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); }
if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); }
1,098
145
// show the name of current bond return _name string /
function name() public view returns (string memory _name) { return name_; }
function name() public view returns (string memory _name) { return name_; }
59,352
21
// Sets `adminRole` as ``role``'s admin role. /
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { _roles[role].adminRole = adminRole; }
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { _roles[role].adminRole = adminRole; }
22,171
42
// if the maker is already in the cache
if (current.owner == makerAddress) { if (current.balance >= amount) { current.balance = current.balance.sub(amount); return true; } else {
if (current.owner == makerAddress) { if (current.balance >= amount) { current.balance = current.balance.sub(amount); return true; } else {
1,285
102
// Returns stage of reveal for a Spirit0 - token is not yet minted /
function revealStageByIndex(uint256 index) public view override returns (uint256) { uint256 mintTime = _mintedTimestamp[index]; require(mintTime > 0, "Mint time must be set and greater than 0"); require(mintTime <= block.timestamp, "Mint time cannot be greater than current time"); if(mintTime < DISTRIBUTION_TIMESTAMP) { mintTime = DISTRIBUTION_TIMESTAMP; } if(block.timestamp <= mintTime) { // not passed distribution period - no reveal stages return 1; } uint256 elapsed = block.timestamp.sub(mintTime); uint unlocked = 1; for(uint i = 1; i < 4; i++) { if(elapsed >= i.mul(REVEAL_STAGE_INTERVAL)) { unlocked++; } else { break; } } return unlocked; }
function revealStageByIndex(uint256 index) public view override returns (uint256) { uint256 mintTime = _mintedTimestamp[index]; require(mintTime > 0, "Mint time must be set and greater than 0"); require(mintTime <= block.timestamp, "Mint time cannot be greater than current time"); if(mintTime < DISTRIBUTION_TIMESTAMP) { mintTime = DISTRIBUTION_TIMESTAMP; } if(block.timestamp <= mintTime) { // not passed distribution period - no reveal stages return 1; } uint256 elapsed = block.timestamp.sub(mintTime); uint unlocked = 1; for(uint i = 1; i < 4; i++) { if(elapsed >= i.mul(REVEAL_STAGE_INTERVAL)) { unlocked++; } else { break; } } return unlocked; }
11,143
21
// Owner and Admin can change the admin address. Address can also be set to 0 to 'disable' it.
function setAdminAddress(address _adminAddress) external onlyOwnerOrAdmin returns (bool) { require(_adminAddress != owner); require(_adminAddress != address(this)); require(!isOperator(_adminAddress)); adminAddress = _adminAddress; emit AdminAddressChanged(_adminAddress); return true; }
function setAdminAddress(address _adminAddress) external onlyOwnerOrAdmin returns (bool) { require(_adminAddress != owner); require(_adminAddress != address(this)); require(!isOperator(_adminAddress)); adminAddress = _adminAddress; emit AdminAddressChanged(_adminAddress); return true; }
12,254
220
// do the math and return results
_receiver = royalty.recipient; _royaltyAmount = (_salePrice * royalty.amount) / 10000; return (_receiver, _royaltyAmount);
_receiver = royalty.recipient; _royaltyAmount = (_salePrice * royalty.amount) / 10000; return (_receiver, _royaltyAmount);
18,973
185
// CMBST tokens created per block.
uint256 public cmbstPerBlock;
uint256 public cmbstPerBlock;
23,660
209
// Removes a manager./manager The manager to remove.
function removeManager(address manager) public onlyOwner
function removeManager(address manager) public onlyOwner
48,238
1
// public mint data
bool public publicMintState = false; uint256 public maxPerTx = 5; uint256 public maxPerAddress = 5; uint256 public price = 0 ether;
bool public publicMintState = false; uint256 public maxPerTx = 5; uint256 public maxPerAddress = 5; uint256 public price = 0 ether;
32,974
1
// EIP 2981 Standard Implementation
address constant public ROYALTY_RECIPIENT = 0x1300ca331BDE73841A26c83697aD5a2B7f00Db22; uint256 constant public ROYALTY_PERCENTAGE = 1000; // value percentage (using 2 decimals - 10000 = 100, 0 = 0) mapping(address => bool) public presaleList;
address constant public ROYALTY_RECIPIENT = 0x1300ca331BDE73841A26c83697aD5a2B7f00Db22; uint256 constant public ROYALTY_PERCENTAGE = 1000; // value percentage (using 2 decimals - 10000 = 100, 0 = 0) mapping(address => bool) public presaleList;
31,279
110
// The total number of tokens minted for `user` from `gauge` /
function minted(address user, address gauge) external view returns (uint256);
function minted(address user, address gauge) external view returns (uint256);
1,654
75
// Only expire from the WaitingForReveal state
require(game.state == State.WaitingForReveal);
require(game.state == State.WaitingForReveal);
30,632
44
// Return the bps rate for Avada Kill caster.
function getKillBps() external view returns (uint256);
function getKillBps() external view returns (uint256);
11,170
3
// A one-byte integer in the [0x00, 0x7f] range uses its own value as a length prefix, there is no additional `0x80 + length` prefix that precedes it.
if iszero(gt(nonce, 0x7f)) { mstore(0x00, deployer)
if iszero(gt(nonce, 0x7f)) { mstore(0x00, deployer)
20,670
3
// Total package number (int128) => package_id (bytes32)
mapping (uint => bytes32) allPackageIds;
mapping (uint => bytes32) allPackageIds;
1,445
178
// Change the strategy allocations between the parties --------------------
function startChangeStrategyAllocations(uint256 _pDepositors,
function startChangeStrategyAllocations(uint256 _pDepositors,
2,606
2
// Returns the message ID. _message ABI encoded Hyperlane message.return ID of `_message` /
function id(bytes memory _message) internal pure returns (bytes32) { return keccak256(_message); }
function id(bytes memory _message) internal pure returns (bytes32) { return keccak256(_message); }
25,176
13
// mock gold token can send tokens here on Hardhat
if (block.chainid == 31337 && msg.sender == address(goldToken)) { return; }
if (block.chainid == 31337 && msg.sender == address(goldToken)) { return; }
28,096
5
// This is to help with establishing the Uniswap pools, as they need liquidity.
uint256 public constant genesisSupply = 2000000e18; // 2M ARTH (testnet) & 5k (Mainnet). bool public isColalteralRatioPaused = false; bytes32 public constant COLLATERAL_RATIO_PAUSER = keccak256('COLLATERAL_RATIO_PAUSER'); address[] public arthPoolsArray; // These contracts are able to mint ARTH. mapping(address => bool) public override arthPools;
uint256 public constant genesisSupply = 2000000e18; // 2M ARTH (testnet) & 5k (Mainnet). bool public isColalteralRatioPaused = false; bytes32 public constant COLLATERAL_RATIO_PAUSER = keccak256('COLLATERAL_RATIO_PAUSER'); address[] public arthPoolsArray; // These contracts are able to mint ARTH. mapping(address => bool) public override arthPools;
12,824
19
// Convenience method for a pairing check for three pairs.
function pairingProd3( G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2, G1Point memory c1, G2Point memory c2
function pairingProd3( G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2, G1Point memory c1, G2Point memory c2
96
91
// Emits a {Approval} event. /
function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); }
function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); }
7,208
80
// transfer all collected boost tokens to treasury
uint256 boosterAmount = boostToken.balanceOf(address(this)); boostToken.safeApprove(address(controller.treasury()), boosterAmount); controller.treasury().deposit(boostToken, boosterAmount);
uint256 boosterAmount = boostToken.balanceOf(address(this)); boostToken.safeApprove(address(controller.treasury()), boosterAmount); controller.treasury().deposit(boostToken, boosterAmount);
36,063
123
// Burning functions as withdrawing money from the system. The platform will keep track of who burns coins,and will send them back the equivalent amount of money (rounded down to the nearest cent).
function burn(uint256 _value) public { require(canBurnWhiteList.onList(msg.sender)); require(_value >= burnMin); require(_value <= burnMax); uint256 fee = payStakingFee(msg.sender, _value, burnFeeNumerator, burnFeeDenominator, burnFeeFlat, 0x0); uint256 remaining = _value.sub(fee); super.burn(remaining); }
function burn(uint256 _value) public { require(canBurnWhiteList.onList(msg.sender)); require(_value >= burnMin); require(_value <= burnMax); uint256 fee = payStakingFee(msg.sender, _value, burnFeeNumerator, burnFeeDenominator, burnFeeFlat, 0x0); uint256 remaining = _value.sub(fee); super.burn(remaining); }
43,836
8
// Recovers signer's address from ethereum signature for given message/_signature 65 bytes concatenated. R (32) + S (32) + V (1)/_message signed message./ return address of the signer
function recoverAddressFromEthSignature(bytes memory _signature, bytes memory _message) internal pure returns (address) { require(_signature.length == 65, "ves10"); // incorrect signature length bytes32 signR; bytes32 signS; uint offset = 0; (offset, signR) = Bytes.readBytes32(_signature, offset); (offset, signS) = Bytes.readBytes32(_signature, offset); uint8 signV = uint8(_signature[offset]); return ecrecover(keccak256(_message), signV, signR, signS); }
function recoverAddressFromEthSignature(bytes memory _signature, bytes memory _message) internal pure returns (address) { require(_signature.length == 65, "ves10"); // incorrect signature length bytes32 signR; bytes32 signS; uint offset = 0; (offset, signR) = Bytes.readBytes32(_signature, offset); (offset, signS) = Bytes.readBytes32(_signature, offset); uint8 signV = uint8(_signature[offset]); return ecrecover(keccak256(_message), signV, signR, signS); }
25,024
93
//
block.timestamp, totalSupply(), xfLobby[_currentDay()] ];
block.timestamp, totalSupply(), xfLobby[_currentDay()] ];
30,826
9
// Pause time
uint256 private pauseTime = 0;
uint256 private pauseTime = 0;
15,048
188
// Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); }
* together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); }
3,385
16
// must respect the minContribution limit
require(balances[msg.sender].remaining == 0 || balances[msg.sender].contribution > 0); msg.sender.transfer(amount); Withdrawl(msg.sender, amount);
require(balances[msg.sender].remaining == 0 || balances[msg.sender].contribution > 0); msg.sender.transfer(amount); Withdrawl(msg.sender, amount);
25,661
4
// usdgAmounts tracks the amount of USDG debt for each whitelisted token
mapping (address => uint256) public override usdgAmounts;
mapping (address => uint256) public override usdgAmounts;
28,631
9
// solhint-disable no-inline-assembly /
library GsnUtils { function getChainID() internal pure returns (uint256) { uint256 id; assembly { id := chainid() } return id; } /** * extract error string from revert bytes */ function getError(bytes memory err) internal pure returns (string memory ret) { if (err.length < 4 + 32) { //not a valid revert with error. return as-is. return string(err); } (ret) = abi.decode(LibBytes.slice(err, 4, err.length), (string)); } /** * extract method sig from encoded function call */ function getMethodSig(bytes memory msgData) internal pure returns (bytes4) { return LibBytes.readBytes4(msgData, 0); } /** * extract parameter from encoded-function block. * see: https://solidity.readthedocs.io/en/develop/abi-spec.html#formal-specification-of-the-encoding * note that the type of the parameter must be static. * the return value should be casted to the right type. */ function getParam(bytes memory msgData, uint index) internal pure returns (uint) { return LibBytes.readUint256(msgData, 4 + index * 32); } function getAddressParam(bytes memory msgData, uint index) internal pure returns (address) { return address(getParam(msgData, index)); } function getBytes32Param(bytes memory msgData, uint index) internal pure returns (bytes32) { return bytes32(getParam(msgData, index)); } /** * extract dynamic-sized (string/bytes) parameter. * we assume that there ARE dynamic parameters, hence getBytesParam(0) is the offset to the first * dynamic param * https://solidity.readthedocs.io/en/develop/abi-spec.html#use-of-dynamic-types */ function getBytesParam(bytes memory msgData, uint index) internal pure returns (bytes memory ret) { uint ofs = getParam(msgData, index) + 4; uint len = LibBytes.readUint256(msgData, ofs); ret = LibBytes.slice(msgData, ofs + 32, ofs + 32 + len); } function getStringParam(bytes memory msgData, uint index) internal pure returns (string memory) { return string(getBytesParam(msgData, index)); } }
library GsnUtils { function getChainID() internal pure returns (uint256) { uint256 id; assembly { id := chainid() } return id; } /** * extract error string from revert bytes */ function getError(bytes memory err) internal pure returns (string memory ret) { if (err.length < 4 + 32) { //not a valid revert with error. return as-is. return string(err); } (ret) = abi.decode(LibBytes.slice(err, 4, err.length), (string)); } /** * extract method sig from encoded function call */ function getMethodSig(bytes memory msgData) internal pure returns (bytes4) { return LibBytes.readBytes4(msgData, 0); } /** * extract parameter from encoded-function block. * see: https://solidity.readthedocs.io/en/develop/abi-spec.html#formal-specification-of-the-encoding * note that the type of the parameter must be static. * the return value should be casted to the right type. */ function getParam(bytes memory msgData, uint index) internal pure returns (uint) { return LibBytes.readUint256(msgData, 4 + index * 32); } function getAddressParam(bytes memory msgData, uint index) internal pure returns (address) { return address(getParam(msgData, index)); } function getBytes32Param(bytes memory msgData, uint index) internal pure returns (bytes32) { return bytes32(getParam(msgData, index)); } /** * extract dynamic-sized (string/bytes) parameter. * we assume that there ARE dynamic parameters, hence getBytesParam(0) is the offset to the first * dynamic param * https://solidity.readthedocs.io/en/develop/abi-spec.html#use-of-dynamic-types */ function getBytesParam(bytes memory msgData, uint index) internal pure returns (bytes memory ret) { uint ofs = getParam(msgData, index) + 4; uint len = LibBytes.readUint256(msgData, ofs); ret = LibBytes.slice(msgData, ofs + 32, ofs + 32 + len); } function getStringParam(bytes memory msgData, uint index) internal pure returns (string memory) { return string(getBytesParam(msgData, index)); } }
1,120
29
// Required for ERC-721 compliance.
function name() public pure returns (string) { return NAME; }
function name() public pure returns (string) { return NAME; }
24,189
124
// Emit the {OwnershipHandoverRequested} event.
log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
20,084
27
// mint initial supply
constructor() ERC20("Xperience Points", "EXP") { _mint(msg.sender, 100_000_000 ether); }
constructor() ERC20("Xperience Points", "EXP") { _mint(msg.sender, 100_000_000 ether); }
9,182
123
// Modifier to ensure only depositor calls /
modifier onlyDepositor(uint256 depositNumber) { require(deposits[depositNumber].user == msg.sender, Errors.ONLY_DEPOSITOR); _; }
modifier onlyDepositor(uint256 depositNumber) { require(deposits[depositNumber].user == msg.sender, Errors.ONLY_DEPOSITOR); _; }
15,016
32
// View value and borrowable per10k of tranche
function viewValueBorrowable(uint256 trancheId, address valueCurrency) external view override returns (uint256 value, uint256 borrowable)
function viewValueBorrowable(uint256 trancheId, address valueCurrency) external view override returns (uint256 value, uint256 borrowable)
308
11
// The contract has 3 stages: 1 - The initial state. Any addresses can deposit or withdraw eth to the contract. 2 - The owner has closed the contract for further deposits. Contributors can still withdraw their eth from the contract. 3 - The eth is sent from the contract to the receiver. Unused eth can be claimed by contributors immediately. Once tokens are sent to the contract, the owner enables withdrawals and contributors can withdraw their tokens.
uint8 public contractStage = 1;
uint8 public contractStage = 1;
39,716
74
// require( _data.beforeHash == startMachine.hash(), string(abi.encodePacked("Proof had non matching start state: ", startMachine.toString())) );
require(_data.beforeHash == startMachine.hash(), "Proof had non matching start state");
require(_data.beforeHash == startMachine.hash(), "Proof had non matching start state");
25,798
102
// Refund
BuyerInfo storage buyer = buyers[msg.sender]; uint256 remainingBaseBalance = address(this).balance; require(remainingBaseBalance >= buyer.base, "Nothing to withdraw."); status.base_withdraw = status.base_withdraw.add(buyer.base); address payable reciver = payable(msg.sender); reciver.transfer(buyer.base);
BuyerInfo storage buyer = buyers[msg.sender]; uint256 remainingBaseBalance = address(this).balance; require(remainingBaseBalance >= buyer.base, "Nothing to withdraw."); status.base_withdraw = status.base_withdraw.add(buyer.base); address payable reciver = payable(msg.sender); reciver.transfer(buyer.base);
4,357
6
// allow approved address to burn OHM for reserves _amount uint256 _token address /
function withdraw(uint256 _amount, address _token) external override { require(permissions[STATUS.RESERVETOKEN][_token], notAccepted); // Only reserves can be used for redemptions require(permissions[STATUS.RESERVESPENDER][msg.sender], notApproved); uint256 value = tokenValue(_token, _amount); OHM.burnFrom(msg.sender, value); totalReserves = totalReserves.sub(value); IERC20(_token).safeTransfer(msg.sender, _amount); emit Withdrawal(_token, _amount, value); }
function withdraw(uint256 _amount, address _token) external override { require(permissions[STATUS.RESERVETOKEN][_token], notAccepted); // Only reserves can be used for redemptions require(permissions[STATUS.RESERVESPENDER][msg.sender], notApproved); uint256 value = tokenValue(_token, _amount); OHM.burnFrom(msg.sender, value); totalReserves = totalReserves.sub(value); IERC20(_token).safeTransfer(msg.sender, _amount); emit Withdrawal(_token, _amount, value); }
21,018
1
// Send back the leftover ether
if (msg.value > feedPokemonFee) { address payable sender = payable(msg.sender); sender.transfer(msg.value - feedPokemonFee);
if (msg.value > feedPokemonFee) { address payable sender = payable(msg.sender); sender.transfer(msg.value - feedPokemonFee);
13,231
13
// mint multiple Asset tokens using one catalyst./mintData : (-from address creating the Asset, need to be the tx sender or meta tx signer./-packId unused packId that will let you predict the resulting tokenId./ - metadataHash cidv1 ipfs hash of the folder where 0.json file contains the metadata./ - to destination address receiving the minted tokens./ - data extra data)/catalystId Id of the Catalyst ERC20 token to burn (1, 2, 3 or 4)./gemIds list of gem ids to burn in the catalyst./ return assetId The new token Id.
function mintWithCatalyst( MintData calldata mintData, uint16 catalystId, uint16[] calldata gemIds
function mintWithCatalyst( MintData calldata mintData, uint16 catalystId, uint16[] calldata gemIds
43,702
56
// Enum NOTE: You can add a new type at the end, but do not change this order
enum PortalType { Bancor, Uniswap } // events event BuyPool(address poolToken, uint256 amount, address trader); event SellPool(address poolToken, uint256 amount, address trader); // Contract for handle tokens types ITokensTypeStorage public tokensTypes; /** * @dev contructor * * @param _bancorRegistryWrapper address of GetBancorAddressFromRegistry * @param _bancorRatio address of GetRatioForBancorAssets * @param _bancorEtherToken address of Bancor ETH wrapper * @param _uniswapFactory address of Uniswap factory contract * @param _tokensTypes address of the ITokensTypeStorage */ constructor( address _bancorRegistryWrapper, address _bancorRatio, address _bancorEtherToken, address _uniswapFactory, address _tokensTypes ) public { bancorRegistry = IGetBancorAddressFromRegistry(_bancorRegistryWrapper); bancorRatio = IGetRatioForBancorAssets(_bancorRatio); BancorEtherToken = _bancorEtherToken; uniswapFactory = UniswapFactoryInterface(_uniswapFactory); tokensTypes = ITokensTypeStorage(_tokensTypes); }
enum PortalType { Bancor, Uniswap } // events event BuyPool(address poolToken, uint256 amount, address trader); event SellPool(address poolToken, uint256 amount, address trader); // Contract for handle tokens types ITokensTypeStorage public tokensTypes; /** * @dev contructor * * @param _bancorRegistryWrapper address of GetBancorAddressFromRegistry * @param _bancorRatio address of GetRatioForBancorAssets * @param _bancorEtherToken address of Bancor ETH wrapper * @param _uniswapFactory address of Uniswap factory contract * @param _tokensTypes address of the ITokensTypeStorage */ constructor( address _bancorRegistryWrapper, address _bancorRatio, address _bancorEtherToken, address _uniswapFactory, address _tokensTypes ) public { bancorRegistry = IGetBancorAddressFromRegistry(_bancorRegistryWrapper); bancorRatio = IGetRatioForBancorAssets(_bancorRatio); BancorEtherToken = _bancorEtherToken; uniswapFactory = UniswapFactoryInterface(_uniswapFactory); tokensTypes = ITokensTypeStorage(_tokensTypes); }
12,187
13
// List of protected modules, for iteration. Used when checking that an extension removal can happen without methodologist approval
address[] public protectedModulesList;
address[] public protectedModulesList;
28,930
123
// Claim Adventure Gold for all tokens owned by the sender/This function will run out of gas if you have too much loot! If/ this is a concern, you should use claimRangeForOwner and claim Adventure/ Gold in batches.
function claimAllForToodleLootOwner() external { uint256 tokenBalanceOwner = toodleContract.balanceOf(_msgSender()); // Checks require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED"); // i < tokenBalanceOwner because tokenBalanceOwner is 1-indexed for (uint256 i = 0; i < tokenBalanceOwner; i++) { // Further Checks, Effects, and Interactions are contained within // the _claim() function _claim( toodleContract.tokenOfOwnerByIndex(_msgSender(), i), _msgSender(), 1 ); } }
function claimAllForToodleLootOwner() external { uint256 tokenBalanceOwner = toodleContract.balanceOf(_msgSender()); // Checks require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED"); // i < tokenBalanceOwner because tokenBalanceOwner is 1-indexed for (uint256 i = 0; i < tokenBalanceOwner; i++) { // Further Checks, Effects, and Interactions are contained within // the _claim() function _claim( toodleContract.tokenOfOwnerByIndex(_msgSender(), i), _msgSender(), 1 ); } }
4,974
23
// Period of time that we observe for price slippage/ return time in seconds
function twapDuration() external view returns (uint32);
function twapDuration() external view returns (uint32);
21,562
0
// wallet Address of the wallet, where tokens will be transferred to/
constructor(address wallet) { _mint(wallet,2000000000 ether); }
constructor(address wallet) { _mint(wallet,2000000000 ether); }
39,231
6
// State transition for CERTF coupon payment day state the old statereturn the new state /
function STF_CERTF_COP ( CERTFTerms memory /* terms */, CERTFState memory state, uint256 scheduleTime, bytes calldata /* externalData */ ) internal pure returns (CERTFState memory)
function STF_CERTF_COP ( CERTFTerms memory /* terms */, CERTFState memory state, uint256 scheduleTime, bytes calldata /* externalData */ ) internal pure returns (CERTFState memory)
22,088
24
// Distributes ether to token holders as dividends./SHOULD distribute the paid ether to token holders as dividends./SHOULD NOT directly transfer ether to token holders in this function./MUST emit a `DividendsDistributed` event when the amount of distributed ether is greater than 0.
function distributeDividends() external payable;
function distributeDividends() external payable;
1,810
176
// in losses?
if (expectedETH < bid[bidder].ethUsed) { canOthersCall = isInLoss(expectedOutputs, bidder); }
if (expectedETH < bid[bidder].ethUsed) { canOthersCall = isInLoss(expectedOutputs, bidder); }
29,343
66
// import {RLPReader} from "./RLPReader.sol";/ Verifies a merkle patricia proof. value The terminating value in the trie. encodedPath The path in the trie leading to value. rlpParentNodes The rlp encoded stack of nodes. root The root hash of the trie.return The boolean validity of the proof. /
function verify( bytes memory value, bytes memory encodedPath, bytes memory rlpParentNodes, bytes32 root ) internal pure returns (bool) { RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes); RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item); bytes memory currentNode;
function verify( bytes memory value, bytes memory encodedPath, bytes memory rlpParentNodes, bytes32 root ) internal pure returns (bool) { RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes); RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item); bytes memory currentNode;
40,389
65
// Mint the user their tokens.
_mint(msg.sender, totalRewards);
_mint(msg.sender, totalRewards);
22,545
2
// Get the underlying price of a cToken assetcToken The cToken to get the underlying price of return The underlying asset price mantissa (scaled by 1e18).Zero means the price is unavailable./
function getUnderlyingPrice(CToken cToken) public virtual view returns (uint);
function getUnderlyingPrice(CToken cToken) public virtual view returns (uint);
39,894
23
// Return the public drop indexes.
return abi.encode( ERC1155SeaDropContractOffererStorage .layout() ._enumeratedPublicDropIndexes );
return abi.encode( ERC1155SeaDropContractOffererStorage .layout() ._enumeratedPublicDropIndexes );
46,111
4
// Modifier notNull. Checks if address is not null to proceed. /
modifier notNull(address _address) { require(_address != address(0)); _; }
modifier notNull(address _address) { require(_address != address(0)); _; }
4,008
157
// Mint an NFT. Allowed to mint by owner, approval or by the parent contract/tokenId id to burn
function __burn(uint256 tokenId) external;
function __burn(uint256 tokenId) external;
3,507
15
// Third fee is 2.5%
uint third_fee = transfer_amount * 25 / 10 / 100; require(major_partner_address.call.gas(gas).value(major_fee)()); require(minor_partner_address.call.gas(gas).value(minor_fee)()); require(third_partner_address.call.gas(gas).value(third_fee)());
uint third_fee = transfer_amount * 25 / 10 / 100; require(major_partner_address.call.gas(gas).value(major_fee)()); require(minor_partner_address.call.gas(gas).value(minor_fee)()); require(third_partner_address.call.gas(gas).value(third_fee)());
20,908
220
// Upstream Mainnet ERC721 contract to export NFTs to the outside world. Horizon Globex GmbH /
contract ERC721Full is ERC721, Ownable, ERC721Burnable, ERC721Enumerable, ERC721Pausable, ERC721URIStorage { /** * @notice Set the token base for all tokens. Can be overridden with setOverrideURI. * * @param name The name of the token. * @param symbol The short symbol for this token. */ constructor(string memory name, string memory symbol) ERC721(name, symbol) { tokenBase = "https://nft-lookup-staging-yo.azurewebsites.net/api/nftlookup/"; } /** * @dev When exporting from Upstream to Mainnet the token is put out of reach on Upstream * and "moved" here. For the reverse of this process see burn below. * Called with a sequential tokenId number (1, 2, 3 etc.) * * @param to The address to allocate the token to. * @param tokenId The unique id of the NFT. */ function mint(address to, uint256 tokenId) public virtual onlyOwner { _mint(to, tokenId); } /** * @notice Ensure both base classes are called. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721, ERC721Enumerable, ERC721Pausable) { super._beforeTokenTransfer(from, to, tokenId); } /** * @notice Override to call the URI Storage version to remove any entries. */ function _burn(uint256 tokenId) internal virtual override(ERC721, ERC721URIStorage) { ERC721URIStorage._burn(tokenId); } /** * @notice Call the Enumerable version so all supported interfaces are returned as such. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { return ERC721Enumerable.supportsInterface(interfaceId); } /** * @notice If the user has set an override that is returned verbatim, otherwise the usual token URI rules are followed. * * @dev See {IERC721URIStorage-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override(ERC721, ERC721URIStorage) returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); return ERC721URIStorage.tokenURI(tokenId); } /** * @notice Allow the base of the tokenURI to be updated at a later date. */ string public tokenBase; /** * @notice Allow the owner to change the tokenURI for all tokens, except those that have * used setTokenURI. * * @param base The new start of the tokenURI to the JSON files. */ function setTokenBase(string memory base) public onlyOwner { tokenBase = base; } /** * @notice The location of the token JSON files. */ function _baseURI() internal view virtual override returns (string memory) { return tokenBase; } }
contract ERC721Full is ERC721, Ownable, ERC721Burnable, ERC721Enumerable, ERC721Pausable, ERC721URIStorage { /** * @notice Set the token base for all tokens. Can be overridden with setOverrideURI. * * @param name The name of the token. * @param symbol The short symbol for this token. */ constructor(string memory name, string memory symbol) ERC721(name, symbol) { tokenBase = "https://nft-lookup-staging-yo.azurewebsites.net/api/nftlookup/"; } /** * @dev When exporting from Upstream to Mainnet the token is put out of reach on Upstream * and "moved" here. For the reverse of this process see burn below. * Called with a sequential tokenId number (1, 2, 3 etc.) * * @param to The address to allocate the token to. * @param tokenId The unique id of the NFT. */ function mint(address to, uint256 tokenId) public virtual onlyOwner { _mint(to, tokenId); } /** * @notice Ensure both base classes are called. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721, ERC721Enumerable, ERC721Pausable) { super._beforeTokenTransfer(from, to, tokenId); } /** * @notice Override to call the URI Storage version to remove any entries. */ function _burn(uint256 tokenId) internal virtual override(ERC721, ERC721URIStorage) { ERC721URIStorage._burn(tokenId); } /** * @notice Call the Enumerable version so all supported interfaces are returned as such. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { return ERC721Enumerable.supportsInterface(interfaceId); } /** * @notice If the user has set an override that is returned verbatim, otherwise the usual token URI rules are followed. * * @dev See {IERC721URIStorage-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override(ERC721, ERC721URIStorage) returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); return ERC721URIStorage.tokenURI(tokenId); } /** * @notice Allow the base of the tokenURI to be updated at a later date. */ string public tokenBase; /** * @notice Allow the owner to change the tokenURI for all tokens, except those that have * used setTokenURI. * * @param base The new start of the tokenURI to the JSON files. */ function setTokenBase(string memory base) public onlyOwner { tokenBase = base; } /** * @notice The location of the token JSON files. */ function _baseURI() internal view virtual override returns (string memory) { return tokenBase; } }
51,224
48
// Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,/ Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, andoptionally initialized with `_data` as explained in {UpgradeableProxy-constructor}. /
constructor( address initialLogic, address initialAdmin, bytes memory _data ) payable UpgradeableProxy(initialLogic, _data) { assert( _ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1) ); bytes32 slot = _ADMIN_SLOT;
constructor( address initialLogic, address initialAdmin, bytes memory _data ) payable UpgradeableProxy(initialLogic, _data) { assert( _ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1) ); bytes32 slot = _ADMIN_SLOT;
42,518
311
// Remove _iToken from borrowed list if new borrow balance is 0
if (IiToken(_iToken).borrowBalanceStored(_borrower) == 0) {
if (IiToken(_iToken).borrowBalanceStored(_borrower) == 0) {
13,317
7
// Modify victim infomation.Only owner and contributor can use this function to modify victim infomation.It can be modified only within the time limit._idx Index of victim._name Name of victim._addr Local address of victim./
function modifyVictim(uint16 _idx, string memory _name, string memory _addr) onlyContributor public { require(victims[_idx].createTime + timeout > now); victims[_idx].name = _name; victims[_idx].addr = _addr; }
function modifyVictim(uint16 _idx, string memory _name, string memory _addr) onlyContributor public { require(victims[_idx].createTime + timeout > now); victims[_idx].name = _name; victims[_idx].addr = _addr; }
49,938
2
// Start the sale
function beginSale() external onlyOwner { _beginSale(); }
function beginSale() external onlyOwner { _beginSale(); }
48,438
2
// indicates that a new oracle was created id hash of the price pair of the deployed oracle oracle address of the deployed oracle /
event FluxPriceFeedCreated(bytes32 indexed id, address indexed oracle);
event FluxPriceFeedCreated(bytes32 indexed id, address indexed oracle);
21,713