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
10
// Assign new success share for sysAdmin to receive after successful execution/Only callable by sysAdmin/_percentage New % success share of total gas consumed
function setSysAdminSuccessShare(uint256 _percentage) external;
function setSysAdminSuccessShare(uint256 _percentage) external;
46,761
488
// Increment the staker's shortfall counter.
shortfallCounter = shortfallCounter.add(1);
shortfallCounter = shortfallCounter.add(1);
30,132
57
// Allows owner to withdraw all ether from contract's balance/
function withdrawEther() public onlyOwner{ owner.transfer(address(this).balance); }
function withdrawEther() public onlyOwner{ owner.transfer(address(this).balance); }
11,442
126
// burn
uint256 receivedEther = user.burn(mintedTokens); assertEq(receivedEther, 10 ether);
uint256 receivedEther = user.burn(mintedTokens); assertEq(receivedEther, 10 ether);
39,936
1,172
// This is a non-standard ERC-20
success := 1 // set success to true
success := 1 // set success to true
35,876
46
// Low level remove payment token function (only by contract owner). environment Address of environment. /
function _removeEnvironment(address environment) private onlyOwner { uint256 curIndex = _environmentsIndexes[environment]; delete _environmentsIndexes[environment]; delete _environments[curIndex]; emit RemoveEnvironment(environment); }
function _removeEnvironment(address environment) private onlyOwner { uint256 curIndex = _environmentsIndexes[environment]; delete _environmentsIndexes[environment]; delete _environments[curIndex]; emit RemoveEnvironment(environment); }
27,814
53
// Public PreSale register contract
contract PresaleRegister is Ownable { mapping (address => bool) verified; event ApprovedInvestor(address indexed investor); /* * Approve function to adjust allowance to investment of each individual investor * @param _investor address sets the beneficiary for later use * @param _amount uint...
contract PresaleRegister is Ownable { mapping (address => bool) verified; event ApprovedInvestor(address indexed investor); /* * Approve function to adjust allowance to investment of each individual investor * @param _investor address sets the beneficiary for later use * @param _amount uint...
5,323
30
// Start Contruibute
function startContruibute() public isOwner atStage(Stages.SetUp)
function startContruibute() public isOwner atStage(Stages.SetUp)
21,992
85
// Checks if the given notary was added to notarize this DataOrder. notary Notary address to check.return true if the Notary was added, false otherwise. /
function hasNotaryBeenAdded( address notary
function hasNotaryBeenAdded( address notary
36,215
1
// use tokenCounter as an id for each created token use _safeMint inherited from ERC721 contract to mint a token
_tokenIds.increment(); uint256 newItemId = _tokenIds.current(); tokenIdtoMetadata[newItemId] = input; _safeMint(recipient, newItemId); string memory createdTokenURI = tokenURI(newItemId); return createdTokenURI;
_tokenIds.increment(); uint256 newItemId = _tokenIds.current(); tokenIdtoMetadata[newItemId] = input; _safeMint(recipient, newItemId); string memory createdTokenURI = tokenURI(newItemId); return createdTokenURI;
18,867
202
// Token 图片(IPFS) /
string public tokenUri;
string public tokenUri;
35,415
0
// Constructor function.It initializes the token contract with the provided initial supply of tokens.The initial supply is assigned to the contract deployer. /
constructor( string memory _name, string memory _symbol, uint256 initialSupply
constructor( string memory _name, string memory _symbol, uint256 initialSupply
28,073
4
// Get the downside protection rate based on the current pool conditions/juniorLiquidity The total amount of junior liquidity in the pool/seniorLiquidity The total amount of senior liquidity in the pool/ return uint256 The downside protection rate, scaled by `scaleFactor`
function getDownsideProtectionRate(uint256 juniorLiquidity, uint256 seniorLiquidity) public pure override returns (uint256) { uint256 total = juniorLiquidity + seniorLiquidity; if (total == 0) { return 0; } uint256 protection = maxProtectionPercentage * juniorLiquidity /...
function getDownsideProtectionRate(uint256 juniorLiquidity, uint256 seniorLiquidity) public pure override returns (uint256) { uint256 total = juniorLiquidity + seniorLiquidity; if (total == 0) { return 0; } uint256 protection = maxProtectionPercentage * juniorLiquidity /...
45,437
20
// Allows GeoJam Dev Team to quickly withdraw all JAM this contract holds. Meant to be used in case of an emergency or to remove leftoverJAM after staking ends. /
function emergencyWithdraw() external onlyOwner { uint256 contractRewardBalance = rewardToken.balanceOf(address(this)); rewardToken.safeTransfer(owner(), contractRewardBalance); rewardAmount = 0; emit FundsWithdrawn(contractRewardBalance); }
function emergencyWithdraw() external onlyOwner { uint256 contractRewardBalance = rewardToken.balanceOf(address(this)); rewardToken.safeTransfer(owner(), contractRewardBalance); rewardAmount = 0; emit FundsWithdrawn(contractRewardBalance); }
13,712
26
// ERC-721 Non-Fungible Token with optional enumeration extension logic /
contract ERC721Enumerable is Context, ERC165, ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => uint256[]) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array ...
contract ERC721Enumerable is Context, ERC165, ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => uint256[]) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array ...
10,964
295
// We've hit the end of the key meaning the value should be within this branch node.
break;
break;
34,466
17
// 转入GWTB
_safeFromTransfer(GWTB,msg.sender,address(this),value); uint256 total = getGWTB_USDT(value.div((10 ** 12))); InterfaceERC20(USDT).transfer(msg.sender,total); uint256 index = UserIndex[msg.sender]; if(index == 0){ if(referrer != msg.sender && referrer != addre...
_safeFromTransfer(GWTB,msg.sender,address(this),value); uint256 total = getGWTB_USDT(value.div((10 ** 12))); InterfaceERC20(USDT).transfer(msg.sender,total); uint256 index = UserIndex[msg.sender]; if(index == 0){ if(referrer != msg.sender && referrer != addre...
22,360
233
// View function to see pending SUSHIs/USDCows/USDCs on frontend.
function pendingSushi(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accSushiPerShare = pool.accSushiPerShare; uint256 lpSupply = pool.token.balanceOf(address(this)); ...
function pendingSushi(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accSushiPerShare = pool.accSushiPerShare; uint256 lpSupply = pool.token.balanceOf(address(this)); ...
20,880
49
// Ensure the change in the current price of CELO quoted in the stable token relative to the value when the proposal was created is within the allowed limit.
FixidityLib.Fraction memory currentRate = getOracleExchangeRate(proposal.stableToken); FixidityLib.Fraction memory proposalRate = FixidityLib.wrap( proposal.celoStableTokenExchangeRate ); (FixidityLib.Fraction memory lesserRate, FixidityLib.Fraction memory greaterRate) = currentRate .lt(prop...
FixidityLib.Fraction memory currentRate = getOracleExchangeRate(proposal.stableToken); FixidityLib.Fraction memory proposalRate = FixidityLib.wrap( proposal.celoStableTokenExchangeRate ); (FixidityLib.Fraction memory lesserRate, FixidityLib.Fraction memory greaterRate) = currentRate .lt(prop...
37,858
693
// Allows users to withdraw their lent funds. An account can withdraw its weighted share of thebucket. While the position is open, a bucket's share is equal to:Owed Token: (Available Amount) + (Outstanding Principal)(1 + interest)Held Token: 0 After the position is closed, a bucket's share is equal to:Owed Token: (Avai...
function withdraw( uint256[] buckets, uint256[] maxWeights, address onBehalfOf ) external nonReentrant returns (uint256, uint256)
function withdraw( uint256[] buckets, uint256[] maxWeights, address onBehalfOf ) external nonReentrant returns (uint256, uint256)
72,473
3
// Returns the downcasted uint64 from uint256, reverting onoverflow (when the input is greater than largest uint64). Counterpart to Solidity's `uint64` operator. Requirements: - input must fit into 64 bits /
function toUint64(uint256 value) internal pure returns (uint64) { require( value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits" ); return uint64(value); }
function toUint64(uint256 value) internal pure returns (uint64) { require( value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits" ); return uint64(value); }
7,816
43
// ICO goals are not reached, ICO terminated and cannot be resumed.
NotCompleted,
NotCompleted,
77,326
23
// Set new moderator of the contract to a new account (`newMod`).Can only be called by the current owner. /
function setNewMod(address newMod) public virtual onlyOwner { _setNewMod(newMod); }
function setNewMod(address newMod) public virtual onlyOwner { _setNewMod(newMod); }
8,792
590
// https:docs.synthetix.io/contracts/source/interfaces/ihasbalance
interface IHasBalance { // Views function balanceOf(address account) external view returns (uint); }
interface IHasBalance { // Views function balanceOf(address account) external view returns (uint); }
48,822
73
// if a direct pair exists, we want to know whether pathA or path B is better
(path, amountOut) = comparePathsFixedInput(path, pathB, _amountIn, _i);
(path, amountOut) = comparePathsFixedInput(path, pathB, _amountIn, _i);
38,415
308
// update with no constraints, compensate & reward
if (overdueCount > 0) { _updateSlasherTimestamp(slasherId_, false); powerPoke.slashReporter(slasherId_, overdueCount); uint256 gasUsed = gasStart.sub(gasleft()); powerPoke.reward(slasherId_, gasUsed, COMPENSATION_PLAN_1_ID, rewardOpts); } else {
if (overdueCount > 0) { _updateSlasherTimestamp(slasherId_, false); powerPoke.slashReporter(slasherId_, overdueCount); uint256 gasUsed = gasStart.sub(gasleft()); powerPoke.reward(slasherId_, gasUsed, COMPENSATION_PLAN_1_ID, rewardOpts); } else {
16,376
75
// Returns the current nonce for `owner`. This value must beincluded whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. Thisprevents a signature from being used multiple times. /
function nonces(address owner) external view returns (uint256);
function nonces(address owner) external view returns (uint256);
223
61
// sets up our call struct which is assigned with the minting process to a short and then to a long upon sale
struct Call { address payable short; uint assetAmt; uint strike; uint totalPurch; uint price; uint expiry; bool open; bool tradeable; address payable long; bool exercised; }
struct Call { address payable short; uint assetAmt; uint strike; uint totalPurch; uint price; uint expiry; bool open; bool tradeable; address payable long; bool exercised; }
13,032
6
// Returns true if agent can place a bet in current betting stage.
function canBet(address agent) public view returns(bool) { mapping(address => Bet) storage group = stageToGroup(BETTING); return group[agent].amount == 0 && currTimePeriod < STAGE_LENGTH; }
function canBet(address agent) public view returns(bool) { mapping(address => Bet) storage group = stageToGroup(BETTING); return group[agent].amount == 0 && currTimePeriod < STAGE_LENGTH; }
27,519
20
// 1.15792e59 < uint(-1) / 1e18/
uint public constant REWARD_OVERFLOW_CHECK = 1.15792e59;
uint public constant REWARD_OVERFLOW_CHECK = 1.15792e59;
47,631
3
// Address that this module will pass transactions to.
address public target;
address public target;
13,501
4
// It sets parameters for pool _offeringAmountPool: offering amount (in tokens) _raisingAmountPool: raising amount (in LP tokens) _limitPerUserInLP: limit per user (in LP tokens) _hasTax: if the pool has a tax _pid: poolId This function is only callable by admin. /
function setPool( uint256 _offeringAmountPool, uint256 _raisingAmountPool, uint256 _limitPerUserInLP,
function setPool( uint256 _offeringAmountPool, uint256 _raisingAmountPool, uint256 _limitPerUserInLP,
37,479
83
// Admin can transfer his ownership to new address
function transferownership(address _newaddress) ownership public returns(bool){ require(_newaddress != address(0)); emit transferredOwnership(_admin, _newaddress); _admin=_newaddress; return true; }
function transferownership(address _newaddress) ownership public returns(bool){ require(_newaddress != address(0)); emit transferredOwnership(_admin, _newaddress); _admin=_newaddress; return true; }
22,513
42
// Mapping from token ID to owner balances
mapping (uint256 => mapping(address => uint256)) private _balances;
mapping (uint256 => mapping(address => uint256)) private _balances;
9,174
298
// Emitted when a contract changes its {IRelayHub} contract to a new one. /
event RelayHubChanged(address indexed oldRelayHub, address indexed newRelayHub);
event RelayHubChanged(address indexed oldRelayHub, address indexed newRelayHub);
7,846
170
// Get the allowance of `spender` for `holder` /
function allowance(address holder, address spender) public override(IBoostableERC20, IERC20) view returns (uint256) { return _allowances[holder][spender]; }
function allowance(address holder, address spender) public override(IBoostableERC20, IERC20) view returns (uint256) { return _allowances[holder][spender]; }
67,323
19
// Reads the last updated height from aggregator delegated to.[deprecated] Use latestRoundData instead. This does not error if noanswer has been reached, it will simply return 0. Either wait to point toan already answered Aggregator or use the recommended latestRoundDatainstead which includes better verification inform...
function latestTimestamp() public view virtual override returns (uint256 updatedAt)
function latestTimestamp() public view virtual override returns (uint256 updatedAt)
8,922
19
// get list of token ids of an owner/throw if 'owner' is zero address/owner address of owner/ return list of token ids of owner
function getTokensOfOwner(address owner) external override view returns(Tokens[] memory) { return _ownerTokens[owner]; }
function getTokensOfOwner(address owner) external override view returns(Tokens[] memory) { return _ownerTokens[owner]; }
13,539
14
// Certain adapters/exchanges needs to be initialized. This method will be called from Augustus/
function initialize(bytes calldata data) external;
function initialize(bytes calldata data) external;
16,646
82
// For updating marketingWallet and stackingPool address
function setWallets(address _marketingWallet,address _stackingPool) external onlyOwner{ marketingWallet = _marketingWallet; stackingPool = _stackingPool; }
function setWallets(address _marketingWallet,address _stackingPool) external onlyOwner{ marketingWallet = _marketingWallet; stackingPool = _stackingPool; }
23,082
3
// checks balance available to withdraw of msg.sender return the balance
function balance() public view returns (uint256) { return escrow.depositsOf(msg.sender); }
function balance() public view returns (uint256) { return escrow.depositsOf(msg.sender); }
27,658
5
// If the distributor bounty is > 0, mint it for the staking contract.
if (bounty > 0) { treasury.mint(address(staking), bounty); }
if (bounty > 0) { treasury.mint(address(staking), bounty); }
39,749
64
// point^(trace_length / 8192)/ mload(0x4380), Denominator for constraints: 'ecdsa/signature0/exponentiate_key/bit_extraction_end'. denominators[19] = point^(trace_length / 4096) - trace_generator^(251trace_length / 256).
mstore(0x4cc0, addmod(
mstore(0x4cc0, addmod(
51,616
168
// Premium = RedeemableTWAP ^ 2 - 1
Decimal.D256 memory redeemablePrice = getRedeemablePrice(epoch); return redeemablePrice.pow(2).sub(Decimal.one());
Decimal.D256 memory redeemablePrice = getRedeemablePrice(epoch); return redeemablePrice.pow(2).sub(Decimal.one());
47,447
94
// @abstract
function notifyRewardAmount(uint256 reward) external; function getRewardToken() external view returns (IERC20);
function notifyRewardAmount(uint256 reward) external; function getRewardToken() external view returns (IERC20);
54,143
47
// 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; }
3,434
15
// get the vote address here as well
function setContractAddress(address govtoken_add) public { gt = GovToken(govtoken_add); }
function setContractAddress(address govtoken_add) public { gt = GovToken(govtoken_add); }
11,767
77
// records our final settlement price and fires needed events./finalSettlementPrice final query price at time of settlement
function settleContract(uint finalSettlementPrice) internal { settlementTimeStamp = now; settlementPrice = finalSettlementPrice; emit ContractSettled(finalSettlementPrice); }
function settleContract(uint finalSettlementPrice) internal { settlementTimeStamp = now; settlementPrice = finalSettlementPrice; emit ContractSettled(finalSettlementPrice); }
15,806
29
// rOwned = ratio of tokens owned relative to circulating supply (NOT total supply, since circulating <= total) /
Fee public buyFee = Fee({reflection: 4, marketing: 8, lp: 0, buyback: 0, burn: 0, total: 12}); Fee public sellFee = Fee({reflection: 8, marketing: 16, lp: 0, buyback: 0, burn: 0, total: 24}); address private marketingFeeReceiver; address private lpFeeReceiver; address private buybackFeeReceiver; ...
Fee public buyFee = Fee({reflection: 4, marketing: 8, lp: 0, buyback: 0, burn: 0, total: 12}); Fee public sellFee = Fee({reflection: 8, marketing: 16, lp: 0, buyback: 0, burn: 0, total: 24}); address private marketingFeeReceiver; address private lpFeeReceiver; address private buybackFeeReceiver; ...
8,693
152
// URI of metadata
string baseURI; event Mashed( address indexed sender, uint256 containerId, address contract1, uint256 tokenId1, address contract2, uint256 tokenId2 );
string baseURI; event Mashed( address indexed sender, uint256 containerId, address contract1, uint256 tokenId1, address contract2, uint256 tokenId2 );
50,333
5
// This creates a map with donations per user // Additional structure to help to iterate over donations /
struct Impact { uint value; uint linked; uint accountCursor; uint count; mapping(uint => address) addresses; mapping(address => uint) values; }
struct Impact { uint value; uint linked; uint accountCursor; uint count; mapping(uint => address) addresses; mapping(address => uint) values; }
32,242
336
// deploy a proxy pointing to impl
TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy( publicLockImpl, proxyAdminAddress, data ); address payable newLock = payable(address(proxy));
TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy( publicLockImpl, proxyAdminAddress, data ); address payable newLock = payable(address(proxy));
13,545
207
// Returns number of nodes with available space. /
function countNodesWithFreeSpace(uint8 freeSpace) public view returns (uint count) { ConstantsHolder constantsHolder = ConstantsHolder(contractManager.getContract("ConstantsHolder")); count = 0; uint totalSpace = constantsHolder.TOTAL_SPACE_ON_NODE(); for (uint8 i = freeSpace; i <= t...
function countNodesWithFreeSpace(uint8 freeSpace) public view returns (uint count) { ConstantsHolder constantsHolder = ConstantsHolder(contractManager.getContract("ConstantsHolder")); count = 0; uint totalSpace = constantsHolder.TOTAL_SPACE_ON_NODE(); for (uint8 i = freeSpace; i <= t...
57,271
5
// Chainlink interface for getting the price of ETH in USD
AggregatorV3Interface internal ETHUSDPriceFeed;
AggregatorV3Interface internal ETHUSDPriceFeed;
33,441
15
// Internal function version of diamondCut This code is almost the same as the external diamondCut, except it is using 'Facet[] memory _diamondCut' instead of 'Facet[] calldata _diamondCut'. The code is duplicated to prevent copying calldata to memory which causes an error for a two dimensional array.
function diamondCut( IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata
function diamondCut( IDiamondCut.FacetCut[] memory _diamondCut, address _init, bytes memory _calldata
17,664
89
// The amount of funds that have already been withdrawn for a given edition.
mapping(uint256 => uint256) public withdrawnForEdition;
mapping(uint256 => uint256) public withdrawnForEdition;
28,244
36
// See {IERC20-allowance}. Note that operator and allowance concepts are orthogonal: operators maynot have allowance, and accounts with allowance may not be operatorsthemselves. /
function allowance(address holder, address spender) public view virtual override returns (uint256) { return _allowances[holder][spender]; }
function allowance(address holder, address spender) public view virtual override returns (uint256) { return _allowances[holder][spender]; }
19,974
116
// Settle the pool, the winners are selected randomly and fee is transfer to the manager. /
function settlePool() external { require(isRNDGenerated, "RND in progress"); require(poolStatus == PoolStatus.INPROGRESS, "pool in progress"); // generate winnerIndexes until the numOfWinners reach uint256 newRandom = randomResult; uint256 offset = 0; while(winnerInd...
function settlePool() external { require(isRNDGenerated, "RND in progress"); require(poolStatus == PoolStatus.INPROGRESS, "pool in progress"); // generate winnerIndexes until the numOfWinners reach uint256 newRandom = randomResult; uint256 offset = 0; while(winnerInd...
54,322
4
// Adds new Proof-of-Humanity to `proofOfHumanity` mapping for provided `agent` address. /
function submitEvidence( address agent, bytes memory timestamp, address delegate, bytes calldata evidence
function submitEvidence( address agent, bytes memory timestamp, address delegate, bytes calldata evidence
38,139
109
// any non-zero byte except "0x80" is considered true
function toBoolean(RLPItem memory item) internal pure returns (bool) { require(item.len == 1); uint result; uint memPtr = item.memPtr; assembly { result := byte(0, mload(memPtr)) } // SEE Github Issue #5. // Summary: Most commonly used RLP librari...
function toBoolean(RLPItem memory item) internal pure returns (bool) { require(item.len == 1); uint result; uint memPtr = item.memPtr; assembly { result := byte(0, mload(memPtr)) } // SEE Github Issue #5. // Summary: Most commonly used RLP librari...
24,773
44
// A descriptive name for a collection of NFTs in this contract
function name() external view returns (string memory _name);
function name() external view returns (string memory _name);
11,217
142
// Private function to update account information and auto-claim pending rewards
function updateAccount( address account, address claimAsToken, uint _amountOutMin_claimAsToken_weth, uint _amountOutMin_claimAsToken_dyp, uint _amountOutMin_attemptSwap, uint _deadline
function updateAccount( address account, address claimAsToken, uint _amountOutMin_claimAsToken_weth, uint _amountOutMin_claimAsToken_dyp, uint _amountOutMin_attemptSwap, uint _deadline
18,828
25
// change status to canceled
idToMarketItem[itemId].status = Status.Canceled; emit MarketItemStatusChanged( idToMarketItem[itemId].tokenId, idToMarketItem[itemId].tokenContract, msg.sender, Status.Canceled );
idToMarketItem[itemId].status = Status.Canceled; emit MarketItemStatusChanged( idToMarketItem[itemId].tokenId, idToMarketItem[itemId].tokenContract, msg.sender, Status.Canceled );
29,678
40
// Set the _pause state of the pool- Only callable by the LendPoolConfigurator contract val `true` to pause the pool, `false` to un-pause it /
function setPause(bool val) external override onlyLendPoolConfigurator { _paused = val; if (_paused) { emit Paused(); } else { emit Unpaused(); } }
function setPause(bool val) external override onlyLendPoolConfigurator { _paused = val; if (_paused) { emit Paused(); } else { emit Unpaused(); } }
68,636
38
// may include Policy Hook-type checks
if (!markets[cToken].accountMembership[borrower]) { return uint(Error.MARKET_NOT_ENTERED); }
if (!markets[cToken].accountMembership[borrower]) { return uint(Error.MARKET_NOT_ENTERED); }
35,284
41
// Function used to charge fee on trades/There are 3 different fees charged - admin, curator and curve/Admin fee percentage is fetched from the factory contract and the fee charged is transferred to factory contract/Curator fee is fetched from curatorFee variable and total fee accrued is stored in feeAccruedCurator var...
function _chargeFee(uint256 _amount) private returns(uint256) { address payable _factory = factory; uint256 _adminFeeAmt = NibblVaultFactory(_factory).feeAdmin(); uint256 _feeAdmin = (_amount * _adminFeeAmt) / SCALE ; uint256 _feeCurator = (_amount * curatorFee) / SCALE ; uin...
function _chargeFee(uint256 _amount) private returns(uint256) { address payable _factory = factory; uint256 _adminFeeAmt = NibblVaultFactory(_factory).feeAdmin(); uint256 _feeAdmin = (_amount * _adminFeeAmt) / SCALE ; uint256 _feeCurator = (_amount * curatorFee) / SCALE ; uin...
43,529
156
// Calculates total rewards (including those on hold if any) for the user till current period_address address of the user /
function calculateRewardTotal(address _address) public view returns (uint256)
function calculateRewardTotal(address _address) public view returns (uint256)
17,839
2
// % of revenue tokens to take from Spigot if the Line of Creditis healthy. 0 decimals
uint8 public immutable defaultRevenueSplit;
uint8 public immutable defaultRevenueSplit;
27,902
92
// ETH / Vader, 18 decimals
uint ethPerVader = pairData .nativeTokenPriceAverage .mul(ONE_VADER) .decode144();
uint ethPerVader = pairData .nativeTokenPriceAverage .mul(ONE_VADER) .decode144();
16,844
17
// 계약 번호 => 종료된 대출 계약서
mapping (bytes32 => ClosedContract) loanIdToClosedContract; bytes32[] contracts; bytes32[] closedContracts;
mapping (bytes32 => ClosedContract) loanIdToClosedContract; bytes32[] contracts; bytes32[] closedContracts;
40,120
14
// Holds number & validity of tokens locked for a given reason for a specified address /
mapping(address => mapping(bytes32 => LockToken)) public locked;
mapping(address => mapping(bytes32 => LockToken)) public locked;
19,229
52
// the address of the Aave price provider
address public constant AAVE_PRICES_PROVIDER = 0x76B47460d7F7c5222cFb6b6A75615ab10895DDe4; address public constant KYBER_ETH_MOCK_ADDRESS = address( 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE );
address public constant AAVE_PRICES_PROVIDER = 0x76B47460d7F7c5222cFb6b6A75615ab10895DDe4; address public constant KYBER_ETH_MOCK_ADDRESS = address( 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE );
8,773
154
// The number One in precise units.
uint256 constant internal PRECISE_UNIT = 10 ** 18; int256 constant internal PRECISE_UNIT_INT = 10 ** 18;
uint256 constant internal PRECISE_UNIT = 10 ** 18; int256 constant internal PRECISE_UNIT_INT = 10 ** 18;
8,413
54
// This function initializes the curve contract, and ensure thecurve has the required permissions on the token contract neededto function. /
function init() external;
function init() external;
37,402
10
// Subscription operations // Approve the subscription of an index token Super token address publisher The publisher of the index indexId Id of the index ctx Context bytes (see ISuperfluid.sol for Context struct) @custom:callbacks - if subscription exist- AgreementCreated callback to the publisher: - agreementId is for...
function approveSubscription(
function approveSubscription(
5,165
32
// get contract balance
function getThisBalance() public view returns(uint)
function getThisBalance() public view returns(uint)
4,548
50
// Unwrap this contract's `wETH` into ETH
function unwrapWETH(uint256 amountMinimum, address recipient) external { uint256 balanceWETH = balanceOfThis(wETH); require(balanceWETH >= amountMinimum, "INSUFFICIENT_WETH"); if (balanceWETH != 0) { withdrawFromWETH(balanceWETH); safeTransferETH(recipient, balanceWET...
function unwrapWETH(uint256 amountMinimum, address recipient) external { uint256 balanceWETH = balanceOfThis(wETH); require(balanceWETH >= amountMinimum, "INSUFFICIENT_WETH"); if (balanceWETH != 0) { withdrawFromWETH(balanceWETH); safeTransferETH(recipient, balanceWET...
26,473
113
// The block number when VAULT mining starts.
uint256 public startBlock; uint256 public halvePeriod = 720; uint256 public lastHalveBlock; uint256 public minimumVaultPerBlock = 0.00625 ether; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);...
uint256 public startBlock; uint256 public halvePeriod = 720; uint256 public lastHalveBlock; uint256 public minimumVaultPerBlock = 0.00625 ether; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);...
25,585
0
// Interface of INinety1. /
interface INinety1 { function mint(address _folder) external; }
interface INinety1 { function mint(address _folder) external; }
33,496
178
// OKF tokens created per block.
uint256 public okfPerBlock;
uint256 public okfPerBlock;
41,237
8
// Buy sell token. /
function distribute() external nonReentrant{ require(_whitelist[msg.sender].amount > 0,"Is not available for this account"); uint256 balance = saleToken.balanceOf(address(this)); uint256 distributeTokenAmount = _whitelist[msg.sender].amount; _whitelist[msg.sender].amount=0; ...
function distribute() external nonReentrant{ require(_whitelist[msg.sender].amount > 0,"Is not available for this account"); uint256 balance = saleToken.balanceOf(address(this)); uint256 distributeTokenAmount = _whitelist[msg.sender].amount; _whitelist[msg.sender].amount=0; ...
29,456
320
// Swap imbalanced token as long as we haven't used the entire amountSpecified and haven't reached the price limit
pool.swap( address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96,
pool.swap( address(this), zeroForOne, amountSpecified, sqrtPriceLimitX96,
1,433
3
// Compute the linear combination vk_x
Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0); for (uint i = 0; i < input.length; i++) { require(input[i] < snark_scalar_field); vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.gamma_abc[i + 1], input[i])); }
Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0); for (uint i = 0; i < input.length; i++) { require(input[i] < snark_scalar_field); vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.gamma_abc[i + 1], input[i])); }
3,186
80
// Calculates the option's delta sp is the spot price of the option st is the strike price of the option v is the annualized volatility of the underlying asset expiryTimestamp is the unix timestamp of expiryreturn delta for given option. 4 decimals (ex: 8100 = 0.81 delta) as this is what strike selectionmodule recogniz...
function getOptionDelta( uint256 sp, uint256 st, uint256 v, uint256 expiryTimestamp
function getOptionDelta( uint256 sp, uint256 st, uint256 v, uint256 expiryTimestamp
47,232
19
// mark as claimed and transfer
_setClaimed(_index); token.safeTransfer(_claimee, _amount);
_setClaimed(_index); token.safeTransfer(_claimee, _amount);
67,349
55
// Update lastUpdatedIndex value
_self.lastUpdatedIndex = newNodeIndex;
_self.lastUpdatedIndex = newNodeIndex;
24,108
8
// update user
uint256 currentIndex = ++user.stakesCount; Stake storage _currentStake = user.stakes[currentIndex]; _currentStake.amount = amount; _currentStake.startTime = block.timestamp; _currentStake.endTime = block.timestamp + lockDuration;
uint256 currentIndex = ++user.stakesCount; Stake storage _currentStake = user.stakes[currentIndex]; _currentStake.amount = amount; _currentStake.startTime = block.timestamp; _currentStake.endTime = block.timestamp + lockDuration;
27,048
36
// promote safe user behavior
if (controller.approve(msg.sender, _spender, _value)) { Approval(msg.sender, _spender, _value); return true; }
if (controller.approve(msg.sender, _spender, _value)) { Approval(msg.sender, _spender, _value); return true; }
10,226
25
// get the current ecliptic contract
IEcliptic ecliptic = IEcliptic(azimuth.owner());
IEcliptic ecliptic = IEcliptic(azimuth.owner());
68,073
159
// re-invest here
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(platformTokenReceived);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(platformTokenReceived);
25,803
490
// See {IERC721CreatorCore-mintExtensionBatch}. /
function mintExtensionBatch(address to, uint16 count) public virtual override nonReentrant returns(uint256[] memory tokenIds) { requireExtension(); tokenIds = new uint256[](count); uint256 firstTokenId = _tokenCount+1; _tokenCount += count; for (uint i; i < count;) { ...
function mintExtensionBatch(address to, uint16 count) public virtual override nonReentrant returns(uint256[] memory tokenIds) { requireExtension(); tokenIds = new uint256[](count); uint256 firstTokenId = _tokenCount+1; _tokenCount += count; for (uint i; i < count;) { ...
19,549
160
// 检查点映射[委托人][检查点] = 检查点构造体(当前区块号, 新票数)
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
7,751
21
// Transfer pyth update fee to orderbook
payable(orderbook_address).transfer(pyth_update_fee);
payable(orderbook_address).transfer(pyth_update_fee);
28,337
106
// First withdraw all rewards, than withdarw it all, then stake back the remaining. /
function withdraw(uint256 amount) external override virtual returns (bool) { address _staker = msg.sender; return _withdraw(_staker, amount); }
function withdraw(uint256 amount) external override virtual returns (bool) { address _staker = msg.sender; return _withdraw(_staker, amount); }
20,968
52
// Deposit assets into the Prize Pool in exchange for tokens/to The address receiving the newly minted tokens/amount The amount of assets to deposit/controlledToken The address of the type of token the user is minting/referrer The referrer of the deposit
function depositTo( address to, uint256 amount, address controlledToken, address referrer ) external override nonReentrant onlyControlledToken(controlledToken) canAddLiquidity(amount)
function depositTo( address to, uint256 amount, address controlledToken, address referrer ) external override nonReentrant onlyControlledToken(controlledToken) canAddLiquidity(amount)
13,589
1
// Add Ether to index 0
currencies.push( Currency ({ exRateToEther: 1, exRateDecimals: 0 })
currencies.push( Currency ({ exRateToEther: 1, exRateDecimals: 0 })
43,635
6
// Whether the delegation is in the top delegations/ @custom:selector 91cc8657/delegator Who made this delegation/candidate The candidate for which the delegation is in support of/ return If delegation is in top delegations (is counted)
function isInTopDelegations(address delegator, address candidate) external view returns (bool);
function isInTopDelegations(address delegator, address candidate) external view returns (bool);
32,295
1
// The approximate cost of calling the enqueue function
uint256 public enqueueGasCost;
uint256 public enqueueGasCost;
26,908
229
// Sanity check that we don't exceed actual physical balances In case this happens, adjust virtual balances to not exceed maximum available reserves while still preserving correct price
if (wTokenVirtualBalance > wTokenBalanceMax) { wTokenVirtualBalance = wTokenBalanceMax; bTokenVirtualBalance = wTokenVirtualBalance .mul(wTokenPrice) .div(bTokenPrice); }
if (wTokenVirtualBalance > wTokenBalanceMax) { wTokenVirtualBalance = wTokenBalanceMax; bTokenVirtualBalance = wTokenVirtualBalance .mul(wTokenPrice) .div(bTokenPrice); }
7,095
10
// 設定遊戲擁有者
_game._gameInitiator = msg.sender;
_game._gameInitiator = msg.sender;
27,590