Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/swagger/swagger-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5664,6 +5664,7 @@ components:
- ticker
- decimals
- name
- dbc_pool
properties:
mint:
type: string
Expand Down Expand Up @@ -5691,6 +5692,10 @@ components:
type: string
description: The description of the coin
example: "A majestic bear token for wildlife conservation"
dbc_pool:
type: string
description: The address of the dynamic bonding curve pool associated with the coin
example: "2AAsAwNPTNBk5N466xyPiwqdgbc5WLbDTdnn9gVuDKaN"
create_coin_response:
type: object
properties:
Expand Down
6 changes: 4 additions & 2 deletions api/v1_create_coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type CreateCoinBody struct {
Name string `json:"name" validate:"required,min=1,max=32"`
LogoUri string `json:"logo_uri" validate:"omitempty,url"`
Description string `json:"description" validate:"max=2500"`
DbcPool string `json:"dbc_pool"`
}

func (app *ApiServer) v1CreateCoin(c *fiber.Ctx) error {
Expand Down Expand Up @@ -62,8 +63,8 @@ func (app *ApiServer) v1CreateCoin(c *fiber.Ctx) error {
}

sql := `
INSERT INTO artist_coins (mint, ticker, user_id, decimals, name, logo_uri, description)
VALUES (@mint, @ticker, @user_id, @decimals, @name, @logo_uri, @description)
INSERT INTO artist_coins (mint, ticker, user_id, decimals, name, logo_uri, description, dbc_pool)
VALUES (@mint, @ticker, @user_id, @decimals, @name, @logo_uri, @description, @dbc_pool)
RETURNING mint, ticker, user_id, decimals, name, logo_uri, description, created_at
`

Expand All @@ -75,6 +76,7 @@ func (app *ApiServer) v1CreateCoin(c *fiber.Ctx) error {
"name": body.Name,
"logo_uri": body.LogoUri,
"description": body.Description,
"dbc_pool": body.DbcPool,
})

var result struct {
Expand Down
17 changes: 0 additions & 17 deletions jobs/coin_dbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ func (j *CoinDBCJob) UpdatePool(ctx context.Context, poolPubkey solana.PublicKey
j.logger.Error("error inserting pool", zap.Error(err))
return fmt.Errorf("error inserting pool: %w", err)
}
err = j.UpdateCoinDbcPool(ctx, pool.BaseMint.String(), poolPubkey.String())
if err != nil {
j.logger.Error("error updating coin dbc_pool", zap.Error(err))
return fmt.Errorf("error updating coin dbc_pool: %w", err)
}
return nil
}

Expand Down Expand Up @@ -278,15 +273,3 @@ func (j *CoinDBCJob) UpsertPool(
})
return err
}

func (j *CoinDBCJob) UpdateCoinDbcPool(ctx context.Context, mint string, dbcPool string) error {
_, err := j.pool.Exec(ctx, `
UPDATE artist_coins
SET dbc_pool = @dbc_pool
WHERE mint = @mint
`, pgx.NamedArgs{
"mint": mint,
"dbc_pool": dbcPool,
})
return err
}
Loading