Skip to content

Deploy Soroban KYC/KYB Contract to Testnet [wallet - service]Β #155

Description

@salazarsebas

πŸ”‘ Deploy Soroban KYC/KYB Contract to Testnet πŸ› οΈ

πŸ“ Description

Deploy the Soroban smart contract designed for KYC/KYB data to the Stellar testnet. This deployment will enable the Stellar wallet service to interact with the contract for storing and verifying KYC/KYB data on the blockchain. The deployment process will use the Soroban client and a funded Stellar account to ensure successful contract deployment.

🎯 Objective

Create a module in services/stellar-wallet/src/soroban/deploy.js to deploy the KYC/KYB contract to the testnet and add a unit test to verify the deployment process.

πŸ—‚ Structure

  • Directory: services/stellar-wallet
  • Files:
    • src/soroban/deploy.js
    • tests/soroban/deploy.test.js
  • Expected structure:
    services/stellar-wallet
    β”œβ”€β”€ src
    β”‚   β”œβ”€β”€ index.js
    β”‚   β”œβ”€β”€ stellar
    β”‚   β”‚   β”œβ”€β”€ client.js
    β”‚   β”‚   β”œβ”€β”€ keys.js
    β”‚   β”‚   └── fund.js
    β”‚   β”œβ”€β”€ db
    β”‚   β”‚   └── kyc.js
    β”‚   β”œβ”€β”€ routes
    β”‚   β”‚   └── kyc.js
    β”‚   β”œβ”€β”€ kyc
    β”‚   β”‚   └── validate.js
    β”‚   └── soroban
    β”‚       β”œβ”€β”€ client.js
    β”‚       β”œβ”€β”€ kyc-contract.rs
    β”‚       └── deploy.js
    β”œβ”€β”€ config
    β”‚   └── db.sqlite
    β”œβ”€β”€ tests
    β”‚   β”œβ”€β”€ stellar
    β”‚   β”‚   β”œβ”€β”€ client.test.js
    β”‚   β”‚   β”œβ”€β”€ keys.test.js
    β”‚   β”‚   └── fund.test.js
    β”‚   β”œβ”€β”€ db
    β”‚   β”‚   └── kyc.test.js
    β”‚   β”œβ”€β”€ routes
    β”‚   β”‚   └── kyc.test.js
    β”‚   β”œβ”€β”€ kyc
    β”‚   β”‚   └── validate.test.js
    β”‚   └── soroban
    β”‚       β”œβ”€β”€ client.test.js
    β”‚       └── deploy.test.js
    β”œβ”€β”€ package.json
    β”œβ”€β”€ .env.example
    β”œβ”€β”€ .eslintrc.json
    β”œβ”€β”€ .eslintignore
    β”œβ”€β”€ .prettierrc.json
    β”œβ”€β”€ .prettierignore
    β”œβ”€β”€ .gitignore
    

βœ… Requirements

  • Create a branch named feat/deploy-soroban-contract for this task.
  • Create src/soroban/deploy.js with a function deployKycContract that:
    • Uses the Soroban client (from Issue 11) to connect to the testnet RPC server.
    • Loads the compiled contract from src/soroban/kyc-contract.rs.
    • Deploys the contract to the Stellar testnet using a funded Stellar account (funded via Friendbot).
  • Implement a function getContractId to retrieve the deployed contract’s ID.
  • Use environment variables (e.g., DEPLOYER_SECRET_KEY) for the deployer account’s private key.
  • Handle errors (e.g., invalid account, deployment failure) with appropriate error messages.
  • Create a unit test in tests/soroban/deploy.test.js to verify that deployKycContract deploys the contract and getContractId returns a valid contract ID.
  • Mock the Soroban client and network interactions in the unit test to avoid network dependencies.
  • Ensure the code adheres to ESLint and Prettier rules.
  • Commit changes to the feat/deploy-soroban-contract branch with a message like feat: deploy soroban contract.
  • Verify that the CI pipeline passes, with linting and test jobs succeeding.

πŸ† Expected Outcomes

  • src/soroban/deploy.js contains deployKycContract and getContractId functions.
  • The deployKycContract function successfully deploys the KYC contract to the testnet.
  • The getContractId function returns the deployed contract’s ID.
  • Unit test in tests/soroban/deploy.test.js verifies deployment and contract ID retrieval with mocked responses.
  • Code passes ESLint and Prettier checks.
  • Changes are committed to the feat/deploy-soroban-contract branch with a descriptive lowercase commit message.
  • CI pipeline runs successfully, with linting passing for src/soroban/deploy.js and tests/soroban/deploy.test.js, and the unit test passing.

πŸ”— References

πŸ“‹ Notes

  • The deployer account must be funded using Friendbot before deployment.
  • The DEPLOYER_SECRET_KEY environment variable should be added to .env.example as a placeholder.
  • Mocking the Soroban client in tests ensures reliable CI execution without network dependencies.
  • The contract ID should be stored or logged for use in subsequent issues.
  • Commit messages must be in lowercase and start with feat, change, fix, chore, or refactor.
  • The CI pipeline should validate the new code, ensuring ESLint passes and the unit test executes successfully.

Metadata

Metadata

Assignees

Labels

onlydust-waveContribute to awesome OSS repos during OnlyDust's open source week

Type

No type

Fields

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