diff --git a/.github/release.yml b/.github/release.yml index fae91ba4..00da9328 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index f9bd9eac..1694b0db 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - uses: technote-space/get-diff-action@v4 with: PATTERNS: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5b9fe851..abb63d04 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,10 +39,12 @@ jobs: arch: arm64 steps: - - name: Check out repository code - uses: actions/checkout@v4 - - name: Get git diff - uses: technote-space/get-diff-action@v6.1.2 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 1.22 + - uses: technote-space/get-diff-action@v4 + id: git_diff with: PATTERNS: | **/**.wasm @@ -82,23 +84,23 @@ jobs: go-version: 1.22 - uses: actions/checkout@v4 - name: Create a file with all the pkgs - run: go list ./... > pkgs.txt + run: go list ./... | grep -E -v 'tests/e2e' > pkgs.txt - name: Split pkgs into 4 files run: split -d -n l/4 pkgs.txt pkgs.txt.part. # cache multiple - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: "${{ github.sha }}-00" path: ./pkgs.txt.part.00 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: "${{ github.sha }}-01" path: ./pkgs.txt.part.01 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: "${{ github.sha }}-02" path: ./pkgs.txt.part.02 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: "${{ github.sha }}-03" path: ./pkgs.txt.part.03 @@ -121,7 +123,7 @@ jobs: **/**.go go.mod go.sum - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: "${{ github.sha }}-${{ matrix.part }}" if: env.GIT_DIFF @@ -129,7 +131,7 @@ jobs: run: | cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='norace ledger test_ledger_mock' if: env.GIT_DIFF - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: "${{ github.sha }}-${{ matrix.part }}-coverage" path: ./${{ matrix.part }}profile.out @@ -145,19 +147,19 @@ jobs: **/**.go go.mod go.sum - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: "${{ github.sha }}-00-coverage" if: env.GIT_DIFF - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: "${{ github.sha }}-01-coverage" if: env.GIT_DIFF - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: "${{ github.sha }}-02-coverage" if: env.GIT_DIFF - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: "${{ github.sha }}-03-coverage" if: env.GIT_DIFF @@ -199,7 +201,7 @@ jobs: **/**.go go.mod go.sum - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: "${{ github.sha }}-${{ matrix.part }}" if: env.GIT_DIFF @@ -207,7 +209,7 @@ jobs: run: | xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -timeout 30m -race -tags='cgo ledger test_ledger_mock' if: env.GIT_DIFF - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: "${{ github.sha }}-${{ matrix.part }}-race-output" path: ./${{ matrix.part }}-race-output.txt diff --git a/app/app.go b/app/app.go index 3c123e09..b80f19c6 100644 --- a/app/app.go +++ b/app/app.go @@ -54,14 +54,7 @@ import ( "github.com/sge-network/sge/app/keepers" sgeappparams "github.com/sge-network/sge/app/params" "github.com/sge-network/sge/app/upgrades" - v1 "github.com/sge-network/sge/app/upgrades/v1" - v2 "github.com/sge-network/sge/app/upgrades/v2" - v3 "github.com/sge-network/sge/app/upgrades/v3" - v4 "github.com/sge-network/sge/app/upgrades/v4" - v5 "github.com/sge-network/sge/app/upgrades/v5" - v6 "github.com/sge-network/sge/app/upgrades/v6" - v7 "github.com/sge-network/sge/app/upgrades/v7" - v8 "github.com/sge-network/sge/app/upgrades/v8" + v10 "github.com/sge-network/sge/app/upgrades/v10" v9 "github.com/sge-network/sge/app/upgrades/v9" // unnamed import of statik for swagger UI support @@ -86,15 +79,8 @@ var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string Upgrades = []upgrades.Upgrade{ - v1.Upgrade, - v2.Upgrade, - v3.Upgrade, - v4.Upgrade, - v5.Upgrade, - v6.Upgrade, - v7.Upgrade, - v8.Upgrade, v9.Upgrade, + v10.Upgrade, } ) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index ed642a07..5b9728a8 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -290,6 +290,7 @@ func NewAppKeeper( BankKeeper: appKeepers.BankKeeper, }, authtypes.FeeCollectorName, + govModAddress, ) appKeepers.DistrKeeper = distrkeeper.NewKeeper( @@ -486,6 +487,7 @@ func NewAppKeeper( AccountKeeper: appKeepers.AccountKeeper, FeeGrantKeeper: appKeepers.FeeGrantKeeper, }, + govModAddress, ) appKeepers.OVMKeeper = ovmmodulekeeper.NewKeeper( @@ -493,6 +495,7 @@ func NewAppKeeper( appKeepers.keys[ovmmoduletypes.StoreKey], appKeepers.keys[ovmmoduletypes.MemStoreKey], appKeepers.GetSubspace(ovmmoduletypes.ModuleName), + govModAddress, ) appKeepers.MarketKeeper = marketmodulekeeper.NewKeeper( @@ -500,6 +503,7 @@ func NewAppKeeper( appKeepers.keys[marketmoduletypes.StoreKey], appKeepers.keys[marketmoduletypes.MemStoreKey], appKeepers.GetSubspace(marketmoduletypes.ModuleName), + govModAddress, ) appKeepers.MarketKeeper.SetOVMKeeper(appKeepers.OVMKeeper) appKeepers.MarketKeeper.SetOrderbookKeeper(appKeepers.OrderbookKeeper) @@ -509,6 +513,7 @@ func NewAppKeeper( appKeepers.keys[betmoduletypes.StoreKey], appKeepers.keys[betmoduletypes.MemStoreKey], appKeepers.GetSubspace(betmoduletypes.ModuleName), + govModAddress, ) appKeepers.BetKeeper.SetMarketKeeper(appKeepers.MarketKeeper) appKeepers.BetKeeper.SetOrderbookKeeper(appKeepers.OrderbookKeeper) @@ -527,6 +532,7 @@ func NewAppKeeper( housemodulekeeper.SdkExpectedKeepers{ AuthzKeeper: appKeepers.AuthzKeeper, }, + govModAddress, ) appKeepers.OrderbookKeeper.SetHouseKeeper(appKeepers.HouseKeeper) @@ -540,6 +546,7 @@ func NewAppKeeper( appKeepers.BetKeeper, appKeepers.OrderbookKeeper, appKeepers.HouseKeeper, + govModAddress, ) appKeepers.RewardKeeper = rewardmodulekeeper.NewKeeper( @@ -555,6 +562,7 @@ func NewAppKeeper( BankKeeper: appKeepers.BankKeeper, AccountKeeper: appKeepers.AccountKeeper, }, + govModAddress, ) // ** Hooks ** \\ diff --git a/app/upgrades/v1/consts.go b/app/upgrades/v1/consts.go deleted file mode 100644 index edc284ae..00000000 --- a/app/upgrades/v1/consts.go +++ /dev/null @@ -1,25 +0,0 @@ -package v1 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/x/group" - - ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" - - "github.com/sge-network/sge/app/upgrades" -) - -// UpgradeName defines the on-chain upgrade name for the v1.1.0 upgrade. -const UpgradeName = "v1.1.0" - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{ - group.ModuleName, - ibcfeetypes.StoreKey, - }, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v1/upgrades.go b/app/upgrades/v1/upgrades.go deleted file mode 100644 index 9d2e44eb..00000000 --- a/app/upgrades/v1/upgrades.go +++ /dev/null @@ -1,47 +0,0 @@ -package v1 - -import ( - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - "github.com/sge-network/sge/app/keepers" -) - -func setCommissionRate(stakingKeeper *stakingkeeper.Keeper, ctx sdk.Context) { - // the minimal commission rate of 5% (0.05) - // (default is needed to be set because of SDK store migrations that set the param) - stakingtypes.DefaultMinCommissionRate = sdkmath.LegacyNewDecWithPrec(5, 2) - - stakingKeeper.IterateValidators(ctx, func(index int64, val stakingtypes.ValidatorI) (stop bool) { - if val.GetCommission().LT(stakingtypes.DefaultMinCommissionRate) { - validator, found := stakingKeeper.GetValidator(ctx, val.GetOperator()) - if !found { - ctx.Logger().Error("validator not found", val) - return true - } - ctx.Logger().Info("update validator's commission rate to a minimal one", val) - validator.Commission.Rate = stakingtypes.DefaultMinCommissionRate - if validator.Commission.MaxRate.LT(stakingtypes.DefaultMinCommissionRate) { - validator.Commission.MaxRate = stakingtypes.DefaultMinCommissionRate - } - stakingKeeper.SetValidator(ctx, validator) - } - return false - }) -} - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - setCommissionRate(keepers.StakingKeeper, ctx) - - return mm.RunMigrations(ctx, configurator, fromVM) - } -} diff --git a/app/upgrades/v7/consts.go b/app/upgrades/v10/consts.go similarity index 75% rename from app/upgrades/v7/consts.go rename to app/upgrades/v10/consts.go index 94aea065..ebd706b2 100644 --- a/app/upgrades/v7/consts.go +++ b/app/upgrades/v10/consts.go @@ -1,4 +1,4 @@ -package v7 +package v10 import ( store "github.com/cosmos/cosmos-sdk/store/types" @@ -6,8 +6,8 @@ import ( "github.com/sge-network/sge/app/upgrades" ) -// UpgradeName defines the on-chain upgrade name for the v1.5.3 upgrade. -const UpgradeName = "v1.5.3" +// UpgradeName defines the on-chain upgrade name for the v1.7.1 upgrade. +const UpgradeName = "v1.7.1" var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, diff --git a/app/upgrades/v5/upgrades.go b/app/upgrades/v10/upgrades.go similarity index 97% rename from app/upgrades/v5/upgrades.go rename to app/upgrades/v10/upgrades.go index 75fb3334..f36ba774 100644 --- a/app/upgrades/v5/upgrades.go +++ b/app/upgrades/v10/upgrades.go @@ -1,9 +1,10 @@ -package v5 +package v10 import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/sge-network/sge/app/keepers" ) diff --git a/app/upgrades/v2/consts.go b/app/upgrades/v2/consts.go deleted file mode 100644 index 14cbe52b..00000000 --- a/app/upgrades/v2/consts.go +++ /dev/null @@ -1,19 +0,0 @@ -package v2 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/sge-network/sge/app/upgrades" -) - -// UpgradeName defines the on-chain upgrade name for the v1.1.1 upgrade. -const UpgradeName = "v1.1.1" - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v2/upgrades.go b/app/upgrades/v2/upgrades.go deleted file mode 100644 index 0400ef84..00000000 --- a/app/upgrades/v2/upgrades.go +++ /dev/null @@ -1,39 +0,0 @@ -package v2 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - sdkmath "cosmossdk.io/math" - "github.com/sge-network/sge/app/keepers" - housetypes "github.com/sge-network/sge/x/house/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - keepers *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - housePS := keepers.GetSubspace(housetypes.ModuleName) - - if !housePS.Has(ctx, []byte("MaxWithdrawalCount")) { - var minDeposit sdkmath.Int - housePS.Get(ctx, []byte("MinDeposit"), &minDeposit) - - var houseParticipationFee sdkmath.LegacyDec - housePS.Get(ctx, []byte("HouseParticipationFee"), &houseParticipationFee) - - p := housetypes.NewParams( - minDeposit, - houseParticipationFee, - housetypes.DefaultMaxWithdrawalCount, - ) - - keepers.HouseKeeper.SetParams(ctx, p) - } - - return mm.RunMigrations(ctx, configurator, fromVM) - } -} diff --git a/app/upgrades/v3/consts.go b/app/upgrades/v3/consts.go deleted file mode 100644 index 38b8b689..00000000 --- a/app/upgrades/v3/consts.go +++ /dev/null @@ -1,25 +0,0 @@ -package v3 - -import ( - sdkmath "cosmossdk.io/math" - - "github.com/sge-network/sge/app/upgrades" -) - -// UpgradeName defines the on-chain upgrade name for the v1.2.0 upgrade. -const UpgradeName = "v1.2.0" - -// Expedite governance params -var ( - // DefaultMinExpeditedDepositTokens is the default minimum deposit required for expedited proposals. - DefaultMinExpeditedDepositTokens = sdkmath.NewInt(50000000000) - // DefaultExpeditedQuorum is the default quorum percentage required for expedited proposals. - DefaultExpeditedQuorum = sdkmath.LegacyNewDecWithPrec(750, 3) - // DefaultExpeditedThreshold is the default voting threshold percentage required for expedited proposals. - DefaultExpeditedThreshold = sdkmath.LegacyNewDecWithPrec(750, 3) -) - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, -} diff --git a/app/upgrades/v3/upgrades.go b/app/upgrades/v3/upgrades.go deleted file mode 100644 index 9f702038..00000000 --- a/app/upgrades/v3/upgrades.go +++ /dev/null @@ -1,37 +0,0 @@ -package v3 - -import ( - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/sge-network/sge/app/keepers" -) - -const DefaultExpeditedPeriod time.Duration = time.Hour * 24 - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - // not applicable anymore - // depositParams := keepers.GovKeeper.GetDepositParams(ctx) - // depositParams.MinExpeditedDeposit = sdk.NewCoins(sdk.NewCoin("usge", DefaultMinExpeditedDepositTokens)) - // keepers.GovKeeper.SetDepositParams(ctx, depositParams) - - // tallyParams := keepers.GovKeeper.GetTallyParams(ctx) - // tallyParams.ExpeditedThreshold = DefaultExpeditedThreshold.String() - // tallyParams.ExpeditedQuorum = DefaultExpeditedQuorum.String() - // keepers.GovKeeper.SetTallyParams(ctx, tallyParams) - - // votingParams := keepers.GovKeeper.GetVotingParams(ctx) - // expeditedPeriod := DefaultExpeditedPeriod - // votingParams.ExpeditedVotingPeriod = &expeditedPeriod - // keepers.GovKeeper.SetVotingParams(ctx, votingParams) - - return mm.RunMigrations(ctx, configurator, fromVM) - } -} diff --git a/app/upgrades/v4/consts.go b/app/upgrades/v4/consts.go deleted file mode 100644 index 09f3339a..00000000 --- a/app/upgrades/v4/consts.go +++ /dev/null @@ -1,24 +0,0 @@ -package v4 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/sge-network/sge/app/upgrades" - rewardmoduletypes "github.com/sge-network/sge/x/reward/types" - subaccountmoduletypes "github.com/sge-network/sge/x/subaccount/types" -) - -// UpgradeName defines the on-chain upgrade name for the v1.3.0 upgrade. -const UpgradeName = "v1.3.0" - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{ - subaccountmoduletypes.ModuleName, - rewardmoduletypes.ModuleName, - }, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v4/upgrades.go b/app/upgrades/v4/upgrades.go deleted file mode 100644 index c6f954f5..00000000 --- a/app/upgrades/v4/upgrades.go +++ /dev/null @@ -1,18 +0,0 @@ -package v4 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/sge-network/sge/app/keepers" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - _ *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - return mm.RunMigrations(ctx, configurator, fromVM) - } -} diff --git a/app/upgrades/v5/consts.go b/app/upgrades/v5/consts.go deleted file mode 100644 index 95596db6..00000000 --- a/app/upgrades/v5/consts.go +++ /dev/null @@ -1,19 +0,0 @@ -package v5 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/sge-network/sge/app/upgrades" -) - -// UpgradeName defines the on-chain upgrade name for the v1.3.1 upgrade. -const UpgradeName = "v1.3.1" - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6/consts.go b/app/upgrades/v6/consts.go deleted file mode 100644 index a59a6535..00000000 --- a/app/upgrades/v6/consts.go +++ /dev/null @@ -1,19 +0,0 @@ -package v6 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/sge-network/sge/app/upgrades" -) - -// UpgradeName defines the on-chain upgrade name for the v1.5.2 upgrade. -const UpgradeName = "v1.5.2" - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v6/upgrades.go b/app/upgrades/v6/upgrades.go deleted file mode 100644 index 61ce32e9..00000000 --- a/app/upgrades/v6/upgrades.go +++ /dev/null @@ -1,58 +0,0 @@ -package v6 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/sge-network/sge/app/keepers" - markettypes "github.com/sge-network/sge/x/market/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - k *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - participationList, err := k.OrderbookKeeper.GetAllOrderBookParticipations(ctx) - if err != nil { - panic(err) - } - - for _, bp := range participationList { - if !bp.IsSettled { - continue - } - - market, found := k.MarketKeeper.GetMarket(ctx, bp.OrderBookUID) - if !found { - panic(fmt.Errorf("market not found %s", bp.OrderBookUID)) - } - - reimburseFee := false - switch market.Status { - case markettypes.MarketStatus_MARKET_STATUS_RESULT_DECLARED: - bp.ReturnedAmount = bp.Liquidity.Add(bp.ActualProfit) - if bp.NotParticipatedInBetFulfillment() { - reimburseFee = true - } - - case markettypes.MarketStatus_MARKET_STATUS_CANCELED, - markettypes.MarketStatus_MARKET_STATUS_ABORTED: - bp.ReturnedAmount = bp.Liquidity - reimburseFee = true - } - - if reimburseFee { - bp.ReimbursedFee = bp.Fee - bp.ReturnedAmount = bp.ReturnedAmount.Add(bp.ReimbursedFee) - } - - k.OrderbookKeeper.SetOrderBookParticipation(ctx, bp) - } - - return mm.RunMigrations(ctx, configurator, fromVM) - } -} diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go deleted file mode 100644 index e26a7b58..00000000 --- a/app/upgrades/v7/upgrades.go +++ /dev/null @@ -1,44 +0,0 @@ -package v7 - -import ( - "fmt" - - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/sge-network/sge/app/keepers" - subaccounttypes "github.com/sge-network/sge/x/subaccount/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - k *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - allSubaccounts := k.SubaccountKeeper.GetAllSubaccounts(ctx) - - for _, sa := range allSubaccounts { - subAccAddr := sdk.MustAccAddressFromBech32(sa.Address) - accSummary, found := k.SubaccountKeeper.GetAccountSummary(ctx, subAccAddr) - if !found { - panic(fmt.Errorf("account summary for the subaccount not found %s", subAccAddr)) - } - - _, totalBalances := k.SubaccountKeeper.GetBalances(ctx, subAccAddr, subaccounttypes.LockedBalanceStatus_LOCKED_BALANCE_STATUS_UNSPECIFIED) - - missingBalance := accSummary.DepositedAmount.Sub(totalBalances) - if missingBalance.GT(sdkmath.ZeroInt()) { - k.SubaccountKeeper.SetLockedBalances(ctx, subAccAddr, []subaccounttypes.LockedBalance{ - { - Amount: missingBalance, - UnlockTS: 1710830000, - }, - }) - } - } - - return mm.RunMigrations(ctx, configurator, fromVM) - } -} diff --git a/app/upgrades/v8/consts.go b/app/upgrades/v8/consts.go deleted file mode 100644 index 686ccb5f..00000000 --- a/app/upgrades/v8/consts.go +++ /dev/null @@ -1,19 +0,0 @@ -package v8 - -import ( - store "github.com/cosmos/cosmos-sdk/store/types" - - "github.com/sge-network/sge/app/upgrades" -) - -// UpgradeName defines the on-chain upgrade name for the v1.6.2 upgrade. -const UpgradeName = "v1.6.2" - -var Upgrade = upgrades.Upgrade{ - UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateUpgradeHandler, - StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, - Deleted: []string{}, - }, -} diff --git a/app/upgrades/v8/upgrades.go b/app/upgrades/v8/upgrades.go deleted file mode 100644 index c9b38084..00000000 --- a/app/upgrades/v8/upgrades.go +++ /dev/null @@ -1,69 +0,0 @@ -package v8 - -import ( - "sort" - - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - "github.com/sge-network/sge/app/keepers" - "github.com/sge-network/sge/x/reward/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - k *keepers.AppKeepers, -) upgradetypes.UpgradeHandler { - return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { - allPromoters := k.RewardKeeper.GetAllPromoter(ctx) - promoterUID := "f0630627-9e4e-48f3-8cd5-1422b46d2175" - if len(allPromoters) == 0 { - allCampaigns := k.RewardKeeper.GetAllCampaign(ctx) - promoters := make(map[string]struct{}) - for _, c := range allCampaigns { - c.CapCount = 0 // infinite cap for all campaigns - c.Pool.Withdrawn = sdkmath.ZeroInt() - k.RewardKeeper.SetCampaign(ctx, c) - promoters[c.Promoter] = struct{}{} - } - - promoterAddresses := []string{} - for addr := range promoters { - promoterAddresses = append(promoterAddresses, addr) - } - sort.Strings(promoterAddresses) - - if len(promoterAddresses) > 0 { - promoterUID := promoterUID - k.RewardKeeper.SetPromoter(ctx, types.Promoter{ - Creator: promoterAddresses[0], - UID: promoterUID, - Addresses: promoterAddresses, - Conf: types.PromoterConf{ - CategoryCap: []types.CategoryCap{ - {Category: types.RewardCategory_REWARD_CATEGORY_SIGNUP, CapPerAcc: 1}, - }, - }, - }) - - for _, addr := range promoterAddresses { - k.RewardKeeper.SetPromoterByAddress(ctx, types.PromoterByAddress{ - PromoterUID: promoterUID, - Address: addr, - }) - } - } - } - - allByCat := k.RewardKeeper.GetAllRewardsOfReceiverByPromoterAndCategory(ctx) - for _, rc := range allByCat { - k.RewardKeeper.RemoveRewardOfReceiverByPromoterAndCategory(ctx, "", rc) - k.RewardKeeper.SetRewardOfReceiverByPromoterAndCategory(ctx, promoterUID, rc) - } - - return mm.RunMigrations(ctx, configurator, fromVM) - } -} diff --git a/config.yml b/config.yml index 17ffd503..5de0e11d 100644 --- a/config.yml +++ b/config.yml @@ -19,7 +19,7 @@ genesis: bank: balances: - address: "sge12m8k4n37tcqt5fk0s90jk3t8gz8rkgl33cu407" - coins: [{"denom": "usge", "amount": "10000000000"}] + coins: [{ "denom": "usge", "amount": "10000000000" }] supply: - denom: "usge" amount: "10000000000" @@ -32,16 +32,20 @@ genesis: amount: "1000" ovm: key_vault: - public_keys: [ - "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAdUWfzVUf4BqsHvErsJoXIaIpO60CHXfaaef+xKU3bbY=\n-----END PUBLIC KEY-----", - "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEA58w+676YVp61kjXDrteK8hDxulq5zbF6sNHQt3Lt5Ng=\n-----END PUBLIC KEY-----", - "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAw5iPKVbSvyF1A1HDFaWMGlhBp/xTU70i8lMgOml79WM=\n-----END PUBLIC KEY-----", - "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAueEgZMdKn6Bp0mcG04HrNAt1a0o7+0eNliQCNmbxkOQ=\n-----END PUBLIC KEY-----", - "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAkMnWRwXXVlQqhpHq7LNVGwqA/E2LQY/6remOtilPKpI=\n-----END PUBLIC KEY-----", - ] + public_keys: + [ + "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAdUWfzVUf4BqsHvErsJoXIaIpO60CHXfaaef+xKU3bbY=\n-----END PUBLIC KEY-----", + "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEA58w+676YVp61kjXDrteK8hDxulq5zbF6sNHQt3Lt5Ng=\n-----END PUBLIC KEY-----", + "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAw5iPKVbSvyF1A1HDFaWMGlhBp/xTU70i8lMgOml79WM=\n-----END PUBLIC KEY-----", + "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAueEgZMdKn6Bp0mcG04HrNAt1a0o7+0eNliQCNmbxkOQ=\n-----END PUBLIC KEY-----", + "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAkMnWRwXXVlQqhpHq7LNVGwqA/E2LQY/6remOtilPKpI=\n-----END PUBLIC KEY-----", + ] gov: - deposit_params: + params: + expedited_min_deposit: [{ amount: "2", denom: "usge" }] min_deposit: [{ amount: "1", denom: "usge" }] + voting_period: "40s" + expedited_voting_period: "30s" bet: params: constraints: @@ -56,10 +60,7 @@ genesis: params: mint_denom: "usge" blocks_per_year: "100" - phases: - [ - { inflation: "0.100000000000000000", year_coefficient: "1" }, - ] + phases: [{ inflation: "0.100000000000000000", year_coefficient: "1" }] exclude_amount: "500000000000" orderbook: params: diff --git a/go.mod b/go.mod index 44044b6d..ef6a30eb 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/CosmWasm/wasmd v0.45.0 github.com/cometbft/cometbft v0.37.5 github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.4 + github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.47.8 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20240502201956-e9b46e4bf0ad @@ -23,15 +23,15 @@ require ( github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 - github.com/mrz1836/go-sanitize v1.3.1 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 + github.com/mrz1836/go-sanitize v1.3.2 github.com/prometheus/client_golang v1.16.0 github.com/rakyll/statik v0.1.7 github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de - google.golang.org/grpc v1.63.2 + google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 + google.golang.org/grpc v1.64.0 gopkg.in/yaml.v2 v2.4.0 mvdan.cc/gofumpt v0.5.0 ) @@ -63,11 +63,10 @@ require ( require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect - cloud.google.com/go v0.112.0 // indirect - cloud.google.com/go/compute v1.24.0 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go v0.112.1 // indirect + cloud.google.com/go/compute/metadata v0.3.0 // indirect cloud.google.com/go/iam v1.1.6 // indirect - cloud.google.com/go/storage v1.36.0 // indirect + cloud.google.com/go/storage v1.38.0 // indirect cosmossdk.io/core v0.6.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect cosmossdk.io/log v1.3.1 // indirect @@ -182,7 +181,7 @@ require ( github.com/google/orderedcode v0.0.1 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.0 // indirect + github.com/googleapis/gax-go/v2 v2.12.2 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect @@ -311,29 +310,28 @@ require ( go-simpler.org/sloglint v0.1.2 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect go.tmz.dev/musttag v0.7.2 // indirect - golang.org/x/crypto v0.19.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/oauth2 v0.17.0 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/oauth2 v0.20.0 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect - golang.org/x/term v0.17.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.18.0 // indirect + golang.org/x/text v0.15.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.14.0 // indirect - google.golang.org/api v0.162.0 // indirect - google.golang.org/appengine v1.6.8 // indirect + google.golang.org/api v0.169.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect + google.golang.org/protobuf v1.34.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.4.6 // indirect @@ -351,7 +349,7 @@ replace ( github.com/CosmWasm/wasmd => github.com/sge-network/wasmd v0.0.0-20240506113624-5ccb26abde7a - github.com/cosmos/cosmos-sdk => github.com/sge-network/cosmos-sdk v0.47.9-0.20240409081440-054c8c413d45 + github.com/cosmos/cosmos-sdk => github.com/sge-network/cosmos-sdk v0.47.9-0.20240603081943-72560a0c8a54 // support concurrency for iavl github.com/cosmos/iavl => github.com/cosmos/iavl v0.20.1 diff --git a/go.sum b/go.sum index 459ce2ea..4dfccc5c 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= -cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= +cloud.google.com/go v0.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= +cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -75,10 +75,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= -cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= +cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -178,8 +176,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.36.0 h1:P0mOkAcaJxhCTvAkMhxMfrTKiNcub4YmmPBtlhAyTr8= -cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= +cloud.google.com/go/storage v1.38.0 h1:Az68ZRGlnNTpIBbLjSMIV2BDcwwXYlRlQzis0llkpJg= +cloud.google.com/go/storage v1.38.0/go.mod h1:tlUADB0mAb9BgYls9lq+8MGkfzOXuLrnHXlpHmvFJoY= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -424,8 +422,6 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= @@ -459,8 +455,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU= -github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co= +github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= +github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -563,8 +559,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= @@ -842,8 +836,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/gax-go/v2 v2.12.2 h1:mhN09QQW1jEWeMF74zGR81R30z4VJzjZsfkUhuHF+DA= +github.com/googleapis/gax-go/v2 v2.12.2/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 h1:mrEEilTAUmaAORhssPPkxj84TsHrPMLBGW2Z4SoTxm8= @@ -882,8 +876,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 h1:RtRsiaGvWxcwd8y3BiRZxsylPT8hLWZ5SPcfI+3IDNk= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0/go.mod h1:TzP6duP4Py2pHLVPPQp42aoYI92+PCrVotyR5e8Vqlk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= @@ -1157,8 +1151,8 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= -github.com/mrz1836/go-sanitize v1.3.1 h1:bTxpzDXzGh9cp3XLTeVKgL2iLqEwCaLqqe+3BmpnCbo= -github.com/mrz1836/go-sanitize v1.3.1/go.mod h1:Js6Gq1uiarNReoOeOKxPXxNpKy1FRlbgDDZnJG4THdM= +github.com/mrz1836/go-sanitize v1.3.2 h1:sGhusPxP4L+7NAUVAUl/WrrBazNSNECsvYh3yumuJXQ= +github.com/mrz1836/go-sanitize v1.3.2/go.mod h1:wvRS2ALFDxOCK3ORQPwKUxl7HTIBUV8S3U34Hwn96r4= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= @@ -1368,8 +1362,8 @@ github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KR github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sge-network/cosmos-sdk v0.47.9-0.20240409081440-054c8c413d45 h1:gdXKc/Y7QTsuDsoC/S3R/LdXAxazOFzjxNoiJmpFaYE= -github.com/sge-network/cosmos-sdk v0.47.9-0.20240409081440-054c8c413d45/go.mod h1:WjqTUUHJnaRjkgJbP2aQ1F+9pxDpLsOBpfuP2S0W+Ck= +github.com/sge-network/cosmos-sdk v0.47.9-0.20240603081943-72560a0c8a54 h1:ay0zjDwGHb6sZG82anuyBU1HxJeB7XByqFuYhPx+j0U= +github.com/sge-network/cosmos-sdk v0.47.9-0.20240603081943-72560a0c8a54/go.mod h1:WjqTUUHJnaRjkgJbP2aQ1F+9pxDpLsOBpfuP2S0W+Ck= github.com/sge-network/wasmd v0.0.0-20240506113624-5ccb26abde7a h1:cg3upuH1sZBjFKY2p7qgE9LTtGt2ccH8vucTGMWquSo= github.com/sge-network/wasmd v0.0.0-20240506113624-5ccb26abde7a/go.mod h1:uQOWQUhJrZpsroGkmunpIJfj4tY9NIZWDVw1f42hjtI= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= @@ -1553,18 +1547,18 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= -go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= -go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= -go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= -go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= -go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= -go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= -go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= -go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= +go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.tmz.dev/musttag v0.7.2 h1:1J6S9ipDbalBSODNT5jCep8dhZyMr4ttnjQagmGYR5s= go.tmz.dev/musttag v0.7.2/go.mod h1:m6q5NiiSKMnQYokefa2xGoyoXnrswCbJ0AWYzf4Zs28= @@ -1610,8 +1604,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= @@ -1716,8 +1710,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1743,8 +1737,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= +golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= +golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1873,8 +1867,8 @@ golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1882,8 +1876,8 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1897,8 +1891,8 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1994,8 +1988,9 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= @@ -2051,8 +2046,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.162.0 h1:Vhs54HkaEpkMBdgGdOT2P6F0csGG/vxDS0hWHJzmmps= -google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= +google.golang.org/api v0.169.0 h1:QwWPy71FgMWqJN/l6jVlFHUa29a7dcUy02I8o799nPY= +google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2061,8 +2056,6 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -2173,10 +2166,10 @@ google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 h1:W5Xj/70xIA4x60O/IFyXivR5MGqblAb8R3w26pnD6No= +google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8/go.mod h1:vPrPUTsDCYxXWjP7clS81mZ6/803D8K4iM9Ma27VKas= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 h1:mxSlqyb8ZAHsYDCfiXN1EDdNTdvjUJSLY+OnAUtYNYA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -2218,8 +2211,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= -google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= +google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2236,8 +2229,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/proto/buf.lock b/proto/buf.lock index 83c7a202..32d482eb 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -19,8 +19,8 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - commit: 1f6ed065c9f04b5cb843d6e7603d6454 - digest: shake256:7149cf5e9955c692d381e557830555d4e93f205a0f1b8e2dfdae46d029369aa3fc1980e35df0d310f7cc3b622f93e19ad276769a283a967dd3065ddfd3a40e13 + commit: f0e53af8f2fc4556b94f482688b57223 + digest: shake256:de26a277fc28b8b411ecf58729d78d32fcf15090ffd998a4469225b17889bfb51442eaab04bb7a8d88d203ecdf0a9febd4ffd52c18ed1c2229160c7bd353ca95 - remote: buf.build owner: protocolbuffers repository: wellknowntypes diff --git a/proto/sgenetwork/sge/bet/bet.proto b/proto/sgenetwork/sge/bet/bet.proto index 87b4d56c..785a5583 100644 --- a/proto/sgenetwork/sge/bet/bet.proto +++ b/proto/sgenetwork/sge/bet/bet.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.bet; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "sgenetwork/sge/bet/odds_type.proto"; option go_package = "github.com/sge-network/sge/x/bet/types"; @@ -53,7 +54,7 @@ message Bet { Result result = 9; // creator is the bettor address. - string creator = 10; + string creator = 10 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // created_at is the bet placement timestamp. int64 created_at = 11; @@ -132,7 +133,7 @@ message PendingBet { json_name = "uid" ]; // creator is the bettor address. - string creator = 2; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // SettledBet is the type for a settled bet. @@ -144,7 +145,7 @@ message SettledBet { json_name = "uid" ]; // bettor_address is the bech32 address of the bettor account. - string bettor_address = 2; + string bettor_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // BetFulfillment: A bet can be fulfilled by multiple users participating as a diff --git a/proto/sgenetwork/sge/bet/query.proto b/proto/sgenetwork/sge/bet/query.proto index 0b533627..4c0ad37f 100644 --- a/proto/sgenetwork/sge/bet/query.proto +++ b/proto/sgenetwork/sge/bet/query.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.bet; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "sgenetwork/sge/bet/params.proto"; @@ -64,7 +65,7 @@ message QueryParamsResponse { // QueryBetRequest is the request type for a single bet query // Query/Bet RPC method. message QueryBetRequest { - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; string uid = 2 [ (gogoproto.jsontag) = "uid", json_name = "uid" ]; } diff --git a/proto/sgenetwork/sge/bet/tx.proto b/proto/sgenetwork/sge/bet/tx.proto index ec52db9f..3393a817 100644 --- a/proto/sgenetwork/sge/bet/tx.proto +++ b/proto/sgenetwork/sge/bet/tx.proto @@ -1,21 +1,33 @@ syntax = "proto3"; package sgenetwork.sge.bet; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; import "sgenetwork/sge/bet/wager.proto"; +import "sgenetwork/sge/bet/params.proto"; option go_package = "github.com/sge-network/sge/x/bet/types"; // Msg defines the Msg service. service Msg { - // Wager defines a method to place a bet with the given data. rpc Wager(MsgWager) returns (MsgWagerResponse); + + // UpdateParams defines a governance operation for updating the x/bet module + // parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "sge-network 1.7.1"; + } } // MsgWager defines a message to place a bet with the given data. message MsgWager { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the bettor address. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // props contains bet properties. WagerProps props = 2; } @@ -23,3 +35,23 @@ message MsgWager { // MsgWagerResponse is the returning value in the response // of MsgWagerResponse request. message MsgWagerResponse { WagerProps props = 1; } + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/bet parameters. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; +} \ No newline at end of file diff --git a/proto/sgenetwork/sge/house/deposit.proto b/proto/sgenetwork/sge/house/deposit.proto index c77e5e18..0d729471 100644 --- a/proto/sgenetwork/sge/house/deposit.proto +++ b/proto/sgenetwork/sge/house/deposit.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.house; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/sge-network/sge/x/house/types"; @@ -15,8 +16,10 @@ message Deposit { string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; // creator is the bech32-encoded address of the depositor. - string depositor_address = 2 - [ (gogoproto.moretags) = "yaml:\"depositor_address\"" ]; + string depositor_address = 2 [ + (gogoproto.moretags) = "yaml:\"depositor_address\"", + (cosmos_proto.scalar) = "cosmos.AddressString" + ]; // market_uid is the uid of market/order book against which deposit is being // made. diff --git a/proto/sgenetwork/sge/house/query.proto b/proto/sgenetwork/sge/house/query.proto index edfb5ccd..262811a2 100644 --- a/proto/sgenetwork/sge/house/query.proto +++ b/proto/sgenetwork/sge/house/query.proto @@ -3,6 +3,7 @@ package sgenetwork.sge.house; import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "google/api/annotations.proto"; import "sgenetwork/sge/house/params.proto"; import "sgenetwork/sge/house/deposit.proto"; @@ -93,7 +94,7 @@ message QueryDepositsByAccountResponse { message QueryWithdrawalsByAccountRequest { // address defines the address of depositor/account for which withdrawals are // queried. - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; @@ -112,7 +113,8 @@ message QueryWithdrawalsByAccountResponse { // QueryWithdrawalRequest is the request type for the Query/Withdrawal RPC // method. Query/Withdrawal RPC method. message QueryWithdrawalRequest { - string depositor_address = 1; + string depositor_address = 1 + [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; string market_uid = 2; // participation_index is the index corresponding to the order book // participation diff --git a/proto/sgenetwork/sge/house/ticket.proto b/proto/sgenetwork/sge/house/ticket.proto index f833cfc9..b7e6a1cd 100644 --- a/proto/sgenetwork/sge/house/ticket.proto +++ b/proto/sgenetwork/sge/house/ticket.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package sgenetwork.sge.house; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "sgenetwork/sge/type/kyc.proto"; option go_package = "github.com/sge-network/sge/x/house/types"; @@ -13,8 +14,10 @@ message DepositTicketPayload { sgenetwork.sge.type.KycDataPayload kyc_data = 1 [ (gogoproto.nullable) = false ]; // depositor_address is the account who makes a deposit - string depositor_address = 2 - [ (gogoproto.moretags) = "yaml:\"depositor_address\"" ]; + string depositor_address = 2 [ + (gogoproto.moretags) = "yaml:\"depositor_address\"", + (cosmos_proto.scalar) = "cosmos.AddressString" + ]; } // WithdrawTicketPayload indicates data of the withdrawal ticket. @@ -23,6 +26,8 @@ message WithdrawTicketPayload { sgenetwork.sge.type.KycDataPayload kyc_data = 1 [ (gogoproto.nullable) = false ]; // depositor_address is the account who makes a deposit - string depositor_address = 2 - [ (gogoproto.moretags) = "yaml:\"depositor_address\"" ]; + string depositor_address = 2 [ + (gogoproto.moretags) = "yaml:\"depositor_address\"", + (cosmos_proto.scalar) = "cosmos.AddressString" + ]; } diff --git a/proto/sgenetwork/sge/house/tx.proto b/proto/sgenetwork/sge/house/tx.proto index 9d218a28..5b9f81ac 100644 --- a/proto/sgenetwork/sge/house/tx.proto +++ b/proto/sgenetwork/sge/house/tx.proto @@ -2,7 +2,11 @@ syntax = "proto3"; package sgenetwork.sge.house; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; import "sgenetwork/sge/house/withdraw.proto"; +import "sgenetwork/sge/house/params.proto"; option go_package = "github.com/sge-network/sge/x/house/types"; @@ -16,6 +20,12 @@ service Msg { // Withdraw defines a method for performing a withdrawal of tokens of unused // amount corresponding to a deposit. rpc Withdraw(MsgWithdraw) returns (MsgWithdrawResponse); + + // UpdateParams defines a governance operation for updating the x/house module + // parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "sge-network 1.7.1"; + } } // MsgDeposit defines a SDK message for performing a deposit of coins to become @@ -23,6 +33,7 @@ service Msg { message MsgDeposit { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "creator"; // creator is the account who makes a deposit string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; @@ -62,8 +73,12 @@ message MsgDepositResponse { message MsgWithdraw { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "creator"; - string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; + string creator = 1 [ + (cosmos_proto.scalar) = "cosmos.AddressString", + (gogoproto.moretags) = "yaml:\"creator\"" + ]; string market_uid = 2 [ (gogoproto.customname) = "MarketUID", (gogoproto.jsontag) = "market_uid", @@ -104,3 +119,23 @@ message MsgWithdrawResponse { uint64 participation_index = 3 [ (gogoproto.moretags) = "yaml:\"participation_index\"" ]; } + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/bet parameters. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; +} \ No newline at end of file diff --git a/proto/sgenetwork/sge/house/withdraw.proto b/proto/sgenetwork/sge/house/withdraw.proto index 7601132c..4a873bed 100644 --- a/proto/sgenetwork/sge/house/withdraw.proto +++ b/proto/sgenetwork/sge/house/withdraw.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.house; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/sge-network/sge/x/house/types"; @@ -12,7 +13,10 @@ message Withdrawal { option (gogoproto.goproto_stringer) = false; // creator is the bech32-encoded address of the depositor. - string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; + string creator = 1 [ + (cosmos_proto.scalar) = "cosmos.AddressString", + (gogoproto.moretags) = "yaml:\"creator\"" + ]; // withdrawal is the withdrawal attempt id. uint64 id = 2 [ @@ -23,7 +27,10 @@ message Withdrawal { ]; // address is the bech32-encoded address of the depositor. - string address = 3 [ (gogoproto.moretags) = "yaml:\"address\"" ]; + string address = 3 [ + (cosmos_proto.scalar) = "cosmos.AddressString", + (gogoproto.moretags) = "yaml:\"address\"" + ]; // market_uid is the uid of market against which the deposit is // being made. diff --git a/proto/sgenetwork/sge/market/market.proto b/proto/sgenetwork/sge/market/market.proto index 22b34539..f3e33b7e 100644 --- a/proto/sgenetwork/sge/market/market.proto +++ b/proto/sgenetwork/sge/market/market.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.market; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "sgenetwork/sge/market/odds.proto"; option go_package = "github.com/sge-network/sge/x/market/types"; @@ -44,7 +45,7 @@ message Market { json_name = "resolution_ts" ]; // creator is the address of the creator of market. - string creator = 8; + string creator = 8 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // meta contains human-readable metadata of the market. string meta = 9; // book_uid is the unique identifier corresponding to the book diff --git a/proto/sgenetwork/sge/market/tx.proto b/proto/sgenetwork/sge/market/tx.proto index 7ed2d7c2..c6f90c95 100644 --- a/proto/sgenetwork/sge/market/tx.proto +++ b/proto/sgenetwork/sge/market/tx.proto @@ -2,7 +2,11 @@ syntax = "proto3"; package sgenetwork.sge.market; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; import "sgenetwork/sge/market/market.proto"; +import "sgenetwork/sge/market/params.proto"; option go_package = "github.com/sge-network/sge/x/market/types"; @@ -14,13 +18,20 @@ service Msg { rpc Resolve(MsgResolve) returns (MsgResolveResponse); // Update defines a method to update a market. rpc Update(MsgUpdate) returns (MsgUpdateResponse); + // UpdateParams defines a governance operation for updating the x/market + // module parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "sge-network 1.7.1"; + } } // MsgAdd is the message type for adding the market into the // state. message MsgAdd { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the address of the creator account of the market. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // ticket is the jwt ticket data. string ticket = 2; } @@ -35,8 +46,10 @@ message MsgAddResponse { // MsgResolve is the message type for resolving a market. message MsgResolve { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the address of the creator account of the market. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // ticket is the jwt ticket data. string ticket = 2; } @@ -52,8 +65,10 @@ message MsgResolveResponse { // MsgUpdate is the message type for updating market data. // in the state message MsgUpdate { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the address of the creator account of the market. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // ticket is the jwt ticket data. string ticket = 2; } @@ -65,3 +80,23 @@ message MsgUpdateResponse { // data is the data of market Market data = 2 [ (gogoproto.nullable) = true ]; } + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/bet parameters. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; +} \ No newline at end of file diff --git a/proto/sgenetwork/sge/orderbook/participation.proto b/proto/sgenetwork/sge/orderbook/participation.proto index 1f02ee68..e6b4a728 100644 --- a/proto/sgenetwork/sge/orderbook/participation.proto +++ b/proto/sgenetwork/sge/orderbook/participation.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.orderbook; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/sge-network/sge/x/orderbook/types"; @@ -22,8 +23,10 @@ message OrderBookParticipation { ]; // participant_address is the bech32-encoded address of the participant. - string participant_address = 3 - [ (gogoproto.moretags) = "yaml:\"participant_address\"" ]; + string participant_address = 3 [ + (cosmos_proto.scalar) = "cosmos.AddressString", + (gogoproto.moretags) = "yaml:\"participant_address\"" + ]; // liquidity is the total initial liquidity provided. string liquidity = 4 [ @@ -153,6 +156,8 @@ message SettledOrderbookParticipation { ]; // participant_address is the bech32-encoded address of the participant. - string participant_address = 3 - [ (gogoproto.moretags) = "yaml:\"participant_address\"" ]; + string participant_address = 3 [ + (cosmos_proto.scalar) = "cosmos.AddressString", + (gogoproto.moretags) = "yaml:\"participant_address\"" + ]; } \ No newline at end of file diff --git a/proto/sgenetwork/sge/orderbook/tx.proto b/proto/sgenetwork/sge/orderbook/tx.proto new file mode 100644 index 00000000..79efdd5e --- /dev/null +++ b/proto/sgenetwork/sge/orderbook/tx.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; +package sgenetwork.sge.orderbook; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "sgenetwork/sge/orderbook/params.proto"; + +option go_package = "github.com/sge-network/sge/x/orderbook/types"; + +// Msg defines the Msg service. +service Msg { + // UpdateParams defines a governance operation for updating the x/market + // module parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "sge-network 1.7.1"; + } +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/bet parameters. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; +} \ No newline at end of file diff --git a/proto/sgenetwork/sge/ovm/proposal.proto b/proto/sgenetwork/sge/ovm/proposal.proto index da6d7400..19e5754a 100644 --- a/proto/sgenetwork/sge/ovm/proposal.proto +++ b/proto/sgenetwork/sge/ovm/proposal.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.ovm; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "sgenetwork/sge/ovm/ticket.proto"; import "sgenetwork/sge/ovm/vote.proto"; @@ -13,7 +14,7 @@ message PublicKeysChangeProposal { // id is the sequential id of the proposal generated by the blockchain. uint64 id = 1; // creator is the account address of the proposal creator. - string creator = 2; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // modifications contain the ticket payload of the proposal. PubkeysChangeProposalPayload modifications = 3 [ (gogoproto.nullable) = false ]; diff --git a/proto/sgenetwork/sge/ovm/tx.proto b/proto/sgenetwork/sge/ovm/tx.proto index 4e51c2e7..c0963535 100644 --- a/proto/sgenetwork/sge/ovm/tx.proto +++ b/proto/sgenetwork/sge/ovm/tx.proto @@ -1,6 +1,12 @@ syntax = "proto3"; package sgenetwork.sge.ovm; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "sgenetwork/sge/ovm/params.proto"; + option go_package = "github.com/sge-network/sge/x/ovm/types"; // Msg defines the Msg service. @@ -13,13 +19,20 @@ service Msg { // allowed public keys. rpc VotePubkeysChange(MsgVotePubkeysChangeRequest) returns (MsgVotePubkeysChangeResponse); + // UpdateParams defines a governance operation for updating the x/ovm module + // parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "sge-network 1.7.1"; + } } // MsgPubkeysChangeProposalRequest is the type of request for modification of // public keys. message MsgSubmitPubkeysChangeProposalRequest { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the account address of the creator. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // ticket is the jwt ticket data. string ticket = 2; } @@ -31,8 +44,10 @@ message MsgSubmitPubkeysChangeProposalResponse { bool success = 1; } // MsgVotePubkeysChangeRequest is the type of request to vote on the // modification of public keys proposal. message MsgVotePubkeysChangeRequest { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the account address of the creator. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // ticket is the jwt ticket data. string ticket = 2; // voter_key_index is the public key index of the voter in the current list @@ -43,3 +58,23 @@ message MsgVotePubkeysChangeRequest { // MsgVotePubkeysChangeResponse is the type of response vote for public keys // modification. message MsgVotePubkeysChangeResponse { bool success = 1; } + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/bet parameters. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; +} \ No newline at end of file diff --git a/proto/sgenetwork/sge/reward/campaign.proto b/proto/sgenetwork/sge/reward/campaign.proto index b6b479c8..cf4894f9 100644 --- a/proto/sgenetwork/sge/reward/campaign.proto +++ b/proto/sgenetwork/sge/reward/campaign.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.reward; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "sgenetwork/sge/reward/reward.proto"; option go_package = "github.com/sge-network/sge/x/reward/types"; @@ -9,7 +10,7 @@ option go_package = "github.com/sge-network/sge/x/reward/types"; // Campaign is type for defining the campaign properties. message Campaign { // creator is the address of campaign creator. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // uid is the unique identifier of a campaign. string uid = 2 [ @@ -20,7 +21,7 @@ message Campaign { // promoter is the address of campaign promoter. // Funds for the campaign would be deducted from this account. - string promoter = 3; + string promoter = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // start_ts is the start timestamp of a campaign. uint64 start_ts = 4 [ diff --git a/proto/sgenetwork/sge/reward/promoter.proto b/proto/sgenetwork/sge/reward/promoter.proto index a08b61c0..d9933124 100644 --- a/proto/sgenetwork/sge/reward/promoter.proto +++ b/proto/sgenetwork/sge/reward/promoter.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.reward; import "gogoproto/gogo.proto"; - +import "cosmos_proto/cosmos.proto"; import "sgenetwork/sge/reward/reward.proto"; option go_package = "github.com/sge-network/sge/x/reward/types"; @@ -11,7 +11,7 @@ option go_package = "github.com/sge-network/sge/x/reward/types"; // configuration. message Promoter { // creator is the address of promoter. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // uid is the unique identifier of a promoter. string uid = 2 [ @@ -48,5 +48,5 @@ message PromoterByAddress { json_name = "promoter_uid" ]; // address is the address of the promoter account. - string address = 2; + string address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } \ No newline at end of file diff --git a/proto/sgenetwork/sge/reward/query.proto b/proto/sgenetwork/sge/reward/query.proto index 597266fa..a7d4ab99 100644 --- a/proto/sgenetwork/sge/reward/query.proto +++ b/proto/sgenetwork/sge/reward/query.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package sgenetwork.sge.reward; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "sgenetwork/sge/reward/params.proto"; @@ -86,13 +87,18 @@ message QueryParamsResponse { // QueryPromoterByAddressRequest is request type for the // Query/GetPromoterByAddress RPC method. -message QueryPromoterByAddressRequest { string addr = 1; } +message QueryPromoterByAddressRequest { + string addr = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} // QueryPromoterByAddressResponse is response type for the // Query/GetPromoterByAddress RPC method. message QueryPromoterByAddressResponse { // promoter holds the queries promoter. - Promoter promoter = 1 [ (gogoproto.nullable) = false ]; + Promoter promoter = 1 [ + (cosmos_proto.scalar) = "cosmos.AddressString", + (gogoproto.nullable) = false + ]; } // QueryPromotersRequest is request body for the query all promoters endpoint. @@ -103,7 +109,10 @@ message QueryPromotersRequest { // QueryPromotersResponse is response body of the query all promoters // endpoint. message QueryPromotersResponse { - repeated Promoter promoter = 1 [ (gogoproto.nullable) = false ]; + repeated Promoter promoter = 1 [ + (cosmos_proto.scalar) = "cosmos.AddressString", + (gogoproto.nullable) = false + ]; cosmos.base.query.v1beta1.PageResponse pagination = 2; } @@ -150,7 +159,7 @@ message QueryRewardsResponse { // address endpoint. message QueryRewardsByAddressRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; - string address = 2; + string address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; string promoter_uid = 3; } @@ -165,7 +174,7 @@ message QueryRewardsByAddressResponse { // rewards by address and category endpoint. message QueryRewardsByAddressAndCategoryRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; - string address = 2; + string address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; RewardCategory category = 3; string promoter_uid = 4; } diff --git a/proto/sgenetwork/sge/reward/reward.proto b/proto/sgenetwork/sge/reward/reward.proto index 8eb1479b..ca9af0a9 100644 --- a/proto/sgenetwork/sge/reward/reward.proto +++ b/proto/sgenetwork/sge/reward/reward.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.reward; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/sge-network/sge/x/reward/types"; @@ -17,10 +18,10 @@ message Reward { ]; // creator is the address of the account that invokes the reward transaction. - string creator = 2; + string creator = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // receiver is the address of the account that receives the reward. - string receiver = 3; + string receiver = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // campaign_uid is the unique identifier of the campaign. string campaign_uid = 4 [ @@ -98,7 +99,7 @@ message RewardByCategory { json_name = "uid" ]; // addr is the address of the reward receiver. - string addr = 2; + string addr = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // reward_category is the category of the reward. RewardCategory reward_category = 3; } diff --git a/proto/sgenetwork/sge/reward/ticket.proto b/proto/sgenetwork/sge/reward/ticket.proto index 763b8937..cbe85c67 100644 --- a/proto/sgenetwork/sge/reward/ticket.proto +++ b/proto/sgenetwork/sge/reward/ticket.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.reward; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "sgenetwork/sge/type/kyc.proto"; import "sgenetwork/sge/reward/campaign.proto"; import "sgenetwork/sge/reward/reward.proto"; @@ -13,7 +14,7 @@ option go_package = "github.com/sge-network/sge/x/reward/types"; message CreateCampaignPayload { // promoter is the address of campaign promoter. // Funds for the campaign would be deducted from this account. - string promoter = 1; + string promoter = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // start_ts is the start timestamp of the campaign. uint64 start_ts = 2; @@ -61,13 +62,13 @@ message UpdateCampaignPayload { message WithdrawFundsPayload { // promoter is the address of campaign promoter. // Funds would be transferred to this account. - string promoter = 1; + string promoter = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // RewardPayloadCommon message RewardPayloadCommon { // receiver is the address of the account that receives the reward. - string receiver = 1; + string receiver = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // source_uid is the address of the source. // It is used to identify the source of the reward. @@ -101,7 +102,7 @@ message GrantSignupReferrerRewardPayload { // referee is the address of the account that used this referrer address as // source_uid - string referee = 2; + string referee = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // GrantSignupAffiliatorRewardPayload is the type for signup affiliator reward @@ -112,7 +113,7 @@ message GrantSignupAffiliatorRewardPayload { // affiliatee is the address of the account that used this affiliator's // address as source_uid - string affiliatee = 2; + string affiliatee = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // GrantBetBonusRewardPayload is the type for bet bonus reward diff --git a/proto/sgenetwork/sge/reward/tx.proto b/proto/sgenetwork/sge/reward/tx.proto index 391480bf..e10ccb9d 100644 --- a/proto/sgenetwork/sge/reward/tx.proto +++ b/proto/sgenetwork/sge/reward/tx.proto @@ -3,6 +3,10 @@ syntax = "proto3"; package sgenetwork.sge.reward; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; +import "sgenetwork/sge/reward/params.proto"; option go_package = "github.com/sge-network/sge/x/reward/types"; @@ -20,12 +24,19 @@ service Msg { rpc WithdrawFunds(MsgWithdrawFunds) returns (MsgWithdrawFundsResponse); // GrantReward is method to allocate rewards rpc GrantReward(MsgGrantReward) returns (MsgGrantRewardResponse); + // UpdateParams defines a governance operation for updating the x/ovm module + // parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "sge-network 1.7.1"; + } } // MsgCreatePromoter is msg to create a promoter. message MsgCreatePromoter { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the address of message signer account. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // ticket is the payload data. string ticket = 2; } @@ -35,8 +46,10 @@ message MsgCreatePromoterResponse {} // MsgSetPromoterConf is msg to set promoter configuration. message MsgSetPromoterConf { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the address of message signer account. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // uid is the unique identifier of the promoter. string uid = 2; // ticket is the payload data. @@ -48,8 +61,10 @@ message MsgSetPromoterConfResponse {} // MsgCreateCampaign is msg to create a reward campaign message MsgCreateCampaign { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the address of campaign creator account. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // uid is the unique identifier of the campaign. string uid = 2; // total_funds is the total funds allocated to the campaign. @@ -67,8 +82,10 @@ message MsgCreateCampaignResponse {} // MsgUpdateCampaign is campaign update message type. message MsgUpdateCampaign { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the address of creator account. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // uid is the unique identifier of the campaign. string uid = 2; // topup_funds is the topup funds to increase the pool balance of the @@ -87,8 +104,10 @@ message MsgUpdateCampaignResponse {} // MsgGrantReward is execute reward message type. message MsgGrantReward { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the address of creator account. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // uid is the unique identifier of the reward. string uid = 2; // campaign_uid is the unique identifier of the reward campaign. @@ -102,8 +121,10 @@ message MsgGrantRewardResponse {} // MsgWithdrawFunds is withdraw funds message type. message MsgWithdrawFunds { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the address of creator account. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // uid is the unique identifier of the reward campaign. string uid = 2; // ticket is the payload data. @@ -117,3 +138,23 @@ message MsgWithdrawFunds { // MsgWithdrawFundsResponse withdraw funds message response type. message MsgWithdrawFundsResponse {} + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/bet parameters. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; +} \ No newline at end of file diff --git a/proto/sgenetwork/sge/subaccount/genesis.proto b/proto/sgenetwork/sge/subaccount/genesis.proto index 5ef9e728..e6ea12b2 100644 --- a/proto/sgenetwork/sge/subaccount/genesis.proto +++ b/proto/sgenetwork/sge/subaccount/genesis.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.subaccount; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "sgenetwork/sge/subaccount/params.proto"; import "sgenetwork/sge/subaccount/balance.proto"; @@ -22,10 +23,10 @@ message GenesisState { // and balance information. message GenesisSubaccount { // address is the address of the subaccount. - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // owner is the owner of the subaccount. - string owner = 2; + string owner = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // balance defines the balance status of a subaccount AccountSummary balance = 3 [ (gogoproto.nullable) = false ]; diff --git a/proto/sgenetwork/sge/subaccount/query.proto b/proto/sgenetwork/sge/subaccount/query.proto index 52829608..54bb6a0d 100644 --- a/proto/sgenetwork/sge/subaccount/query.proto +++ b/proto/sgenetwork/sge/subaccount/query.proto @@ -4,6 +4,7 @@ package sgenetwork.sge.subaccount; option go_package = "github.com/sge-network/sge/x/subaccount/types"; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; import "google/api/annotations.proto"; import "sgenetwork/sge/subaccount/balance.proto"; import "sgenetwork/sge/subaccount/params.proto"; @@ -32,7 +33,7 @@ message QuerySubaccountRequest { string address = 1; } // QuerySubaccountResponse is the response type for the Query/Subaccount RPC message QuerySubaccountResponse { - string address = 1; + string address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; sge.subaccount.AccountSummary balance = 2 [ (gogoproto.nullable) = false ]; repeated sge.subaccount.LockedBalance locked_balance = 3 [ (gogoproto.nullable) = false ]; diff --git a/proto/sgenetwork/sge/subaccount/tx.proto b/proto/sgenetwork/sge/subaccount/tx.proto index f5abc264..be250e78 100644 --- a/proto/sgenetwork/sge/subaccount/tx.proto +++ b/proto/sgenetwork/sge/subaccount/tx.proto @@ -1,10 +1,14 @@ syntax = "proto3"; package sgenetwork.sge.subaccount; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; import "sgenetwork/sge/subaccount/balance.proto"; +import "sgenetwork/sge/subaccount/params.proto"; import "sgenetwork/sge/house/tx.proto"; import "sgenetwork/sge/bet/tx.proto"; -import "gogoproto/gogo.proto"; option go_package = "github.com/sge-network/sge/x/subaccount/types"; @@ -30,15 +34,23 @@ service Msg { // HouseWithdraw defines a method for withdrawing funds from a market. rpc HouseWithdraw(MsgHouseWithdraw) returns (MsgHouseWithdrawResponse); + + // UpdateParams defines a governance operation for updating the x/subaccount + // module parameters. The authority is defined in the keeper. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) { + option (cosmos_proto.method_added_in) = "sge-network 1.7.1"; + } } // MsgCreate defines the Msg/Create request type. message MsgCreate { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the msg signer. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // owner is the owner of the subaccount. - string owner = 2; + string owner = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // locked_balances is the list of balance locks. // Fixme: why this attribute needs to be repeated? @@ -50,11 +62,13 @@ message MsgCreateResponse {} // MsgTopUp defines the Msg/TopUp request type. message MsgTopUp { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the msg signer. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // address is the subaccount address. - string address = 2; + string address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // locked_balances is the list of balance locks. // Fixme: Are we sending multiple balance update together? If not, then only @@ -68,8 +82,10 @@ message MsgTopUpResponse {} // MsgWithdrawUnlockedBalances defines the Msg/WithdrawUnlockedBalances request // type. message MsgWithdrawUnlockedBalances { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the subaccount owner. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgWithdrawUnlockedBalancesResponse defines the Msg/WithdrawUnlockedBalances @@ -79,8 +95,10 @@ message MsgWithdrawUnlockedBalancesResponse {} // MsgWager wraps the MsgWager message. We need it in order not to have // double interface registration conflicts. message MsgWager { + option (cosmos.msg.v1.signer) = "creator"; + // creator is the subaccount owner. - string creator = 1; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // ticket is the jwt ticket data. string ticket = 2; } @@ -103,4 +121,24 @@ message MsgHouseWithdraw { sge.house.MsgWithdraw msg = 1; } // MsgHouseWithdrawResponse wraps the MsgHouseWithdrawResponse message. We need // it in order not to have double interface registration conflicts. -message MsgHouseWithdrawResponse { sge.house.MsgWithdrawResponse response = 1; } \ No newline at end of file +message MsgHouseWithdrawResponse { sge.house.MsgWithdrawResponse response = 1; } + +// MsgUpdateParams is the Msg/UpdateParams request type. +message MsgUpdateParams { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/bet parameters. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse { + option (cosmos_proto.message_added_in) = "sge-network 1.7.1"; +} \ No newline at end of file diff --git a/proto/sgenetwork/sge/type/kyc.proto b/proto/sgenetwork/sge/type/kyc.proto index bc9f6409..94c0ccaf 100644 --- a/proto/sgenetwork/sge/type/kyc.proto +++ b/proto/sgenetwork/sge/type/kyc.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sgenetwork.sge.type; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/sge-network/sge/types"; @@ -13,6 +14,7 @@ message KycDataPayload { bool approved = 2; // id is the id of the KYC user. string id = 3 [ + (cosmos_proto.scalar) = "cosmos.AddressString", (gogoproto.customname) = "ID", (gogoproto.jsontag) = "id", json_name = "id" diff --git a/tests/e2e/bet/cli_test.go b/tests/e2e/bet/cli_test.go new file mode 100644 index 00000000..72228e20 --- /dev/null +++ b/tests/e2e/bet/cli_test.go @@ -0,0 +1,16 @@ +package client_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + client "github.com/sge-network/sge/tests/e2e/bet" + "github.com/sge-network/sge/testutil/network" +) + +func TestE2ETestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + suite.Run(t, client.NewE2ETestSuite(cfg)) +} diff --git a/tests/e2e/bet/grpc.go b/tests/e2e/bet/grpc.go new file mode 100644 index 00000000..22ecb957 --- /dev/null +++ b/tests/e2e/bet/grpc.go @@ -0,0 +1,106 @@ +package client + +import ( + "fmt" + + "github.com/cosmos/gogoproto/proto" + + "github.com/cosmos/cosmos-sdk/testutil" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + "github.com/cosmos/cosmos-sdk/types/query" + + "github.com/sge-network/sge/x/bet/types" +) + +func (s *E2ETestSuite) TestBetsGRPCHandler() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + testCases := []struct { + name string + url string + headers map[string]string + respType proto.Message + expected proto.Message + }{ + { + "test GRPC Bet by UID", + fmt.Sprintf("%s/sge/bet/%s/%s", baseURL, dummyBetCreator, dummyBetUID), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + &types.QueryBetResponse{}, + &types.QueryBetResponse{ + Bet: genesis.BetList[0], + Market: dummyMarket, + }, + }, + { + "test GRPC sorted Bet by creator", + fmt.Sprintf("%s/sge/bet/creator/%s/bets", baseURL, dummyBetCreator), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + &types.QueryBetsByCreatorResponse{}, + &types.QueryBetsByCreatorResponse{ + Bet: genesis.BetList, + Pagination: &query.PageResponse{ + Total: 1, + }, + }, + }, + { + "test GRPC Bet by UID", + fmt.Sprintf("%s/sge/bet/bets", baseURL), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + &types.QueryBetsResponse{}, + &types.QueryBetsResponse{ + Bet: genesis.BetList, + Pagination: &query.PageResponse{ + Total: 1, + }, + }, + }, + { + "test GRPC pending bets by market", + fmt.Sprintf("%s/sge/bet/bets/pending/%s", baseURL, dummyMarketUID), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + &types.QueryPendingBetsResponse{}, + &types.QueryPendingBetsResponse{ + Bet: genesis.BetList, + Pagination: &query.PageResponse{ + Total: 1, + }, + }, + }, + { + "test GRPC settled bets by market", + fmt.Sprintf("%s/sge/bet/bets/settled/%d", baseURL, 1), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + &types.QuerySettledBetsOfHeightResponse{}, + &types.QuerySettledBetsOfHeightResponse{ + Bet: genesis.BetList, + Pagination: &query.PageResponse{ + Total: 1, + }, + }, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + s.Require().NoError(err) + + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + }) + } +} diff --git a/tests/e2e/bet/suite.go b/tests/e2e/bet/suite.go new file mode 100644 index 00000000..c6d5a203 --- /dev/null +++ b/tests/e2e/bet/suite.go @@ -0,0 +1,461 @@ +package client + +import ( + "fmt" + "time" + + "github.com/golang-jwt/jwt" + "github.com/google/uuid" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" + + e2esdk "github.com/sge-network/sge/tests/e2e/sdk" + "github.com/sge-network/sge/testutil/network" + "github.com/sge-network/sge/testutil/sample" + "github.com/sge-network/sge/testutil/simapp" + sgetypes "github.com/sge-network/sge/types" + "github.com/sge-network/sge/x/bet/client/cli" + "github.com/sge-network/sge/x/bet/types" + housecli "github.com/sge-network/sge/x/house/client/cli" + marketcli "github.com/sge-network/sge/x/market/client/cli" + markettypes "github.com/sge-network/sge/x/market/types" +) + +var ( + genesis types.GenesisState + + dummyMarket = markettypes.Market{} + dummyBetCreator = sample.AccAddress() + dummyBetUID = uuid.NewString() + dummyMarketUID = uuid.NewString() + + oddsUID1 = "9991c60f-2025-48ce-ae79-1dc110f16900" + oddsValue1 = sdkmath.LegacyNewDecWithPrec(14, 1) // 1.4 + oddsUID2 = "9991c60f-2025-48ce-ae79-1dc110f16901" + oddsValue2 = sdkmath.LegacyNewDecWithPrec(13, 1) // 1.3 + oddsUID3 = "9991c60f-2025-48ce-ae79-1dc110f16902" + maxLossMultiplier = sdkmath.LegacyNewDecWithPrec(10, 2) + + betFees = sdkmath.NewInt(10) + fees = int64(10) + marketUID = uuid.NewString() + marketStartDate = uint64(time.Now().Unix()) + marketEndDate = uint64(time.Now().Add(time.Minute * time.Duration(120)).Unix()) + depositAmount = sdkmath.NewInt(100000) + + wagerDate = time.Now().Add(time.Minute * time.Duration(180)).Unix() + wagerAmount = sdkmath.NewInt(100) + + acc1 = sdk.AccAddress{} + acc1Balance = sdkmath.ZeroInt() + + acc2 = sdk.AccAddress{} + acc2Balance = sdkmath.ZeroInt() +) + +type E2ETestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network +} + +func NewE2ETestSuite(cfg network.Config) *E2ETestSuite { + return &E2ETestSuite{cfg: cfg} +} + +func (s *E2ETestSuite) SetupSuite() { + s.T().Log("setting up e2e test suite") + + genesisState := s.cfg.GenesisState + + var marketGenesis markettypes.GenesisState + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[markettypes.ModuleName], &marketGenesis)) + + dummyMarket = markettypes.Market{ + Creator: sample.AccAddress(), + UID: dummyMarketUID, + StartTS: uint64(time.Now().Unix()), + EndTS: uint64(time.Now().Add(time.Minute * time.Duration(120)).Unix()), + Odds: []*markettypes.Odds{ + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16904", + Meta: "Home", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16905", + Meta: "Draw", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16906", + Meta: "Away", + }, + }, + WinnerOddsUIDs: []string{}, + Status: markettypes.MarketStatus_MARKET_STATUS_ACTIVE, + Meta: "dummy market", + BookUID: dummyMarketUID, + } + marketGenesis.MarketList = []markettypes.Market{dummyMarket} + marketGenesisBz, err := s.cfg.Codec.MarshalJSON(&marketGenesis) + s.Require().NoError(err) + genesisState[markettypes.ModuleName] = marketGenesisBz + + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[types.ModuleName], &genesis)) + + genesis.BetList = []types.Bet{ + { + Creator: dummyBetCreator, + UID: dummyBetUID, + OddsUID: marketGenesis.MarketList[0].OddsUIDS()[0], + OddsValue: "0.5", + Fee: sdkmath.NewInt(10), + Status: types.Bet_STATUS_SETTLED, + Result: types.Bet_RESULT_WON, + CreatedAt: wagerDate, + SettlementHeight: 1, + MaxLossMultiplier: sdkmath.LegacyNewDecWithPrec(10, 2), + Meta: types.MetaData{ + SelectedOddsType: types.OddsType_ODDS_TYPE_DECIMAL, + SelectedOddsValue: "0.5", + IsMainMarket: false, + }, + BetFulfillment: []*types.BetFulfillment{}, + MarketUID: dummyMarketUID, + Amount: wagerAmount, + }, + } + + genesis.Uid2IdList = []types.UID2ID{ + { + UID: dummyBetUID, + ID: 1, + }, + } + + genesis.PendingBetList = []types.PendingBet{ + { + UID: dummyBetUID, + Creator: dummyBetCreator, + }, + } + + genesis.SettledBetList = []types.SettledBet{ + { + UID: dummyBetUID, + BettorAddress: dummyBetCreator, + }, + } + + genesis.Stats = types.BetStats{ + Count: 1, + } + + genesis.Params = types.Params{ + BatchSettlementCount: uint32(1000), + MaxBetByUidQueryCount: uint32(1000), + Constraints: types.Constraints{ + MinAmount: sdkmath.NewInt(100), + Fee: betFees, + }, + } + + genesisBz, err := s.cfg.Codec.MarshalJSON(&genesis) + s.Require().NoError(err) + genesisState[types.ModuleName] = genesisBz + s.cfg.GenesisState = genesisState + + s.network = network.New(s.T(), s.cfg) + + s.Require().NoError(s.network.WaitForNextBlock()) +} + +func (s *E2ETestSuite) TestWagerTxCmd() { + val := s.network.Validators[0] + + clientCtx := val.ClientCtx + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "uid": marketUID, + "start_ts": marketStartDate, + "end_ts": marketEndDate, + "odds": []markettypes.Odds{ + { + UID: oddsUID1, + Meta: "Home", + }, + { + UID: oddsUID2, + Meta: "Draw", + }, + { + UID: oddsUID3, + Meta: "Away", + }, + }, + "status": markettypes.MarketStatus_MARKET_STATUS_ACTIVE, + "meta": "sample 3way market", + }) + require.Nil(s.T(), err) + + args := []string{ + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + } + bz, err := clitestutil.ExecTestCLICmd(clientCtx, marketcli.CmdAdd(), args) + s.Require().NoError(err) + respType := sdk.TxResponse{} + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + s.Require().Equal(uint32(0), respType.Code) + } + s.Require().NoError(s.network.WaitForNextBlock()) + + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + "depositor_address": val.Address.String(), + }) + require.Nil(s.T(), err) + + bz, err := clitestutil.ExecTestCLICmd(clientCtx, housecli.CmdDeposit(), []string{ + marketUID, + depositAmount.String(), + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }) + s.Require().NoError(err) + + var respType sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + s.Require().Equal(uint32(0), respType.Code) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(uint32(0), txResp.Code) + } + + acc1initialBalance := 1000 + acc1 = e2esdk.CreateAccount(val, "acc1") + e2esdk.SendToken(val, acc1, acc1initialBalance) + s.Require().NoError(s.network.WaitForNextBlock()) + acc1Balance = e2esdk.GetSGEBalance(clientCtx, acc1.String()) + + acc2initialBalance := 1000 + acc2 = e2esdk.CreateAccount(val, "acc2") + e2esdk.SendToken(val, acc2, acc2initialBalance) + s.Require().NoError(s.network.WaitForNextBlock()) + acc2Balance = e2esdk.GetSGEBalance(clientCtx, acc2.String()) + + testCases := []struct { + name string + uid string + marketUID string + amount sdkmath.Int + ticketClaims jwt.MapClaims + args []string + expectErr bool + expectedCode uint32 + expectedErrMsg string + respType proto.Message + }{ + { + "valid transaction for acc1", + uuid.NewString(), + marketUID, + wagerAmount, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: acc1.String(), + }, + "selected_odds": types.BetOdds{ + UID: oddsUID1, + MarketUID: marketUID, + Value: oddsValue1.String(), + MaxLossMultiplier: maxLossMultiplier, + }, + "all_odds": []types.BetOddsCompact{ + {UID: oddsUID1, MaxLossMultiplier: maxLossMultiplier}, + {UID: oddsUID2, MaxLossMultiplier: maxLossMultiplier}, + {UID: oddsUID3, MaxLossMultiplier: maxLossMultiplier}, + }, + "meta": types.MetaData{ + SelectedOddsType: types.OddsType_ODDS_TYPE_DECIMAL, + SelectedOddsValue: oddsValue1.String(), + IsMainMarket: false, + }, + "context": "sample context", + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, "acc1"), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + { + "valid transaction for acc2", + uuid.NewString(), + marketUID, + wagerAmount, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: acc2.String(), + }, + "selected_odds": types.BetOdds{ + UID: oddsUID2, + MarketUID: marketUID, + Value: oddsValue2.String(), + MaxLossMultiplier: maxLossMultiplier, + }, + "all_odds": []types.BetOddsCompact{ + {UID: oddsUID1, MaxLossMultiplier: maxLossMultiplier}, + {UID: oddsUID2, MaxLossMultiplier: maxLossMultiplier}, + {UID: oddsUID3, MaxLossMultiplier: maxLossMultiplier}, + }, + "meta": types.MetaData{ + SelectedOddsType: types.OddsType_ODDS_TYPE_DECIMAL, + SelectedOddsValue: oddsValue2.String(), + IsMainMarket: false, + }, + "context": "sample context", + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, "acc2"), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Require().NoError(s.network.WaitForNextBlock()) + s.Run(tc.name, func() { + ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) + require.Nil(s.T(), err) + + tc.args = append([]string{ + tc.uid, + tc.amount.String(), + ticket, + }, tc.args...) + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdWager(), tc.args) + + if tc.expectErr { + s.Require().Error(err) + s.T().Logf("error captured: %s", tc.name) + } else { + s.Require().NoError(err) + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String()) + respType, ok := tc.respType.(*sdk.TxResponse) + s.Require().True(ok) + s.Require().Equal(tc.expectedCode, respType.Code) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(tc.expectedCode, txResp.Code) + if tc.expectedErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectedErrMsg) + } + } + }) + } + + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "uid": marketUID, + "resolution_ts": uint64(time.Now().Unix()), + "winner_odds_uids": []string{oddsUID1}, + "status": markettypes.MarketStatus_MARKET_STATUS_RESULT_DECLARED, + }) + require.Nil(s.T(), err) + + bz, err := clitestutil.ExecTestCLICmd(clientCtx, marketcli.CmdResolve(), []string{ + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }) + s.Require().NoError(err) + + var respType sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + s.Require().Equal(uint32(0), respType.Code) + + s.Require().NoError(s.network.WaitForNextBlock()) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(uint32(0), txResp.Code) + s.T().Logf("==== success deposit create test case finished") + } + + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdListBet(), []string{fmt.Sprintf("--%s=json", flags.FlagOutput)}) + s.Require().NoError(err) + respType := types.QueryBetsResponse{} + err = clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType) + s.Require().NoError(err) + + s.Require().Equal(3, len(respType.Bet)) + + for _, b := range respType.Bet { + s.Require().Equal(types.Bet_STATUS_SETTLED, b.Status) + } + + payout1 := oddsValue1.Mul(wagerAmount.Sub(betFees).ToLegacyDec()).TruncateInt().Sub(wagerAmount) + expectedAcc1Balance := acc1Balance.Add(payout1).Sub(sdkmath.NewInt(fees)) + acc1Balance = e2esdk.GetSGEBalance(clientCtx, acc1.String()) + s.Require().Equal(expectedAcc1Balance, acc1Balance) + + expectedAcc2Balance := acc2Balance.Sub(wagerAmount).Sub(sdkmath.NewInt(fees)) + acc2Balance = e2esdk.GetSGEBalance(clientCtx, acc2.String()) + s.Require().Equal(expectedAcc2Balance, acc2Balance) +} diff --git a/tests/e2e/house/cli_test.go b/tests/e2e/house/cli_test.go new file mode 100644 index 00000000..6e37be14 --- /dev/null +++ b/tests/e2e/house/cli_test.go @@ -0,0 +1,16 @@ +package client_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + client "github.com/sge-network/sge/tests/e2e/house" + "github.com/sge-network/sge/testutil/network" +) + +func TestE2ETestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + suite.Run(t, client.NewE2ETestSuite(cfg)) +} diff --git a/tests/e2e/house/grpc.go b/tests/e2e/house/grpc.go new file mode 100644 index 00000000..192c8705 --- /dev/null +++ b/tests/e2e/house/grpc.go @@ -0,0 +1,105 @@ +package client + +import ( + "fmt" + + "github.com/cosmos/gogoproto/proto" + + "github.com/cosmos/cosmos-sdk/testutil" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + "github.com/cosmos/cosmos-sdk/types/query" + + "github.com/sge-network/sge/x/house/types" +) + +func (s *E2ETestSuite) TestDepositsGRPCHandler() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + testCases := []struct { + name string + url string + headers map[string]string + respType proto.Message + expected proto.Message + }{ + { + "test GRPC all deposits", + fmt.Sprintf("%s/sge/house/deposits", baseURL), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + &types.QueryDepositsResponse{}, + &types.QueryDepositsResponse{ + Deposits: genesis.DepositList, + Pagination: &query.PageResponse{ + Total: 1, + }, + }, + }, + { + "test GRPC deposits of certain creator", + fmt.Sprintf("%s/sge/house/deposits/%s", baseURL, dummyDepositor), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + &types.QueryDepositsByAccountResponse{}, + &types.QueryDepositsByAccountResponse{ + Deposits: genesis.DepositList, + Pagination: &query.PageResponse{ + Total: 1, + }, + }, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + s.Require().NoError(err) + + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + }) + } +} + +func (s *E2ETestSuite) TestGRPCHandler() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + testCases := []struct { + name string + url string + headers map[string]string + respType proto.Message + expected proto.Message + }{ + { + "test GRPC all withdraws", + fmt.Sprintf("%s/sge/house/withdrawals/%s", baseURL, dummyDepositor), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + &types.QueryWithdrawalsByAccountResponse{}, + &types.QueryWithdrawalsByAccountResponse{ + Withdrawals: genesis.WithdrawalList, + Pagination: &query.PageResponse{ + Total: 1, + }, + }, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + s.Require().NoError(err) + + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + }) + } +} diff --git a/tests/e2e/house/suite.go b/tests/e2e/house/suite.go new file mode 100644 index 00000000..7276221c --- /dev/null +++ b/tests/e2e/house/suite.go @@ -0,0 +1,1046 @@ +package client + +import ( + "fmt" + "time" + + "github.com/golang-jwt/jwt" + "github.com/google/uuid" + "github.com/spf13/cast" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrtypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/gogoproto/proto" + + e2esdk "github.com/sge-network/sge/tests/e2e/sdk" + "github.com/sge-network/sge/testutil/network" + "github.com/sge-network/sge/testutil/sample" + "github.com/sge-network/sge/testutil/simapp" + sgetypes "github.com/sge-network/sge/types" + "github.com/sge-network/sge/x/house/client/cli" + "github.com/sge-network/sge/x/house/types" + marketcli "github.com/sge-network/sge/x/market/client/cli" + markettypes "github.com/sge-network/sge/x/market/types" +) + +var ( + genesis types.GenesisState + dummyDepositor = sample.AccAddress() + + fees = int64(10) + marketUID = uuid.NewString() + marketStartDate = uint64(time.Now().Unix()) + marketEndDate = uint64(time.Now().Add(time.Minute * time.Duration(120)).Unix()) + depositAmount = sdkmath.NewInt(100) + + valBalance = sdkmath.NewInt(400000000) + + acc1 = sdk.AccAddress{} + acc1Balance = sdkmath.ZeroInt() + + acc2 = sdk.AccAddress{} + acc2Balance = sdkmath.ZeroInt() +) + +type E2ETestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network +} + +func NewE2ETestSuite(cfg network.Config) *E2ETestSuite { + return &E2ETestSuite{cfg: cfg} +} + +func (s *E2ETestSuite) SetupSuite() { + s.T().Log("setting up e2e test suite") + + genesisState := s.cfg.GenesisState + + var marketGenesis markettypes.GenesisState + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[markettypes.ModuleName], &marketGenesis)) + + dummyMarketUID := uuid.NewString() + marketGenesis.MarketList = []markettypes.Market{ + { + Creator: sample.AccAddress(), + UID: dummyMarketUID, + StartTS: uint64(time.Now().Unix()), + EndTS: uint64(time.Now().Add(time.Minute * time.Duration(120)).Unix()), + Odds: []*markettypes.Odds{ + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16900", + Meta: "Home", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16901", + Meta: "Draw", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16901", + Meta: "Away", + }, + }, + WinnerOddsUIDs: []string{}, + Status: markettypes.MarketStatus_MARKET_STATUS_ACTIVE, + Meta: "dummy market", + BookUID: dummyMarketUID, + }, + } + marketGenesisBz, err := s.cfg.Codec.MarshalJSON(&marketGenesis) + s.Require().NoError(err) + genesisState[markettypes.ModuleName] = marketGenesisBz + + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[types.ModuleName], &genesis)) + + genesis.DepositList = []types.Deposit{ + { + Creator: sample.AccAddress(), + DepositorAddress: dummyDepositor, + MarketUID: marketUID, + ParticipationIndex: 0, + Amount: sdkmath.NewInt(10000), + WithdrawalCount: 0, + TotalWithdrawalAmount: sdkmath.ZeroInt(), + }, + } + + genesis.WithdrawalList = []types.Withdrawal{ + { + ID: 1, + Creator: sample.AccAddress(), + Address: dummyDepositor, + MarketUID: marketUID, + ParticipationIndex: 0, + Amount: sdkmath.NewInt(10000), + Mode: types.WithdrawalMode_WITHDRAWAL_MODE_FULL, + }, + } + + genesis.Params = types.Params{ + MinDeposit: sdkmath.NewInt(100), + HouseParticipationFee: sdk.NewDecWithPrec(0, 2), + MaxWithdrawalCount: 2, + } + + genesisBz, err := s.cfg.Codec.MarshalJSON(&genesis) + s.Require().NoError(err) + genesisState[types.ModuleName] = genesisBz + s.cfg.GenesisState = genesisState + + s.network = network.New(s.T(), s.cfg) + + s.Require().NoError(s.network.WaitForNextBlock()) +} + +func (s *E2ETestSuite) TestDepositTxCmd() { + s.T().Log("==== new house deposit command test started") + val := s.network.Validators[0] + + clientCtx := val.ClientCtx + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "uid": marketUID, + "start_ts": marketStartDate, + "end_ts": marketEndDate, + "odds": []markettypes.Odds{ + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16990", + Meta: "Home", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16991", + Meta: "Draw", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16992", + Meta: "Away", + }, + }, + "status": markettypes.MarketStatus_MARKET_STATUS_ACTIVE, + "meta": "sample 3way market", + }) + require.Nil(s.T(), err) + + args := []string{ + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + } + bz, err := clitestutil.ExecTestCLICmd(clientCtx, marketcli.CmdAdd(), args) + s.Require().NoError(err) + respType := sdk.TxResponse{} + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + s.Require().Equal(uint32(0), respType.Code) + } + s.Require().NoError(s.network.WaitForNextBlock()) + + expectedValBalance := valBalance.Sub(sdkmath.NewInt(fees)) + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(expectedValBalance, valBalance) + + acc1initialBalance := 1000 + acc1 = e2esdk.CreateAccount(val, "acc1") + e2esdk.SendToken(val, acc1, acc1initialBalance) + s.Require().NoError(s.network.WaitForNextBlock()) + + expectedValBalance = valBalance.Sub(sdkmath.NewInt(int64(acc1initialBalance))).Sub(sdkmath.NewInt(fees)) + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(expectedValBalance, valBalance) + + testCases := []struct { + name string + marketUID string + amount sdkmath.Int + ticketClaims jwt.MapClaims + args []string + expectErr bool + expectedCode uint32 + expectedErrMsg string + respType proto.Message + }{ + { + "valid transaction for val", + marketUID, + depositAmount, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + "depositor_address": val.Address.String(), + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + { + "invalid transaction for acc1", + marketUID, + sdkmath.NewInt(100000000), + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: acc1.String(), + }, + "depositor_address": acc1.String(), + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, "acc1"), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + true, + sdkerrtypes.ErrInsufficientFunds.ABCICode(), + "", + &sdk.TxResponse{}, + }, + { + "valid transaction for acc1", + marketUID, + depositAmount, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: acc1.String(), + }, + "depositor_address": acc1.String(), + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, "acc1"), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Require().NoError(s.network.WaitForNextBlock()) + s.Run(tc.name, func() { + ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) + require.Nil(s.T(), err) + + tc.args = append([]string{ + tc.marketUID, + tc.amount.String(), + ticket, + }, tc.args...) + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdDeposit(), tc.args) + + if tc.expectErr { + s.Require().Error(err) + s.T().Logf("error captured: %s", tc.name) + } else { + s.Require().NoError(err) + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String()) + respType, ok := tc.respType.(*sdk.TxResponse) + s.Require().True(ok) + s.Require().Equal(tc.expectedCode, respType.Code) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(tc.expectedCode, txResp.Code) + if tc.expectedErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectedErrMsg) + } + s.T().Logf("==== success deposit create test case finished: %s", tc.name) + } + }) + } + + depositFeeAmount := sdk.NewDecFromInt(depositAmount).Mul(genesis.Params.HouseParticipationFee).TruncateInt() + + expectedValBalance = valBalance.Sub(depositAmount).Sub(depositFeeAmount).Sub(sdkmath.NewInt(fees)) + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(expectedValBalance, valBalance) + s.T().Logf("==== bank val balance checked after deposit to the market: %s", valBalance) + + acc1Balance = e2esdk.GetSGEBalance(clientCtx, acc1.String()) + expectedBalance := sdkmath.NewInt(int64(acc1initialBalance)).Sub(depositAmount).Sub(depositFeeAmount).Sub(sdkmath.NewInt(fees)) + s.Require().Equal(expectedBalance, acc1Balance) + s.T().Logf("==== bank acc1 balance checked after deposit to the market: %s", acc1Balance) + + depositsBz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryDeposits(), []string{ + fmt.Sprintf("--%s=json", flags.FlagOutput), + }) + require.NoError(s.T(), err) + deposits := types.QueryDepositsResponse{} + err = clientCtx.Codec.UnmarshalJSON(depositsBz.Bytes(), &deposits) + require.NoError(s.T(), err) + + require.Equal(s.T(), 3, len(deposits.Deposits)) + + depositBz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryDepositsByAccount(), []string{ + acc1.String(), + fmt.Sprintf("--%s=json", flags.FlagOutput), + }) + require.NoError(s.T(), err) + deposit := types.QueryDepositsByAccountResponse{} + err = clientCtx.Codec.UnmarshalJSON(depositBz.Bytes(), &deposit) + require.NoError(s.T(), err) + + require.Equal(s.T(), []types.Deposit{ + { + Creator: acc1.String(), + DepositorAddress: acc1.String(), + MarketUID: marketUID, + ParticipationIndex: 2, + Amount: depositAmount, + WithdrawalCount: 0, + TotalWithdrawalAmount: sdkmath.ZeroInt(), + }, + }, deposit.Deposits) + require.Equal(s.T(), acc1.String(), deposit.Deposits[0].DepositorAddress) + s.T().Log("==== state modifications checked after deposit to the market") + + s.T().Log("==== new deposit test passed successfully") +} + +func (s *E2ETestSuite) TestDepositWithAuthzTxCmd() { + s.T().Log("==== new house deposit with authorization command test started") + val := s.network.Validators[0] + + clientCtx := val.ClientCtx + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "uid": marketUID, + "start_ts": marketStartDate, + "end_ts": marketEndDate, + "odds": []markettypes.Odds{ + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16990", + Meta: "Home", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16991", + Meta: "Draw", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16992", + Meta: "Away", + }, + }, + "status": markettypes.MarketStatus_MARKET_STATUS_ACTIVE, + "meta": "sample 3way market", + }) + require.Nil(s.T(), err) + + args := []string{ + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + } + bz, err := clitestutil.ExecTestCLICmd(clientCtx, marketcli.CmdAdd(), args) + s.Require().NoError(err) + respType := sdk.TxResponse{} + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + s.Require().Equal(uint32(0), respType.Code) + } + s.Require().NoError(s.network.WaitForNextBlock()) + + expectedValBalance := valBalance.Sub(sdkmath.NewInt(fees)) + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(expectedValBalance, valBalance) + + e2esdk.SetGenericAuthorization(val, acc1, sdk.MsgTypeURL(&types.MsgDeposit{})) + s.Require().NoError(s.network.WaitForNextBlock()) + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + + testCases := []struct { + name string + marketUID string + amount sdkmath.Int + ticketClaims jwt.MapClaims + args []string + expectErr bool + expectedCode uint32 + expectedErrMsg string + respType proto.Message + }{ + { + "valid transaction for acc1", + marketUID, + depositAmount, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + "depositor_address": val.Address.String(), + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, "acc1"), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Require().NoError(s.network.WaitForNextBlock()) + s.Run(tc.name, func() { + ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) + require.Nil(s.T(), err) + + tc.args = append([]string{ + tc.marketUID, + tc.amount.String(), + ticket, + }, tc.args...) + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdDeposit(), tc.args) + + if tc.expectErr { + s.Require().Error(err) + s.T().Logf("error captured: %s", tc.name) + } else { + s.Require().NoError(err) + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String()) + respType, ok := tc.respType.(*sdk.TxResponse) + s.Require().True(ok) + s.Require().Equal(tc.expectedCode, respType.Code) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(tc.expectedCode, txResp.Code) + if tc.expectedErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectedErrMsg) + } + s.T().Logf("==== success deposit create test case finished: %s", tc.name) + } + }) + } + + depositFeeAmount := sdk.NewDecFromInt(depositAmount).Mul(genesis.Params.HouseParticipationFee).TruncateInt() + + expectedValBalance = valBalance.Sub(depositAmount).Sub(depositFeeAmount) + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(expectedValBalance, valBalance) + s.T().Logf("==== bank val balance checked after deposit to the market: %s", valBalance) + + expectedAcc1Balance := acc1Balance.Sub(sdkmath.NewInt(fees)) + acc1Balance = e2esdk.GetSGEBalance(clientCtx, acc1.String()) + s.Require().Equal(expectedAcc1Balance, acc1Balance) + s.T().Logf("==== bank acc1 balance checked after deposit to the market: %s", acc1Balance) + + depositsBz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryDeposits(), []string{ + fmt.Sprintf("--%s=json", flags.FlagOutput), + }) + require.NoError(s.T(), err) + deposits := types.QueryDepositsResponse{} + err = clientCtx.Codec.UnmarshalJSON(depositsBz.Bytes(), &deposits) + require.NoError(s.T(), err) + + require.Equal(s.T(), 4, len(deposits.Deposits)) + + depositBz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryDepositsByAccount(), []string{ + val.Address.String(), + fmt.Sprintf("--%s=json", flags.FlagOutput), + }) + require.NoError(s.T(), err) + deposit := types.QueryDepositsByAccountResponse{} + err = clientCtx.Codec.UnmarshalJSON(depositBz.Bytes(), &deposit) + require.NoError(s.T(), err) + + require.Equal(s.T(), []types.Deposit{ + { + Creator: val.Address.String(), + DepositorAddress: val.Address.String(), + MarketUID: marketUID, + ParticipationIndex: 1, + Amount: depositAmount, + WithdrawalCount: 0, + TotalWithdrawalAmount: sdkmath.ZeroInt(), + }, + { + Creator: acc1.String(), + DepositorAddress: val.Address.String(), + MarketUID: marketUID, + ParticipationIndex: 3, + Amount: depositAmount, + WithdrawalCount: 0, + TotalWithdrawalAmount: sdkmath.ZeroInt(), + }, + }, deposit.Deposits) + require.Equal(s.T(), val.Address.String(), deposit.Deposits[0].DepositorAddress) + s.T().Log("==== state modifications checked after deposit to the market") + + s.T().Log("==== new deposit with authorization test passed successfully") +} + +func (s *E2ETestSuite) TestWithdrawTxCmd() { + s.T().Log("==== new house deposit command test started") + val := s.network.Validators[0] + + clientCtx := val.ClientCtx + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "uid": marketUID, + "start_ts": marketStartDate, + "end_ts": marketEndDate, + "odds": []markettypes.Odds{ + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16990", + Meta: "Home", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16991", + Meta: "Draw", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16992", + Meta: "Away", + }, + }, + "status": markettypes.MarketStatus_MARKET_STATUS_ACTIVE, + "meta": "sample 3way market", + }) + require.Nil(s.T(), err) + + args := []string{ + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + } + bz, err := clitestutil.ExecTestCLICmd(clientCtx, marketcli.CmdAdd(), args) + s.Require().NoError(err) + respType := sdk.TxResponse{} + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + s.Require().Equal(uint32(0), respType.Code) + } + s.Require().NoError(s.network.WaitForNextBlock()) + + expectedValBalance := valBalance.Sub(sdkmath.NewInt(fees)) + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(expectedValBalance, valBalance) + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + "depositor_address": val.Address.String(), + }) + require.Nil(s.T(), err) + + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdDeposit(), []string{ + marketUID, + depositAmount.String(), + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }) + s.Require().NoError(err) + + var respType sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + s.Require().Equal(uint32(0), respType.Code) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(uint32(0), txResp.Code) + s.T().Logf("==== success deposit create test case finished") + } + + depositFeeAmount := sdk.NewDecFromInt(depositAmount).Mul(genesis.Params.HouseParticipationFee).TruncateInt() + + expectedValBalance = valBalance.Sub(depositAmount).Sub(depositFeeAmount).Sub(sdkmath.NewInt(fees)) + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(expectedValBalance, valBalance) + s.T().Logf("==== bank val balance checked after deposit to the market: %s", valBalance) + + depositsBz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryDeposits(), []string{ + fmt.Sprintf("--%s=json", flags.FlagOutput), + }) + require.NoError(s.T(), err) + deposits := types.QueryDepositsResponse{} + err = clientCtx.Codec.UnmarshalJSON(depositsBz.Bytes(), &deposits) + require.NoError(s.T(), err) + + require.Equal(s.T(), 5, len(deposits.Deposits)) + + depositBz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryDepositsByAccount(), []string{ + acc1.String(), + fmt.Sprintf("--%s=json", flags.FlagOutput), + }) + require.NoError(s.T(), err) + deposit := types.QueryDepositsByAccountResponse{} + err = clientCtx.Codec.UnmarshalJSON(depositBz.Bytes(), &deposit) + require.NoError(s.T(), err) + + require.Equal(s.T(), []types.Deposit{ + { + Creator: acc1.String(), + DepositorAddress: acc1.String(), + MarketUID: marketUID, + ParticipationIndex: 2, + Amount: depositAmount, + WithdrawalCount: 0, + TotalWithdrawalAmount: sdkmath.ZeroInt(), + }, + }, deposit.Deposits) + require.Equal(s.T(), acc1.String(), deposit.Deposits[0].DepositorAddress) + s.T().Log("==== state modifications checked after deposit to the market") + + firstWithdrawAmount := depositAmount.Sub(sdkmath.NewInt(10)) + testCases := []struct { + name string + marketUID string + participationIndex uint64 + ticketClaims jwt.MapClaims + mode types.WithdrawalMode + amount sdkmath.Int + args []string + expectErr bool + expectedCode uint32 + expectedErrMsg string + respType proto.Message + }{ + { + "invalid transaction with large amount for val", + marketUID, + 4, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + }, + types.WithdrawalMode_WITHDRAWAL_MODE_PARTIAL, + sdkmath.NewInt(10000000000), + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + true, + 0, + "withdrawal is more than unused amount", + &sdk.TxResponse{}, + }, + { + "valid transaction for val", + marketUID, + 4, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + }, + types.WithdrawalMode_WITHDRAWAL_MODE_PARTIAL, + firstWithdrawAmount, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + { + "second valid transaction for val with the rest of the amount", + marketUID, + 4, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + }, + types.WithdrawalMode_WITHDRAWAL_MODE_FULL, + sdkmath.Int{}, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Require().NoError(s.network.WaitForNextBlock()) + s.Run(tc.name, func() { + ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) + require.Nil(s.T(), err) + + tc.args = append([]string{ + tc.marketUID, + cast.ToString(tc.participationIndex), + ticket, + cast.ToString(int32(tc.mode)), + tc.amount.String(), + }, tc.args...) + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdWithdraw(), tc.args) + + if tc.expectErr { + s.Require().Error(err) + s.T().Logf("error captured: %s", tc.name) + } else { + s.Require().NoError(err) + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String()) + respType, ok := tc.respType.(*sdk.TxResponse) + s.Require().True(ok) + s.Require().Equal(tc.expectedCode, respType.Code) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(tc.expectedCode, txResp.Code) + if tc.expectedErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectedErrMsg) + } + s.T().Logf("==== success deposit create test case finished: %s", tc.name) + } + }) + } + + s.T().Log("==== new deposit test passed successfully") +} + +func (s *E2ETestSuite) TestWithdrawWithAuthzTxCmd() { + s.T().Log("==== new house deposit command test started") + val := s.network.Validators[0] + + clientCtx := val.ClientCtx + // { + // ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + // "exp": time.Now().Add(time.Minute * 5).Unix(), + // "iat": time.Now().Unix(), + // "uid": marketUID, + // "start_ts": marketStartDate, + // "end_ts": marketEndDate, + // "odds": []markettypes.Odds{ + // { + // UID: "9991c60f-2025-48ce-ae79-1dc110f16990", + // Meta: "Home", + // }, + // { + // UID: "9991c60f-2025-48ce-ae79-1dc110f16991", + // Meta: "Draw", + // }, + // { + // UID: "9991c60f-2025-48ce-ae79-1dc110f16992", + // Meta: "Away", + // }, + // }, + // "status": markettypes.MarketStatus_MARKET_STATUS_ACTIVE, + // "meta": "sample 3way market", + // }) + // require.Nil(s.T(), err) + + // args := []string{ + // ticket, + // fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + // fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + // fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + // fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + // } + // bz, err := clitestutil.ExecTestCLICmd(clientCtx, marketcli.CmdAdd(), args) + // s.Require().NoError(err) + // respType := sdk.TxResponse{} + // s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + // s.Require().Equal(uint32(0), respType.Code) + // } + // s.Require().NoError(s.network.WaitForNextBlock()) + + acc2initialBalance := 1000 + acc2 = e2esdk.CreateAccount(val, "acc2") + e2esdk.SendToken(val, acc2, acc2initialBalance) + s.Require().NoError(s.network.WaitForNextBlock()) + acc2Balance = e2esdk.GetSGEBalance(clientCtx, acc2.String()) + + e2esdk.SetGenericAuthorization(val, acc2, sdk.MsgTypeURL(&types.MsgWithdraw{})) + s.Require().NoError(s.network.WaitForNextBlock()) + + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + "depositor_address": val.Address.String(), + }) + require.Nil(s.T(), err) + + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdDeposit(), []string{ + marketUID, + depositAmount.String(), + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }) + s.Require().NoError(err) + + var respType sdk.TxResponse + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + s.Require().Equal(uint32(0), respType.Code) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(uint32(0), txResp.Code) + s.T().Logf("==== success deposit create test case finished") + } + + depositFeeAmount := sdk.NewDecFromInt(depositAmount).Mul(genesis.Params.HouseParticipationFee).TruncateInt() + + expectedValBalance := valBalance.Sub(depositAmount).Sub(depositFeeAmount).Sub(sdkmath.NewInt(fees)) + valBalance = e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(expectedValBalance, valBalance) + s.T().Logf("==== bank val balance checked after deposit to the market: %s", valBalance) + + depositsBz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryDeposits(), []string{ + fmt.Sprintf("--%s=json", flags.FlagOutput), + }) + require.NoError(s.T(), err) + deposits := types.QueryDepositsResponse{} + err = clientCtx.Codec.UnmarshalJSON(depositsBz.Bytes(), &deposits) + require.NoError(s.T(), err) + + require.Equal(s.T(), 6, len(deposits.Deposits)) + + depositBz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryDepositsByAccount(), []string{ + val.Address.String(), + fmt.Sprintf("--%s=json", flags.FlagOutput), + }) + require.NoError(s.T(), err) + deposit := types.QueryDepositsByAccountResponse{} + err = clientCtx.Codec.UnmarshalJSON(depositBz.Bytes(), &deposit) + require.NoError(s.T(), err) + + require.Equal(s.T(), val.Address.String(), deposit.Deposits[0].DepositorAddress) + s.T().Log("==== state modifications checked after deposit to the market") + + firstWithdrawAmount := depositAmount.Sub(sdkmath.NewInt(10)) + testCases := []struct { + name string + marketUID string + participationIndex uint64 + ticketClaims jwt.MapClaims + mode types.WithdrawalMode + amount sdkmath.Int + args []string + expectErr bool + expectedCode uint32 + expectedErrMsg string + respType proto.Message + }{ + { + "valid transaction for acc2", + marketUID, + 5, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "kyc_data": sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + "depositor_address": val.Address.String(), + }, + types.WithdrawalMode_WITHDRAWAL_MODE_PARTIAL, + firstWithdrawAmount, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, "acc2"), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Require().NoError(s.network.WaitForNextBlock()) + s.Run(tc.name, func() { + ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) + require.Nil(s.T(), err) + + tc.args = append([]string{ + tc.marketUID, + cast.ToString(tc.participationIndex), + ticket, + cast.ToString(int32(tc.mode)), + tc.amount.String(), + }, tc.args...) + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdWithdraw(), tc.args) + + if tc.expectErr { + s.Require().Error(err) + s.T().Logf("error captured: %s", tc.name) + } else { + s.Require().NoError(err) + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String()) + respType, ok := tc.respType.(*sdk.TxResponse) + s.Require().True(ok) + s.Require().Equal(tc.expectedCode, respType.Code) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(tc.expectedCode, txResp.Code) + if tc.expectedErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectedErrMsg) + } + s.T().Logf("==== success deposit create test case finished: %s", tc.name) + } + }) + } + + expectedAcc2Balance := acc2Balance.Sub(sdkmath.NewInt(fees)) + acc2Balance = e2esdk.GetSGEBalance(clientCtx, acc2.String()) + s.Require().Equal(expectedAcc2Balance, acc2Balance) + + s.T().Log("==== new deposit test passed successfully") +} diff --git a/tests/e2e/market/cli_test.go b/tests/e2e/market/cli_test.go new file mode 100644 index 00000000..18c7022a --- /dev/null +++ b/tests/e2e/market/cli_test.go @@ -0,0 +1,16 @@ +package client_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + client "github.com/sge-network/sge/tests/e2e/market" + "github.com/sge-network/sge/testutil/network" +) + +func TestE2ETestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + suite.Run(t, client.NewE2ETestSuite(cfg)) +} diff --git a/tests/e2e/market/grpc.go b/tests/e2e/market/grpc.go new file mode 100644 index 00000000..2eb83ee5 --- /dev/null +++ b/tests/e2e/market/grpc.go @@ -0,0 +1,48 @@ +package client + +import ( + "fmt" + + "github.com/cosmos/gogoproto/proto" + + "github.com/cosmos/cosmos-sdk/testutil" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + + "github.com/sge-network/sge/x/market/types" +) + +func (s *E2ETestSuite) TestMarketsGRPCHandler() { + val := s.network.Validators[0] + baseURL := val.APIAddress + + testCases := []struct { + name string + url string + headers map[string]string + respType proto.Message + expected proto.Message + }{ + { + "test GRPC Market by UID", + fmt.Sprintf("%s/sge/market/%s", baseURL, dummyMarketUID), + map[string]string{ + grpctypes.GRPCBlockHeightHeader: "1", + }, + &types.QueryMarketResponse{}, + &types.QueryMarketResponse{ + Market: dummyMarket, + }, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + resp, err := testutil.GetRequestWithHeaders(tc.url, tc.headers) + s.Require().NoError(err) + + s.Require().NoError(val.ClientCtx.Codec.UnmarshalJSON(resp, tc.respType)) + s.Require().Equal(tc.expected.String(), tc.respType.String()) + }) + } +} diff --git a/tests/e2e/market/suite.go b/tests/e2e/market/suite.go new file mode 100644 index 00000000..711f92d0 --- /dev/null +++ b/tests/e2e/market/suite.go @@ -0,0 +1,214 @@ +package client + +import ( + "fmt" + "time" + + "github.com/golang-jwt/jwt" + "github.com/google/uuid" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" + + e2esdk "github.com/sge-network/sge/tests/e2e/sdk" + "github.com/sge-network/sge/testutil/network" + "github.com/sge-network/sge/testutil/sample" + "github.com/sge-network/sge/testutil/simapp" + "github.com/sge-network/sge/x/market/client/cli" + "github.com/sge-network/sge/x/market/types" +) + +var ( + genesis types.GenesisState + + dummyMarket = types.Market{} + dummyMarketUID = uuid.NewString() + + oddsUID1 = "9991c60f-2025-48ce-ae79-1dc110f16900" + oddsUID2 = "9991c60f-2025-48ce-ae79-1dc110f16901" + oddsUID3 = "9991c60f-2025-48ce-ae79-1dc110f16902" + + fees = int64(10) + marketUID = uuid.NewString() + marketStartDate = uint64(time.Now().Unix()) + marketEndDate = uint64(time.Now().Add(time.Minute * time.Duration(120)).Unix()) +) + +type E2ETestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network +} + +func NewE2ETestSuite(cfg network.Config) *E2ETestSuite { + return &E2ETestSuite{cfg: cfg} +} + +func (s *E2ETestSuite) SetupSuite() { + s.T().Log("setting up e2e test suite") + + genesisState := s.cfg.GenesisState + + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[types.ModuleName], &genesis)) + + dummyMarket = types.Market{ + Creator: sample.AccAddress(), + UID: dummyMarketUID, + StartTS: uint64(time.Now().Unix()), + EndTS: uint64(time.Now().Add(time.Minute * time.Duration(120)).Unix()), + Odds: []*types.Odds{ + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16904", + Meta: "Home", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16905", + Meta: "Draw", + }, + { + UID: "9991c60f-2025-48ce-ae79-1dc110f16906", + Meta: "Away", + }, + }, + WinnerOddsUIDs: []string{}, + Status: types.MarketStatus_MARKET_STATUS_ACTIVE, + Meta: "dummy market", + BookUID: dummyMarketUID, + } + genesis.MarketList = []types.Market{dummyMarket} + + genesis.Stats = types.MarketStats{ + // ResolvedUnsettled: []string{dummyMarketUID}, + } + + // genesis.Params = types.Params{} + + genesisBz, err := s.cfg.Codec.MarshalJSON(&genesis) + s.Require().NoError(err) + genesisState[types.ModuleName] = genesisBz + s.cfg.GenesisState = genesisState + + s.network = network.New(s.T(), s.cfg) + + s.Require().NoError(s.network.WaitForNextBlock()) +} + +func (s *E2ETestSuite) TestMarketAddTxCmd() { + val := s.network.Validators[0] + + clientCtx := val.ClientCtx + + valBalance := e2esdk.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(sdkmath.NewInt(400000000), valBalance) + + testCases := []struct { + name string + ticketClaims jwt.MapClaims + args []string + expectErr bool + expectedCode uint32 + expectedErrMsg string + respType proto.Message + }{ + { + "invalid transaction for val", + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "uid": marketUID, + "start_ts": marketStartDate, + "end_ts": marketEndDate, + "odds": []types.Odds{}, + "status": types.MarketStatus_MARKET_STATUS_ACTIVE, + "meta": "sample 3way market", + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + true, + 0, + "", + &sdk.TxResponse{}, + }, + { + "valid transaction for val", + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "uid": marketUID, + "start_ts": marketStartDate, + "end_ts": marketEndDate, + "odds": []types.Odds{ + { + UID: oddsUID1, + Meta: "Home", + }, + { + UID: oddsUID2, + Meta: "Draw", + }, + { + UID: oddsUID3, + Meta: "Away", + }, + }, + "status": types.MarketStatus_MARKET_STATUS_ACTIVE, + "meta": "sample 3way market", + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagGas, flags.GasFlagAuto), + fmt.Sprintf("--%s=%s", flags.FlagGasAdjustment, "1.15"), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(fees))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Require().NoError(s.network.WaitForNextBlock()) + s.Run(tc.name, func() { + ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) + require.Nil(s.T(), err) + + tc.args = append([]string{ticket}, tc.args...) + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdAdd(), tc.args) + + if tc.expectErr { + s.Require().Error(err) + s.T().Logf("error captured: %s", tc.name) + } else { + s.Require().NoError(err) + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String()) + respType, ok := tc.respType.(*sdk.TxResponse) + s.Require().True(ok) + s.Require().Equal(tc.expectedCode, respType.Code) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(tc.expectedCode, txResp.Code) + if tc.expectedErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectedErrMsg) + } + } + }) + } +} diff --git a/tests/e2e/reward/cli_test.go b/tests/e2e/reward/cli_test.go new file mode 100644 index 00000000..06d65961 --- /dev/null +++ b/tests/e2e/reward/cli_test.go @@ -0,0 +1,16 @@ +package client_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + client "github.com/sge-network/sge/tests/e2e/reward" + "github.com/sge-network/sge/testutil/network" +) + +func TestE2ETestSuite(t *testing.T) { + cfg := network.DefaultConfig() + cfg.NumValidators = 1 + suite.Run(t, client.NewE2ETestSuite(cfg)) +} diff --git a/tests/e2e/reward/grpc.go b/tests/e2e/reward/grpc.go new file mode 100644 index 00000000..da13c8ef --- /dev/null +++ b/tests/e2e/reward/grpc.go @@ -0,0 +1 @@ +package client diff --git a/tests/e2e/reward/suite.go b/tests/e2e/reward/suite.go new file mode 100644 index 00000000..31057b0c --- /dev/null +++ b/tests/e2e/reward/suite.go @@ -0,0 +1,281 @@ +package client + +import ( + "fmt" + "time" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" + "github.com/golang-jwt/jwt" + "github.com/google/uuid" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + sdkcli "github.com/sge-network/sge/tests/e2e/sdk" + "github.com/sge-network/sge/testutil/network" + "github.com/sge-network/sge/testutil/simapp" + sgetypes "github.com/sge-network/sge/types" + "github.com/sge-network/sge/x/reward/client/cli" + "github.com/sge-network/sge/x/reward/types" + subaccountcli "github.com/sge-network/sge/x/subaccount/client/cli" + subaccounttypes "github.com/sge-network/sge/x/subaccount/types" +) + +var ( + genesis types.GenesisState + fees = int64(10) + promoterUID = uuid.NewString() + campaignStartDate = uint64(time.Now().Unix()) + campaignEndDate = time.Now().Add(time.Minute * time.Duration(120)).Unix() + campaignFunds = sdkmath.NewInt(100000000) +) + +type E2ETestSuite struct { + suite.Suite + + cfg network.Config + network *network.Network +} + +func NewE2ETestSuite(cfg network.Config) *E2ETestSuite { + return &E2ETestSuite{cfg: cfg} +} + +func (s *E2ETestSuite) SetupSuite() { + s.T().Log("setting up e2e test suite") + + genesisState := s.cfg.GenesisState + s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[types.ModuleName], &genesis)) + + genesisBz, err := s.cfg.Codec.MarshalJSON(&genesis) + s.Require().NoError(err) + genesisState[types.ModuleName] = genesisBz + s.cfg.GenesisState = genesisState + + s.network = network.New(s.T(), s.cfg) + s.Require().NoError(s.network.WaitForNextBlock()) +} + +func (s *E2ETestSuite) TestNewCampaignTxCmd() { + s.T().Log("==== new campaign create command test started") + val := s.network.Validators[0] + + clientCtx := val.ClientCtx + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "uid": promoterUID, + "conf": types.PromoterConf{ + CategoryCap: []types.CategoryCap{{ + Category: types.RewardCategory_REWARD_CATEGORY_SIGNUP, + CapPerAcc: 1, + }}, + }, + }) + require.Nil(s.T(), err) + + args := []string{ + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), + } + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdCreatePromoter(), args) + s.Require().NoError(err) + respType := sdk.TxResponse{} + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + s.Require().Equal(uint32(0), respType.Code) + } + + valBalance := sdkcli.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(sdkmath.NewInt(400000000), valBalance) + + campaignUID := uuid.NewString() + testCases := []struct { + name string + uid string + totalFunds sdkmath.Int + ticketClaims jwt.MapClaims + args []string + expectErr bool + expectedCode uint32 + expectedErrMsg string + respType proto.Message + }{ + { + "not enough balance to charge pool", + campaignUID, + sdkmath.NewInt(4000000000), + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "promoter": val.Address, + "start_ts": campaignStartDate, + "end_ts": campaignEndDate, + "category": types.RewardCategory_REWARD_CATEGORY_SIGNUP, + "reward_type": types.RewardType_REWARD_TYPE_SIGNUP, + "reward_amount_type": types.RewardAmountType_REWARD_AMOUNT_TYPE_FIXED, + "reward_amount": types.RewardAmount{ + SubaccountAmount: sdkmath.NewInt(100), + UnlockPeriod: uint64(1000), + }, + "is_active": true, + "meta": "sample signup campaign", + "cap_count": 1, + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), + }, + false, + types.ErrInFundingCampaignPool.ABCICode(), + "", + &sdk.TxResponse{}, + }, + { + "valid transaction", + campaignUID, + campaignFunds, + jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "promoter": val.Address, + "start_ts": campaignStartDate, + "end_ts": campaignEndDate, + "category": types.RewardCategory_REWARD_CATEGORY_SIGNUP, + "reward_type": types.RewardType_REWARD_TYPE_SIGNUP, + "reward_amount_type": types.RewardAmountType_REWARD_AMOUNT_TYPE_FIXED, + "reward_amount": types.RewardAmount{ + SubaccountAmount: sdkmath.NewInt(100), + UnlockPeriod: uint64(1000), + }, + "is_active": true, + "meta": "sample signup campaign", + "cap_count": 1, + }, + []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), + }, + false, + 0, + "", + &sdk.TxResponse{}, + }, + } + + for _, tc := range testCases { + tc := tc + + s.Require().NoError(s.network.WaitForNextBlock()) + s.Run(tc.name, func() { + clientCtx := val.ClientCtx + + ticket, err := simapp.CreateJwtTicket(tc.ticketClaims) + require.Nil(s.T(), err) + + tc.args = append([]string{ + tc.uid, + tc.totalFunds.String(), + ticket, + }, tc.args...) + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdCreateCampaign(), tc.args) + + if tc.expectErr { + s.Require().Error(err) + s.T().Logf("error captured: %s", tc.name) + } else { + s.Require().NoError(err) + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String()) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(tc.expectedCode, txResp.Code) + if tc.expectedErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectedErrMsg) + } + s.T().Logf("==== success campaign create test case finished: %s", tc.name) + } + }) + } + + s.Require().NoError(s.network.WaitForNextBlock()) + expectedBalance := valBalance.Sub(campaignFunds).Sub(sdk.NewInt(fees * 3)) + valBalance = sdkcli.GetSGEBalance(clientCtx, val.Address.String()) + s.Require().Equal(expectedBalance, valBalance) + s.T().Logf("==== bank balance checked after creating the campaign: %s", valBalance) + + { + ticket, err := simapp.CreateJwtTicket(jwt.MapClaims{ + "exp": time.Now().Add(time.Minute * 5).Unix(), + "iat": time.Now().Unix(), + "common": types.RewardPayloadCommon{ + Receiver: val.Address.String(), + SourceUID: "", + Meta: "signup reward campaign", + KycData: &sgetypes.KycDataPayload{ + Ignore: false, + Approved: true, + ID: val.Address.String(), + }, + }, + }) + require.Nil(s.T(), err) + + rewardUID := uuid.NewString() + args := []string{ + rewardUID, + campaignUID, + ticket, + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdkmath.NewInt(10))).String()), + } + bz, err := clitestutil.ExecTestCLICmd(clientCtx, cli.CmdGrantReward(), args) + s.Require().NoError(err) + respType := sdk.TxResponse{} + + s.Require().NoError(clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType), bz.String()) + + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, respType.TxHash) + s.Require().NoError(err) + s.Require().Equal(uint32(0), txResp.Code) + s.T().Logf("==== success reward grant test case finished: %s", rewardUID) + } + + valBalance = sdkcli.GetSGEBalance(clientCtx, val.Address.String()) + expectedBalance = expectedBalance.Sub(sdkmath.NewInt(10)) + s.Require().Equal(expectedBalance, valBalance) + s.T().Logf("==== bank balance checked after creating the campaign: %s", valBalance) + + args := []string{ + val.Address.String(), + fmt.Sprintf("--%s=json", flags.FlagOutput), + } + bz, err := clitestutil.ExecTestCLICmd(clientCtx, subaccountcli.QuerySubaccount(), args) + if err != nil { + panic(err) + } + respType := subaccounttypes.QuerySubaccountResponse{} + err = clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType) + if err != nil { + panic(err) + } + + subaccountBalance := sdkcli.GetSGEBalance(clientCtx, respType.Address) + s.Require().Equal(sdkmath.NewInt(100), subaccountBalance) + s.T().Logf("==== bank balance checked after creating the campaign: %s", subaccountBalance) + + s.T().Log("==== new campaign create command test passed successfully") +} diff --git a/tests/e2e/sdk/account.go b/tests/e2e/sdk/account.go new file mode 100644 index 00000000..00083d0e --- /dev/null +++ b/tests/e2e/sdk/account.go @@ -0,0 +1,23 @@ +package sdk + +import ( + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdknetwork "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func CreateAccount(val *sdknetwork.Validator, uid string) sdk.AccAddress { + // Create new account in the keyring. + k, _, err := val.ClientCtx.Keyring.NewMnemonic(uid, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1) + if err != nil { + panic(err) + } + + addr, err := k.GetAddress() + if err != nil { + panic(err) + } + + return addr +} diff --git a/tests/e2e/sdk/auth.go b/tests/e2e/sdk/auth.go new file mode 100644 index 00000000..a0873195 --- /dev/null +++ b/tests/e2e/sdk/auth.go @@ -0,0 +1,40 @@ +package sdk + +import ( + "fmt" + "strings" + "time" + + "github.com/cosmos/cosmos-sdk/client/flags" + sdknetwork "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/authz/client/cli" + authzclitestutil "github.com/cosmos/cosmos-sdk/x/authz/client/testutil" + "github.com/sge-network/sge/app/params" +) + +func SetGenericAuthorization(val *sdknetwork.Validator, grantee sdk.AccAddress, typeMsg string) { + twoHours := time.Now().Add(time.Minute * 120).Unix() + + // Send some funds to the new account. + out, err := authzclitestutil.CreateGrant( + val.ClientCtx, + []string{ + grantee.String(), + "generic", + fmt.Sprintf("--%s=%s", cli.FlagMsgType, typeMsg), + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%d", cli.FlagExpiration, twoHours), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(params.DefaultBondDenom, fees)).String()), + }, + ) + if err != nil { + panic(err) + } + + if !strings.Contains(out.String(), `"code":0`) { + panic(fmt.Sprintf("failed to send tokens: %s", out.String())) + } +} diff --git a/tests/e2e/sdk/balance.go b/tests/e2e/sdk/balance.go new file mode 100644 index 00000000..170f57a5 --- /dev/null +++ b/tests/e2e/sdk/balance.go @@ -0,0 +1,54 @@ +package sdk + +import ( + "fmt" + "strings" + + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdknetwork "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/cli" + "github.com/sge-network/sge/app/params" +) + +func GetSGEBalance(clientCtx client.Context, address string) sdkmath.Int { + args := []string{ + address, + fmt.Sprintf("--%s=json", flags.FlagOutput), + fmt.Sprintf("--%s=usge", bankcli.FlagDenom), + } + bz, err := clitestutil.ExecTestCLICmd(clientCtx, bankcli.GetBalancesCmd(), args) + if err != nil { + panic(err) + } + respType := sdk.Coin{} + err = clientCtx.Codec.UnmarshalJSON(bz.Bytes(), &respType) + if err != nil { + panic(err) + } + + return respType.Amount +} + +func SendToken(val *sdknetwork.Validator, acc sdk.AccAddress, amount int) { + // Send some funds to the new account. + out, err := clitestutil.MsgSendExec( + val.ClientCtx, + val.Address, + acc, + sdk.NewCoins(sdk.NewCoin(params.DefaultBondDenom, sdkmath.NewInt(int64(amount)))), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(params.DefaultBondDenom, fees)).String()), + ) + if err != nil { + panic(err) + } + + if !strings.Contains(out.String(), `"code":0`) { + panic(fmt.Sprintf("failed to send tokens: %s", out.String())) + } +} diff --git a/tests/e2e/sdk/consts.go b/tests/e2e/sdk/consts.go new file mode 100644 index 00000000..494cb602 --- /dev/null +++ b/tests/e2e/sdk/consts.go @@ -0,0 +1,5 @@ +package sdk + +import sdkmath "cosmossdk.io/math" + +var fees = sdkmath.NewInt(10) diff --git a/testutil/network/network.go b/testutil/network/network.go index 25d8893f..95a61f03 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -16,10 +16,14 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/sge-network/sge/app" + "github.com/sge-network/sge/app/params" + "github.com/sge-network/sge/testutil/simapp" + ovmtypes "github.com/sge-network/sge/x/ovm/types" ) type ( @@ -41,6 +45,39 @@ func New(t *testing.T, configs ...network.Config) *network.Network { } else { cfg = configs[0] } + // baseDir := t.TempDir() + + // nodeDirName := fmt.Sprintf("node%d", 0) + // node0Dir := filepath.Join(baseDir, nodeDirName, "simcli") + + // buf := bufio.NewReader(os.Stdin) + // kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, node0Dir, buf, cfg.Codec, cfg.KeyringOptions...) + // if err != nil { + // panic(err) + // } + + // keyringAlgos, _ := kb.SupportedAlgorithms() + // algo, err := keyring.NewSigningAlgoFromString(cfg.SigningAlgo, keyringAlgos) + // if err != nil { + // panic(err) + // } + + // addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, algo) + // if err != nil { + // panic(err) + // } + + // info := map[string]string{"secret": secret} + // infoBz, err := json.Marshal(info) + // if err != nil { + // panic(err) + // } + + // // save private key seed words + // err = simapp.WriteKeyringFile(fmt.Sprintf("%v.json", "key_seed"), node0Dir, infoBz) + // if err != nil { + // panic(err) + // } net, err := network.New(t, t.TempDir(), cfg) if err != nil { @@ -58,6 +95,93 @@ func DefaultConfig() network.Config { encoding = app.MakeEncodingConfig() chainID = "chain-" + tmrand.NewRand().Str(6) ) + + // simapp.GenerateSimappUsers() + + // Initialize test app by genesis account + // genAccs := simapp.GenerateSimappGenesisAccounts() + + // Create testapp instance + // balances := simapp.GenerateSimappUserBalances() + + defGen := app.ModuleBasics.DefaultGenesis(encoding.Marshaler) + { + // modify the staking denom in the genesis + stakingGenState := defGen[stakingtypes.ModuleName] + var newStakingGenState stakingtypes.GenesisState + + if err := encoding.Marshaler.UnmarshalJSON(stakingGenState, &newStakingGenState); err != nil { + panic(err) + } + + // change to default bond denom + newStakingGenState.Params.BondDenom = params.DefaultBondDenom + + var err error + defGen[stakingtypes.ModuleName], err = encoding.Marshaler.MarshalJSON(&newStakingGenState) + if err != nil { + panic(err) + } + } + // { + // authGenState := defGen[authtypes.ModuleName] + // var newAuthGenState authtypes.GenesisState + + // if err := encoding.Marshaler.UnmarshalJSON(authGenState, &newAuthGenState); err != nil { + // panic(err) + // } + + // for _, v := range genAccs { + // anyVal, err := codectypes.NewAnyWithValue(v) + // if err != nil { + // panic(err) + // } + // newAuthGenState.Accounts = append(newAuthGenState.Accounts, anyVal) + // } + + // var err error + // defGen[authtypes.ModuleName], err = encoding.Marshaler.MarshalJSON(&newAuthGenState) + // if err != nil { + // panic(err) + // } + // } + // { + // bankGenState := defGen[banktypes.ModuleName] + // var newBankGenState banktypes.GenesisState + + // if err := encoding.Marshaler.UnmarshalJSON(bankGenState, &newBankGenState); err != nil { + // panic(err) + // } + + // newBankGenState.Balances = append(newBankGenState.Balances, balances...) + + // // totalSupply := sdk.NewCoins() + // // for _, b := range balances { + // // totalSupply = totalSupply.Add(b.Coins...) + // // } + // // newBankGenState.Supply = totalSupply + + // var err error + // defGen[banktypes.ModuleName], err = encoding.Marshaler.MarshalJSON(&newBankGenState) + // if err != nil { + // panic(err) + // } + + // // stateBytes, err := json.MarshalIndent(genesisState, "", " ") + // // if err != nil { + // // panic(err) + // // } + // } + + { + ovmGenesisState := &ovmtypes.GenesisState{ + KeyVault: ovmtypes.KeyVault{ + PublicKeys: simapp.GenerateOvmPublicKeys(ovmtypes.MinPubKeysCount), + }, + } + defGen[ovmtypes.ModuleName] = encoding.Marshaler.MustMarshalJSON(ovmGenesisState) + } + return network.Config{ Codec: encoding.Marshaler, TxConfig: encoding.TxConfig, @@ -81,12 +205,12 @@ func DefaultConfig() network.Config { baseapp.SetChainID(chainID), ) }, - GenesisState: app.ModuleBasics.DefaultGenesis(encoding.Marshaler), + GenesisState: defGen, TimeoutCommit: 2 * time.Second, ChainID: chainID, NumValidators: 1, - BondDenom: sdk.DefaultBondDenom, - MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), + BondDenom: params.DefaultBondDenom, + MinGasPrices: fmt.Sprintf("0.000006%s", params.DefaultBondDenom), AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction), StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction), BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction), diff --git a/testutil/simapp/test_helpers.go b/testutil/simapp/test_helpers.go index c2a6fd8e..18e23d10 100644 --- a/testutil/simapp/test_helpers.go +++ b/testutil/simapp/test_helpers.go @@ -7,6 +7,8 @@ import ( "encoding/hex" "fmt" "math" + "os" + "path/filepath" "github.com/golang-jwt/jwt" "github.com/spf13/cast" @@ -111,3 +113,19 @@ func RandomString(length int) string { str := base64.RawURLEncoding.EncodeToString(buff) return str[:length] // strip 1 extra character we get from odd length results } + +func WriteKeyringFile(name string, dir string, contents []byte) error { + file := filepath.Join(dir, name) + + //#nosec + if err := os.MkdirAll(dir, 0o755); err != nil { + return fmt.Errorf("could not create directory %q: %w", dir, err) + } + + //#nosec + if err := os.WriteFile(file, contents, 0o644); err != nil { + return err + } + + return nil +} diff --git a/types/kyc.pb.go b/types/kyc.pb.go index c9d0d437..56f6e4f4 100644 --- a/types/kyc.pb.go +++ b/types/kyc.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -94,21 +95,23 @@ func init() { func init() { proto.RegisterFile("sgenetwork/sge/type/kyc.proto", fileDescriptor_2be32303a1d48b19) } var fileDescriptor_2be32303a1d48b19 = []byte{ - // 215 bytes of a gzipped FileDescriptorProto + // 249 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0x4e, 0x4f, 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0xd6, 0x2f, 0x4e, 0x4f, 0xd5, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0xcf, 0xae, 0x4c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x46, 0x48, 0xeb, 0x15, 0xa7, 0xa7, 0xea, 0x81, 0xa4, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xf2, 0xfa, 0x20, 0x16, 0x44, - 0xa9, 0x52, 0x12, 0x17, 0x9f, 0x77, 0x65, 0xb2, 0x4b, 0x62, 0x49, 0x62, 0x40, 0x62, 0x65, 0x4e, - 0x7e, 0x62, 0x8a, 0x90, 0x18, 0x17, 0x5b, 0x66, 0x7a, 0x5e, 0x7e, 0x51, 0xaa, 0x04, 0xa3, 0x02, - 0xa3, 0x06, 0x47, 0x10, 0x94, 0x27, 0x24, 0xc5, 0xc5, 0x91, 0x58, 0x50, 0x50, 0x94, 0x5f, 0x96, - 0x9a, 0x22, 0xc1, 0x04, 0x96, 0x81, 0xf3, 0x85, 0x64, 0xb8, 0x98, 0x32, 0x53, 0x24, 0x98, 0x15, - 0x18, 0x35, 0x38, 0x9d, 0x78, 0x1e, 0xdd, 0x93, 0x67, 0xf2, 0x74, 0x79, 0x75, 0x4f, 0x9e, 0x29, - 0x33, 0x25, 0x88, 0x29, 0x33, 0xc5, 0xc9, 0xea, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, - 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, - 0x18, 0xa2, 0x14, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0x41, 0xfe, 0xd0, - 0x45, 0xf7, 0x53, 0x71, 0x12, 0x1b, 0xd8, 0x99, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfc, - 0x12, 0x37, 0x59, 0xf2, 0x00, 0x00, 0x00, + 0xa9, 0x94, 0x64, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0x71, 0x3c, 0x44, 0x02, 0xc2, 0x81, 0x48, 0x29, + 0x55, 0x71, 0xf1, 0x79, 0x57, 0x26, 0xbb, 0x24, 0x96, 0x24, 0x06, 0x24, 0x56, 0xe6, 0xe4, 0x27, + 0xa6, 0x08, 0x89, 0x71, 0xb1, 0x65, 0xa6, 0xe7, 0xe5, 0x17, 0xa5, 0x4a, 0x30, 0x2a, 0x30, 0x6a, + 0x70, 0x04, 0x41, 0x79, 0x42, 0x52, 0x5c, 0x1c, 0x89, 0x05, 0x05, 0x45, 0xf9, 0x65, 0xa9, 0x29, + 0x12, 0x4c, 0x60, 0x19, 0x38, 0x5f, 0xc8, 0x84, 0x8b, 0x29, 0x33, 0x45, 0x82, 0x59, 0x81, 0x51, + 0x83, 0xd3, 0x49, 0xe5, 0xd1, 0x3d, 0x79, 0x26, 0x4f, 0x97, 0x57, 0xf7, 0xe4, 0x99, 0x32, 0x53, + 0x2e, 0x6d, 0xd1, 0x15, 0x81, 0xda, 0xe7, 0x98, 0x92, 0x52, 0x94, 0x5a, 0x5c, 0x1c, 0x5c, 0x52, + 0x94, 0x99, 0x97, 0x1e, 0xc4, 0x94, 0x99, 0xe2, 0x64, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, + 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, + 0xc7, 0x72, 0x0c, 0x51, 0x0a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0x20, + 0xaf, 0xeb, 0xa2, 0x07, 0x43, 0x71, 0x12, 0x1b, 0xd8, 0xf9, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xf7, 0x7f, 0x43, 0x34, 0x25, 0x01, 0x00, 0x00, } func (m *KycDataPayload) Marshal() (dAtA []byte, err error) { diff --git a/x/bet/handler.go b/x/bet/handler.go index d340d1af..fba87cea 100644 --- a/x/bet/handler.go +++ b/x/bet/handler.go @@ -22,6 +22,10 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgWager: res, err := msgServer.Wager(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateParams: + res, err := msgServer.UpdateParams(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) return nil, sdkerrors.Wrap(sdkerrtypes.ErrUnknownRequest, errMsg) diff --git a/x/bet/keeper/keeper.go b/x/bet/keeper/keeper.go index 37e14353..7129df83 100644 --- a/x/bet/keeper/keeper.go +++ b/x/bet/keeper/keeper.go @@ -21,6 +21,10 @@ type Keeper struct { marketKeeper types.MarketKeeper orderbookKeeper types.OrderbookKeeper ovmKeeper types.OVMKeeper + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } // NewKeeper creates new keeper object @@ -29,6 +33,7 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, + authority string, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -40,6 +45,7 @@ func NewKeeper( storeKey: storeKey, memKey: memKey, paramstore: ps, + authority: authority, } } @@ -62,3 +68,8 @@ func (k *Keeper) SetOVMKeeper(ovmKeeper types.OVMKeeper) { func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// GetAuthority returns the x/bet module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/bet/keeper/msg_server_params.go b/x/bet/keeper/msg_server_params.go new file mode 100644 index 00000000..d3be132e --- /dev/null +++ b/x/bet/keeper/msg_server_params.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/sge-network/sge/x/bet/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.GetAuthority() != req.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + k.SetParams(ctx, req.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/bet/simulation/proposals.go b/x/bet/simulation/proposals.go new file mode 100644 index 00000000..060b2dc1 --- /dev/null +++ b/x/bet/simulation/proposals.go @@ -0,0 +1,50 @@ +package simulation + +import ( + "math/rand" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/sge-network/sge/x/bet/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" //#nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateMsgUpdateParams, + ), + } +} + +// SimulateMsgUpdateParams returns a random MsgUpdateParams +func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") + + params := types.DefaultParams() + params.BatchSettlementCount = uint32(r.Intn(10000)) + params.MaxBetByUidQueryCount = uint32(r.Intn(1000)) + params.Constraints = types.Constraints{ + MinAmount: sdkmath.NewInt(int64(r.Intn(1000))), + Fee: sdkmath.NewInt(int64(r.Intn(99))), + } + + return &types.MsgUpdateParams{ + Authority: authority.String(), + Params: params, + } +} diff --git a/x/bet/simulation/proposals_test.go b/x/bet/simulation/proposals_test.go new file mode 100644 index 00000000..6e7a8b5e --- /dev/null +++ b/x/bet/simulation/proposals_test.go @@ -0,0 +1,50 @@ +package simulation_test + +import ( + "fmt" + "math/rand" + "testing" + + sdkmath "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/sge-network/sge/x/bet/simulation" + "github.com/sge-network/sge/x/bet/types" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + //#nosec + r := rand.New(s) + + ctx := sdk.NewContext(nil, tmproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, len(weightedProposalMsgs), 1) + + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + fmt.Println(msgUpdateParams) + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) + require.Equal(t, uint32(2540), msgUpdateParams.Params.BatchSettlementCount) + require.Equal(t, uint32(456), msgUpdateParams.Params.MaxBetByUidQueryCount) + require.Equal(t, types.Constraints{ + MinAmount: sdkmath.NewInt(300), + Fee: sdkmath.NewInt(59), + }, msgUpdateParams.Params.Constraints) +} diff --git a/x/bet/types/bet.pb.go b/x/bet/types/bet.pb.go index f26475e1..6649070e 100644 --- a/x/bet/types/bet.pb.go +++ b/x/bet/types/bet.pb.go @@ -6,6 +6,7 @@ package types import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -563,68 +564,70 @@ func init() { func init() { proto.RegisterFile("sgenetwork/sge/bet/bet.proto", fileDescriptor_7e3a1b484a8c9a09) } var fileDescriptor_7e3a1b484a8c9a09 = []byte{ - // 969 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcb, 0x6e, 0xe3, 0x36, - 0x14, 0x8d, 0x6c, 0x8f, 0x13, 0xdf, 0x24, 0x8a, 0xc2, 0x4c, 0xa7, 0x42, 0x26, 0x63, 0x1b, 0xea, - 0x03, 0x01, 0x8a, 0x2a, 0x40, 0x06, 0x33, 0x8b, 0x76, 0x53, 0x3b, 0x52, 0x1a, 0xb7, 0x8e, 0x93, - 0xd2, 0x76, 0x0b, 0xcc, 0x46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 0x70, 0x42, 0xcd, 0x47, - 0x42, 0x86, 0x2b, 0x02, 0xf9, 0x5e, 0x00, 0xe8, 0x05, 0x94, 0x49, 0x94, 0x4c, 0x62, 0x6e, 0x96, - 0xa5, 0xe3, 0xb3, 0xd7, 0xd3, 0xda, 0xca, 0x1f, 0xd3, 0xda, 0x07, 0xc3, 0x84, 0x45, 0x09, 0x63, - 0xfe, 0x95, 0x1d, 0x24, 0x07, 0x11, 0xe1, 0x97, 0x76, 0x2b, 0xe6, 0x38, 0x23, 0xa3, 0x03, 0x28, - 0x5e, 0x50, 0x6a, 0xae, 0x3e, 0x44, 0x23, 0x98, 0xe8, 0x25, 0x94, 0x19, 0x27, 0x7c, 0xc2, 0xcc, - 0xb5, 0xba, 0xb6, 0xaf, 0x1f, 0x56, 0xed, 0x77, 0x4f, 0xc0, 0x6e, 0x52, 0x6e, 0x77, 0x25, 0x0b, - 0x67, 0x6c, 0xa1, 0x4b, 0x29, 0x9b, 0x84, 0xdc, 0xac, 0xbc, 0x5f, 0x87, 0x25, 0x0b, 0x67, 0x6c, - 0x64, 0xc2, 0xea, 0x30, 0xa5, 0x84, 0x27, 0xa9, 0x09, 0x72, 0xcf, 0x77, 0x53, 0x91, 0x10, 0x39, - 0xa4, 0xbe, 0x47, 0xb8, 0xb9, 0x5e, 0xd7, 0xf6, 0x8b, 0xb8, 0x92, 0x21, 0x0d, 0x8e, 0x3e, 0x83, - 0x6d, 0x46, 0x39, 0x0f, 0x69, 0x44, 0x63, 0xee, 0x5d, 0xd2, 0x60, 0x74, 0xc9, 0xcd, 0x0d, 0xc9, - 0x32, 0xe6, 0x0b, 0x27, 0x12, 0x47, 0x5d, 0xd8, 0x89, 0xc8, 0xb5, 0x17, 0x26, 0x8c, 0x79, 0xd1, - 0x24, 0xe4, 0xc1, 0x38, 0x0c, 0x68, 0x6a, 0x6e, 0xca, 0xb4, 0x7c, 0x94, 0xa5, 0xe5, 0xe9, 0xbb, - 0x69, 0x69, 0xd3, 0x11, 0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 0x07, 0x00, 0x00, + // 997 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcf, 0x4e, 0x23, 0xc7, + 0x13, 0x66, 0x6c, 0xaf, 0xc1, 0x05, 0x18, 0xd3, 0xf0, 0xdb, 0xdf, 0x84, 0x65, 0x6d, 0x6b, 0x12, + 0x45, 0x48, 0xd1, 0x1a, 0xc9, 0xab, 0xdd, 0x43, 0x72, 0x48, 0x6c, 0x66, 0xc8, 0x3a, 0x31, 0x86, + 0xb4, 0xed, 0x44, 0xda, 0xcb, 0xa8, 0xed, 0x69, 0x4c, 0x87, 0xf9, 0x63, 0x4d, 0xb7, 0x13, 0x78, + 0x8b, 0x3c, 0x42, 0x1e, 0x20, 0xc7, 0x3c, 0xc4, 0x1e, 0x57, 0x39, 0x45, 0x39, 0x58, 0x89, 0xb9, + 0xe5, 0xb8, 0xb7, 0xdc, 0xa2, 0xfe, 0x03, 0x18, 0x2d, 0xd9, 0xf5, 0x01, 0xd4, 0xfd, 0xd5, 0xf7, + 0x55, 0x95, 0x6b, 0xaa, 0xab, 0x60, 0x97, 0x8f, 0x68, 0x4c, 0xc5, 0x8f, 0x49, 0x7a, 0xbe, 0xcf, + 0x47, 0x74, 0x7f, 0x40, 0x85, 0xfc, 0xab, 0x8d, 0xd3, 0x44, 0x24, 0x08, 0xdd, 0x5a, 0x6b, 0x7c, + 0x44, 0x6b, 0x03, 0x2a, 0x76, 0xb6, 0x47, 0xc9, 0x28, 0x51, 0xe6, 0x7d, 0x79, 0xd2, 0xcc, 0x9d, + 0x0f, 0x86, 0x09, 0x8f, 0x12, 0xee, 0x6b, 0x83, 0xbe, 0x18, 0x93, 0x73, 0x4f, 0x88, 0x24, 0x08, + 0xb8, 0x2f, 0x2e, 0xc7, 0x54, 0x73, 0x9c, 0x7f, 0x96, 0x21, 0xdb, 0xa4, 0x02, 0x55, 0x21, 0x3b, + 0x61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, 0x9c, 0xa7, 0xeb, 0x65, 0xf2, 0x11, 0x14, 0x19, + 0xf7, 0x23, 0xc2, 0x62, 0x5f, 0xaf, 0x2d, 0x55, 0xbb, 0x15, 0xbc, 0xc6, 0xf8, 0x11, 0x61, 0xb1, + 0xde, 0x71, 0xcd, 0x2f, 0x5e, 0xcd, 0xca, 0xd6, 0xeb, 0x59, 0xd9, 0xfa, 0x73, 0x56, 0xb6, 0x7e, + 0xba, 0x2a, 0x2f, 0xbd, 0xbe, 0x2a, 0x2f, 0xfd, 0x7e, 0x55, 0x5e, 0x7a, 0xf9, 0xf1, 0x88, 0x89, + 0xb3, 0xc9, 0xa0, 0x36, 0x4c, 0x22, 0xb9, 0x6b, 0x9f, 0xcc, 0xef, 0xdd, 0x0b, 0xb5, 0x79, 0xe5, + 0x8f, 0xe1, 0x83, 0xbc, 0x5a, 0xbb, 0x4f, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x02, 0x23, + 0x3c, 0xff, 0x07, 0x00, 0x00, } func (m *Bet) Marshal() (dAtA []byte, err error) { diff --git a/x/bet/types/codec.go b/x/bet/types/codec.go index 1aec2d62..16f7f480 100644 --- a/x/bet/types/codec.go +++ b/x/bet/types/codec.go @@ -12,12 +12,14 @@ import ( // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgWager{}, "bet/Wager") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "bet/MsgUpdateParams") } // RegisterInterfaces registers the module interface types func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgWager{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/bet/types/messages_params.go b/x/bet/types/messages_params.go new file mode 100644 index 00000000..aa88b732 --- /dev/null +++ b/x/bet/types/messages_params.go @@ -0,0 +1,43 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // typeMsgUpdateParams is type of message MsgUpdateParams + typeMsgUpdateParams = "bet_update_params" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// Route returns the module's message router key. +func (*MsgUpdateParams) Route() string { return RouterKey } + +// Type returns type of its message +func (*MsgUpdateParams) Type() string { return typeMsgUpdateParams } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + if err := msg.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/bet/types/query.pb.go b/x/bet/types/query.pb.go index ea31ce88..f4a64b1a 100644 --- a/x/bet/types/query.pb.go +++ b/x/bet/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -770,63 +771,65 @@ func init() { func init() { proto.RegisterFile("sgenetwork/sge/bet/query.proto", fileDescriptor_5d73c4d56d215257) } var fileDescriptor_5d73c4d56d215257 = []byte{ - // 889 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x96, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0xc7, 0xe3, 0xa4, 0x9b, 0x2a, 0x2f, 0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- 0x45, 0x7f, 0x28, 0xf0, 0x7c, 0x4c, 0xa1, 0xa0, 0x9d, 0x89, 0x8a, 0x93, 0xab, 0x5c, 0x7d, 0xff, - 0xff, 0x2d, 0x92, 0xb8, 0x9b, 0x1c, 0xb7, 0x8c, 0x96, 0x93, 0xb8, 0x54, 0x2c, 0x31, 0x3b, 0xf1, - 0x82, 0xef, 0xa2, 0x73, 0x05, 0x60, 0xd0, 0xfe, 0xd1, 0xfa, 0x94, 0xb3, 0x11, 0xbb, 0x5e, 0xd4, - 0x8d, 0x99, 0x6c, 0x25, 0xd5, 0x0a, 0xa7, 0xd2, 0xd0, 0x62, 0x82, 0xaa, 0xe2, 0xb6, 0x2b, 0xd1, - 0x2d, 0x61, 0x76, 0xf8, 0x85, 0xd4, 0xb5, 0x3e, 0xbe, 0xbc, 0x29, 0x29, 0x57, 0x37, 0x25, 0xe5, - 0x9f, 0x9b, 0x92, 0xf2, 0xf3, 0x6d, 0x29, 0x75, 0x75, 0x5b, 0x4a, 0xfd, 0x7d, 0x5b, 0x4a, 0x1d, - 0x96, 0x3d, 0x9f, 0x1d, 0xb7, 0x5c, 0xa3, 0x46, 0x1a, 0x91, 0x8b, 0x4a, 0xfc, 0x63, 0xf2, 0x7b, - 0xee, 0x90, 0xb5, 0x9b, 0x98, 0xba, 0x59, 0xfe, 0x2d, 0xb9, 0xf3, 0x5f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x82, 0x66, 0xa2, 0x41, 0x44, 0x0b, 0x00, 0x00, + // 916 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x96, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0xc7, 0xe3, 0x6c, 0x9a, 0x28, 0x2f, 0x54, 0xa1, 0xaf, 0x81, 0x6c, 0x2c, 0xb2, 0x4e, 0x4d, + 0x9a, 0x54, 0x49, 0xd7, 0x56, 0x52, 0x0e, 0x20, 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, + 0x1f, 0x81, 0xdd, 0x94, 0x52, 0xbb, 0x93, 0x9f, 0x31, 0x5d, 0xfc, 0x4d, 0x83, 0x9b, 0x23, 0x36, + 0x0a, 0xde, 0x1b, 0xeb, 0x38, 0x7e, 0x97, 0xeb, 0xef, 0xfc, 0xbf, 0x41, 0x0a, 0xf7, 0xae, 0xc0, + 0xdd, 0xc2, 0xcd, 0x7e, 0x5c, 0x26, 0x87, 0xd8, 0x9d, 0xe2, 0x86, 0xef, 0xe2, 0x53, 0x0d, 0x20, + 0x3f, 0xfe, 0x71, 0x67, 0xc2, 0xda, 0x28, 0x5c, 0x2f, 0xfa, 0xee, 0x54, 0x5a, 0x45, 0x75, 0x5b, + 0x50, 0x19, 0xb8, 0xde, 0x47, 0x55, 0xf5, 0xdb, 0xd5, 0xf4, 0x96, 0xb0, 0x3b, 0xe2, 0x42, 0xea, + 0x3a, 0x1f, 0x3c, 0x3f, 0xab, 0x68, 0x2f, 0xce, 0x2a, 0xda, 0x3f, 0x67, 0x15, 0xed, 0xc7, 0xf3, + 0xca, 0xcc, 0x8b, 0xf3, 0xca, 0xcc, 0xdf, 0xe7, 0x95, 0x99, 0x47, 0x5b, 0x61, 0xc4, 0x8f, 0x5a, + 0xbe, 0x55, 0xa7, 0x8d, 0x34, 0x44, 0xb5, 0xf8, 0x99, 0xf9, 0xad, 0x08, 0xc8, 0xdb, 0x4d, 0xc2, + 0xfc, 0x79, 0xf1, 0x95, 0x79, 0xef, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x7e, 0x9b, 0x1f, + 0x79, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/bet/types/tx.pb.go b/x/bet/types/tx.pb.go index 41b3a93d..14d2a72d 100644 --- a/x/bet/types/tx.pb.go +++ b/x/bet/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -128,30 +132,140 @@ func (m *MsgWagerResponse) GetProps() *WagerProps { return nil } +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/bet parameters. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_3fc41486184bd76d, []int{2} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3fc41486184bd76d, []int{3} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgWager)(nil), "sgenetwork.sge.bet.MsgWager") proto.RegisterType((*MsgWagerResponse)(nil), "sgenetwork.sge.bet.MsgWagerResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "sgenetwork.sge.bet.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "sgenetwork.sge.bet.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("sgenetwork/sge/bet/tx.proto", fileDescriptor_3fc41486184bd76d) } var fileDescriptor_3fc41486184bd76d = []byte{ - // 238 bytes of a gzipped FileDescriptorProto + // 454 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x4e, 0x4f, 0xcd, 0x4b, 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 0x92, 0x5e, 0x72, 0x7e, 0x2e, 0x28, 0xcc, - 0x74, 0x91, 0xc3, 0xaf, 0x02, 0x12, 0xe4, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x20, 0x34, - 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xbd, 0xa6, 0x56, 0x07, 0x95, 0x01, 0x00, 0x00, + 0x25, 0xa5, 0x96, 0x48, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xa5, 0xf5, 0x41, 0x2c, 0x88, 0x4a, + 0x29, 0xc9, 0xe4, 0xfc, 0xe2, 0xdc, 0xfc, 0xe2, 0x78, 0x88, 0x04, 0x84, 0x03, 0x95, 0x12, 0x87, + 0xf0, 0xf4, 0x73, 0x8b, 0xd3, 0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x54, 0x42, 0x30, 0x31, 0x37, 0x33, + 0x2f, 0x5f, 0x1f, 0x4c, 0x42, 0x85, 0xe4, 0xb0, 0xb8, 0xa6, 0x3c, 0x31, 0x3d, 0xb5, 0x08, 0x2a, + 0x2f, 0x8f, 0x45, 0xbe, 0x20, 0xb1, 0x28, 0x31, 0x17, 0x6a, 0x99, 0x52, 0x13, 0x23, 0x17, 0x87, + 0x6f, 0x71, 0x7a, 0x38, 0x48, 0x8f, 0x90, 0x11, 0x17, 0x7b, 0x72, 0x51, 0x6a, 0x62, 0x49, 0x7e, + 0x91, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xc4, 0xa5, 0x2d, 0xba, 0x22, 0x50, 0xc7, 0x39, + 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x07, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x07, 0xc1, 0x14, 0x0a, + 0x99, 0x70, 0xb1, 0x16, 0x14, 0xe5, 0x17, 0x14, 0x4b, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0xc9, + 0xe9, 0x61, 0x06, 0x81, 0x1e, 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0xbe, 0x71, 0x72, + 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, + 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xb5, 0xf4, 0xcc, 0x92, 0x8c, + 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x24, 0x7d, 0xe0, 0x54, 0x5c, 0x01, 0xc9, 0x75, 0x95, + 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x74, 0x6c, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x62, 0xd8, + 0x6c, 0x13, 0x98, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -168,6 +282,9 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // Wager defines a method to place a bet with the given data. Wager(ctx context.Context, in *MsgWager, opts ...grpc.CallOption) (*MsgWagerResponse, error) + // UpdateParams defines a governance operation for updating the x/bet module + // parameters. The authority is defined in the keeper. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -187,10 +304,22 @@ func (c *msgClient) Wager(ctx context.Context, in *MsgWager, opts ...grpc.CallOp return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/sgenetwork.sge.bet.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // Wager defines a method to place a bet with the given data. Wager(context.Context, *MsgWager) (*MsgWagerResponse, error) + // UpdateParams defines a governance operation for updating the x/bet module + // parameters. The authority is defined in the keeper. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -200,6 +329,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) Wager(ctx context.Context, req *MsgWager) (*MsgWagerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Wager not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -223,6 +355,24 @@ func _Msg_Wager_Handler(srv interface{}, ctx context.Context, dec func(interface return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sgenetwork.sge.bet.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "sgenetwork.sge.bet.Msg", HandlerType: (*MsgServer)(nil), @@ -231,6 +381,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Wager", Handler: _Msg_Wager_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "sgenetwork/sge/bet/tx.proto", @@ -313,6 +467,69 @@ func (m *MsgWagerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -354,6 +571,30 @@ func (m *MsgWagerResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -564,6 +805,171 @@ func (m *MsgWagerResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/house/handler.go b/x/house/handler.go index d30821f6..f91f412d 100644 --- a/x/house/handler.go +++ b/x/house/handler.go @@ -22,10 +22,12 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgDeposit: res, err := msgServer.Deposit(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgWithdraw: res, err := msgServer.Withdraw(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateParams: + res, err := msgServer.UpdateParams(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) diff --git a/x/house/keeper/keeper.go b/x/house/keeper/keeper.go index f35c0b5d..1609658f 100644 --- a/x/house/keeper/keeper.go +++ b/x/house/keeper/keeper.go @@ -16,6 +16,9 @@ type Keeper struct { authzKeeper types.AuthzKeeper orderbookKeeper types.OrderbookKeeper ovmKeeper types.OVMKeeper + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } // SdkExpectedKeepers contains expected keepers parameter needed by NewKeeper @@ -31,6 +34,7 @@ func NewKeeper( ovmKeeper types.OVMKeeper, ps paramtypes.Subspace, expectedKeepers SdkExpectedKeepers, + authority string, ) *Keeper { // set KeyTable if it is not already set if !ps.HasKeyTable() { @@ -44,5 +48,11 @@ func NewKeeper( ovmKeeper: ovmKeeper, paramstore: ps, authzKeeper: expectedKeepers.AuthzKeeper, + authority: authority, } } + +// GetAuthority returns the x/house module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/house/keeper/msg_server_params.go b/x/house/keeper/msg_server_params.go new file mode 100644 index 00000000..1890752c --- /dev/null +++ b/x/house/keeper/msg_server_params.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/sge-network/sge/x/house/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.GetAuthority() != req.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + k.SetParams(ctx, req.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/house/simulation/proposals.go b/x/house/simulation/proposals.go new file mode 100644 index 00000000..e1acf047 --- /dev/null +++ b/x/house/simulation/proposals.go @@ -0,0 +1,47 @@ +package simulation + +import ( + "math/rand" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/sge-network/sge/x/house/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" //#nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateMsgUpdateParams, + ), + } +} + +// SimulateMsgUpdateParams returns a random MsgUpdateParams +func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") + + params := types.DefaultParams() + params.MaxWithdrawalCount = uint64(r.Intn(10000)) + params.HouseParticipationFee = sdkmath.LegacyNewDecFromIntWithPrec(sdkmath.NewInt(int64(r.Intn(1000))), 2) + params.MinDeposit = sdkmath.NewInt(int64(r.Intn(1000))) + + return &types.MsgUpdateParams{ + Authority: authority.String(), + Params: params, + } +} diff --git a/x/house/simulation/proposals_test.go b/x/house/simulation/proposals_test.go new file mode 100644 index 00000000..37ee4b9b --- /dev/null +++ b/x/house/simulation/proposals_test.go @@ -0,0 +1,47 @@ +package simulation_test + +import ( + "fmt" + "math/rand" + "testing" + + sdkmath "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/sge-network/sge/x/house/simulation" + "github.com/sge-network/sge/x/house/types" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + //#nosec + r := rand.New(s) + + ctx := sdk.NewContext(nil, tmproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, len(weightedProposalMsgs), 1) + + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + fmt.Println(msgUpdateParams) + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) + require.Equal(t, uint64(2540), msgUpdateParams.Params.MaxWithdrawalCount) + require.Equal(t, sdkmath.LegacyNewDecWithPrec(456, 2), msgUpdateParams.Params.HouseParticipationFee) + require.Equal(t, sdkmath.NewInt(300), msgUpdateParams.Params.MinDeposit) +} diff --git a/x/house/types/codec.go b/x/house/types/codec.go index 01718d61..d428622f 100644 --- a/x/house/types/codec.go +++ b/x/house/types/codec.go @@ -14,6 +14,7 @@ import ( func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgDeposit{}, "house/Deposit") legacy.RegisterAminoMsg(cdc, &MsgWithdraw{}, "house/Withdraw") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "house/MsgUpdateParams") } // RegisterInterfaces registers the x/house interfaces types with the interface registry @@ -21,6 +22,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgDeposit{}, &MsgWithdraw{}, + &MsgUpdateParams{}, ) registry.RegisterImplementations( (*authz.Authorization)(nil), diff --git a/x/house/types/deposit.pb.go b/x/house/types/deposit.pb.go index ee347799..2eaf00cb 100644 --- a/x/house/types/deposit.pb.go +++ b/x/house/types/deposit.pb.go @@ -6,6 +6,7 @@ package types import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -86,35 +87,37 @@ func init() { } var fileDescriptor_723fb8b8b0b44700 = []byte{ - // 440 bytes of a gzipped FileDescriptorProto + // 465 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x3f, 0x8f, 0xd3, 0x30, - 0x18, 0xc6, 0x13, 0x28, 0xad, 0xce, 0xe2, 0xcf, 0x61, 0xee, 0x20, 0x3a, 0x50, 0x7c, 0xf2, 0xd4, - 0x01, 0x92, 0x81, 0xed, 0x18, 0x50, 0xcb, 0x09, 0xa9, 0x03, 0x42, 0x8a, 0x84, 0x90, 0x58, 0x22, - 0x5f, 0x62, 0xa5, 0x56, 0x9b, 0xbc, 0x91, 0xed, 0xaa, 0x77, 0xdf, 0x80, 0x91, 0x91, 0xb1, 0xe2, - 0xd3, 0xdc, 0x78, 0x23, 0x62, 0xb0, 0x50, 0xbb, 0x20, 0xc6, 0x7c, 0x02, 0x54, 0x3b, 0xb4, 0x45, - 0x80, 0x6e, 0xb3, 0x9f, 0xf7, 0xf7, 0x3c, 0xef, 0x33, 0xbc, 0x88, 0xaa, 0x82, 0x57, 0x5c, 0xcf, - 0x41, 0x4e, 0x62, 0x55, 0xf0, 0x78, 0x0c, 0x33, 0xc5, 0xe3, 0x9c, 0xd7, 0xa0, 0x84, 0x8e, 0x6a, - 0x09, 0x1a, 0xf0, 0xc1, 0x96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0x2b, 0xe4, 0xbd, 0xed, 0xe7, 0x5c, 0x8f, 0x67, 0xa7, 0x61, 0x2a, + 0x8a, 0xf5, 0x06, 0x1f, 0xed, 0x6e, 0xf3, 0x59, 0xb3, 0xcf, 0xfa, 0xbc, 0x62, 0xea, 0xb4, 0x6d, + 0xf7, 0xf0, 0xd1, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xc1, 0x44, 0xd8, 0xf4, 0x02, 0x00, + 0x00, } func (m *Deposit) Marshal() (dAtA []byte, err error) { diff --git a/x/house/types/messages_params.go b/x/house/types/messages_params.go new file mode 100644 index 00000000..ba6bb187 --- /dev/null +++ b/x/house/types/messages_params.go @@ -0,0 +1,43 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // typeMsgUpdateParams is type of message MsgUpdateParams + typeMsgUpdateParams = "house_update_params" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// Route returns the module's message router key. +func (*MsgUpdateParams) Route() string { return RouterKey } + +// Type returns type of its message +func (*MsgUpdateParams) Type() string { return typeMsgUpdateParams } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + if err := msg.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/house/types/query.pb.go b/x/house/types/query.pb.go index d9f24cd9..021def20 100644 --- a/x/house/types/query.pb.go +++ b/x/house/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -578,54 +579,56 @@ func init() { func init() { proto.RegisterFile("sgenetwork/sge/house/query.proto", fileDescriptor_5ca530dfff23b318) } var fileDescriptor_5ca530dfff23b318 = []byte{ - // 750 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xcf, 0x6b, 0x13, 0x4b, - 0x1c, 0xc0, 0x33, 0x69, 0x5f, 0x5e, 0xfb, 0x2d, 0x3c, 0x5e, 0x27, 0xe9, 0x7b, 0x31, 0x36, 0xdb, - 0x74, 0x45, 0x8d, 0xad, 0xdd, 0xa1, 0xad, 0x28, 0x78, 0x91, 0x06, 0xa9, 0x8a, 0x08, 0x6d, 0x44, - 0x04, 0x0f, 0x96, 0x49, 0x76, 0xd8, 0x2e, 0x6d, 0x76, 0xb6, 0x3b, 0x1b, 0xd3, 0x12, 0x02, 0x2a, - 0xfe, 0x01, 0x82, 0x7f, 0x41, 0x0f, 0xbd, 0x78, 0xf3, 0xe2, 0xd1, 0x73, 0x8f, 0x05, 0x2f, 0x9e, - 0x44, 0x5a, 0xff, 0x10, 0xc9, 0xec, 0x6c, 0x37, 0x3f, 0xd6, 0x98, 0x8a, 0xa0, 0xb7, 0xcd, 0xcc, - 0xf7, 0xc7, 0x27, 0x9f, 0xdd, 0xef, 0xec, 0x42, 0x41, 0x58, 0xcc, 0x61, 0x7e, 0x83, 0x7b, 0x5b, - 0x44, 0x58, 0x8c, 0x6c, 0xf2, 0xba, 0x60, 0x64, 0xa7, 0xce, 0xbc, 0x3d, 0xc3, 0xf5, 0xb8, 0xcf, - 0x71, 0x26, 0x8a, 0x30, 0x84, 0xc5, 0x0c, 0x19, 0x91, 0x9b, 0xab, 0x72, 0x51, 0xe3, 0x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0x05, 0x7e, 0x9a, 0x84, 0xef, 0x74, 0x21, 0x26, 0x25, 0xe2, 0xe5, - 0x1f, 0x22, 0x06, 0xdd, 0xbb, 0x18, 0x5f, 0x20, 0xc8, 0x77, 0x31, 0x96, 0xf6, 0x56, 0xaa, 0x55, - 0x5e, 0x77, 0xfc, 0xd0, 0x46, 0x16, 0xfe, 0xa6, 0xa6, 0xe9, 0x31, 0x11, 0x28, 0x1e, 0x2f, 0x87, - 0x3f, 0x7b, 0x3c, 0x25, 0x7f, 0xda, 0xd3, 0x5b, 0x04, 0xda, 0xf7, 0x18, 0xfe, 0x38, 0x61, 0xaf, - 0x10, 0x14, 0x24, 0xec, 0x63, 0xf5, 0xd4, 0xd2, 0xed, 0xdf, 0xe1, 0xec, 0x3d, 0x82, 0xd9, 0x01, - 0x18, 0x4a, 0xdb, 0x5d, 0x98, 0x68, 0x44, 0xfb, 0xca, 0x5c, 0x21, 0xde, 0x5c, 0x54, 0x48, 0xc9, - 0xeb, 0x4c, 0xfd, 0x75, 0xfe, 0x0e, 0x10, 0xfc, 0xd7, 0x03, 0x1e, 0x5a, 0x9b, 0x87, 0x49, 0x75, - 0xbf, 0xb8, 0xb7, 0xd1, 0xed, 0xef, 0xdf, 0xd3, 0x8d, 0x15, 0x25, 0x32, 0x0f, 0x50, 0xa3, 0xde, - 0x16, 0xf3, 0x37, 0xea, 0xb6, 0x29, 0x81, 0xc6, 0xcb, 0xe3, 0xc1, 0xca, 0x23, 0xdb, 0xc4, 0x04, - 0xd2, 0x2e, 0xf5, 0x7c, 0xbb, 0x6a, 0xbb, 0xb2, 0xef, 0x86, 0xed, 0x98, 0x6c, 0x37, 0x3b, 0x52, - 0x40, 0xc5, 0xd1, 0x32, 0xee, 0xda, 0xba, 0xd7, 0xde, 0xc1, 0xff, 0x40, 0xd2, 0x36, 0xb3, 0xa3, - 0x72, 0x3f, 0x69, 0x9b, 0x3a, 0x85, 0xff, 0xfb, 0x30, 0x95, 0xd5, 0x55, 0x80, 0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x3a, 0xd6, 0xd0, 0x97, 0x63, 0x0d, 0xbd, 0x3e, 0xd1, 0x12, 0x47, 0x27, 0x5a, - 0xe2, 0xd3, 0x89, 0x96, 0x78, 0x52, 0xb4, 0x6c, 0x7f, 0xb3, 0x5e, 0x31, 0xaa, 0xbc, 0xd6, 0x6e, - 0xb8, 0xd0, 0xf9, 0x5d, 0xb1, 0xab, 0xa4, 0xf8, 0x7b, 0x2e, 0x13, 0x95, 0x94, 0xfc, 0xae, 0x58, - 0xfe, 0x16, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xb6, 0xf3, 0x8e, 0x5d, 0x09, 0x00, 0x00, + // 781 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0x4d, 0x6f, 0xd3, 0x48, + 0x18, 0x80, 0x33, 0x69, 0x37, 0xdb, 0xbe, 0x95, 0x56, 0xdb, 0x49, 0xba, 0x9b, 0x66, 0x9b, 0x34, + 0xf5, 0x6a, 0x77, 0xb3, 0xdd, 0xad, 0xad, 0xa6, 0x08, 0x24, 0x2e, 0xa8, 0x11, 0x14, 0x10, 0x42, + 0x6a, 0x53, 0x21, 0x24, 0x0e, 0x44, 0x93, 0x78, 0xe4, 0x8e, 0xda, 0x78, 0x5c, 0xdb, 0x21, 0xad, + 0xa2, 0x48, 0xc0, 0x2f, 0x40, 0xe2, 0x8e, 0xd4, 0x03, 0x17, 0x6e, 0x48, 0x88, 0x23, 0x5c, 0x7b, + 0xac, 0xe0, 0xc2, 0x09, 0xa1, 0x96, 0x1f, 0x82, 0x32, 0x33, 0xae, 0xf3, 0x61, 0x42, 0x8a, 0x7a, + 0xe0, 0x96, 0xcc, 0xfb, 0xf5, 0xf8, 0xb1, 0x67, 0x6c, 0xc8, 0x7b, 0x16, 0xb5, 0xa9, 0xdf, 0xe4, + 0xee, 0xb6, 0xe1, 0x59, 0xd4, 0xd8, 0xe2, 0x0d, 0x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x78, 0xf1, 0x92, 0x9d, 0x6e, 0xe6, + 0x37, 0x08, 0x20, 0x6c, 0x85, 0xff, 0x1f, 0x69, 0x62, 0xc0, 0xb7, 0x34, 0x62, 0xb6, 0xa2, 0xda, + 0x14, 0x54, 0xb7, 0xf1, 0x2d, 0x41, 0x15, 0xf2, 0x18, 0xad, 0x81, 0xfd, 0xde, 0x36, 0x5a, 0xe1, + 0xe6, 0x6d, 0x1b, 0xad, 0x88, 0xad, 0xda, 0x36, 0x5a, 0xcc, 0x6c, 0x97, 0x4a, 0x87, 0xc7, 0x39, + 0x74, 0x74, 0x9c, 0x43, 0x9f, 0x8e, 0x73, 0xe8, 0xc9, 0x49, 0x2e, 0x76, 0x74, 0x92, 0x8b, 0x7d, + 0x38, 0xc9, 0xc5, 0xee, 0x15, 0x2c, 0xe6, 0x6f, 0x35, 0xaa, 0x7a, 0x8d, 0xd7, 0x3b, 0x03, 0x97, + 0xba, 0xbf, 0x45, 0xf6, 0x94, 0x14, 0x7f, 0xdf, 0xa1, 0x5e, 0x35, 0x21, 0xbe, 0x45, 0x56, 0xbe, + 0x04, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x3c, 0xb0, 0x73, 0xac, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/house/types/ticket.pb.go b/x/house/types/ticket.pb.go index d55170b6..b8181a4f 100644 --- a/x/house/types/ticket.pb.go +++ b/x/house/types/ticket.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" types "github.com/sge-network/sge/types" @@ -142,25 +143,27 @@ func init() { func init() { proto.RegisterFile("sgenetwork/sge/house/ticket.proto", fileDescriptor_240713aaceffb197) } var fileDescriptor_240713aaceffb197 = []byte{ - // 284 bytes of a gzipped FileDescriptorProto + // 313 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x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2, 0x50, 0xa2, 0x14, 0x24, - 0x00, 0x17, 0x73, 0x84, 0x0a, 0xad, 0x60, 0xe4, 0x12, 0x0d, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, - 0x2c, 0x1f, 0xdc, 0x4e, 0x75, 0x72, 0x3a, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, - 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, - 0x28, 0x8d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x50, 0x6c, 0xe8, 0x22, - 0xc7, 0x4c, 0x05, 0x2c, 0xaa, 0x2b, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xf1, 0x63, 0x0c, 0x08, - 0x00, 0x00, 0xff, 0xff, 0xef, 0xcf, 0xb0, 0x22, 0x0f, 0x02, 0x00, 0x00, + 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0xa5, 0x24, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xe3, 0x21, 0x12, + 0x10, 0x0e, 0x54, 0x4a, 0x16, 0xcd, 0xa6, 0x92, 0xca, 0x82, 0x54, 0xfd, 0xec, 0xca, 0x64, 0x88, + 0xb4, 0xd2, 0x7e, 0x46, 0x2e, 0x11, 0x97, 0xd4, 0x82, 0xfc, 0xe2, 0xcc, 0x92, 0x10, 0xb0, 0xed, + 0x01, 0x89, 0x95, 0x39, 0xf9, 0x89, 0x29, 0x42, 0x2e, 0x5c, 0x1c, 0xd9, 0x95, 0xc9, 0xf1, 0x29, + 0x89, 0x25, 0x89, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0xca, 0x7a, 0x68, 0x2e, 0x02, 0x19, + 0xa5, 0xe7, 0x5d, 0x99, 0xec, 0x92, 0x58, 0x92, 0x08, 0xd5, 0xe6, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, + 0x43, 0x10, 0x7b, 0x36, 0x44, 0x54, 0x28, 0x91, 0x4b, 0x30, 0x05, 0x62, 0x7a, 0x7e, 0x51, 0x7c, + 0x62, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0x93, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xc9, 0xa7, + 0x7b, 0xf2, 0x12, 0x95, 0x89, 0xb9, 0x39, 0x56, 0x4a, 0x18, 0x4a, 0x94, 0x2e, 0x6d, 0xd1, 0x15, + 0x81, 0x7a, 0xc3, 0x11, 0x22, 0x14, 0x5c, 0x52, 0x94, 0x99, 0x97, 0x1e, 0x24, 0x00, 0x57, 0x0b, + 0x15, 0x57, 0x3a, 0xc0, 0xc8, 0x25, 0x1a, 0x9e, 0x59, 0x92, 0x91, 0x52, 0x94, 0x58, 0x3e, 0x34, + 0xbd, 0xe0, 0xe4, 0x74, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, + 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x1a, 0xe9, + 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xa0, 0xd8, 0xd3, 0x45, 0x8e, 0xc9, 0x0a, + 0x58, 0xaa, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xc7, 0xa7, 0x31, 0x20, 0x00, 0x00, 0xff, + 0xff, 0x8d, 0x8c, 0xb3, 0x00, 0x5a, 0x02, 0x00, 0x00, } func (m *DepositTicketPayload) Marshal() (dAtA []byte, err error) { diff --git a/x/house/types/tx.pb.go b/x/house/types/tx.pb.go index faf8b263..ec8ce1a3 100644 --- a/x/house/types/tx.pb.go +++ b/x/house/types/tx.pb.go @@ -7,6 +7,9 @@ import ( context "context" cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -247,50 +250,158 @@ func (m *MsgWithdrawResponse) GetParticipationIndex() uint64 { return 0 } +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/bet parameters. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_0764ff859f434eaf, []int{4} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0764ff859f434eaf, []int{5} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgDeposit)(nil), "sgenetwork.sge.house.MsgDeposit") proto.RegisterType((*MsgDepositResponse)(nil), "sgenetwork.sge.house.MsgDepositResponse") proto.RegisterType((*MsgWithdraw)(nil), "sgenetwork.sge.house.MsgWithdraw") proto.RegisterType((*MsgWithdrawResponse)(nil), "sgenetwork.sge.house.MsgWithdrawResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "sgenetwork.sge.house.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "sgenetwork.sge.house.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("sgenetwork/sge/house/tx.proto", fileDescriptor_0764ff859f434eaf) } var fileDescriptor_0764ff859f434eaf = []byte{ - // 524 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xc1, 0x6a, 0xdb, 0x40, - 0x10, 0xd5, 0xca, 0xae, 0x13, 0x6f, 0x20, 0x85, 0x4d, 0x5a, 0x5c, 0x95, 0x68, 0x53, 0xb5, 0x07, - 0x07, 0x5a, 0x09, 0x52, 0x7a, 0x49, 0x6f, 0x22, 0x17, 0x1f, 0x44, 0x41, 0x10, 0x5a, 0x7a, 0x09, - 0x8a, 0xb4, 0xc8, 0x8b, 0x23, 0xad, 0xd0, 0xae, 0xb1, 0xf3, 0x07, 0x3d, 0xf6, 0x13, 0x42, 0x3f, - 0xa2, 0xdf, 0x90, 0x53, 0xf1, 0xb1, 0xf4, 0x20, 0x8a, 0x7c, 0x29, 0x85, 0x5e, 0xfc, 0x05, 0xc5, - 0x2b, 0xc9, 0x56, 0x8b, 0x4d, 0xa8, 0x0f, 0x25, 0xb7, 0xd5, 0xcc, 0x9b, 0xd1, 0xbc, 0xb7, 0x6f, - 0x07, 0x1e, 0xf0, 0x90, 0xc4, 0x44, 0x8c, 0x58, 0x3a, 0xb0, 0x78, 0x48, 0xac, 0x3e, 0x1b, 0x72, - 0x62, 0x89, 0xb1, 0x99, 0xa4, 0x4c, 0x30, 0xb4, 0xbf, 0x4c, 0x9b, 0x3c, 0x24, 0xa6, 0x4c, 0x6b, - 0xfb, 0x21, 0x0b, 0x99, 0x04, 0x58, 0xf3, 0x53, 0x81, 0xd5, 0x9e, 0xae, 0x6c, 0x35, 0xa2, 0xa2, - 0x1f, 0xa4, 0xde, 0xa8, 0x00, 0x19, 0x13, 0x00, 0xa1, 0xc3, 0xc3, 0x53, 0x92, 0x30, 0x4e, 0x05, - 0x7a, 0x0e, 0xb7, 0xfc, 0x94, 0x78, 0x82, 0xa5, 0x1d, 0x70, 0x08, 0xba, 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9, 0x3d, 0x7e, 0x66, 0xae, 0xf2, 0xa8, 0x59, 0x31, 0xf5, 0x2e, 0x1d, 0x16, 0x10, 0xfb, 0xfe, - 0x2c, 0xc3, 0x3b, 0xc5, 0x7f, 0xe6, 0xb5, 0x86, 0x2b, 0x5b, 0xd4, 0x4c, 0x71, 0x6f, 0x33, 0x53, - 0xb4, 0xd6, 0x98, 0xe2, 0x0b, 0x80, 0x7b, 0x35, 0xbd, 0x17, 0xae, 0x38, 0x82, 0x6a, 0xe9, 0x86, - 0xa6, 0xfd, 0x28, 0xcf, 0xb0, 0x2a, 0xa5, 0x53, 0x69, 0x30, 0xcb, 0x70, 0xbb, 0x98, 0x8f, 0x06, - 0x86, 0xab, 0xd2, 0xe0, 0x6e, 0x89, 0x7e, 0xfc, 0x19, 0xc0, 0x86, 0xc3, 0x43, 0x74, 0x06, 0xb7, - 0xaa, 0xc7, 0x7b, 0xb8, 0x5a, 0xf9, 0xe5, 0x5b, 0xd0, 0xba, 0xb7, 0x21, 0x16, 0xba, 0xbc, 0x83, - 0xdb, 0x0b, 0x6f, 0x3e, 0x59, 0x5b, 0x55, 0x41, 0xb4, 0xa3, 0x5b, 0x21, 0x55, 0x67, 0xdb, 0xbe, - 0xc9, 0x75, 0x30, 0xc9, 0x75, 0xf0, 0x3d, 0xd7, 0xc1, 0xc7, 0xa9, 0xae, 0x4c, 0xa6, 0xba, 0xf2, - 0x75, 0xaa, 0x2b, 0xef, 0xbb, 0x21, 0x15, 0xfd, 0xe1, 0x85, 0xe9, 0xb3, 0x68, 0xbe, 0xb0, 0x5e, - 0xd4, 0x97, 0xd7, 0xb8, 0xda, 0x84, 0x57, 0x09, 0xe1, 0x17, 0x2d, 0xb9, 0xbc, 0x5e, 0xfe, 0x0e, - 0x00, 0x00, 0xff, 0xff, 0x17, 0xd2, 0x1d, 0xcc, 0x2e, 0x05, 0x00, 0x00, + // 716 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00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77, 0x51, 0x32, 0x05, 0xad, 0x3c, 0x77, + 0xb8, 0x57, 0x1a, 0xa3, 0x36, 0x2a, 0x09, 0xd2, 0xcc, 0x92, 0x76, 0x5f, 0x5b, 0xea, 0x08, 0xd0, + 0xcb, 0xa2, 0xde, 0x06, 0x93, 0xa7, 0x0a, 0x8e, 0x54, 0x28, 0x4f, 0xc4, 0xf2, 0x97, 0x3f, 0x25, + 0x41, 0xaa, 0x4a, 0x6d, 0x79, 0x15, 0x0c, 0x45, 0x07, 0xda, 0x4c, 0x7c, 0x69, 0xbd, 0x33, 0xa1, + 0x30, 0x7f, 0x16, 0xa2, 0xab, 0xfd, 0x73, 0x70, 0xb9, 0xfb, 0x8d, 0xce, 0x0e, 0x64, 0x45, 0x90, + 0xc2, 0xc2, 0x99, 0x90, 0xee, 0x9b, 0x5f, 0x81, 0x2b, 0x27, 0x84, 0xb9, 0x39, 0x90, 0xda, 0x0f, + 0x2b, 0x94, 0xce, 0x05, 0x8b, 0xb2, 0xa8, 0x13, 0x9f, 0xe3, 0xa6, 0x66, 0x18, 0xfb, 0xad, 0xa2, + 0x74, 0xd0, 0x2a, 0x4a, 0x3f, 0x5a, 0x45, 0xe9, 0xed, 0x51, 0x31, 0x71, 0x70, 0x54, 0x4c, 0x7c, + 0x3d, 0x2a, 0x26, 0x5e, 0xcc, 0xdb, 0x98, 0xd5, 0x9b, 0xeb, 0x5a, 0x8d, 0x38, 0x7a, 0x1f, 0x8f, + 0xdf, 0x25, 0x5b, 0xd1, 0x25, 0xb8, 0xed, 0x21, 0xba, 0x9e, 0xe1, 0xb7, 0xc9, 0x9d, 0xdf, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x60, 0x38, 0xe8, 0x42, 0x29, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -312,6 +423,9 @@ type MsgClient interface { // Withdraw defines a method for performing a withdrawal of tokens of unused // amount corresponding to a deposit. Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc.CallOption) (*MsgWithdrawResponse, error) + // UpdateParams defines a governance operation for updating the x/house module + // parameters. The authority is defined in the keeper. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -340,6 +454,15 @@ func (c *msgClient) Withdraw(ctx context.Context, in *MsgWithdraw, opts ...grpc. return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/sgenetwork.sge.house.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // Deposit defines a method for performing a deposit of tokens to become part @@ -349,6 +472,9 @@ type MsgServer interface { // Withdraw defines a method for performing a withdrawal of tokens of unused // amount corresponding to a deposit. Withdraw(context.Context, *MsgWithdraw) (*MsgWithdrawResponse, error) + // UpdateParams defines a governance operation for updating the x/house module + // parameters. The authority is defined in the keeper. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -361,6 +487,9 @@ func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*M func (*UnimplementedMsgServer) Withdraw(ctx context.Context, req *MsgWithdraw) (*MsgWithdrawResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Withdraw not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -402,6 +531,24 @@ func _Msg_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sgenetwork.sge.house.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "sgenetwork.sge.house.Msg", HandlerType: (*MsgServer)(nil), @@ -414,6 +561,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Withdraw", Handler: _Msg_Withdraw_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "sgenetwork/sge/house/tx.proto", @@ -612,6 +763,69 @@ func (m *MsgWithdrawResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -710,6 +924,30 @@ func (m *MsgWithdrawResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1335,6 +1573,171 @@ func (m *MsgWithdrawResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/house/types/withdraw.pb.go b/x/house/types/withdraw.pb.go index 15658afb..c5a2c707 100644 --- a/x/house/types/withdraw.pb.go +++ b/x/house/types/withdraw.pb.go @@ -6,6 +6,7 @@ package types import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -117,38 +118,40 @@ func init() { } var fileDescriptor_bc9c262f4256300e = []byte{ - // 488 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x41, 0x6f, 0x12, 0x41, - 0x14, 0xc7, 0x77, 0xb7, 0x48, 0xc3, 0xa8, 0x48, 0x46, 0x8c, 0x6b, 0x49, 0x76, 0xc8, 0xea, 0x01, - 0x8d, 0x2e, 0x89, 0xde, 0xea, 0x09, 0x04, 0xe2, 0x26, 0x60, 0x9b, 0xb5, 0x84, 0xc4, 0x0b, 0x99, - 0x32, 0x93, 0x65, 0x42, 0x97, 0x21, 0x3b, 0x43, 0x68, 0xbf, 0x81, 0x47, 0x8f, 0x1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ab, 0xd9, 0xbc, 0x5c, 0x39, 0xe6, 0xd5, 0xca, - 0x31, 0xff, 0xae, 0x1c, 0xf3, 0xc7, 0xda, 0x31, 0xae, 0xd6, 0x8e, 0xf1, 0x7b, 0xed, 0x18, 0xdf, - 0x6a, 0x21, 0x93, 0xe3, 0xf9, 0xa9, 0x37, 0xe2, 0x51, 0x9a, 0xcc, 0x77, 0xdb, 0x29, 0x3d, 0xcf, - 0x72, 0x2a, 0x2f, 0x66, 0x54, 0x9c, 0xe6, 0x75, 0xf2, 0x3e, 0x5c, 0x07, 0x00, 0x00, 0xff, 0xff, - 0xc7, 0xb9, 0xe4, 0x97, 0xcc, 0x02, 0x00, 0x00, + // 517 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x41, 0x6f, 0xda, 0x3e, + 0x18, 0xc6, 0x93, 0x94, 0x3f, 0x15, 0xfe, 0x6f, 0x0c, 0x79, 0x4c, 0x4b, 0x41, 0x8a, 0x51, 0xb6, + 0x03, 0xab, 0xd4, 0x20, 0x6d, 0xb7, 0xee, 0x04, 0x03, 0xb4, 0x48, 0xb0, 0x56, 0x69, 0x11, 0xd2, + 0x2e, 0x28, 0xc5, 0x56, 0xb0, 0x68, 0x62, 0x14, 0x1b, 0xd1, 0x7e, 0x83, 0x1d, 0x77, 0xdc, 0x91, + 0x0f, 0xb1, 0x0f, 0xd1, 0x63, 0xb5, 0xd3, 0xb4, 0x83, 0x35, 0xc1, 0x65, 0xda, 0x31, 0x9f, 0x60, + 0xc2, 0xc9, 0x54, 0x8a, 0xaa, 0xdd, 0x9c, 0xf7, 0xf9, 0xbd, 0xcf, 0xe3, 0xbc, 0x7e, 0xc1, 0x0b, + 0x1e, 0x90, 0x88, 0x88, 0x05, 0x8b, 0xa7, 0x0d, 0x1e, 0x90, 0xc6, 0x84, 0xcd, 0x39, 0x69, 0x2c, + 0xa8, 0x98, 0xe0, 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, + 0xf9, 0x85, 0x33, 0x66, 0xe1, 0x66, 0xc9, 0x8f, 0xb6, 0x17, 0xfe, 0x2a, 0x5b, 0x79, 0x71, 0x3d, + 0x23, 0xfc, 0x22, 0xaf, 0x36, 0xf5, 0xcd, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xef, 0xfe, + 0x94, 0x17, 0x03, 0x00, 0x00, } func (m *Withdrawal) Marshal() (dAtA []byte, err error) { diff --git a/x/market/handler.go b/x/market/handler.go index 220bb5f5..0e5139e5 100644 --- a/x/market/handler.go +++ b/x/market/handler.go @@ -29,6 +29,10 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgUpdate: res, err := msgServer.Update(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateParams: + res, err := msgServer.UpdateParams(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) return nil, sdkerrors.Wrap(sdkerrtypes.ErrUnknownRequest, errMsg) diff --git a/x/market/keeper/keeper.go b/x/market/keeper/keeper.go index e437d580..65b8597f 100644 --- a/x/market/keeper/keeper.go +++ b/x/market/keeper/keeper.go @@ -22,6 +22,9 @@ type Keeper struct { paramStore paramtypes.Subspace ovmKeeper types.OVMKeeper orderbookKeeper types.OrderbookKeeper + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } // NewKeeper creates new keeper object @@ -30,6 +33,7 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, + authority string, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -41,6 +45,7 @@ func NewKeeper( storeKey: storeKey, memKey: memKey, paramStore: ps, + authority: authority, } } @@ -58,3 +63,8 @@ func (k *Keeper) SetOVMKeeper(ovmKeeper types.OVMKeeper) { func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// GetAuthority returns the x/market module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/market/keeper/msg_server_params.go b/x/market/keeper/msg_server_params.go new file mode 100644 index 00000000..31fa96e4 --- /dev/null +++ b/x/market/keeper/msg_server_params.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/sge-network/sge/x/market/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.GetAuthority() != req.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + k.SetParams(ctx, req.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/market/simulation/proposals.go b/x/market/simulation/proposals.go new file mode 100644 index 00000000..2be67a41 --- /dev/null +++ b/x/market/simulation/proposals.go @@ -0,0 +1,43 @@ +package simulation + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/sge-network/sge/x/market/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" //#nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateMsgUpdateParams, + ), + } +} + +// SimulateMsgUpdateParams returns a random MsgUpdateParams +func SimulateMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") + + params := types.DefaultParams() + + return &types.MsgUpdateParams{ + Authority: authority.String(), + Params: params, + } +} diff --git a/x/market/simulation/proposals_test.go b/x/market/simulation/proposals_test.go new file mode 100644 index 00000000..7c57131d --- /dev/null +++ b/x/market/simulation/proposals_test.go @@ -0,0 +1,43 @@ +package simulation_test + +import ( + "fmt" + "math/rand" + "testing" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/sge-network/sge/x/market/simulation" + "github.com/sge-network/sge/x/market/types" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + //#nosec + r := rand.New(s) + + ctx := sdk.NewContext(nil, tmproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, len(weightedProposalMsgs), 1) + + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + fmt.Println(msgUpdateParams) + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) +} diff --git a/x/market/types/codec.go b/x/market/types/codec.go index 66a82e9a..348363be 100644 --- a/x/market/types/codec.go +++ b/x/market/types/codec.go @@ -14,6 +14,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgAdd{}, "market/Add") legacy.RegisterAminoMsg(cdc, &MsgResolve{}, "market/Resolve") legacy.RegisterAminoMsg(cdc, &MsgUpdate{}, "market/Update") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "market/MsgUpdateParams") } // RegisterInterfaces registers the module interface types @@ -21,12 +22,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil)) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgAdd{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgResolve{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdate{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/market/types/market.pb.go b/x/market/types/market.pb.go index ffad7af2..4c6e02e5 100644 --- a/x/market/types/market.pb.go +++ b/x/market/types/market.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -205,41 +206,42 @@ func init() { } var fileDescriptor_14e36a254c493254 = []byte{ - // 529 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0x9b, 0xa5, 0x6b, 0x57, 0x33, 0xaa, 0xc8, 0x6c, 0x90, 0x15, 0x2d, 0xc9, 0x86, 0x84, - 0x0a, 0x88, 0x54, 0xda, 0x8e, 0x9c, 0x9a, 0xc4, 0xa0, 0x88, 0xae, 0x43, 0x4e, 0x0a, 0x12, 0x97, - 0xa8, 0x5d, 0xac, 0x50, 0x95, 0xc6, 0x53, 0xec, 0x6a, 0xf0, 0x2d, 0xf8, 0x42, 0xdc, 0x39, 0xee, - 0xc8, 0x29, 0x42, 0xe9, 0xad, 0x1f, 0x81,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 0xb0, 0xff, 0xcf, 0x8d, 0xce, 0x39, 0x0e, 0x91, 0xa7, 0x55, 0xe1, 0x11, - 0x38, 0x2c, 0x23, 0x8c, 0x82, 0x41, 0x2f, 0x8c, 0x3c, 0xe4, 0xf6, 0xba, 0x18, 0x79, 0xda, 0xb6, - 0xe3, 0xfe, 0x28, 0x0c, 0xe5, 0xba, 0x30, 0x94, 0x5f, 0x85, 0xa1, 0x7c, 0x9b, 0x1b, 0x95, 0xeb, - 0xb9, 0x51, 0xf9, 0x39, 0x37, 0x2a, 0x1f, 0x9f, 0x25, 0x63, 0xfe, 0x69, 0x36, 0xb2, 0x2f, 0xe8, - 0x54, 0x7c, 0xf8, 0x2f, 0x6f, 0x2f, 0xc1, 0x97, 0x9b, 0x35, 0xe0, 0x5f, 0x2f, 0x09, 0x1b, 0xd5, - 0xe4, 0x22, 0x9c, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xa0, 0x17, 0x1a, 0x7d, 0x03, 0x00, - 0x00, + // 560 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x86, 0xe3, 0xda, 0x4d, 0xdb, 0xf9, 0xfa, 0x55, 0xd6, 0xd0, 0x82, 0x5b, 0x54, 0xdb, 0x2d, + 0x12, 0x0a, 0xa0, 0x3a, 0x52, 0xbb, 0x64, 0xe5, 0x3f, 0x90, 0x45, 0x7f, 0xd0, 0xd8, 0x01, 0x89, + 0x8d, 0x95, 0xc4, 0x23, 0x63, 0x85, 0x78, 0x2a, 0xcf, 0x44, 0x85, 0xbb, 0x60, 0xc1, 0xa5, 0xb0, + 0x65, 0xcf, 0xb2, 0x62, 0xc5, 0xca, 0x42, 0xce, 0x2e, 0x57, 0x81, 0x66, 0xec, 0x86, 0x86, 0x94, + 0x8d, 0xe7, 0xcc, 0x79, 0xde, 0x33, 0x9e, 0x33, 0xaf, 0x0e, 0x38, 0xa4, 0x29, 0xce, 0x31, 0xbb, + 0x22, 0xc5, 0xa8, 0x4b, 0x53, 0xdc, 0x1d, 0xf7, 0x8b, 0x11, 0x66, 0xcd, 0x62, 0x5d, 0x16, 0x84, + 0x11, 0xb8, 0xf3, 0x47, 0x63, 0xd1, 0x14, 0x5b, 0x35, 0xdc, 0xdb, 0x4e, 0x49, 0x4a, 0x84, 0xa2, + 0xcb, 0xa3, 0x5a, 0xbc, 0xb7, 0x3b, 0x24, 0x74, 0x4c, 0x68, 0x5c, 0x83, 0x7a, 0xd3, 0x20, 0xf3, + 0xee, 0x7f, 0x91, 0x24, 0x69, 0x14, 0x87, 0x5f, 0x14, 0xd0, 0x3e, 0x13, 0x59, 0x68, 0x02, 0x79, + 0x92, 0x25, 0x9a, 0x64, 0x4a, 0x9d, 0x0d, 0x67, 0xab, 0x2a, 0x0d, 0xb9, 0x17, 0x78, 0xb3, 0xd2, + 0xe0, 0x59, 0xc4, 0x3f, 0xf0, 0x04, 0xac, 0x53, 0xd6, 0x2f, 0x58, 0xcc, 0xa8, 0xb6, 0x62, 0x4a, + 0x1d, 0xc5, 0x79, 0x50, 0x95, 0xc6, 0x5a, 0xc8, 0x73, 0x51, 0x38, 0x2b, 0x8d, 0x39, 0x46, 0xf3, + 0x08, 0x3e, 0x03, 0x6d, 0x9c, 0x27, 0xbc, 0x44, 0x16, 0x25, 0xf7, 0xaa, 0xd2, 0x58, 0xf5, 0xf3, + 0x44, 0x14, 0x34, 0x08, 0x35, 0x2b, 0xec, 0x02, 0x85, 0x5f, 0x4e, 0x53, 0x4c, 0xb9, 0xf3, 0xdf, + 0xf1, 0x43, 0xeb, 0xce, 0x77, 0xb0, 0x2e, 0x92, 0x84, 0x22, 0x21, 0x84, 0x08, 0xa8, 0x57, 0x59, + 0x9e, 0xe3, 0x22, 0xe6, 0xdb, 0x78, 0x92, 0x25, 0x54, 0x5b, 0x35, 0xe5, 0xce, 0x86, 0x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, 0xde, 0xb0, 0x95, 0x65, 0xe6, 0xda, 0xe7, 0xae, 0x7f, 0xea, 0x7b, + 0xaa, 0x0c, 0x77, 0xc1, 0xce, 0x5f, 0x27, 0x3a, 0x17, 0x28, 0xf2, 0x3d, 0x55, 0x81, 0x07, 0x60, + 0x7f, 0x11, 0x21, 0x3f, 0xec, 0x9d, 0x46, 0xb1, 0xe7, 0xbb, 0xa7, 0x36, 0xf2, 0x3d, 0x75, 0xd5, + 0x71, 0xbf, 0x57, 0xba, 0x74, 0x5d, 0xe9, 0xd2, 0xaf, 0x4a, 0x97, 0x3e, 0x4f, 0xf5, 0xd6, 0xf5, + 0x54, 0x6f, 0xfd, 0x9c, 0xea, 0xad, 0x77, 0x4f, 0xd2, 0x8c, 0xbd, 0x9f, 0x0c, 0xac, 0x21, 0x19, + 0xf3, 0x91, 0x38, 0xba, 0x3d, 0x1e, 0x1f, 0x6f, 0x06, 0x84, 0x7d, 0xba, 0xc4, 0x74, 0xd0, 0x16, + 0x23, 0x72, 0xf2, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x8a, 0x2c, 0x9f, 0xb2, 0x03, 0x00, 0x00, } func (m *Market) Marshal() (dAtA []byte, err error) { diff --git a/x/market/types/messages_params.go b/x/market/types/messages_params.go new file mode 100644 index 00000000..e357ac1e --- /dev/null +++ b/x/market/types/messages_params.go @@ -0,0 +1,43 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // typeMsgUpdateParams is type of message MsgUpdateParams + typeMsgUpdateParams = "market_update_params" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// Route returns the module's message router key. +func (*MsgUpdateParams) Route() string { return RouterKey } + +// Type returns type of its message +func (*MsgUpdateParams) Type() string { return typeMsgUpdateParams } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + if err := msg.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/market/types/tx.pb.go b/x/market/types/tx.pb.go index b84f75d8..2cc7988d 100644 --- a/x/market/types/tx.pb.go +++ b/x/market/types/tx.pb.go @@ -6,6 +6,9 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -360,6 +363,100 @@ func (m *MsgUpdateResponse) GetData() *Market { return nil } +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/bet parameters. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_cb37002f2abdafc2, []int{6} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb37002f2abdafc2, []int{7} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgAdd)(nil), "sgenetwork.sge.market.MsgAdd") proto.RegisterType((*MsgAddResponse)(nil), "sgenetwork.sge.market.MsgAddResponse") @@ -367,35 +464,48 @@ func init() { proto.RegisterType((*MsgResolveResponse)(nil), "sgenetwork.sge.market.MsgResolveResponse") proto.RegisterType((*MsgUpdate)(nil), "sgenetwork.sge.market.MsgUpdate") proto.RegisterType((*MsgUpdateResponse)(nil), "sgenetwork.sge.market.MsgUpdateResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "sgenetwork.sge.market.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "sgenetwork.sge.market.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("sgenetwork/sge/market/tx.proto", fileDescriptor_cb37002f2abdafc2) } var fileDescriptor_cb37002f2abdafc2 = []byte{ - // 353 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x4e, 0x4f, 0xcd, - 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0xd6, 0x2f, 0x4e, 0x4f, 0xd5, 0xcf, 0x4d, 0x2c, 0xca, 0x4e, - 0x2d, 0xd1, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x45, 0xc8, 0xeb, 0x15, - 0xa7, 0xa7, 0xea, 0x41, 0xe4, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x2a, 0xf4, 0x41, 0x2c, - 0x88, 0x62, 0x29, 0x25, 0xec, 0x86, 0x41, 0x28, 0x88, 0x1a, 0x25, 0x2b, 0x2e, 0x36, 0xdf, 0xe2, - 0x74, 0xc7, 0x94, 0x14, 0x21, 0x09, 0x2e, 0xf6, 0xe4, 0xa2, 0xd4, 0xc4, 0x92, 0xfc, 0x22, 0x09, - 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x18, 0x57, 0x48, 0x8c, 0x8b, 0xad, 0x24, 0x33, 0x39, 0x3b, - 0xb5, 0x44, 0x82, 0x09, 0x2c, 0x01, 0xe5, 0x29, 0xa5, 0x72, 0xf1, 0x41, 0xf4, 0x06, 0xa5, 0x16, - 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0x49, 0x71, 0xb1, 0xa6, 0x16, 0x15, 0xc1, 0x4c, 0x70, 0x62, - 0x39, 0x71, 0x4f, 0x9e, 0x31, 0x08, 0x22, 0x24, 0x64, 0xce, 0xc5, 0x92, 0x92, 0x58, 0x92, 0x08, - 0x36, 0x83, 0xdb, 0x48, 0x56, 0x0f, 0xab, 0x4f, 0xf4, 0x7c, 0xc1, 0x14, 0x54, 0x27, 0x58, 0x83, - 0x92, 0x1d, 0x17, 0x97, 0x6f, 0x71, 0x7a, 0x50, 0x6a, 0x71, 0x7e, 0x4e, 0x59, 0x2a, 0x19, 0xce, - 0xcc, 0xe4, 0x12, 0x42, 0xe8, 0xa7, 0xad, 0x53, 0x6d, 0xb9, 0x38, 0x7d, 0x8b, 0xd3, 0x43, 0x0b, - 0x52, 0x12, 0x4b, 0xc8, 0x71, 0x69, 0x06, 0x97, 0x20, 0x5c, 0x3b, 0x4d, 0x1d, 0x6a, 0xd4, 0xc8, - 0xc4, 0xc5, 0xec, 0x5b, 0x9c, 0x2e, 0xe4, 0xcd, 0xc5, 0x0c, 0x8a, 0x7b, 0x9c, 0x3a, 0xc1, 0xd1, - 0x2b, 0xa5, 0x8a, 0x57, 0x1a, 0xee, 0xd2, 0x70, 0x2e, 0x76, 0x58, 0x2c, 0x29, 0xe2, 0xd6, 0x01, - 0x55, 0x22, 0xa5, 0x49, 0x50, 0x09, 0xdc, 0xe0, 0x10, 0x2e, 0x36, 0x68, 0x98, 0x2a, 0xe0, 0xd6, - 0x04, 0x51, 0x21, 0xa5, 0x41, 0x48, 0x05, 0xcc, 0x54, 0x27, 0xe7, 0x13, 0x8f, 0xe4, 0x18, 0x2f, - 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, - 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, - 0x05, 0x65, 0x1c, 0x5d, 0xe4, 0x4c, 0x54, 0x01, 0xcf, 0x93, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, - 0xe0, 0x6c, 0x64, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x8c, 0x3f, 0xf3, 0xb9, 0x03, 0x00, - 0x00, + // 530 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0x6e, 0xe8, 0xc8, 0xd4, 0xc7, 0x04, 0x6a, 0xb4, 0xb2, 0x12, 0x89, 0xac, 0x04, 0x81, 0xb6, + 0x49, 0x4d, 0x68, 0x91, 0x98, 0xd4, 0x13, 0x2b, 0x47, 0x14, 0x09, 0x05, 0x10, 0x12, 0x17, 0x94, + 0x36, 0xc6, 0x8d, 0x4a, 0xea, 0xc8, 0xf6, 0xc6, 0x76, 0x40, 0x42, 0xfc, 0x02, 0x7e, 0x06, 0xc7, + 0x1e, 0xf6, 0x23, 0x2a, 0x4e, 0xd3, 0x4e, 0x9c, 0x26, 0xd4, 0x1e, 0xf6, 0x37, 0x50, 0x6c, 0x27, + 0x05, 0xd4, 0x2e, 0xbb, 0xf4, 0x12, 0xc7, 0xfe, 0xbe, 0xcf, 0xdf, 0x7b, 0xcf, 0xcf, 0x06, 0x8b, + 0x61, 0x34, 0x42, 0xfc, 0x33, 0xa1, 0x43, 0x97, 0x61, 0xe4, 0xc6, 0x01, 0x1d, 0x22, 0xee, 0xf2, + 0x63, 0x27, 0xa1, 0x84, 0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55, 0x3a, 0x9b, 0x59, 0xa5, 0x5f, 0x33, 0xab, 0xf4, 0x7e, 0x17, 0x47, 0x7c, 0x70, 0xd8, + 0x73, 0xfa, 0x24, 0x76, 0xff, 0xd2, 0x89, 0x07, 0xf2, 0x38, 0x7f, 0xda, 0x4f, 0x12, 0xc4, 0x7a, + 0xba, 0x78, 0x22, 0x9f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x93, 0x20, 0x87, 0xb6, 0x00, 0x06, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -416,6 +526,9 @@ type MsgClient interface { Resolve(ctx context.Context, in *MsgResolve, opts ...grpc.CallOption) (*MsgResolveResponse, error) // Update defines a method to update a market. Update(ctx context.Context, in *MsgUpdate, opts ...grpc.CallOption) (*MsgUpdateResponse, error) + // UpdateParams defines a governance operation for updating the x/market + // module parameters. The authority is defined in the keeper. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -453,6 +566,15 @@ func (c *msgClient) Update(ctx context.Context, in *MsgUpdate, opts ...grpc.Call return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/sgenetwork.sge.market.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // Add defines a method to add the market with the given data. @@ -461,6 +583,9 @@ type MsgServer interface { Resolve(context.Context, *MsgResolve) (*MsgResolveResponse, error) // Update defines a method to update a market. Update(context.Context, *MsgUpdate) (*MsgUpdateResponse, error) + // UpdateParams defines a governance operation for updating the x/market + // module parameters. The authority is defined in the keeper. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -476,6 +601,9 @@ func (*UnimplementedMsgServer) Resolve(ctx context.Context, req *MsgResolve) (*M func (*UnimplementedMsgServer) Update(ctx context.Context, req *MsgUpdate) (*MsgUpdateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -535,6 +663,24 @@ func _Msg_Update_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sgenetwork.sge.market.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "sgenetwork.sge.market.Msg", HandlerType: (*MsgServer)(nil), @@ -551,6 +697,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Update", Handler: _Msg_Update_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "sgenetwork/sge/market/tx.proto", @@ -793,6 +943,69 @@ func (m *MsgUpdateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -906,6 +1119,30 @@ func (m *MsgUpdateResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1608,6 +1845,171 @@ func (m *MsgUpdateResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/mint/client/cli/query_minter_test.go b/x/mint/client/cli/query_minter_test.go index 2da04737..841da800 100644 --- a/x/mint/client/cli/query_minter_test.go +++ b/x/mint/client/cli/query_minter_test.go @@ -131,7 +131,7 @@ func TestQueryPhaseProvision(t *testing.T) { } else { require.NoError(t, err) phaseProvision := strings.Replace(string(res.Bytes()), "\n", "", 1) - require.Equal(t, "0.000000000000000000", phaseProvision) + require.Equal(t, "57446808.510638297750000000", phaseProvision) } }) } diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index 6f914615..f650f851 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -21,6 +21,9 @@ type Keeper struct { stakingKeeper types.StakingKeeper bankKeeper types.BankKeeper feeCollectorName string + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } // ExpectedKeepers contains expected keepers parameter needed by NewKeeper @@ -37,6 +40,7 @@ func NewKeeper( ak types.AccountKeeper, expectedKeepers ExpectedKeepers, feeCollectorName string, + authority string, ) *Keeper { // ensure mint module account is set if addr := ak.GetModuleAddress(types.ModuleName); addr == nil { @@ -55,6 +59,7 @@ func NewKeeper( stakingKeeper: expectedKeepers.StakingKeeper, bankKeeper: expectedKeepers.BankKeeper, feeCollectorName: feeCollectorName, + authority: authority, } } diff --git a/x/mint/keeper/msg_server.go b/x/mint/keeper/msg_server.go new file mode 100644 index 00000000..a18ae394 --- /dev/null +++ b/x/mint/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/sge-network/sge/x/mint/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/mint/keeper/msg_server_params.go b/x/mint/keeper/msg_server_params.go new file mode 100644 index 00000000..c4c7770d --- /dev/null +++ b/x/mint/keeper/msg_server_params.go @@ -0,0 +1,28 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/sge-network/sge/x/mint/types" +) + +// UpdateParams updates the params. +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.authority != req.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + k.SetParams(ctx, req.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/mint/module.go b/x/mint/module.go index 3075ce3b..818e0949 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -127,6 +127,7 @@ func (AppModule) QuerierRoute() string { return types.QuerierRoute } // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } diff --git a/x/orderbook/handler.go b/x/orderbook/handler.go new file mode 100644 index 00000000..3f8d5c38 --- /dev/null +++ b/x/orderbook/handler.go @@ -0,0 +1,32 @@ +package orderbook + +import ( + "fmt" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrtypes "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/sge-network/sge/x/orderbook/keeper" + "github.com/sge-network/sge/x/orderbook/types" +) + +// NewHandler initialize a new sdk.handler instance for registered messages +func NewHandler(k keeper.Keeper) sdk.Handler { + msgServer := keeper.NewMsgServerImpl(k) + + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { + ctx = ctx.WithEventManager(sdk.NewEventManager()) + _ = ctx + + switch msg := msg.(type) { + case *types.MsgUpdateParams: + res, err := msgServer.UpdateParams(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + + default: + errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) + return nil, sdkerrors.Wrap(sdkerrtypes.ErrUnknownRequest, errMsg) + } + } +} diff --git a/x/orderbook/keeper/keeper.go b/x/orderbook/keeper/keeper.go index f0072fb1..cf7312f4 100644 --- a/x/orderbook/keeper/keeper.go +++ b/x/orderbook/keeper/keeper.go @@ -25,6 +25,9 @@ type Keeper struct { ovmKeeper types.OVMKeeper feeGrantKeeper types.FeeGrantKeeper hooks types.OrderBookHooks + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } // SdkExpectedKeepers contains expected keepers parameter needed by NewKeeper @@ -40,6 +43,7 @@ func NewKeeper( key storetypes.StoreKey, ps paramtypes.Subspace, expectedKeepers SdkExpectedKeepers, + authority string, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -53,6 +57,7 @@ func NewKeeper( bankKeeper: expectedKeepers.BankKeeper, accountKeeper: expectedKeepers.AccountKeeper, feeGrantKeeper: expectedKeepers.FeeGrantKeeper, + authority: authority, } } @@ -91,3 +96,8 @@ func (k *Keeper) SetHooks(gh types.OrderBookHooks) *Keeper { func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// GetAuthority returns the x/orderbook module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/orderbook/keeper/msg_server.go b/x/orderbook/keeper/msg_server.go new file mode 100644 index 00000000..ab6771dc --- /dev/null +++ b/x/orderbook/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/sge-network/sge/x/orderbook/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/orderbook/keeper/msg_server_params.go b/x/orderbook/keeper/msg_server_params.go new file mode 100644 index 00000000..6d8dc25e --- /dev/null +++ b/x/orderbook/keeper/msg_server_params.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/sge-network/sge/x/orderbook/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.GetAuthority() != req.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + k.SetParams(ctx, req.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/orderbook/module.go b/x/orderbook/module.go index 22f27183..4a4cbffb 100644 --- a/x/orderbook/module.go +++ b/x/orderbook/module.go @@ -103,6 +103,7 @@ func (AppModule) QuerierRoute() string { return types.QuerierRoute } // RegisterServices registers a GRPC query service to respond to the module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } diff --git a/x/orderbook/simulation/proposals.go b/x/orderbook/simulation/proposals.go new file mode 100644 index 00000000..86b99778 --- /dev/null +++ b/x/orderbook/simulation/proposals.go @@ -0,0 +1,46 @@ +package simulation + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/sge-network/sge/x/orderbook/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" //#nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateMsgUpdateParams, + ), + } +} + +// SimulateMsgUpdateParams returns a random MsgUpdateParams +func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") + + params := types.DefaultParams() + params.BatchSettlementCount = uint64(r.Intn(10000)) + params.MaxOrderBookParticipations = uint64(r.Intn(1000)) + params.RequeueThreshold = uint64(r.Intn(1000)) + + return &types.MsgUpdateParams{ + Authority: authority.String(), + Params: params, + } +} diff --git a/x/orderbook/simulation/proposals_test.go b/x/orderbook/simulation/proposals_test.go new file mode 100644 index 00000000..9f73bdc5 --- /dev/null +++ b/x/orderbook/simulation/proposals_test.go @@ -0,0 +1,46 @@ +package simulation_test + +import ( + "fmt" + "math/rand" + "testing" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/sge-network/sge/x/orderbook/simulation" + "github.com/sge-network/sge/x/orderbook/types" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + //#nosec + r := rand.New(s) + + ctx := sdk.NewContext(nil, tmproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, len(weightedProposalMsgs), 1) + + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + fmt.Println(msgUpdateParams) + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) + require.Equal(t, uint64(2540), msgUpdateParams.Params.BatchSettlementCount) + require.Equal(t, uint64(456), msgUpdateParams.Params.MaxOrderBookParticipations) + require.Equal(t, uint64(300), msgUpdateParams.Params.RequeueThreshold) +} diff --git a/x/orderbook/types/codec.go b/x/orderbook/types/codec.go index 23721c39..57a29568 100644 --- a/x/orderbook/types/codec.go +++ b/x/orderbook/types/codec.go @@ -2,19 +2,25 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" ) // RegisterLegacyAminoCodec registers the necessary x/orderbook interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { - // left empty because no message is available in this module +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "orderbook/MsgUpdateParams") } // RegisterInterfaces registers the module interface types func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil)) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } var ( diff --git a/x/orderbook/types/messages_params.go b/x/orderbook/types/messages_params.go new file mode 100644 index 00000000..e357ac1e --- /dev/null +++ b/x/orderbook/types/messages_params.go @@ -0,0 +1,43 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // typeMsgUpdateParams is type of message MsgUpdateParams + typeMsgUpdateParams = "market_update_params" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// Route returns the module's message router key. +func (*MsgUpdateParams) Route() string { return RouterKey } + +// Type returns type of its message +func (*MsgUpdateParams) Type() string { return typeMsgUpdateParams } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + if err := msg.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/orderbook/types/participation.pb.go b/x/orderbook/types/participation.pb.go index 487fec8e..d2258b21 100644 --- a/x/orderbook/types/participation.pb.go +++ b/x/orderbook/types/participation.pb.go @@ -6,6 +6,7 @@ package types import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -239,59 +240,61 @@ func init() { } var fileDescriptor_325ee5284c02991d = []byte{ - // 819 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0x4f, 0x6f, 0xf3, 0x34, - 0x18, 0x6f, 0xde, 0x3f, 0xdb, 0x6a, 0xba, 0xae, 0xe4, 0x6d, 0xf7, 0x46, 0x45, 0x8b, 0x27, 0x4b, - 0x4c, 0x93, 0x18, 0x2d, 0x88, 0xbf, 0x9a, 0x04, 0x68, 0x01, 0x55, 0x1a, 0x0c, 0x3a, 0x0c, 0x5c, - 0x26, 0xa1, 0x90, 0x36, 0x6e, 0x67, 0xb5, 0x89, 0x8b, 0xed, 0x68, 0xdd, 0x07, 0x40, 0x42, 0x9c, - 0x38, 0x72, 0xdc, 0x97, 0xe0, 0x3b, 0xec, 0xb8, 0x23, 0xe2, 0x10, 0xa1, 0x8e, 0x03, 0xe2, 0xd8, - 0x4f, 0x80, 0x62, 0xb7, 0x69, 0xda,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, 0xf4, 0x84, - 0x08, 0x00, 0x00, + // 849 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0x8e, 0xf7, 0xa3, 0x6d, 0x86, 0x34, 0x0d, 0xde, 0xa4, 0x6b, 0x82, 0xd6, 0x53, 0x8d, 0xc4, + 0xaa, 0x12, 0xbb, 0x09, 0x88, 0x4f, 0xad, 0x04, 0x68, 0x0d, 0x8a, 0x54, 0x58, 0x48, 0x99, 0x85, + 0xcb, 0x4a, 0xc8, 0x38, 0xf1, 0xc4, 0x1d, 0x25, 0xf6, 0x84, 0x99, 0xb1, 0x9a, 0xfe, 0x03, 0xc4, + 0x89, 0x23, 0x17, 0xa4, 0xfe, 0x08, 0xf8, 0x0f, 0x3d, 0x56, 0x9c, 0x10, 0x07, 0x0b, 0xa5, 0x1c, + 0x10, 0xc7, 0x9c, 0x39, 0x20, 0xcf, 0x24, 0x8e, 0x93, 0x06, 0x2c, 0x71, 0xdd, 0xdb, 0xcc, 0xfb, + 0xf1, 0x3c, 0xcf, 0x3b, 0xf6, 0xbc, 0xef, 0x80, 0x07, 0x22, 0x20, 0x11, 0x91, 0xa7, 0x8c, 0x0f, + 0xdb, 0x22, 0x20, 0x6d, 0xc6, 0x7d, 0xc2, 0x7b, 0x8c, 0x0d, 0xdb, 0x63, 0x8f, 0x4b, 0xda, 0xa7, + 0x63, 0x4f, 0x52, 0x16, 0xb5, 0xc6, 0x9c, 0x49, 0x66, 0x5a, 0xcb, 0xe8, 0x96, 0x08, 0x48, 0x2b, + 0x8b, 0x6e, 0xd6, 0x03, 0x16, 0x30, 0x15, 0xd4, 0x4e, 0x57, 0x3a, 0xbe, 0xf9, 0x52, 0x9f, 0x89, + 0x90, 0x09, 0x57, 0x3b, 0xf4, 0x46, 0xbb, 0xd0, 0x8f, 0x15, 0xb0, 0xdf, 0x4d, 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, + 0xdf, 0x5d, 0xbf, 0x9b, 0xeb, 0xfa, 0x29, 0x87, 0xab, 0xe7, 0xce, 0x0d, 0xd5, 0x82, 0xec, 0x0d, + 0x5d, 0x7f, 0x19, 0x84, 0x72, 0xdd, 0x3d, 0xb5, 0x1e, 0xa9, 0x91, 0xd4, 0x06, 0xdb, 0xe9, 0xdd, + 0x4d, 0x55, 0xe9, 0xd1, 0xd1, 0x98, 0x26, 0x70, 0xcb, 0x21, 0x52, 0xeb, 0x59, 0x38, 0xf1, 0x62, + 0x81, 0xfe, 0x36, 0xc0, 0xbd, 0xf9, 0x17, 0xec, 0x2e, 0x86, 0xe9, 0xf3, 0x33, 0x0d, 0x9d, 0xce, + 0xc5, 0xd4, 0x36, 0x2e, 0xa7, 0xb6, 0xf1, 0xfb, 0xd4, 0x36, 0xbe, 0xbf, 0xb2, 0x4b, 0x97, 0x57, + 0x76, 0xe9, 0xd7, 0x2b, 0xbb, 0xf4, 0xec, 0x41, 0x40, 0xe5, 0x49, 0xdc, 0x6b, 0xf5, 0x59, 0x98, + 0x3e, 0x4c, 0x1e, 0xe6, 0x1f, 0x29, 0x93, 0xdc, 0x33, 0x45, 0x9e, 0x8d, 0x89, 0xe8, 0x6d, 0xa9, + 0x47, 0xc5, 0x1b, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x73, 0xdb, 0x4c, 0x09, 0xcf, 0x08, 0x00, + 0x00, } func (m *OrderBookParticipation) Marshal() (dAtA []byte, err error) { diff --git a/x/orderbook/types/tx.pb.go b/x/orderbook/types/tx.pb.go new file mode 100644 index 00000000..b5abbfc7 --- /dev/null +++ b/x/orderbook/types/tx.pb.go @@ -0,0 +1,598 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: sgenetwork/sge/orderbook/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/bet parameters. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_40bc64b0300596fa, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_40bc64b0300596fa, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "sgenetwork.sge.orderbook.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "sgenetwork.sge.orderbook.MsgUpdateParamsResponse") +} + +func init() { proto.RegisterFile("sgenetwork/sge/orderbook/tx.proto", fileDescriptor_40bc64b0300596fa) } + +var fileDescriptor_40bc64b0300596fa = []byte{ + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0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b, 0x48, + 0x41, 0x0f, 0x97, 0xd7, 0xf5, 0x20, 0x36, 0x39, 0x71, 0x9e, 0xb8, 0x27, 0xcf, 0xb0, 0xe2, 0xf9, + 0x06, 0x2d, 0xc6, 0x20, 0xa8, 0x56, 0x2b, 0xe5, 0x4b, 0x5b, 0x74, 0x05, 0x8b, 0xd3, 0x53, 0x75, + 0xa1, 0x1a, 0x15, 0x0c, 0xf5, 0xcc, 0xf5, 0x0c, 0x9b, 0x9e, 0x6f, 0xd0, 0x42, 0xd8, 0xa4, 0x64, + 0xc0, 0x25, 0x8e, 0xe6, 0xe8, 0xa0, 0xd4, 0xe2, 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0x2b, 0x51, 0xac, + 0xfa, 0x8d, 0xba, 0x19, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x85, 0x9a, 0x19, 0xb9, 0x78, 0x50, 0x3c, + 0xab, 0x89, 0xdb, 0x91, 0x68, 0x56, 0x48, 0x19, 0x12, 0xad, 0x14, 0xe6, 0x1a, 0x25, 0xd1, 0x53, + 0xd8, 0x5c, 0xe3, 0xe4, 0x76, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, + 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x3a, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x48, 0xfa, 0xc0, 0x51, 0x58, + 0x81, 0x9c, 0xbc, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x91, 0x68, 0x0c, 0x08, 0x00, 0x00, + 0xff, 0xff, 0x2d, 0xa0, 0x4b, 0x4d, 0x87, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // UpdateParams defines a governance operation for updating the x/market + // module parameters. The authority is defined in the keeper. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/sgenetwork.sge.orderbook.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // UpdateParams defines a governance operation for updating the x/market + // module parameters. The authority is defined in the keeper. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sgenetwork.sge.orderbook.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "sgenetwork.sge.orderbook.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "sgenetwork/sge/orderbook/tx.proto", +} + +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ovm/handler.go b/x/ovm/handler.go index e16934ce..921629db 100644 --- a/x/ovm/handler.go +++ b/x/ovm/handler.go @@ -25,6 +25,10 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgVotePubkeysChangeRequest: res, err := msgServer.VotePubkeysChange(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateParams: + res, err := msgServer.UpdateParams(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) return nil, sdkerrors.Wrap(sdkerrtypes.ErrUnknownRequest, errMsg) diff --git a/x/ovm/keeper/keeper.go b/x/ovm/keeper/keeper.go index b53a044a..65d82622 100644 --- a/x/ovm/keeper/keeper.go +++ b/x/ovm/keeper/keeper.go @@ -19,6 +19,9 @@ type Keeper struct { storeKey storetypes.StoreKey memKey storetypes.StoreKey paramStore paramtypes.Subspace + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } // NewKeeper creates new keeper object @@ -27,6 +30,7 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, + authority string, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -38,6 +42,7 @@ func NewKeeper( storeKey: storeKey, memKey: memKey, paramStore: ps, + authority: authority, } } @@ -45,3 +50,8 @@ func NewKeeper( func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// GetAuthority returns the x/ovm module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/ovm/keeper/msg_server_params.go b/x/ovm/keeper/msg_server_params.go new file mode 100644 index 00000000..e417e821 --- /dev/null +++ b/x/ovm/keeper/msg_server_params.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/sge-network/sge/x/ovm/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.GetAuthority() != req.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + k.SetParams(ctx, req.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/ovm/simulation/proposals.go b/x/ovm/simulation/proposals.go new file mode 100644 index 00000000..3a3ce0c2 --- /dev/null +++ b/x/ovm/simulation/proposals.go @@ -0,0 +1,43 @@ +package simulation + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/sge-network/sge/x/ovm/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" //#nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateMsgUpdateParams, + ), + } +} + +// SimulateMsgUpdateParams returns a random MsgUpdateParams +func SimulateMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") + + params := types.DefaultParams() + + return &types.MsgUpdateParams{ + Authority: authority.String(), + Params: params, + } +} diff --git a/x/ovm/simulation/proposals_test.go b/x/ovm/simulation/proposals_test.go new file mode 100644 index 00000000..8183cf30 --- /dev/null +++ b/x/ovm/simulation/proposals_test.go @@ -0,0 +1,43 @@ +package simulation_test + +import ( + "fmt" + "math/rand" + "testing" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/sge-network/sge/x/ovm/simulation" + "github.com/sge-network/sge/x/ovm/types" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + //#nosec + r := rand.New(s) + + ctx := sdk.NewContext(nil, tmproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, len(weightedProposalMsgs), 1) + + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + fmt.Println(msgUpdateParams) + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) +} diff --git a/x/ovm/types/codec.go b/x/ovm/types/codec.go index a954cca2..0437708d 100644 --- a/x/ovm/types/codec.go +++ b/x/ovm/types/codec.go @@ -13,6 +13,7 @@ import ( func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgSubmitPubkeysChangeProposalRequest{}, "ovm/SubmitPubkeysChangeProposal") legacy.RegisterAminoMsg(cdc, &MsgVotePubkeysChangeRequest{}, "ovm/VotePubkeysChange") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "ovm/MsgUpdateParams") } // RegisterInterfaces registers the module interface types @@ -20,6 +21,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSubmitPubkeysChangeProposalRequest{}, &MsgVotePubkeysChangeRequest{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/ovm/types/messages_params.go b/x/ovm/types/messages_params.go new file mode 100644 index 00000000..b847a267 --- /dev/null +++ b/x/ovm/types/messages_params.go @@ -0,0 +1,43 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // typeMsgUpdateParams is type of message MsgUpdateParams + typeMsgUpdateParams = "ovm_update_params" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// Route returns the module's message router key. +func (*MsgUpdateParams) Route() string { return RouterKey } + +// Type returns type of its message +func (*MsgUpdateParams) Type() string { return typeMsgUpdateParams } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + if err := msg.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/ovm/types/proposal.pb.go b/x/ovm/types/proposal.pb.go index 51b7bf6b..3fb6dd8e 100644 --- a/x/ovm/types/proposal.pb.go +++ b/x/ovm/types/proposal.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -219,41 +220,43 @@ func init() { func init() { proto.RegisterFile("sgenetwork/sge/ovm/proposal.proto", fileDescriptor_68d5b3dc34bd8d1b) } var fileDescriptor_68d5b3dc34bd8d1b = []byte{ - // 533 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x4d, 0x8f, 0xd2, 0x40, - 0x18, 0xc7, 0x19, 0xd8, 0xe5, 0x65, 0x88, 0x84, 0x4c, 0x8c, 0x3b, 0xb2, 0xda, 0xd6, 0x3d, 0x98, - 0x66, 0x13, 0x8b, 0x61, 0x0f, 0x26, 0x9e, 0xe4, 0xa5, 0xc4, 0xea, 0xba, 0x34, 0xd3, 0x42, 0x8c, - 0x31, 0x21, 0x05, 0x66, 0x4b, 0xc3, 0xcb, 0x90, 0xce, 0x80, 0xf2, 0x15, 0x3c, 0xf9, 0xb1, 0xf6, - 0xb8, 0x47, 0xbd, 0x10, 0x03, 0x37, 0x3f, 0x85, 0xe9, 0x8b, 0x8b, 0xb0, 0x24, 0xde, 0x9e, 0x3e, - 0xff, 0xdf, 0xf3, 0xf4, 0xd7, 0x26, 0x0f, 0x7c, 0xc6, 0x5d, 0x3a, 0xa5, 0xe2, 0x0b, 0xf3, 0x47, - 0x65, 0xee, 0xd2, 0x32, 0x5b, 0x4c, 0xca, 0x33, 0x9f, 0xcd, 0x18, 0x77, 0xc6, 0xda, 0xcc, 0x67, - 0x82, 0x21, 0xb4, 0x45, 0x34, 0xee, 0x52, 0x8d, 0x2d, 0x26, 0xa5, 0x87, 0x2e, 0x73, 0x59, 0x18, - 0x97, 0x83, 0x2a, 0x22, 0x4b, 0xf2, 0x81, 0x65, 0xc2, 0xeb, 0x8f, 0xa8, 0x88, 0x81, 0xa7, 0x07, - 0x80, 0x05, 0x13, 0x34, 0x8a, 0xcf, 0x7e, 0xa6, 0x20, 0x36, 0xe7, 0xbd, 0xb1, 0xd7, 0x7f, 0x4f, - 0x97, 0xbc, 0x3e, 0x74, 0xa6, 0x2e, 0x35, 0x63, 0x19, 0x54, 0x80, 0x49, 0x6f, 0x80, 0x81, 0x02, - 0xd4, 0x23, 0x92, 0xf4, 0x06, 0x08, 0xc3, 0x4c, 0xdf, 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, - 0xdf, 0x00, 0x2c, 0xec, 0x0a, 0x23, 0x19, 0x9e, 0x9a, 0xa4, 0x65, 0xb6, 0xac, 0xea, 0x65, 0x97, - 0xe8, 0x56, 0xfb, 0xd2, 0xee, 0xb6, 0xaf, 0x2c, 0x53, 0xaf, 0x1b, 0x4d, 0x43, 0x6f, 0x14, 0x13, - 0xe8, 0x09, 0xc4, 0xfb, 0x40, 0xd5, 0x34, 0x49, 0xab, 0xa3, 0x37, 0x8a, 0xe0, 0x50, 0x4a, 0xf4, - 0x77, 0x7a, 0xdd, 0xd6, 0x1b, 0xc5, 0x24, 0x3a, 0x85, 0x27, 0xfb, 0xa9, 0xfe, 0xd1, 0x34, 0x88, - 0xde, 0x28, 0xa6, 0xce, 0x47, 0x5b, 0x97, 0x48, 0x73, 0xc7, 0xc5, 0xb2, 0xab, 0x76, 0xdb, 0xda, - 0x73, 0x29, 0xc1, 0x47, 0xfb, 0x40, 0xb5, 0x6e, 0x1b, 0x1d, 0x7d, 0xcf, 0x24, 0xce, 0x9a, 0xc6, - 0x95, 0x61, 0xbd, 0x0d, 0x4c, 0x6a, 0x6f, 0x6e, 0xd6, 0x12, 0xb8, 0x5d, 0x4b, 0xe0, 0xd7, 0x5a, - 0x02, 0xdf, 0x37, 0x52, 0xe2, 0x76, 0x23, 0x25, 0x7e, 0x6c, 0xa4, 0xc4, 0xa7, 0xe7, 0xae, 0x27, - 0x86, 0xf3, 0x9e, 0xd6, 0x67, 0x93, 0xe0, 0x1c, 0x5e, 0xfc, 0x7b, 0x1a, 0x5f, 0xa3, 0xeb, 0x59, - 0xce, 0x28, 0xef, 0xa5, 0xc3, 0xf3, 0xb8, 0xf8, 0x13, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x9a, 0x7b, - 0x01, 0xad, 0x03, 0x00, 0x00, + // 567 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcb, 0x6e, 0xda, 0x4c, + 0x14, 0xc7, 0x31, 0xe4, 0x3a, 0xe8, 0x43, 0x68, 0x14, 0x7d, 0x99, 0x90, 0xd6, 0x76, 0xb3, 0xa8, + 0xac, 0x48, 0x31, 0x15, 0x59, 0x54, 0xea, 0xaa, 0x5c, 0x8c, 0xea, 0x36, 0x0d, 0xd6, 0xd8, 0xa0, + 0xaa, 0xaa, 0x84, 0x8c, 0x3d, 0x31, 0x16, 0x98, 0x41, 0x9e, 0x81, 0x96, 0x57, 0xe8, 0xaa, 0x0f, + 0xd3, 0x87, 0xc8, 0x32, 0xea, 0xaa, 0x2b, 0x54, 0xc1, 0xae, 0xdb, 0xbe, 0x40, 0xe5, 0x4b, 0x43, + 0x21, 0x48, 0xdd, 0x1d, 0x9f, 0xff, 0x6f, 0xc6, 0xbf, 0x33, 0xd2, 0x01, 0x4f, 0x98, 0x47, 0x46, + 0x84, 0x7f, 0xa4, 0xe1, 0xa0, 0xcc, 0x3c, 0x52, 0xa6, 0xd3, 0xa0, 0x3c, 0x0e, 0xe9, 0x98, 0x32, + 0x7b, 0xa8, 0x8e, 0x43, 0xca, 0x29, 0x84, 0x2b, 0x44, 0x65, 0x1e, 0x51, 0xe9, 0x34, 0x28, 0x1d, + 0x79, 0xd4, 0xa3, 0x71, 0x5c, 0x8e, 0xaa, 0x84, 0x2c, 0x9d, 0x38, 0x94, 0x05, 0x94, 0x75, 0x93, + 0x20, 0xf9, 0x48, 0x23, 0x69, 0xcb, 0x7f, 0xb8, 0xef, 0x0c, 0x08, 0x4f, 0x81, 0xc7, 0x5b, 0x80, + 0x29, 0xe5, 0x24, 0x89, 0xcf, 0x7e, 0xe5, 0x00, 0x32, 0x26, 0xbd, 0xa1, 0xef, 0xbc, 0x21, 0x33, + 0x56, 0xef, 0xdb, 0x23, 0x8f, 0x18, 0xa9, 0x27, 0x2c, 0x80, 0xac, 0xef, 0x22, 0x41, 0x16, 0x94, + 0x1d, 0x9c, 0xf5, 0x5d, 0x58, 0x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 0x16, 0xe2, 0x03, 0x00, 0x00, } func (m *PublicKeysChangeProposal) Marshal() (dAtA []byte, err error) { diff --git a/x/ovm/types/tx.pb.go b/x/ovm/types/tx.pb.go index 87c2aa0f..61a45814 100644 --- a/x/ovm/types/tx.pb.go +++ b/x/ovm/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -243,38 +247,148 @@ func (m *MsgVotePubkeysChangeResponse) GetSuccess() bool { return false } +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/bet parameters. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_f051013778245841, []int{4} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f051013778245841, []int{5} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSubmitPubkeysChangeProposalRequest)(nil), "sgenetwork.sge.ovm.MsgSubmitPubkeysChangeProposalRequest") proto.RegisterType((*MsgSubmitPubkeysChangeProposalResponse)(nil), "sgenetwork.sge.ovm.MsgSubmitPubkeysChangeProposalResponse") proto.RegisterType((*MsgVotePubkeysChangeRequest)(nil), "sgenetwork.sge.ovm.MsgVotePubkeysChangeRequest") proto.RegisterType((*MsgVotePubkeysChangeResponse)(nil), "sgenetwork.sge.ovm.MsgVotePubkeysChangeResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "sgenetwork.sge.ovm.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "sgenetwork.sge.ovm.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("sgenetwork/sge/ovm/tx.proto", fileDescriptor_f051013778245841) } var fileDescriptor_f051013778245841 = []byte{ - // 334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xc1, 0x4a, 0xc3, 0x40, - 0x10, 0x86, 0xbb, 0x2d, 0x54, 0x5d, 0x28, 0xe2, 0x1e, 0x24, 0xb4, 0x12, 0x4a, 0xc0, 0xd2, 0x8b, - 0x89, 0xe8, 0x45, 0x3d, 0x49, 0x3d, 0x89, 0x14, 0x4a, 0x04, 0x41, 0x2f, 0xa5, 0x89, 0xc3, 0x36, - 0xc4, 0x64, 0xe3, 0xce, 0x26, 0x6d, 0xde, 0xc2, 0x43, 0x1f, 0xca, 0x63, 0x8f, 0x1e, 0xa5, 0x7d, - 0x11, 0x49, 0xda, 0xa2, 0x52, 0x6b, 0x4b, 0x8f, 0xff, 0x0e, 0xf3, 0xcd, 0x3f, 0x3b, 0x3f, 0xad, - 0x21, 0x87, 0x10, 0xd4, 0x40, 0x48, 0xdf, 0x42, 0x0e, 0x96, 0x48, 0x02, 0x4b, 0x0d, 0xcd, 0x48, - 0x0a, 0x25, 0x18, 0xfb, 0x2e, 0x9a, 0xc8, 0xc1, 0x14, 0x49, 0x60, 0x3c, 0xd2, 0xe3, 0x36, 0xf2, - 0xfb, 0xd8, 0x09, 0x3c, 0xd5, 0x89, 0x1d, 0x1f, 0x52, 0xbc, 0xe9, 0xf7, 0x42, 0x0e, 0x1d, 0x29, - 0x22, 0x81, 0x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c1, 0x69, 0x04, 0xe8, 0x94, 0xf3, 0x14, 0x9f, - 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x13, 0x33, 0xc7, 0x36, 0xe4, 0x02, 0x00, 0x00, + // 549 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcf, 0x6b, 0x13, 0x51, + 0x10, 0xce, 0x33, 0x90, 0x9a, 0x67, 0x4b, 0xc9, 0xa3, 0xb5, 0x71, 0x23, 0xdb, 0x90, 0x62, 0x28, + 0x95, 0xec, 0x36, 0x11, 0xfc, 0x11, 0x10, 0x34, 0x9e, 0x44, 0x02, 0x61, 0x8b, 0x1e, 0xbc, 0x84, + 0xcd, 0x66, 0x78, 0x59, 0xe2, 0xee, 0x5b, 0x77, 0xde, 0xa6, 0xc9, 0x51, 0xef, 0x82, 0x07, 0xef, + 0x5e, 0xbd, 0x08, 0x3d, 0xf4, 0x8f, 0x28, 0x9e, 0x4a, 0x4f, 0x9e, 0x44, 0x92, 0x43, 0xff, 0x0d, + 0xc9, 0xee, 0x86, 0xf4, 0x47, 0x62, 0x82, 0xe0, 0x25, 0xd9, 0x79, 0x33, 0xdf, 0xcc, 0xf7, 0xf1, + 0x0d, 0x43, 0x73, 0xc8, 0xc1, 0x05, 0x79, 0x28, 0xfc, 0xae, 0x8e, 0x1c, 0x74, 0xd1, 0x73, 0x74, + 0xd9, 0xd7, 0x3c, 0x5f, 0x48, 0xc1, 0xd8, 0x34, 0xa9, 0x21, 0x07, 0x4d, 0xf4, 0x1c, 0x65, 0x83, + 0x0b, 0x2e, 0xc2, 0xb4, 0x3e, 0xfe, 0x8a, 0x2a, 0x95, 0x3b, 0x96, 0x40, 0x47, 0x60, 0x33, 0x4a, + 0x44, 0x41, 0x9c, 0xda, 0x8a, 0x22, 0xdd, 0x41, 0xae, 0xf7, 0xca, 0xe3, 0xbf, 0x38, 0x91, 0x31, + 0x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2, 0xe3, 0xd2, 0x8f, 0x8e, 0xdd, 0xc0, + 0x03, 0x6c, 0xa5, 0xc2, 0xf3, 0xf2, 0xe0, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x08, 0xc5, 0x58, + 0x2d, 0x0f, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -295,6 +409,9 @@ type MsgClient interface { // VotePubkeysChange defines a method to vote for a proposal for changing the // allowed public keys. VotePubkeysChange(ctx context.Context, in *MsgVotePubkeysChangeRequest, opts ...grpc.CallOption) (*MsgVotePubkeysChangeResponse, error) + // UpdateParams defines a governance operation for updating the x/ovm module + // parameters. The authority is defined in the keeper. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -323,6 +440,15 @@ func (c *msgClient) VotePubkeysChange(ctx context.Context, in *MsgVotePubkeysCha return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/sgenetwork.sge.ovm.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // PubkeysChangeProposal defines a method to submit a proposal for changing @@ -331,6 +457,9 @@ type MsgServer interface { // VotePubkeysChange defines a method to vote for a proposal for changing the // allowed public keys. VotePubkeysChange(context.Context, *MsgVotePubkeysChangeRequest) (*MsgVotePubkeysChangeResponse, error) + // UpdateParams defines a governance operation for updating the x/ovm module + // parameters. The authority is defined in the keeper. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -343,6 +472,9 @@ func (*UnimplementedMsgServer) SubmitPubkeysChangeProposal(ctx context.Context, func (*UnimplementedMsgServer) VotePubkeysChange(ctx context.Context, req *MsgVotePubkeysChangeRequest) (*MsgVotePubkeysChangeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method VotePubkeysChange not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -384,6 +516,24 @@ func _Msg_VotePubkeysChange_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sgenetwork.sge.ovm.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "sgenetwork.sge.ovm.Msg", HandlerType: (*MsgServer)(nil), @@ -396,6 +546,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "VotePubkeysChange", Handler: _Msg_VotePubkeysChange_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "sgenetwork/sge/ovm/tx.proto", @@ -546,6 +700,69 @@ func (m *MsgVotePubkeysChangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -618,6 +835,30 @@ func (m *MsgVotePubkeysChangeResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1011,6 +1252,171 @@ func (m *MsgVotePubkeysChangeResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/reward/handler.go b/x/reward/handler.go index 6a490482..e982ac82 100644 --- a/x/reward/handler.go +++ b/x/reward/handler.go @@ -31,6 +31,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgGrantReward: res, err := msgServer.GrantReward(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateParams: + res, err := msgServer.UpdateParams(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) diff --git a/x/reward/keeper/keeper.go b/x/reward/keeper/keeper.go index e67bf48a..56626e4b 100644 --- a/x/reward/keeper/keeper.go +++ b/x/reward/keeper/keeper.go @@ -26,6 +26,9 @@ type ( betKeeper types.BetKeeper ovmKeeper types.OVMKeeper subaccountKeeper types.SubaccountKeeper + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } ) @@ -45,6 +48,7 @@ func NewKeeper( ovmKeeper types.OVMKeeper, subaccountKeeper types.SubaccountKeeper, expectedKeepers SdkExpectedKeepers, + authority string, ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -66,9 +70,15 @@ func NewKeeper( ovmKeeper: ovmKeeper, subaccountKeeper: subaccountKeeper, authzKeeper: expectedKeepers.AuthzKeeper, + authority: authority, } } func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// GetAuthority returns the x/reward module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/reward/keeper/msg_server_params.go b/x/reward/keeper/msg_server_params.go new file mode 100644 index 00000000..7b907e00 --- /dev/null +++ b/x/reward/keeper/msg_server_params.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/sge-network/sge/x/reward/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.GetAuthority() != req.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + k.SetParams(ctx, req.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/reward/simulation/proposals.go b/x/reward/simulation/proposals.go new file mode 100644 index 00000000..10d500d7 --- /dev/null +++ b/x/reward/simulation/proposals.go @@ -0,0 +1,43 @@ +package simulation + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/sge-network/sge/x/reward/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" //#nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateMsgUpdateParams, + ), + } +} + +// SimulateMsgUpdateParams returns a random MsgUpdateParams +func SimulateMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") + + params := types.DefaultParams() + + return &types.MsgUpdateParams{ + Authority: authority.String(), + Params: params, + } +} diff --git a/x/reward/simulation/proposals_test.go b/x/reward/simulation/proposals_test.go new file mode 100644 index 00000000..a2e01a33 --- /dev/null +++ b/x/reward/simulation/proposals_test.go @@ -0,0 +1,43 @@ +package simulation_test + +import ( + "fmt" + "math/rand" + "testing" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/sge-network/sge/x/reward/simulation" + "github.com/sge-network/sge/x/reward/types" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + //#nosec + r := rand.New(s) + + ctx := sdk.NewContext(nil, tmproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, len(weightedProposalMsgs), 1) + + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + fmt.Println(msgUpdateParams) + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) +} diff --git a/x/reward/types/campaign.pb.go b/x/reward/types/campaign.pb.go index f116ca1a..4f0b2639 100644 --- a/x/reward/types/campaign.pb.go +++ b/x/reward/types/campaign.pb.go @@ -6,6 +6,7 @@ package types import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -278,46 +279,48 @@ func init() { } var fileDescriptor_e2342810052fed89 = []byte{ - // 622 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0x1b, 0xd6, 0x6e, 0xa9, 0xbb, 0x75, 0xc8, 0x63, 0xc2, 0xda, 0xa4, 0xa6, 0x04, 0x10, - 0x05, 0xb4, 0x54, 0xda, 0x04, 0x07, 0x6e, 0x4b, 0x40, 0x62, 0x02, 0x21, 0xe4, 0x6d, 0x17, 0x84, - 0x54, 0x79, 0x89, 0x95, 0x45, 0x6b, 0xe2, 0xc8, 0xf6, 0xe8, 0xfa, 0x2d, 0xf8, 0x58, 0x3b, 0x70, - 0xd8, 0x11, 0x21, 0x11, 0xa1, 0xec, 0xb6, 0x23, 0x9f, 0x00, 0xd9, 0x4e, 0xbb, 0x0d, 0x6d, 0x63, - 0x5c, 0x6a, 0xbf, 0x97, 0xff, 0xff, 0xe7, 0x17, 0xf7, 0xe5, 0x81, 0x47, 0x22, 0xa6, 0x19, 0x95, - 0x23, 0xc6, 0x0f, 0xfa, 0x22, 0xa6, 0x7d, 0x4e, 0x47, 0x84, 0x47, 0xfd, 0x90, 0xa4, 0x39, 0x49, - 0xe2, 0xcc, 0xcb, 0x39, 0x93, 0x0c, 0x2e, 0x9f, 0xab, 0x3c, 0x11, 0x53, 0xcf, 0xa8, 0x56, 0xee, - 0xc5, 0x2c, 0x66, 0x5a, 0xd1, 0x57, 0x3b, 0x23, 0x5e, 0x71, 0xaf, 0x46, 0x9a, 0xc5, 0x68, 0xdc, - 0x6f, 0x0d, 0x60, 0x07, 0xd5, 0x19, 0x10, 0x81, 0xb9, 0x90, 0x53, 0x22, 0x19, 0x47, 0x56, 0xd7, - 0xea, 0x35, 0xf1, 0x24, 0x84, 0x5d, 0x30, 0x73, 0x98, 0x44, 0xe8, 0x8e, 0xca, 0xfa, 0xed, 0xb2, - 0x70, 0x66, 0x76, 0xb7, 0x5e, 0x9f, 0x15, 0x8e, 0xca, 0x62, 0xf5, 0x03, 0x57, 0x80, 0x9d, 0x73, - 0x96, 0x32, 0x49, 0x39, 0x9a, 0xd1, 0xe6, 0x69, 0x0c, 0x37, 0x80, 0x2d, 0x24, 0xe1, 0x72, 0x20, - 0x05, 0xaa, 0x77, 0xad, 0x5e, 0xdd, 0xbf, 0x5f, 0x16, 0xce, 0xdc, 0xb6, 0xca, 0xed, 0x6c, 0x9f, - 0x15, 0xce, 0xf4, 0x31, 0x9e, 0xee, 0xe0, 0x73, 0x30, 0x4b, 0xb3, 0x48, 0x59, 0x1a, 0xda, 0xb2, - 0x54, 0x16, 0x4e, 0xe3, 0x4d, 0x16, 0x69, 0x43, 0xf5, 0x08, 0x57, 0x2b, 0xfc, 0x00, 0x16, 0xcd, - 0x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ytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4d, 0x4f, 0x13, 0x41, + 0x18, 0xc7, 0xbb, 0x52, 0xca, 0x76, 0x0a, 0xc5, 0x0c, 0x10, 0x47, 0x48, 0xba, 0x75, 0xd5, 0x58, + 0x35, 0x6c, 0x13, 0x50, 0x0f, 0xde, 0x68, 0x35, 0x91, 0x68, 0x8c, 0x19, 0xe0, 0x62, 0x4c, 0x9a, + 0x61, 0x77, 0xb2, 0x6c, 0xe8, 0xee, 0x6c, 0x66, 0x06, 0x4b, 0x6f, 0x7e, 0x04, 0x3f, 0x8c, 0x1f, + 0x82, 0x23, 0xf1, 0x64, 0x4c, 0xdc, 0x98, 0xe5, 0xc6, 0xd1, 0x4f, 0x60, 0x66, 0x66, 0x5b, 0xc0, + 0x94, 0x17, 0x2f, 0x9d, 0x97, 0xe7, 0xff, 0xff, 0x3d, 0x4f, 0x77, 0x9f, 0x7d, 0xc0, 0x03, 0x11, + 0xd2, 0x84, 0xca, 0x01, 0xe3, 0xfb, 0x6d, 0x11, 0xd2, 0x36, 0xa7, 0x03, 0xc2, 0x83, 0xb6, 0x4f, + 0xe2, 0x94, 0x44, 0x61, 0xe2, 0xa5, 0x9c, 0x49, 0x06, 0x97, 0xce, 0x54, 0x9e, 0x08, 0xa9, 0x67, + 0x54, 0xcb, 0x8b, 0x21, 0x0b, 0x99, 0x56, 0xb4, 0xd5, 0xce, 0x88, 0x97, 0xef, 0xfa, 0x4c, 0xc4, + 0x4c, 0xf4, 0x4c, 0xc0, 0x1c, 0x8a, 0x90, 0x3b, 0x39, 0x9b, 0x59, 0x8c, 0xc6, 0xfd, 0x52, 0x01, + 0x76, 0xb7, 0x48, 0x0f, 0xd7, 0xc0, 0x8c, 0xcf, 0x29, 0x91, 0x8c, 0x23, 0xab, 0x69, 0xb5, 0xaa, + 0x1d, 0xf4, 0xfd, 0xdb, 0xea,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x16, 0x55, 0x9b, 0x56, + 0xab, 0xb6, 0x76, 0xff, 0x06, 0x44, 0x3c, 0x7b, 0x9e, 0x06, 0x9f, 0x83, 0x72, 0xca, 0x58, 0x1f, + 0x01, 0x0d, 0x58, 0xb9, 0x04, 0xf0, 0x81, 0xb1, 0x7e, 0xa7, 0x7c, 0x94, 0x39, 0x25, 0xac, 0xe5, + 0x70, 0x05, 0x54, 0x23, 0xd1, 0x23, 0xbe, 0x8c, 0x3e, 0x53, 0x54, 0x6b, 0x5a, 0x2d, 0x1b, 0xdb, + 0x91, 0xd8, 0xd0, 0x67, 0x08, 0x41, 0x39, 0xa6, 0x92, 0xa0, 0x39, 0xd5, 0x1c, 0x58, 0xef, 0x95, + 0xc1, 0x27, 0x69, 0xcf, 0xd7, 0xd5, 0xd6, 0xd5, 0xcb, 0xc4, 0xb6, 0x4f, 0xd2, 0xae, 0x2e, 0xe2, + 0x1d, 0xa8, 0xf9, 0x2c, 0x11, 0x92, 0x93, 0x28, 0x91, 0x02, 0xcd, 0xeb, 0x5a, 0x9e, 0x5c, 0x52, + 0xcb, 0xa8, 0xbb, 0xbb, 0x67, 0x0e, 0x7c, 0xde, 0xee, 0xfe, 0xb2, 0x40, 0x59, 0x15, 0x0c, 0xbb, + 0x60, 0x5a, 0x32, 0x49, 0xfa, 0x45, 0xf3, 0xaf, 0xaa, 0xfa, 0x7f, 0x66, 0xce, 0x92, 0xe9, 0x54, + 0x11, 0xec, 0x7b, 0x11, 0x6b, 0xc7, 0x44, 0xee, 0x79, 0x9b, 0x89, 0xfc, 0x93, 0x39, 0xb3, 0x43, + 0x12, 0xf7, 0x5f, 0xba, 0xda, 0xe3, 0x62, 0xe3, 0x55, 0x10, 0x91, 0xd2, 0x44, 0x16, 0x5f, 0xc4, + 0x4d, 0x21, 0xda, 0xe3, 0x62, 0xe3, 0x85, 0x6f, 0x41, 0x75, 0x10, 0xc9, 0xbd, 0x80, 0x93, 0x41, + 0x52, 0x7c, 0x33, 0xff, 0x09, 0x3a, 0xf3, 0xbb, 0x02, 0x2c, 0x4c, 0x78, 0x06, 0xf0, 0x13, 0xa8, + 0xc7, 0xe4, 0xb0, 0xb7, 0x4b, 0xe5, 0xa8, 0x29, 0xcc, 0xdf, 0x7e, 0x71, 0x5d, 0xa2, 0x25, 0x93, + 0xe8, 0xa2, 0xd9, 0xc5, 0xb3, 0x31, 0x39, 0xec, 0x50, 0x69, 0xfa, 0xa4, 0xd3, 0x3d, 0xca, 0x1b, + 0xd6, 0x71, 0xde, 0xb0, 0x7e, 0xe7, 0x0d, 0xeb, 0xeb, 0x49, 0xa3, 0x74, 0x7c, 0xd2, 0x28, 0xfd, + 0x38, 0x69, 0x94, 0x3e, 0x3e, 0x0e, 0x23, 0xb9, 0x77, 0xb0, 0xeb, 0xf9, 0x2c, 0x56, 0x53, 0x69, + 0xf5, 0xfc, 0x84, 0x3a, 0x1c, 0xcd, 0x28, 0xd5, 0xf6, 0x62, 0xb7, 0xa2, 0x67, 0xd4, 0xfa, 0xdf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x9a, 0x8a, 0xce, 0x37, 0x05, 0x00, 0x00, } func (m *Campaign) Marshal() (dAtA []byte, err error) { diff --git a/x/reward/types/codec.go b/x/reward/types/codec.go index 24a22c50..f175932b 100644 --- a/x/reward/types/codec.go +++ b/x/reward/types/codec.go @@ -15,6 +15,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgUpdateCampaign{}, "reward/UpdateCampaign") legacy.RegisterAminoMsg(cdc, &MsgWithdrawFunds{}, "reward/WithdrawFunds") legacy.RegisterAminoMsg(cdc, &MsgGrantReward{}, "reward/GrantReward") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "reward/MsgUpdateParams") } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -23,6 +24,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgUpdateCampaign{}, &MsgWithdrawFunds{}, &MsgGrantReward{}, + &MsgUpdateParams{}, ) registry.RegisterImplementations( diff --git a/x/reward/types/messages_params.go b/x/reward/types/messages_params.go new file mode 100644 index 00000000..6af6f1b5 --- /dev/null +++ b/x/reward/types/messages_params.go @@ -0,0 +1,43 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // typeMsgUpdateParams is type of message MsgUpdateParams + typeMsgUpdateParams = "reward_update_params" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// Route returns the module's message router key. +func (*MsgUpdateParams) Route() string { return RouterKey } + +// Type returns type of its message +func (*MsgUpdateParams) Type() string { return typeMsgUpdateParams } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + if err := msg.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/reward/types/promoter.pb.go b/x/reward/types/promoter.pb.go index 755a6904..0d518d73 100644 --- a/x/reward/types/promoter.pb.go +++ b/x/reward/types/promoter.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -263,33 +264,35 @@ func init() { } var fileDescriptor_fdd141f5acd4b4a9 = []byte{ - // 406 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x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0x36, 0xf9, 0x76, 0x6a, 0x99, 0x5b, 0x65, 0x9a, 0x62, - 0x2b, 0x58, 0x3e, 0x7b, 0xd3, 0x98, 0xe6, 0xfb, 0x73, 0x00, 0x00, 0x00, 0xff, 0xff, 0x33, 0xb9, - 0x3f, 0xa6, 0xad, 0x02, 0x00, 0x00, + // 435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x31, 0x8f, 0xd3, 0x30, + 0x14, 0xc7, 0x6b, 0x52, 0xe0, 0xea, 0x54, 0x27, 0x61, 0x1d, 0x52, 0x38, 0xa1, 0x24, 0x0a, 0x20, + 0x95, 0xe1, 0x52, 0xa9, 0xcc, 0x0c, 0x6d, 0x58, 0x10, 0xcb, 0xc9, 0x88, 0x05, 0x86, 0xc8, 0xe7, + 0xf8, 0x4c, 0x85, 0x1a, 0x5b, 0xb6, 0x4f, 0x47, 0xbf, 0x03, 0x03, 0x1f, 0x86, 0x95, 0xfd, 0xc6, + 0x13, 0x13, 0x53, 0x84, 0xd2, 0x8d, 0x4f, 0x81, 0x12, 0xdb, 0xb4, 0x27, 0x5d, 0x6f, 0x89, 0xe3, + 0xf7, 0x7e, 0xef, 0xd9, 0xfe, 0xbf, 0x3f, 0x7c, 0xae, 0x39, 0xab, 0x99, 0xb9, 0x14, 0xea, 0xcb, + 0x54, 0x73, 0x36, 0x55, 0xec, 0x92, 0xa8, 0x6a, 0x2a, 0x95, 0x58, 0x09, 0xc3, 0x54, 0x2e, 0x95, + 0x30, 0x02, 0x3d, 0xde, 0x52, 0xb9, 0xe6, 0x2c, 0xb7, 0xd4, 0xf1, 0x11, 0x17, 0x5c, 0xf4, 0xc4, + 0xb4, 0xfb, 0xb3, 0xf0, 0xf1, 0x13, 0x2a, 0xf4, 0x4a, 0xe8, 0xd2, 0x26, 0xec, 0xc6, 0xa5, 0xb2, + 0xdb, 0x4f, 0xb3, 0x8b, 0x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xd2, 0xec, 0x1b, 0x80, 0x8f, 0xfc, + 0x7b, 0x16, 0x6b, 0x27, 0x39, 0x2a, 0xe0, 0xd8, 0x5b, 0xa4, 0xec, 0xc4, 0xb6, 0xc3, 0x49, 0xda, + 0x26, 0x09, 0x3d, 0x6c, 0x45, 0xbf, 0x81, 0xe1, 0x1b, 0xbb, 0x6e, 0xb8, 0x4e, 0x75, 0x37, 0xac, + 0x3b, 0x86, 0xeb, 0xc0, 0x45, 0x71, 0xd5, 0xc6, 0xe0, 0xba, 0x8d, 0xc1, 0x9f, 0x36, 0x06, 0xdf, + 0x37, 0xf1, 0xe0, 0x7a, 0x13, 0x0f, 0x7e, 0x6f, 0xe2, 0xc1, 0xc7, 0x97, 0x7c, 0x69, 0x3e, 0x5f, + 0x9c, 0xe5, 0x54, 0xac, 0x3a, 0x6f, 0x9d, 0xec, 0xfa, 0xec, 0xab, 0x77, 0x9a, 0x59, 0x4b, 0xa6, + 0xcf, 0x1e, 0xf4, 0x4e, 0x7b, 0xf5, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xe0, 0xd7, 0x89, 0x57, 0xfd, + 0x02, 0x00, 0x00, } func (m *Promoter) Marshal() (dAtA []byte, err error) { diff --git a/x/reward/types/query.pb.go b/x/reward/types/query.pb.go index 47b765cf..c49e6fdc 100644 --- a/x/reward/types/query.pb.go +++ b/x/reward/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -1060,70 +1061,72 @@ func init() { func init() { proto.RegisterFile("sgenetwork/sge/reward/query.proto", fileDescriptor_102f3c906d210d41) } var fileDescriptor_102f3c906d210d41 = []byte{ - // 1003 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x98, 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 0xd7, 0xf3, - 0x06, 0xbc, 0x96, 0xb7, 0x9e, 0xf1, 0xf1, 0x30, 0x79, 0xdf, 0x8e, 0x8e, 0x9a, 0x8f, 0x8f, 0x35, - 0xf4, 0xe4, 0x58, 0x43, 0x7f, 0x1d, 0x6b, 0xe8, 0xdb, 0x13, 0x6d, 0xe5, 0xc9, 0x89, 0xb6, 0xf2, - 0xc7, 0x89, 0xb6, 0x72, 0x77, 0xd7, 0x71, 0x83, 0x8f, 0xfb, 0x6d, 0xa3, 0x43, 0xbb, 0x89, 0xe0, - 0x9f, 0xab, 0xf0, 0xc1, 0xc0, 0x23, 0xac, 0xbd, 0xce, 0xff, 0xb3, 0xb0, 0xff, 0x5f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xee, 0x71, 0x7e, 0x37, 0x89, 0x11, 0x00, 0x00, + // 1039 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x98, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0xc7, 0x33, 0x49, 0x48, 0xd2, 0xd7, 0x82, 0xda, 0x47, 0x8a, 0xca, 0x92, 0x6e, 0xba, 0xa6, + 0x6c, 0x92, 0x36, 0x6b, 0xab, 0xdb, 0x54, 0x40, 0x11, 0x94, 0x24, 0x82, 0x1e, 0x10, 0x52, 0x59, + 0xc4, 0x81, 0x4a, 0x28, 0xf2, 0xc6, 0x23, 0x63, 0xc1, 0xae, 0xb7, 0xb6, 0x97, 0xb2, 0x5a, 0xed, + 0x85, 0x0b, 0x12, 0x15, 0x12, 0x52, 0xc5, 0x95, 0x13, 0xe2, 0x0e, 0xe2, 0x18, 0x84, 0xb8, 0xf5, + 0x58, 0xc1, 0x85, 0x13, 0x42, 0x09, 0x37, 0xfe, 0x09, 0xe4, 0x99, 0x37, 0xde, 0x1f, 0x5e, 0xff, + 0x48, 0x64, 0xa4, 0x9e, 0xd6, 0xb1, 0xdf, 0x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0xdb, 0x8a, 0x05, 0xff, 0x5c, 0x85, 0x0f, 0x7a, 0x1d, 0xee, 0x37, 0x17, 0xc4, 0xff, 0x35, + 0xae, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0x55, 0xaf, 0x69, 0xd0, 0x22, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/reward/types/reward.pb.go b/x/reward/types/reward.pb.go index 913da46f..ed5c549d 100644 --- a/x/reward/types/reward.pb.go +++ b/x/reward/types/reward.pb.go @@ -6,6 +6,7 @@ package types import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -466,63 +467,65 @@ func init() { } var fileDescriptor_31e6858ad0a3d6b8 = []byte{ - // 885 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0x8f, 0x93, 0xec, 0xbf, 0xd7, 0xed, 0xe2, 0x1d, 0x36, 0xad, 0x9b, 0xdd, 0xda, 0x5b, 0x23, - 0x50, 0x59, 0xa9, 0x8e, 0x54, 0x4e, 0xd0, 0x93, 0xe3, 0x38, 0xc1, 0xd2, 0x36, 0x89, 0x26, 0x8e, - 0xa0, 0x5c, 0x22, 0xaf, 0x33, 0xb8, 0x51, 0x36, 0x71, 0x64, 0x3b, 0x94, 0x9c, 0x91, 0x10, 0x47, - 0x2e, 0x48, 0x7c, 0x01, 0x3e, 0x06, 0xf7, 0x1e, 0x7b, 0x44, 0x1c, 0x2c, 0x94, 0xe5, 0xd4, 0x63, - 0x3f, 0x01, 0xf2, 0x8c, 0x93, 0x8c, 0xdd, 0x08, 0x4a, 0x2f, 0xc9, 0xbc, 0xf7, 0x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7a, 0xcb, 0x14, 0x4b, 0x75, 0xe3, 0xe5, 0x52, 0x16, 0x5e, 0x2d, 0x65, - 0xe1, 0xaf, 0xa5, 0x2c, 0xfc, 0x7c, 0x23, 0x17, 0x5e, 0xdd, 0xc8, 0x85, 0x3f, 0x6e, 0xe4, 0xc2, - 0x37, 0x9f, 0x72, 0xcf, 0x4a, 0xe8, 0x91, 0x47, 0xfc, 0xc7, 0xff, 0xfb, 0xd5, 0xe7, 0x9f, 0xbe, - 0x2e, 0x57, 0xbb, 0xf4, 0x8b, 0xfe, 0xd9, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x14, 0x46, - 0xcc, 0x24, 0x08, 0x00, 0x00, + // 918 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x8f, 0xdb, 0x44, + 0x14, 0x5e, 0x27, 0xd9, 0x5f, 0xaf, 0xdb, 0xc5, 0x3b, 0x6c, 0xda, 0x6c, 0x76, 0x1b, 0x6f, 0x8d, + 0x40, 0x65, 0xc5, 0x3a, 0xd2, 0xc2, 0x05, 0x7a, 0x72, 0x1c, 0x27, 0x58, 0xda, 0x26, 0xd1, 0xc4, + 0x11, 0x94, 0x4b, 0xe4, 0xb5, 0x07, 0x37, 0xca, 0x26, 0x8e, 0x6c, 0x87, 0x92, 0x33, 0x12, 0xe2, + 0xc8, 0x05, 0x89, 0x7f, 0x80, 0x7f, 0x00, 0x71, 0xe5, 0xde, 0x63, 0xc5, 0x09, 0x71, 0xb0, 0x50, + 0xf6, 0xd6, 0x63, 0xff, 0x02, 0xe4, 0x19, 0x27, 0x19, 0xbb, 0x11, 0x5b, 0xb8, 0x24, 0x9e, 0xf7, + 0x7d, 0x6f, 0xde, 0x37, 0xdf, 0xcc, 0x1b, 0x0d, 0xc8, 0x81, 0x4b, 0xc6, 0x24, 0x7c, 0xee, 0xf9, + 0xc3, 0x6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x9a, 0x98, 0x43, 0x0f, 0xe1, 0xc1, 0x1a, 0xb4, 0xa3, + 0x63, 0x4d, 0x6f, 0x99, 0x6a, 0x53, 0x17, 0xf3, 0x35, 0xed, 0xc5, 0xbc, 0x22, 0xbc, 0x9c, 0x57, + 0x84, 0xbf, 0xe7, 0x15, 0xe1, 0xc7, 0x9b, 0xca, 0xc6, 0xcb, 0x9b, 0xca, 0xc6, 0x9f, 0x37, 0x95, + 0x8d, 0xaf, 0x3e, 0xe4, 0x2e, 0x9c, 0xc0, 0x25, 0xe7, 0xfc, 0x2b, 0xe3, 0xdb, 0xc5, 0x3b, 0x83, + 0xde, 0x3b, 0x57, 0x5b, 0xf4, 0x7d, 0xf0, 0xf1, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x5a, + 0x1b, 0x29, 0x8d, 0x08, 0x00, 0x00, } func (m *Reward) Marshal() (dAtA []byte, err error) { diff --git a/x/reward/types/ticket.pb.go b/x/reward/types/ticket.pb.go index f403122d..60db2d79 100644 --- a/x/reward/types/ticket.pb.go +++ b/x/reward/types/ticket.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" types "github.com/sge-network/sge/types" @@ -674,55 +675,58 @@ func init() { } var fileDescriptor_b924af6a809dd84d = []byte{ - // 764 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x41, 0x6f, 0xe2, 0x46, - 0x14, 0x66, 0x02, 0x01, 0xf3, 0x48, 0xa3, 0x6a, 0x1a, 0x2a, 0x97, 0xa8, 0x40, 0xdd, 0x56, 0xa5, - 0x95, 0x0a, 0x52, 0x7a, 0xac, 0x5a, 0x09, 0x3b, 0x6a, 0x53, 0xa5, 0x87, 0xc8, 0x49, 0x14, 0x69, - 0x2f, 0x68, 0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 0x00, 0x24, 0x2d, 0x32, 0x57, 0x93, 0xdb, 0x31, 0xde, 0x20, 0x68, - 0x28, 0x41, 0x26, 0x93, 0x26, 0xf7, 0x27, 0xe1, 0x73, 0x09, 0xe9, 0x41, 0xe5, 0x9c, 0xc9, 0x9c, - 0xed, 0xea, 0xb3, 0x69, 0xab, 0x6c, 0x32, 0x99, 0x78, 0x2e, 0x3b, 0xb4, 0xb3, 0x85, 0x71, 0x93, - 0x7d, 0x8a, 0x8f, 0x52, 0xc3, 0x67, 0x9a, 0xda, 0x50, 0x8c, 0x59, 0x94, 0xb5, 0xcd, 0xed, 0xd9, - 0xb4, 0x55, 0x4c, 0x28, 0xe2, 0x5d, 0x3b, 0xfe, 0xc1, 0x7f, 0x41, 0x89, 0x72, 0x7f, 0x98, 0xda, - 0x66, 0xdd, 0x77, 0x27, 0xe3, 0xb5, 0xb8, 0x3f, 0x4c, 0xc5, 0xaa, 0x34, 0xe3, 0x0c, 0xbe, 0x3d, - 0x66, 0x32, 0x7f, 0x9c, 0x95, 0xce, 0x88, 0xd1, 0x67, 0x11, 0x9b, 0xd6, 0xed, 0xac, 0x89, 0xee, - 0x66, 0x4d, 0xf4, 0x61, 0xd6, 0x44, 0xaf, 0xef, 0x9b, 0x85, 0xbb, 0xfb, 0x66, 0xe1, 0xfd, 0x7d, - 0xb3, 0xf0, 0xe2, 0x57, 0xd7, 0x93, 0x17, 0x93, 0xf3, 0x2e, 0xe5, 0xe3, 0xf8, 0x79, 0xfa, 0x3d, - 0xff, 0x54, 0xdd, 0xcc, 0x9f, 0xd9, 0x28, 0x60, 0xe1, 0x79, 0x59, 0x3d, 0x55, 0x7f, 0x7c, 0x0a, - 0x00, 0x00, 0xff, 0xff, 0x6a, 0xce, 0xc9, 0xff, 0x8c, 0x07, 0x00, 0x00, + // 802 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x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0x07, 0x5d, 0x2e, 0x3b, 0xe8, 0xdf, 0x65, 0x07, 0xfd, 0x72, 0xd5, 0xa9, 0x5c, + 0x5e, 0x75, 0x2a, 0x7f, 0x5f, 0x75, 0x2a, 0x3f, 0x7f, 0xe1, 0x07, 0xea, 0x78, 0x7e, 0x34, 0xa0, + 0x3c, 0x4c, 0x2f, 0xc8, 0x17, 0xe5, 0xcb, 0xf2, 0x7c, 0xf5, 0x0d, 0x90, 0xc4, 0x4c, 0x1e, 0xd5, + 0xf5, 0x65, 0xf9, 0xd5, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb0, 0x15, 0x04, 0xf3, 0x29, 0x08, + 0x00, 0x00, } func (m *CreateCampaignPayload) Marshal() (dAtA []byte, err error) { diff --git a/x/reward/types/tx.pb.go b/x/reward/types/tx.pb.go index a1d0a17f..884abd48 100644 --- a/x/reward/types/tx.pb.go +++ b/x/reward/types/tx.pb.go @@ -7,6 +7,9 @@ import ( context "context" cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -642,6 +645,100 @@ func (m *MsgWithdrawFundsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithdrawFundsResponse proto.InternalMessageInfo +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/bet parameters. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_0db1a5dd8b963fa8, []int{12} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0db1a5dd8b963fa8, []int{13} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreatePromoter)(nil), "sgenetwork.sge.reward.MsgCreatePromoter") proto.RegisterType((*MsgCreatePromoterResponse)(nil), "sgenetwork.sge.reward.MsgCreatePromoterResponse") @@ -655,47 +752,61 @@ func init() { proto.RegisterType((*MsgGrantRewardResponse)(nil), "sgenetwork.sge.reward.MsgGrantRewardResponse") proto.RegisterType((*MsgWithdrawFunds)(nil), "sgenetwork.sge.reward.MsgWithdrawFunds") proto.RegisterType((*MsgWithdrawFundsResponse)(nil), "sgenetwork.sge.reward.MsgWithdrawFundsResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "sgenetwork.sge.reward.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "sgenetwork.sge.reward.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("sgenetwork/sge/reward/tx.proto", fileDescriptor_0db1a5dd8b963fa8) } var fileDescriptor_0db1a5dd8b963fa8 = []byte{ - // 551 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0x63, 0x02, 0x41, 0x4c, 0xa0, 0x14, 0x8b, 0x56, 0xc6, 0x80, 0x03, 0x96, 0x10, 0xed, - 0xa1, 0x36, 0x50, 0x71, 0xe1, 0x98, 0x08, 0x10, 0x07, 0x4b, 0xc8, 0x50, 0x81, 0xb8, 0x54, 0x5b, - 0x7b, 0xbb, 0xb1, 0x12, 0x7b, 0xad, 0xdd, 0xb5, 0xd2, 0x3e, 0x04, 0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0xcb, 0x93, 0x54, 0x95, 0xea, 0xb3, 0xa6, 0xca, - 0x45, 0x5a, 0xd1, 0xee, 0x17, 0xd2, 0x72, 0xe5, 0xc5, 0xb4, 0x7a, 0x4f, 0xc6, 0xb4, 0xda, 0x70, - 0xad, 0xa0, 0x55, 0x95, 0xab, 0x68, 0xe7, 0x4f, 0x80, 0xec, 0xc1, 0xad, 0x6a, 0xab, 0x3d, 0x5d, - 0x9e, 0xa2, 0x22, 0x54, 0xcd, 0x86, 0xc2, 0x02, 0xe5, 0x40, 0xb7, 0x3c, 0x69, 0x4f, 0x96, 0xdf, - 0x2f, 0xc9, 0xd4, 0x9d, 0x46, 0xb2, 0x1c, 0xd2, 0x1f, 0x9c, 0xce, 0x34, 0xe9, 0x6c, 0xa6, 0x49, - 0x3f, 0x67, 0x9a, 0x74, 0x32, 0xd7, 0x5a, 0x67, 0x73, 0xad, 0xf5, 0x7d, 0xae, 0xb5, 0xbe, 0x6c, - 0x13, 0x4f, 0x0c, 0xa3, 0x03, 0xc3, 0xa1, 0x7e, 0xbc, 0xae, 0x76, 0xca, 0xab, 0xeb, 0xa8, 0x58, - 0x5e, 0xc7, 0x21, 0xe6, 0x07, 0x9d, 0x64, 0x27, 0xed, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xa0, - 0x38, 0xd6, 0x53, 0xe2, 0x06, 0x00, 0x00, + // 743 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0x8e, 0x2f, 0x57, 0xb9, 0x62, 0xc2, 0xe5, 0xc7, 0x22, 0x10, 0x7c, 0x2f, 0x86, 0xba, 0x6a, + 0x0b, 0x48, 0xb1, 0x09, 0xa8, 0xad, 0x94, 0x55, 0x9b, 0x48, 0xad, 0xba, 0x88, 0x84, 0x4c, 0x51, + 0xa5, 0x6e, 0xd0, 0x10, 0x0f, 0x13, 0x0b, 0xec, 0xb1, 0x66, 0xc6, 0x05, 0x16, 0x95, 0xaa, 0xbe, + 0x40, 0xfb, 0x06, 0xdd, 0x76, 0xc9, 0x82, 0xbe, 0x03, 0xea, 0x0a, 0x21, 0x55, 0xaa, 0xba, 0x40, + 0x15, 0x2c, 0xd8, 0xf7, 0x09, 0x2a, 0xff, 0x62, 0x3b, 0xbf, 0x45, 0xb0, 0x49, 0x3c, 0x73, 0xbe, + 0x33, 0xdf, 0xf7, 0xcd, 0xf8, 0x1c, 0x0f, 0x90, 0x19, 0x46, 0x36, 0xe2, 0x7b, 0x84, 0xee, 0x68, + 0x0c, 0x23, 0x8d, 0xa2, 0x3d, 0x48, 0x0d, 0x8d, 0xef, 0xab, 0x0e, 0x25, 0x9c, 0x88, 0xc5, 0xab, + 0xb8, 0xca, 0x30, 0x52, 0x83, 0xb8, 0x34, 0x89, 0x09, 0x26, 0x3e, 0x42, 0xf3, 0x9e, 0x02, 0xb0, + 0x34, 0xd3, 0x24, 0xcc, 0x22, 0x6c, 0x33, 0x08, 0x04, 0x83, 0x30, 0x34, 0x1d, 0x8c, 0x34, 0x8b, + 0x61, 0xed, 0x4d, 0xc5, 0xfb, 0x0b, 0x03, 0x13, 0xd0, 0x32, 0x6d, 0xa2, 0xf9, 0xbf, 0xe1, 0x94, + 0xd2, 0x59, 0x93, 0x03, 0x29, 0xb4, 0xc2, 0xf5, 0x14, 0x0b, 0x4c, 0x34, 0x18, 0xae, 0x53, 0x04, + 0x39, 0x5a, 0xa3, 0xc4, 0x22, 0x1c, 0x51, 0x71, 0x05, 0xfc, 0xd3, 0xf4, 0x66, 0x08, 0x2d, 0x09, + 0xf3, 0xc2, 0xc2, 0x70, 0xad, 0x74, 0x7a, 0x54, 0x9e, 0x0c, 0x75, 0x3c, 0x35, 0x0c, 0x8a, 0x18, + 0x5b, 0xe7, 0xd4, 0xb4, 0xb1, 0x1e, 0x01, 0xc5, 0x29, 0x90, 0xe7, 0x66, 0x73,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, 0x92, 0x6d, 0x7a, 0xa1, 0xe0, 0x65, 0x2c, 0x44, 0x73, 0x1b, 0xa9, 0x37, 0xb5, 0x97, 0xfc, + 0x12, 0x98, 0x4a, 0x0b, 0x8c, 0xb5, 0x7f, 0x11, 0xc0, 0x78, 0x83, 0xe1, 0x57, 0x26, 0x6f, 0x19, + 0x14, 0xee, 0x05, 0x7b, 0x72, 0xab, 0x45, 0x24, 0x3e, 0x04, 0x79, 0x68, 0x11, 0xd7, 0x0e, 0x25, + 0xd7, 0x66, 0x7b, 0x1e, 0xa1, 0x1e, 0x82, 0x33, 0x8e, 0x24, 0x50, 0xca, 0xca, 0x8e, 0x3d, 0x1d, + 0x0a, 0x60, 0x2c, 0x3e, 0xad, 0x35, 0xbf, 0x81, 0x89, 0x8f, 0xc0, 0x30, 0x74, 0x79, 0x8b, 0x50, + 0x93, 0x1f, 0xf4, 0x35, 0x75, 0x05, 0x15, 0x9f, 0x80, 0x7c, 0xd0, 0x02, 0x7d, 0x67, 0x85, 0x95, + 0x59, 0xb5, 0x63, 0x6f, 0x56, 0x03, 0x9a, 0xda, 0xb0, 0xe7, 0xe5, 0xf3, 0xe5, 0xe1, 0x92, 0xa0, + 0x87, 0x79, 0xd5, 0xbb, 0xa7, 0x47, 0xe5, 0x09, 0x86, 0x51, 0x39, 0xcc, 0x9a, 0xaf, 0xa8, 0x8f, + 0xd5, 0x8a, 0x67, 0xe6, 0x8a, 0x46, 0x59, 0x06, 0xd3, 0x19, 0xc5, 0x91, 0x9b, 0x6a, 0xb1, 0x63, + 0xfe, 0xca, 0x87, 0x3c, 0x18, 0x6a, 0x30, 0x2c, 0x12, 0x30, 0x96, 0xed, 0x81, 0x8b, 0x5d, 0x34, + 0xb6, 0x37, 0x2b, 0xa9, 0x32, 0x30, 0x34, 0xd2, 0x23, 0xee, 0x82, 0xd1, 0xcc, 0x17, 0x60, 0xa1, + 0xfb, 0x22, 0x69, 0xa4, 0xb4, 0x3c, 0x28, 0xb2, 0x9d, 0x2d, 0x6e, 0x26, 0x7d, 0xd9, 0x22, 0x64, + 0x7f, 0xb6, 0x6c, 0x25, 0x7b, 0x6c, 0x99, 0xd6, 0xd5, 0x83, 0x2d, 0x8d, 0xec, 0xc5, 0xd6, 0xb9, + 0x6f, 0x88, 0x26, 0xf8, 0x37, 0x5d, 0x77, 0x0f, 0xba, 0x2f, 0x91, 0x02, 0x4a, 0xda, 0x80, 0xc0, + 0x98, 0xaa, 0x09, 0x0a, 0xc9, 0xf6, 0x74, 0xaf, 0x7b, 0x7e, 0x02, 0x26, 0x95, 0x07, 0x82, 0xc5, + 0x24, 0x6f, 0xc1, 0x48, 0xaa, 0xe6, 0xee, 0xf7, 0xdb, 0x91, 0x00, 0x27, 0xa9, 0x83, 0xe1, 0xe2, + 0xfa, 0x2e, 0x7e, 0xed, 0x54, 0x11, 0xb5, 0xfa, 0xf1, 0xb9, 0x2c, 0x9c, 0x9c, 0xcb, 0xc2, 0xcf, + 0x73, 0x59, 0xf8, 0x78, 0x21, 0xe7, 0x4e, 0x2e, 0xe4, 0xdc, 0xf7, 0x0b, 0x39, 0xf7, 0x7a, 0x11, + 0x9b, 0xbc, 0xe5, 0x6e, 0xa9, 0x4d, 0x62, 0x69, 0x89, 0x3c, 0xff, 0x9e, 0xb3, 0x1f, 0xdf, 0xbe, + 0x0e, 0x1c, 0xc4, 0xb6, 0xf2, 0xfe, 0x4d, 0x67, 0xf5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x69, + 0xfa, 0xcf, 0x98, 0xa3, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -722,6 +833,9 @@ type MsgClient interface { WithdrawFunds(ctx context.Context, in *MsgWithdrawFunds, opts ...grpc.CallOption) (*MsgWithdrawFundsResponse, error) // GrantReward is method to allocate rewards GrantReward(ctx context.Context, in *MsgGrantReward, opts ...grpc.CallOption) (*MsgGrantRewardResponse, error) + // UpdateParams defines a governance operation for updating the x/ovm module + // parameters. The authority is defined in the keeper. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -786,6 +900,15 @@ func (c *msgClient) GrantReward(ctx context.Context, in *MsgGrantReward, opts .. return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/sgenetwork.sge.reward.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // SetPromoterConf is a method to set the configurations of a promoter. @@ -800,6 +923,9 @@ type MsgServer interface { WithdrawFunds(context.Context, *MsgWithdrawFunds) (*MsgWithdrawFundsResponse, error) // GrantReward is method to allocate rewards GrantReward(context.Context, *MsgGrantReward) (*MsgGrantRewardResponse, error) + // UpdateParams defines a governance operation for updating the x/ovm module + // parameters. The authority is defined in the keeper. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -824,6 +950,9 @@ func (*UnimplementedMsgServer) WithdrawFunds(ctx context.Context, req *MsgWithdr func (*UnimplementedMsgServer) GrantReward(ctx context.Context, req *MsgGrantReward) (*MsgGrantRewardResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GrantReward not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -937,6 +1066,24 @@ func _Msg_GrantReward_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sgenetwork.sge.reward.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "sgenetwork.sge.reward.Msg", HandlerType: (*MsgServer)(nil), @@ -965,6 +1112,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "GrantReward", Handler: _Msg_GrantReward_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "sgenetwork/sge/reward/tx.proto", @@ -1402,6 +1553,69 @@ func (m *MsgWithdrawFundsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1599,6 +1813,30 @@ func (m *MsgWithdrawFundsResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2883,6 +3121,171 @@ func (m *MsgWithdrawFundsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/subaccount/handler.go b/x/subaccount/handler.go index 24fd75ad..beb68a13 100644 --- a/x/subaccount/handler.go +++ b/x/subaccount/handler.go @@ -13,7 +13,7 @@ import ( // NewHandler initialize a new sdk.handler instance for registered messages func NewHandler(k keeper.Keeper) sdk.Handler { - msgServer := keeper.NewMsgServerImpl(&k) + msgServer := keeper.NewMsgServerImpl(k) return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { ctx = ctx.WithEventManager(sdk.NewEventManager()) @@ -38,6 +38,10 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgHouseWithdraw: res, err := msgServer.HouseWithdraw(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUpdateParams: + res, err := msgServer.UpdateParams(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) return nil, sdkerrors.Wrap(sdkerrtypes.ErrUnknownRequest, errMsg) diff --git a/x/subaccount/keeper/export_test.go b/x/subaccount/keeper/export_test.go new file mode 100644 index 00000000..d22f197e --- /dev/null +++ b/x/subaccount/keeper/export_test.go @@ -0,0 +1,5 @@ +package keeper + +// KeeperTest is a wrapper object for the keeper, It is being used +// to export unexported methods of the keeper +type KeeperTest = Keeper diff --git a/x/subaccount/keeper/keeper.go b/x/subaccount/keeper/keeper.go index b1ba60e2..c1b69ce2 100644 --- a/x/subaccount/keeper/keeper.go +++ b/x/subaccount/keeper/keeper.go @@ -20,6 +20,9 @@ type Keeper struct { betKeeper types.BetKeeper houseKeeper types.HouseKeeper obKeeper types.OrderBookKeeper + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } func NewKeeper( @@ -32,6 +35,7 @@ func NewKeeper( betKeeper types.BetKeeper, obKeeper types.OrderBookKeeper, hk types.HouseKeeper, + authority string, ) *Keeper { // set KeyTable if it is not already set if !ps.HasKeyTable() { @@ -48,6 +52,12 @@ func NewKeeper( betKeeper: betKeeper, houseKeeper: hk, obKeeper: obKeeper, + authority: authority, } return k } + +// GetAuthority returns the x/subaccount module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/subaccount/keeper/keeper_test.go b/x/subaccount/keeper/keeper_test.go index 1a6f6b4a..06d290a5 100644 --- a/x/subaccount/keeper/keeper_test.go +++ b/x/subaccount/keeper/keeper_test.go @@ -12,7 +12,7 @@ import ( "github.com/sge-network/sge/x/subaccount/keeper" ) -func setupKeeperAndApp(t testing.TB) (*simapp.TestApp, *keeper.Keeper, sdk.Context) { +func setupKeeperAndApp(t testing.TB) (*simapp.TestApp, *keeper.KeeperTest, sdk.Context) { tApp, ctx, err := simapp.GetTestObjects() require.NoError(t, err) diff --git a/x/subaccount/keeper/msg_server.go b/x/subaccount/keeper/msg_server.go index 48699f9d..5625c960 100644 --- a/x/subaccount/keeper/msg_server.go +++ b/x/subaccount/keeper/msg_server.go @@ -5,14 +5,14 @@ import ( ) type msgServer struct { - keeper *Keeper + Keeper } // NewMsgServerImpl returns an implementation of the MsgServer interface // for the provided Keeper. -func NewMsgServerImpl(keeper *Keeper) types.MsgServer { +func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{ - keeper: keeper, + Keeper: keeper, } } diff --git a/x/subaccount/keeper/msg_server_balance.go b/x/subaccount/keeper/msg_server_balance.go index e7680849..5057d8d3 100644 --- a/x/subaccount/keeper/msg_server_balance.go +++ b/x/subaccount/keeper/msg_server_balance.go @@ -12,7 +12,7 @@ import ( func (k msgServer) TopUp(goCtx context.Context, msg *types.MsgTopUp) (*types.MsgTopUpResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - subAccAddr, err := k.keeper.TopUp(ctx, msg.Creator, msg.Address, msg.LockedBalances) + subAccAddr, err := k.Keeper.TopUp(ctx, msg.Creator, msg.Address, msg.LockedBalances) if err != nil { return nil, err } @@ -27,12 +27,12 @@ func (k msgServer) WithdrawUnlockedBalances(goCtx context.Context, msg *types.Ms ctx := sdk.UnwrapSDKContext(goCtx) ownerAddr := sdk.MustAccAddressFromBech32(msg.Creator) - subAccAddr, exists := k.keeper.GetSubaccountByOwner(ctx, ownerAddr) + subAccAddr, exists := k.Keeper.GetSubaccountByOwner(ctx, ownerAddr) if !exists { return nil, types.ErrSubaccountDoesNotExist } - err := k.keeper.withdrawUnlocked(ctx, subAccAddr, ownerAddr) + err := k.Keeper.withdrawUnlocked(ctx, subAccAddr, ownerAddr) if err != nil { return nil, err } diff --git a/x/subaccount/keeper/msg_server_bet.go b/x/subaccount/keeper/msg_server_bet.go index 55ca2913..a5f2f449 100644 --- a/x/subaccount/keeper/msg_server_bet.go +++ b/x/subaccount/keeper/msg_server_bet.go @@ -18,19 +18,19 @@ import ( func (k msgServer) Wager(goCtx context.Context, msg *types.MsgWager) (*types.MsgWagerResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if !k.keeper.GetWagerEnabled(ctx) { + if !k.Keeper.GetWagerEnabled(ctx) { return nil, sdkerrors.Wrapf(sdkerrtypes.ErrInvalidRequest, "currently the subacount wager tx is not enabled") } subAccOwner := sdk.MustAccAddressFromBech32(msg.Creator) // find subaccount - subAccAddr, exists := k.keeper.GetSubaccountByOwner(ctx, subAccOwner) + subAccAddr, exists := k.Keeper.GetSubaccountByOwner(ctx, subAccOwner) if !exists { return nil, status.Error(codes.NotFound, "subaccount not found") } payload := &types.SubAccWagerTicketPayload{} - err := k.keeper.ovmKeeper.VerifyTicketUnmarshal(sdk.WrapSDKContext(ctx), msg.Ticket, &payload) + err := k.Keeper.ovmKeeper.VerifyTicketUnmarshal(sdk.WrapSDKContext(ctx), msg.Ticket, &payload) if err != nil { return nil, sdkerrors.Wrapf(types.ErrInTicketVerification, "%s", err) } @@ -39,7 +39,7 @@ func (k msgServer) Wager(goCtx context.Context, msg *types.MsgWager) (*types.Msg return nil, sdkerrors.Wrapf(sdkerrtypes.ErrInvalidRequest, "message creator should be the same as the sub message creator%s", msg.Creator) } - bet, oddsMap, err := k.keeper.betKeeper.PrepareBetObject(ctx, payload.Msg.Creator, payload.Msg.Props) + bet, oddsMap, err := k.Keeper.betKeeper.PrepareBetObject(ctx, payload.Msg.Creator, payload.Msg.Props) if err != nil { return nil, err } @@ -48,7 +48,7 @@ func (k msgServer) Wager(goCtx context.Context, msg *types.MsgWager) (*types.Msg return nil, sdkerrors.Wrapf(types.ErrInTicketPayloadValidation, "%s", err) } - mainAccBalance := k.keeper.bankKeeper.GetBalance( + mainAccBalance := k.Keeper.bankKeeper.GetBalance( ctx, sdk.MustAccAddressFromBech32(bet.Creator), params.DefaultBondDenom) @@ -56,11 +56,11 @@ func (k msgServer) Wager(goCtx context.Context, msg *types.MsgWager) (*types.Msg return nil, sdkerrors.Wrapf(sdkerrtypes.ErrInvalidRequest, "not enough balance in main account") } - if err := k.keeper.withdrawLockedAndUnlocked(ctx, subAccAddr, subAccOwner, payload.SubaccDeductAmount); err != nil { + if err := k.Keeper.withdrawLockedAndUnlocked(ctx, subAccAddr, subAccOwner, payload.SubaccDeductAmount); err != nil { return nil, err } - if err := k.keeper.betKeeper.Wager(ctx, bet, oddsMap); err != nil { + if err := k.Keeper.betKeeper.Wager(ctx, bet, oddsMap); err != nil { return nil, err } diff --git a/x/subaccount/keeper/msg_server_house.go b/x/subaccount/keeper/msg_server_house.go index 27a09c72..c667d562 100644 --- a/x/subaccount/keeper/msg_server_house.go +++ b/x/subaccount/keeper/msg_server_house.go @@ -14,24 +14,24 @@ import ( func (k msgServer) HouseDeposit(goCtx context.Context, msg *types.MsgHouseDeposit) (*types.MsgHouseDepositResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if !k.keeper.GetDepositEnabled(ctx) { + if !k.Keeper.GetDepositEnabled(ctx) { return nil, sdkerrors.Wrapf(sdkerrtypes.ErrInvalidRequest, "currently the subacount deposit tx is not enabled") } // check if subaccount exists - subAccAddr, exists := k.keeper.GetSubaccountByOwner(ctx, sdk.MustAccAddressFromBech32(msg.Msg.Creator)) + subAccAddr, exists := k.Keeper.GetSubaccountByOwner(ctx, sdk.MustAccAddressFromBech32(msg.Msg.Creator)) if !exists { return nil, types.ErrSubaccountDoesNotExist } // get subaccount balance, and check if it can spend - balance, exists := k.keeper.GetAccountSummary(ctx, subAccAddr) + balance, exists := k.Keeper.GetAccountSummary(ctx, subAccAddr) if !exists { panic("data corruption: subaccount balance not found") } // parse the ticket payload and create deposit, setting the authz allowed as false - _, err := k.keeper.houseKeeper.ParseDepositTicketAndValidate(goCtx, ctx, msg.Msg, false) + _, err := k.Keeper.houseKeeper.ParseDepositTicketAndValidate(goCtx, ctx, msg.Msg, false) if err != nil { return nil, sdkerrors.Wrap(err, "failed to deposit") } @@ -41,7 +41,7 @@ func (k msgServer) HouseDeposit(goCtx context.Context, msg *types.MsgHouseDeposi } // send house deposit from subaccount on behalf of the owner - participationIndex, feeAmount, err := k.keeper.houseKeeper.Deposit( + participationIndex, feeAmount, err := k.Keeper.houseKeeper.Deposit( ctx, msg.Msg.Creator, subAccAddr.String(), @@ -53,7 +53,7 @@ func (k msgServer) HouseDeposit(goCtx context.Context, msg *types.MsgHouseDeposi } // update subaccount balance - k.keeper.SetAccountSummary(ctx, subAccAddr, balance) + k.Keeper.SetAccountSummary(ctx, subAccAddr, balance) // emit event msg.EmitEvent(&ctx, subAccAddr.String(), participationIndex, feeAmount) @@ -70,22 +70,22 @@ func (k msgServer) HouseWithdraw(goCtx context.Context, msg *types.MsgHouseWithd ctx := sdk.UnwrapSDKContext(goCtx) // check if subaccount exists - subAccAddr, exists := k.keeper.GetSubaccountByOwner(ctx, sdk.MustAccAddressFromBech32(msg.Msg.Creator)) + subAccAddr, exists := k.Keeper.GetSubaccountByOwner(ctx, sdk.MustAccAddressFromBech32(msg.Msg.Creator)) if !exists { return nil, types.ErrSubaccountDoesNotExist } - subAccountBalance, exists := k.keeper.GetAccountSummary(ctx, subAccAddr) + subAccountBalance, exists := k.Keeper.GetAccountSummary(ctx, subAccAddr) if !exists { panic("data corruption: subaccount balance not found") } - _, _, err := k.keeper.houseKeeper.ParseWithdrawTicketAndValidate(goCtx, msg.Msg, true) + _, _, err := k.Keeper.houseKeeper.ParseWithdrawTicketAndValidate(goCtx, msg.Msg, true) if err != nil { return nil, err } - id, err := k.keeper.houseKeeper.CalcAndWithdraw(ctx, msg.Msg, subAccAddr.String(), false) + id, err := k.Keeper.houseKeeper.CalcAndWithdraw(ctx, msg.Msg, subAccAddr.String(), false) if err != nil { return nil, err } @@ -95,7 +95,7 @@ func (k msgServer) HouseWithdraw(goCtx context.Context, msg *types.MsgHouseWithd panic("data corruption: it must be possible to unspend an house withdrawal") } - k.keeper.SetAccountSummary(ctx, subAccAddr, subAccountBalance) + k.Keeper.SetAccountSummary(ctx, subAccAddr, subAccountBalance) msg.Msg.EmitEvent(&ctx, subAccAddr.String(), id) diff --git a/x/subaccount/keeper/msg_server_params.go b/x/subaccount/keeper/msg_server_params.go new file mode 100644 index 00000000..29269762 --- /dev/null +++ b/x/subaccount/keeper/msg_server_params.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "context" + + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/sge-network/sge/x/subaccount/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if k.GetAuthority() != req.Authority { + return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + k.SetParams(ctx, req.Params) + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/subaccount/keeper/msg_server_subaccount.go b/x/subaccount/keeper/msg_server_subaccount.go index 202f7829..3c033651 100644 --- a/x/subaccount/keeper/msg_server_subaccount.go +++ b/x/subaccount/keeper/msg_server_subaccount.go @@ -20,7 +20,7 @@ func (k msgServer) Create( return nil, sdkerrors.Wrap(err, "invalid request") } - subAccAddr, err := k.keeper.CreateSubaccount(ctx, msg.Creator, msg.Owner, msg.LockedBalances) + subAccAddr, err := k.Keeper.CreateSubaccount(ctx, msg.Creator, msg.Owner, msg.LockedBalances) if err != nil { return nil, err } diff --git a/x/subaccount/keeper/msg_server_test.go b/x/subaccount/keeper/msg_server_test.go index c778d977..079bff35 100644 --- a/x/subaccount/keeper/msg_server_test.go +++ b/x/subaccount/keeper/msg_server_test.go @@ -14,5 +14,5 @@ func setupMsgServerAndApp( t testing.TB, ) (*simapp.TestApp, *keeper.Keeper, types.MsgServer, sdk.Context) { tApp, k, ctx := setupKeeperAndApp(t) - return tApp, k, keeper.NewMsgServerImpl(k), ctx + return tApp, k, keeper.NewMsgServerImpl(*k), ctx } diff --git a/x/subaccount/module.go b/x/subaccount/module.go index 5645f7c3..9a68aefd 100644 --- a/x/subaccount/module.go +++ b/x/subaccount/module.go @@ -109,7 +109,7 @@ func (AppModule) QuerierRoute() string { return types.QuerierRoute } // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(&am.keeper)) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(am.keeper)) } diff --git a/x/subaccount/simulation/proposals.go b/x/subaccount/simulation/proposals.go new file mode 100644 index 00000000..c6265cb2 --- /dev/null +++ b/x/subaccount/simulation/proposals.go @@ -0,0 +1,45 @@ +package simulation + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/sge-network/sge/x/subaccount/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" //#nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateMsgUpdateParams, + ), + } +} + +// SimulateMsgUpdateParams returns a random MsgUpdateParams +func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + // use the default gov module account address as authority + var authority sdk.AccAddress = address.Module("gov") + + params := types.DefaultParams() + params.WagerEnabled = r.Intn(2) == 0 + params.DepositEnabled = r.Intn(2) == 0 + + return &types.MsgUpdateParams{ + Authority: authority.String(), + Params: params, + } +} diff --git a/x/subaccount/simulation/proposals_test.go b/x/subaccount/simulation/proposals_test.go new file mode 100644 index 00000000..43e7a464 --- /dev/null +++ b/x/subaccount/simulation/proposals_test.go @@ -0,0 +1,45 @@ +package simulation_test + +import ( + "fmt" + "math/rand" + "testing" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/sge-network/sge/x/subaccount/simulation" + "github.com/sge-network/sge/x/subaccount/types" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + //#nosec + r := rand.New(s) + + ctx := sdk.NewContext(nil, tmproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, len(weightedProposalMsgs), 1) + + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + fmt.Println(msgUpdateParams) + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority) + require.Equal(t, true, msgUpdateParams.Params.DepositEnabled) + require.Equal(t, true, msgUpdateParams.Params.WagerEnabled) +} diff --git a/x/subaccount/types/codec.go b/x/subaccount/types/codec.go index 4cfe3560..6257d243 100644 --- a/x/subaccount/types/codec.go +++ b/x/subaccount/types/codec.go @@ -17,6 +17,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgWager{}, "subaccount/BetWager") legacy.RegisterAminoMsg(cdc, &MsgHouseDeposit{}, "subaccount/HouseDeposit") legacy.RegisterAminoMsg(cdc, &MsgHouseWithdraw{}, "subaccount/HouseWithdraw") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "subaccount/MsgUpdateParams") } // RegisterInterfaces registers the module interface types @@ -28,6 +29,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgWager{}, &MsgHouseDeposit{}, &MsgHouseWithdraw{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/subaccount/types/genesis.pb.go b/x/subaccount/types/genesis.pb.go index c1ec9db3..76a9ef6a 100644 --- a/x/subaccount/types/genesis.pb.go +++ b/x/subaccount/types/genesis.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -170,30 +171,32 @@ func init() { } var fileDescriptor_4e56b8808b8d551c = []byte{ - // 362 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xc1, 0x4e, 0xea, 0x40, - 0x14, 0xed, 0x3c, 0x78, 0x10, 0x06, 0xd4, 0x38, 0x61, 0x51, 0x59, 0x54, 0xc4, 0x44, 0x6b, 0x22, - 0x6d, 0x82, 0x1f, 0x60, 0x64, 0x43, 0x48, 0x5c, 0x98, 0x62, 0x62, 0xe2, 0x86, 0x4c, 0xdb, 0x49, - 0x25, 0xd0, 0x0e, 0xe9, 0x4c, 0x83, 0xfc, 0x85, 0x9f, 0x45, 0x5c, 0xb1, 0x74, 0x65, 0x0c, 0x2c, - 0xfc, 0x0d, 0xc3, 0xcc, 0xd4, 0x36, 0x31, 0x74, 0xd5, 0xde, 0xd3, 0x73, 0xce, 0x3d, 0xf7, 0xf6, - 0xc2, 0x4b, 0x16, 0x90, 0x88, 0xf0, 0x05, 0x8d, 0xa7, 0x36, 0x0b, 0x88, 0xcd, 0x12, 0x17, 0x7b, - 0x1e, 0x4d, 0x22, 0x6e, 0xef, 0x3e, 0xb0, 0x09, 0xb3, 0xe6, 0x31, 0xe5, 0x14, 0x9d, 0x64, 0x44, - 0x8b, 0x05, 0xc4, 0xca, 0x88, 0xad, 0x66, 0x40, 0x03, 0x2a, 0x58, 0xf6, 0xee, 0x4d, 0x0a, 0x5a, - 0x17, 0xfb,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b, 0x43, 0x5b, 0x6f, 0x0d, 0xed, 0x63, 0x6b, - 0x68, 0xcf, 0xdd, 0x60, 0xc2, 0x5f, 0x12, 0xd7, 0xf2, 0x68, 0xb8, 0xfb, 0xf3, 0xdd, 0xfc, 0x15, - 0xbc, 0xe6, 0xef, 0x80, 0x2f, 0xe7, 0x84, 0xb9, 0x15, 0x71, 0x06, 0x37, 0x3f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xf9, 0xe0, 0x7a, 0x46, 0xb3, 0x02, 0x00, 0x00, + // 391 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xc1, 0x6a, 0xea, 0x40, + 0x14, 0x86, 0x13, 0xf5, 0x2a, 0x77, 0xf4, 0xde, 0xcb, 0x1d, 0x5c, 0x44, 0x17, 0xa9, 0xb5, 0xd0, + 0xa6, 0x50, 0x13, 0xb0, 0x0f, 0x50, 0xcc, 0x46, 0x84, 0x2e, 0x8a, 0x16, 0x0a, 0xdd, 0xc8, 0x24, + 0x19, 0xd2, 0xa0, 0xc9, 0x48, 0x66, 0x82, 0xf5, 0x2d, 0xba, 0xef, 0x6b, 0xf4, 0x21, 0xa4, 0x2b, + 0xe9, 0xaa, 0xab, 0x52, 0xf4, 0x45, 0x8a, 0x33, 0x93, 0x26, 0x50, 0xcc, 0x2a, 0x99, 0x73, 0xbe, + 0xff, 0x9c, 0xff, 0x1c, 0x0e, 0x38, 0xa3, 0x3e, 0x8e, 0x30, 0x5b, 0x92, 0x78, 0x66, 0x51, 0x1f, + 0x5b, 0x34, 0x71, 0x90, 0xeb, 0x92, 0x24, 0x62, 0xd6, 0x3e, 0x41, 0x03, 0x6a, 0x2e, 0x62, 0xc2, + 0x08, 0x6c, 0x65, 0xa0, 0x49, 0x7d, 0x6c, 0x66, 0x60, 0xbb, 0xe9, 0x13, 0x9f, 0x70, 0xca, 0xda, + 0xff, 0x09, 0x41, 0xbb, 0xe5, 0x12, 0x1a, 0x12, 0x3a, 0x15, 0x09, 0xf1, 0x90, 0xa9, 0xd3, 0xc3, + 0x4d, 0x17, 0x28, 0x46, 0x61, 0xca, 0x15, 0x98, 0x73, 0xd0, 0x1c, 0x45, 0x2e, 0x16, 0x60, 0xf7, + 0x55, 0x05, 0x8d, 0xa1, 0xb0, 0x3b, 0x61, 0x88, 0x61, 0x78, 0x05, 0xaa, 0xa2, 0x92, 0xa6, 0x76, + 0x54, 0xa3, 0xde, 0x3f, 0x36, 0x0f, 0xda, 0x37, 0x6f, 0x38, 0x68, 0x57, 0xd6, 0x1f, 0x47, 0xca, + 0x58, 0xca, 0xe0, 0x09, 0xf8, 0x93, 0x21, 0xd3, 0xc0, 0xd3, 0x4a, 0x1d, 0xd5, 0xa8, 0x8c, 0x1b, + 0x59, 0x70, 0xe4, 0xc1, 0x5b, 0x50, 0xcf, 0xde, 0x54, 0x2b, 0x77, 0xca, 0x46, 0xbd, 0x7f, 0x51, + 0xd0, 0x2a, 0xf5, 0xf8, 0x1d, 0x91, 0x5d, 0xf3, 0x65, 0xba, 0xcf, 0x25, 0xf0, 0xff, 0x07, 0x08, + 0xfb, 0xa0, 0x86, 0x3c, 0x2f, 0xc6, 0x54, 0x8c, 0xf4, 0xdb, 0xd6, 0xde, 0x5e, 0x7a, 0x4d, 0xb9, + 0xd6, 0x81, 0xc8, 0x4c, 0x58, 0x1c, 0x44, 0xfe, 0x38, 0x05, 0xa1, 0x09, 0x7e, 0x91, 0x65, 0x84, + 0x63, 0x6e, 0xbe, 0x48, 0x21, 0x30, 0x38, 0x02, 0x35, 0xb9, 0x57, 0xad, 0xcc, 0xd7, 0x76, 0x5e, + 0x30, 0xcb, 0x40, 0x7c, 0x27, 0x49, 0x18, 0xa2, 0x78, 0x25, 0x07, 0x49, 0xf5, 0xf0, 0x0e, 0xfc, + 0x9b, 0x13, 0x77, 0x86, 0xbd, 0xa9, 0x8c, 0x50, 0xad, 0xc2, 0xd7, 0x63, 0x14, 0x94, 0xbc, 0xe6, + 0x0a, 0x5b, 0x08, 0x64, 0xc5, 0xbf, 0xf3, 0x7c, 0x90, 0xda, 0xc3, 0xf5, 0x56, 0x57, 0x37, 0x5b, + 0x5d, 0xfd, 0xdc, 0xea, 0xea, 0xd3, 0x4e, 0x57, 0x36, 0x3b, 0x5d, 0x79, 0xdf, 0xe9, 0xca, 0x7d, + 0xcf, 0x0f, 0xd8, 0x43, 0xe2, 0x98, 0x2e, 0x09, 0xf7, 0xd7, 0xd2, 0xcb, 0x5f, 0xce, 0x63, 0xfe, + 0x76, 0xd8, 0x6a, 0x81, 0xa9, 0x53, 0xe5, 0xa7, 0x73, 0xf9, 0x15, 0x00, 0x00, 0xff, 0xff, 0xdf, + 0x5a, 0xa9, 0x97, 0x02, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/subaccount/types/messages_params.go b/x/subaccount/types/messages_params.go new file mode 100644 index 00000000..fd6b2d65 --- /dev/null +++ b/x/subaccount/types/messages_params.go @@ -0,0 +1,43 @@ +package types + +import ( + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // typeMsgUpdateParams is type of message MsgUpdateParams + typeMsgUpdateParams = "subaccount_update_params" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// Route returns the module's message router key. +func (*MsgUpdateParams) Route() string { return RouterKey } + +// Type returns type of its message +func (*MsgUpdateParams) Type() string { return typeMsgUpdateParams } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} +} + +// GetSignBytes implements the LegacyMsg interface. +func (msg MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// ValidateBasic does a sanity check on the provided data. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + + if err := msg.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/subaccount/types/query.pb.go b/x/subaccount/types/query.pb.go index c4124ee3..ee108615 100644 --- a/x/subaccount/types/query.pb.go +++ b/x/subaccount/types/query.pb.go @@ -7,6 +7,7 @@ import ( context "context" cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -239,39 +240,41 @@ func init() { } var fileDescriptor_8c7f71115b08f83f = []byte{ - // 503 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x6e, 0xd3, 0x40, - 0x14, 0xc6, 0xe3, 0xa4, 0x4d, 0xc5, 0x54, 0xfc, 0xd1, 0x50, 0x4a, 0x08, 0xd4, 0x2d, 0x16, 0x94, - 0x20, 0x91, 0xb1, 0x30, 0x07, 0x40, 0x64, 0x83, 0x2a, 0xb1, 0x80, 0x54, 0x45, 0x82, 0x4d, 0x35, - 0xb6, 0x47, 0x8e, 0x15, 0x7b, 0x9e, 0xeb, 0x19, 0x2b, 0x44, 0x88, 0x0d, 0x1b, 0xb6, 0x48, 0x3d, - 0x01, 0x87, 0xe0, 0x0e, 0x5d, 0x56, 0x62, 0x83, 0x58, 0x54, 0x28, 0xe1, 0x20, 0xc8, 0xf6, 0x98, - 0x38, 0x6d, 0x1d, 0xa0, 0x2b, 0x8f, 0xc7, 0xdf, 0xf7, 0x7b, 0x9f, 0xe7, 0xcd, 0x43, 0xf7, 0x85, - 0xc7, 0x38, 0x93, 0x23, 0x88, 0x87, 0xa6, 0xf0, 0x98, 0x29, 0x12, 0x9b, 0x3a, 0x0e, 0x24, 0x5c, - 0x9a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, 0xf4, 0xbe, 0x2b, 0x93, - 0xe4, 0x38, 0x62, 0xc2, 0x6e, 0x66, 0xf3, 0xfb, 0xe4, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, - 0xdf, 0x91, 0x17, 0x88, 0x04, 0x00, 0x00, + // 529 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0x8d, 0x93, 0x36, 0x15, 0x53, 0xf1, 0xd0, 0x10, 0x8a, 0x1b, 0xa8, 0x5b, 0x2c, 0x28, 0x41, + 0x22, 0xb6, 0x30, 0x1f, 0x80, 0x9a, 0x0d, 0xaa, 0xc4, 0x02, 0x12, 0x15, 0x09, 0x36, 0xd1, 0xd8, + 0x1e, 0x39, 0x56, 0xec, 0x19, 0xd7, 0x33, 0x56, 0x88, 0x10, 0x1b, 0x36, 0x6c, 0x91, 0xf8, 0x02, + 0x3e, 0x80, 0x1d, 0xfc, 0x43, 0x97, 0x15, 0x6c, 0x10, 0x8b, 0x0a, 0x25, 0x7c, 0x08, 0xca, 0xcc, + 0xb8, 0x71, 0xd2, 0x26, 0x3c, 0x56, 0x33, 0x73, 0xef, 0x39, 0xe7, 0x3e, 0xe6, 0x5e, 0x70, 0x87, + 0x05, 0x98, 0x60, 0x3e, 0xa0, 0x69, 0xdf, 0x66, 0x01, 0xb6, 0x59, 0xe6, 0x22, 0xcf, 0xa3, 0x19, + 0xe1, 0xf6, 0x61, 0x86, 0xd3, 0xa1, 0x95, 0xa4, 0x94, 0x53, 0xb8, 0x39, 0x85, 0x59, 0x2c, 0xc0, + 0xd6, 0x14, 0x56, 0xaf, 0x05, 0x34, 0xa0, 0x02, 0x65, 0x4f, 0x6e, 0x92, 0x50, 0xdf, 0xf4, 0x28, + 0x8b, 0x29, 0xeb, 0x4a, 0x87, 0x7c, 0x28, 0xd7, 0xcd, 0x80, 0xd2, 0x20, 0xc2, 0x36, 0x4a, 0x42, + 0x1b, 0x11, 0x42, 0x39, 0xe2, 0x21, 0x25, 0xb9, 0xf7, 0xee, 0xe2, 0x84, 0x5c, 0x14, 0x21, 0xe2, + 0x61, 0x05, 0xdc, 0x5d, 0x0c, 0x4c, 0x50, 0x8a, 0x62, 0x25, 0x68, 0xd6, 0x00, 0x7c, 0x36, 0xa9, + 0xe4, 0xa9, 0x30, 0xb6, 0xf1, 0x61, 0x86, 0x19, 0x37, 0x9f, 0x83, 0xab, 0x33, 0x56, 0x96, 0x50, + 0xc2, 0x30, 0x7c, 0x04, 0xaa, 0x92, 0xac, 0x6b, 0x3b, 0x5a, 0x63, 0xdd, 0xb9, 0x65, 0x2d, 0x2c, + 0xdc, 0x92, 0xd4, 0xd6, 0xca, 0xd1, 0xc9, 0x76, 0xa9, 0xad, 0x68, 0xa6, 0x03, 0x36, 0x84, 0x6e, + 0xe7, 0x14, 0xa7, 0x22, 0x42, 0x1d, 0xac, 0x21, 0xdf, 0x4f, 0x31, 0x93, 0xda, 0x17, 0xda, 0xf9, + 0xd3, 0xfc, 0x54, 0x01, 0xd7, 0xcf, 0x90, 0x54, 0x42, 0xce, 0x1c, 0xab, 0xa5, 0x7f, 0xfd, 0xdc, + 0xac, 0xa9, 0x7e, 0xee, 0x49, 0x4f, 0x87, 0xa7, 0x21, 0x09, 0x4e, 0xf5, 0xe0, 0x3e, 0x58, 0x53, + 0xad, 0xd2, 0xcb, 0xa2, 0x8a, 0x7b, 0x4b, 0xaa, 0xd8, 0x93, 0x67, 0x27, 0x8b, 0x63, 0x94, 0x0e, + 0x55, 0x35, 0x39, 0x1f, 0x1e, 0x80, 0x4b, 0x11, 0xf5, 0xfa, 0xd8, 0xef, 0xe6, 0x8a, 0x95, 0x9d, + 0x4a, 0x63, 0xdd, 0x69, 0x2c, 0x51, 0x7c, 0x22, 0x08, 0x2d, 0x89, 0x57, 0x82, 0x17, 0xa3, 0xa2, + 0x11, 0xbe, 0x00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 0x00, 0xff, 0xff, 0x4e, 0x35, 0x9d, 0xb9, 0xbd, 0x04, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/subaccount/types/tx.pb.go b/x/subaccount/types/tx.pb.go index 91d7ee08..b87388e6 100644 --- a/x/subaccount/types/tx.pb.go +++ b/x/subaccount/types/tx.pb.go @@ -6,6 +6,9 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -606,6 +609,100 @@ func (m *MsgHouseWithdrawResponse) GetResponse() *types1.MsgWithdrawResponse { return nil } +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/bet parameters. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_4f026744c489fe19, []int{12} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4f026744c489fe19, []int{13} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreate)(nil), "sgenetwork.sge.subaccount.MsgCreate") proto.RegisterType((*MsgCreateResponse)(nil), "sgenetwork.sge.subaccount.MsgCreateResponse") @@ -619,6 +716,8 @@ func init() { proto.RegisterType((*MsgHouseDepositResponse)(nil), "sgenetwork.sge.subaccount.MsgHouseDepositResponse") proto.RegisterType((*MsgHouseWithdraw)(nil), "sgenetwork.sge.subaccount.MsgHouseWithdraw") proto.RegisterType((*MsgHouseWithdrawResponse)(nil), "sgenetwork.sge.subaccount.MsgHouseWithdrawResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "sgenetwork.sge.subaccount.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "sgenetwork.sge.subaccount.MsgUpdateParamsResponse") } func init() { @@ -626,44 +725,56 @@ func init() { } var fileDescriptor_4f026744c489fe19 = []byte{ - // 587 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0xd1, 0x6b, 0xd3, 0x40, - 0x1c, 0xc7, 0x1b, 0xeb, 0xba, 0xed, 0x37, 0x75, 0x1a, 0x87, 0xc6, 0x0c, 0x63, 0xcd, 0x26, 0x56, - 0xe7, 0x52, 0x68, 0x41, 0x5f, 0x44, 0xa4, 0x6e, 0xcc, 0x07, 0xfb, 0x12, 0x36, 0x8a, 0x22, 0x8c, - 0x24, 0x3d, 0xae, 0xa5, 0x5d, 0x2e, 0xe6, 0xae, 0x74, 0xfe, 0x17, 0x2a, 0x82, 0xff, 0xd2, 0x1e, - 0xf7, 0xe8, 0x93, 0x48, 0xfb, 0x8f, 0x48, 0x2e, 0xc9, 0x35, 0x49, 0x49, 0x5a, 0x05, 0xdf, 0xee, - 0x92, 0xef, 0xf7, 0x7b, 0x9f, 0xdf, 0x8f, 0xfb, 0x71, 0xa0, 0x53, 0x8c, 0x5c, 0xc4, 0xc6, 0xc4, - 0x1f, 0xd4, 0x29, 0x46, 0x75, 0x3a, 0xb2, 0x2d, 0xc7, 0x21, 0x23, 0x97, 0xd5, 0xd9, 0xb9, 0xe1, - 0xf9, 0x84, 0x11, 0xf9, 0xde, 0x4c, 0x63, 0x50, 0x8c, 0x8c, 0x99, 0x46, 0x7d, 0x9c, 0x6f, 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, 0x17, 0xae, 0xa5, 0x26, 0xe0, - 0x69, 0xb1, 0x39, 0xa9, 0x55, 0x1b, 0xcb, 0x6b, 0xc5, 0x79, 0x9f, 0xe0, 0x7a, 0xfa, 0x26, 0xef, - 0x2d, 0x11, 0x12, 0x8b, 0xd5, 0xe6, 0x5f, 0x88, 0xe3, 0x23, 0x5b, 0x47, 0x17, 0x13, 0x4d, 0xba, - 0x9c, 0x68, 0xd2, 0xef, 0x89, 0x26, 0x7d, 0x99, 0x6a, 0xa5, 0xcb, 0xa9, 0x56, 0xfa, 0x39, 0xd5, - 0x4a, 0x1f, 0xf6, 0x71, 0x9f, 0xf5, 0x46, 0xb6, 0xe1, 0x90, 0xb3, 0xe0, 0x09, 0xda, 0x4f, 0x3e, - 0x47, 0xe7, 0xa9, 0x77, 0xf1, 0xb3, 0x87, 0xa8, 0x5d, 0xe1, 0xaf, 0x50, 0xf3, 0x4f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xd3, 0x75, 0x55, 0xca, 0x41, 0x07, 0x00, 0x00, + // 780 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xee, 0xfe, 0xfa, 0xa3, 0xd0, 0x01, 0x45, 0x56, 0x90, 0xb2, 0xc4, 0x5a, 0x17, 0xd4, 0x0a, + 0x76, 0x57, 0x96, 0x04, 0x13, 0x0e, 0x46, 0x2b, 0x04, 0x0f, 0x36, 0x31, 0x2b, 0x84, 0x68, 0x4c, + 0x9a, 0xed, 0x76, 0x32, 0xdd, 0x40, 0x77, 0xd6, 0x9d, 0xa9, 0xc0, 0xd5, 0xc4, 0xbb, 0xf1, 0xe6, + 0x37, 0xf0, 0xc8, 0x81, 0x0f, 0x41, 0x3c, 0x11, 0x0e, 0x46, 0x2f, 0xc6, 0xd0, 0x03, 0x5f, 0xc3, + 0xec, 0xec, 0x9f,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, 0x09, 0xcb, 0x03, 0x80, 0x82, 0xd0, 0x9f, 0x39, 0x90, 0xe9, + 0x39, 0x3f, 0xd6, 0xfa, 0x47, 0xea, 0xc5, 0x13, 0x1e, 0x0f, 0xc7, 0x0b, 0xfb, 0x75, 0x67, 0x49, + 0x8c, 0x5f, 0x06, 0x8a, 0xf3, 0xdb, 0x3e, 0x2f, 0x4c, 0x30, 0xd1, 0xd6, 0xea, 0x4b, 0xfd, 0xc9, + 0x61, 0xac, 0xa0, 0x0c, 0x8e, 0x0d, 0xf2, 0xbd, 0x03, 0x57, 0xda, 0x5b, 0x76, 0x79, 0x80, 0x20, + 0x3e, 0x58, 0x58, 0xfd, 0x0b, 0x70, 0x90, 0xf2, 0x23, 0x07, 0x26, 0xda, 0x3a, 0x2f, 0xc6, 0x63, + 0x18, 0x1b, 0xe7, 0xb1, 0x5b, 0x6f, 0x88, 0x33, 0xdf, 0xba, 0xf5, 0x46, 0x71, 0xeb, 0xf4, 0x22, + 0xcb, 0x9d, 0x5d, 0x64, 0xb9, 0xdf, 0x17, 0x59, 0xee, 0x53, 0x33, 0x9b, 0x38, 0x6b, 0x66, 0x13, + 0x3f, 0x9a, 0xd9, 0xc4, 0x9b, 0x02, 0x32, 0x68, 0xad, 0x51, 0x91, 0x74, 0x5c, 0x97, 0x43, 0x3c, + 0x76, 0x7b, 0x39, 0x6c, 0xbb, 0xcb, 0x1d, 0x59, 0x90, 0x54, 0x52, 0xec, 0x2a, 0xb3, 0xfa, 0x27, + 0x00, 0x00, 0xff, 0xff, 0x5c, 0x06, 0xdc, 0x08, 0xf5, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -692,6 +803,9 @@ type MsgClient interface { HouseDeposit(ctx context.Context, in *MsgHouseDeposit, opts ...grpc.CallOption) (*MsgHouseDepositResponse, error) // HouseWithdraw defines a method for withdrawing funds from a market. HouseWithdraw(ctx context.Context, in *MsgHouseWithdraw, opts ...grpc.CallOption) (*MsgHouseWithdrawResponse, error) + // UpdateParams defines a governance operation for updating the x/subaccount + // module parameters. The authority is defined in the keeper. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -756,6 +870,15 @@ func (c *msgClient) HouseWithdraw(ctx context.Context, in *MsgHouseWithdraw, opt return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/sgenetwork.sge.subaccount.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // Create defines a method for creating a subaccount. @@ -772,6 +895,9 @@ type MsgServer interface { HouseDeposit(context.Context, *MsgHouseDeposit) (*MsgHouseDepositResponse, error) // HouseWithdraw defines a method for withdrawing funds from a market. HouseWithdraw(context.Context, *MsgHouseWithdraw) (*MsgHouseWithdrawResponse, error) + // UpdateParams defines a governance operation for updating the x/subaccount + // module parameters. The authority is defined in the keeper. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -796,6 +922,9 @@ func (*UnimplementedMsgServer) HouseDeposit(ctx context.Context, req *MsgHouseDe func (*UnimplementedMsgServer) HouseWithdraw(ctx context.Context, req *MsgHouseWithdraw) (*MsgHouseWithdrawResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HouseWithdraw not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -909,6 +1038,24 @@ func _Msg_HouseWithdraw_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sgenetwork.sge.subaccount.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "sgenetwork.sge.subaccount.Msg", HandlerType: (*MsgServer)(nil), @@ -937,6 +1084,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "HouseWithdraw", Handler: _Msg_HouseWithdraw_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "sgenetwork/sge/subaccount/tx.proto", @@ -1355,6 +1506,69 @@ func (m *MsgHouseWithdrawResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1534,6 +1748,30 @@ func (m *MsgHouseWithdrawResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2612,6 +2850,171 @@ func (m *MsgHouseWithdrawResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0