Skip to content

feat: transfer native#56

Merged
ChrisAmora merged 2 commits into
mainfrom
feat/transfer-native
May 15, 2026
Merged

feat: transfer native#56
ChrisAmora merged 2 commits into
mainfrom
feat/transfer-native

Conversation

@ChrisAmora
Copy link
Copy Markdown
Contributor

@ChrisAmora ChrisAmora commented May 15, 2026

Ports deployment/common/changeset/transfer_native.go from the chainlink repo into evm/changesets/

@ChrisAmora ChrisAmora force-pushed the feat/transfer-native branch from 2374137 to 82f1879 Compare May 15, 2026 18:57
@ChrisAmora ChrisAmora marked this pull request as ready for review May 15, 2026 19:08
@ChrisAmora ChrisAmora requested a review from a team as a code owner May 15, 2026 19:08
Copilot AI review requested due to automatic review settings May 15, 2026 19:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an EVM changeset for transferring native funds from the deployer key to a recipient address, with operation/sequence plumbing and simulated-environment tests.

Changes:

  • Introduces TransferNative changeset with precondition validation and an operation-backed apply path.
  • Adds native transfer operation/sequence definitions.
  • Adds tests for validation, happy path transfer, and insufficient funds behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.

File Description
evm/changesets/transfer_native.go Adds the native transfer changeset, operation, sequence, and EVM transaction construction.
evm/changesets/transfer_native_test.go Adds simulated EVM tests for preconditions and transfer execution paths.
Comments suppressed due to low confidence (3)

evm/changesets/transfer_native_test.go:126

  • This subtest also runs in parallel against the same simulated chain and shared outer err variable as the happy-path subtest. Besides the data race on err, both cases can observe or mutate the same deployer balance concurrently, making the test flaky under go test -race or parallel scheduling.
	t.Run("insufficient funds", func(t *testing.T) {
		t.Parallel()

evm/changesets/transfer_native_test.go:90

  • The test name still refers to TransferFunds while the changeset under test is TransferNative; this makes test output/searching inconsistent with the exported type name.
func Test_TransferFundsChangeset(t *testing.T) {

evm/changesets/transfer_native.go:50

  • This inline comment is misleading for the same reason: EstimateGas does not prove the transfer will succeed with the selected fees or available balance. Calling it a full success validation can hide the fact that the real balance check happens later in Apply.
	// Validate the transfer will succeed with simulation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if !valid {
return fmt.Errorf("address string %s cannot be converted to ETH hex address", config.Address)
}

Comment on lines +146 to +161
tipCap, err := chain.Client.SuggestGasTipCap(b.GetContext())
if err != nil {
return TransferNativeOutput{}, fmt.Errorf("could not suggest gas tip cap: %w", err)
}

latestBlock, err := chain.Client.HeaderByNumber(b.GetContext(), nil)
if err != nil {
return TransferNativeOutput{}, fmt.Errorf("could not get latest block: %w", err)
}
baseFee := latestBlock.BaseFee

feeCap := new(big.Int).Add(
new(big.Int).Mul(baseFee, big.NewInt(2)),
tipCap,
)

Comment on lines +141 to +143
nonce, err := chain.Client.NonceAt(b.GetContext(), chain.DeployerKey.From, nil)
if err != nil {
return TransferNativeOutput{}, fmt.Errorf("could not get latest nonce for deployer key: %w", err)
Comment on lines +100 to +101
t.Run("happy path", func(t *testing.T) {
t.Parallel()
}

if config.Amount.Cmp(big.NewInt(0)) < 1 {
return fmt.Errorf("amount must be positive value: %d", config.Amount)
"github.com/smartcontractkit/chainlink-evm/pkg/utils"
)

func Test_TransferFunds_VerifyPreconditions(t *testing.T) {

// TransferNativeInput holds the parameters for a native token transfer.
type TransferNativeInput struct {
ChainSel uint64 `json:"chainSel" yaml:"chainSel"`
Comment on lines +117 to +119
ChainSel uint64
Address common.Address
Amount *big.Int

e.Logger.Infow("Starting transfer of native funds", "chainSelector", config.ChainSel, "fromAddress", chain.DeployerKey.From, "toAddress", config.Address, "amount", config.Amount)

_, err := operations.ExecuteSequence(
// TransferNative is a changeset that transfers native funds from the deployer key to another address.
type TransferNative struct{}

// VerifyPreconditions validates the input and simulates the transfer to ensure it will succeed.
@ChrisAmora ChrisAmora enabled auto-merge (squash) May 15, 2026 19:59
@ChrisAmora ChrisAmora merged commit 4368e49 into main May 15, 2026
12 checks passed
@ChrisAmora ChrisAmora deleted the feat/transfer-native branch May 15, 2026 20:02
ecPablo pushed a commit that referenced this pull request May 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.4.0](v0.3.0...v0.4.0)
(2026-05-18)


### Features

* add changeset and operation to delete CRE workflow
([#54](#54))
([f0e341a](f0e341a))
* add support for multiple api key to deploy workflow
([#55](#55))
([a68f156](a68f156))
* transfer native
([#56](#56))
([4368e49](4368e49))


### Bug Fixes

* use cache dir for sol programs loading
([#52](#52))
([b04f4d9](b04f4d9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: app-token-issuer-ops-platform[bot] <275822481+app-token-issuer-ops-platform[bot]@users.noreply.github.com>
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.

3 participants