From 6a30bf6d0215371d15723328b4f35de82f3a7dd4 Mon Sep 17 00:00:00 2001 From: Vladislav Vasilev <81014877+faust403@users.noreply.github.com> Date: Wed, 11 Dec 2024 13:48:39 +0100 Subject: [PATCH] Second bond --- .../src/testcases/lazy-staking.test.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/integration_tests/src/testcases/lazy-staking.test.ts b/integration_tests/src/testcases/lazy-staking.test.ts index d89c0d59..ece803f4 100644 --- a/integration_tests/src/testcases/lazy-staking.test.ts +++ b/integration_tests/src/testcases/lazy-staking.test.ts @@ -230,4 +230,31 @@ describe('Lazy Staking', () => { const { amount } = await client.getBalance(account.address, ldntrnDenom); expect(amount).toEqual('10000000'); }); + + it('Exchange rate now 10', async () => { + const { coreContractClient, account } = context; + await coreContractClient.updateExchangeRate(account.address, { + exchange_rate: '10', + }); + expect(await coreContractClient.queryExchangeRate()).toEqual('10'); + }); + + it("If we have 10 ldNTRN, they're now equal to 1 dNTRN (because 1 dNTRN equals 10 NTRN)", async () => { + const { lazyStakingClient } = context; + const rewards = await lazyStakingClient.queryRewards(); + expect(rewards).toEqual('9000000'); + }); + + it('Send 100 dNTRN more and get 1000 ldNTRN back (because 1000 ldNTRN = 100 (dNTRN) * 10 (core_exchange_rate))', async () => { + const { lazyStakingClient, client, account, dntrnDenom, ldntrnDenom } = + context; + await lazyStakingClient.bond(account.address, undefined, undefined, [ + { + denom: dntrnDenom, + amount: '100000000', + }, + ]); + const { amount } = await client.getBalance(account.address, ldntrnDenom); + expect(amount).toEqual('1010000000'); + }); });