Skip to content

Commit ffce4d5

Browse files
authored
Merge pull request #20 from octopus-network/v0.5.x
Upgrade to `v0.5.3`.
2 parents 95cec89 + 31742b4 commit ffce4d5

File tree

5 files changed

+24
-84
lines changed

5 files changed

+24
-84
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ree-types"
3-
version = "0.5.1"
3+
version = "0.5.3"
44
edition = "2021"
55
license = "MIT"
66
homepage = "https://www.omnity.network/"

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
This repository contains the essential data type definitions for REE (Runes Exchange Environment).
44

5+
## Versions
6+
7+
This crate depends the `ic-cdk` crate, here are the versions of `ic-cdk` that this crate is compatible with:
8+
9+
| ree-types Version | ic-cdk Version |
10+
|-------------------|----------------|
11+
| 0.6.x | 0.18.x |
12+
| 0.5.x | 0.17.x |
13+
514
## Exchange Interfaces
615

716
In REE, every exchange must implement the following six functions:
@@ -93,9 +102,21 @@ Parameters:
93102
```rust
94103
pub struct RollbackTxArgs {
95104
pub txid: Txid,
105+
pub reason_code: String
96106
}
97107
```
98108

109+
Where the `reason_code` will be one of the following:
110+
111+
| Rollback Reason Code | Description |
112+
|---------|---------|
113+
| 01 | Transaction rejected by Mempool |
114+
| 02 | Rollback by Orchestrator Admin |
115+
| 03 | Final Bitcoin transaction is not valid |
116+
| 04 | An exchange returned error |
117+
| 05 | An exchange returned invalid PSBT data |
118+
| 99 | Unknown reason, check Orchestrator logs |
119+
99120
Return Type:
100121

101122
- `Ok(())`: On success.

src/exchange_interfaces.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub type ExecuteTxResponse = Result<String, String>;
5656
#[derive(CandidType, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
5757
pub struct RollbackTxArgs {
5858
pub txid: Txid,
59+
pub reason_code: String,
5960
}
6061

6162
/// The response for the `rollback_tx` function.

src/orchestrator_interfaces.rs

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -17,92 +17,10 @@ pub struct InvokeArgs {
1717
pub initiator_utxo_proof: Vec<u8>,
1818
}
1919

20-
pub type InvokeStatusSubCode = u8;
21-
22-
/// Invoke status code to be used in the response of invoke function,
23-
/// will be formatted as a string before returning to the caller
24-
///
25-
/// 3xx - Latency caused errors, may be retried
26-
/// 4xx - InvokeArgs errors
27-
/// 5xx - Orchestrator errors
28-
/// 7xx - Exchange errors
29-
#[derive(CandidType, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
30-
pub enum InvokeStatus {
31-
_200,
32-
_301,
33-
_401(InvokeStatusSubCode),
34-
_402(InvokeStatusSubCode),
35-
_403,
36-
_404,
37-
_405,
38-
_406,
39-
_407,
40-
_408,
41-
_409(InvokeStatusSubCode),
42-
_410(InvokeStatusSubCode),
43-
_411,
44-
_412,
45-
_413(InvokeStatusSubCode),
46-
_414(InvokeStatusSubCode),
47-
_415(InvokeStatusSubCode),
48-
_501,
49-
_502(InvokeStatusSubCode),
50-
_503(String),
51-
_504(String),
52-
_505(InvokeStatusSubCode),
53-
_506(String),
54-
_599(String),
55-
_701 { exchange_id: String, error: String },
56-
_702 { exchange_id: String, error: String },
57-
_703(InvokeStatusSubCode),
58-
_704(InvokeStatusSubCode),
59-
}
60-
6120
/// If successful, returns the txid of the transaction broadcasted,
6221
/// otherwise returns the formatted status message
6322
pub type InvokeResponse = Result<String, String>;
6423

65-
impl core::fmt::Display for InvokeStatus {
66-
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
67-
match self {
68-
InvokeStatus::_200 => write!(f, "200"),
69-
InvokeStatus::_301 => write!(f, "301"),
70-
InvokeStatus::_401(sub_code) => write!(f, "401:{:03}", sub_code),
71-
InvokeStatus::_402(sub_code) => write!(f, "402:{:03}", sub_code),
72-
InvokeStatus::_403 => write!(f, "403"),
73-
InvokeStatus::_404 => write!(f, "404"),
74-
InvokeStatus::_405 => write!(f, "405"),
75-
InvokeStatus::_406 => write!(f, "406"),
76-
InvokeStatus::_407 => write!(f, "407"),
77-
InvokeStatus::_408 => write!(f, "408"),
78-
InvokeStatus::_409(sub_code) => write!(f, "409:{:03}", sub_code),
79-
InvokeStatus::_410(sub_code) => write!(f, "410:{:03}", sub_code),
80-
InvokeStatus::_411 => write!(f, "411"),
81-
InvokeStatus::_412 => write!(f, "412"),
82-
InvokeStatus::_413(sub_code) => write!(f, "413:{:03}", sub_code),
83-
InvokeStatus::_414(sub_code) => write!(f, "414:{:03}", sub_code),
84-
InvokeStatus::_415(sub_code) => write!(f, "415:{:03}", sub_code),
85-
InvokeStatus::_501 => write!(f, "501"),
86-
InvokeStatus::_502(sub_code) => write!(f, "502:{:03}", sub_code),
87-
InvokeStatus::_503(msg) => write!(f, "503: {}", msg),
88-
InvokeStatus::_504(msg) => write!(f, "504: {}", msg),
89-
InvokeStatus::_505(sub_code) => write!(f, "505:{:03}", sub_code),
90-
InvokeStatus::_506(msg) => write!(f, "506: {}", msg),
91-
InvokeStatus::_599(txid) => {
92-
write!(f, "599: Txid: {}", txid)
93-
}
94-
InvokeStatus::_701 { exchange_id, error } => {
95-
write!(f, "701: Exchange id: {}, error: {}", exchange_id, error)
96-
}
97-
InvokeStatus::_702 { exchange_id, error } => {
98-
write!(f, "702: Exchange id: {}, error: {}", exchange_id, error)
99-
}
100-
InvokeStatus::_703(sub_code) => write!(f, "703:{:03}", sub_code),
101-
InvokeStatus::_704(sub_code) => write!(f, "704:{:03}", sub_code),
102-
}
103-
}
104-
}
105-
10624
pub const TESTNET4_ORCHESTRATOR_CANISTER: &'static str = "hvyp5-5yaaa-aaaao-qjxha-cai";
10725
// mainnet orchestrator
10826
pub const ORCHESTRATOR_CANISTER: &'static str = "kqs64-paaaa-aaaar-qamza-cai";

0 commit comments

Comments
 (0)