stellar-axelar-std-derive 2.0.0

Proc macros for Axelar contracts.
Documentation
use stellar_axelar_std::interfaces::{UpgradableInterface as _, MigratableInterface as _};
#[stellar_axelar_std::contractimpl]
impl stellar_axelar_std::interfaces::UpgradableInterface for Contract {
    #[allow_during_migration]
    fn version(env: &Env) -> stellar_axelar_std::String {
        stellar_axelar_std::String::from_str(env, env!("CARGO_PKG_VERSION"))
    }
    #[allow_during_migration]
    fn required_auths(
        env: &Env,
    ) -> stellar_axelar_std::Vec<stellar_axelar_std::Address> {
        stellar_axelar_std::interfaces::required_auths::<Self>(env)
    }
    #[allow_during_migration]
    fn upgrade(env: &Env, new_wasm_hash: stellar_axelar_std::BytesN<32>) {
        stellar_axelar_std::interfaces::upgrade::<Self>(env, new_wasm_hash);
    }
}
#[allow(non_camel_case_types)]
type __ContractMigrationData = <Contract as stellar_axelar_std::interfaces::CustomMigratableInterface>::MigrationData;
#[stellar_axelar_std::contractimpl]
impl stellar_axelar_std::interfaces::MigratableInterface for Contract {
    type Error = ContractError;
    #[allow_during_migration]
    fn migrate(
        env: &Env,
        migration_data: __ContractMigrationData,
    ) -> Result<(), ContractError> {
        stellar_axelar_std::interfaces::migrate::<Self>(env, migration_data)
            .map_err(|err| match err {
                stellar_axelar_std::interfaces::MigrationError::NotAllowed => {
                    ContractError::MigrationNotAllowed
                }
                stellar_axelar_std::interfaces::MigrationError::ExecutionFailed(err) => {
                    err.into()
                }
            })
    }
}