Replies: 4 comments 4 replies
-
Could you frame the problem we are trying to solve here? I guess it's paying fees for users who have locked tokens (when the transfers are disable on the network level)? |
Beta Was this translation helpful? Give feedback.
-
Alternative proposal (I will use deposit word instead of stake). Resource DepositsWe propose a resource staking mechanism to obtain a right to acquire and hold a resource (eg storage). FramingAdditional fee mechanism, which will be complementary for gas payments. MotivationSome messages would prefer to additionally require from a user to deposit (stake) tokens for a resource locked by the user. Once that resource is released, user will be able to get the tokens back. Notable examples:
Model
So, a deposit is a mapping of
The keeper will have following methods: // Depost will top up a user deposit by increasing total balance and locking
// tokens (tokens will be transferred from account to the deposit module account).
// Returns account deposit balance.
func (k Keeper) Deposit(module, key string, account Account, amount sdk.Int) Balance
// Withdraw decreases account deposit balance and transfers tokens from the
// deposit module back to the account.Returns account deposit balance.
func (k Keeper) Withdraw(module, key string, account Account), amount sdk.Int) Balance
// Require increases the account deposit used balance. Returns error
// if the used amount goes above the account total balance.
func (k Keeper) Require(module, key string, account Account, amount sdk.Int) error
// Release decreases the account deposit used balance. Returns error if
// the it goes below zero.
func (k Keeper) Release(module, key string, account Account, amount sdk.Int) error Examples:
Using gas style depositsIt will make sense to use deposits using gas price instead of tokens. So instead of The type Balance struct {
total: sdk.Int // denominated in the native currency
usedGas: sdk.Int // denominated in gas
} The invariant in The |
Beta Was this translation helpful? Give feedback.
-
Notably, these proposals preclude multi-denom fees without at least some base currency for any operations that require deposits. Looking more and more necessary to require native tokens for at least some actions. |
Beta Was this translation helpful? Give feedback.
-
Following up from #8224, I'd like to propose a new
x/deposit
module to specifically target the part of the spam problem that can be solved by redeemable deposits. Two specific cases where this could be applied right away would be the authorization and fee grants in the newx/authz
andx/feegrant
modules, where fees would need to be deposited in order to create a grant and where they would be returned when the grant is revoked. Creating a grant adds a small amount of persistent state that is freed when the grant is revoked so the idea with a deposit is to a) create a small but meaningful incentive to revoke grants when they're done rather than needing to implement a separate pruning layer and b) prevent spam.Deposit Keeper Interface
Modules would interface with the
x/deposit
module using theDepositKeeper
which would have three basic operations:RequireDeposit
,ReleaseDeposit
andSlashDeposit
.RequireDeposit method
Keepers would call the
RequireDeposit
method with:x/params
or some other mechanismEx:
Release Deposit
Calling
ReleaseDeposit
would turn the deposited amount for the provided deposit key/depositor pair.Ex:
Slash Deposit
A
SlashDeposit
method would also be available to slash all or part of the deposit in certain conditionsFee.deposit
fieldA
deposit
field would get added toFee
so that:deposit
field to every message which uses themx/feegrant
module -Allowance
s could have a flag which indicates whether they can be used for deposits or notDeposit pricing
The simplest model would be to have fixed base deposit amounts set by governance using
x/param
. In the future, if there is an algorithm like EIP 1559 for base fees, it could potentially be used as a scaling factor for deposit amounts, but that would be a research topic for the future.This module should be relatively straightforward to implement and could address part of the spam problem.
Beta Was this translation helpful? Give feedback.
All reactions