contract.test.ts.md•4.88 kB
# Snapshot report for `src/contract.test.ts`
The actual snapshot is saved in `contract.test.ts.snap`.
Generated by [AVA](https://avajs.dev).
## contract basics
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
#[contract]␊
pub struct Foo;␊
`
## contract with constructor code
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
#[contract]␊
pub struct Foo;␊
␊
#[contractimpl]␊
impl Foo {␊
pub fn __constructor(e: &Env) {␊
someFunction();␊
}␊
}␊
`
## contract with constructor code with semicolon
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
#[contract]␊
pub struct Foo;␊
␊
#[contractimpl]␊
impl Foo {␊
pub fn __constructor(e: &Env) {␊
someFunction();␊
}␊
}␊
`
## contract with function code before
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
#[contract]␊
pub struct Foo;␊
␊
#[othertag]␊
#[contractimpl]␊
impl External for ExternalTrait {␊
#[functiontag]␊
fn someFunction() {␊
before();␊
someFunction();␊
}␊
}␊
`
## contract with function code before with semicolons
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
#[contract]␊
pub struct Foo;␊
␊
#[othertag]␊
#[contractimpl]␊
impl External for ExternalTrait {␊
#[functiontag]␊
fn someFunction() {␊
before();␊
someFunction();␊
}␊
}␊
`
## contract with standalone import
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
use some::library::SomeLibrary;␊
␊
#[contract]␊
pub struct Foo;␊
`
## contract with grouped imports
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
use some::library::{Misc, SomeLibrary};␊
␊
#[contract]␊
pub struct Foo;␊
`
## contract with sorted use clauses
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
use another::library::{self as custom1, self as custom2, AnotherLibrary};␊
use some::library::SomeLibrary;␊
␊
#[contract]␊
pub struct Foo;␊
`
## contract with documentation
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
␊
//! Some documentation␊
#![no_std]␊
␊
#[contract]␊
pub struct Foo;␊
`
## contract with security contact metadata
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
use soroban_sdk::contractmeta;␊
␊
contractmeta!(key="contact", val="security@example.com");␊
␊
#[contract]␊
pub struct Foo;␊
`
## contract with multiple metadata
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
use soroban_sdk::contractmeta;␊
␊
contractmeta!(key="contact", val="security@example.com");␊
contractmeta!(key="meta", val="data");␊
␊
#[contract]␊
pub struct Foo;␊
`
## contract with multiple metadata and documentation
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
␊
//! Some documentation␊
#![no_std]␊
␊
use soroban_sdk::contractmeta;␊
␊
contractmeta!(key="contact", val="security@example.com");␊
contractmeta!(key="meta", val="data");␊
␊
#[contract]␊
pub struct Foo;␊
`
## contract with setInfo
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
#![no_std]␊
␊
use soroban_sdk::contractmeta;␊
␊
contractmeta!(key="security_contact", val="security@example.com");␊
␊
#[contract]␊
pub struct Foo;␊
`