Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions deployments/deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,23 @@
"1301": {
"SpokePool": { "address": "0x6999526e507Cc3b03b180BbE05E1Ff938259A874", "blockNumber": 12593713 },
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 12594561 }
},
"133268194659241": {
"SvmSpoke": {
"address": "JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq",
"blockNumber": 356313770
},
"MulticallHandler": {
"address": "Fk1RpqsfeWt8KnFCTW9NQVdVxYvxuqjGn6iPB9wrmM8h",
"blockNumber": 356321050
},
"MessageTransmitter": {
"address": "CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd",
"blockNumber": 339604856
},
"TokenMessengerMinter": {
"address": "CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3",
"blockNumber": 277864039
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@across-protocol/contracts",
"version": "4.0.2",
"version": "4.0.3",
"author": "UMA Team",
"license": "AGPL-3.0-only",
"repository": {
Expand Down
50 changes: 33 additions & 17 deletions scripts/svm/simpleFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { PublicKey, SystemProgram, Transaction, sendAndConfirmTransaction } from
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { calculateRelayHashUint8Array, getSpokePoolProgram, intToU8Array32 } from "../../src/svm/web3-v1";
import { FillDataValues } from "../../src/types/svm";

// Set up the provider
const provider = AnchorProvider.env();
Expand Down Expand Up @@ -133,6 +134,16 @@ async function fillRelay(): Promise<void> {

const tokenDecimals = (await getMint(provider.connection, outputToken, undefined, TOKEN_PROGRAM_ID)).decimals;

// Create the ATA using the create_token_accounts method
const createTokenAccountsIx = await program.methods
.createTokenAccounts()
.accounts({ signer: signer.publicKey, mint: outputToken, tokenProgram: TOKEN_PROGRAM_ID })
.remainingAccounts([
{ pubkey: recipient, isWritable: false, isSigner: false },
{ pubkey: recipientTokenAccount, isWritable: true, isSigner: false },
])
.instruction();

// Delegate state PDA to pull relayer tokens.
const approveIx = await createApproveCheckedInstruction(
relayerTokenAccount,
Expand All @@ -145,24 +156,29 @@ async function fillRelay(): Promise<void> {
TOKEN_PROGRAM_ID
);

const fillIx = await (
program.methods.fillRelay(Array.from(relayHashUint8Array), relayData, chainId, signer.publicKey) as any
)
.accounts({
state: statePda,
signer: signer.publicKey,
instructionParams: program.programId,
mint: outputToken,
relayerTokenAccount: relayerTokenAccount,
recipientTokenAccount: recipientTokenAccount,
fillStatus: fillStatusPda,
tokenProgram: TOKEN_PROGRAM_ID,
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
systemProgram: SystemProgram.programId,
programId: programId,
})
const fillDataValues: FillDataValues = [Array.from(relayHashUint8Array), relayData, chainId, signer.publicKey];

const fillAccounts = {
state: statePda,
signer: signer.publicKey,
instructionParams: program.programId,
mint: outputToken,
relayerTokenAccount: relayerTokenAccount,
recipientTokenAccount: recipientTokenAccount,
fillStatus: fillStatusPda,
tokenProgram: TOKEN_PROGRAM_ID,
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
systemProgram: SystemProgram.programId,
programId: programId,
program: program.programId,
};

const fillIx = await program.methods
.fillRelay(...fillDataValues)
.accounts(fillAccounts)
.instruction();
const fillTx = new Transaction().add(approveIx, fillIx);

const fillTx = new Transaction().add(createTokenAccountsIx, approveIx, fillIx);
const tx = await sendAndConfirmTransaction(provider.connection, fillTx, [signer]);

console.log("Transaction signature:", tx);
Expand Down
Loading