diff --git a/app/upgrades/v1_5/upgrade.go b/app/upgrades/v1_5/upgrade.go index 91eed388..3dcab1ae 100644 --- a/app/upgrades/v1_5/upgrade.go +++ b/app/upgrades/v1_5/upgrade.go @@ -38,6 +38,8 @@ func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, // TODO: migrate delegation outstanding rewards + // TODO: migrate network fee and whitelist weights + return mm.RunMigrations(ctx, configurator, fromVM) } } diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 0bb94e32..72ec91bf 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -30,10 +30,16 @@ paths: storage_provider_id: type: integer format: int64 - description: storage_provider_id ... + description: >- + storage_provider_id is a unique identifier for each + storage provider, such as Arweave, Irys, Filecoin, + etc. cost: type: string - description: cost ... + description: >- + cost is the amount in USD to store one byte on the + storage provider. This value should be kept + up-to-date. title: StorageCost defines the cost for storage providers description: storage_costs ... network_fee: @@ -4423,10 +4429,16 @@ paths: storage_provider_id: type: integer format: int64 - description: storage_provider_id ... + description: >- + storage_provider_id is a unique identifier for each + storage provider, such as Arweave, Irys, Filecoin, + etc. cost: type: string - description: cost ... + description: >- + cost is the amount in USD to store one byte on the + storage provider. This value should be kept + up-to-date. title: StorageCost defines the cost for storage providers description: storage_costs ... network_fee: @@ -4723,9 +4735,12 @@ paths: that needs to be funded per bundle coin_weight: type: string - title: >- + description: >- coin_weight is a factor used to sort funders after - their funding amounts + their funding amounts. + + This should be the market price of the coin in + USD/coin. This value should be kept up-to-date. title: >- WhitelistCoinEntry is an object containing information around a coin which diff --git a/proto/kyve/bundles/v1beta1/events.proto b/proto/kyve/bundles/v1beta1/events.proto index 749c9e97..4c3b203a 100644 --- a/proto/kyve/bundles/v1beta1/events.proto +++ b/proto/kyve/bundles/v1beta1/events.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package kyve.bundles.v1beta1; +import "amino/amino.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "kyve/bundles/v1beta1/bundles.proto"; import "kyve/bundles/v1beta1/params.proto"; @@ -87,24 +89,51 @@ message EventBundleFinalized { uint64 total = 6; // status of the finalized bundle BundleStatus status = 7; - // amount which funders provided to the total bundle reward (in ukyve) - uint64 funders_payout = 8; + // amount which funders provided to the total bundle reward + repeated cosmos.base.v1beta1.Coin funders_payout = 8 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; // amount which the inflation pool provided to the total reward (in ukyve) uint64 inflation_payout = 9; - // rewards transferred to treasury (in ukyve) - uint64 reward_treasury = 10; - // rewardUploader rewards directly transferred to uploader (in ukyve) - uint64 reward_uploader = 11; - // rewardDelegation rewards distributed among all delegators (in ukyve) - uint64 reward_delegation = 12; + // rewards transferred to treasury + repeated cosmos.base.v1beta1.Coin reward_treasury = 10 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // reward_uploader_commission are the commission rewards of the uploader. + // if the uploader has no delegations the delegation rewards are included here + repeated cosmos.base.v1beta1.Coin reward_uploader_commission = 11 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + // rewardDelegation rewards distributed among all delegators + repeated cosmos.base.v1beta1.Coin reward_delegation = 12 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; // rewardTotal the total bundle reward - uint64 reward_total = 13; + repeated cosmos.base.v1beta1.Coin reward_total = 13 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; // finalized_at the block height where the bundle got finalized uint64 finalized_at = 14; // uploader the address of the uploader of this bundle string uploader = 15; // next_uploader the address of the next uploader after this bundle string next_uploader = 16; + // reward_uploader_storage_cost are the storage cost rewards for the uploader + repeated cosmos.base.v1beta1.Coin reward_uploader_storage_cost = 17 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; } // EventClaimedUploaderRole is an event emitted when an uploader claims the uploader role diff --git a/proto/kyve/bundles/v1beta1/params.proto b/proto/kyve/bundles/v1beta1/params.proto index 97e4bae3..6394563d 100644 --- a/proto/kyve/bundles/v1beta1/params.proto +++ b/proto/kyve/bundles/v1beta1/params.proto @@ -8,9 +8,9 @@ option go_package = "github.com/KYVENetwork/chain/x/bundles/types"; // StorageCost defines the cost for storage providers message StorageCost { - // storage_provider_id ... + // storage_provider_id is a unique identifier for each storage provider, such as Arweave, Irys, Filecoin, etc. uint32 storage_provider_id = 1; - // cost ... + // cost is the amount in USD to store one byte on the storage provider. This value should be kept up-to-date. string cost = 2 [ (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false diff --git a/proto/kyve/funders/v1beta1/params.proto b/proto/kyve/funders/v1beta1/params.proto index 77d1ebf8..2c114036 100644 --- a/proto/kyve/funders/v1beta1/params.proto +++ b/proto/kyve/funders/v1beta1/params.proto @@ -18,7 +18,8 @@ message WhitelistCoinEntry { // min_funding_amount_per_bundle is the minimum required amount of this denom // that needs to be funded per bundle uint64 min_funding_amount_per_bundle = 3; - // coin_weight is a factor used to sort funders after their funding amounts + // coin_weight is a factor used to sort funders after their funding amounts. + // This should be the market price of the coin in USD/coin. This value should be kept up-to-date. string coin_weight = 4 [ (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index 36e1a4d3..d75ec43b 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -1076,11 +1076,11 @@ var _ = Describe("valid bundles", Ordered, func() { balanceVoter := s.GetBalanceFromAddress(valaccountVoter.Staker) Expect(balanceVoter).To(Equal(initialBalanceStaker1)) - // calculate uploader rewards // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + whitelist := s.App().FundersKeeper.GetCoinWhitelistMap(s.Ctx()) treasuryReward := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), storageProviderId).MulInt64(100).TruncateInt64()) + storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), storageProviderId).Quo(whitelist[globalTypes.Denom].CoinWeight).MulInt64(100).TruncateInt64()) totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) diff --git a/x/bundles/keeper/logic_bundles.go b/x/bundles/keeper/logic_bundles.go index bff939ed..8dfaaea5 100644 --- a/x/bundles/keeper/logic_bundles.go +++ b/x/bundles/keeper/logic_bundles.go @@ -2,7 +2,6 @@ package keeper import ( "cosmossdk.io/errors" - "cosmossdk.io/math" globalTypes "github.com/KYVENetwork/chain/x/global/types" poolTypes "github.com/KYVENetwork/chain/x/pool/types" @@ -232,12 +231,12 @@ func (k Keeper) handleNonVoters(ctx sdk.Context, poolId uint64) { // calculatePayouts calculates the different payouts to treasury, uploader and delegators from the total payout // the pool module provides for this bundle round -func (k Keeper) calculatePayouts(ctx sdk.Context, poolId uint64, totalPayout uint64) (bundleReward types.BundleReward) { - // This method first subtracts the network fee from it - // After that the uploader receives the storage rewards. If the total payout does not cover the - // storage rewards we pay out the remains, the commission and delegation rewards will be empty - // in this case. After the payout of the storage rewards the remains are divided between uploader - // and its delegators based on the commission. +func (k Keeper) calculatePayouts(ctx sdk.Context, poolId uint64, totalPayout sdk.Coins) (bundleReward types.BundleReward) { + // This method first subtracts the network fee from the total payout dedicated for this bundle. + // After that the uploader receives the storage rewards which are based on the byte size of the bundle. + // If the total payout does not cover the storage rewards we pay out the remains, the commission and + // delegation rewards will be empty in this case. After the payout of the storage rewards the remains + // are divided between uploader and its delegators based on the uploader's commission. bundleProposal, _ := k.GetBundleProposal(ctx, poolId) // Should not happen, if so make no payouts @@ -245,37 +244,71 @@ func (k Keeper) calculatePayouts(ctx sdk.Context, poolId uint64, totalPayout uin return } + // Already return if there are no payouts + if totalPayout.IsZero() { + return + } + bundleReward.Total = totalPayout // calculate share of treasury from total payout - bundleReward.Treasury = uint64(math.LegacyNewDec(int64(totalPayout)).Mul(k.GetNetworkFee(ctx)).TruncateInt64()) + treasuryPayout, _ := sdk.NewDecCoinsFromCoins(totalPayout...).MulDec(k.GetNetworkFee(ctx)).TruncateDecimal() + bundleReward.Treasury = treasuryPayout + + // subtract treasury payout from total payout, so we can continue splitting up the rewards from here + totalPayout = totalPayout.Sub(bundleReward.Treasury...) + if totalPayout.IsZero() { + return + } + + // subtract storage cost from remaining total payout. We split the storage cost between all coins and charge + // the amount per coin, the idea is that every coin should contribute the same USD value to the total storage + // reward. This is done by defining the storage cost as USD / byte and the coin weights as USD / coin denom. + // + // If there is not enough of a coin available to cover the storage reward per coin we simply charge what is left, + // so there can be the case that the storageRewards are less than what we actually wanted to pay out. This is + // acceptable because this case is very rare, usually the minFundingAmount ensures that there are always enough + // funds left of each coin, and in the case there are not enough the coins are removed and therefore for the + // next bundle we split between the other remaining coins. + whitelist := k.fundersKeeper.GetCoinWhitelistMap(ctx) + wantedStorageRewards := sdk.NewCoins() + storageCostPerCoin := k.GetStorageCost(ctx, bundleProposal.StorageProviderId).MulInt64(int64(bundleProposal.DataSize)).QuoInt64(int64(totalPayout.Len())) + + for _, coin := range totalPayout { + weight := whitelist[coin.Denom].CoinWeight + if weight.IsZero() { + continue + } + + amount := storageCostPerCoin.Quo(weight) + wantedStorageRewards = wantedStorageRewards.Add(sdk.NewCoin(coin.Denom, amount.TruncateInt())) + } - // calculate wanted storage reward the uploader should receive - storageReward := uint64(k.GetStorageCost(ctx, bundleProposal.StorageProviderId).MulInt64(int64(bundleProposal.DataSize)).TruncateInt64()) + // we take the min here since there can be the case where we want to charge more coins for the storage + // reward than we have left in the total payout + bundleReward.UploaderStorageCost = totalPayout.Min(wantedStorageRewards) - // if not even the full storage reward can not be paid out we pay out the remains. - // in this case the uploader will not earn the commission rewards and delegators not - // their delegation rewards because total payout is not high enough - if totalPayout-bundleReward.Treasury < storageReward { - bundleReward.Uploader = totalPayout - bundleReward.Treasury + // the remaining total payout is split between the uploader and his delegators. + totalPayout = totalPayout.Sub(bundleReward.UploaderStorageCost...) + if totalPayout.IsZero() { return - } else { - bundleReward.Uploader = storageReward } - // remaining rewards to be split between uploader and its delegators - totalNodeReward := totalPayout - bundleReward.Treasury - bundleReward.Uploader + commission := k.stakerKeeper.GetCommission(ctx, bundleProposal.Uploader) + commissionRewards, _ := sdk.NewDecCoinsFromCoins(totalPayout...).MulDec(commission).TruncateDecimal() + bundleReward.UploaderCommission = commissionRewards - // payout delegators - if k.delegationKeeper.GetDelegationAmount(ctx, bundleProposal.Uploader) > 0 { - commission := k.stakerKeeper.GetCommission(ctx, bundleProposal.Uploader) - commissionRewards := uint64(math.LegacyNewDec(int64(totalNodeReward)).Mul(commission).TruncateInt64()) + // the remaining total payout belongs to the delegators + totalPayout = totalPayout.Sub(bundleReward.UploaderCommission...) + if totalPayout.IsZero() { + return + } - bundleReward.Uploader += commissionRewards - bundleReward.Delegation = totalNodeReward - commissionRewards + // if the uploader has no delegators he receives the entire remaining amount + if k.delegationKeeper.GetDelegationAmount(ctx, bundleProposal.Uploader) > 0 { + bundleReward.Delegation = totalPayout } else { - bundleReward.Uploader += totalNodeReward - bundleReward.Delegation = 0 + bundleReward.UploaderCommission = bundleReward.UploaderCommission.Add(totalPayout...) } return @@ -335,7 +368,7 @@ func (k Keeper) registerBundleProposalFromUploader(ctx sdk.Context, msg *types.M // finalizeCurrentBundleProposal takes the data of the current evaluated proposal // and stores it as a finalized proposal. This only happens if the network // reached quorum on the proposal's validity. -func (k Keeper) finalizeCurrentBundleProposal(ctx sdk.Context, poolId uint64, voteDistribution types.VoteDistribution, fundersPayout uint64, inflationPayout uint64, bundleReward types.BundleReward, nextUploader string) { +func (k Keeper) finalizeCurrentBundleProposal(ctx sdk.Context, poolId uint64, voteDistribution types.VoteDistribution, fundersPayout sdk.Coins, inflationPayout uint64, bundleReward types.BundleReward, nextUploader string) { pool, _ := k.poolKeeper.GetPool(ctx, poolId) bundleProposal, _ := k.GetBundleProposal(ctx, poolId) @@ -367,22 +400,23 @@ func (k Keeper) finalizeCurrentBundleProposal(ctx sdk.Context, poolId uint64, vo k.SetFinalizedBundle(ctx, finalizedBundle) _ = ctx.EventManager().EmitTypedEvent(&types.EventBundleFinalized{ - PoolId: finalizedBundle.PoolId, - Id: finalizedBundle.Id, - Valid: voteDistribution.Valid, - Invalid: voteDistribution.Invalid, - Abstain: voteDistribution.Abstain, - Total: voteDistribution.Total, - Status: voteDistribution.Status, - FundersPayout: fundersPayout, - InflationPayout: inflationPayout, - RewardTreasury: bundleReward.Treasury, - RewardUploader: bundleReward.Uploader, - RewardDelegation: bundleReward.Delegation, - RewardTotal: bundleReward.Total, - FinalizedAt: uint64(ctx.BlockTime().Unix()), - Uploader: bundleProposal.Uploader, - NextUploader: nextUploader, + PoolId: finalizedBundle.PoolId, + Id: finalizedBundle.Id, + Valid: voteDistribution.Valid, + Invalid: voteDistribution.Invalid, + Abstain: voteDistribution.Abstain, + Total: voteDistribution.Total, + Status: voteDistribution.Status, + FundersPayout: fundersPayout, + InflationPayout: inflationPayout, + RewardTreasury: bundleReward.Treasury, + RewardUploaderCommission: bundleReward.UploaderCommission, + RewardUploaderStorageCost: bundleReward.UploaderStorageCost, + RewardDelegation: bundleReward.Delegation, + RewardTotal: bundleReward.Total, + FinalizedAt: uint64(ctx.BlockTime().Unix()), + Uploader: bundleProposal.Uploader, + NextUploader: nextUploader, }) // Finalize the proposal, saving useful information. @@ -398,19 +432,15 @@ func (k Keeper) dropCurrentBundleProposal(ctx sdk.Context, poolId uint64, voteDi bundleProposal, _ := k.GetBundleProposal(ctx, poolId) _ = ctx.EventManager().EmitTypedEvent(&types.EventBundleFinalized{ - PoolId: pool.Id, - Id: pool.TotalBundles, - Valid: voteDistribution.Valid, - Invalid: voteDistribution.Invalid, - Abstain: voteDistribution.Abstain, - Total: voteDistribution.Total, - Status: voteDistribution.Status, - RewardTreasury: 0, - RewardUploader: 0, - RewardDelegation: 0, - RewardTotal: 0, - FinalizedAt: uint64(ctx.BlockTime().Unix()), - Uploader: bundleProposal.Uploader, + PoolId: pool.Id, + Id: pool.TotalBundles, + Valid: voteDistribution.Valid, + Invalid: voteDistribution.Invalid, + Abstain: voteDistribution.Abstain, + Total: voteDistribution.Total, + Status: voteDistribution.Status, + FinalizedAt: uint64(ctx.BlockTime().Unix()), + Uploader: bundleProposal.Uploader, }) // drop bundle @@ -533,39 +563,40 @@ func (k Keeper) tallyBundleProposal(ctx sdk.Context, bundleProposal types.Bundle switch voteDistribution.Status { case types.BUNDLE_STATUS_VALID: // charge the funders of the pool - fundersPayouts, err := k.fundersKeeper.ChargeFundersOfPool(ctx, poolId, poolTypes.ModuleName) + fundersPayout, err := k.fundersKeeper.ChargeFundersOfPool(ctx, poolId, poolTypes.ModuleName) if err != nil { return types.TallyResult{}, err } - // TODO: support all coins in separate PR - fundersPayout := uint64(0) - if found, payout := fundersPayouts.Find(globalTypes.Denom); found { - fundersPayout = payout.Amount.Uint64() - } - // charge the inflation pool inflationPayout, err := k.poolKeeper.ChargeInflationPool(ctx, poolId) if err != nil { return types.TallyResult{}, err } - // calculate payouts to the different stakeholders like treasury, uploader and delegators - bundleReward := k.calculatePayouts(ctx, poolId, fundersPayout+inflationPayout) + // combine funders payout with inflation payout to calculate the rewards for the different stakeholders + // like treasury, uploader and delegators + totalPayout := fundersPayout.Add(sdk.NewInt64Coin(globalTypes.Denom, int64(inflationPayout))) + bundleReward := k.calculatePayouts(ctx, poolId, totalPayout) // payout rewards to treasury - if err := util.TransferFromModuleToTreasury(k.accountKeeper, k.distrkeeper, ctx, poolTypes.ModuleName, bundleReward.Treasury); err != nil { + if err := k.distrkeeper.FundCommunityPool(ctx, bundleReward.Treasury, k.accountKeeper.GetModuleAddress(poolTypes.ModuleName)); err != nil { return types.TallyResult{}, err } // payout rewards to uploader through commission rewards - if err := k.stakerKeeper.IncreaseStakerCommissionRewards(ctx, bundleProposal.Uploader, bundleReward.Uploader); err != nil { + uploaderReward := uint64(0) + if found, uploaderRewardCoin := bundleReward.UploaderCommission.Add(bundleReward.UploaderStorageCost...).Find(globalTypes.Denom); found { + uploaderReward = uploaderRewardCoin.Amount.Uint64() + } + + // TODO: payout all rewards to uploader in separate PR + if err := k.stakerKeeper.IncreaseStakerCommissionRewards(ctx, bundleProposal.Uploader, uploaderReward); err != nil { return types.TallyResult{}, err } // payout rewards to delegators through delegation rewards - bundleRewardCoins := sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(bundleReward.Delegation))) - if err := k.delegationKeeper.PayoutRewards(ctx, bundleProposal.Uploader, bundleRewardCoins, poolTypes.ModuleName); err != nil { + if err := k.delegationKeeper.PayoutRewards(ctx, bundleProposal.Uploader, bundleReward.Delegation, poolTypes.ModuleName); err != nil { return types.TallyResult{}, err } @@ -599,7 +630,7 @@ func (k Keeper) tallyBundleProposal(ctx sdk.Context, bundleProposal types.Bundle return types.TallyResult{ Status: types.TallyResultInvalid, VoteDistribution: voteDistribution, - FundersPayout: 0, + FundersPayout: sdk.NewCoins(), InflationPayout: 0, BundleReward: types.BundleReward{}, }, nil @@ -608,7 +639,7 @@ func (k Keeper) tallyBundleProposal(ctx sdk.Context, bundleProposal types.Bundle return types.TallyResult{ Status: types.TallyResultNoQuorum, VoteDistribution: voteDistribution, - FundersPayout: 0, + FundersPayout: sdk.NewCoins(), InflationPayout: 0, BundleReward: types.BundleReward{}, }, nil diff --git a/x/bundles/types/events.pb.go b/x/bundles/types/events.pb.go index ffbbf676..9d4c693e 100644 --- a/x/bundles/types/events.pb.go +++ b/x/bundles/types/events.pb.go @@ -5,6 +5,9 @@ package types import ( fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -347,24 +350,27 @@ type EventBundleFinalized struct { Total uint64 `protobuf:"varint,6,opt,name=total,proto3" json:"total,omitempty"` // status of the finalized bundle Status BundleStatus `protobuf:"varint,7,opt,name=status,proto3,enum=kyve.bundles.v1beta1.BundleStatus" json:"status,omitempty"` - // amount which funders provided to the total bundle reward (in ukyve) - FundersPayout uint64 `protobuf:"varint,8,opt,name=funders_payout,json=fundersPayout,proto3" json:"funders_payout,omitempty"` + // amount which funders provided to the total bundle reward + FundersPayout github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,8,rep,name=funders_payout,json=fundersPayout,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funders_payout"` // amount which the inflation pool provided to the total reward (in ukyve) InflationPayout uint64 `protobuf:"varint,9,opt,name=inflation_payout,json=inflationPayout,proto3" json:"inflation_payout,omitempty"` - // rewards transferred to treasury (in ukyve) - RewardTreasury uint64 `protobuf:"varint,10,opt,name=reward_treasury,json=rewardTreasury,proto3" json:"reward_treasury,omitempty"` - // rewardUploader rewards directly transferred to uploader (in ukyve) - RewardUploader uint64 `protobuf:"varint,11,opt,name=reward_uploader,json=rewardUploader,proto3" json:"reward_uploader,omitempty"` - // rewardDelegation rewards distributed among all delegators (in ukyve) - RewardDelegation uint64 `protobuf:"varint,12,opt,name=reward_delegation,json=rewardDelegation,proto3" json:"reward_delegation,omitempty"` + // rewards transferred to treasury + RewardTreasury github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,10,rep,name=reward_treasury,json=rewardTreasury,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_treasury"` + // reward_uploader_commission are the commission rewards of the uploader. + // if the uploader has no delegations the delegation rewards are included here + RewardUploaderCommission github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,11,rep,name=reward_uploader_commission,json=rewardUploaderCommission,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_uploader_commission"` + // rewardDelegation rewards distributed among all delegators + RewardDelegation github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,12,rep,name=reward_delegation,json=rewardDelegation,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_delegation"` // rewardTotal the total bundle reward - RewardTotal uint64 `protobuf:"varint,13,opt,name=reward_total,json=rewardTotal,proto3" json:"reward_total,omitempty"` + RewardTotal github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,13,rep,name=reward_total,json=rewardTotal,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_total"` // finalized_at the block height where the bundle got finalized FinalizedAt uint64 `protobuf:"varint,14,opt,name=finalized_at,json=finalizedAt,proto3" json:"finalized_at,omitempty"` // uploader the address of the uploader of this bundle Uploader string `protobuf:"bytes,15,opt,name=uploader,proto3" json:"uploader,omitempty"` // next_uploader the address of the next uploader after this bundle NextUploader string `protobuf:"bytes,16,opt,name=next_uploader,json=nextUploader,proto3" json:"next_uploader,omitempty"` + // reward_uploader_storage_cost are the storage cost rewards for the uploader + RewardUploaderStorageCost github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,17,rep,name=reward_uploader_storage_cost,json=rewardUploaderStorageCost,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_uploader_storage_cost"` } func (m *EventBundleFinalized) Reset() { *m = EventBundleFinalized{} } @@ -449,11 +455,11 @@ func (m *EventBundleFinalized) GetStatus() BundleStatus { return BUNDLE_STATUS_UNSPECIFIED } -func (m *EventBundleFinalized) GetFundersPayout() uint64 { +func (m *EventBundleFinalized) GetFundersPayout() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.FundersPayout } - return 0 + return nil } func (m *EventBundleFinalized) GetInflationPayout() uint64 { @@ -463,32 +469,32 @@ func (m *EventBundleFinalized) GetInflationPayout() uint64 { return 0 } -func (m *EventBundleFinalized) GetRewardTreasury() uint64 { +func (m *EventBundleFinalized) GetRewardTreasury() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.RewardTreasury } - return 0 + return nil } -func (m *EventBundleFinalized) GetRewardUploader() uint64 { +func (m *EventBundleFinalized) GetRewardUploaderCommission() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { - return m.RewardUploader + return m.RewardUploaderCommission } - return 0 + return nil } -func (m *EventBundleFinalized) GetRewardDelegation() uint64 { +func (m *EventBundleFinalized) GetRewardDelegation() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.RewardDelegation } - return 0 + return nil } -func (m *EventBundleFinalized) GetRewardTotal() uint64 { +func (m *EventBundleFinalized) GetRewardTotal() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.RewardTotal } - return 0 + return nil } func (m *EventBundleFinalized) GetFinalizedAt() uint64 { @@ -512,6 +518,13 @@ func (m *EventBundleFinalized) GetNextUploader() string { return "" } +func (m *EventBundleFinalized) GetRewardUploaderStorageCost() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.RewardUploaderStorageCost + } + return nil +} + // EventClaimedUploaderRole is an event emitted when an uploader claims the uploader role // emitted_by: MsgClaimUploaderRole type EventClaimedUploaderRole struct { @@ -787,63 +800,72 @@ func init() { func init() { proto.RegisterFile("kyve/bundles/v1beta1/events.proto", fileDescriptor_a02f505e55d81e92) } var fileDescriptor_a02f505e55d81e92 = []byte{ - // 895 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdf, 0x6e, 0x1b, 0xc5, - 0x17, 0xce, 0xa6, 0x1b, 0x27, 0x7b, 0xfc, 0x27, 0xce, 0x36, 0xbf, 0x1f, 0x4b, 0xa0, 0x6e, 0x62, - 0x84, 0x08, 0x2a, 0xb2, 0xd5, 0x70, 0xc7, 0x5d, 0x52, 0x5a, 0x61, 0x55, 0x42, 0xd6, 0xa6, 0xad, - 0x04, 0x37, 0xd6, 0x38, 0x73, 0x6c, 0x8f, 0xbc, 0xde, 0x59, 0xcd, 0xcc, 0xda, 0x71, 0x9e, 0x02, - 0x09, 0xf1, 0x24, 0x7d, 0x05, 0x2e, 0x7a, 0xd9, 0x4b, 0xae, 0x10, 0x4a, 0x5e, 0x04, 0xcd, 0x9f, - 0xdd, 0x98, 0xe0, 0x42, 0xcb, 0x9d, 0xcf, 0x77, 0xbe, 0xf9, 0xce, 0xb7, 0xe7, 0x9c, 0x19, 0xc3, - 0xd1, 0x74, 0x39, 0xc7, 0xee, 0x30, 0x4f, 0x69, 0x82, 0xb2, 0x3b, 0x7f, 0x3c, 0x44, 0x45, 0x1e, - 0x77, 0x71, 0x8e, 0xa9, 0x92, 0x9d, 0x4c, 0x70, 0xc5, 0xc3, 0x7d, 0x4d, 0xe9, 0x38, 0x4a, 0xc7, - 0x51, 0x0e, 0xf6, 0xc7, 0x7c, 0xcc, 0x0d, 0xa1, 0xab, 0x7f, 0x59, 0xee, 0x41, 0x7b, 0xad, 0x5c, - 0x71, 0xd6, 0x72, 0xd6, 0x97, 0xcc, 0x88, 0x20, 0xb3, 0x82, 0xf2, 0x60, 0x2d, 0x45, 0x5d, 0xda, - 0x74, 0xfb, 0xb5,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, 0x02, 0x08, 0x00, 0x00, + // 1034 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x26, 0x4e, 0x62, 0x8f, 0xff, 0xc4, 0xde, 0x06, 0xd8, 0x84, 0xd6, 0x71, 0x8c, 0x90, + 0xcc, 0x3f, 0xaf, 0x6a, 0xc4, 0x85, 0x5b, 0x62, 0x5a, 0x61, 0x55, 0x42, 0xd6, 0xa6, 0xad, 0x04, + 0x17, 0x6b, 0xec, 0x19, 0xdb, 0x23, 0xef, 0xce, 0xac, 0x66, 0x66, 0xed, 0x38, 0x12, 0x5f, 0x01, + 0x81, 0x10, 0xdf, 0x01, 0x71, 0x42, 0xe2, 0x2b, 0x70, 0xe8, 0xb1, 0x47, 0x4e, 0x80, 0x92, 0x03, + 0x1f, 0x81, 0x2b, 0x9a, 0x3f, 0xbb, 0x4d, 0x83, 0x0b, 0x6d, 0x25, 0x5f, 0x12, 0xbf, 0xdf, 0x7b, + 0xf3, 0x7e, 0xbf, 0x99, 0xf7, 0xe6, 0xcd, 0x82, 0xe3, 0xd9, 0x72, 0x8e, 0xfd, 0x61, 0x42, 0x51, + 0x88, 0x85, 0x3f, 0xbf, 0x3b, 0xc4, 0x12, 0xde, 0xf5, 0xf1, 0x1c, 0x53, 0x29, 0xda, 0x31, 0x67, + 0x92, 0xb9, 0xfb, 0x2a, 0xa4, 0x6d, 0x43, 0xda, 0x36, 0xe4, 0xb0, 0x06, 0x23, 0x42, 0x99, 0xaf, + 0xff, 0x9a, 0xc0, 0xc3, 0xfa, 0x88, 0x89, 0x88, 0x09, 0x7f, 0x08, 0x05, 0xce, 0x52, 0x8d, 0x18, + 0xa1, 0xd6, 0xbf, 0x3f, 0x61, 0x13, 0xa6, 0x7f, 0xfa, 0xea, 0x97, 0x45, 0x9b, 0x2b, 0x15, 0xa4, + 0x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x8e, 0xec, 0xb8, 0x6f, 0xaa, + 0xca, 0xfd, 0x5b, 0x55, 0x64, 0x5f, 0xcf, 0x3e, 0x23, 0x54, 0xf6, 0xe8, 0x48, 0x5d, 0xc9, 0xff, + 0x9a, 0xba, 0x2f, 0x7a, 0xd9, 0xd5, 0x98, 0x4f, 0x38, 0xc7, 0x54, 0x0e, 0x62, 0x95, 0x4a, 0xd8, + 0x31, 0x5c, 0xb6, 0xa8, 0xce, 0x2f, 0x9a, 0x5d, 0x50, 0x7d, 0x46, 0x27, 0x02, 0x2c, 0xb0, 0x7c, + 0x65, 0xae, 0xd3, 0xfb, 0x4f, 0x2e, 0xeb, 0xce, 0xd3, 0xcb, 0xba, 0xf3, 0xe7, 0x65, 0xdd, 0xf9, + 0xf6, 0xaa, 0xbe, 0xf1, 0xf4, 0xaa, 0xbe, 0xf1, 0xdb, 0x55, 0x7d, 0xe3, 0xab, 0x0f, 0xaf, 0x75, + 0xc5, 0x83, 0x2f, 0x1f, 0xdf, 0xfb, 0x02, 0xcb, 0x05, 0xe3, 0x33, 0x7f, 0x34, 0x85, 0x84, 0xfa, + 0xe7, 0xd9, 0x37, 0x99, 0xee, 0x8f, 0xe1, 0x8e, 0xfe, 0x1e, 0xfb, 0xf8, 0x9f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x78, 0x95, 0x78, 0xb1, 0x79, 0x0a, 0x00, 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -1068,6 +1090,22 @@ func (m *EventBundleFinalized) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.RewardUploaderStorageCost) > 0 { + for iNdEx := len(m.RewardUploaderStorageCost) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardUploaderStorageCost[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + } if len(m.NextUploader) > 0 { i -= len(m.NextUploader) copy(dAtA[i:], m.NextUploader) @@ -1089,35 +1127,80 @@ func (m *EventBundleFinalized) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x70 } - if m.RewardTotal != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.RewardTotal)) - i-- - dAtA[i] = 0x68 + if len(m.RewardTotal) > 0 { + for iNdEx := len(m.RewardTotal) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardTotal[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } } - if m.RewardDelegation != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.RewardDelegation)) - i-- - dAtA[i] = 0x60 + if len(m.RewardDelegation) > 0 { + for iNdEx := len(m.RewardDelegation) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardDelegation[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } } - if m.RewardUploader != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.RewardUploader)) - i-- - dAtA[i] = 0x58 + if len(m.RewardUploaderCommission) > 0 { + for iNdEx := len(m.RewardUploaderCommission) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardUploaderCommission[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } } - if m.RewardTreasury != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.RewardTreasury)) - i-- - dAtA[i] = 0x50 + if len(m.RewardTreasury) > 0 { + for iNdEx := len(m.RewardTreasury) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardTreasury[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } } if m.InflationPayout != 0 { i = encodeVarintEvents(dAtA, i, uint64(m.InflationPayout)) i-- dAtA[i] = 0x48 } - if m.FundersPayout != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.FundersPayout)) - i-- - dAtA[i] = 0x40 + if len(m.FundersPayout) > 0 { + for iNdEx := len(m.FundersPayout) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FundersPayout[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } } if m.Status != 0 { i = encodeVarintEvents(dAtA, i, uint64(m.Status)) @@ -1454,23 +1537,38 @@ func (m *EventBundleFinalized) Size() (n int) { if m.Status != 0 { n += 1 + sovEvents(uint64(m.Status)) } - if m.FundersPayout != 0 { - n += 1 + sovEvents(uint64(m.FundersPayout)) + if len(m.FundersPayout) > 0 { + for _, e := range m.FundersPayout { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } } if m.InflationPayout != 0 { n += 1 + sovEvents(uint64(m.InflationPayout)) } - if m.RewardTreasury != 0 { - n += 1 + sovEvents(uint64(m.RewardTreasury)) + if len(m.RewardTreasury) > 0 { + for _, e := range m.RewardTreasury { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } } - if m.RewardUploader != 0 { - n += 1 + sovEvents(uint64(m.RewardUploader)) + if len(m.RewardUploaderCommission) > 0 { + for _, e := range m.RewardUploaderCommission { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } } - if m.RewardDelegation != 0 { - n += 1 + sovEvents(uint64(m.RewardDelegation)) + if len(m.RewardDelegation) > 0 { + for _, e := range m.RewardDelegation { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } } - if m.RewardTotal != 0 { - n += 1 + sovEvents(uint64(m.RewardTotal)) + if len(m.RewardTotal) > 0 { + for _, e := range m.RewardTotal { + l = e.Size() + n += 1 + l + sovEvents(uint64(l)) + } } if m.FinalizedAt != 0 { n += 1 + sovEvents(uint64(m.FinalizedAt)) @@ -1483,6 +1581,12 @@ func (m *EventBundleFinalized) Size() (n int) { if l > 0 { n += 2 + l + sovEvents(uint64(l)) } + if len(m.RewardUploaderStorageCost) > 0 { + for _, e := range m.RewardUploaderStorageCost { + l = e.Size() + n += 2 + l + sovEvents(uint64(l)) + } + } return n } @@ -2426,10 +2530,10 @@ func (m *EventBundleFinalized) Unmarshal(dAtA []byte) error { } } case 8: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FundersPayout", wireType) } - m.FundersPayout = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2439,11 +2543,26 @@ func (m *EventBundleFinalized) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.FundersPayout |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FundersPayout = append(m.FundersPayout, types.Coin{}) + if err := m.FundersPayout[len(m.FundersPayout)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field InflationPayout", wireType) @@ -2464,10 +2583,10 @@ func (m *EventBundleFinalized) Unmarshal(dAtA []byte) error { } } case 10: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RewardTreasury", wireType) } - m.RewardTreasury = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2477,16 +2596,31 @@ func (m *EventBundleFinalized) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RewardTreasury |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardTreasury = append(m.RewardTreasury, types.Coin{}) + if err := m.RewardTreasury[len(m.RewardTreasury)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardUploader", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardUploaderCommission", wireType) } - m.RewardUploader = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2496,16 +2630,31 @@ func (m *EventBundleFinalized) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RewardUploader |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardUploaderCommission = append(m.RewardUploaderCommission, types.Coin{}) + if err := m.RewardUploaderCommission[len(m.RewardUploaderCommission)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 12: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RewardDelegation", wireType) } - m.RewardDelegation = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2515,16 +2664,31 @@ func (m *EventBundleFinalized) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RewardDelegation |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardDelegation = append(m.RewardDelegation, types.Coin{}) + if err := m.RewardDelegation[len(m.RewardDelegation)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 13: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RewardTotal", wireType) } - m.RewardTotal = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2534,11 +2698,26 @@ func (m *EventBundleFinalized) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RewardTotal |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardTotal = append(m.RewardTotal, types.Coin{}) + if err := m.RewardTotal[len(m.RewardTotal)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 14: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field FinalizedAt", wireType) @@ -2622,6 +2801,40 @@ func (m *EventBundleFinalized) Unmarshal(dAtA []byte) error { } m.NextUploader = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardUploaderStorageCost", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardUploaderStorageCost = append(m.RewardUploaderStorageCost, types.Coin{}) + if err := m.RewardUploaderStorageCost[len(m.RewardUploaderStorageCost)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) diff --git a/x/bundles/types/expected_keepers.go b/x/bundles/types/expected_keepers.go index f074c129..2213fa71 100644 --- a/x/bundles/types/expected_keepers.go +++ b/x/bundles/types/expected_keepers.go @@ -49,7 +49,7 @@ type DelegationKeeper interface { } type FundersKeeper interface { - GetCoinWhitelist(ctx sdk.Context) (whitelist []types.WhitelistCoinEntry) + GetCoinWhitelistMap(ctx sdk.Context) (whitelist map[string]types.WhitelistCoinEntry) ChargeFundersOfPool(ctx sdk.Context, poolId uint64, recipient string) (payout sdk.Coins, err error) } diff --git a/x/bundles/types/params.pb.go b/x/bundles/types/params.pb.go index 0bc8581c..0bbfba61 100644 --- a/x/bundles/types/params.pb.go +++ b/x/bundles/types/params.pb.go @@ -26,9 +26,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // StorageCost defines the cost for storage providers type StorageCost struct { - // storage_provider_id ... + // storage_provider_id is a unique identifier for each storage provider, such as Arweave, Irys, Filecoin, etc. StorageProviderId uint32 `protobuf:"varint,1,opt,name=storage_provider_id,json=storageProviderId,proto3" json:"storage_provider_id,omitempty"` - // cost ... + // cost is the amount in USD to store one byte on the storage provider. This value should be kept up-to-date. Cost cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=cost,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"cost"` } diff --git a/x/bundles/types/types.go b/x/bundles/types/types.go index 2d2cdce7..700ee52f 100644 --- a/x/bundles/types/types.go +++ b/x/bundles/types/types.go @@ -1,5 +1,7 @@ package types +import sdk "github.com/cosmos/cosmos-sdk/types" + type VoteDistribution struct { // valid ... Valid uint64 @@ -15,13 +17,15 @@ type VoteDistribution struct { type BundleReward struct { // treasury ... - Treasury uint64 - // uploader ... - Uploader uint64 + Treasury sdk.Coins + // uploader storage cost ... + UploaderStorageCost sdk.Coins + // uploader commission... + UploaderCommission sdk.Coins // delegation ... - Delegation uint64 + Delegation sdk.Coins // total ... - Total uint64 + Total sdk.Coins } // GetMap converts to array to a go map which return the upgrade-height for each version. @@ -47,7 +51,7 @@ const ( type TallyResult struct { Status TallyResultStatus VoteDistribution VoteDistribution - FundersPayout uint64 + FundersPayout sdk.Coins InflationPayout uint64 BundleReward BundleReward } diff --git a/x/funders/types/params.pb.go b/x/funders/types/params.pb.go index 11bb9fc4..4493ce71 100644 --- a/x/funders/types/params.pb.go +++ b/x/funders/types/params.pb.go @@ -36,7 +36,8 @@ type WhitelistCoinEntry struct { // min_funding_amount_per_bundle is the minimum required amount of this denom // that needs to be funded per bundle MinFundingAmountPerBundle uint64 `protobuf:"varint,3,opt,name=min_funding_amount_per_bundle,json=minFundingAmountPerBundle,proto3" json:"min_funding_amount_per_bundle,omitempty"` - // coin_weight is a factor used to sort funders after their funding amounts + // coin_weight is a factor used to sort funders after their funding amounts. + // This should be the market price of the coin in USD/coin. This value should be kept up-to-date. CoinWeight cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=coin_weight,json=coinWeight,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"coin_weight"` }