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
192
// Updates the amount of rewards owed for each user before any tokens are moved TODO: revert for an non existing user?
function updateReward( address _user ) public
function updateReward( address _user ) public
46,271
22
// Rescue ERC721 assets sent directly to this contract. /
function withdrawForeignERC721(address tokenContract, uint256 tokenId) public onlyOwner { IERC721(tokenContract).safeTransferFrom(address(this), owner, tokenId); }
function withdrawForeignERC721(address tokenContract, uint256 tokenId) public onlyOwner { IERC721(tokenContract).safeTransferFrom(address(this), owner, tokenId); }
45,163
78
// Repay debt by selling base in a pool and using the resulting fyToken/ The base tokens need to be already in the pool, unaccounted for./ Only before maturity. After maturity use close.
function repay(bytes12 vaultId_, address to, int128 ink, uint128 min) external payable returns (uint128 art)
function repay(bytes12 vaultId_, address to, int128 ink, uint128 min) external payable returns (uint128 art)
64,109
57
// Additional non fungible properties of a Hedera Token.
struct NonFungibleTokenInfo { /// The shared hedera token info TokenInfo tokenInfo; /// The serial number of the nft int64 serialNumber; /// The account id specifying the owner of the non fungible token address ownerId; /// The epoch second at which the tok...
struct NonFungibleTokenInfo { /// The shared hedera token info TokenInfo tokenInfo; /// The serial number of the nft int64 serialNumber; /// The account id specifying the owner of the non fungible token address ownerId; /// The epoch second at which the tok...
15,763
17
// ...
24,581
3
// @inheritdoc IFractionalToken
uint256 public override nav;
uint256 public override nav;
19,110
308
// Calculates new ranges for orders and calls `vault.rebalance()`so that vault can update its positions. Can only be called by keeper. /
function rebalance(address _vault) external override { require(shouldRebalance(_vault), "cannot rebalance"); vaultData storage _data = vaultStrategyData[_vault]; int24 tick = getTick(_data.pool); int24 tickFloor = _floor(tick, _data.tickSpacing); int24 tickCeil = tickFloor +...
function rebalance(address _vault) external override { require(shouldRebalance(_vault), "cannot rebalance"); vaultData storage _data = vaultStrategyData[_vault]; int24 tick = getTick(_data.pool); int24 tickFloor = _floor(tick, _data.tickSpacing); int24 tickCeil = tickFloor +...
10,237
253
// Put an evil address into blacklist
function blacklistAddress(address userAddress) public { require(hasRole(MANAGER_ROLE, msg.sender), "only manager"); _beneficiaryAllocations[userAddress].blackListed = true; }
function blacklistAddress(address userAddress) public { require(hasRole(MANAGER_ROLE, msg.sender), "only manager"); _beneficiaryAllocations[userAddress].blackListed = true; }
11,046
101
// Important for security - any address without masterContract has address(0) as masterContract So approving address(0) would approve every address, leading to full loss of funds Also, ecrecover returns address(0) on failure. So we check this:
require(user != address(0), "MasterCMgr: User cannot be 0");
require(user != address(0), "MasterCMgr: User cannot be 0");
4,734
32
// Initiate the subscription struct
setSubscription( providerAddress, msg.sender, endpoint, blocks, uint96(block.number), uint96(block.number) + uint96(blocks) ); emit DataPurchase(
setSubscription( providerAddress, msg.sender, endpoint, blocks, uint96(block.number), uint96(block.number) + uint96(blocks) ); emit DataPurchase(
23,422
5
// The mapping between release and build numbers.
mapping(uint8 => uint16) internal buildsPerRelease;
mapping(uint8 => uint16) internal buildsPerRelease;
8,174
66
// Make a request to refresh a submissionDuration. Paying the full deposit right away is not required as it can be crowdfunded later. Note that the user can reapply even when current submissionDuration has not expired, but only after the start of renewal period._evidence A link to evidence using its URI. /
function reapplySubmission(string calldata _evidence, string calldata _name, string calldata _bio) external payable { Submission storage submission = submissions[msg.sender]; require(submission.registered && submission.status == Status.None, "Wrong status"); uint renewalAvailableAt = submiss...
function reapplySubmission(string calldata _evidence, string calldata _name, string calldata _bio) external payable { Submission storage submission = submissions[msg.sender]; require(submission.registered && submission.status == Status.None, "Wrong status"); uint renewalAvailableAt = submiss...
29,786
102
// Alley Hour taxes
uint256 private _alleyHourStartTimestamp = 0; CustomTaxPeriod private _alley1 = CustomTaxPeriod('alley1',0,3600,1,3,0,5,0,5,0,2,0,4,1,6); CustomTaxPeriod private _alley2 = CustomTaxPeriod('alley2',0,3600,1,1,0,3,0,3,0,1,1,3,2,4); uint256 private _blockedTimeLimit = 86400; mapping (address => bool) private _isExcl...
uint256 private _alleyHourStartTimestamp = 0; CustomTaxPeriod private _alley1 = CustomTaxPeriod('alley1',0,3600,1,3,0,5,0,5,0,2,0,4,1,6); CustomTaxPeriod private _alley2 = CustomTaxPeriod('alley2',0,3600,1,1,0,3,0,3,0,1,1,3,2,4); uint256 private _blockedTimeLimit = 86400; mapping (address => bool) private _isExcl...
11,193
1
// Super token that may be streamed to this contract
ISuperToken internal immutable _acceptedToken;
ISuperToken internal immutable _acceptedToken;
27,987
1
// Emit an event when the contract configuration is updated. /
event ContractConfigUpdated( uint256 maxSupply, address royalties, address beneficiary, string baseURI, string contractURI );
event ContractConfigUpdated( uint256 maxSupply, address royalties, address beneficiary, string baseURI, string contractURI );
11,911
72
// Put the royalty info on the stack for more efficient access.
RoyaltyInfo storage info = _royaltyInfo;
RoyaltyInfo storage info = _royaltyInfo;
26,988
9
// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
struct ReserveData { //stores the reserve configuration ReserveConfigurationMap configuration; //the liquidity index. Expressed in ray uint128 liquidityIndex; //variable borrow index. Expressed in ray uint128 variableBorrowIndex; //the current supply rate. Exp...
struct ReserveData { //stores the reserve configuration ReserveConfigurationMap configuration; //the liquidity index. Expressed in ray uint128 liquidityIndex; //variable borrow index. Expressed in ray uint128 variableBorrowIndex; //the current supply rate. Exp...
4,263
115
// And the specified start time has not yet come If initialization return an error, check the start date!
require(now <= startTime); initialization(); emit Initialized(); renewal = 0; isInitialized = true;
require(now <= startTime); initialization(); emit Initialized(); renewal = 0; isInitialized = true;
78,493
37
// add to pairs for taxes.
pairs[pair] = true; _balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply);
pairs[pair] = true; _balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply);
8,348
2
// Empty baseURI is allowed
baseURI = _baseURI;
baseURI = _baseURI;
37,267
0
// Events emitted by a pool/Contains all events emitted by the pool
interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the...
interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the...
1,925
11
// convert expiry to a readable string
(uint256 year, uint256 month, uint256 day) = BokkyPooBahsDateTimeLibrary.timestampToDate(expiryTimestamp);
(uint256 year, uint256 month, uint256 day) = BokkyPooBahsDateTimeLibrary.timestampToDate(expiryTimestamp);
43,273
55
// change crowdsale ETH rate newRate Figure that corresponds to the new ETH rate per token /
function setRate(uint256 newRate) external onlyOwner { require(isWeiAccepted, "Sale must allow Wei for purchases to set a rate for Wei!"); require(newRate != 0, "ETH rate must be more than 0!"); emit TokenRateChanged(rate, newRate); rate = newRate; }
function setRate(uint256 newRate) external onlyOwner { require(isWeiAccepted, "Sale must allow Wei for purchases to set a rate for Wei!"); require(newRate != 0, "ETH rate must be more than 0!"); emit TokenRateChanged(rate, newRate); rate = newRate; }
16,039
9
// this will be an array of ids but for now just doing one for simplicity
uint256[5] ids; address owner;
uint256[5] ids; address owner;
26,524
177
// event EquityWithdrawn(address asset, uint equityAvailableBefore, uint amount, address owner)
emit EquityWithdrawn(asset, equity, amount, admin); return uint(Error.NO_ERROR); // success
emit EquityWithdrawn(asset, equity, amount, admin); return uint(Error.NO_ERROR); // success
37,665
116
// Internal invoke call, /operationHash The hash of the operation/data The data to send to the `call()` operation/The data is prefixed with a global 1 byte revert flag/If revert is 1, then any revert from a `call()` operation is rethrown./Otherwise, the error is recorded in the `result` field of the `InvocationSuccess`...
function internalInvoke(bytes32 operationHash, bytes data) internal { // keep track of the number of operations processed uint256 numOps; // keep track of the result of each operation as a bit uint256 result; // We need to store a reference to this string as a variable so we...
function internalInvoke(bytes32 operationHash, bytes data) internal { // keep track of the number of operations processed uint256 numOps; // keep track of the result of each operation as a bit uint256 result; // We need to store a reference to this string as a variable so we...
6,113
113
// Given amountB, which amountA is required such that amountB / amountA is equal to the ratioamountA := amountBInTokenAratio /
function tokenAForTokenB( uint256 amountB, uint256 ratio, uint256 rate, uint256 sFactorA, uint256 sFactorB
function tokenAForTokenB( uint256 amountB, uint256 ratio, uint256 rate, uint256 sFactorA, uint256 sFactorB
24,813
27
// Set original owner
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
1,662
10
// Next, set the caller as the argument.
mstore(ChannelClosed_channel_ptr, caller())
mstore(ChannelClosed_channel_ptr, caller())
11,542
131
// id of this contract for metadata server
uint public contractId;
uint public contractId;
39,129
75
// Function that returns NFT's pending rewards
function pendingRewards(uint _NFT) public view returns(uint) { NFT storage nft = NFTDetails[_NFT]; uint256 _accNfyPerShare = accNfyPerShare; if (block.number > lastRewardBlock && totalStaked != 0) { uint256 blocksToReward = block.number.sub(lastRewardBlock); uint256...
function pendingRewards(uint _NFT) public view returns(uint) { NFT storage nft = NFTDetails[_NFT]; uint256 _accNfyPerShare = accNfyPerShare; if (block.number > lastRewardBlock && totalStaked != 0) { uint256 blocksToReward = block.number.sub(lastRewardBlock); uint256...
35,376
187
// Increase required energy
energyRequired = (totalSupply()**energyIncreaseExponent) * energyIncreaseConstant;
energyRequired = (totalSupply()**energyIncreaseExponent) * energyIncreaseConstant;
43,332
3
// get BillDetails at index _index Index of BillDetails to look up /
function getBillDetails(uint256 _index) external view override returns (BillDetails memory) { require(_index < totalBills(), "index out of bounds"); return billDetails[_index]; }
function getBillDetails(uint256 _index) external view override returns (BillDetails memory) { require(_index < totalBills(), "index out of bounds"); return billDetails[_index]; }
27,691
41
// Transfers `amount` tokens from `sender` to `recipient`. sender The account to transfer tokens from. recipient The account to transfer tokens to. amount The amount of tokens to transfer. /
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(amount > 0, 'ERC20: transfer amount zero'); require(sender != address(0), 'ERC20: transfer from the zero address'); require(recipient != address(0), 'ERC20: transfer to the zero address'); uint256 senderB...
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(amount > 0, 'ERC20: transfer amount zero'); require(sender != address(0), 'ERC20: transfer from the zero address'); require(recipient != address(0), 'ERC20: transfer to the zero address'); uint256 senderB...
31,845
3
// view reads blockchain!
function retrieve() public view returns(uint256) { return favouriteNumber; }
function retrieve() public view returns(uint256) { return favouriteNumber; }
30,534
236
// Checks that current Hf < 1
isLiquidatable = twvUSD < borrowAmountPlusInterestRateUSD;
isLiquidatable = twvUSD < borrowAmountPlusInterestRateUSD;
20,741
22
// emergency withdraw to allow removing unrefined without no care for the refined amount
bool public emergencyActivated;
bool public emergencyActivated;
78,834
151
// update share
uint lusdValue = LUSD.balanceOf(address(this)); (bool succ, uint colValue) = getCollateralValue(); require(succ, "deposit: chainlink is down"); uint totalValue = lusdValue.add(colValue);
uint lusdValue = LUSD.balanceOf(address(this)); (bool succ, uint colValue) = getCollateralValue(); require(succ, "deposit: chainlink is down"); uint totalValue = lusdValue.add(colValue);
28,504
14
// Emitted when an inflation mint call is executed successfully./grgAmount Amount of GRG tokens minted to the staking proxy.
event GrgMintEvent(uint256 grgAmount);
event GrgMintEvent(uint256 grgAmount);
25,067
139
// Airdrop tokens to all holders that are included from reward.Requirements:- the caller must have a balance of at least `amount`. /
function airdrop(uint256 amount) public { address sender = _msgSender(); //require(!_isExcludedFromReward[sender], "Excluded addresses cannot call this function"); require(balanceOf(sender) >= amount, "The caller must have balance >= amount."); ValuesFromAmount memory values = _getVa...
function airdrop(uint256 amount) public { address sender = _msgSender(); //require(!_isExcludedFromReward[sender], "Excluded addresses cannot call this function"); require(balanceOf(sender) >= amount, "The caller must have balance >= amount."); ValuesFromAmount memory values = _getVa...
12,994
17
// set a new ipfs hash for token /
function setIPFSHash(uint256 id, string calldata ipfsHash) external { require(ERC721.ownerOf(id) == _msgSender(), "only owner can set ipfs"); areas[id].ipfs = ipfsHash; }
function setIPFSHash(uint256 id, string calldata ipfsHash) external { require(ERC721.ownerOf(id) == _msgSender(), "only owner can set ipfs"); areas[id].ipfs = ipfsHash; }
64,291
2
// address _treasury_token, erc20 token used to mint/burn
uint _numOfTeams, uint _exchangeRate ) ERC1155Base( _defaultAdmin, _name, _symbol, _royaltyRecipient, _royaltyBps )
uint _numOfTeams, uint _exchangeRate ) ERC1155Base( _defaultAdmin, _name, _symbol, _royaltyRecipient, _royaltyBps )
2,939
53
// EU21 token contract address
address public constant tokenAddress = 0x87ea1F06d7293161B9ff080662c1b0DF775122D3;
address public constant tokenAddress = 0x87ea1F06d7293161B9ff080662c1b0DF775122D3;
57,429
1
// ๅ„ฒๅญ˜็›ฎๅ‰ๆ‰€ๆœ‰ๆญฃๅœจไบŒ็ดšๅธ‚ๅ ดไบคๆ˜“็š„ๆดปๅ‹•็ฅจๅˆธ่ณ‡่จŠ๏ผŒTrade struct ๅŒ…ๅซๆ“ๆœ‰่€…๏ผˆ่ณผ่ฒท่€…๏ผ‰ใ€็ฅจๅˆธ Id๏ผŒ่ฒฉๅ”ฎๅƒนๆ ผ่ณ‡่จŠใ€‚
mapping(uint256 => Trade) public tradingList;
mapping(uint256 => Trade) public tradingList;
30,223
281
// We read and store the key's index to prevent multiple reads from the same storage slot
uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value }));
uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value }));
1,827
56
// unstaking fee 0.50 percent
uint public constant unstakingFeeRate = 50;
uint public constant unstakingFeeRate = 50;
2,838
122
// Parse the return data to the local stack. localStack The local stack to place the return values. ret The return data. index The current tail. /
function _parse( bytes32[256] memory localStack, bytes memory ret, uint256 index
function _parse( bytes32[256] memory localStack, bytes memory ret, uint256 index
48,332
6
// Generate the expected integrity code from the hash
bytes6 expectedIntegrityCode = bytes6(updateHash);
bytes6 expectedIntegrityCode = bytes6(updateHash);
24,791
85
// Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with`errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._ /
function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); }
function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); }
1,867
49
// Gets the owner wallet of the domain /
function getDomainOwner(string memory domain) public view returns (address owner)
function getDomainOwner(string memory domain) public view returns (address owner)
50,010
54
// Stops the contract - this is irreversible. Should only be usedin an emergency, for example an irreversible accounting bugor an exploit. Enables all depositors to withdraw their stakeinstantly. Also stops new rewards accounting.makeRewardsClaimableWhether any previously accumulated rewards should be claimable. /
function emergencyStop(bool makeRewardsClaimable) external override onlyOwner { if (ended) revert STATE_AlreadyStopped(); // Update state and put in irreversible emergency mode ended = true; claimable = makeRewardsClaimable; if (!claimable) { // Send distributio...
function emergencyStop(bool makeRewardsClaimable) external override onlyOwner { if (ended) revert STATE_AlreadyStopped(); // Update state and put in irreversible emergency mode ended = true; claimable = makeRewardsClaimable; if (!claimable) { // Send distributio...
72,103
0
// Scroing Config interface /
interface IScoringConfig { function getUserScore(address user, address token) external view returns (uint256); function getGlobalScore(address token) external view returns (uint256); }
interface IScoringConfig { function getUserScore(address user, address token) external view returns (uint256); function getGlobalScore(address token) external view returns (uint256); }
15,343
117
// This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.implement alternative mechanisms to perform token transfer, such as signature-based. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`.- If `to` ref...
function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
21,718
233
// Combines account details with their twab history/details The account details/twabs The history of twabs for this account
struct Account { AccountDetails details; ObservationLib.Observation[MAX_CARDINALITY] twabs; }
struct Account { AccountDetails details; ObservationLib.Observation[MAX_CARDINALITY] twabs; }
49,781
5
// set address of promoter, developer and manager
address payable public promoter; address payable public developer; address payable public manager;
address payable public promoter; address payable public developer; address payable public manager;
28,174
92
// Fill the arrays with the active effectIds and their durations
for (uint256 i = 0; i < activeEffectsCount; i++) { uint256 effectId = proxy.activeEffectIds[i]; effectIds[i] = effectId; durations[i] = proxy.activeEffectDurations[effectId]; }
for (uint256 i = 0; i < activeEffectsCount; i++) { uint256 effectId = proxy.activeEffectIds[i]; effectIds[i] = effectId; durations[i] = proxy.activeEffectDurations[effectId]; }
13,904
242
// INTERFACE: Try to update a bytes32 element and append a bytes32 element, given a root, an index, a bytes32 element, and a Single Proof
function try_update_one_and_append_one( bytes32 root, uint256 index, bytes32 element, bytes32 update_element, bytes32 append_element, bytes32[] calldata proof
function try_update_one_and_append_one( bytes32 root, uint256 index, bytes32 element, bytes32 update_element, bytes32 append_element, bytes32[] calldata proof
14,277
194
// Sale must NOT be enabled
require(!sale, "Sale already in progress"); require(presale,"Presale must be active"); require(quantity != 0, "Requested quantity cannot be zero"); require(quantity * pricePer <= msg.value, "Not enough ether sent"); require(super.totalSupply() + quantity <= maxPreMint, "Purchase ...
require(!sale, "Sale already in progress"); require(presale,"Presale must be active"); require(quantity != 0, "Requested quantity cannot be zero"); require(quantity * pricePer <= msg.value, "Not enough ether sent"); require(super.totalSupply() + quantity <= maxPreMint, "Purchase ...
14,480
35
// For each asset there a different maximum amount a user can leverageWe make sure the leverage amount is below the maximum
require( initialDeposit > 0 && ((longAmount + initialDeposit) * 100) / longAmount >= getMinimumCollateralPercentage(), "NOT_ENOUGH_COLLATERAL" ); uint256 userDebtBefore = IERC20StableCoin(maiVault).vaultDebt(vaultId); IERC20(colla...
require( initialDeposit > 0 && ((longAmount + initialDeposit) * 100) / longAmount >= getMinimumCollateralPercentage(), "NOT_ENOUGH_COLLATERAL" ); uint256 userDebtBefore = IERC20StableCoin(maiVault).vaultDebt(vaultId); IERC20(colla...
8,822
85
// ============================= CONTRACT VARIABLES ==============================
1,551
2
// this function is called to create an ERC721 contract. /
function createContract( string memory _name, string memory _symbol, string memory _uri, address factory ) external returns (address);
function createContract( string memory _name, string memory _symbol, string memory _uri, address factory ) external returns (address);
7,208
206
// The total Fei currently boosting Vaults.
uint256 public totalBoosted;
uint256 public totalBoosted;
10,991
3
// To redeem tokens and track redemptions _value The number of tokens to redeem /
function redeemTokens(uint256 _value) public { ISecurityToken(securityToken).burnFromWithData(msg.sender, _value, ""); redeemedTokens[msg.sender] = redeemedTokens[msg.sender].add(_value); /*solium-disable-next-line security/no-block-members*/ emit Redeemed(msg.sender, _value, now); ...
function redeemTokens(uint256 _value) public { ISecurityToken(securityToken).burnFromWithData(msg.sender, _value, ""); redeemedTokens[msg.sender] = redeemedTokens[msg.sender].add(_value); /*solium-disable-next-line security/no-block-members*/ emit Redeemed(msg.sender, _value, now); ...
27,301
14
// The delegated account for each voting account
mapping(address => address) public delegate;
mapping(address => address) public delegate;
26,005
325
// Authorize UniV3 contract to move fund asset/Only allow governance and strategist identities to execute authorized functions to reduce miner fee consumption/token Authorized target token
function safeApproveAll(address token) public virtual onlyStrategistOrGovernance { ERC20Extends.safeApprove(token, address(UniV3PeripheryExtends.PM()), type(uint256).max); ERC20Extends.safeApprove(token, address(UniV3PeripheryExtends.SRT()), type(uint256).max); }
function safeApproveAll(address token) public virtual onlyStrategistOrGovernance { ERC20Extends.safeApprove(token, address(UniV3PeripheryExtends.PM()), type(uint256).max); ERC20Extends.safeApprove(token, address(UniV3PeripheryExtends.SRT()), type(uint256).max); }
1,943
89
// constuctor(<other arguments>, address _vrfCoordinator, address _link)
* @dev VRFConsumerBase(_vrfCoordinator, _link) public { * @dev <initialization with other arguments goes here> * @dev }
* @dev VRFConsumerBase(_vrfCoordinator, _link) public { * @dev <initialization with other arguments goes here> * @dev }
106
23
// - Lets a Lender and a Borrower increase the credit limit on a position- line status must be ACTIVE- callable by borrower id - position id that we are updating amount - amount to deposit by the Lenderreturn - if function executed successfully /
function increaseCredit(bytes32 id, uint256 amount) external payable returns (bool);
function increaseCredit(bytes32 id, uint256 amount) external payable returns (bool);
27,969
6
// Returns total count of active jobs
function activeJobsCount() view public returns (uint256);
function activeJobsCount() view public returns (uint256);
14,875
51
// Return an amount of allready collected tokens (for rewards)
uint256 _collectedTokens;
uint256 _collectedTokens;
20,948
18
// Function to report on totalsupply following ERC20 Standard
function totalSupply() public override view returns (uint256) { return totalSupply_; }
function totalSupply() public override view returns (uint256) { return totalSupply_; }
66,000
30
// Do not allow renouncing ownership /
function renounceOwnership() public override(Ownable) onlyOwner {} }
function renounceOwnership() public override(Ownable) onlyOwner {} }
75,633
0
// VaultInfo struct/this struct is used to store the vault metadata/ this should reduce the cost of minting by ~15,000/ by limiting us to max 296-1 vaults
struct VaultInfo { uint96 id; address minter; }
struct VaultInfo { uint96 id; address minter; }
11,410
49
// Computing height of a building with respect to city progression.
function _computeHeight( uint256 _x, uint256 _z, uint256 _height
function _computeHeight( uint256 _x, uint256 _z, uint256 _height
58,199
60
// Mapping from owner to a list of owned auctions
mapping (address => uint256[]) public ownedAuctions; event BidSuccess(address _from, uint256 _auctionId, uint256 _price, uint256 _bidIndex);
mapping (address => uint256[]) public ownedAuctions; event BidSuccess(address _from, uint256 _auctionId, uint256 _price, uint256 _bidIndex);
19,069
84
// Common logic for clearing the data of an Identity.
function resetIdentityData(Identity storage identity, address newRecoveryAddress, bool resetResolvers) private { for (uint i; i < identity.associatedAddresses.members.length; i++) { delete associatedAddressDirectory[identity.associatedAddresses.members[i]]; } delete identity.asso...
function resetIdentityData(Identity storage identity, address newRecoveryAddress, bool resetResolvers) private { for (uint i; i < identity.associatedAddresses.members.length; i++) { delete associatedAddressDirectory[identity.associatedAddresses.members[i]]; } delete identity.asso...
19,736
68
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) /Interface of the ERC165 standard, as defined in the https:eips.ethereum.org/EIPS/eip-165[EIP]. Implementers can declare support of contract interfaces, which can then be
// * queried by others ({ERC165Checker}). // * // * For an implementation, see {ERC165}. // */ // interface IERC165 { // /** // * @dev Returns true if this contract implements the interface defined by // * `interfaceId`. See the corresponding // * https://eips.ethereum.org/EIPS/eip-165#how-interf...
// * queried by others ({ERC165Checker}). // * // * For an implementation, see {ERC165}. // */ // interface IERC165 { // /** // * @dev Returns true if this contract implements the interface defined by // * `interfaceId`. See the corresponding // * https://eips.ethereum.org/EIPS/eip-165#how-interf...
9,869
56
// If there was already enough COIN in the safeEngine balance, just exits it without adding more debt
if (coin < multiply(wad, RAY)) {
if (coin < multiply(wad, RAY)) {
4,615
383
// To avoid rounding issues, we re-order and group the operations so we do 1 division and only at the end [supplyCurrent(Oracle price for the collateral)] / [ (1 + liquidationDiscount)(Oracle price for the borrow) ]
Error err; Exp memory onePlusLiquidationDiscount; // (1 + liquidationDiscount) Exp memory supplyCurrentTimesOracleCollateral; // supplyCurrent * Oracle price for the collateral Exp memory onePlusLiquidationDiscountTimesOracleBorrow; // (1 + liquidationDiscount) * Oracle price for the bor...
Error err; Exp memory onePlusLiquidationDiscount; // (1 + liquidationDiscount) Exp memory supplyCurrentTimesOracleCollateral; // supplyCurrent * Oracle price for the collateral Exp memory onePlusLiquidationDiscountTimesOracleBorrow; // (1 + liquidationDiscount) * Oracle price for the bor...
17,569
8
// This is a virtual function that should be overridden so it returns the address to which the fallback function
* and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internal call site, it will return directly to the ex...
* and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internal call site, it will return directly to the ex...
2,242
18
// Sum up total amounts owed to recipient
amount0 = unusedAmount0.add(baseAmount0).add(limitAmount0); amount1 = unusedAmount1.add(baseAmount1).add(limitAmount1); require(amount0 >= amount0Min, "amount0Min"); require(amount1 >= amount1Min, "amount1Min");
amount0 = unusedAmount0.add(baseAmount0).add(limitAmount0); amount1 = unusedAmount1.add(baseAmount1).add(limitAmount1); require(amount0 >= amount0Min, "amount0Min"); require(amount1 >= amount1Min, "amount1Min");
23,309
2
// Initiates sending of an AMB message to the opposite network_contract executor address on the other side_data calldata passed to the executor on the other side_gas gas limit used on the other network for executing a message_dataType AMB message dataType to be included as a part of the header/
function _sendMessage(address _contract, bytes _data, uint256 _gas, uint256 _dataType) internal returns (bytes32) { // it is not allowed to pass messages while other messages are processed // if other is not explicitly configured require(messageId() == bytes32(0) || allowReentrantRequests())...
function _sendMessage(address _contract, bytes _data, uint256 _gas, uint256 _dataType) internal returns (bytes32) { // it is not allowed to pass messages while other messages are processed // if other is not explicitly configured require(messageId() == bytes32(0) || allowReentrantRequests())...
21,821
8
// `voter` ์—๊ฒŒ ์ด ํˆฌํ‘œ๊ถŒ์— ๋Œ€ํ•œ ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•˜์‹ญ์‹œ์˜ค. ์˜ค์ง `chairperson` ์œผ๋กœ๋ถ€ํ„ฐ ํ˜ธ์ถœ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
function giveRightToVote(address voter) public { // `require`์˜ ์ธ์ˆ˜๊ฐ€ `false`๋กœ ํ‰๊ฐ€๋˜๋ฉด, // ๊ทธ๊ฒƒ์€ ์ข…๋ฃŒ๋˜๊ณ  ๋ชจ๋“  ๋ณ€๊ฒฝ๋‚ด์šฉ์„ state์™€ // Ether Balance๋กœ ๋˜๋Œ๋ฆฝ๋‹ˆ๋‹ค. // ํ•จ์ˆ˜๊ฐ€ ์ž˜๋ชป ํ˜ธ์ถœ๋˜๋ฉด ์ด๊ฒƒ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. // ๊ทธ๋Ÿฌ๋‚˜ ์กฐ์‹ฌํ•˜์‹ญ์‹œ์˜ค, // ์ด๊ฒƒ์€ ํ˜„์žฌ ์ œ๊ณต๋œ ๋ชจ๋“  ๊ฐ€์Šค๋ฅผ ์†Œ๋น„ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. // (์ด๊ฒƒ์€ ์•ž์œผ๋กœ ๋ฐ”๋€Œ๊ฒŒ ๋  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค) require( ...
function giveRightToVote(address voter) public { // `require`์˜ ์ธ์ˆ˜๊ฐ€ `false`๋กœ ํ‰๊ฐ€๋˜๋ฉด, // ๊ทธ๊ฒƒ์€ ์ข…๋ฃŒ๋˜๊ณ  ๋ชจ๋“  ๋ณ€๊ฒฝ๋‚ด์šฉ์„ state์™€ // Ether Balance๋กœ ๋˜๋Œ๋ฆฝ๋‹ˆ๋‹ค. // ํ•จ์ˆ˜๊ฐ€ ์ž˜๋ชป ํ˜ธ์ถœ๋˜๋ฉด ์ด๊ฒƒ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. // ๊ทธ๋Ÿฌ๋‚˜ ์กฐ์‹ฌํ•˜์‹ญ์‹œ์˜ค, // ์ด๊ฒƒ์€ ํ˜„์žฌ ์ œ๊ณต๋œ ๋ชจ๋“  ๊ฐ€์Šค๋ฅผ ์†Œ๋น„ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. // (์ด๊ฒƒ์€ ์•ž์œผ๋กœ ๋ฐ”๋€Œ๊ฒŒ ๋  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค) require( ...
26,613
34
// user who will receive all funds
address internal beneficiary;
address internal beneficiary;
32,764
62
// current purchasable units per transaction
uint256 public unitsPerTransaction;
uint256 public unitsPerTransaction;
50,032
41
// Sells Shares if tokens transfered to this address
function _transferShares(address _sender, address _receipent, uint256 _amount) internal balanceCheck(_sender, _amount) notOkamaShares(_sender) checkContract(_receipent) notRestricted(_receipent){ if (_receipent == address(this)) { _sellViaCircValue(_sender, _amount); } el...
function _transferShares(address _sender, address _receipent, uint256 _amount) internal balanceCheck(_sender, _amount) notOkamaShares(_sender) checkContract(_receipent) notRestricted(_receipent){ if (_receipent == address(this)) { _sellViaCircValue(_sender, _amount); } el...
36,361
72
// max open sale tokens
uint public constant MAX_OPEN_SOLD = TOTAL_SUPPLY * OPEN_SALE_STAKE / DIVISOR_STAKE; uint public constant STAKE_MULTIPLIER = TOTAL_SUPPLY / DIVISOR_STAKE;
uint public constant MAX_OPEN_SOLD = TOTAL_SUPPLY * OPEN_SALE_STAKE / DIVISOR_STAKE; uint public constant STAKE_MULTIPLIER = TOTAL_SUPPLY / DIVISOR_STAKE;
7,325
46
// Transfer in sufficient dDai and use it to mint Dai.
totalDDaiRedeemed = _transferAndRedeemDDai(daiEquivalentAmount);
totalDDaiRedeemed = _transferAndRedeemDDai(daiEquivalentAmount);
19,358
334
// Returns the number of shares for a given `assetAmount`.Used by the frontend to calculate withdraw amounts. assetAmount is the asset amount to be withdrawnreturn share amount /
function assetAmountToShares(uint256 assetAmount) external view returns (uint256)
function assetAmountToShares(uint256 assetAmount) external view returns (uint256)
9,414
4
// ็ฎก็†่ฅไธšๆ‰ง็…ง็š„ๅˆ็บฆๅœฐๅ€ /
address bizLicContract;
address bizLicContract;
27,483
31
// Returns the number of decimals used to get its user representation.For example, if `decimals` equals `2`, a balance of `505` tokens shouldbe displayed to a user as `5,05` (`505 / 102`). Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function dec...
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function dec...
640
18
// The offset of an encoded pool key
uint256 private constant POP_OFFSET = NEXT_OFFSET + ADDR_SIZE;
uint256 private constant POP_OFFSET = NEXT_OFFSET + ADDR_SIZE;
5,484
84
// Gets the total amount of tokens sold/
function getTotalSold() public view virtual returns (uint256 totalSold) { return nTotalSold; }
function getTotalSold() public view virtual returns (uint256 totalSold) { return nTotalSold; }
17,153
306
// Precision factor used to improve rounding when computing weights for the final round
uint256 internal constant FINAL_ROUND_WEIGHT_PRECISION = 1000;
uint256 internal constant FINAL_ROUND_WEIGHT_PRECISION = 1000;
27,692
46
// ------------------------------------------------------------------------ Owners can send the funds to be distributed to stakers using this functiontokens number of tokens to distribute ------------------------------------------------------------------------
function ADDFUNDS(uint256 tokens) external onlyWhitelistAdmin{ //can only be called by regrewardContract uint256 transferTxFee = (onePercent(tokens).mul(txFee1)).div(10); uint256 tokens_ = (tokens.sub(transferTxFee)); _addPayout(tokens_); }
function ADDFUNDS(uint256 tokens) external onlyWhitelistAdmin{ //can only be called by regrewardContract uint256 transferTxFee = (onePercent(tokens).mul(txFee1)).div(10); uint256 tokens_ = (tokens.sub(transferTxFee)); _addPayout(tokens_); }
27,114
19
// ----------------------------- FEES----------------------------- Owner can send ETH to the Index, to perform some task, this eth belongs to him solhint-disable-next-line
function addOwnerBalance() external payable { accumulatedFee = accumulatedFee.add(msg.value); }
function addOwnerBalance() external payable { accumulatedFee = accumulatedFee.add(msg.value); }
1,041
40
// Modifier used to verify that a function for a given contract exists by using
* its {functionSelector} identifier and the key parent {contractAddress} identifier. * * @param contractAddress The contract where the functionSelector is supposed to live. * @param functionSelector The function identifier that will be checked */ modifier functionExists(address contractAddr...
* its {functionSelector} identifier and the key parent {contractAddress} identifier. * * @param contractAddress The contract where the functionSelector is supposed to live. * @param functionSelector The function identifier that will be checked */ modifier functionExists(address contractAddr...
34,945
117
// makes sure seller or buyer is not blacklisted
require(!_isBlacklisted[from] && !_isBlacklisted[to], "This account is blacklisted: If you feel this is incorrect please contac us and we will remove you"); require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); ...
require(!_isBlacklisted[from] && !_isBlacklisted[to], "This account is blacklisted: If you feel this is incorrect please contac us and we will remove you"); require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); ...
40,433
27
// InbestToken Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.Note they can later distribute these tokens as they wish using `transfer` and other`StandardToken` functions. /
contract InbestToken is StandardToken { string public constant name = "Inbest Token"; string public constant symbol = "IBST"; uint8 public constant decimals = 18; // TBD uint256 public constant INITIAL_SUPPLY = 17656263110 * (10 ** uint256(decimals)); /** * @dev Constructor that gives msg.sender all o...
contract InbestToken is StandardToken { string public constant name = "Inbest Token"; string public constant symbol = "IBST"; uint8 public constant decimals = 18; // TBD uint256 public constant INITIAL_SUPPLY = 17656263110 * (10 ** uint256(decimals)); /** * @dev Constructor that gives msg.sender all o...
26,968
8
// Amount of votes that holder has./sender_ address of the holder./ return number of votes.
function votesOf(address sender_) external view returns (uint256);
function votesOf(address sender_) external view returns (uint256);
1,770
31
// mapping of addresses to mapping of allowances for an address
mapping (address => mapping (address => uint)) allowances;
mapping (address => mapping (address => uint)) allowances;
17,316