Skip to content

Commit

Permalink
chore: Add cbBTC support (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
MilGard91 authored Nov 14, 2024
2 parents 9fc0271 + a3c03bd commit d69e053
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 29 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cover-router",
"version": "2.3.6",
"version": "2.3.7",
"description": "Cover Router",
"main": "src/index.js",
"engines": {
Expand All @@ -25,7 +25,7 @@
},
"homepage": "https://github.com/NexusMutual/cover-router#readme",
"dependencies": {
"@nexusmutual/deployments": "^2.9.0",
"@nexusmutual/deployments": "^2.10.0",
"convict": "^6.2.4",
"dotenv": "^16.0.3",
"ethers": "^5.7.2",
Expand Down
1 change: 1 addition & 0 deletions src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const initialState = {
0: { id: 0, symbol: 'ETH', decimals: 18 },
1: { id: 1, symbol: 'DAI', decimals: 18 },
6: { id: 6, symbol: 'USDC', decimals: 6 },
7: { id: 7, symbol: 'cbBTC', decimals: 8 },
255: { id: 255, symbol: 'NXM', decimals: 18 },
},
globalCapacityRatio: 0,
Expand Down
30 changes: 16 additions & 14 deletions test/mocks/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ const store = {
0: BigNumber.from(10280040304526400n),
1: BigNumber.from(28724439013819923654n),
6: BigNumber.from(28724439n),
7: BigNumber.from(82274n),
255: BigNumber.from(1000000000000000000n),
},
assets: {
0: { id: 0, symbol: 'ETH', decimals: 18 },
1: { id: 1, symbol: 'DAI', decimals: 18 },
6: { id: 6, symbol: 'USDC', decimals: 6 },
7: { id: 7, symbol: 'cbBTC', decimals: 8 },
255: { id: 255, symbol: 'NXM', decimals: 18 },
},
productPriorityPoolsFixedPrice: {
Expand Down Expand Up @@ -249,13 +251,13 @@ const store = {
],
trancheCapacities: [
BigNumber.from(0),
BigNumber.from(1642753),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(1642753),
],
lastEffectiveWeight: BigNumber.from(50),
targetWeight: BigNumber.from(50),
Expand All @@ -277,14 +279,14 @@ const store = {
BigNumber.from(0),
],
trancheCapacities: [
BigNumber.from(4566),
BigNumber.from(182069),
BigNumber.from(1948),
BigNumber.from(849),
BigNumber.from(0),
BigNumber.from(1173144),
BigNumber.from(4925),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(1367501),
],
lastEffectiveWeight: BigNumber.from(7),
targetWeight: BigNumber.from(7),
Expand All @@ -306,14 +308,14 @@ const store = {
BigNumber.from(0),
],
trancheCapacities: [
BigNumber.from(226500),
BigNumber.from(49999),
BigNumber.from(0),
BigNumber.from(1557499),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(1200499),
BigNumber.from(2850000),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(5884497),
],
lastEffectiveWeight: BigNumber.from(25),
targetWeight: BigNumber.from(25),
Expand All @@ -336,13 +338,13 @@ const store = {
],
trancheCapacities: [
BigNumber.from(0),
BigNumber.from(509999),
BigNumber.from(200000),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(0),
BigNumber.from(509999),
BigNumber.from(200000),
],
lastEffectiveWeight: BigNumber.from(50),
targetWeight: BigNumber.from(50),
Expand Down
39 changes: 35 additions & 4 deletions test/unit/responses.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const assets = {
0: { id: 0, symbol: 'ETH', decimals: 18 },
1: { id: 1, symbol: 'DAI', decimals: 18 },
6: { id: 6, symbol: 'USDC', decimals: 6 },
7: { id: 7, symbol: 'cbBTC', decimals: 8 },
255: { id: 255, symbol: 'NXM', decimals: 18 },
};

Expand All @@ -28,6 +29,11 @@ const capacities = [
amount: '13305160144',
asset: assets[6],
},
{
assetId: 7,
amount: '38109316',
asset: assets[7],
},
{
assetId: 255,
amount: '463200000000000000000',
Expand Down Expand Up @@ -56,6 +62,11 @@ const capacities = [
amount: '14718402543',
asset: assets[6],
},
{
assetId: 7,
amount: '42157197',
asset: assets[7],
},
{
assetId: 255,
amount: '512400000000000000000',
Expand Down Expand Up @@ -84,6 +95,11 @@ const capacities = [
amount: '13305160144',
asset: assets[6],
},
{
assetId: 7,
amount: '38109316',
asset: assets[7],
},
{
assetId: 255,
amount: '463200000000000000000',
Expand All @@ -96,22 +112,27 @@ const capacities = [
availableCapacity: [
{
assetId: 0,
amount: '627202118245255087296',
amount: '650955796175312058720',
asset: assets[0],
},
{
assetId: 1,
amount: '1752525132313136206805332',
amount: '1818897544564809351595684',
asset: assets[1],
},
{
assetId: 6,
amount: '1752525131469',
amount: '1818897543689',
asset: assets[6],
},
{
assetId: 7,
amount: '5209778910',
asset: assets[7],
},
{
assetId: 255,
amount: '61011640000000000000000',
amount: '63322300000000000000000',
asset: assets[255],
},
],
Expand All @@ -137,6 +158,11 @@ const capacities = [
amount: '104020098195',
asset: assets[6],
},
{
assetId: 7,
amount: '297939658',
asset: assets[7],
},
{
assetId: 255,
amount: '3621310000000000000000',
Expand Down Expand Up @@ -221,6 +247,11 @@ const getQuote = assetId => ({
amount: '2826484797',
asset: assets[6],
},
{
assetId: '7',
amount: '8095761',
asset: assets[7],
},
{
assetId: '255',
amount: '98400000000000000000',
Expand Down

0 comments on commit d69e053

Please sign in to comment.