Skip to content

Commit

Permalink
Assets duplication allowed. (#135)
Browse files Browse the repository at this point in the history
* Assets duplication allowed.

* Unconfirmed assets duplication allowed.
  • Loading branch information
oskin1 authored May 30, 2021
1 parent f7cb63e commit ca6b3a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val commonSettings = Seq(
scalacOptions ++= commonScalacOptions,
scalaVersion := "2.12.13",
organization := "org.ergoplatform",
version := "8.0.0-M2",
version := "8.0.0-M3",
resolvers += Resolver.sonatypeRepo("public"),
resolvers += Resolver.sonatypeRepo("snapshots"),
libraryDependencies ++= dependencies.Testing ++ dependencies.CompilerPlugins,
Expand Down
4 changes: 2 additions & 2 deletions modules/explorer-core/src/main/resources/db/V8__Schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ CREATE TABLE node_assets
header_id VARCHAR(64) NOT NULL,
index INTEGER NOT NULL,
value BIGINT NOT NULL,
PRIMARY KEY (token_id, box_id, header_id)
PRIMARY KEY (index, token_id, box_id, header_id)
);

CREATE INDEX "node_assets__box_id" ON node_assets (box_id);
Expand Down Expand Up @@ -260,7 +260,7 @@ CREATE TABLE node_u_assets
box_id VARCHAR(64) NOT NULL REFERENCES node_u_outputs (box_id) ON DELETE CASCADE,
index INTEGER NOT NULL,
value BIGINT NOT NULL,
PRIMARY KEY (token_id, box_id)
PRIMARY KEY (index, token_id, box_id)
);

CREATE INDEX "node_u_assets__box_id" ON node_u_assets (box_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object AssetQuerySet extends QuerySet {

def getAllByBoxId(boxId: BoxId)(implicit lh: LogHandler): Query0[ExtendedAsset] =
sql"""
|select distinct on (a.token_id, a.box_id)
|select distinct on (a.index, a.token_id, a.box_id)
| a.token_id,
| a.box_id,
| a.header_id,
Expand All @@ -42,7 +42,7 @@ object AssetQuerySet extends QuerySet {

def getAllByBoxIds(boxIds: NonEmptyList[BoxId])(implicit lh: LogHandler): Query0[ExtendedAsset] =
(sql"""
|select distinct on (a.token_id, a.box_id)
|select distinct on (a.index, a.token_id, a.box_id)
| a.token_id,
| a.box_id,
| a.header_id,
Expand All @@ -59,7 +59,7 @@ object AssetQuerySet extends QuerySet {

def getAllMainUnspentByErgoTree(ergoTree: HexString)(implicit lh: LogHandler): Query0[ExtendedAsset] =
sql"""
|select distinct on (a.token_id, a.box_id)
|select distinct on (a.index, a.token_id, a.box_id)
| a.token_id,
| a.box_id,
| a.header_id,
Expand All @@ -85,7 +85,7 @@ object AssetQuerySet extends QuerySet {
sql"""
|select agg.token_id, agg.total, t.name, t.decimals from (
| select ia.token_id, sum(ia.value) as total from (
| select distinct on (a.token_id, a.box_id)
| select distinct on (a.index, a.token_id, a.box_id)
| a.token_id,
| a.box_id,
| a.value
Expand Down

0 comments on commit ca6b3a4

Please sign in to comment.