diff options
author | Determinant <[email protected]> | 2020-09-20 17:52:33 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-09-20 17:52:33 -0400 |
commit | c2bdebdce042b3c07888e2066d39b19ad3a9bbc0 (patch) | |
tree | 25706a5cca63d481e70a60d9799705e7997e43a3 /plugin/evm/export_tx.go | |
parent | e86ccf90bd33de6dc8694eb914b7b541aca53db6 (diff) |
do not multiply the non AVAX asset by 10^9v0.3.3-rc.4
Diffstat (limited to 'plugin/evm/export_tx.go')
-rw-r--r-- | plugin/evm/export_tx.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugin/evm/export_tx.go b/plugin/evm/export_tx.go index 8b512df..f210352 100644 --- a/plugin/evm/export_tx.go +++ b/plugin/evm/export_tx.go @@ -229,14 +229,15 @@ func (tx *UnsignedExportTx) EVMStateTransfer(vm *VM, state *state.StateDB) error addrs := map[[20]byte]uint64{} for _, from := range tx.Ins { log.Info("crosschain C->X", "addr", from.Address, "amount", from.Amount) - amount := new(big.Int).Mul( - new(big.Int).SetUint64(from.Amount), x2cRate) if from.AssetID.Equals(vm.ctx.AVAXAssetID) { + amount := new(big.Int).Mul( + new(big.Int).SetUint64(from.Amount), x2cRate) if state.GetBalance(from.Address).Cmp(amount) < 0 { return errInsufficientFunds } state.SubBalance(from.Address, amount) } else { + amount := new(big.Int).SetUint64(from.Amount) assetID := from.AssetID.Key() if state.GetBalanceMultiCoin(from.Address, assetID).Cmp(amount) < 0 { return errInsufficientFunds |