From 8460bf6aa878a9f765c546572e57b57372003ca8 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Sat, 10 Aug 2024 21:25:40 +0200 Subject: [PATCH 01/10] feat(diesel_table): oo_requests table definition --- src/schema.rs | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/schema.rs b/src/schema.rs index 3f8633d..eeaf600 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -1,5 +1,4 @@ // @generated automatically by Diesel CLI. - diesel::table! { future_entry (data_id) { #[max_length = 255] @@ -172,6 +171,42 @@ diesel::table! { } } + +diesel::table! { + oo_requests (data_id) { + #[max_length = 255] + network -> Varchar, + data_id -> Varchar, + assertion_id -> Varchar, + domain_id -> Varchar, + claim -> Text, + #[max_length = 255] + asserter -> Varchar, + #[max_length = 255] + disputer -> Varchar, + disputed -> Bool, + #[max_length = 255] + callback_recipient -> Varchar, + #[max_length = 255] + escalation_manager -> Varchar, + #[max_length = 255] + caller -> Varchar, + expiration_timestamp -> Numeric, + settlement_resolution -> Bool, + #[max_length = 255] + settle_caller -> Varchar, + #[max_length = 255] + currency -> Varchar, + bond -> Numeric, + _cursor -> Int8range, + identifier -> Varchar, + updated_at -> Timestamp, + #[max_length = 255] + updated_at_tx -> Varchar, + } +} + + diesel::allow_tables_to_appear_in_same_query!( future_entry, mainnet_future_entry, From 39fc854a8e33998ea97c1bb746e88ca4203ecf21 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Sun, 11 Aug 2024 01:36:47 +0200 Subject: [PATCH 02/10] feat(oo): model definition --- src/models.rs | 28 ++++++++++++++++++++++++++++ src/schema.rs | 6 +++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/models.rs b/src/models.rs index aec7198..3b19ad7 100644 --- a/src/models.rs +++ b/src/models.rs @@ -89,3 +89,31 @@ pub struct VrfRequest { pub _cursor: (Bound, Bound), pub data_id: String, } + + +#[derive(Queryable, Debug, QueryableByName, Selectable)] +#[diesel(primary_key(data_id))] +#[diesel(check_for_backend(diesel::pg::Pg))] +#[diesel(table_name = crate::schema::oo_requests)] +pub struct OORequest { + pub network: String, + pub data_id: String, + assertion_id: BigDecimal, + domain_id: BigDecimal, + claim: String, + asserter: String, + disputer: String, + disputed: bool, + callback_recipient: String, + escalation_manager: String, + caller: String, + expiration_timestamp: NaiveDateTime, + settlement_resolution: bool, + settle_caller: String, + currency: String, + bond: BigDecimal, + _cursor: (Bound, Bound), + identifier: String, + pub updated_at: NaiveDateTime, + pub updated_at_tx: String, +} \ No newline at end of file diff --git a/src/schema.rs b/src/schema.rs index eeaf600..267dd55 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -177,8 +177,8 @@ diesel::table! { #[max_length = 255] network -> Varchar, data_id -> Varchar, - assertion_id -> Varchar, - domain_id -> Varchar, + assertion_id -> Numeric, + domain_id -> Numeric, claim -> Text, #[max_length = 255] asserter -> Varchar, @@ -191,7 +191,7 @@ diesel::table! { escalation_manager -> Varchar, #[max_length = 255] caller -> Varchar, - expiration_timestamp -> Numeric, + expiration_timestamp -> Timestamp, settlement_resolution -> Bool, #[max_length = 255] settle_caller -> Varchar, From af9057c2696272c4c4285c30d6786487096d9252 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Sun, 11 Aug 2024 08:24:29 +0200 Subject: [PATCH 03/10] fix(oo): `OO_requests` pub oo members --- src/models.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/models.rs b/src/models.rs index 3b19ad7..e971486 100644 --- a/src/models.rs +++ b/src/models.rs @@ -98,22 +98,22 @@ pub struct VrfRequest { pub struct OORequest { pub network: String, pub data_id: String, - assertion_id: BigDecimal, - domain_id: BigDecimal, - claim: String, - asserter: String, - disputer: String, - disputed: bool, - callback_recipient: String, - escalation_manager: String, - caller: String, - expiration_timestamp: NaiveDateTime, - settlement_resolution: bool, - settle_caller: String, - currency: String, - bond: BigDecimal, - _cursor: (Bound, Bound), - identifier: String, + pub assertion_id: BigDecimal, + pub domain_id: BigDecimal, + pub claim: String, + pub asserter: String, + pub disputer: String, + pub disputed: bool, + pub callback_recipient: String, + pub escalation_manager: String, + pub caller: String, + pub expiration_timestamp: NaiveDateTime, + pub settlement_resolution: bool, + pub settle_caller: String, + pub currency: String, + pub bond: BigDecimal, + pub _cursor: (Bound, Bound), + pub identifier: String, pub updated_at: NaiveDateTime, pub updated_at_tx: String, } \ No newline at end of file From 0e8a4e050216a8023e91b66d975d7c4d3b045995 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Sun, 11 Aug 2024 18:39:02 +0200 Subject: [PATCH 04/10] feat(oo-schemas): add settled bool --- src/models.rs | 1 + src/schema.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/models.rs b/src/models.rs index e971486..3340e66 100644 --- a/src/models.rs +++ b/src/models.rs @@ -108,6 +108,7 @@ pub struct OORequest { pub escalation_manager: String, pub caller: String, pub expiration_timestamp: NaiveDateTime, + pub settled: bool, pub settlement_resolution: bool, pub settle_caller: String, pub currency: String, diff --git a/src/schema.rs b/src/schema.rs index 267dd55..4e44fb6 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -192,6 +192,7 @@ diesel::table! { #[max_length = 255] caller -> Varchar, expiration_timestamp -> Timestamp, + settled -> Bool, settlement_resolution -> Bool, #[max_length = 255] settle_caller -> Varchar, From f51c225bfcce4e4474b49e673e8f3b22a8e24421 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Sun, 11 Aug 2024 22:48:28 +0200 Subject: [PATCH 05/10] fix(oo): ids Bigdecimal -> String --- src/models.rs | 4 ++-- src/schema.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/models.rs b/src/models.rs index 3340e66..da222a5 100644 --- a/src/models.rs +++ b/src/models.rs @@ -98,8 +98,8 @@ pub struct VrfRequest { pub struct OORequest { pub network: String, pub data_id: String, - pub assertion_id: BigDecimal, - pub domain_id: BigDecimal, + pub assertion_id: String, + pub domain_id: String, pub claim: String, pub asserter: String, pub disputer: String, diff --git a/src/schema.rs b/src/schema.rs index 4e44fb6..68d4834 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -177,8 +177,8 @@ diesel::table! { #[max_length = 255] network -> Varchar, data_id -> Varchar, - assertion_id -> Numeric, - domain_id -> Numeric, + assertion_id -> Varchar, + domain_id -> Varchar, claim -> Text, #[max_length = 255] asserter -> Varchar, From 96ed6908b8c46d20dafb848e875febc88984822b Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Sun, 11 Aug 2024 23:28:19 +0200 Subject: [PATCH 06/10] fix(oo-schemas): parameters as nullable --- src/models.rs | 10 +++++----- src/schema.rs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/models.rs b/src/models.rs index da222a5..a0e46be 100644 --- a/src/models.rs +++ b/src/models.rs @@ -102,15 +102,15 @@ pub struct OORequest { pub domain_id: String, pub claim: String, pub asserter: String, - pub disputer: String, - pub disputed: bool, + pub disputer: Option, + pub disputed: Option, pub callback_recipient: String, pub escalation_manager: String, pub caller: String, pub expiration_timestamp: NaiveDateTime, - pub settled: bool, - pub settlement_resolution: bool, - pub settle_caller: String, + pub settled: Option, + pub settlement_resolution: Option, + pub settle_caller: Option, pub currency: String, pub bond: BigDecimal, pub _cursor: (Bound, Bound), diff --git a/src/schema.rs b/src/schema.rs index 68d4834..4504608 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -183,8 +183,8 @@ diesel::table! { #[max_length = 255] asserter -> Varchar, #[max_length = 255] - disputer -> Varchar, - disputed -> Bool, + disputer -> Nullable, + disputed -> Nullable, #[max_length = 255] callback_recipient -> Varchar, #[max_length = 255] @@ -192,10 +192,10 @@ diesel::table! { #[max_length = 255] caller -> Varchar, expiration_timestamp -> Timestamp, - settled -> Bool, - settlement_resolution -> Bool, + settled -> Nullable, + settlement_resolution -> Nullable, #[max_length = 255] - settle_caller -> Varchar, + settle_caller -> Nullable, #[max_length = 255] currency -> Varchar, bond -> Numeric, From 808d1ebb2725080b9ed481b12eb38808aaa58183 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 12 Aug 2024 00:03:30 +0200 Subject: [PATCH 07/10] fix(oo-schemas): expiration as bigInt --- src/models.rs | 2 +- src/schema.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models.rs b/src/models.rs index a0e46be..81c5fc2 100644 --- a/src/models.rs +++ b/src/models.rs @@ -107,7 +107,7 @@ pub struct OORequest { pub callback_recipient: String, pub escalation_manager: String, pub caller: String, - pub expiration_timestamp: NaiveDateTime, + pub expiration_timestamp: i64, pub settled: Option, pub settlement_resolution: Option, pub settle_caller: Option, diff --git a/src/schema.rs b/src/schema.rs index 4504608..481596f 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -191,7 +191,7 @@ diesel::table! { escalation_manager -> Varchar, #[max_length = 255] caller -> Varchar, - expiration_timestamp -> Timestamp, + expiration_timestamp -> BigInt, settled -> Nullable, settlement_resolution -> Nullable, #[max_length = 255] From bca97317b0b1178cc7e95acafda29210f9d9ea89 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 12 Aug 2024 00:26:06 +0200 Subject: [PATCH 08/10] fix(oo-schemas): bond as String --- src/models.rs | 2 +- src/schema.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models.rs b/src/models.rs index 81c5fc2..6b12067 100644 --- a/src/models.rs +++ b/src/models.rs @@ -112,7 +112,7 @@ pub struct OORequest { pub settlement_resolution: Option, pub settle_caller: Option, pub currency: String, - pub bond: BigDecimal, + pub bond: String, pub _cursor: (Bound, Bound), pub identifier: String, pub updated_at: NaiveDateTime, diff --git a/src/schema.rs b/src/schema.rs index 481596f..f280ff4 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -198,7 +198,7 @@ diesel::table! { settle_caller -> Nullable, #[max_length = 255] currency -> Varchar, - bond -> Numeric, + bond -> Varchar, _cursor -> Int8range, identifier -> Varchar, updated_at -> Timestamp, From 6e4f0359a5eab143bea5670864becee8f1e27554 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 12 Aug 2024 07:24:21 +0200 Subject: [PATCH 09/10] fix(oo-schemas): expiratioon timestamp as BigDecimal --- src/models.rs | 2 +- src/schema.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models.rs b/src/models.rs index 6b12067..9a71cee 100644 --- a/src/models.rs +++ b/src/models.rs @@ -107,7 +107,7 @@ pub struct OORequest { pub callback_recipient: String, pub escalation_manager: String, pub caller: String, - pub expiration_timestamp: i64, + pub expiration_timestamp: BigDecimal, pub settled: Option, pub settlement_resolution: Option, pub settle_caller: Option, diff --git a/src/schema.rs b/src/schema.rs index f280ff4..cac032a 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -191,7 +191,7 @@ diesel::table! { escalation_manager -> Varchar, #[max_length = 255] caller -> Varchar, - expiration_timestamp -> BigInt, + expiration_timestamp -> Numeric, settled -> Nullable, settlement_resolution -> Nullable, #[max_length = 255] From 442a9f3220d803154e6863143915bc4359b3c340 Mon Sep 17 00:00:00 2001 From: JordyRo1 Date: Mon, 12 Aug 2024 12:22:26 +0200 Subject: [PATCH 10/10] fix(oo-schemas): final modifications --- src/models.rs | 4 ++-- src/schema.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/models.rs b/src/models.rs index 9a71cee..a0e46be 100644 --- a/src/models.rs +++ b/src/models.rs @@ -107,12 +107,12 @@ pub struct OORequest { pub callback_recipient: String, pub escalation_manager: String, pub caller: String, - pub expiration_timestamp: BigDecimal, + pub expiration_timestamp: NaiveDateTime, pub settled: Option, pub settlement_resolution: Option, pub settle_caller: Option, pub currency: String, - pub bond: String, + pub bond: BigDecimal, pub _cursor: (Bound, Bound), pub identifier: String, pub updated_at: NaiveDateTime, diff --git a/src/schema.rs b/src/schema.rs index cac032a..4504608 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -191,14 +191,14 @@ diesel::table! { escalation_manager -> Varchar, #[max_length = 255] caller -> Varchar, - expiration_timestamp -> Numeric, + expiration_timestamp -> Timestamp, settled -> Nullable, settlement_resolution -> Nullable, #[max_length = 255] settle_caller -> Nullable, #[max_length = 255] currency -> Varchar, - bond -> Varchar, + bond -> Numeric, _cursor -> Int8range, identifier -> Varchar, updated_at -> Timestamp,