Skip to content

Admin apis for fees #866

@altafan

Description

@altafan

At the moment, restarting arkd is required to update the fee policies as they can be changed only via env vars.

Let's get rid of the env vars in favor of admin apis so that fee polices can be updated at runtime and prevent any service restart.

This task requires changes at pretty much all layers:

  • domain: add IntentFee domain and FeeRepository interface with CRUD apis:
type IntentFees struct {
   OnchainInputFee string
   OffchainInputFee string
   OnchainOutputFee string
   OffchainOutputFee string
}

type FeeRepository interface {
   GetIntentFees(ctx context.Context) (*IntentFees, error)
   UpsertIntentFees(ctx context.Context, fees IntentFees) error
   ClearIntentFees(ctx context.Context) error
   Close()
}
  • ports: add Fees() domain.FeeRepository api to repo manager
  • infrastructure: add implementations of domain.FeeRepository (badger, sqlite and postgres)
  • application: add CRUD apis to admin service for fee management
  • interface: add new rpcs GetIntentFees and UpdateIntentFees to admin.proto
  • config: drop existing env vars

NOTE: repo.UpsertIntentFees should take care of updating only the non-empty fields defined in the provided struct.

#380 can be taken as reference.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions