Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit b655abd

Browse files
imp: add comments for create_token
1 parent 4a42433 commit b655abd

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

modules/sov-ibc-transfer/src/context.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,17 @@ impl<'ws, S: Spec> IbcTransferContext<'ws, S> {
8686
})
8787
}
8888

89+
/// Creates a new token with the specified `token_name` and mints an initial
90+
/// balance to the `minter_address`.
91+
///
92+
/// Note: The mint authority must be held by the `IbcTransfer` module, so the
93+
/// `authorized_minters` is set to the `IbcTransfer` address. Also, remember
94+
/// that the `token_name` is a denom prefixed with IBC and originates from the
95+
/// counterparty chain.
8996
fn create_token(
9097
&self,
9198
token_name: String,
9299
minter_address: S::Address,
93-
authorized_minters: Vec<S::Address>,
94100
) -> Result<TokenId, TokenTransferError> {
95101
// Using a different salt will result in a different token
96102
// address. Since ICS-20 tokens coming from other chains are
@@ -115,7 +121,7 @@ impl<'ws, S: Spec> IbcTransferContext<'ws, S> {
115121
salt,
116122
initial_balance,
117123
minter_address,
118-
authorized_minters,
124+
vec![self.ibc_transfer.address.clone()],
119125
&context,
120126
&mut self.working_set.borrow_mut(),
121127
)
@@ -383,11 +389,7 @@ impl<'ws, S: Spec> TokenTransferExecutionContext for IbcTransferContext<'ws, S>
383389

384390
match maybe_token_id {
385391
Some(token_id) => token_id,
386-
None => self.create_token(
387-
token_name,
388-
account.address.clone(),
389-
vec![self.ibc_transfer.address.clone()],
390-
)?,
392+
None => self.create_token(token_name, account.address.clone())?,
391393
}
392394
};
393395

0 commit comments

Comments
 (0)