Skip to content

Commit

Permalink
init_asset to init
Browse files Browse the repository at this point in the history
  • Loading branch information
sisuresh committed Dec 9, 2022
1 parent 6eefa05 commit 4c16ec7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion soroban-env-host/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ impl Host {
self.metered_write_xdr(&asset_preimage.asset, &mut asset_bytes)?;
self.call_n(
contract_id,
Symbol::from_str("init_asset"),
Symbol::from_str("init"),
&[self.add_host_object(asset_bytes)?.into()],
false,
)?;
Expand Down
6 changes: 3 additions & 3 deletions soroban-env-host/src/native_contract/token/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ use super::error::ContractError;
use super::public_types::{AlphaNum12Metadata, AlphaNum4Metadata};

pub trait TokenTrait {
/// init_asset can create a contract for a wrapped classic asset
/// init can create a contract for a wrapped classic asset
/// (Native, AlphaNum4, or AlphaNum12). It will fail if the contractID
/// of this contract does not match the expected contractID for this asset
/// returned by Host::get_contract_id_from_asset. This function should only be
/// called by the create_token_from_asset host function for this reason.
///
/// No admin will be set for the Native token, so any function that checks the admin
/// (burn, freeze, unfreeze, mint, set_admin) will always fail
fn init_asset(e: &Host, asset_bytes: Bytes) -> Result<(), HostError>;
fn init(e: &Host, asset_bytes: Bytes) -> Result<(), HostError>;

fn nonce(e: &Host, id: Identifier) -> Result<i128, HostError>;

Expand Down Expand Up @@ -122,7 +122,7 @@ fn check_nonnegative_amount(e: &Host, amount: i128) -> Result<(), HostError> {
#[contractimpl]
// Metering: *mostly* covered by components.
impl TokenTrait for Token {
fn init_asset(e: &Host, asset_bytes: Bytes) -> Result<(), HostError> {
fn init(e: &Host, asset_bytes: Bytes) -> Result<(), HostError> {
if has_metadata(&e)? {
return Err(e.err_status_msg(
ContractError::AlreadyInitializedError,
Expand Down

0 comments on commit 4c16ec7

Please sign in to comment.