aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/import_tx.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-08-19 23:34:12 -0400
committerDeterminant <[email protected]>2020-08-19 23:34:12 -0400
commit40879ea67433b73b464bd8b012a9809fbb646cfd (patch)
treea11646c8f69a217c936322bd937915b2ecc7bdba /plugin/evm/import_tx.go
parent0b934ef60fd652de038a21e6f25691b11cea7121 (diff)
WIP: C-to-X transfer
Diffstat (limited to 'plugin/evm/import_tx.go')
-rw-r--r--plugin/evm/import_tx.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/plugin/evm/import_tx.go b/plugin/evm/import_tx.go
index 2e49493..68f34b0 100644
--- a/plugin/evm/import_tx.go
+++ b/plugin/evm/import_tx.go
@@ -27,6 +27,7 @@ var (
errUnknownAsset = errors.New("unknown asset ID")
errNoFunds = errors.New("no spendable funds were found")
errWrongChainID = errors.New("tx has wrong chain ID")
+ errInsufficientFunds = errors.New("insufficient funds")
)
// UnsignedImportTx is an unsigned ImportTx
@@ -36,19 +37,16 @@ type UnsignedImportTx struct {
syntacticallyVerified bool
// ID of the network on which this tx was issued
NetworkID uint32 `serialize:"true" json:"networkID"`
- // ID of this blockchain. In practice is always the empty ID.
- // This is only here to match avm.BaseTx's format
+ // ID of this blockchain.
BlockchainID ids.ID `serialize:"true" json:"blockchainID"`
- // Outputs
- Outs []EVMOutput `serialize:"true" json:"outputs"`
- // Memo field contains arbitrary bytes, up to maxMemoSize
- Memo []byte `serialize:"true" json:"memo"`
-
// Which chain to consume the funds from
SourceChain ids.ID `serialize:"true" json:"sourceChain"`
-
// Inputs that consume UTXOs produced on the chain
ImportedInputs []*avax.TransferableInput `serialize:"true" json:"importedInputs"`
+ // Outputs
+ Outs []EVMOutput `serialize:"true" json:"outputs"`
+ // Memo field contains arbitrary bytes, up to maxMemoSize
+ Memo []byte `serialize:"true" json:"memo"`
}
// InputUTXOs returns the UTXOIDs of the imported funds
@@ -147,7 +145,7 @@ func (vm *VM) newImportTx(
to common.Address, // Address of recipient
keys []*crypto.PrivateKeySECP256K1R, // Keys to import the funds
) (*Tx, error) {
- if !vm.avm.Equals(chainID) {
+ if !vm.ctx.XChainID.Equals(chainID) {
return nil, errWrongChainID
}