Skip to content

Commit

Permalink
feat: common unified tokens for send, multisend, permit2. use common.…
Browse files Browse the repository at this point in the history
…chainTokens for all logics config
  • Loading branch information
Bob Lu committed Jun 25, 2024
1 parent 543a6d4 commit cd76089
Show file tree
Hide file tree
Showing 45 changed files with 348 additions and 1,676 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-ways-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@protocolink/logics': patch
---

use common unified tokens
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
},
"dependencies": {
"@paraswap/sdk": "^6.6.0",
"@protocolink/common": "^0.3.10",
"@protocolink/core": "^0.4.12",
"@protocolink/smart-accounts": "^0.1.2",
"@protocolink/common": "^0.3.11",
"@protocolink/core": "^0.4.13",
"@protocolink/smart-accounts": "^0.1.3",
"@types/lodash": "^4.14.195",
"@uniswap/sdk-core": "^3.2.6",
"@uniswap/token-lists": "^1.0.0-beta.31",
Expand All @@ -48,7 +48,7 @@
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@protocolink/test-helpers": "^0.3.7",
"@protocolink/test-helpers": "^0.3.8",
"@typechain/ethers-v5": "^11.0.0",
"@types/chai": "^4.3.5",
"@types/fs-extra": "^11.0.1",
Expand Down
5 changes: 4 additions & 1 deletion src/logics/aave-v2/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Service } from './service';
import * as common from '@protocolink/common';
import { expect } from 'chai';
import { mainnetTokens } from './tokens';
import omit from 'lodash/omit';

