@@ -13,81 +13,119 @@ Ensure you have the following installed:
1313- Stellar CLI
1414- A funded Stellar testnet account (via Friendbot)
1515
16+ ### Recommended: Use the ` tokenbound ` CLI (cross-platform)
17+
18+ This repo includes a Node-based CLI that wraps the Soroban CLI and automates the dependency-ordered deployment.
19+
20+ From the repo root:
21+
22+ ``` bash
23+ npm install
24+ npm run tokenbound -- deploy --network testnet --source deployer
25+ ```
26+
27+ Deployment output is written to ` soroban-contract/deployments/<network>.json ` by default.
28+
1629### Install Soroban CLI
30+
1731``` bash
1832cargo install --locked soroban-cli
1933```
2034
2135### Add WASM target
36+
2237``` bash
2338rustup target add wasm32-unknown-unknown
2439```
40+
2541### 2. Setup Environment
42+
2643Create environment variables:
44+
2745``` bash
2846export NETWORK=testnet
2947export SOROBAN_RPC_URL=" https://soroban-testnet.stellar.org"
3048export ADMIN_SECRET_KEY=" S..."
3149export ADMIN_ADDRESS=" G..."
3250```
51+
3352Fund your account:
53+
3454``` bash
3555curl " https://friendbot.stellar.org?addr=$ADMIN_ADDRESS "
3656```
3757
3858### 3. Build Contracts
59+
3960From the root directory:
61+
4062``` bash
4163cargo build --target wasm32-unknown-unknown --release
4264```
65+
4366Optimise contracts:
67+
4468``` bash
4569soroban contract optimize --wasm target/wasm32-unknown-unknown/release/* .wasm
4670```
4771
4872### 4. Deployment Order
73+
4974Deploy contracts in the following order:
75+
50761 . ` ticket_factory `
51772 . ` event_manager `
52783 . ` tba_registry `
5379
5480### 5. Deploy Contracts
81+
5582** Deploy Ticket Factory**
83+
5684``` bash
5785soroban contract deploy \
5886 --wasm < path_to_ticket_factory.wasm> \
5987 --source $ADMIN_SECRET_KEY \
6088 --rpc-url $SOROBAN_RPC_URL
6189```
90+
6291Save the returned Contract ID:
92+
6393``` bash
6494export TICKET_FACTORY_ID=" C..."
6595```
96+
6697** Deploy Event Manager**
98+
6799``` bash
68100soroban contract deploy \
69101 --wasm < path_to_event_manager.wasm> \
70102 --source $ADMIN_SECRET_KEY \
71103 --rpc-url $SOROBAN_RPC_URL
72104```
105+
73106``` bash
74107export EVENT_MANAGER_ID=" C..."
75108```
109+
76110** Deploy TBA Registry**
111+
77112``` bash
78113soroban contract deploy \
79114 --wasm < path_to_tba_registry.wasm> \
80115 --source $ADMIN_SECRET_KEY \
81116 --rpc-url $SOROBAN_RPC_URL
82117```
118+
83119``` bash
84120export TBA_REGISTRY_ID=" C..."
85121```
86122
87123### 6. Contract Initialization
124+
88125Initialize each contract with required parameters.
89126
90127Example:
128+
91129``` bash
92130soroban contract invoke \
93131 --id $TICKET_FACTORY_ID \
@@ -96,42 +134,51 @@ soroban contract invoke \
96134 -- initialize \
97135 --admin $ADMIN_ADDRESS
98136```
137+
99138Repeat for other contracts using their respective parameters.
100139
101140### 7. Verification Steps
141+
102142After deployment:
143+
103144- Confirm contract IDs are returned
104145- Call a read method:
146+
105147``` bash
106148soroban contract invoke \
107149 --id $TICKET_FACTORY_ID \
108150 --source $ADMIN_SECRET_KEY \
109151 --rpc-url $SOROBAN_RPC_URL \
110152 -- some_view_function
111153```
154+
112155- Ensure no errors are returned
113156- Check events on Soroban explorer
114157
115-
116158### 8. Troubleshooting
159+
117160** Contract fails to deploy**
161+
118162- Ensure account has enough XLM
119163- Check RPC URL
120164
121165** WASM not found**
166+
122167- Ensure build step completed successfully
123168
124169** Initialization fails**
170+
125171- Ensure correct parameters are passed
126172- Check contract already initialized
127173
128174** CLI errors**
175+
129176``` bash
130177soroban --version
131178```
132179
133180### 9. Notes
181+
134182- Always deploy in the correct order
135183- Store contract IDs securely
136184- Never expose secret keys in code
137-
0 commit comments