Skip to content
Open
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
4 changes: 4 additions & 0 deletions chains/sui/contracts/ccip/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/*
traces/*
.trace
.coverage*
56 changes: 56 additions & 0 deletions chains/sui/contracts/ccip/Move.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# @generated by Move, please check-in and do not edit manually.

[move]
version = 3
manifest_digest = "FD5E62CCB7099A0B4B6CADEFAB8BDCFF066D52DFAC950B11C7A47C4DE4BE4E79"
deps_digest = "F9B494B64F0615AED0E98FC12A85B85ECD2BC5185C22D30E7F67786BB52E507C"
dependencies = [
{ id = "Bridge", name = "Bridge" },
{ id = "MoveStdlib", name = "MoveStdlib" },
{ id = "Sui", name = "Sui" },
{ id = "SuiSystem", name = "SuiSystem" },
]

[[move.package]]
id = "Bridge"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "d75fae3aa7fa3545b5803980a1e0c965b8bbf48e", subdir = "crates/sui-framework/packages/bridge" }

dependencies = [
{ id = "MoveStdlib", name = "MoveStdlib" },
{ id = "Sui", name = "Sui" },
{ id = "SuiSystem", name = "SuiSystem" },
]

[[move.package]]
id = "MoveStdlib"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "d75fae3aa7fa3545b5803980a1e0c965b8bbf48e", subdir = "crates/sui-framework/packages/move-stdlib" }

[[move.package]]
id = "Sui"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "d75fae3aa7fa3545b5803980a1e0c965b8bbf48e", subdir = "crates/sui-framework/packages/sui-framework" }

dependencies = [
{ id = "MoveStdlib", name = "MoveStdlib" },
]

[[move.package]]
id = "SuiSystem"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "d75fae3aa7fa3545b5803980a1e0c965b8bbf48e", subdir = "crates/sui-framework/packages/sui-system" }

dependencies = [
{ id = "MoveStdlib", name = "MoveStdlib" },
{ id = "Sui", name = "Sui" },
]

[move.toolchain-version]
compiler-version = "1.61.2"
edition = "2024.beta"
flavor = "sui"

[env]

[env.testnet]
chain-id = "4c78adac"
original-published-id = "0xe6763a05a2a7cb9250342d7420c566c6d4255920640c64c399beab47b6313e9b"
latest-published-id = "0xe6763a05a2a7cb9250342d7420c566c6d4255920640c64c399beab47b6313e9b"
published-version = "1"
33 changes: 33 additions & 0 deletions chains/sui/contracts/ccip/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
name = "ChainlinkCCIP"
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move
# license = "" # e.g., "MIT", "GPL", "Apache 2.0"
# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"]

[dependencies]

# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`.
# Revision can be a branch, a tag, and a commit hash.
# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" }

# For local dependencies use `local = path`. Path is relative to the package root
# Local = { local = "../path/to" }

# To resolve a version conflict and force a specific version for dependency
# override use `override = true`
# Override = { local = "../conflicting/version", override = true }

[addresses]
ccip = "0x0"

# Named addresses will be accessible in Move as `@name`. They're also exported:
# for example, `std = "0x1"` is exported by the Standard Library.
# alice = "0xA11CE"

[dev-dependencies]
# The dev-dependencies section allows overriding dependencies for `--test` and
# `--dev` modes. You can introduce test-only dependencies here.
# Local = { local = "../path/to/dev-build" }

[dev-addresses]
ccip = "0x3000"
42 changes: 42 additions & 0 deletions chains/sui/contracts/ccip/sources/fee_quoter.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module ccip::fee_quoter;

use sui::clock;
use sui::event;

public struct UsdPerTokenUpdated has copy, drop {
token: address,
usd_per_token: u256,
timestamp: u64,
}

public struct UsdPerUnitGasUpdated has copy, drop {
dest_chain_selector: u64,
usd_per_unit_gas: u256,
timestamp: u64,
}

public fun emit_usd_per_token_updated(clock: &clock::Clock, token: address, usd_per_token: u256) {
event::emit(UsdPerTokenUpdated {
token,
usd_per_token,
timestamp: clock.timestamp_ms(),
})
}

public fun emit_usd_per_unit_gas_updated(clock: &clock::Clock, usd_per_unit_gas: u256) {
event::emit(UsdPerUnitGasUpdated {
dest_chain_selector: 17529533435026248318,
usd_per_unit_gas,
timestamp: clock.timestamp_ms(),
})
}

public fun drill_price_registries(
clock: &clock::Clock,
token: address,
usd_per_token: u256,
usd_per_unit_gas: u256,
) {
emit_usd_per_token_updated(clock, token, usd_per_token);
emit_usd_per_unit_gas_updated(clock, usd_per_unit_gas);
}
65 changes: 65 additions & 0 deletions chains/sui/contracts/ccip/sources/state_object.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
module ccip::state_object;

use std::ascii;
use std::string::{Self, String};
use std::type_name;
use sui::address;
use sui::derived_object;
use sui::event;
use sui::object;
use sui::transfer;
use sui::vec_map::{Self, VecMap};

public fun type_and_version(): String {
string::utf8(b"StateObject 1.6.0")
}

public struct CCIPObject has key {
id: UID,
}

public struct CCIPObjectRef has key, store {
id: UID,
package_ids: vector<address>,
}

public struct CCIPObjectRefPointer has key, store {
id: UID,
ccip_object_id: address,
}

public struct STATE_OBJECT has drop {}

fun init(otw: STATE_OBJECT, ctx: &mut TxContext) {
let mut ccip_object = CCIPObject { id: object::new(ctx) };

let mut ref = CCIPObjectRef {
id: derived_object::claim(&mut ccip_object.id, b"CCIPObjectRef"),
package_ids: vector[],
};

let pointer = CCIPObjectRefPointer {
id: object::new(ctx),
ccip_object_id: object::id_address(&ccip_object),
};

let tn = type_name::with_original_ids<STATE_OBJECT>();
let package_bytes = ascii::into_bytes(tn.address_string());
let package_id = address::from_ascii_bytes(&package_bytes);
ref.package_ids.push_back(package_id);

transfer::share_object(ref);
transfer::share_object(ccip_object);

transfer::transfer(pointer, package_id);
}

public fun add_package_id(ref: &mut CCIPObjectRef, package_id: address) {
ref.package_ids.push_back(package_id);
}

public fun remove_package_id(ref: &mut CCIPObjectRef, package_id: address) {
let (found, idx) = ref.package_ids.index_of(&package_id);
assert!(found, 1);
ref.package_ids.swap_remove(idx);
}
18 changes: 18 additions & 0 deletions chains/sui/contracts/ccip/tests/ccip_tests.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
#[test_only]
module ccip::ccip_tests;
// uncomment this line to import the module
// use ccip::ccip;

const ENotImplemented: u64 = 0;

#[test]
fun test_ccip() {
// pass
}

#[test, expected_failure(abort_code = ::ccip::ccip_tests::ENotImplemented)]
fun test_ccip_fail() {
abort ENotImplemented
}
*/
4 changes: 4 additions & 0 deletions chains/sui/contracts/ccip_offramp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/*
traces/*
.trace
.coverage*
68 changes: 68 additions & 0 deletions chains/sui/contracts/ccip_offramp/Move.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# @generated by Move, please check-in and do not edit manually.

[move]
version = 3
manifest_digest = "29F173AA58C24C5E12AF017CDB866784A6A8EF5F39E0064C4BF85F6CA0AD0D0F"
deps_digest = "397E6A9F7A624706DBDFEE056CE88391A15876868FD18A88504DA74EB458D697"
dependencies = [
{ id = "Bridge", name = "Bridge" },
{ id = "ChainlinkCCIP", name = "ChainlinkCCIP" },
{ id = "MoveStdlib", name = "MoveStdlib" },
{ id = "Sui", name = "Sui" },
{ id = "SuiSystem", name = "SuiSystem" },
]

[[move.package]]
id = "Bridge"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "c1f1ae650fb9f9248b39a569400b4420820868db", subdir = "crates/sui-framework/packages/bridge" }

dependencies = [
{ id = "MoveStdlib", name = "MoveStdlib" },
{ id = "Sui", name = "Sui" },
{ id = "SuiSystem", name = "SuiSystem" },
]

[[move.package]]
id = "ChainlinkCCIP"
source = { local = "../ccip" }

dependencies = [
{ id = "Bridge", name = "Bridge" },
{ id = "MoveStdlib", name = "MoveStdlib" },
{ id = "Sui", name = "Sui" },
{ id = "SuiSystem", name = "SuiSystem" },
]

[[move.package]]
id = "MoveStdlib"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "c1f1ae650fb9f9248b39a569400b4420820868db", subdir = "crates/sui-framework/packages/move-stdlib" }

[[move.package]]
id = "Sui"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "c1f1ae650fb9f9248b39a569400b4420820868db", subdir = "crates/sui-framework/packages/sui-framework" }

dependencies = [
{ id = "MoveStdlib", name = "MoveStdlib" },
]

[[move.package]]
id = "SuiSystem"
source = { git = "https://github.com/MystenLabs/sui.git", rev = "c1f1ae650fb9f9248b39a569400b4420820868db", subdir = "crates/sui-framework/packages/sui-system" }

dependencies = [
{ id = "MoveStdlib", name = "MoveStdlib" },
{ id = "Sui", name = "Sui" },
]

[move.toolchain-version]
compiler-version = "1.61.2"
edition = "2024.beta"
flavor = "sui"

[env]

[env.testnet]
chain-id = "4c78adac"
original-published-id = "0x867da368e81618e8ee282085675f06e357caa52faf9421e6ba6a29438615d6cf"
latest-published-id = "0x867da368e81618e8ee282085675f06e357caa52faf9421e6ba6a29438615d6cf"
published-version = "1"
16 changes: 16 additions & 0 deletions chains/sui/contracts/ccip_offramp/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "CCIP_OFFRAMP"
edition = "2024.beta"

[dependencies]
ChainlinkCCIP = { local = "../ccip" }

[addresses]
ccip_offramp = "0x0"
ccip = "0xe6763a05a2a7cb9250342d7420c566c6d4255920640c64c399beab47b6313e9b"
router = "0x0d1cefe6e43cc96cbb6b2e7aa261b8be05cbf926a8f83431e1bd6023250b522c"
onramp = "0xefd74f2ab89903cd0a6783af2937c8cb932812a41590d7842d632dd9770b3e68"

[dev-addresses]
ccip_offramp = "0x1000"
ccip = "0x3000"
25 changes: 25 additions & 0 deletions chains/sui/contracts/ccip_offramp/sources/ocr3_base.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module ccip_offramp::ocr3_base;

use sui::event;

public struct ConfigSet has copy, drop {
ocr_plugin_type: u8,
config_digest: vector<u8>,
signers: vector<vector<u8>>,
transmitters: vector<address>,
big_f: u8,
}

public fun emit_config_set() {
event::emit(ConfigSet {
ocr_plugin_type: 1,
config_digest: vector[],
signers: vector[],
transmitters: vector[
@0x7f8e09ea5a9d6e72854af8d6fa3e4d6f5466d9c11b498e0d9d4f64d8cabe8d32,
@0xc8cc7f57a25e6e96e6be7bcd606a1a8d59d85d757d08e7e045e87a8cfe0bcbc7,
@0x5,
],
big_f: 2,
});
}
Loading
Loading