Skip to content

Commit

Permalink
Fixed param name same as contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Ngo committed Mar 22, 2024
1 parent 597d705 commit f6353de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
10 changes: 5 additions & 5 deletions contracts/feralfile-exhibition-v2/feralfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ func (c *FeralfileExhibitionV2Contract) Call(
return nil, fmt.Errorf("invalid operator params")
}

approve, ok := params[1].(bool)
approved, ok := params[1].(bool)
if !ok {
return nil, fmt.Errorf("invalid approve params")
return nil, fmt.Errorf("invalid approved params")
}

return contract.SetApprovalForAll(t, operator, approve)
return contract.SetApprovalForAll(t, operator, approved)
default:
return nil, fmt.Errorf("unsupported method")
}
Expand Down Expand Up @@ -280,13 +280,13 @@ func (c *FeralfileExhibitionV2Contract) Parse(
case "setApprovalForAll":
var params struct {
Operator common.Address `json:"operator"`
Approve bool `json:"approve"`
Approved bool `json:"approved"`
}
if err := json.Unmarshal(arguments, &params); err != nil {
return nil, err
}

return []interface{}{params.Operator, params.Approve}, nil
return []interface{}{params.Operator, params.Approved}, nil
default:
return nil, fmt.Errorf("unsupported method")
}
Expand Down
10 changes: 5 additions & 5 deletions contracts/feralfile-exhibition-v3/feralfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ func (c *FeralfileExhibitionV3Contract) Call(
return nil, fmt.Errorf("invalid operator params")
}

approve, ok := params[1].(bool)
approved, ok := params[1].(bool)
if !ok {
return nil, fmt.Errorf("invalid approve params")
return nil, fmt.Errorf("invalid approved params")
}

return contract.SetApprovalForAll(t, operator, approve)
return contract.SetApprovalForAll(t, operator, approved)
default:
return nil, fmt.Errorf("unsupported method")
}
Expand Down Expand Up @@ -342,13 +342,13 @@ func (c *FeralfileExhibitionV3Contract) Parse(
case "setApprovalForAll":
var params struct {
Operator common.Address `json:"operator"`
Approve bool `json:"approve"`
Approved bool `json:"approved"`
}
if err := json.Unmarshal(arguments, &params); err != nil {
return nil, err
}

return []interface{}{params.Operator, params.Approve}, nil
return []interface{}{params.Operator, params.Approved}, nil
default:
return nil, fmt.Errorf("unsupported method")
}
Expand Down
12 changes: 7 additions & 5 deletions contracts/feralfile-exhibition-v4/feralfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,14 @@ func (c *FeralfileExhibitionV4Contract) Call(
return nil, errors.New("Invalid operator")
}

approve, ok := params[1].(bool)
approved, ok := params[1].(bool)
if !ok {
return nil, errors.New("Invalid approve")
return nil, errors.New("Invalid approved")
}

return contract.SetApprovalForAll(t, operator, approve)
t.GasLimit = gasLimit

return contract.SetApprovalForAll(t, operator, approved)
default:
return nil, fmt.Errorf("unsupported method")
}
Expand Down Expand Up @@ -276,13 +278,13 @@ func (c *FeralfileExhibitionV4Contract) Parse(
case "setApprovalForAll":
var params struct {
Operator common.Address `json:"operator"`
Approve bool `json:"approve"`
Approved bool `json:"approved"`
}
if err := json.Unmarshal(arguments, &params); err != nil {
return nil, err
}

return []interface{}{params.Operator, params.Approve}, nil
return []interface{}{params.Operator, params.Approved}, nil
case "buyArtworks":
var params struct {
SaleData struct {
Expand Down

0 comments on commit f6353de

Please sign in to comment.