Skip to content

Commit 293ae9c

Browse files
committed
rebase
2 parents 14f5c49 + 5d4726d commit 293ae9c

File tree

17 files changed

+42
-727
lines changed

17 files changed

+42
-727
lines changed

bindings/generated/ccip/ccip_token_pools/burn_mint_token_pool/burn_mint_token_pool.go

Lines changed: 1 addition & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/generated/ccip/ccip_token_pools/lock_release_token_pool/lock_release_token_pool.go

Lines changed: 1 addition & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/generated/ccip/ccip_token_pools/managed_token_pool/managed_token_pool.go

Lines changed: 1 addition & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ccip/ccip_token_pools/burn_mint_token_pool/sources/burn_mint_token_pool.move

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ use burn_mint_token_pool::token_pool::{Self, TokenPoolState};
99
use ccip::eth_abi;
1010
use ccip::offramp_state_helper as offramp_sh;
1111
use ccip::onramp_state_helper as onramp_sh;
12-
use ccip::state_object::{Self, CCIPObjectRef};
12+
use ccip::state_object::CCIPObjectRef;
1313
use ccip::token_admin_registry;
1414
use mcms::bcs_stream;
1515
use mcms::mcms_deployer::{Self, DeployerState};
1616
use mcms::mcms_registry::{Self, Registry, ExecutingCallbackParams};
1717
use std::string::{Self, String};
18-
use std::type_name::{Self, TypeName};
19-
use sui::address;
2018
use sui::clock::Clock;
2119
use sui::coin::{Self, Coin, CoinMetadata, TreasuryCap};
2220
use sui::package::UpgradeCap;
@@ -51,7 +49,7 @@ public fun initialize<T>(
5149
token_pool_administrator: address,
5250
ctx: &mut TxContext,
5351
) {
54-
let (_, _, _, burn_mint_token_pool) = initialize_internal(
52+
let burn_mint_token_pool = initialize_internal(
5553
coin_metadata,
5654
treasury_cap,
5755
ctx,
@@ -70,49 +68,12 @@ public fun initialize<T>(
7068
transfer::share_object(burn_mint_token_pool);
7169
}
7270

73-
public fun initialize_by_ccip_admin<T>(
74-
ref: &mut CCIPObjectRef,
75-
ccip_admin_proof: state_object::CCIPAdminProof,
76-
coin_metadata: &CoinMetadata<T>,
77-
treasury_cap: TreasuryCap<T>,
78-
token_pool_administrator: address,
79-
ctx: &mut TxContext,
80-
) {
81-
let (
82-
coin_metadata_address,
83-
type_proof_type_name,
84-
token_type,
85-
burn_mint_token_pool,
86-
) = initialize_internal(coin_metadata, treasury_cap, ctx);
87-
88-
let type_proof_type_name_address = type_proof_type_name.address_string();
89-
let burn_mint_token_pool_package_id = address::from_ascii_bytes(
90-
&type_proof_type_name_address.into_bytes(),
91-
);
92-
93-
token_admin_registry::register_pool_by_admin(
94-
ref,
95-
ccip_admin_proof,
96-
coin_metadata_address,
97-
burn_mint_token_pool_package_id,
98-
string::utf8(b"burn_mint_token_pool"),
99-
token_type.into_string(),
100-
token_pool_administrator,
101-
type_proof_type_name.into_string(),
102-
vector[CLOCK_ADDRESS, object::uid_to_address(&burn_mint_token_pool.id)],
103-
vector[CLOCK_ADDRESS, object::uid_to_address(&burn_mint_token_pool.id)],
104-
ctx,
105-
);
106-
107-
transfer::share_object(burn_mint_token_pool);
108-
}
109-
11071
#[allow(lint(self_transfer))]
11172
fun initialize_internal<T>(
11273
coin_metadata: &CoinMetadata<T>,
11374
treasury_cap: TreasuryCap<T>,
11475
ctx: &mut TxContext,
115-
): (address, TypeName, TypeName, BurnMintTokenPoolState<T>) {
76+
): BurnMintTokenPoolState<T> {
11677
let coin_metadata_address: address = object::id_to_address(&object::id(coin_metadata));
11778
let (ownable_state, owner_cap) = ownable::new(ctx);
11879

@@ -127,12 +88,10 @@ fun initialize_internal<T>(
12788
treasury_cap,
12889
ownable_state,
12990
};
130-
let type_proof_type_name = type_name::with_defining_ids<TypeProof>();
131-
let token_type = type_name::with_defining_ids<T>();
13291

13392
transfer::public_transfer(owner_cap, ctx.sender());
13493

135-
(coin_metadata_address, type_proof_type_name, token_type, burn_mint_token_pool)
94+
burn_mint_token_pool
13695
}
13796

13897
public fun set_pool<T>(

contracts/ccip/ccip_token_pools/burn_mint_token_pool/tests/burn_mint_token_pool_ownable_test.move

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ fun setup(): (TestEnv, OwnerCap) {
5050
scenario.ctx(),
5151
);
5252

53-
burn_mint_token_pool::initialize_by_ccip_admin(
53+
burn_mint_token_pool::initialize(
5454
&mut ccip_ref,
55-
state_object::create_ccip_admin_proof_for_test(),
5655
&coin_metadata,
5756
treasury_cap,
5857
@0x123,

contracts/ccip/ccip_token_pools/burn_mint_token_pool/tests/burn_mint_token_pool_tests.move

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ public fun test_initialize_and_basic_functionality() {
8282
);
8383

8484
// Initialize burn mint token pool
85-
burn_mint_token_pool::initialize_by_ccip_admin(
85+
burn_mint_token_pool::initialize(
8686
&mut ccip_ref,
87-
state_object::create_ccip_admin_proof_for_test(),
8887
&coin_metadata,
8988
treasury_cap,
9089
@0x123, // token_pool_administrator
@@ -146,9 +145,8 @@ public fun test_chain_configuration_management() {
146145
ctx,
147146
);
148147

149-
burn_mint_token_pool::initialize_by_ccip_admin(
148+
burn_mint_token_pool::initialize(
150149
&mut ccip_ref,
151-
state_object::create_ccip_admin_proof_for_test(),
152150
&coin_metadata,
153151
treasury_cap,
154152
@0x123,
@@ -262,9 +260,8 @@ public fun test_allowlist_management() {
262260
ctx,
263261
);
264262

265-
burn_mint_token_pool::initialize_by_ccip_admin(
263+
burn_mint_token_pool::initialize(
266264
&mut ccip_ref,
267-
state_object::create_ccip_admin_proof_for_test(),
268265
&coin_metadata,
269266
treasury_cap,
270267
@0x123,
@@ -320,9 +317,8 @@ public fun test_rate_limiter_configuration() {
320317
ctx,
321318
);
322319

323-
burn_mint_token_pool::initialize_by_ccip_admin(
320+
burn_mint_token_pool::initialize(
324321
&mut ccip_ref,
325-
state_object::create_ccip_admin_proof_for_test(),
326322
&coin_metadata,
327323
treasury_cap,
328324
@0x123,
@@ -423,9 +419,8 @@ public fun test_invalid_arguments_rate_limiter_configs() {
423419
ctx,
424420
);
425421

426-
burn_mint_token_pool::initialize_by_ccip_admin(
422+
burn_mint_token_pool::initialize(
427423
&mut ccip_ref,
428-
state_object::create_ccip_admin_proof_for_test(),
429424
&coin_metadata,
430425
treasury_cap,
431426
@0x123,
@@ -487,9 +482,8 @@ public fun test_comprehensive_allowlist_operations() {
487482
ctx,
488483
);
489484

490-
burn_mint_token_pool::initialize_by_ccip_admin(
485+
burn_mint_token_pool::initialize(
491486
&mut ccip_ref,
492-
state_object::create_ccip_admin_proof_for_test(),
493487
&coin_metadata,
494488
treasury_cap,
495489
@0x123,
@@ -548,9 +542,8 @@ public fun test_destroy_token_pool() {
548542
ctx,
549543
);
550544

551-
burn_mint_token_pool::initialize_by_ccip_admin(
545+
burn_mint_token_pool::initialize(
552546
&mut ccip_ref,
553-
state_object::create_ccip_admin_proof_for_test(),
554547
&coin_metadata,
555548
treasury_cap,
556549
@burn_mint_token_pool,
@@ -611,9 +604,8 @@ public fun test_comprehensive_rate_limiter_operations() {
611604
ctx,
612605
);
613606

614-
burn_mint_token_pool::initialize_by_ccip_admin(
607+
burn_mint_token_pool::initialize(
615608
&mut ccip_ref,
616-
state_object::create_ccip_admin_proof_for_test(),
617609
&coin_metadata,
618610
treasury_cap,
619611
@0x123,
@@ -713,9 +705,8 @@ public fun test_edge_cases_and_boundary_conditions() {
713705
ctx,
714706
);
715707

716-
burn_mint_token_pool::initialize_by_ccip_admin(
708+
burn_mint_token_pool::initialize(
717709
&mut ccip_ref,
718-
state_object::create_ccip_admin_proof_for_test(),
719710
&coin_metadata,
720711
treasury_cap,
721712
@0x123,
@@ -851,9 +842,8 @@ public fun test_lock_or_burn_comprehensive() {
851842
let test_coin = coin::mint(&mut treasury_cap, 1000, ctx); // Small amount to stay within rate limiter
852843
transfer::public_transfer(test_coin, @0x456); // Transfer to test user
853844

854-
burn_mint_token_pool::initialize_by_ccip_admin(
845+
burn_mint_token_pool::initialize(
855846
&mut ccip_ref,
856-
state_object::create_ccip_admin_proof_for_test(),
857847
&coin_metadata,
858848
treasury_cap, // treasury_cap is moved here
859849
@0x123,
@@ -997,9 +987,8 @@ public fun test_release_or_mint_comprehensive() {
997987

998988
let coin_metadata_address = object::id_to_address(&object::id(&coin_metadata));
999989

1000-
burn_mint_token_pool::initialize_by_ccip_admin(
990+
burn_mint_token_pool::initialize(
1001991
&mut ccip_ref,
1002-
state_object::create_ccip_admin_proof_for_test(),
1003992
&coin_metadata,
1004993
treasury_cap,
1005994
@0x123,
@@ -1139,9 +1128,8 @@ public fun test_set_allowlist_enabled() {
11391128
ctx,
11401129
);
11411130

1142-
burn_mint_token_pool::initialize_by_ccip_admin(
1131+
burn_mint_token_pool::initialize(
11431132
&mut ccip_ref,
1144-
state_object::create_ccip_admin_proof_for_test(),
11451133
&coin_metadata,
11461134
treasury_cap,
11471135
@0x123,
@@ -1203,9 +1191,8 @@ public fun test_apply_allowlist_updates() {
12031191
ctx,
12041192
);
12051193

1206-
burn_mint_token_pool::initialize_by_ccip_admin(
1194+
burn_mint_token_pool::initialize(
12071195
&mut ccip_ref,
1208-
state_object::create_ccip_admin_proof_for_test(),
12091196
&coin_metadata,
12101197
treasury_cap,
12111198
@0x123,
@@ -1308,9 +1295,8 @@ public fun test_set_pool() {
13081295
let coin_metadata_address = object::id_to_address(&object::id(&coin_metadata));
13091296

13101297
// Initialize normally with burn_mint_token_pool
1311-
burn_mint_token_pool::initialize_by_ccip_admin(
1298+
burn_mint_token_pool::initialize(
13121299
&mut ccip_ref,
1313-
state_object::create_ccip_admin_proof_for_test(),
13141300
&coin_metadata,
13151301
treasury_cap,
13161302
@0x123,
@@ -1524,9 +1510,8 @@ public fun test_allowlist_enabled_and_updates_comprehensive() {
15241510
ctx,
15251511
);
15261512

1527-
burn_mint_token_pool::initialize_by_ccip_admin(
1513+
burn_mint_token_pool::initialize(
15281514
&mut ccip_ref,
1529-
state_object::create_ccip_admin_proof_for_test(),
15301515
&coin_metadata,
15311516
treasury_cap,
15321517
@0x123,

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

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ module lock_release_token_pool::lock_release_token_pool;
33
use ccip::eth_abi;
44
use ccip::offramp_state_helper as offramp_sh;
55
use ccip::onramp_state_helper as onramp_sh;
6-
use ccip::state_object::{Self, CCIPObjectRef};
6+
use ccip::state_object::CCIPObjectRef;
77
use ccip::token_admin_registry;
88
use lock_release_token_pool::ownable::{Self, OwnerCap, OwnableState};
99
use lock_release_token_pool::token_pool::{Self, TokenPoolState};
1010
use mcms::bcs_stream;
1111
use mcms::mcms_deployer::{Self, DeployerState};
1212
use mcms::mcms_registry::{Self, Registry, ExecutingCallbackParams};
1313
use std::string::{Self, String};
14-
use std::type_name::{Self, TypeName};
15-
use sui::address;
1614
use sui::clock::Clock;
1715
use sui::coin::{Self, Coin, CoinMetadata, TreasuryCap};
1816
use sui::package::UpgradeCap;
@@ -55,7 +53,7 @@ public fun initialize<T>(
5553
rebalancer: address,
5654
ctx: &mut TxContext,
5755
) {
58-
let (_, lock_release_token_pool_state_address, _, _) = initialize_internal(
56+
let lock_release_token_pool_state_address = initialize_internal(
5957
coin_metadata,
6058
rebalancer,
6159
ctx,
@@ -72,50 +70,12 @@ public fun initialize<T>(
7270
);
7371
}
7472

75-
/// this is used by the ccip admin to initialize the token pool
76-
/// it verifies that the tx signer is the CCIP admin
77-
/// it does not require a treasury cap object
78-
public fun initialize_by_ccip_admin<T>(
79-
ref: &mut CCIPObjectRef,
80-
ccip_admin_proof: state_object::CCIPAdminProof,
81-
coin_metadata: &CoinMetadata<T>,
82-
token_pool_administrator: address,
83-
rebalancer: address,
84-
ctx: &mut TxContext,
85-
) {
86-
let (
87-
coin_metadata_address,
88-
lock_release_token_pool_state_address,
89-
token_type,
90-
type_proof_type_name,
91-
) = initialize_internal(coin_metadata, rebalancer, ctx);
92-
93-
let type_proof_type_name_address = type_proof_type_name.address_string();
94-
let lock_release_token_pool_package_id = address::from_ascii_bytes(
95-
&type_proof_type_name_address.into_bytes(),
96-
);
97-
98-
token_admin_registry::register_pool_by_admin(
99-
ref,
100-
ccip_admin_proof,
101-
coin_metadata_address,
102-
lock_release_token_pool_package_id,
103-
string::utf8(b"lock_release_token_pool"),
104-
token_type.into_string(),
105-
token_pool_administrator,
106-
type_proof_type_name.into_string(),
107-
vector[CLOCK_ADDRESS, lock_release_token_pool_state_address],
108-
vector[CLOCK_ADDRESS, lock_release_token_pool_state_address],
109-
ctx,
110-
);
111-
}
112-
11373
#[allow(lint(self_transfer))]
11474
fun initialize_internal<T>(
11575
coin_metadata: &CoinMetadata<T>,
11676
rebalancer: address,
11777
ctx: &mut TxContext,
118-
): (address, address, TypeName, TypeName) {
78+
): address {
11979
let coin_metadata_address: address = object::id_to_address(&object::id(coin_metadata));
12080
let (ownable_state, owner_cap) = ownable::new(ctx);
12181

@@ -135,15 +95,13 @@ fun initialize_internal<T>(
13595
rebalancer_cap_id: object::id(&rebalancer_cap),
13696
ownable_state,
13797
};
138-
let type_proof_type_name = type_name::with_defining_ids<TypeProof>();
139-
let token_type = type_name::with_defining_ids<T>();
14098
let token_pool_state_address = object::uid_to_address(&lock_release_token_pool.id);
14199

142100
transfer::share_object(lock_release_token_pool);
143101
transfer::public_transfer(owner_cap, ctx.sender());
144102
transfer::public_transfer(rebalancer_cap, rebalancer);
145103

146-
(coin_metadata_address, token_pool_state_address, token_type, type_proof_type_name)
104+
token_pool_state_address
147105
}
148106

149107
public fun set_pool<T>(

contracts/ccip/ccip_token_pools/lock_release_token_pool/tests/lock_release_token_pool_tests.move

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,10 +1086,10 @@ public fun test_lock_or_burn_functionality() {
10861086
ctx,
10871087
);
10881088

1089-
lock_release_token_pool::initialize_by_ccip_admin(
1089+
lock_release_token_pool::initialize(
10901090
&mut ccip_ref,
1091-
state_object::create_ccip_admin_proof_for_test(),
10921091
&coin_metadata,
1092+
&treasury_cap,
10931093
TOKEN_ADMIN,
10941094
REBALANCER,
10951095
ctx,
@@ -1266,10 +1266,10 @@ public fun test_release_or_mint_functionality() {
12661266

12671267
let _coin_metadata_address = object::id_to_address(&object::id(&coin_metadata));
12681268

1269-
lock_release_token_pool::initialize_by_ccip_admin(
1269+
lock_release_token_pool::initialize(
12701270
&mut ccip_ref,
1271-
state_object::create_ccip_admin_proof_for_test(),
12721271
&coin_metadata,
1272+
&treasury_cap,
12731273
TOKEN_ADMIN,
12741274
REBALANCER,
12751275
ctx,

0 commit comments

Comments
 (0)