Skip to content

Commit

Permalink
Merge pull request #146 from alephium/fix-decimals
Browse files Browse the repository at this point in the history
Fix token decimals from BSC
  • Loading branch information
Lbqds authored Nov 4, 2024
2 parents 8cf89b1 + fc15359 commit f426262
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion alephium/test/governance-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ describe('test governance', () => {
const invalidVaa = new VAA(vaa.version, vaa.guardianSetIndex, invalidSignatures, vaa.body)
await expectOneOfError(
async () => await Governance.tests.submitNewGuardianSet(createTestParams(invalidVaa)),
['Assertion Failed', 'FailedInRecoverEthAddress', 'InvalidConversion', 'InvalidBytesSliceArg']
['Assertion Failed', 'FailedInRecoverEthAddress', 'Invalid conversion', 'InvalidBytesSliceArg']
)
})

Expand Down
8 changes: 4 additions & 4 deletions configs/bsc/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
},
{
"id": "0x55d398326f99059ff775485246999027b3197955",
"minimal": "10000000",
"decimals": 6
"minimal": "10000000000000000000",
"decimals": 18
},
{
"id": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
"minimal": "10000000",
"decimals": 6
"minimal": "10000000000000000000",
"decimals": 18
}
]
}
14 changes: 13 additions & 1 deletion token-list/test/BridgeToken.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ChainId, CHAIN_ID_ALEPHIUM, CHAIN_ID_ETH, CHAIN_ID_BSC } from '@alephium/wormhole-sdk'
import { BridgeToken, mainnetBridgeTokens } from '../src'
import { BridgeChain, getBridgeChain, validateTokenMetadata } from '../utils'
import { default as BscMainnet } from '../../configs/bsc/mainnet.json'

describe('test bridge token list', () => {
async function validateBridgeToken(network: 'testnet' | 'mainnet', tokenList: BridgeToken[]) {
Expand All @@ -24,7 +25,18 @@ describe('test bridge token list', () => {
}
}

test('testnet:bridge token list', async () => {
test('mainnet:bridge token list', async () => {
await validateBridgeToken('mainnet', mainnetBridgeTokens)
}, 90000)

test('mainnet:reward token list', async () => {
const bridgeChain = getBridgeChain('mainnet', CHAIN_ID_BSC)
const tokenList = BscMainnet.tokensForReward
for (const token of tokenList) {
const tokenMetadata = await bridgeChain.getTokenMetadata(token.id)
if (tokenMetadata.decimals !== token.decimals) {
throw new Error(`Invalid token decimals in reward token list, expected ${tokenMetadata.decimals}, got ${token.decimals}`)
}
}
}, 90000)
})

0 comments on commit f426262

Please sign in to comment.