Skip to content

Commit

Permalink
finalaze tokenfactory tests
Browse files Browse the repository at this point in the history
  • Loading branch information
quasisamurai committed Sep 8, 2023
1 parent a2fab01 commit 3648f51
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 43 deletions.
3 changes: 1 addition & 2 deletions src/helpers/proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export type PinCodesInfo = {
codes_ids: number[];
};


export type UpdateParamsInterchaintxsInfo = {
title: string;
description: string;
Expand Down Expand Up @@ -206,7 +205,7 @@ export const updateInterchaintxsParamsProposal = (
admin_proposal: {
proposal_execute_message: {
message: JSON.stringify({
'@type': '/cosmos.interchaintxs.MsgUpdateParams',
'@type': '/neutron.interchaintxs.MsgUpdateParams',
authority: ADMIN_MODULE_ADDRESS,
pararms: {
msg_submit_tx_max_messages: info.msg_submit_tx_max_messages,
Expand Down
8 changes: 4 additions & 4 deletions src/helpers/tokenfactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ cosmosclient.codec.register(
'/osmosis.tokenfactory.v1beta1.MsgChangeAdmin',
osmosis.tokenfactory.v1beta1.MsgChangeAdmin,
);
// cosmosclient.codec.register(
// '/osmosis.tokenfactory.v1beta1.MsgChangeAdmin',
// osmosis.tokenfactory.v1beta1.MsgChangeAdmin,
// );
cosmosclient.codec.register(
'/osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook',
osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook,
);

export const msgMintDenom = async (
cmNeutron: WalletWrapper,
Expand Down
2 changes: 0 additions & 2 deletions src/testcases/parallel/governance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,11 +1047,9 @@ describe('Neutron / Governance', () => {
describe('vote for proposal #20 with unbonded funds(no, yes, yes)', () => {
const proposalId = 20;
test('vote NO from wallet 1', async () => {

await daoMember1.voteNo(proposalId);
});
test('vote YES from wallet 2', async () => {

await daoMember2.voteYes(proposalId);
});
test('vote YES from wallet 3', async () => {
Expand Down
58 changes: 23 additions & 35 deletions src/testcases/parallel/tokenfactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
msgBurn,
msgChangeAdmin,
msgCreateDenom,
msgMintDenom, msgSetBeforeSendHook,
msgMintDenom,
msgSetBeforeSendHook,
} from '../../helpers/tokenfactory';

interface DenomsFromCreator {
Expand All @@ -25,7 +26,7 @@ interface AuthorityMetadata {
}

interface BerforeSendHook {
readonly before_send_hook: { readonly CosmwasmAddress: string };
readonly cosmwasm_address: string;
}

describe('Neutron / Tokenfactory', () => {
Expand Down Expand Up @@ -121,14 +122,10 @@ describe('Neutron / Tokenfactory', () => {
'new_token_denom',
);

console.log(newTokenDenom);
console.log(neutronChain.sdk.url);

const authorityMetadataBefore = await getAuthorityMetadata(
neutronChain.sdk.url,
newTokenDenom,
);
console.log(authorityMetadataBefore);

expect(authorityMetadataBefore.authority_metadata).toEqual({
Admin: ownerWallet.address.toString(),
Expand Down Expand Up @@ -220,9 +217,7 @@ describe('Neutron / Tokenfactory', () => {
newTokenDenom,
);

expect(hookAfter.before_send_hook.CosmwasmAddress).toEqual(
ownerWallet.address.toString,
);
expect(hookAfter.cosmwasm_address).toEqual(ownerWallet.address.toString());
});

describe('wasmbindings', () => {
Expand Down Expand Up @@ -325,6 +320,25 @@ describe('Neutron / Tokenfactory', () => {
);
expect(res.admin).toEqual(contractAddress);
});
test('set_before_send_hook', async () => {
await neutronAccount.executeContract(
contractAddress,
JSON.stringify({
set_before_send_hook: {
denom,
cosm_wasm_addr: contractAddress,
},
}),
);
const res = await neutronChain.queryContract<{
cosm_wasm_addr: string;
}>(contractAddress, {
before_send_hook: {
denom,
},
});
expect(res.cosm_wasm_addr).toEqual(contractAddress);
});

test('change admin', async () => {
await neutronAccount.executeContract(
Expand Down Expand Up @@ -362,32 +376,6 @@ describe('Neutron / Tokenfactory', () => {
);
expect(res.admin).toEqual(neutronAccount.wallet.address.toString());
});
test('set_before_send_hook', async () => {
await neutronAccount.executeContract(
contractAddress,
JSON.stringify({
set_before_send_hook: {
denom,
cosm_wasm_addr: contractAddress
},
}),
);

const balance = await neutronChain.queryDenomBalance(
neutronAccount.wallet.address.toString(),
denom,
);
expect(balance).toEqual(amount);
const res = await neutronChain.queryContract<{ cosm_wasm_addr: string }>(
contractAddress,
{
before_send_hook: {
denom,
},
},
);
expect(res.cosm_wasm_addr).toEqual(contractAddress);
});
});
});

Expand Down

0 comments on commit 3648f51

Please sign in to comment.