Skip to content

Commit

Permalink
Merge pull request #333 from neutron-org/feat/burn-different
Browse files Browse the repository at this point in the history
feat: allow to burn from different address in wasmbindings #ntrn-372
  • Loading branch information
pr0n00gler authored Aug 28, 2024
2 parents c533ce8 + c4c4856 commit fa3b969
Showing 1 changed file with 44 additions and 5 deletions.
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

0 comments on commit fa3b969

Please sign in to comment.