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
0
// Get current reserves
(uint current_fxs_virtual_reserves,uint current_collat_virtual_reserves, uint average_fxs_virtual_reserves, uint average_collat_virtual_reserves) = getVirtualReserves();
(uint current_fxs_virtual_reserves,uint current_collat_virtual_reserves, uint average_fxs_virtual_reserves, uint average_collat_virtual_reserves) = getVirtualReserves();
14,545
22
// Add airdrop _collectionName Collection name for minting _totalAmount How many copies to create _metadataURI Metadata URI _data Data. By default "0x00" _recipients Array of recipients _amountEach How many copy each account will getreturn Token ID of created airdrop /
function addAirdrop( string memory _collectionName, uint256 _totalAmount, uint256 _price, uint256 _royaltyAmount, string memory _metadataURI, bytes memory _data, address[] memory _recipients, uint256 _amountEach
function addAirdrop( string memory _collectionName, uint256 _totalAmount, uint256 _price, uint256 _royaltyAmount, string memory _metadataURI, bytes memory _data, address[] memory _recipients, uint256 _amountEach
15,670
10
// function multiTransfer(uint256[] calldata mixedAddrVal) external returns (bool);
function batchTransfer(address[] memory addressList, uint256[] memory amountList) external returns (bool);
function batchTransfer(address[] memory addressList, uint256[] memory amountList) external returns (bool);
14,928
14
// Admin suggests a new upgrade
upgrade.newUpgrade(block.timestamp + 60, IDNS(up_dns)); assertTrue(upgrade.upgradePlanned());
upgrade.newUpgrade(block.timestamp + 60, IDNS(up_dns)); assertTrue(upgrade.upgradePlanned());
46,669
481
// encodes a uint144 as a UQ144x112
function encode144(uint144 x) internal pure returns (uq144x112 memory) { return uq144x112(uint256(x) << RESOLUTION); }
function encode144(uint144 x) internal pure returns (uq144x112 memory) { return uq144x112(uint256(x) << RESOLUTION); }
12,248
35
// todo: 计算正确的值
return (0, 0);
return (0, 0);
32,587
58
// transfer each nft from the caller
ERC721(nft).safeTransferFrom(msg.sender, address(this), tokenIds[i]); if (payRoyalties) {
ERC721(nft).safeTransferFrom(msg.sender, address(this), tokenIds[i]); if (payRoyalties) {
24,825
463
// https:etherscan.io/address/0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E
SystemStatus public constant systemstatus_i = SystemStatus(0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E);
SystemStatus public constant systemstatus_i = SystemStatus(0x1c86B3CDF2a60Ae3a574f7f71d44E2C50BDdB87E);
6,192
30
// Fixed Fee for using the serice
TokenCurrency.transfer( _owner(), (a.onPremiumSale.length > 0) ? 1000000 : 3500000 );
TokenCurrency.transfer( _owner(), (a.onPremiumSale.length > 0) ? 1000000 : 3500000 );
14,163
0
// Initialize the contract creator Creator/owner of contract _contractURI Contract metadata defaultRoyalty Default royalty object for contract (optional) _defaultTokenManager Default token manager for contract (optional) _name Name of token edition _symbol Symbol of the token edition trustedForwarder Trusted minimal forwarder initialMinter Initial minter to register newBaseURI Base URI for contract _limitSupply Initial limit supply useMarketplaceFiltererRegistry Denotes whether to use marketplace filterer registry _observability Observability contract address /
function initialize( address creator, string memory _contractURI, IRoyaltyManager.Royalty memory defaultRoyalty, address _defaultTokenManager, string memory _name, string memory _symbol, address trustedForwarder, address initialMinter, string memory newBaseURI,
function initialize( address creator, string memory _contractURI, IRoyaltyManager.Royalty memory defaultRoyalty, address _defaultTokenManager, string memory _name, string memory _symbol, address trustedForwarder, address initialMinter, string memory newBaseURI,
45,416
8
// Emitted on a call to an account.
event CallResult(bool success, bytes result); /*/////////////////////////////////////////////////////////////// Functions
event CallResult(bool success, bytes result); /*/////////////////////////////////////////////////////////////// Functions
11,870
38
// emit modification event
emit ModifyOfferValue(msg.sender, _tokenId, _value);
emit ModifyOfferValue(msg.sender, _tokenId, _value);
7,080
15
// cap asked amount with available reserve
effectiveAmount = Math.min(masterReserve, amount);
effectiveAmount = Math.min(masterReserve, amount);
12,506
28
// Get material images_materialTokenId Material token idreturn Material images /
function getMaterialImages(uint256 _materialTokenId) public view returns (string[] memory) { return materialToken[_materialTokenId].images; }
function getMaterialImages(uint256 _materialTokenId) public view returns (string[] memory) { return materialToken[_materialTokenId].images; }
44,797
13
// Ensure that the tokenCounter doesn't overflow
uint256 newTokenCounter = tokenCounter + 1; tokenCounter = newTokenCounter > MAX_TOKENS ? MAX_TOKENS : newTokenCounter;
uint256 newTokenCounter = tokenCounter + 1; tokenCounter = newTokenCounter > MAX_TOKENS ? MAX_TOKENS : newTokenCounter;
4,995
194
// the referenced bonding curve
IBondingCurve public override bondingCurve; Decimal.D256 internal _initialUSDPrice;
IBondingCurve public override bondingCurve; Decimal.D256 internal _initialUSDPrice;
21,569
402
// Deactivate the authority system.
authoritiesActive = false; quorumAuthorities = 0; for (uint256 i = 0; i < _authorities.length; i++) { authorities[_authorities[i]] = false; }
authoritiesActive = false; quorumAuthorities = 0; for (uint256 i = 0; i < _authorities.length; i++) { authorities[_authorities[i]] = false; }
8,011
39
// Check caller is pendingAdmin and pendingAdmin ≠ address(0)
require(msg.sender == pendingAdmin && msg.sender != address(0), "Romulus:_acceptAdmin: pending admin only");
require(msg.sender == pendingAdmin && msg.sender != address(0), "Romulus:_acceptAdmin: pending admin only");
17,588
18
// 11081018 Belong to Founder
uint256 totalFounder=1*10**8*10**18;
uint256 totalFounder=1*10**8*10**18;
73,103
149
// the sum of decimalsOfBond of the bondMaker.This value is constant by the restriction of `_assertBondMakerDecimals`. /
uint8 internal constant DECIMALS_OF_BOND = 8;
uint8 internal constant DECIMALS_OF_BOND = 8;
37,351
110
// always push out _tokenIn (already have)
function _pushCollectedFundGivenIn(address _tokenIn, uint _tokenAmountIn) internal returns (uint collectedFeeAmount) { collectedFeeAmount = 0; if (collectedFee > 0) { address _collectedToken = IBFactory(factory).collectedToken(); if (_collectedToken != address(0)) { collectedFeeAmount = bdiv(bmul(_tokenAmountIn, collectedFee), BConst.BONE); _pushUnderlying(_tokenIn, factory, collectedFeeAmount); emit LOG_COLLECTED_FUND(_tokenIn, collectedFeeAmount); } } }
function _pushCollectedFundGivenIn(address _tokenIn, uint _tokenAmountIn) internal returns (uint collectedFeeAmount) { collectedFeeAmount = 0; if (collectedFee > 0) { address _collectedToken = IBFactory(factory).collectedToken(); if (_collectedToken != address(0)) { collectedFeeAmount = bdiv(bmul(_tokenAmountIn, collectedFee), BConst.BONE); _pushUnderlying(_tokenIn, factory, collectedFeeAmount); emit LOG_COLLECTED_FUND(_tokenIn, collectedFeeAmount); } } }
72,303
8
// Make sure that the input is less than the snark scalar field
require(input < SNARK_SCALAR_FIELD, ERROR_INPUT_VAL);
require(input < SNARK_SCALAR_FIELD, ERROR_INPUT_VAL);
49,258
61
// Creates `amount` tokens and assigns them to `msg.sender`, increasingthe total supply. Requirements - `msg.sender` must be the token owner /
function mint(uint256 amount) public onlyOwner returns (bool) { _mint(_msgSender(), amount); return true; }
function mint(uint256 amount) public onlyOwner returns (bool) { _mint(_msgSender(), amount); return true; }
257
186
// The LOCK TOKEN!
LockToken public lock;
LockToken public lock;
43,845
147
// Constraint expression for cpu/operands/res: (1 - cpu__decode__opcode_rc__bit_9)column19_row13 - (cpu__decode__opcode_rc__bit_5(column17_row5 + column17_row13) + cpu__decode__opcode_rc__bit_6column19_row5 + cpu__decode__flag_res_op1_0column17_row13).
let val := addmod( mulmod( addmod( 1, sub(PRIME, /*intermediate_value/cpu/decode/opcode_rc/bit_9*/ mload(0x3440)), PRIME),
let val := addmod( mulmod( addmod( 1, sub(PRIME, /*intermediate_value/cpu/decode/opcode_rc/bit_9*/ mload(0x3440)), PRIME),
19,536
98
// Payback tokens to aave. Payback tokens to aave. _tokens list of token addresses. _amounts list of amounts for respective tokens./
function aavePayback( address[] memory _tokens, uint256[] memory _amounts
function aavePayback( address[] memory _tokens, uint256[] memory _amounts
49,461
163
// all poolers exit before settlement, the premium belongs to the pool creator, however it's unlikely to happen.
_claimableUSDTPremiums[_owner] = _claimableUSDTPremiums[_owner].add(option.totalPremiums());
_claimableUSDTPremiums[_owner] = _claimableUSDTPremiums[_owner].add(option.totalPremiums());
20,250
121
// If the approval buyAmount is non-zero the fill buyAmount must be non-zero too.
require(fill.buyAmount > 0/*, "Approval does not allow zero buy amount."*/);
require(fill.buyAmount > 0/*, "Approval does not allow zero buy amount."*/);
2,404
53
// Safely transfers the ownership of a given item ID to another addressIf the target address is a contract, it must implement `onERCXReceived`,which is called upon a safe transfer, and return the magic value`bytes4(keccak256("onERCXReceived(address,address,uint256,bytes)"))`; otherwise,the transfer is reverted.Requires the msg sender to be the owner, approved, or operator from current owner of the item to address to receive the ownership of the given item ID itemId uint256 ID of the item to be transferred data bytes data to send along with a safe transfer check /
function safeTransferOwner( address from, address to, uint256 itemId, bytes memory data
function safeTransferOwner( address from, address to, uint256 itemId, bytes memory data
79,819
8
// Pools
AXIAL = IAxialToken(_pool_addresses[0]); ac4d_swap = ISwapFlashLoan(_pool_addresses[1]); AC4D = ERC20(_pool_addresses[2]); masterchef = IMasterChefAxialV3(_pool_addresses[3]);
AXIAL = IAxialToken(_pool_addresses[0]); ac4d_swap = ISwapFlashLoan(_pool_addresses[1]); AC4D = ERC20(_pool_addresses[2]); masterchef = IMasterChefAxialV3(_pool_addresses[3]);
41,946
183
// Proof of work is called by the miner when they submit the solution (proof of work and value)_nonce uint submitted by miner_requestId is the array of the 5 PSR's being mined_value is an array of 5 values/
function submitMiningSolution(TellorStorage.TellorStorageStruct storage self, string calldata _nonce,uint256[5] calldata _requestId, uint256[5] calldata _value) external
function submitMiningSolution(TellorStorage.TellorStorageStruct storage self, string calldata _nonce,uint256[5] calldata _requestId, uint256[5] calldata _value) external
7,676
63
// count the number of tokens this strategy currently supports
function approvedTokensCount() external view override returns (uint256) { return _approvedTokens.length(); }
function approvedTokensCount() external view override returns (uint256) { return _approvedTokens.length(); }
327
160
// To receive BNB from tokenSwapRouter when swapping
receive() external payable {} /** * @dev Update the transfer tax rate. * Can only be called by the current operator. */ function updateTransferTaxRate(uint16 _transferTaxRate) public onlyOperator { require(_transferTaxRate <= MAXIMUM_TRANSFER_TAX_RATE, "updateTransferTaxRate: Transfer tax rate must not exceed the maximum rate."); emit TransferTaxRateUpdated(msg.sender, transferTaxRate, _transferTaxRate); transferTaxRate = _transferTaxRate; }
receive() external payable {} /** * @dev Update the transfer tax rate. * Can only be called by the current operator. */ function updateTransferTaxRate(uint16 _transferTaxRate) public onlyOperator { require(_transferTaxRate <= MAXIMUM_TRANSFER_TAX_RATE, "updateTransferTaxRate: Transfer tax rate must not exceed the maximum rate."); emit TransferTaxRateUpdated(msg.sender, transferTaxRate, _transferTaxRate); transferTaxRate = _transferTaxRate; }
19,464
5
// return The address of the proxy admin. /
function admin() external ifAdmin returns (address) { return _admin(); }
function admin() external ifAdmin returns (address) { return _admin(); }
10,663
10
// Gets the size of the validator set that must sign the given block number. blockNumber Block number to retrieve the validator set from.return Size of the validator set. /
function numberValidatorsInSet(uint256 blockNumber) public view returns (uint256) { bytes memory out; bool success; (success, out) = NUMBER_VALIDATORS.staticcall(abi.encodePacked(blockNumber)); require(success, "error calling numberValidatorsInSet precompile"); return getUint256FromBytes(out, 0); }
function numberValidatorsInSet(uint256 blockNumber) public view returns (uint256) { bytes memory out; bool success; (success, out) = NUMBER_VALIDATORS.staticcall(abi.encodePacked(blockNumber)); require(success, "error calling numberValidatorsInSet precompile"); return getUint256FromBytes(out, 0); }
25,870
90
// Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address. /
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount);
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount);
16,543
9
// set metadata
metadata[tokenId] = _metadata; super._safeMint(to, tokenId); super._setTokenURI(tokenId, tokenUri);
metadata[tokenId] = _metadata; super._safeMint(to, tokenId); super._setTokenURI(tokenId, tokenUri);
23,754
12
// No new deposits 20 minutes before next restart, you should withdraw the prize
require(getStageStartTime(stage+1) >= now + MAX_IDLE_TIME); addDeposit(msg.sender, msg.value);
require(getStageStartTime(stage+1) >= now + MAX_IDLE_TIME); addDeposit(msg.sender, msg.value);
49,619
97
// 3. Now we create array in memory
Goal[] memory goalBasicInfos = new Goal[](arrayLength); uint256 index; for (uint256 i; i < friends.length; i++) { uint256[] memory friendGoalIds = userToGoalIds[friends[i]]; for (uint256 j; j < friendGoalIds.length; j++) { if (isVotingStatus(friendGoalIds[j], votingStatus)) { goalBasicInfos[index] = goalIdToGoal[friendGoalIds[j]];
Goal[] memory goalBasicInfos = new Goal[](arrayLength); uint256 index; for (uint256 i; i < friends.length; i++) { uint256[] memory friendGoalIds = userToGoalIds[friends[i]]; for (uint256 j; j < friendGoalIds.length; j++) { if (isVotingStatus(friendGoalIds[j], votingStatus)) { goalBasicInfos[index] = goalIdToGoal[friendGoalIds[j]];
21,796
3
// Returns the amount of tokens in existence. /
function totalSupply() external view returns (uint256);
function totalSupply() external view returns (uint256);
1,581
16
// The fee as a percentage of the cash traded given to the protocol
uint128 public G_TRANSACTION_FEE;
uint128 public G_TRANSACTION_FEE;
32,503
18
// event for new registered node
event NewNode(address indexed node, string nodeUrl);
event NewNode(address indexed node, string nodeUrl);
49,252
20
// return Balance of vested token per beneficiary for a specific period (in terms of a 31-day-month) /
function balanceOfVestingForPeriod(address beneficiary, uint256 period) public view returns (uint256) { return _vestedBalances[period][beneficiary]; }
function balanceOfVestingForPeriod(address beneficiary, uint256 period) public view returns (uint256) { return _vestedBalances[period][beneficiary]; }
36,621
23
// Get the original Element Merkle Root, given an index, a bytes32 element, and a Single Proof
function get_root_from_single_proof( uint256 index, bytes32 element, bytes32[] calldata proof
function get_root_from_single_proof( uint256 index, bytes32 element, bytes32[] calldata proof
14,168
295
// called when token is deposited on root chain Should be callable only by ChildChainManagerShould handle deposit by minting the required tokenId for userMake sure minting is done only by this function user user address for whom deposit is being done depositData abi encoded tokenId /
function deposit(address user, bytes calldata depositData) external;
function deposit(address user, bytes calldata depositData) external;
75,560
184
// Miscellaneous events
event VersionChanged(address indexed seller, uint256 version); event AltSignerChanged(address newSigner); event BalanceWithdrawn(uint256 balance); event RoyaltyUpdated(uint256 bps); event RevenueShareUpdated(address address1, address address2, uint256 bps1, uint256 bps2);
event VersionChanged(address indexed seller, uint256 version); event AltSignerChanged(address newSigner); event BalanceWithdrawn(uint256 balance); event RoyaltyUpdated(uint256 bps); event RevenueShareUpdated(address address1, address address2, uint256 bps1, uint256 bps2);
41,786
11
// Actual gas after execution
uint remainingGasEnd = gasleft();
uint remainingGasEnd = gasleft();
28,515
25
// unstake all users
while (userList.length > 0) { _unstake(userList[0]); }
while (userList.length > 0) { _unstake(userList[0]); }
14,638
29
// Returns the address currently assigned ownership of a given lock./Required for ERC-721 compliance.
function ownerOf(uint256 _tokenId) external view returns (address owner)
function ownerOf(uint256 _tokenId) external view returns (address owner)
41,559
3
// deposits ERC20 in portal contract and create tokens in L2/_ERC20 address of ERC20 token to be deposited/_L1Sender address on L1 that authorized the transaction/_L2receivers array with receivers addresses/_amounts array of amounts of ether to be distributed/_data information to be interpreted by L2/ return hash of input generated by deposit/ receivers[i] receive amounts[i]
function erc20Deposit( address _ERC20, address _L1Sender, address[] calldata _L2receivers, uint256[] calldata _amounts, bytes calldata _data ) external returns (bytes32);
function erc20Deposit( address _ERC20, address _L1Sender, address[] calldata _L2receivers, uint256[] calldata _amounts, bytes calldata _data ) external returns (bytes32);
18,977
11
// Validate syntactically invalid statements number
require(syntInvalidNum <= statementsNum);
require(syntInvalidNum <= statementsNum);
14,149
9
// Returns the revenue share of `_stakeholder` for ledger `_ledger` See {setRevenueSplit} /
function getRevenueSplit(address _ledger, address payable _stakeholder, bool _retail) external view returns (uint256 share);
function getRevenueSplit(address _ledger, address payable _stakeholder, bool _retail) external view returns (uint256 share);
32,728
11
// This function creates a unique landId using its properties
function computeIdLand(string memory landAddress, string memory city, string memory country, string memory pincode) public pure returns(uint){ return uint(keccak256(abi.encodePacked(landAddress, city, country, pincode)))%1000000000; }
function computeIdLand(string memory landAddress, string memory city, string memory country, string memory pincode) public pure returns(uint){ return uint(keccak256(abi.encodePacked(landAddress, city, country, pincode)))%1000000000; }
11,634
5
// Emitted when a `roleId` is revoked from `account` by `admin`. /
event RemoveAssignment(
event RemoveAssignment(
19,127
52
// Gets the owner of the specified token ID _tokenId uint256 ID of the token to query the owner ofreturn owner address currently marked as the owner of the given token ID /
function ownerOf(uint256 _tokenId) public view returns (address) { address owner = tokenOwner[_tokenId]; require(owner != address(0)); return owner; }
function ownerOf(uint256 _tokenId) public view returns (address) { address owner = tokenOwner[_tokenId]; require(owner != address(0)); return owner; }
8,540
56
// If the next bucket is expired, that's the new start index
if (escrow.expiration >= block.timestamp) { break; }
if (escrow.expiration >= block.timestamp) { break; }
19,772
192
// Change prices of NFT
function setPartnerPrice(uint256 __price) public onlyOwner { pricePartner = __price; }
function setPartnerPrice(uint256 __price) public onlyOwner { pricePartner = __price; }
12,681
36
// If the TransferRoot was never bonded, distribute the TransferRoot.
TransferBond storage transferBond = transferBonds[transferRootId]; if (transferBond.createdAt == 0) { _distributeTransferRoot(rootHash, destinationChainId, totalAmount); }
TransferBond storage transferBond = transferBonds[transferRootId]; if (transferBond.createdAt == 0) { _distributeTransferRoot(rootHash, destinationChainId, totalAmount); }
50,548
0
// state machine
enum Stages { Initialization, MintPass, MintPassEnded, AllowList, AllowListEnded, PublicSale, PublicSaleEnded, Redeem, Finished }
enum Stages { Initialization, MintPass, MintPassEnded, AllowList, AllowListEnded, PublicSale, PublicSaleEnded, Redeem, Finished }
18,292
126
// Minting fee for issuing the pynths. Default 50 bips.
uint256 public issueFeeRate = (5 * SafeDecimalMath.unit()) / 1000;
uint256 public issueFeeRate = (5 * SafeDecimalMath.unit()) / 1000;
50,030
203
// The ```RepayAssetWithCollateral``` event is emitted whenever ```repayAssetWithCollateral()``` is invoked/_borrower The borrower account for which the repayment is taking place/_swapperAddress The address of the whitelisted swapper to use for token swaps/_collateralToSwap The amount of Collateral Token to swap and use for repayment/_amountAssetOut The amount of Asset Token which was repaid/_sharesRepaid The number of Borrow Shares which were repaid
event RepayAssetWithCollateral( address indexed _borrower, address _swapperAddress, uint256 _collateralToSwap, uint256 _amountAssetOut, uint256 _sharesRepaid );
event RepayAssetWithCollateral( address indexed _borrower, address _swapperAddress, uint256 _collateralToSwap, uint256 _amountAssetOut, uint256 _sharesRepaid );
16,800
65
// Returns how much fyToken would be required to buy `tokenOut` base./tokenOut Amount of base hypothetically desired./ return Amount of fyToken hypothetically required.
function buyBasePreview(uint128 tokenOut) external view override returns(uint128)
function buyBasePreview(uint128 tokenOut) external view override returns(uint128)
7,137
4
// method to send Ether 3: address.call => forward all gas, returns bool Which method should you use?call in combination with re-entrancy guard is the recommended method to use after December 2019. Guard against re-entrancy by making all state changesbefore calling other contracts using re-entrancy guard modifier
function callEth(address payable receiver) public payable { // call method returns bool and bytes memory // The empty argument triggers the fallback function of the receiving address. (bool isSent, ) = receiver.call{gas: 10000, value : msg.value}(""); require(isSent); }
function callEth(address payable receiver) public payable { // call method returns bool and bytes memory // The empty argument triggers the fallback function of the receiving address. (bool isSent, ) = receiver.call{gas: 10000, value : msg.value}(""); require(isSent); }
11,813
103
// Boolean variable to know whether rewards tokens are allocated or not.
bool public isRewardsTokensAllocated;
bool public isRewardsTokensAllocated;
12,423
11
// Save the official(finalValue), timestamp of it, 5 miners and their submitted values for it, and its block number
_request.finalValues[_timeOfLastNewValue] = a[2].value; _request.requestTimestamps.push(_timeOfLastNewValue);
_request.finalValues[_timeOfLastNewValue] = a[2].value; _request.requestTimestamps.push(_timeOfLastNewValue);
17,486
30
// Add user's compliancy data for current or past periods. _updateIterationCount The number defining the max for how much compliancedata will be passed in a single function call to prevent out-of-gas errors. _wasCompliant The boolean array to indicate compliancy. /
function addWasCompliantDataForUsers( uint256 _updateIterationCount, bool[] memory _wasCompliant ) public isJuriNetwork atStage(Stages.AWAITING_COMPLIANCE_DATA)
function addWasCompliantDataForUsers( uint256 _updateIterationCount, bool[] memory _wasCompliant ) public isJuriNetwork atStage(Stages.AWAITING_COMPLIANCE_DATA)
13,250
4
// Add or update price feed for assets pair. For only the admin role. assetA The first currency within the currency pair quotation (the base currency). assetB The second currency within the currency pair quotation (the quote currency). priceFeed The chain link price feed address for the pair assetA/assetB /
function updatePriceFeed(address assetA, address assetB, address priceFeed) external;
function updatePriceFeed(address assetA, address assetB, address priceFeed) external;
30,462
21
// delete point on map and messagery
assert(tellerStorage.isOnline(msg.sender)); tellerStorage.turnOffline(msg.sender); DeleteTeller(msg.sender);
assert(tellerStorage.isOnline(msg.sender)); tellerStorage.turnOffline(msg.sender); DeleteTeller(msg.sender);
29,645
1
// Thrown when two related arrays have different lengths/
error ARRAY_LENGTH_MISMATCH();
error ARRAY_LENGTH_MISMATCH();
27,501
38
// how much value we must send to beneficiary
uint value = tokens * price;
uint value = tokens * price;
11,070
424
// Reads the uint8 at `cdPtr` in calldata.
function readUint8( CalldataPointer cdPtr
function readUint8( CalldataPointer cdPtr
23,549
0
// Mapping from a minigame's key to it's factory's address
mapping(string => address) public minigameFactories;
mapping(string => address) public minigameFactories;
19,199
193
// Ethermon payment
address public convertorContract; mapping (address => bool) public frozenAccount; event FrozenFunds(address target, bool frozen);
address public convertorContract; mapping (address => bool) public frozenAccount; event FrozenFunds(address target, bool frozen);
43,256
81
// Если уже создали токены для первой стадии, делаем откат
require(!isFirstStageTokensMinted); uint tokenMultiplier = 10 ** token.decimals(); token.mintToAddress(firstStageTotalSupply.mul(tokenMultiplier), address(this)); isFirstStageTokensMinted = true;
require(!isFirstStageTokensMinted); uint tokenMultiplier = 10 ** token.decimals(); token.mintToAddress(firstStageTotalSupply.mul(tokenMultiplier), address(this)); isFirstStageTokensMinted = true;
36,175
37
// function withdrawableETH(uint256 amount) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
21,373
104
// oracle deviation value (1e27)
uint256 internal oracleDeviation;
uint256 internal oracleDeviation;
67,470
34
// count of confirmations needed
uint yetNeeded;
uint yetNeeded;
31,022
162
// global restriction for claims
uint256 internal _lastClaimedTime; uint256 internal _lastClaimedAmount;
uint256 internal _lastClaimedTime; uint256 internal _lastClaimedAmount;
37,434
10
// Bytes16
function getBytes16(bytes32 _key) public view returns (bytes16); function setBytes16(bytes32 _key, bytes16 _value) public; function deleteBytes16(bytes32 _key) public;
function getBytes16(bytes32 _key) public view returns (bytes16); function setBytes16(bytes32 _key, bytes16 _value) public; function deleteBytes16(bytes32 _key) public;
5,344
72
// The LBT pricing mechanism for the conversion
ILiquidityBasedTWAP public lbt;
ILiquidityBasedTWAP public lbt;
19,879
113
// Modify a SAFE's collateralization ratio while keeping the generated COIN or collateral freed in the SAFE handler address./manager address - Safe Manager/safe uint - Safe Id/deltaCollateral - int/deltaDebt - int
function modifySAFECollateralization( address manager, uint safe, int deltaCollateral, int deltaDebt
function modifySAFECollateralization( address manager, uint safe, int deltaCollateral, int deltaDebt
54,805
11
// sync removed assets
address[] memory removedBridgeAssets = siloRepository.getRemovedBridgeAssets(); for (uint256 i = 0; i < removedBridgeAssets.length; i++) {
address[] memory removedBridgeAssets = siloRepository.getRemovedBridgeAssets(); for (uint256 i = 0; i < removedBridgeAssets.length; i++) {
26,843
5
// require(owner == msg.sender);
Score score = Score.Negative; emit LogReputationFact(pointNum, repNum, uint(score), fact);
Score score = Score.Negative; emit LogReputationFact(pointNum, repNum, uint(score), fact);
37,093
82
// --- INTERNAL METHODS --- / override
function getMinimumContribution() public view returns(uint) { if (currentState == State.Preico1 || currentState == State.Preico2) { return MIMIMUM_CONTRIBUTION_AMOUNT_PREICO; } if (uint(currentState) >= uint(State.Ico1) && uint(currentState) <= uint(State.Ico6)) { return MIMIMUM_CONTRIBUTION_AMOUNT_ICO; } if (isPrivateIcoActive()) { return privateIcoMinimumContribution; } return 0; }
function getMinimumContribution() public view returns(uint) { if (currentState == State.Preico1 || currentState == State.Preico2) { return MIMIMUM_CONTRIBUTION_AMOUNT_PREICO; } if (uint(currentState) >= uint(State.Ico1) && uint(currentState) <= uint(State.Ico6)) { return MIMIMUM_CONTRIBUTION_AMOUNT_ICO; } if (isPrivateIcoActive()) { return privateIcoMinimumContribution; } return 0; }
52,349
159
// Deposit LP tokens to AcornMaster for Acorn allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.acccakePerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeAcornTransfer(msg.sender, pending); } } if (_amount > 0) { pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); if (pool.depositFeeBP > 0) { uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000); pool.lpToken.safeTransfer(feeAddress, depositFee); user.amount = user.amount.add(_amount).sub(depositFee); } else { user.amount = user.amount.add(_amount); } } user.rewardDebt = user.amount.mul(pool.acccakePerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); }
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.acccakePerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeAcornTransfer(msg.sender, pending); } } if (_amount > 0) { pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); if (pool.depositFeeBP > 0) { uint256 depositFee = _amount.mul(pool.depositFeeBP).div(10000); pool.lpToken.safeTransfer(feeAddress, depositFee); user.amount = user.amount.add(_amount).sub(depositFee); } else { user.amount = user.amount.add(_amount); } } user.rewardDebt = user.amount.mul(pool.acccakePerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); }
3,638
13
// total CULT used for purchase land
uint256 public totalCultUsedForPurchase; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event AdminUpdated(address newAdmin); function initialize( IERC20Upgradeable _cult, address _adminAddress,
uint256 public totalCultUsedForPurchase; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event AdminUpdated(address newAdmin); function initialize( IERC20Upgradeable _cult, address _adminAddress,
58,980
8
// Executes actions and returns tokens to account.Uses CHI tokens previously approved by the msg.sender. data TransactionData struct with the following elements:- actions Array of actions to be executed.- inputs Array of tokens to be taken from the signer of this data.- fee Fee struct with fee details.- requiredOutputs Array of requirements for the returned tokens.- account Address of the account that will receive the returned tokens.- salt Number that makes this data unique. signature EIP712-compatible signature of data.return Array of AbsoluteTokenAmount structs with the returned tokens. This function uses CHI token to refund some gas. /
function executeWithCHI(TransactionData memory data, bytes memory signature) public payable useCHI returns (AbsoluteTokenAmount[] memory)
function executeWithCHI(TransactionData memory data, bytes memory signature) public payable useCHI returns (AbsoluteTokenAmount[] memory)
29,475
63
// Processes a new offer to a direct listing.
function handleOffer(Listing memory _targetListing, Offer memory _newOffer) internal { require( _newOffer.quantityWanted <= _targetListing.quantity && _targetListing.quantity > 0, "insufficient tokens in listing." ); validateERC20BalAndAllowance( _newOffer.offeror, _newOffer.currency, _newOffer.pricePerToken * _newOffer.quantityWanted ); offers[_targetListing.listingId][_newOffer.offeror] = _newOffer; emit NewOffer( _targetListing.listingId, _newOffer.offeror, _targetListing.listingType, _newOffer.quantityWanted, _newOffer.pricePerToken * _newOffer.quantityWanted, _newOffer.currency ); }
function handleOffer(Listing memory _targetListing, Offer memory _newOffer) internal { require( _newOffer.quantityWanted <= _targetListing.quantity && _targetListing.quantity > 0, "insufficient tokens in listing." ); validateERC20BalAndAllowance( _newOffer.offeror, _newOffer.currency, _newOffer.pricePerToken * _newOffer.quantityWanted ); offers[_targetListing.listingId][_newOffer.offeror] = _newOffer; emit NewOffer( _targetListing.listingId, _newOffer.offeror, _targetListing.listingType, _newOffer.quantityWanted, _newOffer.pricePerToken * _newOffer.quantityWanted, _newOffer.currency ); }
3,503
29
// See if we need to update because answer is stale or outside deviation. Time since answer was last updated.
uint256 timeDeltaCurrentAnswer = block.timestamp - observations[_currentIndex].timestamp; uint256 timeDeltaSincePreviousObservation = block.timestamp - observations[_getPreviousIndex(_currentIndex, _observationsLength)].timestamp; uint64 _heartbeat = heartbeat; if ( timeDeltaCurrentAnswer >= _heartbeat || timeDeltaSincePreviousObservation >= _heartbeat || sharePrice > _answer.mulDivDown(1e4 + deviationTrigger, 1e4) || sharePrice < _answer.mulDivDown(1e4 - deviationTrigger, 1e4)
uint256 timeDeltaCurrentAnswer = block.timestamp - observations[_currentIndex].timestamp; uint256 timeDeltaSincePreviousObservation = block.timestamp - observations[_getPreviousIndex(_currentIndex, _observationsLength)].timestamp; uint64 _heartbeat = heartbeat; if ( timeDeltaCurrentAnswer >= _heartbeat || timeDeltaSincePreviousObservation >= _heartbeat || sharePrice > _answer.mulDivDown(1e4 + deviationTrigger, 1e4) || sharePrice < _answer.mulDivDown(1e4 - deviationTrigger, 1e4)
6,383
100
// Mints 2500 Unity Token to treasury, 2000 for airdrop and 500 for meme contest
treasury = _treasury; _mint(treasury, 100000 ether);
treasury = _treasury; _mint(treasury, 100000 ether);
15,780
5
// Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions. phaseClaim condition to set. resetClaimEligibilityWhether to honor the restrictions applied to wallets who have claimed tokens in the current conditions, in the new claim conditions being set. /
function setClaimConditions(ClaimCondition calldata phase, bool resetClaimEligibility) external;
function setClaimConditions(ClaimCondition calldata phase, bool resetClaimEligibility) external;
25,815
39
// Internal transfer, only can be called by this contract /
function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to].add(_value) > balanceOf[_to]); // Check for overflows require(!frozenAccount[_from]); // Check if sender is frozen require(!frozenAccount[_to]); // Check if recipient is frozen balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient emit Transfer(_from, _to, _value); }
function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to].add(_value) > balanceOf[_to]); // Check for overflows require(!frozenAccount[_from]); // Check if sender is frozen require(!frozenAccount[_to]); // Check if recipient is frozen balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient emit Transfer(_from, _to, _value); }
9,798
0
// The administrator of the contract
address private owner;
address private owner;
72,165
34
// EVENTS
event SaleCreated(uint256 tokenID, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 startedAt); event TeamSaleCreated(uint256[9] tokenIDs, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 startedAt); event SaleWinner(uint256 tokenID, uint256 totalPrice, address winner); event TeamSaleWinner(uint256[9] tokenIDs, uint256 totalPrice, address winner); event SaleCancelled(uint256 tokenID, address sellerAddress); event EtherWithdrawed(uint256 value);
event SaleCreated(uint256 tokenID, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 startedAt); event TeamSaleCreated(uint256[9] tokenIDs, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 startedAt); event SaleWinner(uint256 tokenID, uint256 totalPrice, address winner); event TeamSaleWinner(uint256[9] tokenIDs, uint256 totalPrice, address winner); event SaleCancelled(uint256 tokenID, address sellerAddress); event EtherWithdrawed(uint256 value);
44,864
545
// Computes the nameHash and versionHash
constructor( string memory name_, string memory symbol_, string memory version_
constructor( string memory name_, string memory symbol_, string memory version_
12,012
19
// Checks if an airline has already voted for another airline to be included_airlineAddress the address to be included_voterAddress the voter/
function voted(address _airlineAddress, address _voterAddress)
function voted(address _airlineAddress, address _voterAddress)
32,801
67
// Invoke mint from the SetToken. Mints the specified cToken from the underlying of the specified notional quantity /
function invokeMintCToken(ISetToken _setToken, ICErc20 _cToken, uint256 _mintNotional) external { ( , , bytes memory mintCTokenCalldata) = getMintCTokenCalldata(_cToken, _mintNotional); require( abi.decode(_setToken.invoke(address(_cToken), 0, mintCTokenCalldata), (uint256)) == 0, "Mint failed" ); }
function invokeMintCToken(ISetToken _setToken, ICErc20 _cToken, uint256 _mintNotional) external { ( , , bytes memory mintCTokenCalldata) = getMintCTokenCalldata(_cToken, _mintNotional); require( abi.decode(_setToken.invoke(address(_cToken), 0, mintCTokenCalldata), (uint256)) == 0, "Mint failed" ); }
2,720
53
// Work on a (potentially new) position. Optionally send ETH back to Bank. 持仓工作, 可能会发送eth到bank.
function work(uint256 id, address user, uint256 debt, bytes calldata data) external payable;
function work(uint256 id, address user, uint256 debt, bytes calldata data) external payable;
18,627
35
// Set allowance for other address and notify Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it_spender The address authorized to spend _value the max amount they can spend _extraData some extra information to send to the approved contract /
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public onlyOwner returns (bool success)
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public onlyOwner returns (bool success)
7,174
191
// from remove automaticLockup from address/
function automaticLockupRemove( address from ) public onlyOwner()
function automaticLockupRemove( address from ) public onlyOwner()
26,271