Skip to content

Commit

Permalink
fix deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
slandymani committed Oct 9, 2024
1 parent fc0a579 commit 8dbef43
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 35 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions modules/bank/source/local/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s Source) GetBalances(addresses []string, height int64) ([]types.AccountBa

var balances []types.AccountBalance
for _, address := range addresses {
res, err := s.q.AllBalances(sdk.WrapSDKContext(ctx), &banktypes.QueryAllBalancesRequest{Address: address})
res, err := s.q.AllBalances(ctx, &banktypes.QueryAllBalancesRequest{Address: address})
if err != nil {
return nil, err
}
Expand All @@ -63,7 +63,7 @@ func (s Source) GetSupply(height int64) (sdk.Coins, error) {
var stop = false
for !stop {
res, err := s.q.TotalSupply(
sdk.WrapSDKContext(ctx),
ctx,
&banktypes.QueryTotalSupplyRequest{
Pagination: &query.PageRequest{
Key: nextKey,
Expand All @@ -89,7 +89,7 @@ func (s Source) GetAccountBalance(address string, height int64) ([]sdk.Coin, err
return nil, fmt.Errorf("error while loading height: %s", err)
}

balRes, err := s.q.AllBalances(sdk.WrapSDKContext(ctx), &banktypes.QueryAllBalancesRequest{Address: address})
balRes, err := s.q.AllBalances(ctx, &banktypes.QueryAllBalancesRequest{Address: address})
if err != nil {
return nil, fmt.Errorf("error while getting all balances: %s", err)
}
Expand Down
10 changes: 5 additions & 5 deletions modules/distribution/source/local/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (s Source) ValidatorCommission(valOperAddr string, height int64) (sdk.DecCo
}

res, err := s.q.ValidatorCommission(
sdk.WrapSDKContext(ctx),
ctx,
&distrtypes.QueryValidatorCommissionRequest{ValidatorAddress: valOperAddr},
)
if err != nil {
Expand All @@ -53,7 +53,7 @@ func (s Source) DelegatorTotalRewards(delegator string, height int64) ([]distrty
}

res, err := s.q.DelegationTotalRewards(
sdk.WrapSDKContext(ctx),
ctx,
&distrtypes.QueryDelegationTotalRewardsRequest{DelegatorAddress: delegator},
)
if err != nil {
Expand All @@ -71,7 +71,7 @@ func (s Source) DelegatorWithdrawAddress(delegator string, height int64) (string
}

res, err := s.q.DelegatorWithdrawAddress(
sdk.WrapSDKContext(ctx),
ctx,
&distrtypes.QueryDelegatorWithdrawAddressRequest{DelegatorAddress: delegator},
)
if err != nil {
Expand All @@ -88,7 +88,7 @@ func (s Source) CommunityPool(height int64) (sdk.DecCoins, error) {
return nil, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.q.CommunityPool(sdk.WrapSDKContext(ctx), &distrtypes.QueryCommunityPoolRequest{})
res, err := s.q.CommunityPool(ctx, &distrtypes.QueryCommunityPoolRequest{})
if err != nil {
return nil, err
}
Expand All @@ -103,7 +103,7 @@ func (s Source) Params(height int64) (distrtypes.Params, error) {
return distrtypes.Params{}, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.q.Params(sdk.WrapSDKContext(ctx), &distrtypes.QueryParamsRequest{})
res, err := s.q.Params(ctx, &distrtypes.QueryParamsRequest{})
if err != nil {
return distrtypes.Params{}, err
}
Expand Down
9 changes: 4 additions & 5 deletions modules/gov/source/local/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package local
import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/forbole/juno/v6/node/local"

Expand Down Expand Up @@ -35,7 +34,7 @@ func (s Source) Proposal(height int64, id uint64) (*govtypesv1.Proposal, error)
return nil, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.queryClient.Proposal(sdk.WrapSDKContext(ctx), &govtypesv1.QueryProposalRequest{ProposalId: id})
res, err := s.queryClient.Proposal(ctx, &govtypesv1.QueryProposalRequest{ProposalId: id})
if err != nil {
return nil, err
}
Expand All @@ -50,7 +49,7 @@ func (s Source) ProposalDeposit(height int64, id uint64, depositor string) (*gov
return nil, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.queryClient.Deposit(sdk.WrapSDKContext(ctx), &govtypesv1.QueryDepositRequest{ProposalId: id, Depositor: depositor})
res, err := s.queryClient.Deposit(ctx, &govtypesv1.QueryDepositRequest{ProposalId: id, Depositor: depositor})
if err != nil {
return nil, err
}
Expand All @@ -65,7 +64,7 @@ func (s Source) TallyResult(height int64, proposalID uint64) (*govtypesv1.TallyR
return nil, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.queryClient.TallyResult(sdk.WrapSDKContext(ctx), &govtypesv1.QueryTallyResultRequest{ProposalId: proposalID})
res, err := s.queryClient.TallyResult(ctx, &govtypesv1.QueryTallyResultRequest{ProposalId: proposalID})
if err != nil {
return nil, err
}
Expand All @@ -80,7 +79,7 @@ func (s Source) Params(height int64) (*govtypesv1.Params, error) {
return nil, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.queryClient.Params(sdk.WrapSDKContext(ctx), &govtypesv1.QueryParamsRequest{ParamsType: govtypesv1.ParamDeposit})
res, err := s.queryClient.Params(ctx, &govtypesv1.QueryParamsRequest{ParamsType: govtypesv1.ParamDeposit})
if err != nil {
return nil, err
}
Expand Down
5 changes: 5 additions & 0 deletions modules/oracle/handle_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ var msgFilter = map[string]bool{
"/oracle.v1.MsgActivate": true,
}

// HandleMsgExec implements modules.AuthzMessageModule
func (m *Module) HandleMsgExec(index int, _ int, executedMsg juno.Message, tx *juno.Transaction) error {
return m.HandleMsg(index, executedMsg, tx)
}

func (m *Module) HandleMsg(_ int, msg juno.Message, tx *juno.Transaction) error {
if _, ok := msgFilter[msg.GetType()]; !ok {
return nil
Expand Down
1 change: 1 addition & 0 deletions modules/oracle/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var (
_ modules.GenesisModule = &Module{}
_ modules.BlockModule = &Module{}
_ modules.MessageModule = &Module{}
_ modules.AuthzMessageModule = &Module{}
_ modules.PeriodicOperationsModule = &Module{}
)

Expand Down
17 changes: 8 additions & 9 deletions modules/oracle/source/local/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"

oracletypes "github.com/ODIN-PROTOCOL/odin-core/x/oracle/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"
"github.com/forbole/juno/v6/node/local"
"github.com/forbole/juno/v6/node/remote"
Expand Down Expand Up @@ -38,7 +37,7 @@ func (s *Source) GetParams(height int64) (oracletypes.Params, error) {
return oracletypes.Params{}, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.client.Params(sdk.WrapSDKContext(ctx), &oracletypes.QueryParamsRequest{})
res, err := s.client.Params(ctx, &oracletypes.QueryParamsRequest{})
if err != nil {
return oracletypes.Params{}, fmt.Errorf("error while getting params: %s", err)
}
Expand All @@ -53,7 +52,7 @@ func (s *Source) GetRequestStatus(height, id int64) (oracletypes.Result, error)
}

res, err := s.client.Request(
remote.GetHeightRequestContext(sdk.WrapSDKContext(ctx), height),
remote.GetHeightRequestContext(ctx, height),
&oracletypes.QueryRequestRequest{RequestId: uint64(id)},
)
if err != nil {
Expand All @@ -74,7 +73,7 @@ func (s *Source) GetDataSourcesInfo(height int64) ([]oracletypes.DataSource, err
var stop = false
for !stop {
res, err := s.client.DataSources(
sdk.WrapSDKContext(ctx),
ctx,
&oracletypes.QueryDataSourcesRequest{
Pagination: &query.PageRequest{
Key: nextKey,
Expand All @@ -101,7 +100,7 @@ func (s *Source) GetDataSourceInfo(height, id int64) (oracletypes.DataSource, er
}

response, err := s.client.DataSource(
sdk.WrapSDKContext(ctx),
ctx,
&oracletypes.QueryDataSourceRequest{
DataSourceId: uint64(id),
},
Expand All @@ -120,7 +119,7 @@ func (s *Source) GetRequestInfo(height, id int64) (oracletypes.RequestResult, er
}

response, err := s.client.Request(
sdk.WrapSDKContext(ctx),
ctx,
&oracletypes.QueryRequestRequest{
RequestId: uint64(id),
},
Expand Down Expand Up @@ -149,7 +148,7 @@ func (s *Source) GetRequestsInfo(height int64) ([]oracletypes.RequestResult, err
var stop = false
for !stop {
res, err := s.client.Requests(
sdk.WrapSDKContext(ctx),
ctx,
&oracletypes.QueryRequestsRequest{
Pagination: &query.PageRequest{
Key: nextKey,
Expand All @@ -176,7 +175,7 @@ func (s *Source) GetOracleScriptInfo(height, id int64) (oracletypes.OracleScript
}

res, err := s.client.OracleScript(
sdk.WrapSDKContext(ctx),
ctx,
&oracletypes.QueryOracleScriptRequest{
OracleScriptId: uint64(id),
},
Expand All @@ -199,7 +198,7 @@ func (s *Source) GetOracleScriptsInfo(height int64) ([]oracletypes.OracleScript,
var stop = false
for !stop {
res, err := s.client.OracleScripts(
sdk.WrapSDKContext(ctx),
ctx,
&oracletypes.QueryOracleScriptsRequest{
Pagination: &query.PageRequest{
Key: nextKey,
Expand Down
6 changes: 3 additions & 3 deletions modules/slashing/source/local/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (s Source) GetSigningInfos(height int64) ([]slashingtypes.ValidatorSigningI
var stop = false
for !stop {
res, err := s.querier.SigningInfos(
sdk.WrapSDKContext(ctx),
ctx,
&slashingtypes.QuerySigningInfosRequest{
Pagination: &query.PageRequest{
Key: nextKey,
Expand All @@ -68,7 +68,7 @@ func (s Source) GetParams(height int64) (slashingtypes.Params, error) {
return slashingtypes.Params{}, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.querier.Params(sdk.WrapSDKContext(ctx), &slashingtypes.QueryParamsRequest{})
res, err := s.querier.Params(ctx, &slashingtypes.QueryParamsRequest{})
if err != nil {
return slashingtypes.Params{}, nil
}
Expand All @@ -84,7 +84,7 @@ func (s Source) GetSigningInfo(height int64, consAddr sdk.ConsAddress) (slashing
}

res, err := s.querier.SigningInfo(
sdk.WrapSDKContext(ctx),
ctx,
&slashingtypes.QuerySigningInfoRequest{
ConsAddress: consAddr.String(),
},
Expand Down
20 changes: 10 additions & 10 deletions modules/staking/source/local/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (s Source) GetValidator(height int64, valOper string) (stakingtypes.Validat
return stakingtypes.Validator{}, fmt.Errorf("error while loading height: %s", err)
}

res, err := s.q.Validator(sdk.WrapSDKContext(ctx), &stakingtypes.QueryValidatorRequest{ValidatorAddr: valOper})
res, err := s.q.Validator(ctx, &stakingtypes.QueryValidatorRequest{ValidatorAddr: valOper})
if err != nil {
return stakingtypes.Validator{}, fmt.Errorf("error while reading validator: %s", err)
}
Expand All @@ -51,7 +51,7 @@ func (s Source) GetDelegationsTotal(height int64, address string) (sdk.Coins, er
}

res, err := s.q.DelegatorDelegations(
sdk.WrapSDKContext(ctx),
ctx,
&stakingtypes.QueryDelegatorDelegationsRequest{
DelegatorAddr: address,
},
Expand All @@ -76,7 +76,7 @@ func (s Source) GetDelegationsWithPagination(height int64, delegator string, pag
}

res, err := s.q.DelegatorDelegations(
sdk.WrapSDKContext(ctx),
ctx,
&stakingtypes.QueryDelegatorDelegationsRequest{
DelegatorAddr: delegator,
Pagination: &query.PageRequest{
Expand All @@ -100,7 +100,7 @@ func (s Source) GetRedelegations(height int64, request *stakingtypes.QueryRedele
return nil, fmt.Errorf("error while loading height: %s", err)
}

redelegations, err := s.q.Redelegations(sdk.WrapSDKContext(ctx), request)
redelegations, err := s.q.Redelegations(ctx, request)
if err != nil {
return nil, err
}
Expand All @@ -120,7 +120,7 @@ func (s Source) GetValidatorsWithStatus(height int64, status string) ([]stakingt
var stop = false
for !stop {
res, err := s.q.Validators(
sdk.WrapSDKContext(ctx),
ctx,
&stakingtypes.QueryValidatorsRequest{
Status: status,
Pagination: &query.PageRequest{
Expand Down Expand Up @@ -149,7 +149,7 @@ func (s Source) GetPool(height int64) (stakingtypes.Pool, error) {
}

res, err := s.q.Pool(
sdk.WrapSDKContext(ctx),
ctx,
&stakingtypes.QueryPoolRequest{},
)
if err != nil {
Expand All @@ -167,7 +167,7 @@ func (s Source) GetParams(height int64) (stakingtypes.Params, error) {
}

res, err := s.q.Params(
sdk.WrapSDKContext(ctx),
ctx,
&stakingtypes.QueryParamsRequest{},
)
if err != nil {
Expand All @@ -186,7 +186,7 @@ func (s Source) GetUnbondingDelegations(height int64, delegator string, paginati
}

unbondingDelegations, err := s.q.DelegatorUnbondingDelegations(
sdk.WrapSDKContext(ctx),
ctx,
&stakingtypes.QueryDelegatorUnbondingDelegationsRequest{
DelegatorAddr: delegator,
Pagination: &query.PageRequest{
Expand Down Expand Up @@ -214,7 +214,7 @@ func (s Source) GetValidatorDelegationsWithPagination(
}

res, err := s.q.ValidatorDelegations(
sdk.WrapSDKContext(ctx),
ctx,
&stakingtypes.QueryValidatorDelegationsRequest{
ValidatorAddr: validator,
Pagination: pagination,
Expand All @@ -237,7 +237,7 @@ func (s Source) GetUnbondingDelegationsFromValidator(
}

unbondingDelegations, err := s.q.ValidatorUnbondingDelegations(
sdk.WrapSDKContext(ctx),
ctx,
&stakingtypes.QueryValidatorUnbondingDelegationsRequest{
ValidatorAddr: validator,
Pagination: pagination,
Expand Down

0 comments on commit 8dbef43

Please sign in to comment.