diff --git a/soroban-sdk/src/token.rs b/soroban-sdk/src/token.rs index 2aecf68ce..c9d2bd4db 100644 --- a/soroban-sdk/src/token.rs +++ b/soroban-sdk/src/token.rs @@ -469,4 +469,23 @@ pub trait StellarAssetInterface { /// Emits an event with topics `["clawback", admin: Address, to: Address], /// data = amount: i128` fn clawback(env: Env, from: Address, amount: i128); + + /// Creates this contract asset's unlimited trustline for the provided + /// address. + /// + /// This is a no-op if the input address is a C-address, or if the + /// provided G-address already has the respective trustline. + /// + /// If the trustline is actually created, this will require authorization + /// from `addr` (i.e. `addr.require_auth` will be called). + /// + /// # Arguments + /// + /// * `addr` - The address for which a trustline will be created. + /// + /// # Panics + /// + /// Panics during trustline creation if the asset issuer does not exist, + /// or when a new trustline cannot be created. + fn trust(env: Env, addr: Address); } diff --git a/stellar-asset-spec/src/lib.rs b/stellar-asset-spec/src/lib.rs index 81247ed3c..0c48d0527 100644 --- a/stellar-asset-spec/src/lib.rs +++ b/stellar-asset-spec/src/lib.rs @@ -38,6 +38,7 @@ pub(crate) const XDR_INPUT: &[&[u8]] = &[ &soroban_sdk::token::StellarAssetFnSpec::spec_xdr_symbol(), &soroban_sdk::token::StellarAssetFnSpec::spec_xdr_transfer(), &soroban_sdk::token::StellarAssetFnSpec::spec_xdr_transfer_from(), + &soroban_sdk::token::StellarAssetFnSpec::spec_xdr_trust(), &soroban_token_sdk::events::Approve::spec_xdr(), &soroban_token_sdk::events::TransferWithAmountOnly::spec_xdr(), &soroban_token_sdk::events::Transfer::spec_xdr(), @@ -53,7 +54,7 @@ pub(crate) const XDR_INPUT: &[&[u8]] = &[ &SetAuthorized::spec_xdr(), ]; -pub(crate) const XDR_LEN: usize = 8560; +pub(crate) const XDR_LEN: usize = 9128; /// Returns the contract spec for Stellar Asset contract. pub const fn xdr() -> &'static [u8] {