Skip to content

Commit

Permalink
fix: do not charge relayerFee for auto cross undelegate after SecondS…
Browse files Browse the repository at this point in the history
…unsetFork
  • Loading branch information
j75689 committed Jan 15, 2024
1 parent 14aa8ec commit d28e18e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion x/stake/keeper/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,14 @@ func (k Keeper) crossDistributeUndelegated(ctx sdk.Context, delAddr sdk.AccAddre
if relayFee.Tokens.AmountOf(denom) >= amount {
return sdk.Events{}, ErrNotEnoughRelayerFeeForCrossPkg
}

bscRelayFee := bsc.ConvertBCAmountToBSCAmount(relayFee.Tokens.AmountOf(denom))
bscTransferAmount := new(big.Int).Sub(bsc.ConvertBCAmountToBSCAmount(amount), bscRelayFee)
var bscTransferAmount *big.Int
if sdk.IsUpgrade(sdk.SecondSunsetFork) && k.IsAutoUnDelegate(ctx, delAddr, valAddr) {
bscTransferAmount = bsc.ConvertBCAmountToBSCAmount(amount)
} else {
bscTransferAmount = new(big.Int).Sub(bsc.ConvertBCAmountToBSCAmount(amount), bscRelayFee)
}

delBscAddrAcc := types.GetStakeCAoB(delAddr.Bytes(), types.DelegateCAoBSalt)
delBscAddr := hex.EncodeToString(delBscAddrAcc.Bytes())
Expand Down

0 comments on commit d28e18e

Please sign in to comment.