aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/import_tx.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-08-19 23:42:43 -0400
committerDeterminant <[email protected]>2020-08-19 23:42:43 -0400
commitc6fbdb0dc9453bf4dbf43490d7d83b7a4de2f182 (patch)
tree3ab6bfd38159e9e1c4aee58eabf1c3d39108ad57 /plugin/evm/import_tx.go
parentf3eb89cbe4611c9372ece05eaf5cb7a609954b8e (diff)
clean up code
Diffstat (limited to 'plugin/evm/import_tx.go')
-rw-r--r--plugin/evm/import_tx.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugin/evm/import_tx.go b/plugin/evm/import_tx.go
index 68f34b0..d6e03dc 100644
--- a/plugin/evm/import_tx.go
+++ b/plugin/evm/import_tx.go
@@ -6,6 +6,9 @@ package evm
import (
"errors"
"fmt"
+ "math/big"
+
+ "github.com/ava-labs/coreth/core/state"
"github.com/ava-labs/gecko/database"
"github.com/ava-labs/gecko/ids"
@@ -134,7 +137,7 @@ func (tx *UnsignedImportTx) SemanticVerify(
// we don't want to remove an imported UTXO in semanticVerify
// only to have the transaction not be Accepted. This would be inconsistent.
// Recall that imported UTXOs are not kept in a versionDB.
-func (tx *UnsignedImportTx) Accept(batch database.Batch) error {
+func (tx *UnsignedImportTx) Accept(ctx *snow.Context, batch database.Batch) error {
// TODO: finish this function via gRPC
return nil
}
@@ -218,3 +221,12 @@ func (vm *VM) newImportTx(
}
return tx, utx.Verify(vm.avm, vm.ctx, vm.txFee, vm.avaxAssetID)
}
+
+func (tx *UnsignedImportTx) EVMStateTransfer(state *state.StateDB) {
+ for _, to := range tx.Outs {
+ amount := new(big.Int).SetUint64(to.Amount)
+ state.AddBalance(to.Address, new(big.Int).Mul(amount, x2cRate))
+ nonce := state.GetNonce(to.Address)
+ state.SetNonce(to.Address, nonce+1)
+ }
+}