From cf8a18c0ae4b846524c19431339164f843052e5f Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Fri, 25 Aug 2023 15:56:50 -0400 Subject: [PATCH] feat: update to newest loam and add CI test --- .cargo/config.toml | 4 +- .env | 3 +- .github/workflows/standalone.yml | 39 +++++++++++ .gitignore | 1 + .soroban/network/standalone.toml | 2 + Cargo.lock | 20 ++++-- Cargo.toml | 9 ++- README.md | 8 --- contract_id.txt | 2 +- contracts/core/Cargo.toml | 23 ++++++ contracts/core/src/lib.rs | 11 +++ contracts/smartdeploy/Cargo.toml | 6 +- contracts/smartdeploy/src/error.rs | 3 + contracts/smartdeploy/src/lib.rs | 10 ++- contracts/smartdeploy/src/registry.rs | 14 +++- .../smartdeploy/src/registry/contract.rs | 70 ++++++++++++++----- contracts/smartdeploy/src/registry/wasm.rs | 6 +- deploy.sh | 23 +++--- examples/cross_contract/contract_b/Cargo.toml | 1 + examples/cross_contract/contract_b/src/lib.rs | 7 +- hash.txt | 2 +- justfile | 34 ++++++--- 22 files changed, 225 insertions(+), 73 deletions(-) create mode 100644 .github/workflows/standalone.yml create mode 100644 .soroban/network/standalone.toml create mode 100644 contracts/core/Cargo.toml create mode 100644 contracts/core/src/lib.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index f0a4d14..6d9ce09 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -4,8 +4,8 @@ xtask = "run --package xtask --" bwl = "build --profile release-with-logs" install_soroban = "binstall -y --install-path ./target/bin soroban-cli --version 0.8.7" -install_soroban_dev = "install --git https://github.com/ahalabs/soroban-tools --rev 2966e7ac9cbcc9f408b80f4aa21c3b76ccf064c6 --debug --root ./target soroban-cli" -install_loam = "install --git https://github.com/loambuild/loam-sdk --rev 9e8773367fae11dfe6dfe6277de9ff3b771faa2a --debug --root ./target loam-cli" +install_soroban_dev = "install --git https://github.com/ahalabs/soroban-tools --rev 5e28f84861e3d031dd23d3dcd964bbe13f876511 --debug --root ./target soroban-cli" +install_loam = "install --git https://github.com/loambuild/loam-sdk --rev ee47f39b270569ce25eaead80da4a9859ee21868 --debug --root ./target loam-cli" # c = "check" # t = "test" # r = "run" diff --git a/.env b/.env index 68ceaab..4904fa4 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ -SOROBAN_CONTRACT_ID=a0ac4c26215ee63cbf9084ae2aa369df3808cf4a2a3f57a1da07956562791258 +SOROBAN_NETWORK=standalone +SOROBAN_ACCOUNT=default CONFIG_DIR=. \ No newline at end of file diff --git a/.github/workflows/standalone.yml b/.github/workflows/standalone.yml new file mode 100644 index 0000000..7d31e51 --- /dev/null +++ b/.github/workflows/standalone.yml @@ -0,0 +1,39 @@ +name: standalone RPC + +on: [push] + +jobs: + test: + name: test generated libraries + runs-on: ubuntu-20.04 + services: + rpc: + image: stellar/quickstart:soroban-dev@sha256:a6b03cf6b0433c99f2f799b719f0faadbb79684b1b763e7674ba749fb0f648ee + ports: + - 8000:8000 + env: + ENABLE_LOGS: true + NETWORK: standalone + ENABLE_SOROBAN_RPC: true + options: >- + --health-cmd "curl -X POST \"http://localhost:8000/soroban/rpc\"" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - run: rustup update + - run: rustup target add wasm32-unknown-unknown + - run: just setup + - run: just clean + - run: just publish_all + - run: just deployed_contracts \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0b32cff..a3f7ce3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target/ .soroban +!./.soroban/network/standalone.toml diff --git a/.soroban/network/standalone.toml b/.soroban/network/standalone.toml new file mode 100644 index 0000000..5ab0864 --- /dev/null +++ b/.soroban/network/standalone.toml @@ -0,0 +1,2 @@ +rpc_url = "http://localhost:8000/soroban/rpc" +network_passphrase = "Standalone Network ; February 2017" diff --git a/Cargo.lock b/Cargo.lock index e871b43..e4259ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -458,6 +458,7 @@ dependencies = [ name = "contract-b" version = "0.0.0" dependencies = [ + "contract-a", "loam-sdk", "loam-sdk-core-riff", ] @@ -478,6 +479,14 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "core-riff" +version = "0.0.0" +dependencies = [ + "loam-sdk", + "loam-sdk-core-riff", +] + [[package]] name = "cpufeatures" version = "0.2.7" @@ -1397,7 +1406,7 @@ checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" [[package]] name = "loam-build" version = "0.1.0" -source = "git+https://github.com/loambuild/loam-sdk?tag=v0.5.0#9e8773367fae11dfe6dfe6277de9ff3b771faa2a" +source = "git+https://github.com/loambuild/loam-sdk?tag=v0.6.1#ee47f39b270569ce25eaead80da4a9859ee21868" dependencies = [ "cargo_metadata 0.15.4", "thiserror", @@ -1407,7 +1416,7 @@ dependencies = [ [[package]] name = "loam-sdk" version = "0.1.0" -source = "git+https://github.com/loambuild/loam-sdk?tag=v0.5.0#9e8773367fae11dfe6dfe6277de9ff3b771faa2a" +source = "git+https://github.com/loambuild/loam-sdk?tag=v0.6.1#ee47f39b270569ce25eaead80da4a9859ee21868" dependencies = [ "loam-sdk-macro", "loam-soroban-sdk", @@ -1416,7 +1425,7 @@ dependencies = [ [[package]] name = "loam-sdk-core-riff" version = "0.1.0" -source = "git+https://github.com/loambuild/loam-sdk?tag=v0.5.0#9e8773367fae11dfe6dfe6277de9ff3b771faa2a" +source = "git+https://github.com/loambuild/loam-sdk?tag=v0.6.1#ee47f39b270569ce25eaead80da4a9859ee21868" dependencies = [ "loam-sdk", ] @@ -1424,7 +1433,7 @@ dependencies = [ [[package]] name = "loam-sdk-macro" version = "0.0.1" -source = "git+https://github.com/loambuild/loam-sdk?tag=v0.5.0#9e8773367fae11dfe6dfe6277de9ff3b771faa2a" +source = "git+https://github.com/loambuild/loam-sdk?tag=v0.6.1#ee47f39b270569ce25eaead80da4a9859ee21868" dependencies = [ "Inflector", "cargo_metadata 0.15.4", @@ -1439,7 +1448,7 @@ dependencies = [ [[package]] name = "loam-soroban-sdk" version = "0.1.0" -source = "git+https://github.com/loambuild/loam-sdk?tag=v0.5.0#9e8773367fae11dfe6dfe6277de9ff3b771faa2a" +source = "git+https://github.com/loambuild/loam-sdk?tag=v0.6.1#ee47f39b270569ce25eaead80da4a9859ee21868" dependencies = [ "loam-sdk-macro", "soroban-sdk 0.9.2", @@ -2391,6 +2400,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" name = "smartdeploy" version = "0.0.0" dependencies = [ + "core-riff", "loam-sdk", "loam-sdk-core-riff", ] diff --git a/Cargo.toml b/Cargo.toml index 1e6ec23..44f2850 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,17 +40,16 @@ lto = true [workspace.dependencies] -# loam-sdk = { path = "../../loam/crates/loam" } +# loam-sdk = { path = "../../loam/crates/loam-sdk" } # loam-sdk-core-riff = { path = "../../loam/crates/loam-core" } -loam-sdk = { git = "https://github.com/loambuild/loam-sdk", tag = "v0.5.0" } -loam-sdk-core-riff = { git = "https://github.com/loambuild/loam-sdk", tag = "v0.5.0" } +loam-sdk = { git = "https://github.com/loambuild/loam-sdk", tag = "v0.6.1" } +loam-sdk-core-riff = { git = "https://github.com/loambuild/loam-sdk", tag = "v0.6.1" } clap = { version = "4.1.8", features = [ "derive", "env", "deprecated", "string", ] } -base64 = "0.13.0" thiserror = "1.0.31" serde = "1.0.82" serde_derive = "1.0.82" @@ -59,6 +58,6 @@ serde-aux = "4.1.2" hex = "0.4.3" num-bigint = "0.4" tokio = { version = "1", features = ["full"] } -soroban-cli = "0.8.7" +soroban-cli = "0.9.4" tracing = "0.1.37" tracing-subscriber = "0.3.17" diff --git a/README.md b/README.md index b4c59d3..4deb9a6 100644 --- a/README.md +++ b/README.md @@ -51,16 +51,8 @@ To deploy your own Smartdeploy first run: ```bash just clean ``` - -Then you can deploy it: - -```bash -just deploy_self -``` - ### Publish and deploy all the finished example contracts -Once Smartdeploy is deployed ```bash just publish_all diff --git a/contract_id.txt b/contract_id.txt index 284ae78..d4a7b22 100644 --- a/contract_id.txt +++ b/contract_id.txt @@ -1 +1 @@ -CBEBBQOYOWPVAOZ3BAIVVHPRLJSOB5OICXC7HNKTJNMLTPAWILQHR6SM \ No newline at end of file +CAES56G5MJQW6UJAYIHQLH3B7N3UP6WPOHUFQ6SKHGBX47RV4AAG5NMN \ No newline at end of file diff --git a/contracts/core/Cargo.toml b/contracts/core/Cargo.toml new file mode 100644 index 0000000..6f9b9c8 --- /dev/null +++ b/contracts/core/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "core-riff" +description = "Smallest Redeployable Contract" +version = "0.0.0" +authors = ["Stellar Development Foundation "] +license = "Apache-2.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] +doctest = false + +[dependencies] +loam-sdk = { workspace = true, features = ["loam-soroban-sdk"] } +loam-sdk-core-riff = { workspace = true } + + +[dev_dependencies] +loam-sdk = { workspace = true, features = ["soroban-sdk-testutils"] } + +[package.metadata.loam] +contract = true diff --git a/contracts/core/src/lib.rs b/contracts/core/src/lib.rs new file mode 100644 index 0000000..4ab340a --- /dev/null +++ b/contracts/core/src/lib.rs @@ -0,0 +1,11 @@ +#![no_std] +use loam_sdk::{soroban_contract, soroban_sdk}; +use loam_sdk_core_riff::{owner::Owner, CoreRiff}; + +pub struct Contract; + +impl CoreRiff for Contract { + type Impl = Owner; +} + +soroban_contract!(); diff --git a/contracts/smartdeploy/Cargo.toml b/contracts/smartdeploy/Cargo.toml index 1dd4a08..5477a58 100644 --- a/contracts/smartdeploy/Cargo.toml +++ b/contracts/smartdeploy/Cargo.toml @@ -15,9 +15,13 @@ doctest = false [dependencies] loam-sdk = { workspace = true } loam-sdk-core-riff = { workspace = true } +core-riff = { path = "../core" } [dev_dependencies] loam-sdk = { workspace = true, features = ["soroban-sdk-testutils"] } [package.metadata.loam] -contract = true \ No newline at end of file +contract = true + +# should add this here +#[package.metadata.loam.dependencies] \ No newline at end of file diff --git a/contracts/smartdeploy/src/error.rs b/contracts/smartdeploy/src/error.rs index 234eb56..b358021 100644 --- a/contracts/smartdeploy/src/error.rs +++ b/contracts/smartdeploy/src/error.rs @@ -19,4 +19,7 @@ pub enum Error { /// Contract already claimed AlreadyClaimed = 6, + + /// Failed to initialize contract + InitFailed = 7, } diff --git a/contracts/smartdeploy/src/lib.rs b/contracts/smartdeploy/src/lib.rs index d21c555..6b54d7d 100644 --- a/contracts/smartdeploy/src/lib.rs +++ b/contracts/smartdeploy/src/lib.rs @@ -1,7 +1,9 @@ #![no_std] use loam_sdk::{soroban_contract, soroban_sdk}; use loam_sdk_core_riff::{owner::Owner, CoreRiff}; -use registry::{contract::ContractRegistry, wasm::WasmRegistry, Deployable, Publishable}; +use registry::{ + contract::ContractRegistry, wasm::WasmRegistry, Deployable, DevDeployable, Publishable, +}; pub mod error; pub mod metadata; @@ -22,11 +24,15 @@ impl Deployable for Contract { type Impl = ContractRegistry; } +impl DevDeployable for Contract { + type Impl = ContractRegistry; +} + impl CoreRiff for Contract { type Impl = Owner; } -soroban_contract!(); +soroban_contract!(WasmRegistry impl Publishable, Deployable = ContractRegistry, CoreRiff = Owner); #[cfg(test)] mod test; diff --git a/contracts/smartdeploy/src/registry.rs b/contracts/smartdeploy/src/registry.rs index 2803019..5067baf 100644 --- a/contracts/smartdeploy/src/registry.rs +++ b/contracts/smartdeploy/src/registry.rs @@ -37,7 +37,7 @@ pub trait IsPublishable { &mut self, contract_name: soroban_sdk::String, author: soroban_sdk::Address, - bytes: soroban_sdk::Bytes, + wasm: soroban_sdk::Bytes, repo: Option, kind: Option, ) -> Result<(), Error>; @@ -79,3 +79,15 @@ pub trait IsDeployable { limit: Option, ) -> Result, Error>; } + + +#[riff] +pub trait IsDevDeployable { + /// Skips the publish step to deploy a contract directly, keeping the name + fn dev_deploy( + &mut self, + name: soroban_sdk::String, + owner: soroban_sdk::Address, + wasm: soroban_sdk::Bytes, + ) -> Result; +} diff --git a/contracts/smartdeploy/src/registry/contract.rs b/contracts/smartdeploy/src/registry/contract.rs index 80c4805..a23631d 100644 --- a/contracts/smartdeploy/src/registry/contract.rs +++ b/contracts/smartdeploy/src/registry/contract.rs @@ -1,12 +1,20 @@ #![allow(non_upper_case_globals)] -use loam_sdk::soroban_sdk::{ - self, contracttype, env, symbol_short, vec, Address, BytesN, IntoKey, IntoVal, Map, String, - Val, Vec, -}; +use loam_sdk::soroban_sdk::{self, contracttype, env, vec, Address, BytesN, IntoKey, Map, String}; use crate::{error::Error, registry::Publishable, util::hash_string, version::Version, Contract}; -use super::IsDeployable; +use super::{IsDeployable, IsDevDeployable}; + + +loam_sdk::import_contract!(core_riff); + +// Is the same as + +// mod core_riff { +// use loam_sdk::soroban_sdk; +// loam_sdk::soroban_sdk::contractimport!(file = "../../target/loam/core_riff.wasm",); +// } + #[contracttype(export = false)] #[derive(IntoKey)] @@ -19,7 +27,6 @@ impl Default for ContractRegistry { } impl IsDeployable for ContractRegistry { - fn claim_deployed_contract(&mut self, deployed_name: String, id: Address) -> Result<(), Error> { if self.0.contains_key(deployed_name.clone()) { return Err(Error::AlreadyClaimed); @@ -35,7 +42,6 @@ impl IsDeployable for ContractRegistry { owner: Address, salt: Option>, ) -> Result { - let env = env(); if self.0.contains_key(deployed_name.clone()) { return Err(Error::NoSuchContractDeployed); } @@ -43,16 +49,9 @@ impl IsDeployable for ContractRegistry { owner.require_auth(); let hash = Contract::fetch_hash(contract_name, version)?; let salt = salt.unwrap_or_else(|| hash_string(&deployed_name)); - // Deploy the contract using the installed WASM code with given hash. - let id = env.deployer().with_current_contract(salt).deploy(hash); - // TODO: Invoke using a External API interface that is generated from Core Riff. - let init_fn = symbol_short!("owner_set"); - let mut init_args: Vec = Vec::new(env); - init_args.push_back(owner.into_val(env)); - // Invoke the init function with the given arguments. - let _res: Val = env.invoke_contract(&id, &init_fn, init_args); - self.0.set(deployed_name, id.clone()); - Ok(id) + let address = deploy_and_init(&owner, salt, hash)?; + self.0.set(deployed_name, address.clone()); + Ok(address) } fn fetch_contract_id(&self, deployed_name: String) -> Result { @@ -78,3 +77,40 @@ impl IsDeployable for ContractRegistry { Ok(res) } } + +fn deploy_and_init( + owner: &Address, + salt: BytesN<32>, + wasm_hash: BytesN<32>, +) -> Result { + // Deploy the contract using the installed WASM code with given hash. + let address = env() + .deployer() + .with_current_contract(salt) + .deploy(wasm_hash); + // Set the owner of the contract to the given owner. + let _ = core_riff::Client::new(env(), &address) + .try_owner_set(owner) + .map_err(|_| Error::InitFailed)?; + Ok(address) +} + +impl IsDevDeployable for ContractRegistry { + fn dev_deploy( + &mut self, + name: soroban_sdk::String, + owner: soroban_sdk::Address, + wasm: soroban_sdk::Bytes, + ) -> Result { + let wasm_hash = env().deployer().upload_contract_wasm(wasm); + if let Some(address) = self.0.get(name.clone()) { + let contract = core_riff::Client::new(env(), &address); + contract.redeploy(&wasm_hash); + return Ok(address); + } + let salt = hash_string(&name); + let id = deploy_and_init(&owner, salt, wasm_hash)?; + self.0.set(name, id.clone()); + Ok(id) + } +} diff --git a/contracts/smartdeploy/src/registry/wasm.rs b/contracts/smartdeploy/src/registry/wasm.rs index 44e03b0..f090d7b 100644 --- a/contracts/smartdeploy/src/registry/wasm.rs +++ b/contracts/smartdeploy/src/registry/wasm.rs @@ -52,7 +52,7 @@ impl IsPublishable for WasmRegistry { &mut self, contract_name: String, author: Address, - bytes: soroban_sdk::Bytes, + wasm: soroban_sdk::Bytes, repo: Option, kind: Option, ) -> Result<(), Error> { @@ -62,9 +62,11 @@ impl IsPublishable for WasmRegistry { contract.author.require_auth(); let keys = contract.versions.keys(); let last_version = keys.last().unwrap_or_default(); + last_version.log(); let new_version = last_version.clone().update(&kind.unwrap_or_default()); new_version.log(); + let metadata = if let Some(repo) = repo { ContractMetadata { repo } } else if new_version == INITAL_VERSION { @@ -72,7 +74,7 @@ impl IsPublishable for WasmRegistry { } else { contract.get(Some(last_version))?.metadata }; - let hash = env().deployer().upload_contract_wasm(bytes); + let hash = env().deployer().upload_contract_wasm(wasm); let published_binary = PublishedWasm { hash, metadata }; contract.versions.set(new_version, published_binary); self.set_contract(contract_name, contract); diff --git a/deploy.sh b/deploy.sh index b646de9..afe61de 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,12 +1,12 @@ #!/bin/bash -CURRENT_HASH=$(just soroban contract install \ - --source default \ - --wasm ./target/wasm32-unknown-unknown/release-with-logs/smartdeploy.wasm) -FILE_HASH="" +CURRENT_HASH=$(just soroban contract install --source default --wasm ./target/loam/smartdeploy.wasm) +author=$(just soroban config identity address default) +echo $author +FILE_HASH="" if test -e "./hash.txt"; then FILE_HASH=$(cat ./hash.txt) @@ -37,19 +37,18 @@ fi -author=$(just soroban config identity address default) ID=$(cat contract_id.txt) +if test "$ID" = ""; then + echo "No ID found" + exit 1 +fi + -smartdeploy="just soroban --quiet contract invoke --source default --id $ID" +smartdeploy="just soroban --quiet contract invoke --id $ID" if test "$FILE_HASH" = ""; then - $smartdeploy --fee 500000 -- publish \ - --contract_name smartdeploy \ - --bytes-file-path ./target/loam/smartdeploy.wasm \ - --author $author \ - --repo https://github.com/tenk-dao/smart-deploy - + just publish smartdeploy just claim_self fi diff --git a/examples/cross_contract/contract_b/Cargo.toml b/examples/cross_contract/contract_b/Cargo.toml index 92a7768..689b0a8 100644 --- a/examples/cross_contract/contract_b/Cargo.toml +++ b/examples/cross_contract/contract_b/Cargo.toml @@ -13,6 +13,7 @@ doctest = false [dependencies] loam-sdk = { workspace = true } loam-sdk-core-riff = { workspace = true } +contract-a = { path = "../contract_a" } [dev_dependencies] diff --git a/examples/cross_contract/contract_b/src/lib.rs b/examples/cross_contract/contract_b/src/lib.rs index 8fa02bf..1cea527 100644 --- a/examples/cross_contract/contract_b/src/lib.rs +++ b/examples/cross_contract/contract_b/src/lib.rs @@ -2,12 +2,7 @@ use loam_sdk::soroban_sdk::{self, contract, contractimpl, Address, Env}; -mod contract_a { - use loam_sdk::soroban_sdk; - loam_sdk::soroban_sdk::contractimport!( - file = "../../../target/loam/contract_a.wasm", - ); -} +loam_sdk::import_contract!(contract_a); #[contract] pub struct ContractB; diff --git a/hash.txt b/hash.txt index 6d1066e..42e68f9 100644 --- a/hash.txt +++ b/hash.txt @@ -1 +1 @@ -6ffff845c5bdd88ead77ee161761d018afb5661ed806c3e6502f5b3fd9130acb \ No newline at end of file +1b4d44c03e9ee1d622ddf6f3935c4377875af3d365e69b4b526ea37a45f8e26a \ No newline at end of file diff --git a/justfile b/justfile index 0f423fb..36a7685 100644 --- a/justfile +++ b/justfile @@ -2,7 +2,6 @@ set dotenv-load export PATH := './target/bin:' + env_var('PATH') -export SOROBAN_NETWORK := 'futurenet' TARGET_DIR := './target/loam' SMARTDEPLOY := TARGET_DIR / 'smartdeploy.wasm' BASE := TARGET_DIR / 'base.wasm' @@ -27,9 +26,9 @@ s name +args: @just soroban {{ name }} {{ args }} smartdeploy +args: - @soroban contract invoke --id {{id}} -- {{args}} + @just smartdeploy_raw -- {{args}} -smartdeploy_raw +args: +@smartdeploy_raw +args: @soroban contract invoke --id {{id}} {{args}} @soroban_install name: @@ -52,7 +51,7 @@ build: [private] setup_default: - soroban config identity generate default --config-dir $CONFIG_DIR --network futurenet + soroban config identity generate default --config-dir $CONFIG_DIR @setup: echo {{ if path_exists(soroban) == "true" { "" } else { `cargo install_soroban_dev` } }} @@ -65,7 +64,7 @@ setup_default: [private] @claim_self: - just smartdeploy claim_deployed_contract --deployed_name smartdeploy --id $(cat contract_id.txt) + just smartdeploy claim_deployed_contract --deployed_name smartdeploy --id {{ id }} [private] @install_self: @@ -73,7 +72,7 @@ setup_default: chmod +x {{ FILE }} -publish_all: build +publish_all: deploy_self #!/usr/bin/env bash just install_self; for name in $(loam build --ls) @@ -92,13 +91,20 @@ publish_all: build @just install_contract {{ name }} @deploy contract_name deployed_name owner='default': - just smartdeploy_raw --source {{owner}} -- deploy --contract_name {{contract_name}} --deployed_name {{deployed_name}} --owner {{owner}} + @just smartdeploy_raw --source {{owner}} -- deploy --contract_name {{contract_name}} --deployed_name {{deployed_name}} --owner {{owner}} + +@dev_deploy name file owner='default': + just smartdeploy_raw --fee {{UPLOAD_FEE}} --source {{owner}} -- \ + dev_deploy \ + --owner {{owner}}} \ + --name {{name}} \ + --wasm-file-path {{file}}} \ @publish name kind='Patch' author='default': just smartdeploy_raw --fee {{UPLOAD_FEE}} --source {{author}} -- \ publish \ --contract_name {{name}} \ - --bytes-file-path ./target/loam/{{name}}.wasm \ + --wasm-file-path ./target/loam/{{name}}.wasm \ --kind {{kind}} \ --author {{author}} \ @@ -106,7 +112,9 @@ publish_all: build @clean: rm -rf .soroban/*.json hash.txt target/bin/soroban-* - +# Delete installed binaries +@clean_installed_binaries: + rm target/bin/loam target/bin/soroban # List Published Contracts published_contracts start='0' limit='100': @@ -121,3 +129,11 @@ deployed_contracts start='0' limit='100': @install_contract name: ./install_contract.sh {{name}} +start_docker: + docker run --rm -it \ + -p 8000:8000 \ + --name stellar \ + stellar/quickstart:soroban-dev@sha256:a6b03cf6b0433c99f2f799b719f0faadbb79684b1b763e7674ba749fb0f648ee \ + --standalone \ + --enable-soroban-rpc \ +