diff --git a/tests/e2e/e2e_ibc_test.go b/tests/e2e/e2e_ibc_test.go index 2560679eae..a65d6cd9a6 100644 --- a/tests/e2e/e2e_ibc_test.go +++ b/tests/e2e/e2e_ibc_test.go @@ -111,12 +111,14 @@ func (s *E2ETest) TestIBCTokenTransfer() { sdk.NewDecFromInt(tokenQuota).Quo(atomPrice).Mul(powerReduction).RoundInt(), ) + //<<<< INFLOW : gaia -> umee >> // send $500 ATOM from gaia to umee. (ibc_quota will not check token limit) atomFromGaia := mulCoin(atomQuota, "5.0") atomFromGaia.Denom = "uatom" s.SendIBC(setup.GaiaChainID, s.Chain.ID, "", atomFromGaia, false, "") s.checkSupply(umeeAPIEndpoint, uatomIBCHash, atomFromGaia.Amount) + // <<< OUTLOW : umee -> gaia >> // compute the amout of UMEE sent to gaia which would meet umee's token quota umeePrice, err := s.QueryHistAvgPrice(umeeAPIEndpoint, umeeSymbol) s.Require().NoError(err) @@ -126,13 +128,13 @@ func (s *E2ETest) TestIBCTokenTransfer() { sdk.NewDecFromInt(tokenQuota).Quo(umeePrice).Mul(powerReduction).RoundInt(), ) - // send $90 UMEE from umee to gaia (ibc_quota will check) - // Note: receiver is null so hermes will default send to key_name (from config) of target chain (gaia) - sendUmee := mulCoin(umeeQuota, "0.9") - s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", sendUmee, false, fmt.Sprintf( - "sending %s (less than token quota) ", sendUmee.String())) - s.checkOutflows(umeeAPIEndpoint, appparams.BondDenom, true, sdk.NewDecFromInt(sendUmee.Amount), appparams.Name) - s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, sendUmee.Amount) + // << TOKEN QUOTA EXCCEED >> + // send $110 UMEE from umee to gaia (token_quota is 100$) + exceedUmee := mulCoin(umeeQuota, "1.1") + s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedUmee, true, "") + // check the ibc (umee) quota after ibc txs - this one should have failed + // supply don't change + s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, math.ZeroInt()) // send $110 ATOM from umee to gaia exceedAtom := mulCoin(atomQuota, "1.1") @@ -140,20 +142,25 @@ func (s *E2ETest) TestIBCTokenTransfer() { s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedAtom, true, "uatom from umee to gaia") s.checkSupply(umeeAPIEndpoint, uatomIBCHash, atomFromGaia.Amount) - // send $110 UMEE from umee to gaia (token_quota is 100$) - exceedUmee := mulCoin(umeeQuota, "1.1") - s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", exceedUmee, true, "") - // check the ibc (umee) quota after ibc txs - this one should have failed - s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, math.ZeroInt()) + // << BELOW TOKEN QUOTA >> + // send $90 UMEE from umee to gaia (ibc_quota will check) + // Note: receiver is null so hermes will default send to key_name (from config) of target chain (gaia) + sendUmee := mulCoin(umeeQuota, "0.9") + s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", sendUmee, false, fmt.Sprintf( + "sending %s (less than token quota) ", sendUmee.String())) + s.checkOutflows(umeeAPIEndpoint, appparams.BondDenom, true, sdk.NewDecFromInt(sendUmee.Amount), appparams.Name) + s.checkSupply(gaiaAPIEndpoint, umeeIBCHash, sendUmee.Amount) + // << BELOW TOKEN QUTOA 40$ but ATOM_QUOTA (40$)+ UMEE_QUOTA(90$) >= TOTAL QUOTA (120$) >> // send $40 ATOM from umee to gaia atom40 := mulCoin(atomQuota, "0.4") s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", atom40, true, "below token quota but not total quota") // supply will be not be decreased because sending more than total quota from umee to gaia s.checkSupply(umeeAPIEndpoint, uatomIBCHash, atomFromGaia.Amount) + // ✅ << BELOW TOKEN QUTOA 5$ but ATOM_QUOTA (5$)+ UMEE_QUOTA(90$) <= TOTAL QUOTA (120$) >> // send $15 ATOM from umee to gaia - sendAtom := mulCoin(atomQuota, "0.15") + sendAtom := mulCoin(atomQuota, "0.05") s.SendIBC(s.Chain.ID, setup.GaiaChainID, "", sendAtom, false, "below both quotas") // remaing supply decreased uatom on umee s.checkSupply(umeeAPIEndpoint, uatomIBCHash, atomFromGaia.Amount.Sub(sendAtom.Amount))