Skip to content

Add deployment scripts and stellar.toml configuration for testnet and mainnet #26

Description

@prodbycorne

Overview

There are no deployment scripts, configuration files, or documentation for deploying the contracts to Stellar testnet or mainnet. Developers must reconstruct the deployment sequence from the Stellar CLI docs and source code, which is error-prone and inconsistent across team members.

Required Deliverables

1. scripts/deploy.sh

A shell script that:

  1. Installs WASM for farming-pool via stellar contract install
  2. Deploys the factory contract via stellar contract deploy
  3. Calls factory.initialize(admin, pool_wasm_hash)
  4. Saves deployed contract IDs to .contract-ids.json
#!/usr/bin/env bash
set -euo pipefail

NETWORK=${NETWORK:-testnet}
ADMIN=${ADMIN:-$(stellar keys address default)}

echo "Installing farming-pool WASM..."
POOL_HASH=$(stellar contract install     --wasm target/wasm32-unknown-unknown/release/farming_pool.wasm     --network $NETWORK --source default)

echo "Deploying factory..."
FACTORY_ID=$(stellar contract deploy     --wasm target/wasm32-unknown-unknown/release/factory.wasm     --network $NETWORK --source default)

echo "Initializing factory..."
stellar contract invoke --id $FACTORY_ID --network $NETWORK --source default     -- initialize --admin $ADMIN --pool_wasm_hash $POOL_HASH

echo "{\"factory\": \"$FACTORY_ID\", \"pool_wasm_hash\": \"$POOL_HASH\"}" > .contract-ids.json

2. stellar.toml

Network configuration for Stellar CLI:

[testnet]
rpc-url = "https://soroban-testnet.stellar.org"
network-passphrase = "Test SDF Network ; September 2015"

[mainnet]
rpc-url = "https://soroban-rpc.stellar.org"
network-passphrase = "Public Global Stellar Network ; September 2015"

3. Makefile

build:
    cargo build --target wasm32-unknown-unknown --release

test:
    cargo test

deploy-testnet:
    NETWORK=testnet ./scripts/deploy.sh

deploy-mainnet:
    NETWORK=mainnet ./scripts/deploy.sh

Acceptance Criteria

  • scripts/deploy.sh deploys and initializes factory end-to-end on testnet
  • Makefile with build, test, deploy-testnet, deploy-mainnet targets
  • .contract-ids.json generated and gitignored
  • stellar.toml with testnet + mainnet RPC configuration
  • README updated with Quick Start deployment section
  • Script fails fast with clear error messages on missing env vars

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaigninfrastructureBuild tooling, deployment, CI/CD

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions