Skip to content

Commit 1400674

Browse files
add usdc token pool support (#28)
* add an upgrade registry and tests * update ccip tests * update ccip package * regen * no op * revert tar tests * add tar tests * fix token pool tests * fix token pool tests 2 * offramp & onramp * fix ops tests * fix ccip onramp tests * update package id management functions * fix tests * update tests * add usdc token pool support --------- Co-authored-by: Faisal <[email protected]>
1 parent fe09230 commit 1400674

File tree

13 files changed

+4578
-15
lines changed

13 files changed

+4578
-15
lines changed

bindings/bind/compile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func CompilePackage(packageName contracts.Package, namedAddresses map[string]str
110110
}
111111

112112
// Special-case: update published-at of CCIP, CCIP Token Pool, & MCMs if it's a token pool package
113-
if packageName == contracts.LockReleaseTokenPool || packageName == contracts.BurnMintTokenPool || packageName == contracts.ManagedTokenPool {
113+
if packageName == contracts.LockReleaseTokenPool || packageName == contracts.BurnMintTokenPool || packageName == contracts.ManagedTokenPool || packageName == contracts.USDCTokenPool {
114114
if err = updatePublishedAt(dstRoot, contracts.CCIP, namedAddresses["ccip"]); err != nil {
115115
return PackageArtifact{}, fmt.Errorf("updating CCIP published-at: %w", err)
116116
}

bindings/generated/ccip/ccip_token_pools/usdc_token_pool/usdc_token_pool.go

Lines changed: 2858 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package usdctokenpool
2+
3+
import (
4+
"context"
5+
6+
"github.com/block-vision/sui-go-sdk/models"
7+
"github.com/block-vision/sui-go-sdk/sui"
8+
9+
"github.com/smartcontractkit/chainlink-sui/bindings/bind"
10+
module_usdc_token_pool "github.com/smartcontractkit/chainlink-sui/bindings/generated/ccip/ccip_token_pools/usdc_token_pool"
11+
"github.com/smartcontractkit/chainlink-sui/contracts"
12+
)
13+
14+
type USDCTokenPool interface {
15+
Address() string
16+
}
17+
18+
var _ USDCTokenPool = CCIPUSDCTokenPoolPackage{}
19+
20+
type CCIPUSDCTokenPoolPackage struct {
21+
address string
22+
23+
usdcTokenPool module_usdc_token_pool.IUsdcTokenPool
24+
}
25+
26+
func (p CCIPUSDCTokenPoolPackage) Address() string {
27+
return p.address
28+
}
29+
30+
func NewCCIPUSDCTokenPool(address string, client sui.ISuiAPI) (USDCTokenPool, error) {
31+
usdcTokenPoolContract, err := module_usdc_token_pool.NewUsdcTokenPool(address, client)
32+
if err != nil {
33+
return nil, err
34+
}
35+
36+
packageId, err := bind.ToSuiAddress(address)
37+
if err != nil {
38+
return nil, err
39+
}
40+
41+
return CCIPUSDCTokenPoolPackage{
42+
address: packageId,
43+
usdcTokenPool: usdcTokenPoolContract,
44+
}, nil
45+
}
46+
47+
func PublishCCIPUSDCTokenPool(
48+
ctx context.Context,
49+
opts *bind.CallOpts,
50+
client sui.ISuiAPI,
51+
ccipAddress,
52+
ccipTokenPoolAddress,
53+
usdcCoinMetadataObjectId,
54+
tokenMessengerMinterPackageId,
55+
tokenMessengerMinterStateObjectId,
56+
messageTransmitterPackageId,
57+
messageTransmitterStateObjectId,
58+
treasuryObjectId,
59+
mcmsAddress,
60+
mcmsOwnerAddress string) (USDCTokenPool, *models.SuiTransactionBlockResponse, error) {
61+
artifact, err := bind.CompilePackage(contracts.USDCTokenPool, map[string]string{
62+
"ccip": ccipAddress,
63+
"ccip_token_pool": ccipTokenPoolAddress,
64+
"usdc_token_pool": "0x0",
65+
"usdc_coin_metadata_object_id": usdcCoinMetadataObjectId,
66+
"token_messenger_minter_package_id": tokenMessengerMinterPackageId,
67+
"token_messenger_minter_state": tokenMessengerMinterStateObjectId,
68+
"message_transmitter_package_id": messageTransmitterPackageId,
69+
"message_transmitter_state": messageTransmitterStateObjectId,
70+
"treasury": treasuryObjectId,
71+
"mcms": mcmsAddress,
72+
"mcms_owner": mcmsOwnerAddress,
73+
})
74+
if err != nil {
75+
return nil, nil, err
76+
}
77+
78+
packageId, tx, err := bind.PublishPackage(ctx, opts, client, bind.PublishRequest{
79+
CompiledModules: artifact.Modules,
80+
Dependencies: artifact.Dependencies,
81+
})
82+
if err != nil {
83+
return nil, nil, err
84+
}
85+
86+
contract, err := NewCCIPUSDCTokenPool(packageId, client)
87+
if err != nil {
88+
return nil, nil, err
89+
}
90+
91+
return contract, tx, nil
92+
}

contracts/ccip/ccip_token_pools/lock_release_token_pool/sources/lock_release_token_pool.move

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public fun apply_allowlist_updates<T>(
269269
}
270270

271271
// ================================================================
272-
// | Burn/Mint |
272+
// | Lock/Release |
273273
// ================================================================
274274

275275
public struct TypeProof has drop {}

contracts/ccip/ccip_token_pools/token_pool/Move.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ dependencies = [
6767
]
6868

6969
[move.toolchain-version]
70-
compiler-version = "1.54.1"
70+
compiler-version = "1.55.0"
7171
edition = "2024"
7272
flavor = "sui"
7373

contracts/ccip/ccip_token_pools/usdc_token_pool/Move.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[move]
44
version = 3
5-
manifest_digest = "669F3ACC63A42576A333870BA7792FD60B5BB1FAB356C76C52FFF5146F2663BF"
5+
manifest_digest = "C76DD278314FF86495A48BE1F4FAEFF047E2F74F164BF4D62B863535EEEB82C8"
66
deps_digest = "CAFAD8A7CF51067FB4358215BECB86BD100DD64E57C2AC8A7AE7D74B688F5965"
77
dependencies = [
88
{ id = "Bridge", name = "Bridge" },
@@ -16,7 +16,7 @@ dependencies = [
1616

1717
[[move.package]]
1818
id = "Bridge"
19-
source = { git = "https://github.com/MystenLabs/sui.git", rev = "209f0da8e316", subdir = "crates/sui-framework/packages/bridge" }
19+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "2cde80b5766b0bc2073908e10f6e3c81c93fd691", subdir = "crates/sui-framework/packages/bridge" }
2020

2121
dependencies = [
2222
{ id = "MoveStdlib", name = "MoveStdlib" },
@@ -73,19 +73,19 @@ dependencies = [
7373

7474
[[move.package]]
7575
id = "MoveStdlib"
76-
source = { git = "https://github.com/MystenLabs/sui.git", rev = "209f0da8e316", subdir = "crates/sui-framework/packages/move-stdlib" }
76+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "2cde80b5766b0bc2073908e10f6e3c81c93fd691", subdir = "crates/sui-framework/packages/move-stdlib" }
7777

7878
[[move.package]]
7979
id = "Sui"
80-
source = { git = "https://github.com/MystenLabs/sui.git", rev = "209f0da8e316", subdir = "crates/sui-framework/packages/sui-framework" }
80+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "2cde80b5766b0bc2073908e10f6e3c81c93fd691", subdir = "crates/sui-framework/packages/sui-framework" }
8181

8282
dependencies = [
8383
{ id = "MoveStdlib", name = "MoveStdlib" },
8484
]
8585

8686
[[move.package]]
8787
id = "SuiSystem"
88-
source = { git = "https://github.com/MystenLabs/sui.git", rev = "209f0da8e316", subdir = "crates/sui-framework/packages/sui-system" }
88+
source = { git = "https://github.com/MystenLabs/sui.git", rev = "2cde80b5766b0bc2073908e10f6e3c81c93fd691", subdir = "crates/sui-framework/packages/sui-system" }
8989

9090
dependencies = [
9191
{ id = "MoveStdlib", name = "MoveStdlib" },
@@ -130,6 +130,6 @@ dependencies = [
130130
]
131131

132132
[move.toolchain-version]
133-
compiler-version = "1.54.1"
133+
compiler-version = "1.55.0"
134134
edition = "2024"
135135
flavor = "sui"

contracts/ccip/ccip_token_pools/usdc_token_pool/Move.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@ TokenMessengerMinter = { local = "../../../vendored/circlefin/sui-cctp/packages/
1313
ccip = "_"
1414
ccip_token_pool = "_"
1515
usdc_token_pool = "_"
16-
usdc_local_token = "_"
16+
usdc_coin_metadata_object_id = "_"
1717
token_messenger_minter = "_"
18+
token_messenger_minter_state = "_"
1819
message_transmitter = "_"
20+
message_transmitter_state = "_"
21+
treasury = "_"
1922
mcms = "_"
2023
mcms_owner = "_"
2124

2225
[dev-addresses]
2326
ccip = "0x1000"
2427
ccip_token_pool = "0x2000"
2528
usdc_token_pool = "0x2003"
26-
usdc_local_token = "0x9000"
29+
usdc_coin_metadata_object_id = "0x9000"
2730
token_messenger_minter = "0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb"
31+
token_messenger_minter_state = "0x5252abd1137094ed1db3e0d75bc36abcd287aee4bc310f8e047727ef5682e7c2"
2832
message_transmitter = "0x4931e06dce648b3931f890035bd196920770e913e43e45990b383f6486fdd0a5"
33+
message_transmitter_state = "0x98234bd0fa9ac12cc0a20a144a22e36d6a32f7e0a97baaeaf9c76cdc6d122d2e"
34+
treasury = "0x7170137d4a6431bf83351ac025baf462909bffe2877d87716374fb42b9629ebe"
2935
mcms = "0x4000"
3036
mcms_owner = "0x4010"

0 commit comments

Comments
 (0)