-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
661 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
pragma solidity 0.8.13; | ||
|
||
import { ResilientOracleInterface } from '../../oracle/contracts/interfaces/OracleInterface.sol'; | ||
import 'hardhat/console.sol'; | ||
|
||
contract MockPriceOracleUnderlyingPrice is ResilientOracleInterface { | ||
mapping(address => uint256) public prices; | ||
|
||
constructor() {} | ||
|
||
function updatePrice(address vToken) external { | ||
prices[vToken] = prices[vToken]; | ||
} | ||
|
||
function updateAssetPrice(address asset) external { | ||
prices[asset] = prices[asset]; | ||
} | ||
|
||
function setPrice(address vToken, uint256 price) public { | ||
prices[vToken] = price; | ||
} | ||
|
||
function getPrice(address asset) external view returns (uint256) { | ||
return 0; | ||
} | ||
|
||
function getUnderlyingPrice(address vToken) external view returns (uint256) { | ||
return prices[vToken]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { exec, fetchSubgraphs, fetchSubgraph, waitForSubgraphToBeSynced, deploy } from './subgraph'; | ||
export { normalizeMantissa } from './math'; | ||
export { normalizeMantissa, scaleValue } from './math'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import BigNumber from 'bignumber.js'; | ||
|
||
export const normalizeMantissa = (num: number | string, scale = 1e18): BigNumber => { | ||
if (num < 0) return new BigNumber(2).pow(256).plus(num); | ||
return new BigNumber(num).times(scale); | ||
export const normalizeMantissa = (num: number | string, decimals = 18): BigNumber => { | ||
return new BigNumber(num).div(new BigNumber(10).pow(decimals)); | ||
}; | ||
|
||
export const scaleValue = (num: number | string, decimals = 18): BigNumber => { | ||
return new BigNumber(num).times(new BigNumber(10).pow(decimals)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"network": "hardhat", | ||
"poolRegistryAddress": "0x95401dc811bb5740090279Ba06cfA8fcF6113778", | ||
"poolLensAddress": "0x809d550fca64d94Bd9F66E60752A544199cfAC3D", | ||
"poolRegistryAddress": "0x3155755b79aA083bd953911C92705B7aA82a18F9", | ||
"poolLensAddress": "0x5bf5b11053e734690269C6B9D438F8C9d48F528A", | ||
"startBlock": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.