zip-rust.compile.test.ts.md•4.3 kB
# Snapshot report for `src/zip-rust.compile.test.ts`
The actual snapshot is saved in `zip-rust.compile.test.ts.snap`.
Generated by [AVA](https://avajs.dev).
## rust zip
> Snapshot 1
[
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.4.1␊
␊
␊
use soroban_sdk::{Address, contract, contractimpl, Env, String};␊
use stellar_macros::default_impl;␊
use stellar_tokens::fungible::{Base, burnable::FungibleBurnable, FungibleToken};␊
␊
#[contract]␊
pub struct MyToken;␊
␊
#[contractimpl]␊
impl MyToken {␊
pub fn __constructor(e: &Env, recipient: Address) {␊
Base::set_metadata(e, 18, String::from_str(e, "MyToken"), String::from_str(e, "MTK"));␊
Base::mint(e, &recipient, 2000000000000000000000);␊
}␊
}␊
␊
#[default_impl]␊
#[contractimpl]␊
impl FungibleToken for MyToken {␊
type ContractType = Base;␊
␊
}␊
␊
//␊
// Extensions␊
//␊
␊
#[default_impl]␊
#[contractimpl]␊
impl FungibleBurnable for MyToken {}␊
`,
`#![cfg(test)]␊
␊
extern crate std;␊
␊
use soroban_sdk::{ testutils::Address as _, Address, Env, String };␊
␊
use crate::contract::{ MyToken, MyTokenClient };␊
␊
#[test]␊
fn initial_state() {␊
let env = Env::default();␊
␊
let contract_addr = env.register(MyToken, (Address::generate(&env),));␊
let client = MyTokenClient::new(&env, &contract_addr);␊
␊
assert_eq!(client.name(), String::from_str(&env, "MyToken"));␊
}␊
␊
// Add more tests bellow␊
`,
`#![no_std]␊
#![allow(dead_code)]␊
␊
mod contract;␊
mod test;␊
`,
`[package]␊
name = "fungible-contract"␊
edition.workspace = true␊
license.workspace = true␊
publish = false␊
version.workspace = true␊
␊
[package.metadata.stellar]␊
cargo_inherit = true␊
␊
[lib]␊
crate-type = ["cdylib"]␊
doctest = false␊
␊
[dependencies]␊
stellar-tokens = { workspace = true }␊
stellar-access = { workspace = true }␊
stellar-contract-utils = { workspace = true }␊
stellar-macros = { workspace = true }␊
soroban-sdk = { workspace = true }␊
␊
[dev-dependencies]␊
soroban-sdk = { workspace = true, features = ["testutils"] }␊
`,
`[workspace]␊
resolver = "2"␊
members = ["contracts/*"]␊
␊
[workspace.package]␊
authors = []␊
edition = "2021"␊
license = "Apache-2.0"␊
version = "0.0.1"␊
␊
[workspace.dependencies]␊
soroban-sdk = "22.0.8"␊
stellar-tokens = "=0.4.1"␊
stellar-access = "=0.4.1"␊
stellar-contract-utils = "=0.4.1"␊
stellar-macros = "=0.4.1"␊
␊
␊
[profile.release]␊
opt-level = "z"␊
overflow-checks = true␊
debug = 0␊
strip = "symbols"␊
debug-assertions = false␊
panic = "abort"␊
codegen-units = 1␊
lto = true␊
␊
[profile.release-with-logs]␊
inherits = "release"␊
debug-assertions = true␊
`,
`# Sample Rust Contract Environment␊
␊
This project demonstrates a basic Rust contract environment use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/) and a test for that contract. Make sure you have the required dependencies and keep building!␊
␊
## Go further␊
␊
Continue your development journey with [Stellar CLI](https://github.com/stellar/stellar-cli).␊
␊
## Installing dependencies␊
␊
- See [Rust and Stellar installation guide](https://developers.stellar.org/docs/build/smart-contracts/getting-started/setup).␊
- See [Git installation guide](https://github.com/git-guides/install-git).␊
`,
]