Introduction
FixedFi is a DeFi protocol built using CosmWasm contracts that lets anyone access to fixed yield on their assets.
Split a yield bearing asset into principle token (pToken) and yield token (yToken) and yToken can be sold at a fixed price to fix the future yield and to get it now.
Users can even buy the pToken at discount w.r.t. undelying asset to get fixed yield without holding a yield bearing asset or having exposure to the yield or source of yield (the protocol).
User stories
Switching from variable yield to fixed yeild
- A ybToken got from depositing Token to a yield generating DeFi protocol.
- Deposit ybToken into FixedFi to get pToken and yToken for fixed duration (example: 6 months).
- yToken represents the yield for the next 6 months which is variable.
- pToken represents the underlying asset locked up for 6 months.
- Sell the yToken at current market price through the AMM and fix the amount of yield for next 6 months.
- After 6 months unlock the underlying token from pToken.
Getting assets at discount (fixed APR with lock period)
- Instead of buying the asset, buy the pToken of that asset.
- pToken in the AMM is always at a dicount from underlying asset.
- The discount is due to lockup period (example 6 months) and separation of yield for that period.
- Directly buying pToken fixes the discount, hence fixing the yield on that asset for next 6 months.
- After 6 months, unlock the asset from the pToken.
- As time progresses, the price of pToken will steadily increase and will match the underlying at expiry.
- The amount of discount is proportional to the expected yield which is seprated using yToken.
Speculating on yield changes
- yToken is selling at a fixed price at a time through the AMM.
- The price represents the average yield over lock time that market expects.
- If user belives that the yield can go up in future that buying the yToken can give a positive APR.
- Buying more of yToken gives higher exposure to the future variable yield.
Compiling contracts
Use this command to compile your contracts:
$ wasmkit compile
Running script
$ wasmkit run scripts/sample-script.ts
Deploying contracts
In scripts/
directory:
First of all you need to create an instance of your contract using contract name.
const contract = new Contract('sample-project');
// To deploy your contract
const deploy_response = await contract.deploy(account);
// To initialize your contract
await contract.instantiate({"count": 102}, "deploy test", account);
Note: You can check out your contract information in deploy_response
.
Interacting with contracts
wasmkit
will load functions using schema, you can call contract functions using contract.tx
(to execute transactions) and contract.query
(to query from contract).
// To interact with your contract
// Execute contract function
await contract.tx.increment(account);
// View count in contract
await contract.query.get_count();