Advanced Use-Cases
Managing, deploying, and customising a specific pool are advanced use-cases that offer the full capability of creating money markets with parameters of their choice, at their own will
Deploying A Pool*
Programmatic pool creation is offered as an alternative to the UI flow we have implemented at https://app.midascapital.xyz/[chainId]/create-pool
deployPool
deployPool
Arguments:
poolName: string
: canonical pool name. Can be edited by the pool's owner at a later pointenforceWhitelist: boolean
: whether to limit pool interactions to a set of whitelisted addressescloseFactor: BigNumber
: the pool's Close Factor. See Compound Finance docs for more informationliquidationIncentive: BigNumber
: incentive given to the liquidators as profit for liquidating an unhealthy loan. Compound Finance docspriceOracle: string
: contract address of the price oracle to be usedpriceOracleConf: OracleConf
: currently unusedoptions: { from: string }
: from address from where to make the callwhitelist: string[]
:An array of whitelisted addresses
Returns:
Promise<[string, string, string, number?]>
: array of pool data, namely:the pool's address (also referred to as the pool's Comptroller address)
the Implementation Address: this is the Comptroller's implementation address. Every new pool will basically deploy a new Comptroller, the implementation of which is deployed once by Midas Capital, and is subject to upgrading
Price Oracle address
Pool ID
*NOTE: permissionless pool creation is currently unsupported -- as we are still in public beta, we are limiting the pool creation to only the Midas Team and selected partners. Get in contact with us if you'd like to get whitelisted for such functionality
Managing A Pool's Assets
One of the core tenants of the Midas protocol is the ability for pool operators to add support for any arbitrary asset* to their pools. This can be done via the ui at https://app.midascapital.xyz/[chainId]/pool/[poolId]/edit , but that is also achievable programmatically. Whether you're interested in creating a custom pool management UI for yourself, or enable other users to manage your pool, these functions should allow you to add and remove assets from the ones supported by the pool
deployAsset
deployAsset
Arguments:
irmConf: InterestRateModelConf
: configuration parameters for the asset's Interest Rate Modelconfig: MarketConfig
options: any
*NOTE: arbitrary assets are supported only insofar as these assets have a valid price oracle for them. Currently, Midas Capital controls which oracles are deployed. We strive however to support our partners in adding assets they wish to the set of assets that we can currently support. Get in contact with us if you'd like us to support more assets!
Running a Liquidity Mining Campaign
Every pool can be customised to be the source of a liquidity mining campaign. This provides pool operators a mechanism to incentivise borrows or lends of specific assets they have interest in making more widely available, as well as increasing TVL in their pool.
At its core, a liquidity mining campaign is based on a set of contracts named the Flywheel Contracts
initially developed by the folks from Fei Protocol, now part of the Tribe DAO. These sets of contracts can be conceived as a generalised token incentives infrastructure that enables directing tokens to users based on specific protocol interactions. You can read more about it here.
Step 1: Deploy Flywheel Core & Flywheel Static Rewards
First, we deploy the basic infrastructure
Step 2: Add the Flywheel to the pool
Then, we just need to add the newly deployed flywheel to the pool
Step 3: Set up rewards for specific market and set its emission schedule
Step 4: Fund the Flywheel with the tokens you'd like to emit
That's it! Now every time a user interacts with the specified market, the user will automatically accrue LM rewards.
A full-fledged run-down to how these are used can also be found in our tests for the SDK.
Querying Flywheels for Accrued Rewards
Running the liquidity mining campaign assumes also that pool operators can let users check the status of their rewards, how much has been accrued, and how much is claimable.
This is also the case for markets for which a an ERC-4626 strategy exists. Basically, the Flywheel contracts and the Flywheel SDK module are your one-stop-shop for letting users introspect, claim, and interact with any yield-bearing operation.
getFlywheelMarketRewardsByPoolWithAPR
getFlywheelMarketRewardsByPoolWithAPR
Arguments:
pool: string
: pool address (Comptroller) for which to query the rewardsoptions: { from: string }
: from address for which to query the rewards
Returns:
Promise<Array<
FlywheelMarketRewardsInfo
>>
Last updated