Skip to content

Commit d7be754

Browse files
authored
Add sdk support for SAC trust() (#1824)
### What Add support for CAP-0073
1 parent d5b6d67 commit d7be754

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

soroban-sdk/src/token.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,23 @@ pub trait StellarAssetInterface {
469469
/// Emits an event with topics `["clawback", admin: Address, to: Address],
470470
/// data = amount: i128`
471471
fn clawback(env: Env, from: Address, amount: i128);
472+
473+
/// Creates this contract asset's unlimited trustline for the provided
474+
/// address.
475+
///
476+
/// This is a no-op if the input address is a C-address, or if the
477+
/// provided G-address already has the respective trustline.
478+
///
479+
/// If the trustline is actually created, this will require authorization
480+
/// from `addr` (i.e. `addr.require_auth` will be called).
481+
///
482+
/// # Arguments
483+
///
484+
/// * `addr` - The address for which a trustline will be created.
485+
///
486+
/// # Panics
487+
///
488+
/// Panics during trustline creation if the asset issuer does not exist,
489+
/// or when a new trustline cannot be created.
490+
fn trust(env: Env, addr: Address);
472491
}

stellar-asset-spec/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub(crate) const XDR_INPUT: &[&[u8]] = &[
3838
&soroban_sdk::token::StellarAssetFnSpec::spec_xdr_symbol(),
3939
&soroban_sdk::token::StellarAssetFnSpec::spec_xdr_transfer(),
4040
&soroban_sdk::token::StellarAssetFnSpec::spec_xdr_transfer_from(),
41+
&soroban_sdk::token::StellarAssetFnSpec::spec_xdr_trust(),
4142
&soroban_token_sdk::events::Approve::spec_xdr(),
4243
&soroban_token_sdk::events::TransferWithAmountOnly::spec_xdr(),
4344
&soroban_token_sdk::events::Transfer::spec_xdr(),
@@ -53,7 +54,7 @@ pub(crate) const XDR_INPUT: &[&[u8]] = &[
5354
&SetAuthorized::spec_xdr(),
5455
];
5556

56-
pub(crate) const XDR_LEN: usize = 8560;
57+
pub(crate) const XDR_LEN: usize = 9128;
5758

5859
/// Returns the contract spec for Stellar Asset contract.
5960
pub const fn xdr() -> &'static [u8] {

0 commit comments

Comments
 (0)