Transmuter is a CosmWasm contract that allows 1:1 conversion of one asset to another by establishing a new CosmWasm pool type.
Transmuter V2 adds to the functionality of these pools by adding key updates:
- Shares of the pool are tokenized as “Alloyed Assets”.
- Rate limits for the change in the quantity of contained assets.
Once instantiated with two assets, the contract functions as a pool with a fixed 1:1 ratio of token value, no matter the ratio of the assets in the pool.
For traders, this enables the Transmute function, which allows the exchange of 1 unit of value of a token they possess in the pool with 1 unit of value of any other token present in the pool without any slippage.
For liquidity providers, one token can be added to the pool in exchange for a representative token of that value held within the pool. Owners of the representative tokens can choose which asset to withdraw from the pool.
With zero slippage or fee, liquidity providers must either be altruistic or obtain an alternative benefit for adding tokens to the pool.
As Classic pools use a GAMM token to represent a share of the assets in the pool, a Transmuter v2 pool uses an Alloyed Asset denom.
While GAMM tokens can represent a differing amount of liquidity of a token depending on the initial deposit to the pool, Alloyed Assets are always representative 1:1 of a deposited token denom in the Transmuter pool. This is because all tokens in the Transmuter pool are worth 1:1 relative to each other.
These Alloyed Assets may then be used as a representative token of the basket of assets contained within the Transmuter pool. Whether an Alloyed Asset is considered to be the Canonical representation of the asset on the chain will depend on Osmosis governance approving the pool settings.
The usage of Alloyed assets in alternative locations will provide an incentive for liquidity providers to keep both sides equally populated. For example, an Alloyed version of USDC paired with the native version at a low swap rate will enable a liquidity provider to hold a yield bearing USDC position with exposure only to the USDC asset and a lower bridge risk of the constituent tokens. They would then be incentivized to ensure that the Alloyed asset remained well balanced to minimize risk and maximize trading activity.
Example of Alloyed Asset user flow
For a hypothetical FOO.Alloyed representative share of a transmuter pool consisting of both FOO.Bridge1 and FOO.Bridge2 tokens.
1 FOO.Alloyed = 1 FOO.Bridge1 = 1 FOO.Bridge2.
The user flow for swapping from a deposited FOO.Bridge1 asset would be identical to a deposited FOO.Bridge2 token in that both would join the Transmuter pool in exchange for the FOO.Alloyed representative asset.
Leaving the chain would similarly redeem FOO.Alloyed for the preferred amount of FOO.BridgeX and be able to cross the bridge to the destination chain.
This process will take place within the swapping action at first, meaning that swapping by starting at a bridged asset or the alloyed asset would appear identical. The withdrawal and deposit process is manual at launch but may be further integrated using hooks in the future to abstract away the bridging action.
The Transmuter pool has built-in rate limitation settings which can prevent the ratio of tokens from changing excessively in a set period, this prevents an issue with one constituent from draining the effective liquidity of the pool.
There are two types of limiters in place
- Change Limiter determines the maximum percentage of an asset permitted to leave the pools based on the moving average of the asset’s weights over a specified period.
- Static Limiter determines the maximum percentage of the pool allowed to be a specific asset, preventing imbalance from occurring or minimizing the exposure of the Alloyed asset to a particular constituent.
The FOO.Alloyed pool is composed of 50% FOO.Bridge1 and 50% FOO.Bridge2.
FOO.Bridge1 is compromised, and token supply on Osmosis suddenly increases due to this.
The FOO.Alloyed pool has a Change Limiter in place of 10%/Day, 30%/Week and a Static Limiter in place of 0.6.
On Day 1 the Change Limiter is hit, causing the imbalance to be frozen at 0.55 Bridge 1 and 0.45 Bridge 2.
On Day 2 the Change Limiter would trigger at 0.605, however the Static Limiter caps the imbalance at 0.6, effectively freezing the pool until governance resolves the situation.
This limits the amount of compromised FOO.Bridge1 that can be disposed of on Osmosis, allowing the governors of Bridge 1 time to repair the issue, and recover or resupply underlying funds if possible.
The Admin Role can perform the following tasks:
Delegate Set Active Status
This allows the Admin to delegate a Moderator address to have the ability to disable the transmuter pool entirely in the event of an emergency or to retire unused pools. This will freeze the contents of the pool as no messages can be run apart from enabling the Active Status again. This delegation allows either the wider Osmosis DAO or a large subDAO the ability to handle Metadata and Limiter settings, whilst retaining rapid response by a smaller subDAO in an emergency.
Set Alloyed Metadata
This allows the on-chain metadata for how the Alloyed Asset is displayed to be adjusted, for example the displayed denom, description and ticker.
This allows the limiters above to be created, removed or modified. These must be set appropriately for normal trading to not be impacted whilst minimising the impact of a security issue in any of the constituent assets.
Compiler Version: cosmwasm/workspace-optimizer:0.14.0
Commit ID: a4cfd53c105bfbd7e52d63b93337932431023a0b
Target On-chain Date: 17th October 2023