Compare commits
No commits in common. "master" and "v2.2.0-stable" have entirely different histories.
master
...
v2.2.0-sta
@ -43,10 +43,5 @@ func bootstrapRouter(handlerContainer *handler.Handler) *router.Router {
|
|||||||
handlerContainer.IndexOwnershipChange,
|
handlerContainer.IndexOwnershipChange,
|
||||||
)
|
)
|
||||||
|
|
||||||
router.RegisterRoute(
|
|
||||||
"TRACKER.INDEX_REMOVE",
|
|
||||||
handlerContainer.IndexRemove,
|
|
||||||
)
|
|
||||||
|
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
package handler
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/grassrootseconomics/eth-tracker/pkg/event"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (h *Handler) IndexRemove(ctx context.Context, event event.Event) error {
|
|
||||||
return h.store.RemoveContractAddress(ctx, event)
|
|
||||||
}
|
|
||||||
@ -39,8 +39,6 @@ type (
|
|||||||
InsertOwnershipChange string `query:"insert-ownership-change"`
|
InsertOwnershipChange string `query:"insert-ownership-change"`
|
||||||
InsertToken string `query:"insert-token"`
|
InsertToken string `query:"insert-token"`
|
||||||
InsertPool string `query:"insert-pool"`
|
InsertPool string `query:"insert-pool"`
|
||||||
RemovePool string `query:"remove-pool"`
|
|
||||||
RemoveToken string `query:"remove-token"`
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -249,30 +247,6 @@ func (pg *Pg) InsertPool(ctx context.Context, contractAddress string, name strin
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pg *Pg) RemoveContractAddress(ctx context.Context, eventPayload event.Event) error {
|
|
||||||
return pg.executeTransaction(ctx, func(tx pgx.Tx) error {
|
|
||||||
_, err := tx.Exec(
|
|
||||||
ctx,
|
|
||||||
pg.queries.RemovePool,
|
|
||||||
eventPayload.Payload["address"].(string),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = tx.Exec(
|
|
||||||
ctx,
|
|
||||||
pg.queries.RemoveToken,
|
|
||||||
eventPayload.Payload["address"].(string),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (pg *Pg) insertTx(ctx context.Context, tx pgx.Tx, eventPayload event.Event) (int, error) {
|
func (pg *Pg) insertTx(ctx context.Context, tx pgx.Tx, eventPayload event.Event) (int, error) {
|
||||||
var txID int
|
var txID int
|
||||||
if err := tx.QueryRow(
|
if err := tx.QueryRow(
|
||||||
|
|||||||
@ -18,7 +18,6 @@ type (
|
|||||||
InsertOwnershipChange(context.Context, event.Event) error
|
InsertOwnershipChange(context.Context, event.Event) error
|
||||||
InsertToken(context.Context, string, string, string, uint8, string) error
|
InsertToken(context.Context, string, string, string, uint8, string) error
|
||||||
InsertPool(context.Context, string, string, string) error
|
InsertPool(context.Context, string, string, string) error
|
||||||
RemoveContractAddress(context.Context, event.Event) error
|
|
||||||
Pool() *pgxpool.Pool
|
Pool() *pgxpool.Pool
|
||||||
Close()
|
Close()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
ALTER TABLE tokens
|
|
||||||
ADD COLUMN removed BOOLEAN NOT NULL DEFAULT false;
|
|
||||||
|
|
||||||
ALTER TABLE pools
|
|
||||||
ADD COLUMN removed BOOLEAN NOT NULL DEFAULT false;
|
|
||||||
@ -139,11 +139,3 @@ INSERT INTO pools(
|
|||||||
pool_name,
|
pool_name,
|
||||||
pool_symbol
|
pool_symbol
|
||||||
) VALUES ($1, $2, $3) ON CONFLICT DO NOTHING
|
) VALUES ($1, $2, $3) ON CONFLICT DO NOTHING
|
||||||
|
|
||||||
--name: remove-pool
|
|
||||||
-- $1: contract_address
|
|
||||||
UPDATE pools SET removed = true WHERE contract_address = $1
|
|
||||||
|
|
||||||
--name: remove-token
|
|
||||||
-- $1: contract_address
|
|
||||||
UPDATE tokens SET removed = true WHERE contract_address = $1
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user