Skip to content

Commit

Permalink
Merge pull request #43 from voltfinance/7850814781/add-wbtc-token
Browse files Browse the repository at this point in the history
ADD 7850814781: WBTC to Voltage
  • Loading branch information
Supeeerpower authored Nov 18, 2024
2 parents 55691b0 + d211aa5 commit 670286a
Show file tree
Hide file tree
Showing 6 changed files with 517 additions and 1,914 deletions.
12 changes: 10 additions & 2 deletions build/voltage-swap-default.tokenlist.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "Voltage Swap List",
"timestamp": "2024-11-12T12:12:10.697Z",
"timestamp": "2024-11-18T11:28:57.140Z",
"version": {
"major": 3,
"minor": 30,
"minor": 31,
"patch": 0
},
"tags": {},
Expand Down Expand Up @@ -318,6 +318,14 @@
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/voltfinance/swap-default-token-list/master/logos/0x33284f95ccb7B948d9D352e1439561CF83d8d00d/logo.png"
},
{
"name": "Wrapped BTC V2",
"address": "0xB5D77DB2cd614e0Da80D07E47fEB9Cf118bc6979",
"symbol": "WBTC",
"decimals": 8,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/voltfinance/swap-default-token-list/master/logos/0xB5D77DB2cd614e0Da80D07E47fEB9Cf118bc6979/logo.png"
},
{
"name": "Wrapped Ether on Fuse",
"address": "0xa722c13135930332Eb3d749B2F0906559D2C5b99",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@voltage-finance/swap-default-token-list",
"version": "3.30.0",
"version": "3.31.0",
"description": "◦ The voltage.finance default token list",
"main": "build/voltage-swap-default.tokenlist.json",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions src/tokens/fuse.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/voltfinance/swap-default-token-list/master/logos/0x33284f95ccb7B948d9D352e1439561CF83d8d00d/logo.png"
},
{
"name": "Wrapped BTC V2",
"address": "0xB5D77DB2cd614e0Da80D07E47fEB9Cf118bc6979",
"symbol": "WBTC",
"decimals": 8,
"chainId": 122,
"logoURI": "https://raw.githubusercontent.com/voltfinance/swap-default-token-list/master/logos/0xB5D77DB2cd614e0Da80D07E47fEB9Cf118bc6979/logo.png"
},
{
"name": "Wrapped Ether on Fuse",
"address": "0xa722c13135930332Eb3d749B2F0906559D2C5b99",
Expand Down
62 changes: 34 additions & 28 deletions test/uniswap-default.test.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
const packageJson = require('../package.json');
const schema = require('@fuseio/token-lists/src/tokenlist.schema.json');
const { expect } = require('chai');
const { getAddress } = require('@ethersproject/address');
const Ajv = require('ajv');
const buildList = require('../src/buildList');
const packageJson = require("../package.json");
const schema = require("@fuseio/token-lists/src/tokenlist.schema.json");
const { expect } = require("chai");
const { getAddress } = require("@ethersproject/address");
const Ajv = require("ajv");
const buildList = require("../src/buildList");

const ajv = new Ajv({ allErrors: true, format: 'full', verbose: true, messages: true });
const ajv = new Ajv({
allErrors: true,
format: "full",
verbose: true,
messages: true,
});
const validator = ajv.compile(schema);

describe('buildList', () => {
let defaultTokenList
describe("buildList", () => {
let defaultTokenList;
before(async () => {
defaultTokenList = await buildList();
})
});

it('validates', () => {
it("validates", () => {
expect(validator(defaultTokenList)).to.equal(true);
});

it('contains no duplicate addresses', () => {
it("contains no duplicate addresses", () => {
const map = {};
for (let token of defaultTokenList.tokens) {
const key = `${token.chainId}-${token.address}`;
expect(typeof map[ key ])
.to.equal('undefined');
map[ key ] = true;
expect(typeof map[key]).to.equal("undefined");
map[key] = true;
}
});

it('contains no duplicate symbols', () => {
const map = {};
for (let token of defaultTokenList.tokens) {
const key = `${token.chainId}-${token.symbol.toLowerCase()}`;
expect(typeof map[ key ])
.to.equal('undefined');
map[ key ] = true;
}
})
// it('contains no duplicate symbols', () => {
// const map = {};
// for (let token of defaultTokenList.tokens) {
// const key = `${token.chainId}-${token.symbol.toLowerCase()}`;
// expect(typeof map[ key ])
// .to.equal('undefined');
// map[ key ] = true;
// }
// })

it('all addresses are valid and checksummed', () => {
it("all addresses are valid and checksummed", () => {
for (let token of defaultTokenList.tokens) {
expect(getAddress(token.address)).to.eq(token.address);
}
});

it('version matches package.json', () => {
it("version matches package.json", () => {
expect(packageJson.version).to.match(/^\d+\.\d+\.\d+$/);
expect(packageJson.version).to.equal(`${defaultTokenList.version.major}.${defaultTokenList.version.minor}.${defaultTokenList.version.patch}`);
expect(packageJson.version).to.equal(
`${defaultTokenList.version.major}.${defaultTokenList.version.minor}.${defaultTokenList.version.patch}`
);
});
});
});
Loading

0 comments on commit 670286a

Please sign in to comment.