Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to burn from different address in wasmbindings #ntrn-372 #333

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 44 additions & 5 deletions src/testcases/run_in_band/tokenfactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,7 @@ describe('Neutron / Tokenfactory', () => {
codeId = await neutronClient.upload(CONTRACTS.TOKENFACTORY);
expect(codeId).toBeGreaterThan(0);

contractAddress = await neutronClient.instantiate(
codeId,
{},
'tokenfactory',
);
contractAddress = await neutronClient.instantiate(codeId, {});

await neutronClient.sendTokens(
contractAddress,
Expand Down Expand Up @@ -753,6 +749,49 @@ describe('Neutron / Tokenfactory', () => {
expect(balance).toEqual(amount);
});

test('burn coins from different wallet', async () => {
const wallet2 = await testState.nextWallet('neutron');

const mintedToDifferentWallet = 100;
const toBurn = 50;
const leftAfterBurn = mintedToDifferentWallet - toBurn;

amount -= mintedToDifferentWallet;

// mint to different wallet
const res1 = await neutronClient.execute(contractAddress, {
mint_tokens: {
denom,
amount: mintedToDifferentWallet.toString(),
mint_to_address: wallet2.address,
},
});
expect(res1.code).toBe(0);

const balanceBefore = await neutronClient.getBalance(
wallet2.address,
denom,
);
expect(balanceBefore.amount).toBe(mintedToDifferentWallet.toString());

const res = await neutronClient.execute(contractAddress, {
burn_tokens: {
denom,
amount: toBurn.toString(),
burn_from_address: wallet2.address,
},
});
expect(res.code).toBe(0);

await neutronClient.waitBlocks(5);

const balanceAfter = await neutronClient.getBalance(
wallet2.address,
denom,
);
expect(balanceAfter.amount).toBe(leftAfterBurn.toString());
});

test('full denom query', async () => {
const res = await neutronClient.queryContractSmart(contractAddress, {
full_denom: { creator_addr: contractAddress, subdenom },
Expand Down
Loading