describe('AaveV2 Service', function () {
const chainIds = [common.ChainId.mainnet];
Expand Down Expand Up @@ -43,7 +44,9 @@ describe('AaveV2 Service', function () {
testCases.forEach(({ aToken, expected }) => {
it(`${aToken.symbol} to ${expected.symbol}`, async function () {
const asset = await service.toAsset(aToken);
expect(asset.toObject()).to.deep.eq(expected.toObject());
expect(JSON.stringify(omit(asset.toObject(), 'logoUri'))).to.eq(
JSON.stringify(omit(expected.toObject(), 'logoUri'))
);
});
});
});
Expand Down
189 changes: 0 additions & 189 deletions src/logics/aave-v2/tokens/data/mainnet.json
Original file line number Diff line number Diff line change
@@ -1,205 +1,16 @@
{
"USDT": {
"chainId": 1,
"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"decimals": 6,
"symbol": "USDT",
"name": "Tether USD"
},
"aUSDT": {
"chainId": 1,
"address": "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811",
"decimals": 6,
"symbol": "aUSDT",
"name": "Aave interest bearing USDT"
},
"WBTC": {
"chainId": 1,
"address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
"decimals": 8,
"symbol": "WBTC",
"name": "Wrapped BTC"
},
"aWBTC": {
"chainId": 1,
"address": "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656",
"decimals": 8,
"symbol": "aWBTC",
"name": "Aave interest bearing WBTC"
},
"ETH": {
"chainId": 1,
"address": "0x0000000000000000000000000000000000000000",
"decimals": 18,
"symbol": "ETH",
"name": "Ethereum"
},
"WETH": {
"chainId": 1,
"address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"decimals": 18,
"symbol": "WETH",
"name": "Wrapped Ether"
},
"aWETH": {
"chainId": 1,
"address": "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e",
"decimals": 18,
"symbol": "aWETH",
"name": "Aave interest bearing WETH"
},
"AAVE": {
"chainId": 1,
"address": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
"decimals": 18,
"symbol": "AAVE",
"name": "Aave Token"
},
"aAAVE": {
"chainId": 1,
"address": "0xFFC97d72E13E01096502Cb8Eb52dEe56f74DAD7B",
"decimals": 18,
"symbol": "aAAVE",
"name": "Aave interest bearing AAVE"
},
"DAI": {
"chainId": 1,
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"decimals": 18,
"symbol": "DAI",
"name": "Dai Stablecoin"
},
"aDAI": {
"chainId": 1,
"address": "0x028171bCA77440897B824Ca71D1c56caC55b68A3",
"decimals": 18,
"symbol": "aDAI",
"name": "Aave interest bearing DAI"
},
"sUSD": {
"chainId": 1,
"address": "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51",
"decimals": 18,
"symbol": "sUSD",
"name": "Synth sUSD"
},
"aSUSD": {
"chainId": 1,
"address": "0x6C5024Cd4F8A59110119C56f8933403A539555EB",
"decimals": 18,
"symbol": "aSUSD",
"name": "Aave interest bearing SUSD"
},
"TUSD": {
"chainId": 1,
"address": "0x0000000000085d4780B73119b644AE5ecd22b376",
"decimals": 18,
"symbol": "TUSD",
"name": "TrueUSD"
},
"aTUSD": {
"chainId": 1,
"address": "0x101cc05f4A51C0319f570d5E146a8C625198e636",
"decimals": 18,
"symbol": "aTUSD",
"name": "Aave interest bearing TUSD"
},
"USDC": {
"chainId": 1,
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6,
"symbol": "USDC",
"name": "USD Coin"
},
"aUSDC": {
"chainId": 1,
"address": "0xBcca60bB61934080951369a648Fb03DF4F96263C",
"decimals": 6,
"symbol": "aUSDC",
"name": "Aave interest bearing USDC"
},
"CRV": {
"chainId": 1,
"address": "0xD533a949740bb3306d119CC777fa900bA034cd52",
"decimals": 18,
"symbol": "CRV",
"name": "Curve DAO Token"
},
"aCRV": {
"chainId": 1,
"address": "0x8dAE6Cb04688C62d939ed9B68d32Bc62e49970b1",
"decimals": 18,
"symbol": "aCRV",
"name": "Aave interest bearing CRV"
},
"GUSD": {
"chainId": 1,
"address": "0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd",
"decimals": 2,
"symbol": "GUSD",
"name": "Gemini dollar"
},
"aGUSD": {
"chainId": 1,
"address": "0xD37EE7e4f452C6638c96536e68090De8cBcdb583",
"decimals": 2,
"symbol": "aGUSD",
"name": "Aave interest bearing GUSD"
},
"USDP": {
"chainId": 1,
"address": "0x8E870D67F660D95d5be530380D0eC0bd388289E1",
"decimals": 18,
"symbol": "USDP",
"name": "Pax Dollar"
},
"aUSDP": {
"chainId": 1,
"address": "0x2e8F4bdbE3d47d7d7DE490437AeA9915D930F1A3",
"decimals": 18,
"symbol": "aUSDP",
"name": "Aave interest bearing USDP"
},
"FRAX": {
"chainId": 1,
"address": "0x853d955aCEf822Db058eb8505911ED77F175b99e",
"decimals": 18,
"symbol": "FRAX",
"name": "Frax"
},
"aFRAX": {
"chainId": 1,
"address": "0xd4937682df3C8aEF4FE912A96A74121C0829E664",
"decimals": 18,
"symbol": "aFRAX",
"name": "Aave interest bearing FRAX"
},
"stETH": {
"chainId": 1,
"address": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
"decimals": 18,
"symbol": "stETH",
"name": "Liquid staked Ether 2.0"
},
"aSTETH": {
"chainId": 1,
"address": "0x1982b2F5814301d4e9a8b0201555376e62F82428",
"decimals": 18,
"symbol": "aSTETH",
"name": "Aave interest bearing STETH"
},
"LUSD": {
"chainId": 1,
"address": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0",
"decimals": 18,
"symbol": "LUSD",
"name": "LUSD Stablecoin"
},
"aLUSD": {
"chainId": 1,
"address": "0xce1871f791548600cb59efbefFC9c38719142079",
"decimals": 18,
"symbol": "aLUSD",
"name": "Aave interest bearing LUSD"
}
}
2 changes: 1 addition & 1 deletion src/logics/aave-v2/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import mainnetTokensJSON from './data/mainnet.json';

type MainnetTokenSymbols = keyof typeof mainnetTokensJSON;

export const mainnetTokens = common.toTokenMap<MainnetTokenSymbols>(mainnetTokensJSON);
export const mainnetTokens = { ...common.toTokenMap<MainnetTokenSymbols>(mainnetTokensJSON), ...common.mainnetTokens };
5 changes: 4 additions & 1 deletion src/logics/aave-v3/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Service } from './service';
import * as common from '@protocolink/common';
import { expect } from 'chai';
import { mainnetTokens } from './tokens';
import omit from 'lodash/omit';

describe('AaveV3 Service', function () {
const chainIds = [common.ChainId.mainnet];
Expand Down Expand Up @@ -43,7 +44,9 @@ describe('AaveV3 Service', function () {
testCases.forEach(({ aToken, expected }) => {
it(`${aToken.symbol} to ${expected.symbol}`, async function () {
const asset = await service.toAsset(aToken);
expect(asset.toObject()).to.deep.eq(expected.toObject());
expect(JSON.stringify(omit(asset.toObject(), 'logoUri'))).to.eq(
JSON.stringify(omit(expected.toObject(), 'logoUri'))
);
});
});
});
Expand Down
Loading

0 comments on commit cd76089

Please sign in to comment.