Documentation
¶
Overview ¶
Package settlement handles asynchronous on-chain settlement of P2P tool invocation payments. It subscribes to ToolExecutionPaidEvent from the event bus and submits transferWithAuthorization transactions to the USDC contract.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Wallet wallet.WalletProvider
RPCClient *ethclient.Client
DBClient *ent.Client
ChainID int64
USDCAddr common.Address
ReceiptTimeout time.Duration // default: 2m
MaxRetries int // default: 3
Logger *zap.SugaredLogger
}
Config holds construction parameters for a settlement Service.
type ReputationRecorder ¶
type ReputationRecorder interface {
RecordSuccess(ctx context.Context, peerDID string) error
RecordFailure(ctx context.Context, peerDID string) error
}
ReputationRecorder records success/failure outcomes for reputation tracking.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service processes on-chain settlement for paid tool invocations.
func (*Service) Close ¶
func (s *Service) Close()
Close waits for all in-flight settlement goroutines to finish.
func (*Service) SetReputationRecorder ¶
func (s *Service) SetReputationRecorder(r ReputationRecorder)
SetReputationRecorder sets the reputation recorder for post-settlement success/failure tracking.
Click to show internal directories.
Click to hide internal directories.