Skip to content

Conversation

@sukantoraymond
Copy link
Collaborator

Proposed EVM design.

Main idea:

Read only operations are implemented by Client, which is inside Wallet

Write Operations will be implemented by Wallet, consistent with Build/Sign/Send approach.

EVM specific operations (like Deploy Contract) will be handled by EVM wallet implementation of wallet interface.

One wallet object will be able to handle both Avalanche and EVM chains

)

// EVMClient represents an EVM client interface for wallet operations
type EVMClient interface {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read only operations are placed here

Comment on lines 33 to 34
evmClient EVMClient // For EVM operations
avalancheClient Client // For Avalanche operations
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clients placed here are just for placheolders

}
return tx, issueTxErr
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions below are for EVM specific implementations of wallet

return w.evmClient.GetBalance(ctx, address)
}

func (w *LocalWallet) DeployEVMContract(ctx context.Context, account Account, network Network,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is similar to our Submit Tx, where it combines Build, Sign and Send Tx into one function

@sukantoraymond sukantoraymond changed the title Raymond evm design Wallet Evm design Oct 20, 2025
@sukantoraymond sukantoraymond changed the base branch from convert-example to main October 20, 2025 22:50
@sukantoraymond sukantoraymond changed the base branch from main to convert-example October 20, 2025 22:50
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/libevm/core/types"
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains the input that can be fed into our build, sign, send Tx operations similar to how we do it for Avalanche Txs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It contains EVMDeployContractInput, Transfer

)

// EVMDeployContractInput represents EVM contract deployment parameters
type EVMDeployContractInput struct {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We specify EVMDeployContractInput in case user wants to do build,sign,send. We have have DeployContract function which basically combines these build,sign,send steps into one step. DeployContract is in local/wallet.go

return w.evmClient.GetBalance(ctx, address)
}

func (w *LocalWallet) DeployEVMContract(ctx context.Context, account Account, network Network,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is similar to Submit Tx, where it combines, Build,Sign,Send Tx into one

}
return tx, issueTxErr
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions below are for EVM specific implementations of wallet

"github.com/ava-labs/libevm/common"
"github.com/ava-labs/libevm/core/types"
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file contains the input that can be fed into build,sign,send operations. This is similar to how we do it for avalanche txs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It contains EVM Contract Deploy input, Transfer input

)

// EVMDeployContractInput represents EVM contract deployment parameters
type EVMDeployContractInput struct {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We specificy EVMDeployContractInput in case user wants to use Build,Sign,Send Workflow for Deploying contract. We also have Deploy Contract function that does Build,Sign,Send in one step in local/wallet.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants