Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
16f0dc2
feat(svm): wip cctp sponsored src
Reinis-FRP Oct 14, 2025
e4d6c32
fix: todo nonce check
Reinis-FRP Oct 14, 2025
f7fc466
feat: cctp quote parsing
Reinis-FRP Oct 14, 2025
53bceb6
fix: comment
Reinis-FRP Oct 14, 2025
959d996
fix: linting
Reinis-FRP Oct 15, 2025
e6ef648
fix: naming
Reinis-FRP Oct 15, 2025
ffb738e
fix: parse and validate quote parameters
Reinis-FRP Oct 15, 2025
a5da4eb
fix: missing events file
Reinis-FRP Oct 15, 2025
71724e8
feat: admin methods
Reinis-FRP Oct 15, 2025
6f35d56
fix: validate source domain
Reinis-FRP Oct 15, 2025
2b97244
feat: validate sigature
Reinis-FRP Oct 15, 2025
eec13c0
fix: represent nonce as pubkey
Reinis-FRP Oct 16, 2025
ce21d7a
feat: sponsored cctp periphery artifacts
Reinis-FRP Oct 16, 2025
64b7f96
fix: rename to max_bps_to_sponsor
Reinis-FRP Oct 16, 2025
9fff1e9
test: sponsored cctp svm deposit
Reinis-FRP Oct 16, 2025
8f9a8a1
fix: comment typo
Reinis-FRP Oct 16, 2025
c359505
fix: remove only
Reinis-FRP Oct 16, 2025
ef873bd
fix: use existing lookup table in tests
Reinis-FRP Oct 17, 2025
d1d91a1
feat: sponsored rent fund
Reinis-FRP Oct 17, 2025
118de7a
fix: nonce validation
Reinis-FRP Oct 17, 2025
71ad236
fix: use vec in params and emit signature
Reinis-FRP Oct 18, 2025
039861a
fix: comment on vec usage
Reinis-FRP Oct 18, 2025
cead081
fix: use vec for nonce
Reinis-FRP Oct 18, 2025
7b31731
fix: simplify signature errors
Reinis-FRP Oct 18, 2025
b5fb88e
fix: match deposit event to evm
Reinis-FRP Oct 18, 2025
5b6cf1d
fix: sync signer naming with evm
Reinis-FRP Oct 18, 2025
c607ed9
fix: check for changed signer
Reinis-FRP Oct 18, 2025
4b596d9
fix: remove redundant signer check
Reinis-FRP Oct 18, 2025
feac848
fix: reorder validation logic to match evm
Reinis-FRP Oct 18, 2025
41696ed
fix: move mint checks to constraints
Reinis-FRP Oct 18, 2025
a6127f8
fix: revert to fixed sized input params
Reinis-FRP Oct 19, 2025
ffb1970
fix: use native i64 for timestamps
Reinis-FRP Oct 20, 2025
5497c0e
fix: improve decoding logic
Reinis-FRP Oct 20, 2025
f4e021e
feat: used nonce close info getter
Reinis-FRP Oct 20, 2025
c4cb337
fix: sync source domain naming with evm
Reinis-FRP Oct 20, 2025
e012665
fix: sync deposit_for_burn naming with evm
Reinis-FRP Oct 20, 2025
87e5211
fix: remove redundant quote.deadline() call
Reinis-FRP Oct 20, 2025
2f67b7a
fix: update comment
Reinis-FRP Oct 20, 2025
cc4162b
fix: consistent deposit account naming
Reinis-FRP Oct 20, 2025
38c2249
fix: update comment
Reinis-FRP Oct 20, 2025
58d1eaa
fix: rename internal fn
Reinis-FRP Oct 20, 2025
0757b1e
feat: emit created message sent account
Reinis-FRP Oct 20, 2025
dc29cf3
fix: drop state seed
Reinis-FRP Oct 20, 2025
a3f6fd5
fix: import visibility
Reinis-FRP Oct 20, 2025
69eeaad
fix: remove build warnings
Reinis-FRP Oct 20, 2025
9024ec7
fix: add security.txt
Reinis-FRP Oct 20, 2025
b78d917
fix: add missing maxUserSlippageBps
Reinis-FRP Oct 20, 2025
5354ac8
fix: simplify layout
Reinis-FRP Oct 20, 2025
5a5203a
fix: initial docs
Reinis-FRP Oct 20, 2025
7bc8ec9
fix: improve documentation
Reinis-FRP Oct 20, 2025
f5ce303
fix: typo
Reinis-FRP Oct 20, 2025
b13eaad
fix: instruction name in comments
Reinis-FRP Oct 20, 2025
9d7c3c1
fix: lint
Reinis-FRP Oct 20, 2025
724b73f
fix: optimize address bumps
Reinis-FRP Oct 21, 2025
c413e5c
test: reclaim nonce account
Reinis-FRP Oct 21, 2025
e69e58d
fix: add arbitrary actions execution to sponsored bridging
Reinis-FRP Oct 22, 2025
6d41f25
fix: remove duplicate test
Reinis-FRP Oct 22, 2025
1bced45
fix: update comment
Reinis-FRP Oct 22, 2025
87f5dcf
fix: update comment
Reinis-FRP Oct 22, 2025
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
29 changes: 29 additions & 0 deletions Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ skip-lint = false
multicall_handler = "HaQe51FWtnmaEcuYEfPA7MRCXKrtqptat4oJdJ8zV5Be"
svm_spoke = "DLv3NggMiSaef97YCkew5xKUHDh13tVGZ7tydt3ZeAru"
test = "8tsEfDSiE4WUMf97oyyyasLAvWwjeRZb2GByh4w7HckA"
sponsored_cctp_src_periphery = "CPr4bRvkVKcSCLyrQpkZrRrwGzQeVAXutFU8WupuBLXq"

[programs.devnet]
multicall_handler = "Fk1RpqsfeWt8KnFCTW9NQVdVxYvxuqjGn6iPB9wrmM8h"
Expand Down Expand Up @@ -56,6 +57,9 @@ findFillStatusFromFillStatusPda = "NODE_NO_WARNINGS=1 yarn run ts-node ./scripts
nativeDeposit = "NODE_NO_WARNINGS=1 yarn run ts-node ./scripts/svm/nativeDeposit.ts"
squadsIdlUpgrade = "NODE_NO_WARNINGS=1 yarn run ts-node ./scripts/svm/squadsIdlUpgrade.ts"

[test]
upgradeable = true

[test.validator]
url = "https://api.mainnet-beta.solana.com"

Expand Down Expand Up @@ -84,3 +88,28 @@ address = "Afgq3BHEfCE7d78D2XE9Bfyu2ieDqvE24xX8KDwreBms"
### Circle Token Messenger Minter PDA -- Ethereum Remote Token Messenger
[[test.validator.clone]]
address = "Hazwi3jFQtLKc2ughi7HFXPkpDeso7DQaMR9Ks4afh3j"

### Forked Circle MessageTransmitterV2 Program
[[test.validator.clone]]
address = "CCTPV2Sm4AdWt5296sk4P66VBZ7bEhcARwFaaS9YPbeC"

### Forked Circle TokenMessengerMinterV2 Program
[[test.validator.clone]]
address = "CCTPV2vPZJS2u2BBsUoscuikbYjnpFmbFsvVuJdgUMQe"

### Forked Circle MessageTransmitterV2 PDA -- Message Transmitter Config
[[test.validator.clone]]
address = "W1k5ijkaSTo5iA5zChNpfzcy796fLhkBxfmJuR8W8HU"

### Forked Circle TokenMessengerMinterV2 PDA -- Token Messenger
[[test.validator.clone]]
address = "AawthJCGRmggpfv9MMWV6Jmo9cue4gL9wUZgRBShg58W"

