-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from anoma/ibc-events
Ibc events
- Loading branch information
Showing
31 changed files
with
646 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
-- This file should undo anything in `up.sql` | ||
|
||
DROP TABLE crawler_state; | ||
|
||
DROP TYPE CRAWLER_NAME; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- Your SQL goes here | ||
CREATE TYPE IBC_STATUS AS ENUM ('fail', 'success', 'timeout', 'unknown'); | ||
|
||
CREATE TABLE ibc_ack ( | ||
id VARCHAR PRIMARY KEY, | ||
tx_hash VARCHAR NOT NULL, | ||
timeout BIGINT NOT NULL, | ||
status IBC_STATUS NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
-- This file should undo anything in `up.sql` | ||
DROP TABLE ibc_ack; | ||
|
||
DROP TYPE IBC_STATUS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use diesel::prelude::Queryable; | ||
use diesel::{AsChangeset, Insertable, Selectable}; | ||
use serde::{Deserialize, Serialize}; | ||
use shared::transaction::{IbcAckStatus, IbcSequence}; | ||
|
||
use crate::schema::ibc_ack; | ||
|
||
#[derive(Debug, Clone, Serialize, Deserialize, diesel_derive_enum::DbEnum)] | ||
#[ExistingTypePath = "crate::schema::sql_types::IbcStatus"] | ||
pub enum IbcAckStatusDb { | ||
Unknown, | ||
Timeout, | ||
Fail, | ||
Success, | ||
} | ||
|
||
impl From<IbcAckStatus> for IbcAckStatusDb { | ||
fn from(value: IbcAckStatus) -> Self { | ||
match value { | ||
IbcAckStatus::Success => Self::Success, | ||
IbcAckStatus::Fail => Self::Fail, | ||
IbcAckStatus::Timeout => Self::Timeout, | ||
IbcAckStatus::Unknown => Self::Unknown, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Serialize, Queryable, Insertable, Selectable, Clone, Debug)] | ||
#[diesel(table_name = ibc_ack)] | ||
#[diesel(check_for_backend(diesel::pg::Pg))] | ||
pub struct IbcAckDb { | ||
pub id: String, | ||
pub tx_hash: String, | ||
pub timeout: i64, | ||
pub status: IbcAckStatusDb, | ||
} | ||
|
||
pub type IbcAckInsertDb = IbcAckDb; | ||
|
||
impl From<IbcSequence> for IbcAckInsertDb { | ||
fn from(value: IbcSequence) -> Self { | ||
Self { | ||
id: value.id(), | ||
tx_hash: value.tx_id.to_string(), | ||
timeout: value.timeout as i64, | ||
status: IbcAckStatusDb::Unknown, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Serialize, AsChangeset, Clone)] | ||
#[diesel(table_name = ibc_ack)] | ||
#[diesel(check_for_backend(diesel::pg::Pg))] | ||
pub struct IbcSequencekStatusUpdateDb { | ||
pub status: IbcAckStatusDb, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.