Skip to content

Commit 13cf316

Browse files
committed
updated CCIP example
1 parent e0d37f3 commit 13cf316

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

.github/actions/projectserum_version/action.yml

-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ runs:
1414
run: |
1515
PSVERSION=$(make projectserum_version)
1616
echo "PSVERSION=${PSVERSION}" >>$GITHUB_OUTPUT
17-
EVM2AnyRampMessage

pkg/solana/chainwriter/chain_writer_test.go

+33-18
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ import (
88
"github.com/smartcontractkit/chainlink-solana/pkg/solana/chainwriter"
99
)
1010

11-
type RegistryTokenState struct {
12-
PoolProgram [32]byte `json:"pool_program"`
13-
PoolConfig [32]byte `json:"pool_config"`
14-
TokenProgram [32]byte `json:"token_program"`
15-
TokenState [32]byte `json:"token_state"`
16-
PoolAssociatedTokenAccount [32]byte `json:"pool_associated_token_account"`
17-
}
18-
1911
func TestGetAddresses(t *testing.T) {
2012
// Fake constant addresses for the purpose of this example.
2113
registryAddress := "4Nn9dsYBcSTzRbK9hg9kzCUdrCSkMZq1UR6Vw1Tkaf6A"
@@ -95,7 +87,7 @@ func TestGetAddresses(t *testing.T) {
9587
// A) The PublicKey lookup resolves to multiple addresses (i.e. multiple token addresses)
9688
// B) The Seeds or ValueSeeds resolve to multiple values
9789
chainwriter.PDALookups{
98-
Name: "PerChainRateLimit",
90+
Name: "PerChainConfig",
9991
// PublicKey is a constant account in this case, not a lookup.
10092
PublicKey: chainwriter.AccountConstant{
10193
Address: registryAddress,
@@ -105,6 +97,7 @@ func TestGetAddresses(t *testing.T) {
10597
// Similar to the RegistryTokenState above, the user is looking up PDA accounts based on the dest tokens.
10698
Seeds: []chainwriter.Lookup{
10799
chainwriter.AccountLookup{Location: "Message.TokenAmounts.DestTokenAddress"},
100+
chainwriter.AccountLookup{Location: "Message.Header.DestChainSelector"},
108101
},
109102
IsSigner: false,
110103
IsWritable: false,
@@ -182,6 +175,22 @@ func TestGetAddresses(t *testing.T) {
182175
IsSigner: false,
183176
IsWritable: false,
184177
},
178+
// PDA lookup to get the Router Chain Config
179+
chainwriter.PDALookups{
180+
Name: "RouterChainConfig",
181+
// The public key is a constant Router address.
182+
PublicKey: chainwriter.AccountConstant{
183+
Address: routerProgramAddress,
184+
IsSigner: false,
185+
IsWritable: false,
186+
},
187+
Seeds: []chainwriter.Lookup{
188+
chainwriter.AccountLookup{Location: "Message.Header.DestChainSelector"},
189+
chainwriter.AccountLookup{Location: "Message.Header.SourceChainSelector"},
190+
},
191+
IsSigner: false,
192+
IsWritable: false,
193+
},
185194
// PDA lookup to get the Router Report Accounts.
186195
chainwriter.PDALookups{
187196
Name: "RouterReportAccount",
@@ -213,7 +222,7 @@ func TestGetAddresses(t *testing.T) {
213222
// with the public key to generate one or multiple PDA accounts.
214223
Seeds: []chainwriter.Lookup{
215224
chainwriter.AccountLookup{Location: "Message.Receiver"},
216-
chainwriter.AccountLookup{Location: "Message.DestChainSelector"},
225+
chainwriter.AccountLookup{Location: "Message.Header.DestChainSelector"},
217226
},
218227
},
219228
// Account constant
@@ -261,7 +270,20 @@ func TestGetAddresses(t *testing.T) {
261270
},
262271
},
263272
Accounts: []chainwriter.Lookup{
264-
273+
// Account constant
274+
chainwriter.AccountConstant{
275+
Name: "RouterProgram",
276+
Address: routerProgramAddress,
277+
IsSigner: false,
278+
IsWritable: false,
279+
},
280+
// Account constant
281+
chainwriter.AccountConstant{
282+
Name: "RouterAccountConfig",
283+
Address: routerAccountConfigAddress,
284+
IsSigner: false,
285+
IsWritable: false,
286+
},
265287
// PDA lookup to get the Router Report Accounts.
266288
chainwriter.PDALookups{
267289
Name: "RouterReportAccount",
@@ -281,13 +303,6 @@ func TestGetAddresses(t *testing.T) {
281303
IsWritable: false,
282304
},
283305
// Account constant
284-
chainwriter.AccountConstant{
285-
Name: "CPISigner",
286-
Address: cpiSignerAddress,
287-
IsSigner: true,
288-
IsWritable: false,
289-
},
290-
// Account constant
291306
chainwriter.AccountConstant{
292307
Name: "SystemProgram",
293308
Address: systemProgramAddress,

0 commit comments

Comments
 (0)