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

added log to undelegate icacallback #1277

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion dockernet/scripts/1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/../config.sh

## IBC ATOM from GAIA to STRIDE
$GAIA_MAIN_CMD tx ibc-transfer transfer transfer channel-0 $(STRIDE_ADDRESS) 1000000uatom --from ${GAIA_VAL_PREFIX}1 -y
$GAIA_MAIN_CMD tx ibc-transfer transfer transfer channel-0 $(STRIDE_ADDRESS) 1000000uatom --from ${GAIA_VAL_PREFIX}1 -y --fees 1000000ufee
sleep 10
$STRIDE_MAIN_CMD q bank balances $(STRIDE_ADDRESS)
13 changes: 9 additions & 4 deletions x/stakeibc/keeper/icacallbacks_undelegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ func (k Keeper) UpdateHostZoneUnbondingsAfterUndelegation(
stTokensToBurn = sdk.NewDecFromInt(nativeTokensUnbonded).Quo(impliedRedemptionRate).TruncateInt()
}

k.Logger(ctx).Info(utils.LogICACallbackWithHostZone(chainId, ICACallbackID_Undelegate,
"Epoch Unbonding Record: %d - Native Unbonded: %v, StTokens Burned: %v",
epochNumber, nativeTokensUnbonded, stTokensToBurn))

// Decrement st amount on the record and increment the total
hostZoneUnbonding.StTokensToBurn = hostZoneUnbonding.StTokensToBurn.Sub(stTokensToBurn)
totalStTokensToBurn = totalStTokensToBurn.Add(stTokensToBurn)
Expand All @@ -259,15 +263,15 @@ func (k Keeper) UpdateHostZoneUnbondingsAfterUndelegation(
// Update the unbonding time if the time from this batch is later than what's on the record
if unbondingTime > hostZoneUnbonding.UnbondingTime {
hostZoneUnbonding.UnbondingTime = unbondingTime

k.Logger(ctx).Info(utils.LogICACallbackWithHostZone(chainId, ICACallbackID_Undelegate,
"Epoch Unbonding Record: %d - Setting unbonding time to %d", epochNumber, unbondingTime))
}

// Persist the record changes
if err := k.RecordsKeeper.SetHostZoneUnbondingRecord(ctx, epochNumber, chainId, *hostZoneUnbonding); err != nil {
return totalStTokensToBurn, err
}

k.Logger(ctx).Info(utils.LogICACallbackWithHostZone(chainId, ICACallbackID_Undelegate,
"Epoch Unbonding Record: %d - Setting unbonding time to %d", epochNumber, unbondingTime))
}
return totalStTokensToBurn, nil
}
Expand All @@ -293,6 +297,7 @@ func (k Keeper) BurnStTokensAfterUndelegation(ctx sdk.Context, hostZone types.Ho
if err != nil {
return errorsmod.Wrapf(err, "unable to burn %v%s tokens", stTokenBurnAmount, stCoinDenom)
}
k.Logger(ctx).Info(utils.LogICACallbackWithHostZone(hostZone.ChainId, ICACallbackID_Undelegate, "Burned %v", stCoin))
k.Logger(ctx).Info(utils.LogICACallbackWithHostZone(hostZone.ChainId, ICACallbackID_Undelegate,
"Total Burned from Batch %v", stCoin))
return nil
}
Loading