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

fix: fix the inflows sum adding when sender chain is source chain #2417

Merged
merged 11 commits into from
Feb 8, 2024
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

- [2388](https://github.com/umee-network/umee/pull/2388) Adjust interest rate algorithm and associated token parameter validation rules.

### Bug Fixes

- [2417](https://github.com/umee-network/umee/pull/2417) Fix the ibc inflows storing of registered tokens when sender chain is source chain.

## v6.3.0 - 2024-01-03

### Improvements
Expand Down
7 changes: 4 additions & 3 deletions x/uibc/quota/intest/quota_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ func TestKeeper_UndoUpdateQuota(t *testing.T) {
func TestKeeper_RecordIBCInflow(t *testing.T) {
atomAmount := sdkmath.NewInt(100_000000)
atomPrice := sdk.MustNewDecFromStr("0.37")
// ibc incoming denom from packet is `port/path/base_denom`
atomToken := sdk.NewCoin("transfer/channel-10/uatom", atomAmount)
// ibc denom = base_denom when sender chain is source chain
// ibc denom = ibc/XXX when sender chain is receiver chain
atomToken := sdk.NewCoin("uatom", atomAmount)
atomExponent := 6
inflowBaseDenom := "ibc/D6372674F0E9A3A7ADC2FEFD8B2708C5008C7ED04DA6566E279DC1321BDDCB6F"
inflowBaseDenom := "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9"

ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down
2 changes: 1 addition & 1 deletion x/uibc/quota/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (k Keeper) RecordIBCInflow(packet channeltypes.Packet, denom, amount string
) exported.Acknowledgement {
// if chain is recevier and sender chain is source then we need create ibc_denom (ibc/hash(channel,denom)) to
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
// check ibc_denom is exists in leverage token registry
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
if !ics20types.SenderChainIsSource(packet.GetSourcePort(), packet.GetSourceChannel(), denom) {
if ics20types.SenderChainIsSource(packet.GetSourcePort(), packet.GetSourceChannel(), denom) {
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
// since SendPacket did not prefix the denomination, we must prefix denomination here
sourcePrefix := ics20types.GetDenomPrefix(packet.GetDestPort(), packet.GetDestChannel())
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
// NOTE: sourcePrefix contains the trailing "/"
Expand Down
Loading