Skip to content

Commit

Permalink
Parse scope ownership changes
Browse files Browse the repository at this point in the history
* Added Encryption dependency for signature parsing
* Added migration to track ownership changes

closes: #247
  • Loading branch information
Carolyn Russell committed Nov 19, 2021
1 parent ff3f143 commit 896a523
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 6 deletions.
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ object Versions {
const val KotlinGrpc = "1.2.0"
const val GrpcStarter = "4.5.6"
const val Postgres = "42.2.23"
const val Encryption = "0.4.0"

// Testing
const val Jupiter = "5.7.1"
Expand Down Expand Up @@ -94,6 +95,7 @@ object Libraries {
const val ApacheCommonsText = "org.apache.commons:commons-text:${Versions.ApacheCommonsText}"
const val Khttp = "khttp:khttp:${Versions.Khttp}"
const val KaseChange = "net.pearx.kasechange:kasechange:${Versions.KaseChange}"
const val Encryption = "io.provenance.scope:encryption:${Versions.Encryption}"

// Logging
const val LogbackCore = "ch.qos.logback.contrib:logback-json-core:${Versions.Logback}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
SELECT 'Add nft_scope_value_owner_transfer' AS comment;
CREATE TABLE IF NOT EXISTS nft_scope_value_owner_transfer
(
id SERIAL PRIMARY KEY,
scope_id INT NOT NULL,
scope_addr VARCHAR(128) NOT NULL,
address VARCHAR(256) NOT NULL,
tx_id INT NOT NULL,
block_height INT NOT NULL,
tx_hash VARCHAR(64) NOT NULL
);

CREATE UNIQUE INDEX IF NOT EXISTS nft_scope_vo_transfer_scope_address_tx_idx
ON nft_scope_value_owner_transfer (scope_id, address, tx_id);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_scope_id_idx ON nft_scope_value_owner_transfer (scope_id);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_scope_addr_idx ON nft_scope_value_owner_transfer (scope_addr);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_address_idx ON nft_scope_value_owner_transfer (address);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_block_height_idx ON nft_scope_value_owner_transfer (block_height);


SELECT 'Add nft_scope_owner_changes' AS comment;
CREATE TABLE IF NOT EXISTS nft_scope_owner_changes
(
id SERIAL PRIMARY KEY,
scope_id INT NOT NULL,
scope_addr VARCHAR(128) NOT NULL,
address VARCHAR(256) NOT NULL,
role VARCHAR(256) NOT NULL,
tx_id INT NOT NULL,
block_height INT NOT NULL,
tx_hash VARCHAR(64) NOT NULL
);

CREATE UNIQUE INDEX IF NOT EXISTS nft_scope_owner_changes_scope_address_role_tx_idx
ON nft_scope_owner_changes (scope_id, address, role, tx_id);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_scope_id_idx ON nft_scope_owner_changes (scope_id);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_scope_addr_idx ON nft_scope_owner_changes (scope_addr);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_address_idx ON nft_scope_owner_changes (address);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_block_height_idx ON nft_scope_owner_changes (block_height);

SELECT 'Add nft_scope_owner_changes' AS comment;
CREATE TABLE IF NOT EXISTS nft_scope_owner_changes
(
id SERIAL PRIMARY KEY,
scope_id INT NOT NULL,
scope_addr VARCHAR(128) NOT NULL,
address VARCHAR(256),
role VARCHAR(256) NOT NULL,
tx_id INT NOT NULL,
block_height INT NOT NULL,
tx_hash VARCHAR(64) NOT NULL
);

CREATE UNIQUE INDEX IF NOT EXISTS nft_scope_owner_changes_scope_address_role_tx_idx
ON nft_scope_owner_changes (scope_id, address, role, tx_id);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_scope_id_idx ON nft_scope_owner_changes (scope_id);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_scope_addr_idx ON nft_scope_owner_changes (scope_addr);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_address_idx ON nft_scope_owner_changes (address);
CREATE INDEX IF NOT EXISTS nft_scope_vo_transfer_block_height_idx ON nft_scope_owner_changes (block_height);
4 changes: 4 additions & 0 deletions service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ dependencies {
api(Libraries.ApacheCommonsText)
api(Libraries.Khttp)
implementation(Libraries.KaseChange)
api(Libraries.Encryption) {
exclude("io.provenance.scope", "contract-proto")
exclude("io.provenance.protobuf", "pb-proto-java")
}

implementation(Libraries.GrpcNetty)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class AccountGrpcClient(channelUri: URI) {
it.usePlaintext()
}
}
.idleTimeout(5, TimeUnit.MINUTES)
.keepAliveTime(60, TimeUnit.SECONDS)
.keepAliveTimeout(20, TimeUnit.SECONDS)
.idleTimeout(60, TimeUnit.SECONDS)
.keepAliveTime(10, TimeUnit.SECONDS)
.keepAliveTimeout(10, TimeUnit.SECONDS)
.intercept(GrpcLoggingInterceptor())
.build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class MarkerGrpcClient(channelUri: URI, private val semaphore: Semaphore) {
it.usePlaintext()
}
}
.idleTimeout(5, TimeUnit.MINUTES)
.keepAliveTime(60, TimeUnit.SECONDS)
.keepAliveTimeout(20, TimeUnit.SECONDS)
.idleTimeout(60, TimeUnit.SECONDS)
.keepAliveTime(10, TimeUnit.SECONDS)
.keepAliveTimeout(10, TimeUnit.SECONDS)
.intercept(GrpcLoggingInterceptor())
.build()

Expand Down

0 comments on commit 896a523

Please sign in to comment.