Skip to content

Commit

Permalink
test: update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Sep 19, 2023
1 parent 2b4e6c1 commit 73519a2
Show file tree
Hide file tree
Showing 14 changed files with 661 additions and 439 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:

- name: Generate graphql types
run: |
docker exec -i subgraph-hardhat-node yarn workspace isolated-pools-subgraph run create:docker
docker exec -i subgraph-hardhat-node yarn workspace isolated-pools-subgraph run deploy:docker
docker exec -i subgraph-hardhat-node yarn workspace isolated-pools-subgraph run generate-subgraph-types
- name: Run integration tests
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ ARG DEPLOY_KEY

RUN yarn graph auth --product hosted-service $DEPLOY_KEY

RUN yarn workspace $SUBGRAPH run deploy:testnet --version $VERSION
RUN yarn workspace $SUBGRAPH run deploy:testnet --version-label $VERSION
30 changes: 30 additions & 0 deletions mocks/MockPriceOracleUnderlyingPrice.sol
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];
}
}
2 changes: 1 addition & 1 deletion packages/utils/src/index.ts
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';
9 changes: 6 additions & 3 deletions packages/utils/src/math.ts
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));
};
4 changes: 2 additions & 2 deletions subgraphs/isolated-pools/config/local.json
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
}
2 changes: 1 addition & 1 deletion subgraphs/isolated-pools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build:docker": "npx graph build --ipfs http://ipfs:5001",
"build:bsc": "npx graph build --ipfs https://api.thegraph.com/ipfs/ ",
"deploy:local": "LOCAL=true npx mustache config/local.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020/",
"deploy:docker": "npx mustache config/local.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools --ipfs http://ipfs:5001 --node http://graph-node:8020/",
"deploy:docker": "npx mustache config/local.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools --ipfs http://ipfs:5001 --node http://graph-node:8020/ --version-label ci",
"deploy:chapel": "npx mustache config/chapel.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools-chapel --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:bsc": "npx mustache config/bsc.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:sepolia": "npx prepare:sepolia && npx graph deploy --studio venus-isolated-pools-sepolia",
Expand Down
Loading

0 comments on commit 73519a2

Please sign in to comment.