Skip to content

Commit

Permalink
Change max_initial_pledges type from int to float64
Browse files Browse the repository at this point in the history
  • Loading branch information
strahe committed Oct 12, 2024
1 parent b2db969 commit a2e6917
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type createRequestArgs struct {
NewExpiration *abi.ChainEpoch `json:"new_expiration"` // new expiration to set
Tolerance *abi.ChainEpoch `json:"tolerance"` // tolerance for expiration
MaxSectors *int `json:"max_sectors"` // max sectors to include in a single message
MaxInitialPledges *int `json:"max_initial_pledges"` // max initial pledges to extend
MaxInitialPledges *float64 `json:"max_initial_pledges"` // max initial pledges to extend
DryRun bool `json:"dry_run"`
}

Expand Down
2 changes: 1 addition & 1 deletion model.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Request struct {
NewExpiration *abi.ChainEpoch `json:"new_expiration"`
Tolerance abi.ChainEpoch `json:"tolerance"`
MaxSectors int `json:"max_sectors"`
MaxInitialPledges int `json:"max_initial_pledges"`
MaxInitialPledges float64 `json:"max_initial_pledges"`
Status RequestStatus `gorm:"index" json:"status"`
Messages []*Message `json:"messages"`
TotalSectors int `json:"total_sectors"`
Expand Down
4 changes: 2 additions & 2 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (s *Service) processRequest(ctx context.Context, request *Request) error {

result, terr := s.extend(ctx, request.Miner.Address, fromEpoch, toEpoch,
request.Extension, request.NewExpiration, request.Tolerance,
request.MaxSectors, abi.TokenAmount(types.MustParseFIL(fmt.Sprintf("%d", request.MaxInitialPledges))), request.DryRun, sLog)
request.MaxSectors, abi.TokenAmount(types.MustParseFIL(fmt.Sprintf("%f", request.MaxInitialPledges))), request.DryRun, sLog)

if terr != nil {
request.Error = terr.Error()
Expand Down Expand Up @@ -247,7 +247,7 @@ func (s *Service) processRequest(ctx context.Context, request *Request) error {
}

func (s *Service) createRequest(ctx context.Context, minerAddr address.Address, from, to time.Time,
extension, newExpiration, tolerance *abi.ChainEpoch, maxSectors int, maxInitialPledges int, dryRun bool) (*Request, error) {
extension, newExpiration, tolerance *abi.ChainEpoch, maxSectors int, maxInitialPledges float64, dryRun bool) (*Request, error) {
if extension == nil && newExpiration == nil {
return nil, fmt.Errorf("either extension or new_expiration must be set")
}
Expand Down

0 comments on commit a2e6917

Please sign in to comment.