#Can you deploy an SAC from another contract?
1 messages · Page 1 of 1 (latest)
Theres a way with token i think
Yeah its deployer.with_stellar_asset
/// corresponding to the provided serialized asset.
///
/// `serialized_asset` is the Stellar `Asset` XDR serialized to bytes. Refer
/// to `[soroban_sdk::xdr::Asset]`
pub fn with_stellar_asset(
&self,
serialized_asset: impl IntoVal<Env, Bytes>,
) -> DeployerWithAsset {
DeployerWithAsset {
env: self.env.clone(),
serialized_asset: serialized_asset.into_val(&self.env),
}
}```
U gotta build the asset xdr into the byte array
Then pass that in.
Ive found it easiest to calculate that part off chain but u could do it in the contract with a little effort
Thank you!
Btw
It returns a deployerWithAsset
after u make the deployer itd just be deployer.deploy() since u dont need a wasm hash there.
Heres the sdk code for ref
https://github.com/stellar/rs-soroban-sdk/blob/d40bd031c14fbd3d75cf4473486ef7ef15af3364/soroban-sdk/src/deploy.rs#L239