initial test

This commit is contained in:
Evan Gray 2021-11-17 20:07:05 -05:00 committed by Evan Gray
parent 7b4b873d6c
commit fca43a75f4
8 changed files with 7461 additions and 0 deletions

14
.github/workflows/test.yaml vendored Normal file
View File

@ -0,0 +1,14 @@
name: Test
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci
- run: npm test

33
.gitignore vendored Normal file
View File

@ -0,0 +1,33 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# ethereum contracts
/contracts
/src/ethers-contracts
# tsproto output
/src/proto
# build
/lib

4
jestconfig.json Normal file
View File

@ -0,0 +1,4 @@
{
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"]
}

7144
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

29
package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "@certusone/wormhole-token-list",
"version": "0.0.1",
"description": "A token list for featured markets",
"homepage": "https://wormholenetwork.com",
"repository": "https://github.com/certusone/wormhole-token-list",
"scripts": {
"test": "jest --config jestconfig.json --verbose"
},
"keywords": [
"wormhole",
"bridge",
"token",
"sdk",
"solana",
"ethereum",
"terra",
"bsc"
],
"author": "certusone",
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^27.0.2",
"@types/node": "^16.6.1",
"ajv": "^8.8.1",
"jest": "^27.3.1",
"prettier": "^2.3.2"
}
}

28
src/__tests__/validate.js Normal file
View File

@ -0,0 +1,28 @@
test("markets.json is valid", () => {
const Ajv = require("ajv");
const ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
const schema = require("../markets.schema.json");
const validate = ajv.compile(schema);
const data = require("../markets.json");
const valid = validate(data);
expect(valid).toBe(true);
});
test("all markets are keys in markets", () => {
const data = require("../markets.json");
for (const sourceChain in data.marketsBySource) {
for (const targetChain in data.marketsBySource[sourceChain]) {
for (const address in data.marketsBySource[sourceChain][targetChain]) {
data.marketsBySource[sourceChain][targetChain][address].markets.forEach(
(market) => {
expect(data.markets[market]).toBeDefined();
}
);
}
}
}
});

130
src/markets.json Normal file
View File

@ -0,0 +1,130 @@
{
"markets": {
"saber": {
"name": "Saber",
"link": "https://www.saber.so/"
},
"mercurial": {
"name": "Mercurial",
"link": "https://mercurial.finance/"
},
"jupiter": {
"name": "Jupiter",
"link": "https://jup.ag/"
},
"raydium": {
"name": "Raydium",
"link": "https://raydium.io/swap/"
},
"tulip": {
"name": "Tulip",
"link": "https://tulip.garden/"
},
"almond": {
"name": "Almond",
"link": "https://almond.so/"
},
"orca": {
"name": "Orca",
"link": "https://www.orca.so/"
},
"curve": {
"name": "Curve",
"link": "https://curve.fi/"
},
"uniswap": {
"name": "Uniswap",
"link": "https://app.uniswap.org/"
},
"anchor": {
"name": "Anchor",
"link": "https://app.anchorprotocol.com/"
},
"loop": {
"name": "Loop Markets",
"link": "https://dex.loop.markets/"
},
"quickswap": {
"name": "Quickswap",
"link": "https://quickswap.exchange/"
},
"sushi": {
"name": "Sushi",
"link": "https://app.sushi.com/"
}
},
"marketsBySource": {
"2": {
"1": {
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
"symbol": "USDC",
"markets": ["saber", "mercurial", "jupiter"]
},
"0xdac17f958d2ee523a2206206994597c13d831ec7": {
"symbol": "USDT",
"markets": ["saber", "mercurial", "jupiter"]
},
"0x50d1c9771902476076ecfc8b2a83ad6b9355a4c9": {
"symbol": "FTX Token",
"markets": ["saber", "almond", "tulip"]
},
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": {
"symbol": "WETH",
"markets": ["orca", "saber", "tulip"]
},
"0x476c5e26a75bd202a9683ffd34359c0cc15be0ff": {
"symbol": "SRM",
"markets": ["orca", "saber", "tulip"]
},
"0x6b175474e89094c44da98b954eedeac495271d0f": {
"symbol": "DAI",
"markets": ["saber", "mercurial", "jupiter"]
},
"0xa693B19d2931d498c5B318dF961919BB4aee87a5": {
"symbol": "UST",
"markets": ["saber", "mercurial", "jupiter"]
},
"0x4fabb145d64652a948d72533023f6e7a623c7c53": {
"symbol": "BUSD",
"markets": ["saber"]
},
"0xdf574c24545e5ffecb9a659c229253d4111d87e1": {
"symbol": "HUSD",
"markets": ["saber"]
},
"0x1c48f86ae57291f7686349f12601910bd8d470bb": {
"symbol": "USDK",
"markets": ["saber"]
},
"0x853d955acef822db058eb8505911ed77f175b99e": {
"symbol": "FRAX",
"markets": ["saber"]
},
"0x0316eb71485b0ab14103307bf65a021042c6d380": {
"symbol": "HBTC",
"markets": ["saber"]
},
"0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE": {
"symbol": "SHIB",
"markets": ["saber"]
},
"0xbb0e17ef65f82ab018d8edd776e8dd940327b28b": {
"symbol": "AXS",
"markets": ["raydium"]
},
"0x6b3595068778dd592e39a122f4f5a5cf09c90fe2": {
"symbol": "SUSHI",
"markets": ["raydium", "tulip"]
},
"0x92d6c1e31e14520e676a687f0a93788b716beff5": {
"symbol": "DYDX",
"markets": ["raydium"]
},
"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984": {
"symbol": "UNI",
"markets": ["raydium", "tulip"]
}
}
}
}
}

79
src/markets.schema.json Normal file
View File

@ -0,0 +1,79 @@
{
"description": "a schema for defining markets for wormhole-wrapped assets",
"type": "object",
"properties": {
"markets": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/marketInfo"
}
},
"marketsBySource": {
"description": "keys of source chain id",
"type": "object",
"properties": {
"1": { "$ref": "#/$defs/sourceChain" },
"2": { "$ref": "#/$defs/sourceChain" },
"3": { "$ref": "#/$defs/sourceChain" },
"4": { "$ref": "#/$defs/sourceChain" },
"5": { "$ref": "#/$defs/sourceChain" }
},
"additionalProperties": false
}
},
"required": ["markets", "marketsBySource"],
"additionalProperties": false,
"$defs": {
"marketInfo": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"link": {
"type": "string"
}
},
"additionalProperties": false
},
"sourceChain": {
"description": "keys of target chain id",
"type": "object",
"properties": {
"1": { "$ref": "#/$defs/targetChain" },
"2": { "$ref": "#/$defs/targetChain" },
"3": { "$ref": "#/$defs/targetChain" },
"4": { "$ref": "#/$defs/targetChain" },
"5": { "$ref": "#/$defs/targetChain" }
},
"additionalProperties": false
},
"targetChain": {
"description": "keys of token addresses",
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/tokenInfo"
}
},
"tokenInfo": {
"description": "contains list of markets for a given source - target - address tuple",
"type": "object",
"properties": {
"symbol": {
"description": "for maintainer reference only",
"type": "string"
},
"markets": {
"description": "list of market ids that support this token",
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
}
},
"required": ["symbol", "markets"],
"additionalProperties": false
}
}
}