Skip to content

Commit

Permalink
Fixed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
backsapc committed Dec 25, 2024
1 parent ae244da commit 80301a1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion precompiles/async/IAsync.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ interface IAsync {
) external returns (uint64 futureId);

/// @dev Defines a method to query future by id.
/// @param futureId The pagination details
/// @param futureId The future id
/// @return response The future
function futureById(
uint64 futureId
Expand Down
2 changes: 1 addition & 1 deletion precompiles/async/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func newMsgAddFuture(args []interface{}, origin common.Address, method *abi.Meth

var input addFutureInput
if err := method.Inputs.Copy(&input, args); err != nil {
return nil, fmt.Errorf("error while unpacking args to keysBySpaceIdInput struct: %w", err)
return nil, fmt.Errorf("error while unpacking args to addFutureInput struct: %w", err)
}

return &acttypes.MsgAddFuture{
Expand Down
26 changes: 13 additions & 13 deletions precompiles/async/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import (
types "github.com/warden-protocol/wardenprotocol/warden/x/async/types/v1beta1"
)

// ActionsInput needed to unmarshal Pagination field and pass it to types.QueryActionsRequest
// FuturesInput needed to unmarshal Pagination field and pass it to types.QueryFuturesRequest
type FuturesInput struct {
Pagination query.PageRequest `abi:"pagination"`
Creator common.Address `abi:"creator"`
}

// FromResponse needed to map QueryActionsResponse to ActionsResponse
// FromResponse needed to map QueryFuturesResponse to FuturesResponse
func (r *FuturesResponse) FromResponse(res *types.QueryFuturesResponse) (FuturesResponse, error) {
if res != nil {
futures := make([]FutureResponse, 0, len(res.Futures))
for _, action := range res.Futures {
mappedFuture, err := mapFutureResponse(action)
for _, future := range res.Futures {
mappedFuture, err := mapFutureResponse(future)
if err != nil {
return FuturesResponse{}, err
}
Expand All @@ -36,12 +36,12 @@ func (r *FuturesResponse) FromResponse(res *types.QueryFuturesResponse) (Futures
return *r, nil
}

// FromResponse needed to map QueryActionByIdResponse to ActionByIdResponse
// FromResponse needed to map QueryPendingFuturesResponse to PendingFuturesResponse
func (r *PendingFuturesResponse) FromResponse(res *types.QueryPendingFuturesResponse) (PendingFuturesResponse, error) {
if res != nil {
futures := make([]Future, 0, len(res.Futures))
for _, action := range res.Futures {
mappedFuture, err := mapFuture(action)
for _, future := range res.Futures {
mappedFuture, err := mapFuture(future)
if err != nil {
return PendingFuturesResponse{}, err
}
Expand All @@ -56,7 +56,7 @@ func (r *PendingFuturesResponse) FromResponse(res *types.QueryPendingFuturesResp
return *r, nil
}

// FromResponse needed to map QueryActionByIdResponse to ActionByIdResponse
// FromResponse needed to map QueryFutureByIdResponse to FutureByIdResponse
func (r *FutureByIdResponse) FromResponse(res *types.QueryFutureByIdResponse) (FutureByIdResponse, error) {
if res != nil {
mappedFuture, err := mapFuture(res.Future)
Expand All @@ -70,17 +70,17 @@ func (r *FutureByIdResponse) FromResponse(res *types.QueryFutureByIdResponse) (F
return *r, nil
}

func mapFuture(action types.Future) (Future, error) {
creator, err := precommon.AddressFromBech32Str(action.Creator)
func mapFuture(future types.Future) (Future, error) {
creator, err := precommon.AddressFromBech32Str(future.Creator)
if err != nil {
return Future{}, fmt.Errorf("invalid creator: %w", err)
}

return Future{
Id: action.Id,
Id: future.Id,
Creator: creator,
Handler: action.Handler,
Input: action.Input,
Handler: future.Handler,
Input: future.Input,
}, nil
}

Expand Down

0 comments on commit 80301a1

Please sign in to comment.