### Circle TokenMessengerMinterV2 PDA -- Ethereum Remote Token Messenger
[[test.validator.clone]]
address = "3EzN2mcmdfSNGXRCAixSpTteK6ywdmFDZZWvkMnznFt9"

### Circle TokenMessengerMinterV2 PDA -- Token Minter (Modified with token_controller set to test wallet)
[[test.validator.account]]
address = "E1bQJ8eMMn3zmeSewW3HQ8zmJr7KR75JonbwAtWx2bux"
filename = "test/svm/accounts/token_minter_v2.json"
103 changes: 96 additions & 7 deletions Cargo.lock

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

24 changes: 24 additions & 0 deletions programs/sponsored-cctp-src-periphery/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "sponsored-cctp-src-periphery"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"

[lib]
crate-type = ["cdylib", "lib"]
name = "sponsored_cctp_src_periphery"

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

[dependencies]
anchor-lang = { version = "0.31.1", features = ["event-cpi"]}
anchor-spl = "0.31.1"
libsecp256k1 = "0.7.2"
solana-security-txt = "1.1.1"
2 changes: 2 additions & 0 deletions programs/sponsored-cctp-src-periphery/Xargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.bpfel-unknown-unknown.dependencies.std]
features = []
46 changes: 46 additions & 0 deletions programs/sponsored-cctp-src-periphery/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use anchor_lang::prelude::*;

// Common Errors with EVM SponsoredCCTPSrcPeriphery.
#[error_code]
pub enum CommonError {
#[msg("Invalid quote signature")]
InvalidSignature,
#[msg("Invalid quote deadline")]
InvalidDeadline,
#[msg("Invalid source domain")]
InvalidSourceDomain,
}

// SVM specific errors.
#[error_code]
pub enum SvmError {
#[msg("Only the upgrade authority can call this instruction")]
NotUpgradeAuthority,
#[msg("Invalid program data account")]
InvalidProgramData,
#[msg("Cannot set time if not in test mode")]
CannotSetCurrentTime,
#[msg("Invalid burn_token key")]
InvalidBurnToken,
#[msg("Amount must be greater than 0")]
AmountNotPositive,
#[msg("The quote deadline has not passed!")]
QuoteDeadlineNotPassed,
#[msg("New signer unchanged")]
SignerUnchanged,
#[msg("Invalid quote data length")]
InvalidQuoteDataLength,
}

// EVM decoding errors.
#[error_code]
pub enum DataDecodingError {
#[msg("Cannot decode to u32")]
CannotDecodeToU32,
#[msg("Cannot decode to u64")]
CannotDecodeToU64,
#[msg("Cannot decode to i64")]
CannotDecodeToI64,
#[msg("Cannot decode bytes")]
CannotDecodeBytes,
}
41 changes: 41 additions & 0 deletions programs/sponsored-cctp-src-periphery/src/event.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use anchor_lang::prelude::*;

#[event]
pub struct SignerSet {
pub old_signer: Pubkey,
pub new_signer: Pubkey,
}

#[event]
pub struct WithdrawnRentFund {
pub amount: u64,
pub recipient: Pubkey,
}

#[event]
pub struct SponsoredDepositForBurn {
pub quote_nonce: Vec<u8>, // Nonce is bytes32 random value, but it is more readable in logs expressed as encoded data blob.
pub origin_sender: Pubkey,
pub final_recipient: Pubkey,
pub quote_deadline: i64,
pub max_bps_to_sponsor: u64,
pub max_user_slippage_bps: u64,
pub final_token: Pubkey,
pub signature: Vec<u8>,
}

#[event]
pub struct CreatedEventAccount {
pub message_sent_event_data: Pubkey,
}

#[event]
pub struct ReclaimedEventAccount {
pub message_sent_event_data: Pubkey,
}

#[event]
pub struct ReclaimedUsedNonceAccount {
pub nonce: Vec<u8>, // Nonce is bytes32 random value, but it is more readable in logs expressed as encoded data blob.
pub used_nonce: Pubkey, // PDA derived from above nonce that got closed.
}
Loading
Loading