Skip to content

Commit

Permalink
convert to bep20 supply in sync
Browse files Browse the repository at this point in the history
update token supply
  • Loading branch information
HaoyangLiu committed Dec 25, 2020
1 parent dab338c commit eaa2cb5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/bridge/cross_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,10 @@ func (app *MirrorSyncApp) ExecuteSynPackage(ctx sdk.Context, payload []byte, rel
}

// mint or burn
newSupply := mirrorSyncPackage.BEP20TotalSupply.Int64()
newSupply, sdkErr := types.ConvertBSCAmountToBCAmount(token.GetContractDecimals(), sdk.NewIntFromBigInt(mirrorSyncPackage.BEP20TotalSupply))
if sdkErr != nil {
panic("convert bsc total supply error")
}
if newSupply > ctypes.TokenMaxTotalSupply {
ackPackage, sdkErr := app.generateAckPackage(types.MirrorSyncErrCodeUnknown, mirrorSyncPackage)
if sdkErr != nil {
Expand Down Expand Up @@ -675,6 +678,9 @@ func (app *MirrorSyncApp) ExecuteSynPackage(ctx sdk.Context, payload []byte, rel
panic(sdkError.Error())
}
}
if err := app.bridgeKeeper.TokenMapper.UpdateTotalSupply(ctx, symbol, newSupply); err !=nil {
panic(err.Error())
}

// add balance change accounts
if newSupply != token.GetTotalSupply().ToInt64() && ctx.IsDeliverTx() {
Expand Down

0 comments on commit eaa2cb5

Please sign in to comment.