Skip to content

Commit 6eacf73

Browse files
committed
chore(sui): fix escrow and owned vault warnings
Signed-off-by: aeryz <[email protected]>
1 parent 8d2e0a9 commit 6eacf73

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

sui/escrow_vault/sources/escrow_vault.move

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ module escrow_vault::escrow_vault {
128128

129129
vault.fungible_counterparties.add(
130130
FungibleLane {
131-
token: type_name::get<T>().into_string().into_bytes(),
131+
token: type_name::with_defining_ids<T>().into_string().into_bytes(),
132132
path,
133133
channel,
134134
base_token
@@ -151,7 +151,7 @@ module escrow_vault::escrow_vault {
151151
assert!(hash.length() == 32, E_INVALID_PACKET_HASH);
152152

153153
let whitelist_key = IntentWhitelistKey {
154-
token: type_name::get<T>().into_string().into_bytes(),
154+
token: type_name::with_defining_ids<T>().into_string().into_bytes(),
155155
packet_hash: hash
156156
};
157157

@@ -180,7 +180,7 @@ module escrow_vault::escrow_vault {
180180
intent: bool,
181181
ctx: &mut TxContext,
182182
): (vector<u8>, u64) {
183-
if (type_name::get<T>().into_string().into_bytes() != quote_token) {
183+
if (type_name::with_defining_ids<T>().into_string().into_bytes() != quote_token) {
184184
return (vector::empty(), E_INVALID_QUOTE_TOKEN)
185185
};
186186

@@ -232,7 +232,7 @@ module escrow_vault::escrow_vault {
232232
recipient: address,
233233
ctx: &mut TxContext
234234
) {
235-
let coin: &mut Coin<T> = vault.coin_bag.borrow_mut(type_name::get<T>());
235+
let coin: &mut Coin<T> = vault.coin_bag.borrow_mut(type_name::with_defining_ids<T>());
236236
let coin = coin.split<T>(amount, ctx);
237237
transfer::public_transfer(coin, recipient);
238238
}
@@ -242,7 +242,7 @@ module escrow_vault::escrow_vault {
242242
_: &ZkgmCap,
243243
coin: Coin<T>,
244244
) {
245-
let key = type_name::get<T>();
245+
let key = type_name::with_defining_ids<T>();
246246
if (vault.coin_bag.contains(key)) {
247247
let self_coin: &mut Coin<T> = vault.coin_bag.borrow_mut(key);
248248
coin::join(self_coin, coin)

sui/owned_vault/sources/vault.move

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ module owned_vault::owned_vault {
145145
abort 0
146146
};
147147

148-
vault.token_type_to_treasury.add(type_name::get<T>().into_string().into_bytes(), TreasuryCapWithMetadata {
148+
vault.token_type_to_treasury.add(type_name::with_defining_ids<T>(), TreasuryCapWithMetadata {
149149
id: object::new(ctx),
150150
cap: capability,
151151
metadata: metadata::new(
@@ -167,14 +167,14 @@ module owned_vault::owned_vault {
167167
beneficiary: vector<u8>,
168168
ctx: &mut TxContext,
169169
) {
170-
let token = type_name::get<T>().into_string().into_bytes();
170+
let token = type_name::with_defining_ids<T>();
171171
let cap: &TreasuryCapWithMetadata<T> = vault.token_type_to_treasury.borrow(token);
172172

173173
assert!(cap.metadata.owner() == ctx.sender(), E_UNAUTHORIZED);
174174

175175
vault.fungible_counterparties.add(
176176
FungibleLane {
177-
token,
177+
token: token.into_string().into_bytes(),
178178
path,
179179
channel,
180180
base_token
@@ -191,7 +191,7 @@ module owned_vault::owned_vault {
191191
whitelist: bool,
192192
ctx: &mut TxContext,
193193
) {
194-
let token = type_name::get<T>().into_string();
194+
let token = type_name::with_defining_ids<T>();
195195
let cap: &TreasuryCapWithMetadata<T> = vault.token_type_to_treasury.borrow(token);
196196

197197
assert!(cap.metadata.owner() == ctx.sender(), E_UNAUTHORIZED);
@@ -200,7 +200,7 @@ module owned_vault::owned_vault {
200200
assert!(hash.length() == 32, E_INVALID_PACKET_HASH);
201201

202202
let whitelist_key = IntentWhitelistKey {
203-
token: token.into_bytes(),
203+
token: token.into_string().into_bytes(),
204204
packet_hash: hash
205205
};
206206

@@ -229,7 +229,7 @@ module owned_vault::owned_vault {
229229
intent: bool,
230230
ctx: &mut TxContext,
231231
): (vector<u8>, u64) {
232-
if (type_name::get<T>().into_string().into_bytes() != quote_token) {
232+
if (type_name::with_defining_ids<T>().into_string().into_bytes() != quote_token) {
233233
return (vector::empty(), E_INVALID_QUOTE_TOKEN)
234234
};
235235

@@ -283,7 +283,7 @@ module owned_vault::owned_vault {
283283
// We could just return a mutable ref to the `TreasuryCap<T>` but it's not allowed in the MoveVM to return a mutable reference
284284
// from a PTB command.
285285
public fun release_treasury_cap<T>(vault: &mut OwnedVault, ctx: &TxContext): (TreasuryCap<T>, TreasuryCapReleaseCtx<T>) {
286-
let token = type_name::get<T>().into_string().into_bytes();
286+
let token = type_name::with_defining_ids<T>();
287287
let cap: TreasuryCapWithMetadata<T> = vault.token_type_to_treasury.remove(token);
288288

289289
assert!(ctx.sender() == cap.metadata.owner(), E_UNAUTHORIZED);
@@ -305,7 +305,7 @@ module owned_vault::owned_vault {
305305
public fun give_back_treasury_cap<T>(vault: &mut OwnedVault, cap: TreasuryCap<T>, handle: TreasuryCapReleaseCtx<T>, ctx: &mut TxContext) {
306306
assert!(ctx.sender() == handle.metadata.owner(), E_UNAUTHORIZED);
307307

308-
let token = type_name::get<T>().into_string().into_bytes();
308+
let token = type_name::with_defining_ids<T>();
309309
let TreasuryCapReleaseCtx {
310310
metadata
311311
} = handle;
@@ -337,7 +337,7 @@ module owned_vault::owned_vault {
337337
public fun get_metadata<T>(
338338
vault: &OwnedVault,
339339
): &Metadata {
340-
let typename_t = type_name::get<T>().into_string().into_bytes();
340+
let typename_t = type_name::with_defining_ids<T>();
341341
let cap: &TreasuryCapWithMetadata<T> = vault.token_type_to_treasury.borrow(typename_t);
342342

343343
&cap.metadata
@@ -346,7 +346,7 @@ module owned_vault::owned_vault {
346346
fun borrow_mut_treasury_cap<T>(
347347
vault: &mut OwnedVault
348348
): &mut TreasuryCap<T> {
349-
let key = type_name::get<T>().into_string().into_bytes();
349+
let key = type_name::with_defining_ids<T>();
350350
if (!vault.token_type_to_treasury.contains(key)) {
351351
abort E_NO_TREASURY_CAPABILITY
352352
};

sui/ucs03_zkgm/sources/ibc.move

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ module zkgm::ibc {
7777
ctx: &TxContext
7878
) {
7979
ibc_store.channel_open_init(
80-
counterparty_port_id,
81-
connection_id,
82-
version,
83-
zkgm.port(),
84-
ctx
80+
counterparty_port_id, connection_id, version, zkgm.port(), ctx
8581
);
8682

8783
if (!is_valid_version(version)) {

0 commit comments

Comments
 (0)