Skip to content

Commit 83f6a0a

Browse files
authored
docs: enhance convert contract readme (#10)
1 parent 8e5dce6 commit 83f6a0a

File tree

1 file changed

+190
-1
lines changed

1 file changed

+190
-1
lines changed

contracts/converter/README.md

Lines changed: 190 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ A CosmWasm smart contract for converting between MFX and different token denomin
44

55
## Overview
66

7-
The Converter contract facilitates the conversion of MFX tokens to target tokens at a predetermined exchange rate.
7+
The Converter contract facilitates the conversion of MFX tokens to target tokens at a predetermined exchange rate.
8+
9+
## Deployed Contracts
10+
11+
| Network | Contract Address |
12+
|---------|------------------|
13+
| Mainnet | `manifest1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqdnm0gk` |
14+
| Testnet | `manifest1c4p5p0eajlymxak8z5ugmksfpvp5zmm3scrwdrtd5a6mwxnhsa9qnsfftk` |
815

916
## Features
1017

@@ -100,6 +107,187 @@ Get current admin address:
100107
}
101108
```
102109

110+
## Interacting with the Contract
111+
112+
You can interact with the deployed converter contract using either REST (via `curl`) or RPC (via `manifestd`).
113+
114+
### Network Endpoints
115+
116+
| Network | REST API | RPC |
117+
|---------|----------|-----|
118+
| Mainnet | `https://nodes.manifest.network/manifest/api` | `https://nodes.manifest.network/manifest/rpc` |
119+
| Testnet | `https://nodes.liftedinit.tech/manifest/testnet/api` | `https://nodes.liftedinit.tech/manifest/testnet/rpc` |
120+
121+
For more information on network configurations, see:
122+
- [Mainnet Configuration](https://docs.manifest.network/network-configurations/mainnet)
123+
- [Testnet Configuration](https://docs.manifest.network/network-configurations/testnet)
124+
125+
### Prerequisites
126+
127+
#### Installing manifestd
128+
129+
To use RPC commands, you need `manifestd` installed. It is a CosmosSDK-based chain binary with CosmWasm enabled.
130+
131+
```bash
132+
# Clone and build from source
133+
git clone https://github.com/manifest-network/manifest-ledger
134+
cd manifest-ledger
135+
make install
136+
```
137+
138+
#### Base64 Encoding for REST Queries
139+
140+
REST API queries require the JSON query message to be base64-encoded. You can encode messages using:
141+
142+
```bash
143+
# Linux/macOS
144+
echo -n '{"config":{}}' | base64
145+
# Output: eyJjb25maWciOnt9fQ==
146+
147+
echo -n '{"admin":{}}' | base64
148+
# Output: eyJhZG1pbiI6e319
149+
```
150+
151+
### Query Examples
152+
153+
#### Get Contract Configuration
154+
155+
**Mainnet (REST)**
156+
```bash
157+
curl "https://nodes.manifest.network/manifest/api/cosmwasm/wasm/v1/contract/manifest1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqdnm0gk/smart/eyJjb25maWciOnt9fQ=="
158+
```
159+
160+
**Mainnet (RPC)**
161+
```bash
162+
manifestd q wasm contract-state smart manifest1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqdnm0gk '{"config":{}}' --node https://nodes.manifest.network/manifest/rpc
163+
```
164+
165+
**Testnet (REST)**
166+
```bash
167+
curl "https://nodes.liftedinit.tech/manifest/testnet/api/cosmwasm/wasm/v1/contract/manifest1c4p5p0eajlymxak8z5ugmksfpvp5zmm3scrwdrtd5a6mwxnhsa9qnsfftk/smart/eyJjb25maWciOnt9fQ=="
168+
```
169+
170+
**Testnet (RPC)**
171+
```bash
172+
manifestd q wasm contract-state smart manifest1c4p5p0eajlymxak8z5ugmksfpvp5zmm3scrwdrtd5a6mwxnhsa9qnsfftk '{"config":{}}' --node https://nodes.liftedinit.tech/manifest/testnet/rpc
173+
```
174+
175+
#### Get Contract Admin
176+
177+
**Mainnet (REST)**
178+
```bash
179+
curl "https://nodes.manifest.network/manifest/api/cosmwasm/wasm/v1/contract/manifest1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqdnm0gk/smart/eyJhZG1pbiI6e319"
180+
```
181+
182+
**Mainnet (RPC)**
183+
```bash
184+
manifestd q wasm contract-state smart manifest1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqdnm0gk '{"admin":{}}' --node https://nodes.manifest.network/manifest/rpc
185+
```
186+
187+
**Testnet (REST)**
188+
```bash
189+
curl "https://nodes.liftedinit.tech/manifest/testnet/api/cosmwasm/wasm/v1/contract/manifest1c4p5p0eajlymxak8z5ugmksfpvp5zmm3scrwdrtd5a6mwxnhsa9qnsfftk/smart/eyJhZG1pbiI6e319"
190+
```
191+
192+
**Testnet (RPC)**
193+
```bash
194+
manifestd q wasm contract-state smart manifest1c4p5p0eajlymxak8z5ugmksfpvp5zmm3scrwdrtd5a6mwxnhsa9qnsfftk '{"admin":{}}' --node https://nodes.liftedinit.tech/manifest/testnet/rpc
195+
```
196+
197+
### Execute Examples
198+
199+
Execute transactions require a wallet with funds to pay for gas fees. The examples below use `manifestd` with a configured wallet.
200+
201+
#### Convert Tokens
202+
203+
Convert source tokens to target tokens. You must send the source tokens as funds with the transaction.
204+
205+
**Mainnet**
206+
```bash
207+
manifestd tx wasm execute manifest1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqdnm0gk '{"convert":{}}' \
208+
--amount 1000000umfx \
209+
--from <your-wallet> \
210+
--gas auto \
211+
--gas-adjustment 1.5 \
212+
--gas-prices 1.0umfx \
213+
--node https://nodes.manifest.network/manifest/rpc \
214+
--chain-id manifest-ledger-mainnet
215+
```
216+
217+
**Testnet**
218+
```bash
219+
manifestd tx wasm execute manifest1c4p5p0eajlymxak8z5ugmksfpvp5zmm3scrwdrtd5a6mwxnhsa9qnsfftk '{"convert":{}}' \
220+
--amount 1000000umfx \
221+
--from <your-wallet> \
222+
--gas auto \
223+
--gas-adjustment 1.5 \
224+
--gas-prices 1.0umfx \
225+
--node https://nodes.liftedinit.tech/manifest/testnet/rpc \
226+
--chain-id manifest-ledger-testnet
227+
```
228+
229+
> **Note**: Replace `1000000umfx` with the actual source token denomination and amount configured in the contract. Query the contract configuration first to see the current `source_denom`.
230+
231+
#### Update Config (Admin Only)
232+
233+
Update the contract configuration. Only the contract admin can execute this.
234+
235+
**Mainnet**
236+
```bash
237+
manifestd tx wasm execute manifest1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqdnm0gk \
238+
'{"update_config":{"config":{"rate":"2.0","paused":false}}}' \
239+
--from <admin-wallet> \
240+
--gas auto \
241+
--gas-adjustment 1.5 \
242+
--gas-prices 1.0umfx \
243+
--node https://nodes.manifest.network/manifest/rpc \
244+
--chain-id manifest-ledger-mainnet
245+
```
246+
247+
**Testnet**
248+
```bash
249+
manifestd tx wasm execute manifest1c4p5p0eajlymxak8z5ugmksfpvp5zmm3scrwdrtd5a6mwxnhsa9qnsfftk \
250+
'{"update_config":{"config":{"rate":"2.0","paused":false}}}' \
251+
--from <admin-wallet> \
252+
--gas auto \
253+
--gas-adjustment 1.5 \
254+
--gas-prices 1.0umfx \
255+
--node https://nodes.liftedinit.tech/manifest/testnet/rpc \
256+
--chain-id manifest-ledger-testnet
257+
```
258+
259+
> **Note**: All fields in `update_config` are optional. Only include the fields you want to change.
260+
261+
#### Update Admin (Admin Only)
262+
263+
Transfer admin privileges to a new address. Only the current admin can execute this.
264+
265+
**Mainnet**
266+
```bash
267+
manifestd tx wasm execute manifest1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqdnm0gk \
268+
'{"update_admin":{"admin":"manifest1newadminaddress..."}}' \
269+
--from <current-admin-wallet> \
270+
--gas auto \
271+
--gas-adjustment 1.5 \
272+
--gas-prices 1.0umfx \
273+
--node https://nodes.manifest.network/manifest/rpc \
274+
--chain-id manifest-ledger-mainnet
275+
```
276+
277+
**Testnet**
278+
```bash
279+
manifestd tx wasm execute manifest1c4p5p0eajlymxak8z5ugmksfpvp5zmm3scrwdrtd5a6mwxnhsa9qnsfftk \
280+
'{"update_admin":{"admin":"manifest1newadminaddress..."}}' \
281+
--from <current-admin-wallet> \
282+
--gas auto \
283+
--gas-adjustment 1.5 \
284+
--gas-prices 1.0umfx \
285+
--node https://nodes.liftedinit.tech/manifest/testnet/rpc \
286+
--chain-id manifest-ledger-testnet
287+
```
288+
289+
> **Warning**: Admin transfer is irreversible. The contract does not allow renouncing admin privileges (setting admin to null).
290+
103291
## Development
104292

105293
### Building
@@ -124,3 +312,4 @@ Apache-2.0
124312

125313
- **Repository**: https://github.com/manifest-network/manifest-contracts
126314
- **Homepage**: https://manifest.network
315+
- **manifestd**: https://github.com/manifest-network/manifest-ledger

0 commit comments

Comments
 (0)