Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solana: example receiver #521

Merged
merged 12 commits into from
Feb 3, 2025
9 changes: 5 additions & 4 deletions chains/solana/contracts/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ wallet = "id.json"

[programs.localnet]
access_controller = "9xi644bRR8birboDGdTiwBq3C7VEeR7VuamRYYXCubUW"
ccip_receiver = "CtEVnHsQzhTNWav8skikiV2oF6Xx7r7uGGa8eCDQtTjH"
ccip_invalid_receiver = "9Vjda3WU2gsJgE4VdU6QuDw8rfHLyigfFyWs3XDPNUn8"
ccip_router = "C8WSPj3yyus1YN3yNB6YA5zStYtbjQWtpmKadmvyUXq8"
token_pool = "GRvFSLwR7szpjgNEZbGe4HtxfJYXqySXuuRUAJDpu4WH"
external_program_cpi_stub = "4HeqEoSyfYpeC2goFLj9eHgkxV33mR5G7JYAbRsN14uQ"
mcm = "6UmMZr5MEqiKWD5jqTJd1WCR5kT8oZuFYBLJFi1o6GQX"
timelock = "LoCoNsJFuhTkSQjfdDfn3yuwqhSYoPujmviRHVCzsqn"
token_pool = "GRvFSLwR7szpjgNEZbGe4HtxfJYXqySXuuRUAJDpu4WH"
example_ccip_receiver = "CcipReceiver1111111111111111111111111111111"
test_ccip_receiver = "CtEVnHsQzhTNWav8skikiV2oF6Xx7r7uGGa8eCDQtTjH"
test_ccip_invalid_receiver = "9Vjda3WU2gsJgE4VdU6QuDw8rfHLyigfFyWs3XDPNUn8"
external_program_cpi_stub = "4HeqEoSyfYpeC2goFLj9eHgkxV33mR5G7JYAbRsN14uQ"
44 changes: 28 additions & 16 deletions chains/solana/contracts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -464,11 +464,13 @@ fn internal_execute<'info>(
CcipRouterError::OfframpInvalidDataLength
);

// parse pool return data into SVMTokenAmount
token_amounts[i] = SVMTokenAmount {
token: accs.mint.key(),
amount: ReleaseOrMintOutV1::try_from_slice(&return_data)?.destination_amount,
};

// validate user recieved tokens according to the amount returned by the token pool
let post_bal = get_balance(accs.user_token_account)?;
require!(
post_bal >= init_bal && post_bal - init_bal == token_amounts[i].amount,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
[package]
name = "ccip_receiver"
name = "example_ccip_receiver"
version = "0.1.0-dev"
description = "Created with Anchor"
edition = "2021"

[lib]
crate-type = ["cdylib", "lib"]
name = "ccip_receiver"
name = "example_ccip_receiver"

[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
idel-build = ["anchor-lang/idl-build"]

[dependencies]
solana-program = "1.17.25" # pin solana to 1.17
Expand Down
Loading
Loading