Skip to content

Latest commit

 

History

History
157 lines (123 loc) · 4.47 KB

File metadata and controls

157 lines (123 loc) · 4.47 KB

Issue #321: FiatBridge Futurenet Deployment Implementation

Summary

Successfully implemented automated Futurenet deployment infrastructure for the FiatBridge smart contract, including deployment scripts, GitHub Actions CI/CD workflow, and comprehensive documentation.

Implementation Details

1. Deployment Scripts ✅

Shell Script

  • Location: stellar-contracts/scripts/deploy_fiat_bridge_futurenet.sh
  • Purpose: Bash-based deployment script for manual local deployments
  • Features:
    • Parameterized by environment variables
    • Automatic WASM contract building
    • Contract ID extraction and file output
    • GitHub Actions output integration

Rust Binary

  • Location: stellar-contracts/src/bin/deploy_fiat_bridge_futurenet.rs
  • Purpose: Rust-based deployment binary alternative
  • Features:
    • Built-in dependency management
    • Structured error handling
    • Soroban CLI integration

2. GitHub Actions Workflow ✅

Workflow File: .github/workflows/deploy-futurenet.yml

Features:

  • Triggered on push to release/** branches
  • Conditional on stellar-contracts/** changes
  • Environment: Futurenet (requires FUTURENET_ADMIN_SECRET_KEY secret)
  • Automatic artifact generation
  • Deployment status tracking
  • GitHub Step Summary output

Steps:

  1. Checkout code
  2. Setup Rust toolchain (wasm32-unknown-unknown target)
  3. Install Soroban CLI
  4. Cargo cache for performance
  5. Build WASM contract
  6. Deploy to Futurenet
  7. Upload contract ID artifact
  8. Create deployment status
  9. Post summary to Actions

3. Documentation ✅

File: stellar-contracts/DEPLOYMENT.md

Contents:

  • Prerequisites and tool setup
  • Local deployment instructions (Bash and Rust options)
  • Environment variables reference
  • Automated CI/CD setup guide
  • Output format documentation
  • Verification steps
  • Troubleshooting guide
  • Security considerations

4. Environment Variables

Parameterization through environment variables:

Variable Purpose Default
FUTURENET_ADMIN_SECRET_KEY Admin account secret key Required
FUTURENET_RPC_URL RPC endpoint https://rpc-futurenet.stellar.org
FUTURENET_NETWORK_PASSPHRASE Network identifier Test SDF Future Network ; April 2020
OUTPUT_FILE Contract ID output path ./contract_id_futurenet.txt

5. Contract ID Output

Scripts output contract ID in two ways:

File Output:

# contract_id_futurenet.txt
CABC1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF123456

GitHub Actions Output:

$GITHUB_OUTPUT: contract_id=CABC1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF123456

Artifact:

  • Uploaded for 90 days retention
  • Named: contract-deployment-{sha}
  • Downloadable from Actions page

Acceptance Criteria Met

Deploy script parameterised by environment variable

  • Multiple parameterization points for flexibility
  • Sensible defaults for Futurenet
  • Clear documentation of required variables

Outputs contract ID to a file for downstream scripts

  • Primary output: contract_id_futurenet.txt
  • Configurable via OUTPUT_FILE variable
  • GitHub Actions integration for CI/CD

GitHub Actions workflow that deploys on push to release/ branches*

  • Workflow file: .github/workflows/deploy-futurenet.yml
  • Pattern: release/** branches
  • Triggered only on relevant code changes
  • Environment-based secrets management
  • done

Usage Examples

Local Deployment (Bash)

export FUTURENET_ADMIN_SECRET_KEY="your-key"
bash stellar-contracts/scripts/deploy_fiat_bridge_futurenet.sh
cat contract_id_futurenet.txt

Local Deployment (Rust)

export FUTURENET_ADMIN_SECRET_KEY="your-key"
cargo run --release --bin deploy_fiat_bridge_futurenet

CI/CD Deployment

  1. Configure FUTURENET_ADMIN_SECRET_KEY in GitHub Secrets
  2. Push to release/ branch
  3. Workflow automatically deploys contract
  4. Contract ID available in artifacts

Security

  • Secret key management through GitHub Secrets
  • No hardcoded credentials
  • Environment variable isolation
  • Network validation
  • Error handling for failed deployments

Testing Completed

✅ Script validation ✅ Environment variable substitution ✅ Workflow trigger conditions ✅ Artifact generation ✅ Error handling

Future Enhancements

  • Add Testnet deployment workflow
  • Add Public network deployment workflow (with approval gates)
  • Add contract verification script
  • Add initialization parameter configuration
  • Add multi-environment deployment strategy