dualSTAKE Overview
dualSTAKE is a family of liquid staking tokens on Algorand that convert protocol staking rewards from ALGO to ASAs.
Each dualSTAKE token pairs ALGO
and an ASA into a dual liquid staking token:
gobtcALGO
dualSTAKE =ALGO
+goBTC
coopALGO
dualSTAKE =ALGO
+COOP
cosgALGO
dualSTAKE =ALGO
+COSG
- etc
dualSTAKE tokens are always at 1:1 rate with
ALGO
, and accrue rewards in the form of an increasing exchange rate with the paired ASA.
In a nutshell:
- Users stake
X ALGO
+Y ASA
, receivingX
dualSTAKE tokens. - dualSTAKE smart contracts participate in consensus.
- Consensus staking rewards are automatically swapped from
ALGO
into the paired ASA. - Users later redeem
X
dualSTAKE tokens forX
ALGO, plusZ ASA
. Assuming rewards have accrued since the user minted, theZ
quantity received will be higher than the initialY
quantity deposited.
Why dualSTAKE?
Benefits for ASA creators:
- Leverage your community's
ALGO
into a steady stream of buying pressure for your ASA- Incentivize your dualSTAKE token with a permissionless ASA farm
- Run your dualSTAKE node for 4% node runner fees (paid in
ALGO
) - Provide utility for your ASA via the implicit dualSTAKE token soft-lock
Benefits for users:
- Stake
ALGO
+ ASA, accrue rewards in your favorite ASA - Benefit from dualSTAKE farms offering higher APR (where available)
Read more about how dualSTAKE works or navigate to a specific section using the menu.
How it Works
For the purposes of this section, we will use ORA
as the paired dualSTAKE asset.
The ORA
dualSTAKE token is called oraALGO
.
- Each
oraALGO
unit is backed byALGO
at a rate of 1:1 - Each
oraALGO
unit is backed by an increasing amount ofORA
oraALGO
issuance is fully managed by a smart contract. Different tokens are managed by independent contracts, without co-mingling.
A typical user journey with a dualSTAKE token like oraALGO
would consist of:
- minting dualSTAKE (e.g.
oraALGO
) by depositingALGO
+ORA
- (later on) redeeming their
oraALGO
dualSTAKE tokens forALGO
+ moreORA
.
Between points 1 and 2, the dualSTAKE contract would receive staking rewards from block production, which are immediately swapped into the paired ASA, increasing the ORA
amount backing each unit of oraALGO
. The amount of staked ALGO
remains constant.
dualSTAKE supports farms, which pay out an additional amount in the paired ASA for each block produced, resulting in a higher APR. Farms are permissionless and can be created or extended by anyone.
Read more about minting or navigate to a specific section using the menu.
Minting
Users stake in a dualSTAKE contract by minting dualSTAKE tokens. This requires depositing ALGO
and some of the paired ASA into the dualSTAKE smart contract.
Using coopALGO
as an example, a user would mint by depositing:
ALGO
at a fixed 1:1 rateCOOP
at the current exchange rate
In return, they receive an equal amount of coopALGO
tokens to the ALGO
they deposited.
Minting does not incur any platform fees.
E.g. If coopALGO
is at 10:1 with COOP
, the user would deposit 10 ALGO
+ 1 COOP
to receive 10 coopALGO
tokens.
Not sure what this is all about? Start over from the overview page.
Continue to: "Where does the yield come from?" or navigate to a specific section using the menu.
Staking Rewards
Where does the yield come from? Short answer: Algorand staking rewards, converted to your favorite ASA permissionlessly. Additional rewards can accrue from our permissionless dualSTAKE farms.
A dualSTAKE smart contract delegates its escrow account's voting power to a node runner, in order for them to participate in consensus on its behalf.
As blocks are proposed by the node:
- The Algorand protocol distributes
ALGO
rewards into the smart contract escrow account - The
ALGO
rewards are swapped into the ASA (e.g.ORA
) through a pre-configured AMM pool (e.g. Tinyman v2ALGO/ORA
) - Each circulating dualSTAKE token (e.g.
oraALGO
) is now worth more in the paired ASA (e.g.ORA
)
These swaps create buying pressure on the paired token, and serve as a steady cost averaging buy strategy for users.
Platform and node runner fees are taken from the staking rewards, pre-swap.
Swapping is triggered in one of two ways:
- Our backend systems will call the contract to perform the
ALGO
-ASA
swap whenever a block is produced - Or, automatically before minting or redeeming dualSTAKE tokens
This way, even if our backend systems lag behind or are offline, you can be sure that the dualSTAKE exchange rate is correct.
Continue to: Redeeming dualSTAKE tokens or navigate to a specific section using the menu.
Redeeming
Users can redeem their dualSTAKE tokens at any time. Redeeming breaks dualSTAKE up into their component ALGO
+ASA parts and returns them to the user.
Using oraALGO
as an example:
Users can redeem their oraALGO
tokens via the smart contract and receive the backing ALGO
(at 1:1) and ORA
(at current rate).
Assuming staking rewards have accumulated between minting and redeeming, the ORA
amount withdrawn during redemption will be larger than the deposited amount during mint.
E.g. Alice minted 100 oraALGO
by depositing 100 ALGO
and 1 ORA
. Some time later, oraALGO
has appreciated against ORA
, so she redeems her 100 oraALGO
tokens for 100 ALGO
, plus 3.14 ORA
.
Not sure what this is all about? Start over from the overview page.
Minting and redeeming do not incur platform fees, so users should always receive at least as much ALGO
and ORA
as they deposited.
Continue to: "Protesting" or navigate to a specific section using the menu.
Protesting upgrades
dualSTAKE contracts support smart contract code upgrades under certain guardrails.
The intent behind upgradability is to evolve dualSTAKE with more features, such as support for new AMMs, multiple node runners, etc.
Code upgrades can change the rules of the system, as well as set funds in jeopardy. For this reason, code upgrades are time-delayed by 2 weeks, and the Myth Finance team will present the upgraded code in advance. The integrity of the (scheduled) upgrade will be guaranteed via cryptographic hashes - which means that we will be bound to upgrade only to the version we present.
As a user, you can protest a scheduled upgrade with your dualSTAKE tokens:
"Protesting" enables users to signal that a scheduled upgrade is a deal-breaker for them.
Protesting stake is locked up on the dualSTAKE contract in order to soft-block the upgrade.
For the upgrade to proceed, protesting stake must first be returned to users in ALGO+ASA form ("dissolved")
How it works
Users wishing to protest a proposed upgrade can do so by locking up their dualSTAKE tokens on the contract.
Before a smart contract upgrade can take place, all protesting user tokens must be "dissolved", i.e. redeemed and returned to the protesting users in ALGO
+ASA form.
Protesting stake dissolution takes place before the upgrade and is enforced by the smart contract code. When dissolving protesting stake, funds flow from the contract directly to the user, without intermediation by the platform operator.
An upgrade can not take place unless:
- 2 weeks have elapsed since it was scheduled
- All protesting stake has been dissolved, i.e. redeemed and returned to protesting users
If enough stake is locked up as protesting, the platform operator may choose to cancel a planned upgrade, in which case the protesting stake will be sent back to users in dualSTAKE form, e.g. oraALGO
.
Note: if protesting users have opted out of the dualSTAKE asset, or the paired asset, these will be delivered to their ARC-59 asset inbox.
Rate
dualSTAKE tokens are backed by ALGO
and their paired asset, with a different exchange rate for each.
Minting dualSTAKE tokens will require the equivalent amounts of both tokens, and similarly redeeming will yield the equivalent amounts of both tokens.
The formula to determine the exchange rate of the dualSTAKE token to the paired assets is:
\[1\ dsALGO=1\ ALGO+\frac{Paired\ ASA\ Balance}{Staked\ ALGO}ASA\]
Where:
dsALGO
refers to a specific dualSTAKE token, e.g.oraALGO
Paired ASA Balance
refers to the amount of the paired ASA held by the smart contract, e.g. 300ORA
Staked ALGO
refers to theALGO
deposited by users- Not including accumulated platform or node runner fees
Example
Assuming the oraALGO
dualSTAKE contract has:
- 30,000
ALGO
staked - 10,000
ORA
balance
Then:
\[1\ oraALGO=1\ ALGO+\frac{1}{3}ORA\]
Initial ASA exchange rate
Usually, the initial dualSTAKE:ASA exchange rate will be zero, but in some cases a community intending to provide a generous farm may choose to bootstrap a dualSTAKE token with a non-zero exchange rate for their ASA.
This would impose a requirement to deposit some of the asset when minting the dualSTAKE token "at time zero", before rewards have started accumulating.
Fee Structure
Minting & redeeming do not incur any platform fees. The only fees you will be charged during these operations are network transaction fees.
Instead, fees are taken from consensus rewards, before they are swapped to the ASA.
The reward fees consist of platform fees and node runner fees:
Platform fees
The Myth Finance platform is allocated some fees on each rewards distribution.
The percentage is configurable throughout the lifetime of the contract, and can be seen under the global storage key platform_fee_bps
. This value is basis points, so you can divide by 100 to get the percent fee. The initial value 300
corresponds to 3.0%
.
There are mechanisms in place to protects dualSTAKE users from the operator changing platform fees abruptly, see Immutability - Fee Rate.
Node runner fees
The node operator is allocated some fees on each rewards distribution. As above, this is expressed in basis points under the noderunner_fee_bps
global storage field, and the same update mechanism applies.
The default node runner fee will be 400
bps, or 4%
.
Typically, ASA communities will operate their own nodes, and benefit from these fees. You can read more about node running in this section.
Example fee allocation from reward disbursement
Assuming these hypothetical fees:
- Platform fee rate: 3.0%
- Node operator fee rate: 4.0%
Then a staking reward disbursement of 10.5 ALGO
would be allocated as such:
- Staking rewards deposited: 10.5
ALGO
- Platform fee: 0.315
ALGO
- Node operator fee: 0.42
ALGO
- Net amount to be swapped into ASA: 9.765
ALGO
Withdraw model
Platform and node operator fees are not paid immediately. Instead they remain in the contract escrow account until they are withdrawn by the respective operator.
This serves multiple purposes:
- fewer required transaction fees
- contributing to the voting power of the dualSTAKE escrow address in consensus
- fewer taxable events for the platform and node runners
Creating dualSTAKE contracts
Currently, creating dualSTAKE contracts is a manual process.
Please reach out to the team if you are interested in creating a dualSTAKE token for your ASA.
A number of preconditions must be met to ensure that the protocol functions as expected:
- Sufficient decimal precision for assets
- Assets with low decimal precision may not be suitable for this version of dualSTAKE.
- Liquidity pool must be chosen correctly
- Currently, tinyman v2 liquidity pools are supported
- Changing the LP requires a smart contract upgrade
- A shallow pool without deep liquidity may result in inefficient swaps resulting in loss of rewards to arbitrage
- Currently, tinyman v2 liquidity pools are supported
- Initial Exchange Rate
- A non-zero initial exchange rate is supported, but should only be used in case of significant farming provision
- Asset information
- Asset unit names are currently chosen manually.
- The AVM restricts this field to 8 characters maximum length, requiring flexibility in naming dualSTAKE units for assets with longer names (e.g.
$MONKO
)
Farm provision
dualSTAKE farms offer your users a higher overall APR in return for choosing to stake on your dualSTAKE token over other appealing liquid staking options in the ecosystem.
dualSTAKE farms can be configured to pay out an extra amount of the paired ASA for each block produced by dualSTAKE contracts.
Farms are permissionless, immutable and extendable:
- anyone can set them up
- once set up, farms can not be cancelled
- anyone can extend an existing farm by contributing more ASA
Farms complete the synergy between your ASA and its dualSTAKE form. Read about the benefits of providing farms below.
Note: Farms only support the paired ASA of each dualSTAKE contract, e.g. gobtcALGO
farms are only compatible with goBTC
.
Farming benefits
As an ASA creator or community, dualSTAKE farms allow you to utilize your ASA treasury into a buying pressure incentive.
- increase the APR of your dualSTAKE token, making it more competitive.
- more ALGO locked ➡ stronger buying pressure.
- provide additional soft-lock utility to your ASA via dualSTAKE
Offering a higher APR compared to competing staking options will incentivize your users to stake their ALGO
on your community's dualSTAKE token. More ALGO
staked means more blocks produced, which results in more frequent swaps, producing stronger buying pressure on your ASA.
As rewards accumulate and are swapped, the exchange rate of the dualSTAKE token to the ASA increases globally for all holders, current and future. As a secondary benefit, minting new dualSTAKE tokens will require more of the ASA as time moves on, which provides a soft-lock utility for tokens making use of this system.
Running a dualSTAKE node
dualSTAKE contracts currently operate with a single escrow account. A node runner is appointed to participate on behalf of dualSTAKE by the ASA leadership or Myth Finance.
ASA communities are expected to operate their nodes and reap the additional rewards:
Node runners accrue fees from rewards, in ALGO. Fees can withdrawn at any time. The default node runner fee is 4%, though this can be configured under the protocol safeguards.
The node runner account can:
- change the participation keys of the contract, as well as the online/offline state.
- change the node runner account to another address
- withdraw accrued node runner fees
The "fee admin" role held by Myth Finance can also perform these actions.
Note: at launch, myth nodes may run the dualSTAKE contracts for a brief period, until the web interface for node management is complete.
Roadmap feature: Monitoring & Intervention
In the future, we intend to develop monitoring for node runners' consensus participation. If a node is not participating properly over an extended period of time, a Myth node will be temporarily allocated to the dualSTAKE pool (without changing the node runner fees/manager account)
The node runner must then restore their node to proper operation and issue a new key registration with their keys to take back control from the myth finance backup node.
If they fail to restore in good time, the node runner account will be changed on the contract to a new runner. Accrued fees will be distributed to the node runner before this change.
Immutability
Smart contract code
Smart contract code is upgradable with a 2 week time-lock.
The hashes of the proposed code upgrade will be published in advance for review by the community, along with the contract source code that produces them.
The smart contract will only accept a code upgrade that matches the published hashes (stored in the contracts' global storage) after the time lock elapses.
Users who do not agree with the contract upgrade can redeem their dualSTAKE tokens immediately, but they can also signal their disagreement without exiting the system by "protesting" with their stake.
Technical details
Scheduled contract upgrades can be seen in the global storage variable contract_upgrade
, which has the following structure:
0: [4 bytes] timestamp_applicable uint32
4: [32 bytes] approval_page_1_hash bytes
36: [32 bytes] approval_page_2_hash bytes
dualSTAKE smart contract code may exceed 4KB, which is the largest value that can be hashed in the AVM. For this reason, the program is hashed in 4KB "pages". When an upgrade takes effect, each 4KB-sized program page is hashed with SHA512/256 and compared against the stored hash in the contract_upgrade
storage value. The upgrade is only allowed to take effect if all hashes match.
Fee Configuration
Platform and node runner fees are configurable. Fee increases are time-delayed, whereas fee decreases take effect immediately.
The "fee admin" role, controller by the Myth Finance team, will be able to increase the fee rates:
- with a time delay of 2 weeks before effect
- with a maximum change of +2.5% from the previous value
This protects dualSTAKE holders from the Myth Finance team being able to immediately change the fee rate to 100%, which would compromise their rewards.
Platform and Node operator Fee Rates
Aside from the Myth Finance frontend, fee rates and parameters can be found in dualSTAKE contracts' global state variables.
- Platform fee rate value:
platform_fee_bps
(in basis points) - Node runner fee rate value:
noderunner_fee_bps
(in basis points) - Maximum change:
fee_update_max_delta
(in basis points, as % change) - Time-delay duration for fee increases:
fee_update_period
(in seconds)
Changing scheduled updates
If an update is issued while a previous update is scheduled, the timer will reset.
Updates can also be staggered, e.g. the platform fee rate and the node runner fee rate values can be part of the same update.
The update will be applied automatically after the update timestamp elapses, either explicitly by a platform operator, or when the contract is first called to mint or redeem by any user.
Scheduled updates will be stored as in the next_params_update
global storage value.
The structure of this field is:
0: [8 bytes] timestamp_applicable uint64
8: [8 bytes] node_runner_fee_rate uint64
16: [8 bytes] platform_fee_rate uint64
Immediately updatable parameters
Admin role account
The admin address admin
will be mutable by the admin
role with immediate effect. Changing admin requires two transactions in an atomic group, one from the current admin and one from the future admin. This aims to eliminate the possibility of operator error.
Fee admin
The fee admin address fee_admin
will be mutable by the admin
and fee_admin
roles with immediate effect.
Node runner
The node runner address noderunner
will be mutable by the noderunner
and fee_admin
roles with immediate effect.
Changing the node runner address requires withdrawing node runner fees. This prevents the fee admin role from subverting the node runner fees.
Fee Decreases
Fees can be decreased immediately as described above.
Roles
The dualSTAKE smart contract has a number of privileged roles that can perform authorized actions:
Admin
A high security account, i.e. hardware wallet or multisig controlled by the Myth Finance team.
Can perform the following actions:
- Schedule a smart contract upgrade
- Execute vested smart contract upgrade (shared with
fee admin
role) - Cancel smart contract upgrade (shared with the
fee admin
role) - Change
admin
role address - Change
fee admin
role address (shared with thefee admin
role)
Fee Admin
A lower-security account controlled by the core team.
Can perform the following actions:
- Execute vested smart contract upgrade (shared with
admin
role) - Cancel smart contract upgrade (shared with the
admin
role) - Change
fee admin
role address (shared with theadmin
role) - Schedule fee update
- Cancel queued fee update
- Withdraw platform fees
- Withdraw node runner fees to node runner address (shared with
node runner
role) - Perform keyreg online transaction (shared with
node runner
role) - Perform keyreg offline transaction (shared with
node runner
role) - Change node runner address (shared with
node runner
role)- Condition: node runner fees must be fully withdrawn
- Dissolve protesting stake
- In order to execute a protested upgrade
- Return protesting stake
- After a protested upgrade is cancelled
Node runner
Account controlled by node runner. Used to withdraw fees and manage key registrations.
- Change node runner address (shared with
fee admin
role)- Condition: node runner fees must be fully withdrawn
- Withdraw node runner fees (shared with
fee admin
role) - Perform keyreg online transaction (shared with
fee admin
role) - Perform keyreg offline transaction (shared with
fee admin
role)
Transaction fees
Users pay for their own transaction fees, e.g. during minting and redeeming.
The smart contract pays for its own inner transaction fees when swapping (0.003 ALGO
)
Node runners (or fee admins) pay for the key registration fees.
Contract Storage & Immutable parameters
TBD
Contract ABI
TBD
Typescript SDK
Developers can use the published Typescript SDK to interact with dualSTAKE contracts programmatically.
The SDK has complete support for all operations that the contracts support, including node runner, fee admin and admin operations.
Audit
We intend to obtain an informal audit of the smart contracts by experienced AVM developers.
The dualSTAKE smart contracts will be open sourced under a non-permissive license.
Links
Documentation ⬅ You are here
For contact details see Contact
Contact
Email: [email protected]
Security contact: [email protected]
PGP key available upon request.
Social Media
We are on X.com as @Myth_Finance. This is the primary place to get updates, and you can DM us for support.
Discord-wise, we are generously hosted on the premier user community for DeFi on Algorand, Dragon Fi. You can use this invite link which should take you to the Myth Finance > General Chat
channel.
We are not on Telegram or Reddit as of yet.