Skip to content

Commit

Permalink
feat: voucher init test
Browse files Browse the repository at this point in the history
  • Loading branch information
ratik committed Dec 18, 2023
1 parent a1687d8 commit 55b1e00
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions integration_tests/src/testcases/core.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { describe, expect, it, beforeAll, afterAll } from 'vitest';
import { LidoCore, LidoFactory } from '../generated/contractLib';
import {
LidoCore,
LidoFactory,
LidoWithdrawalVoucher,
} from '../generated/contractLib';
import {
QueryClient,
StakingExtension,
Expand All @@ -22,6 +26,7 @@ import { waitFor } from '../helpers/waitFor';

const LidoFactoryClass = LidoFactory.Client;
const LidoCoreClass = LidoCore.Client;
const LidoVoucherClass = LidoWithdrawalVoucher.Client;

describe('Core', () => {
const context: {
Expand All @@ -31,6 +36,7 @@ describe('Core', () => {
gaiaWallet?: DirectSecp256k1HdWallet;
contractClient?: InstanceType<typeof LidoFactoryClass>;
coreContractClient?: InstanceType<typeof LidoCoreClass>;
voucherContractClient?: InstanceType<typeof LidoVoucherClass>;
account?: AccountData;
icaAddress?: string;
client?: SigningCosmWasmClient;
Expand All @@ -45,6 +51,7 @@ describe('Core', () => {
tokenizedDenomOnNeutron?: string;
coreCoreId?: number;
tokenCodeId?: number;
voucherCodeId?: number;
exchangeRate?: number;
tokenContractAddress?: string;
neutronIBCDenom?: string;
Expand Down Expand Up @@ -129,6 +136,17 @@ describe('Core', () => {
expect(res.codeId).toBeGreaterThan(0);
context.tokenCodeId = res.codeId;
}
{
const res = await client.upload(
account.address,
fs.readFileSync(
join(__dirname, '../../../artifacts/lido_withdrawal_voucher.wasm'),
),
1.5,
);
expect(res.codeId).toBeGreaterThan(0);
context.voucherCodeId = res.codeId;
}
const res = await client.upload(
account.address,
fs.readFileSync(join(__dirname, '../../../artifacts/lido_factory.wasm')),
Expand All @@ -142,6 +160,7 @@ describe('Core', () => {
{
core_code_id: context.coreCoreId,
token_code_id: context.tokenCodeId,
voucher_code_id: context.voucherCodeId,
salt: 'salt',
subdenom: 'lido',
},
Expand Down Expand Up @@ -175,16 +194,29 @@ describe('Core', () => {
await neutronClient.CosmwasmWasmV1.query.queryContractInfo(
res.token_contract,
);
expect(tokenContractInfo.data.contract_info.label).toBe('token');
expect(tokenContractInfo.data.contract_info.label).toBe(
'LIDO-staking-token',
);
const coreContractInfo =
await neutronClient.CosmwasmWasmV1.query.queryContractInfo(
res.core_contract,
);
expect(coreContractInfo.data.contract_info.label).toBe('core');
expect(coreContractInfo.data.contract_info.label).toBe('LIDO-staking-core');
const voucherContractInfo =
await neutronClient.CosmwasmWasmV1.query.queryContractInfo(
res.voucher_contract,
);
expect(voucherContractInfo.data.contract_info.label).toBe(
'LIDO-staking-voucher',
);
context.coreContractClient = new LidoCore.Client(
context.client,
res.core_contract,
);
context.voucherContractClient = new LidoWithdrawalVoucher.Client(
context.client,
res.voucher_contract,
);
context.tokenContractAddress = res.token_contract;
});
it('query exchange rate', async () => {
Expand Down

0 comments on commit 55b1e00

Please sign in to comment.