View Source: contracts/libraries/PriceLibV1.sol
PriceLibV1
- getPriceOracleInternal(IStore s)
- setNpmPrice(IStore s)
- convertNpmLpUnitsToStabelcoinInternal(IStore s, uint256 amountIn)
- getLastUpdatedOnInternal(IStore s, bytes32 coverKey)
- setLastUpdatedOnInternal(IStore s, bytes32 coverKey)
- getLastUpdateKeyInternal(bytes32 coverKey)
- getNpmPriceInternal(IStore s, uint256 amountIn)
function getPriceOracleInternal(IStore s) public view
returns(contract IPriceOracle)Arguments
| Name | Type | Description |
|---|---|---|
| s | IStore |
Source Code
function getPriceOracleInternal(IStore s) public view returns (IPriceOracle) {
return IPriceOracle(s.getNpmPriceOracleInternal());
}function setNpmPrice(IStore s) internal nonpayableArguments
| Name | Type | Description |
|---|---|---|
| s | IStore |
Source Code
function setNpmPrice(IStore s) internal {
IPriceOracle oracle = getPriceOracleInternal(s);
if (address(oracle) == address(0)) {
return;
}
oracle.update();
}function convertNpmLpUnitsToStabelcoinInternal(IStore s, uint256 amountIn) external view
returns(uint256)Arguments
| Name | Type | Description |
|---|---|---|
| s | IStore | |
| amountIn | uint256 |
Source Code
function convertNpmLpUnitsToStabelcoinInternal(IStore s, uint256 amountIn) external view returns (uint256) {
return getPriceOracleInternal(s).consultPair(amountIn);
}function getLastUpdatedOnInternal(IStore s, bytes32 coverKey) external view
returns(uint256)Arguments
| Name | Type | Description |
|---|---|---|
| s | IStore | |
| coverKey | bytes32 |
Source Code
function getLastUpdatedOnInternal(IStore s, bytes32 coverKey) external view returns (uint256) {
bytes32 key = getLastUpdateKeyInternal(coverKey);
return s.getUintByKey(key);
}function setLastUpdatedOnInternal(IStore s, bytes32 coverKey) external nonpayableArguments
| Name | Type | Description |
|---|---|---|
| s | IStore | |
| coverKey | bytes32 |
Source Code
function setLastUpdatedOnInternal(IStore s, bytes32 coverKey) external {
bytes32 key = getLastUpdateKeyInternal(coverKey);
s.setUintByKey(key, block.timestamp); // solhint-disable-line
}Hash key of the "last state update" for the given cover. Warning: this function does not validate the cover key supplied.
function getLastUpdateKeyInternal(bytes32 coverKey) public pure
returns(bytes32)Arguments
| Name | Type | Description |
|---|---|---|
| coverKey | bytes32 | Enter cover key |
Source Code
function getLastUpdateKeyInternal(bytes32 coverKey) public pure returns (bytes32) {
return keccak256(abi.encodePacked(ProtoUtilV1.NS_LAST_LIQUIDITY_STATE_UPDATE, coverKey));
}function getNpmPriceInternal(IStore s, uint256 amountIn) external view
returns(uint256)Arguments
| Name | Type | Description |
|---|---|---|
| s | IStore | |
| amountIn | uint256 |
Source Code
function getNpmPriceInternal(IStore s, uint256 amountIn) external view returns (uint256) {
return getPriceOracleInternal(s).consult(s.getNpmTokenAddressInternal(), amountIn);
}- AaveStrategy
- AccessControl
- AccessControlLibV1
- Address
- BaseLibV1
- BokkyPooBahsDateTimeLibrary
- BondPool
- BondPoolBase
- BondPoolLibV1
- CompoundStrategy
- Context
- Cover
- CoverBase
- CoverLibV1
- CoverReassurance
- CoverStake
- CoverUtilV1
- cxToken
- cxTokenFactory
- cxTokenFactoryLibV1
- Delayable
- Destroyable
- ERC165
- ERC20
- FakeAaveLendingPool
- FakeCompoundStablecoinDelegator
- FakePriceOracle
- FakeRecoverable
- FakeStore
- FakeToken
- FakeUniswapPair
- FakeUniswapV2FactoryLike
- FakeUniswapV2PairLike
- FakeUniswapV2RouterLike
- FaultyAaveLendingPool
- FaultyCompoundStablecoinDelegator
- Finalization
- ForceEther
- Governance
- GovernanceUtilV1
- IAaveV2LendingPoolLike
- IAccessControl
- IBondPool
- IClaimsProcessor
- ICompoundERC20DelegatorLike
- ICover
- ICoverReassurance
- ICoverStake
- ICxToken
- ICxTokenFactory
- IERC165
- IERC20
- IERC20Detailed
- IERC20Metadata
- IERC3156FlashBorrower
- IERC3156FlashLender
- IFinalization
- IGovernance
- ILendingStrategy
- ILiquidityEngine
- IMember
- INeptuneRouterV1
- InvalidStrategy
- IPausable
- IPolicy
- IPolicyAdmin
- IPriceOracle
- IProtocol
- IRecoverable
- IReporter
- IResolution
- IResolvable
- IStakingPools
- IStore
- IStoreLike
- IUniswapV2FactoryLike
- IUniswapV2PairLike
- IUniswapV2RouterLike
- IUnstakable
- IVault
- IVaultDelegate
- IVaultFactory
- IWitness
- LiquidityEngine
- MaliciousToken
- MockAccessControlUser
- MockCoverUtilUser
- MockCxToken
- MockCxTokenPolicy
- MockCxTokenStore
- MockFlashBorrower
- MockLiquidityEngineUser
- MockProcessorStore
- MockProcessorStoreLib
- MockProtocol
- MockRegistryClient
- MockStore
- MockStoreKeyUtilUser
- MockValidationLibUser
- MockVault
- MockVaultLibUser
- NeptuneRouterV1
- NPM
- NpmDistributor
- NTransferUtilV2
- NTransferUtilV2Intermediate
- Ownable
- Pausable
- Policy
- PolicyAdmin
- PolicyHelperV1
- PoorMansERC20
- POT
- PriceLibV1
- Processor
- ProtoBase
- Protocol
- ProtoUtilV1
- Recoverable
- ReentrancyGuard
- RegistryLibV1
- Reporter
- Resolution
- Resolvable
- RoutineInvokerLibV1
- SafeERC20
- StakingPoolBase
- StakingPoolCoreLibV1
- StakingPoolInfo
- StakingPoolLibV1
- StakingPoolReward
- StakingPools
- Store
- StoreBase
- StoreKeyUtil
- StrategyLibV1
- Strings
- TimelockController
- Unstakable
- ValidationLibV1
- Vault
- VaultBase
- VaultDelegate
- VaultDelegateBase
- VaultDelegateWithFlashLoan
- VaultFactory
- VaultFactoryLibV1
- VaultLibV1
- VaultLiquidity
- VaultStrategy
- WithFlashLoan
- WithPausability
- WithRecovery
- Witness