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
5
// masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
address masterCopy;
address masterCopy;
13,128
67
// NOTE: here we are multiplying by 1e3 to get precise decimal values.
timelyRewardRatio = timeSinceLastClaimed.mul(1e3).div(vestFor);
timelyRewardRatio = timeSinceLastClaimed.mul(1e3).div(vestFor);
22,083
37
// Function to add non upgradable contract in registry of all contracts contractName is the name of the contract contractAddress is the contract address only maintainer can issue call to this method /
function addNonUpgradableContractToAddress( string contractName, address contractAddress ) public onlyCoreDev
function addNonUpgradableContractToAddress( string contractName, address contractAddress ) public onlyCoreDev
37,536
23
// lib/dpass/lib/openzeppelin-contracts/src/drafts/Counters.sol/ pragma solidity ^0.5.0; // import "../math/SafeMath.sol"; // Counters Matt Condon (@shrugs) Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the numberof elements in a mapping, issuing ERC721 ids, or cou...
* Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; ...
* Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; ...
26,799
118
// Gives permission to `to` to transfer `tokenId` token to another account.The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving thezero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator.- `tokenId` ...
function approve(address to, uint256 tokenId) external payable;
function approve(address to, uint256 tokenId) external payable;
487
4
// Admin-only to force unstake a user's tokens./_user The user to force withdraw/_amount The amount to force withdraw
function forceUnstake(address _user, uint256 _amount) external onlyOwner { tls.forceUnstake(_user, _amount); }
function forceUnstake(address _user, uint256 _amount) external onlyOwner { tls.forceUnstake(_user, _amount); }
19,709
9
// The number of rebase cycles since inception
uint256 public epoch; uint256 private constant DECIMALS = 18;
uint256 public epoch; uint256 private constant DECIMALS = 18;
38,980
12
// Deploy the contract
constructor() ERC721A("Reincarnation Pass", "BBRP")
constructor() ERC721A("Reincarnation Pass", "BBRP")
35,411
24
// admin function to reject a previously approved batch/ Requires that the Batch-NFT has not been fractionalized yet
function rejectApprovedWithComment(uint256 tokenId, string memory comment) external virtual onlyOwner whenNotPaused
function rejectApprovedWithComment(uint256 tokenId, string memory comment) external virtual onlyOwner whenNotPaused
16,068
221
// Lock some tokens as a new sub-stake_info Staker structure_nextPeriod Next period_staker Staker_value Amount of tokens which will be locked_unlockingDuration Amount of periods during which tokens will be unlocked when wind down is enabled/
function lockAndCreate( StakerInfo storage _info, uint16 _nextPeriod, address _staker, uint256 _value, uint16 _unlockingDuration ) internal
function lockAndCreate( StakerInfo storage _info, uint16 _nextPeriod, address _staker, uint256 _value, uint16 _unlockingDuration ) internal
50,062
244
// The actual token contract, the default controller is the msg.sender/that deploys the contract, so usually this token will be deployed by a/token controller contract, which Giveth will call a "Campaign"
contract MiniMeToken is Controlled { string public name; //The Token's name: e.g. DigixDAO Tokens uint8 public decimals; //Number of decimals of the smallest unit string public symbol; //An identifier: e.g. REP string public version = "MMT_0.1"; //An arbitrary ve...
contract MiniMeToken is Controlled { string public name; //The Token's name: e.g. DigixDAO Tokens uint8 public decimals; //Number of decimals of the smallest unit string public symbol; //An identifier: e.g. REP string public version = "MMT_0.1"; //An arbitrary ve...
13,085
1
// returns an account's total withdrawable rewards (principal balance + newly earned rewards) _account account addressreturn account's total unclaimed rewards /
function withdrawableRewards(address _account) public view virtual returns (uint256) { return (controller.staked(_account) * (rewardPerToken - userRewardPerTokenPaid[_account])) / 1e18 + userRewards[_account]; }
function withdrawableRewards(address _account) public view virtual returns (uint256) { return (controller.staked(_account) * (rewardPerToken - userRewardPerTokenPaid[_account])) / 1e18 + userRewards[_account]; }
5,665
60
// See {IERC721-balanceOf}. /
function balanceOf(address owner) public view virtual override returns (uint256) {
function balanceOf(address owner) public view virtual override returns (uint256) {
2,893
27
// Initiates an Ether transfer between two wallets_from Address from which the Ether is sent from_to Address to which the Ether is sent_value Amount of wei sent
function moveEther(FundWallet _from, address _to, uint256 _value) public onlyOwner
function moveEther(FundWallet _from, address _to, uint256 _value) public onlyOwner
25,826
23
// Slice the sighash.
_returnData := add(_returnData, 0x04)
_returnData := add(_returnData, 0x04)
2,069
13
// Mainnet neutral tokens
neutralTokens[address(0x8e769EAA31375D13a1247dE1e64987c28Bed987E)] = true; neutralTokens[address(0x739D93f2b116E6aD754e173655c635Bd5D8d664c)] = true; neutralTokens[address(0xfea2468C55E80aB9487f6E6189C79Ce31E1f9Ea7)] = true; neutralTokens[address(0x939D73E26138f4B483368F96d17D2B4dCc5bc84...
neutralTokens[address(0x8e769EAA31375D13a1247dE1e64987c28Bed987E)] = true; neutralTokens[address(0x739D93f2b116E6aD754e173655c635Bd5D8d664c)] = true; neutralTokens[address(0xfea2468C55E80aB9487f6E6189C79Ce31E1f9Ea7)] = true; neutralTokens[address(0x939D73E26138f4B483368F96d17D2B4dCc5bc84...
32,603
109
// A cursor pointing to the revert flag, starts after the length field of the data object
let memPtr := add(data, 32)
let memPtr := add(data, 32)
7,337
301
// Returns the current quorum numerator. See {quorumDenominator}. /
function quorumNumerator() public view virtual returns (uint256) { return _quorumNumerator; }
function quorumNumerator() public view virtual returns (uint256) { return _quorumNumerator; }
60,081
18
// Close the crowdsale/
function closeCrowdsale() isOwner
function closeCrowdsale() isOwner
37,141
10
// Delegate to internal OpenZeppelin burn function
_burn(_tokenId);
_burn(_tokenId);
66,360
102
// EIP-20 token decimals for this token /
uint256 public decimals;
uint256 public decimals;
37,327
14
// Remove single address into the whitelist.Note: Use this function for a single address save transaction fee/
function removeFromWhitelist(address addr) onlyOwner public { participants[addr].whitelisted = false; }
function removeFromWhitelist(address addr) onlyOwner public { participants[addr].whitelisted = false; }
46,913
13
// Set new alloc points for an option pool. Can only be called by the owner or premia diamond _pool Address of option pool contract _allocPoints Weight of this pool in the reward calculation /
function setPoolAllocPoints(address _pool, uint256 _allocPoints) external override onlyDiamondOrOwner
function setPoolAllocPoints(address _pool, uint256 _allocPoints) external override onlyDiamondOrOwner
37,239
64
// Remove node from a storage linkedlist.
function checkAndRemoveFromPendingGroup(address node) private returns(bool) { uint prev = HEAD_I; uint curr = pendingGroupList[prev]; while (curr != HEAD_I) { PendingGroup storage pgrp = pendingGroups[curr]; (, bool found) = findNodeFromList(pgrp.memberList, node); ...
function checkAndRemoveFromPendingGroup(address node) private returns(bool) { uint prev = HEAD_I; uint curr = pendingGroupList[prev]; while (curr != HEAD_I) { PendingGroup storage pgrp = pendingGroups[curr]; (, bool found) = findNodeFromList(pgrp.memberList, node); ...
38,768
207
// increments the value of _currentTokenID /
function _incrementTokenTypeId() internal virtual { _currentTokenID++; }
function _incrementTokenTypeId() internal virtual { _currentTokenID++; }
45,721
226
// Return the approx logarithm of a value with log(x) where x <= 1.1.All values are in integers with (1e18 == 1.0). Requirements: - input value x must be greater than 1e18 /
function _logApprox(uint256 x) internal pure returns (uint256 y) { uint256 one = W_ONE; require(x >= one, "logApprox: x must >= 1"); uint256 z = x - one; uint256 zz = z.mul(z).div(one); uint256 zzz = zz.mul(z).div(one); uint256 zzzz = zzz.mul(z).div(one); ui...
function _logApprox(uint256 x) internal pure returns (uint256 y) { uint256 one = W_ONE; require(x >= one, "logApprox: x must >= 1"); uint256 z = x - one; uint256 zz = z.mul(z).div(one); uint256 zzz = zz.mul(z).div(one); uint256 zzzz = zzz.mul(z).div(one); ui...
71,040
135
// Oracle info
OracleInfo memory thisOracle = oracle_info[token_address];
OracleInfo memory thisOracle = oracle_info[token_address];
27,849
289
// Check parameters existence.
require(parameters[_paramsHash].queuedVoteRequiredPercentage >= 50);
require(parameters[_paramsHash].queuedVoteRequiredPercentage >= 50);
7,694
88
// loop all dates
for (uint8 i = 0; i < PERIOD_DATES.length; i++) { uint256 nPeriodInterest = arrInterests[i]; uint256 nPeriodDate = PERIOD_DATES[i]; if (_nPaymentDate >= nPeriodDate) {
for (uint8 i = 0; i < PERIOD_DATES.length; i++) { uint256 nPeriodInterest = arrInterests[i]; uint256 nPeriodDate = PERIOD_DATES[i]; if (_nPaymentDate >= nPeriodDate) {
18,785
3
// Maps SocialToken creator to deployed SocialToken address
mapping(address => address) private _tokens;
mapping(address => address) private _tokens;
17,848
5
// Copies 'len' bytes from 'srcPtr' to 'destPtr'. NOTE: This function does not check if memory is allocated, it only copies the bytes.
function memcopy(uint srcPtr, uint destPtr, uint len) internal pure { uint offset = 0; uint size = len / WORD_SIZE; // Copy word-length chunks while possible. for (uint i = 0; i < size; i++) { offset = i * WORD_SIZE; assembly { mstore(add(destPtr, offset), mlo...
function memcopy(uint srcPtr, uint destPtr, uint len) internal pure { uint offset = 0; uint size = len / WORD_SIZE; // Copy word-length chunks while possible. for (uint i = 0; i < size; i++) { offset = i * WORD_SIZE; assembly { mstore(add(destPtr, offset), mlo...
11,097
27
// Ensure that sender has revealed a vote
VoteCommit memory senderVote = votes[msg.sender]; require( (senderVote.choice == Choice.A) || (senderVote.choice == Choice.B), "Cannot claim payout without revealed vote." );
VoteCommit memory senderVote = votes[msg.sender]; require( (senderVote.choice == Choice.A) || (senderVote.choice == Choice.B), "Cannot claim payout without revealed vote." );
48,763
21
// Calculate tokens amount that is sent to withdrawAddress.return Amount of tokens that can be sent. /
function getAvailableTokensToWithdraw () public view returns (uint256 tokensToSend) { uint256 tokensUnlockedPercentage = getTokensUnlockedPercentage(); // In the case of stuck tokens we allow the withdrawal of them all after vesting period ends. if (tokensUnlockedPercentage >= 100) { ...
function getAvailableTokensToWithdraw () public view returns (uint256 tokensToSend) { uint256 tokensUnlockedPercentage = getTokensUnlockedPercentage(); // In the case of stuck tokens we allow the withdrawal of them all after vesting period ends. if (tokensUnlockedPercentage >= 100) { ...
41,266
233
// Returns the text of a mood based on the supplied type/mood The MoodType/ return The mood text
function moodForType(IBear3Traits.MoodType mood) external pure returns (string memory);
function moodForType(IBear3Traits.MoodType mood) external pure returns (string memory);
14,059
27
// Internal pure function to supply the name of the underlying token.return The name of the underlying token. /
function _getUnderlyingName() internal pure returns (string memory underlyingName);
function _getUnderlyingName() internal pure returns (string memory underlyingName);
49,525
2
// Implements a URI for a collection which is shared by all tokens. HardlyDifficult /
abstract contract SharedURICollection is ERC721Upgradeable { string private $baseURI; /** * @notice Set the base URI to be used for all tokens. * @param uri The base URI to use. */ function _setBaseURI(string calldata uri) internal { if (bytes(uri).length == 0) { revert SharedURICollection_URI...
abstract contract SharedURICollection is ERC721Upgradeable { string private $baseURI; /** * @notice Set the base URI to be used for all tokens. * @param uri The base URI to use. */ function _setBaseURI(string calldata uri) internal { if (bytes(uri).length == 0) { revert SharedURICollection_URI...
33,579
19
// Returns each address that signed a hashed message (`hash`) from acollection of `signatures`. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:this function rejects them by requiring the `s` value to be in the lowerhalf order, and the `v` value to be either 27 or 28. NOTE: This call _does not r...
function _recoverGroup( bytes32 hash, bytes memory signatures
function _recoverGroup( bytes32 hash, bytes memory signatures
28,513
190
// Transfers ownership of the contract to a new account (`newOwner`).Can only be called by the current owner.force setup DEFAULT_ADMIN_ROLE to owner, in case him has renounced DEFAULT_ADMIN_ROLEbeacuse he need to have almost DEFAULT_ADMIN_ROLE role to grant all role to the newOwnerRevoke all roles to the previous owner...
function transferOwnership(address newOwner) public override onlyOwner { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); grantRole(DEFAULT_ADMIN_ROLE, newOwner); grantRole(MINTER_ROLE, newOwner); grantRole(PAUSER_ROLE, newOwner); revokeRole(MINTER_ROLE, _msgSender()); r...
function transferOwnership(address newOwner) public override onlyOwner { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); grantRole(DEFAULT_ADMIN_ROLE, newOwner); grantRole(MINTER_ROLE, newOwner); grantRole(PAUSER_ROLE, newOwner); revokeRole(MINTER_ROLE, _msgSender()); r...
6,169
386
// move right bound `j` to the middle position `k - 1`: element at position `k` is bigger and cannot be the result
j = k - 1;
j = k - 1;
49,950
87
// This contract aims to provide an inheritable way to recover tokens from a contract not meant to hold tokens To use this contract, have your token-ignoring contract inherit this one and implement getLostAndFoundMaster to decide who can move lost tokens. Of course, this contract imposes support costs upon whoever is t...
contract LostAndFoundToken { /** * @return Address of the account that handles movements. */ function getLostAndFoundMaster() internal view returns (address); /** * @param agent Address that will be able to move tokens with transferFrom * @param tokens Amount of tokens approved for transfer * @par...
contract LostAndFoundToken { /** * @return Address of the account that handles movements. */ function getLostAndFoundMaster() internal view returns (address); /** * @param agent Address that will be able to move tokens with transferFrom * @param tokens Amount of tokens approved for transfer * @par...
73,753
94
// recalculate deposit weight
uint256 previousWeight = stakeDeposit.weight; uint256 newWeight = (((stakeDeposit.lockedUntil - stakeDeposit.lockedFrom) * WEIGHT_MULTIPLIER) / 365 days + WEIGHT_MULTIPLIER) * (stakeDeposit.tokenAmount - _amount);
uint256 previousWeight = stakeDeposit.weight; uint256 newWeight = (((stakeDeposit.lockedUntil - stakeDeposit.lockedFrom) * WEIGHT_MULTIPLIER) / 365 days + WEIGHT_MULTIPLIER) * (stakeDeposit.tokenAmount - _amount);
35,979
159
// boolean to declare if contract is whitelisted
bool public immutable whitelistedContract;
bool public immutable whitelistedContract;
69,475
113
// nft owner address
address nftOwner;
address nftOwner;
3,763
52
// Donate ETH tokens to contract (Owner)/
function donation() external payable
function donation() external payable
36,907
29
// ============ MUTATIVE FUNCTIONS ==========
function addLiquidity( uint256[] calldata amounts, uint256 minToMint, uint256 deadline
function addLiquidity( uint256[] calldata amounts, uint256 minToMint, uint256 deadline
15,087
28
// To be set at a later date when the platform is developed /
function setAddonsAddress(address addonsAddress) onlyOwner public { _addonsAddress = addonsAddress; }
function setAddonsAddress(address addonsAddress) onlyOwner public { _addonsAddress = addonsAddress; }
39,427
45
// Addresses for second batch release
address[] secondBatchAddresses; uint256 sIndex = 0;
address[] secondBatchAddresses; uint256 sIndex = 0;
78,443
33
// Allows an owner to submit and confirm a transaction./destination Transaction target address./value Transaction ether value./data Transaction data payload./ return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data) public returns (uint transactionId)
function submitTransaction(address destination, uint value, bytes data) public returns (uint transactionId)
2,749
36
// ERC20 standard function
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){ require(_to != 0x0); require(_value <= allowed[_from][msg.sender]); require(_value <= balances[_from]); require(validateTransferAmount(_from,_value)); balances[_from] = balances[...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){ require(_to != 0x0); require(_value <= allowed[_from][msg.sender]); require(_value <= balances[_from]); require(validateTransferAmount(_from,_value)); balances[_from] = balances[...
3,104
102
// A hook function checking if the mass of the NFT in the `to` wallethas reached the soft cap before it is being transferred. /
function _beforeTokenTransfer(address, address to, uint256) private view { if (!specialWallets[to]) { if (_tokenOf(to) != 0) { // a non-existent token require(_massOf(_tokenOf(to)) < cap, "Exceeding cap"); } } }
function _beforeTokenTransfer(address, address to, uint256) private view { if (!specialWallets[to]) { if (_tokenOf(to) != 0) { // a non-existent token require(_massOf(_tokenOf(to)) < cap, "Exceeding cap"); } } }
5,575
17
// implements the permit function/_owner the owner of the funds/_spender the _spender/_value the amount/_deadline the deadline timestamp, type(uint256).max for no deadline/_v signature param/_r signature param/_s signature param
function permit( address _owner, address _spender, uint256 _value, uint256 _deadline, uint8 _v, bytes32 _r, bytes32 _s
function permit( address _owner, address _spender, uint256 _value, uint256 _deadline, uint8 _v, bytes32 _r, bytes32 _s
46,956
33
// Emit event that everything is fine
emit WithdrawRequestSucceeded(lastExchangePrice, _queryID);
emit WithdrawRequestSucceeded(lastExchangePrice, _queryID);
7,582
107
// See {IERC721-getApproved}. /
function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; }
function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; }
208
22
// EMERGENCY ONLY. Disable accept new position without going through Timelock in case of emergency.
function emergencySetAcceptDebt(address[] calldata addrs, bool isAcceptDebt) external onlyGovernor { uint256 len = addrs.length; for (uint256 idx = 0; idx < len; idx++) { workers[addrs[idx]].acceptDebt = isAcceptDebt; emit SetConfig( _msgSender(), addrs[idx], workers[addrs[...
function emergencySetAcceptDebt(address[] calldata addrs, bool isAcceptDebt) external onlyGovernor { uint256 len = addrs.length; for (uint256 idx = 0; idx < len; idx++) { workers[addrs[idx]].acceptDebt = isAcceptDebt; emit SetConfig( _msgSender(), addrs[idx], workers[addrs[...
52,047
58
// Put a token up for auction. _tokenId ID of token to auction, sender must be owner _startingPrice Price of item (in wei) at beginning of auction _endingPrice Price of item (in wei) at end of auction _duration Length of auction (in seconds) /
function createAuction( uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration ) whenNotPaused external
function createAuction( uint256 _tokenId, uint256 _startingPrice, uint256 _endingPrice, uint256 _duration ) whenNotPaused external
15,120
2
// Max approve token in
_params.tokenIn.maxApproveIfNecessary(_params.allowanceTarget);
_params.tokenIn.maxApproveIfNecessary(_params.allowanceTarget);
16,325
5
// https:docs.synthetix.io/contracts/Owned
abstract contract Owned { address public owner; address public nominatedOwner; constructor(address _owner) public { require(_owner != address(0), "Owner address cannot be 0"); owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner)...
abstract contract Owned { address public owner; address public nominatedOwner; constructor(address _owner) public { require(_owner != address(0), "Owner address cannot be 0"); owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner)...
29,111
31
// quadratic reward curve constants a + bx + cx^2
uint256 public A = 187255; // 1.87255 uint256 public B = 29854; // 0.2985466*x uint256 public C = 141; // 0.001419838*x^2 uint256 public maxDays = 365; uint256 public minDays = 10; uint256 public totalStaked = 0; uint256 public totalRewards = 0;
uint256 public A = 187255; // 1.87255 uint256 public B = 29854; // 0.2985466*x uint256 public C = 141; // 0.001419838*x^2 uint256 public maxDays = 365; uint256 public minDays = 10; uint256 public totalStaked = 0; uint256 public totalRewards = 0;
11,858
8
// Must be a branch node at this point
require(node.length == 17, "Invalid node length"); if (i == proof.length - 1) {
require(node.length == 17, "Invalid node length"); if (i == proof.length - 1) {
34,457
924
// Gets the value of `fundOwner` variable/ return fundOwner_ The `fundOwner` variable value
function getFundOwner() external view returns (address fundOwner_) { return fundOwner; }
function getFundOwner() external view returns (address fundOwner_) { return fundOwner; }
44,405
2
// return (size,of chunks)
function size(bytes memory name) external view returns (uint256, uint256); function remove(bytes memory name) external returns (uint256); function countChunks(bytes memory name) external view returns (uint256);
function size(bytes memory name) external view returns (uint256, uint256); function remove(bytes memory name) external returns (uint256); function countChunks(bytes memory name) external view returns (uint256);
35,354
83
// Set the next increase direction
nextIncreaseDirection = (nextIncreaseDirection + 1) % 4;
nextIncreaseDirection = (nextIncreaseDirection + 1) % 4;
34,602
73
// Unpauses the auction house
function unpause() external onlyOwner { _unpause(); // If this is the first auction: if (!settings.launched) { // Mark the DAO as launched settings.launched = true; // Transfer ownership of the auction contract to the DAO transferOwnership(se...
function unpause() external onlyOwner { _unpause(); // If this is the first auction: if (!settings.launched) { // Mark the DAO as launched settings.launched = true; // Transfer ownership of the auction contract to the DAO transferOwnership(se...
14,393
69
// Creates a new NFT type _cid Content identifier _data Data to pass if receiver is contractreturn _id The newly created token ID /
function create(string calldata _cid, bytes calldata _data) external onlyOwner returns (uint256 _id)
function create(string calldata _cid, bytes calldata _data) external onlyOwner returns (uint256 _id)
73,389
5
// Insurance factor as 18-digit decimal
uint256 public insuranceFactor;
uint256 public insuranceFactor;
8,315
19
// updated to be divided by royaltyAmount
return (owner(), (_salePrice * royaltyBPS) / 10_000);
return (owner(), (_salePrice * royaltyBPS) / 10_000);
26,470
0
// Supply ETH as collateral, get cETH in return
cEth.mint{ value: msg.value, gas: 250000 }();
cEth.mint{ value: msg.value, gas: 250000 }();
6,554
6
// Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given current on-chain conditions. assets The amount of underlying assets to be transferred.return shares The amount of vault shares that will be minted. /
function previewDeposit(uint256 assets) external view returns (uint256 shares);
function previewDeposit(uint256 assets) external view returns (uint256 shares);
49,639
5
// Returns the list of the underlying assets of all the initialized reserves It does not include dropped reservesreturn The addresses of the underlying assets of the initialized reserves // Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct id The id...
function updateBridgeProtocolFee(uint256 bridgeProtocolFee) external;
function updateBridgeProtocolFee(uint256 bridgeProtocolFee) external;
20,343
2
// Compute the final score given a bundle of rating information/_scoresThe array of scores/_blocksThe array of blocks containing the scores/_valuesSkill The array of values about skill of item rated
function compute(uint[] calldata _scores, uint[] calldata _blocks, uint[] calldata _valuesSkill ) external pure returns(uint);
function compute(uint[] calldata _scores, uint[] calldata _blocks, uint[] calldata _valuesSkill ) external pure returns(uint);
18,777
901
// Overloaded method to enable short term backwards compatibility. Will be deprecated in the next DVM version.
function hasPrice(bytes32 identifier, uint256 time) public view override returns (bool)
function hasPrice(bytes32 identifier, uint256 time) public view override returns (bool)
52,090
89
// =================================================================================================================Modifiers =================================================================================================================
modifier isKycPending() { require(state == State.KycPending); _; }
modifier isKycPending() { require(state == State.KycPending); _; }
28,484
49
// Check if the guard value has its original value
require(_guardValue == 0, "REENTRANCY");
require(_guardValue == 0, "REENTRANCY");
32,490
2
// let's return _refund back to the relayer
_relayer.transfer(_refund);
_relayer.transfer(_refund);
18,287
38
// the correct event
emit SubscriptionReleased(_paymentIdentifier, msg.sender, _dueDate);
emit SubscriptionReleased(_paymentIdentifier, msg.sender, _dueDate);
30,209
7
// Convert uint32 value into bytes v The uint32 valuereturnConverted bytes array/
function WriteUint32(uint32 v) internal pure returns(bytes memory) { bytes memory buff; assembly{ buff := mload(0x40) let byteLen := 0x04 mstore(buff, byteLen) for { let mindex := 0x00 let vindex := 0x1f } lt...
function WriteUint32(uint32 v) internal pure returns(bytes memory) { bytes memory buff; assembly{ buff := mload(0x40) let byteLen := 0x04 mstore(buff, byteLen) for { let mindex := 0x00 let vindex := 0x1f } lt...
12,007
36
// shareholder address => ( signature number for this shareholder => signature data)
mapping(address => mapping(uint => Signature)) public signaturesByAddress;
mapping(address => mapping(uint => Signature)) public signaturesByAddress;
9,205
20
// Sets and resets mutex in order to block functin reentry
modifier preventReentry() { require(!__reMutex); __reMutex = true; _; delete __reMutex; }
modifier preventReentry() { require(!__reMutex); __reMutex = true; _; delete __reMutex; }
4,052
1
// Store custom descriptions for GOOPs
mapping (uint => string) public customDescription;
mapping (uint => string) public customDescription;
10,010
78
// Set of owners NOTE: we utilize a set, so we can enumerate the owners and so that the list only contains one instance of an account NOTE: address(0) is not a valid owner
EnumerableSet.AddressSet private _owners;
EnumerableSet.AddressSet private _owners;
53,384
8
// list of aliases for Walker's Alias algorithm
uint8[][14] public aliases;
uint8[][14] public aliases;
39,521
2
// PIEPS^3
uint128 constant PI = 3141592653589793238; uint128 constant PRECISION = 100;
uint128 constant PI = 3141592653589793238; uint128 constant PRECISION = 100;
6,455
14
// Uniswap more expensive
function arb(address tokenAddress) public { uint256 uniswapOutput = shitcoinPrice(tokenAddress, "uniswap"); uint256 sushiswapOutput = shitcoinPrice(tokenAddress, "sushiswap"); uint256 oneEth = 1000000000000000000; uint[] memory amount = buyShitcoin(tokenAddress, oneEth, uniswapOutp...
function arb(address tokenAddress) public { uint256 uniswapOutput = shitcoinPrice(tokenAddress, "uniswap"); uint256 sushiswapOutput = shitcoinPrice(tokenAddress, "sushiswap"); uint256 oneEth = 1000000000000000000; uint[] memory amount = buyShitcoin(tokenAddress, oneEth, uniswapOutp...
4,764
4
// storage // initialization function /
function initializeLock() external initializer {} function initialize() external override initializer { OwnableERC721._setNFT(msg.sender); }
function initializeLock() external initializer {} function initialize() external override initializer { OwnableERC721._setNFT(msg.sender); }
28,549
5
// offset the pointer if the first byte
uint8 byte0; assembly { byte0 := byte(0, mload(memPtr)) }
uint8 byte0; assembly { byte0 := byte(0, mload(memPtr)) }
22,278
140
// sale settings
uint256 constant private MAX_SUPPLY = 20000; uint256 private COST = 0.025 ether; string private baseURI; constructor( string memory _initBaseURI, address[] memory payees, uint256[] memory shares
uint256 constant private MAX_SUPPLY = 20000; uint256 private COST = 0.025 ether; string private baseURI; constructor( string memory _initBaseURI, address[] memory payees, uint256[] memory shares
27,137
22
// Function for the game to set a withdrawalRequest for the rewards of the game user/_value Amount to set a request in vaultCurrency/_user Address of the user
function redeemRewardsGame( uint256 _value, address _user
function redeemRewardsGame( uint256 _value, address _user
6,317
9
// Cannot transfer to the zero address. /
error TransferToZeroAddress();
error TransferToZeroAddress();
40,116
30
// Add support for the asset./_debridgeId Asset identifier./_maxAmount Maximum amount of current chain token to be wrapped./_minReservesBps Minimal reserve ration in BPS.
function updateAsset( bytes32 _debridgeId, uint256 _maxAmount, uint16 _minReservesBps, uint256 _amountThreshold
function updateAsset( bytes32 _debridgeId, uint256 _maxAmount, uint16 _minReservesBps, uint256 _amountThreshold
49,770
288
// Random DS Proof Step 2: The unique keyhash has to match with the sha256 of (context name + _queryId)
uint ledgerProofLength = 3 + 65 + (uint(uint8(_proof[3 + 65 + 1])) + 2) + 32; bytes memory keyhash = new bytes(32); copyBytes(_proof, ledgerProofLength, 32, keyhash, 0); if (!(keccak256(keyhash) == keccak256(abi.encodePacked(sha256(abi.encodePacked(_contextName, _queryId)))))) { ...
uint ledgerProofLength = 3 + 65 + (uint(uint8(_proof[3 + 65 + 1])) + 2) + 32; bytes memory keyhash = new bytes(32); copyBytes(_proof, ledgerProofLength, 32, keyhash, 0); if (!(keccak256(keyhash) == keccak256(abi.encodePacked(sha256(abi.encodePacked(_contextName, _queryId)))))) { ...
11,037
41
// ========== DEPOSIT ========== / NOTE: Guarded by onlyMiningContract
function depositEth(address miner) override payable external onlyBy(C_NestMining)
function depositEth(address miner) override payable external onlyBy(C_NestMining)
17,373
11
// saddle swap2
address swap2, uint8 tokenIndexFrom2, uint8 tokenIndexTo2, uint256 minDy2,
address swap2, uint8 tokenIndexFrom2, uint8 tokenIndexTo2, uint256 minDy2,
35,651
200
// The following functions are overrides required by Solidity.
function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool)
function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool)
4,911
49
// read 3 bytes
let input := mload(dataPtr)
let input := mload(dataPtr)
17,412
117
// - return address of user - _userId - unique number of user in array /
function getUser(uint256 _userId) public view returns(address) { return users[_userId]; }
function getUser(uint256 _userId) public view returns(address) { return users[_userId]; }
23,446
111
// Get ether to token conversion
uint tokens = ethToTokens(msg.value);
uint tokens = ethToTokens(msg.value);
39,042
34
// Tokensend Functions/
function getTotalAmountOfTokens(uint256 _weiAmount) internal pure returns (uint256) { uint256 amountOfTokens = 0; if(_weiAmount == 0){ amountOfTokens = 0 * (10**uint256(decimals)); } if( _weiAmount == 0.002 ether){ amountOfTokens = 20 * 10**3 * (10**uint256(decimals)); } if( ...
function getTotalAmountOfTokens(uint256 _weiAmount) internal pure returns (uint256) { uint256 amountOfTokens = 0; if(_weiAmount == 0){ amountOfTokens = 0 * (10**uint256(decimals)); } if( _weiAmount == 0.002 ether){ amountOfTokens = 20 * 10**3 * (10**uint256(decimals)); } if( ...
80,279
8
// Call the implementation. out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation__, 0, calldatasize(), 0, 0)
let result := delegatecall(gas(), implementation__, 0, calldatasize(), 0, 0)
13,715
26
// Give random antz to the provided address /
function reserveAntz(address _address) external onlyCollaborator
function reserveAntz(address _address) external onlyCollaborator
35,963
20
// - Runs logic to ensure Line owns all modules are configured properly - collateral, interest rates, arbiter, etc. - Changes `status` from UNINITIALIZED to ACTIVE - Reverts on failure to update status /
function init() external;
function init() external;
29,594