Skip to content

program: allow sol deposit #46

@2501babe

Description

@2501babe

svsp maintains 100% capital utilization (no undelegated float), mints tokens immediately on deposit, and charges no fees. this works great for stake deposits, but it has blocked us from accepting sol deposits because of economic attacks related to the immediate mint. ive contemplated various rube goldberg machines to work around this via delayed stake deposits that "feel" like sol deposits (default deposit accounts were one attempt to support such a flow) but this is confusing for devs, let alone users

im one year older and one year wiser now and a lot less dogmatic about the no fees thing. stake deposit will always be free, but sol deposit is a convenience, its fine to charge 5-10bps for the service (by underminting tokens thus giving the fee to the pool as a whole)

we do not want to have a reserve account and will never allow sol withdrawal. the design im envisioning is two new instructions and one onramp stake account per pool:

  • DepositSol: send user sol to the onramp account, mint tokens
    • if the account doesnt exist, fund rent and initialize. this only ever needs to be done once per pool, and we only have to do it here for backwards compat
    • if the account exists and is initialized or deactivated, delegate it after sending sol
    • if the account exists and is active, move the active stake to the main pool account, either via the second instruction or via stake program directly, and then delegate it again after sending sol
    • if the account exists and is activating, no special behavior is needed
  • MergeSolDeposits: except dont call it "merge" because i want to use MoveStake. sweep active onramp stake into the main pool account. permissionless, probably idempotent. maybe reserve a small/capped portion of the deposit fee to incentivize people to turn the crank on low volume pools

create the onramp account in Initialize and check it in Reactivate

also probably deprecate default deposit accounts, the point of that feature was to allow "one click to stake" following a similar sweep-and-delegate flow, just on an individual user basis. the idea was users who regularly add stake to the same validator would get the tokens for their prior epoch delegations at the same time they make a new delegation. but this requires wallets/dapps to implement the flow, and based on conversations since v1.0 was finished, i dont think anyone even really understands it. getting rid of it once we have a superior alternative that requires no outside support makes sense

overall this sounds very similar to multistake, and if we ever do do multistake, it should be easy to ditch the onramp account and swap backends without breaking the instruction interfaces

(will consider whether to do this after simd83 and simd186, based on what we think user uptake might be)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions