- fCash is Notional's zero-coupon bond like instrument and derives its value from time to maturity and current interest rate levels:
-
Time to maturity is the time in seconds to a fixed date, where the fCash can be settled into cash
-
There's a notional native market for interest rates that mostly depends on lending vs borrowing volume. This market works as an AMM using the pair (fToken / cToken). A priori, the pair is not expected to have a high volatility, so they provide a curve that works very flat and doesn't trade at pre defined conditions that are considered as limits. Those values are set by governance and currently is ~20% for stablecoin and ~15% for crypto asset pools: .
-
The value of fCash is calculated as
PV(fCash) = fCash * e^ - (oracleRate * timeToMaturity)
-
- Oracle rate is defined by the previous AMM, they provide a TWAP to protect from flash loan attacks. **T
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lockModifyPosition(PoolKey memory key, IPoolManager.ModifyPositionParams memory params) public { | |
poolManager.lock(abi.encodeCall(this.__performModifyPosition, (key, params, msg.sender))); | |
} |
All the actions we need to interact with are pretty well summarized here: https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/INonfungiblePositionManager.sol
constructor()
:- Calls
mint
and creates a new NFTPosition, with a NFT position id, all the bellow params will be included (most of them part ofINonFungiblePositionManager
.
- Calls
- Input params:
Given the integrations above, the following example shows how we could manag
- Collateralized assets and debt could be modeled as a single asset (CDP)
- The CDP value would be calculated as:
CDP_VALUE = Σ COLLATERAL_ASSET_VALUE - DEBT
- With this new implementation,
GAV
would be calculated as:GAV_NEXT = GAV_CURRENT + Σ CDP
, where current and next represent thecurrent
andnext
release.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity 0.6.12; | |
interface IComptroller { | |
function callOnExtension( | |
address, | |
uint256, | |
bytes calldata | |
) external; |
This gist has some thoughts on a general solution to enable borrowing.
The exercise is divided in the following sections.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Value | Mnemonic | Gas Used | Subset | Removed from stack | Added to stack | Notes | Formula Notes | |
---|---|---|---|---|---|---|---|---|
0x00 | STOP | 0 | zero | 0 | 0 | Halts execution. | ||
0x01 | ADD | 3 | verylow | 2 | 1 | Addition operation | ||
0x02 | MUL | 5 | low | 2 | 1 | Multiplication operation. | ||
0x03 | SUB | 3 | verylow | 2 | 1 | Subtraction operation. | ||
0x04 | DIV | 5 | low | 2 | 1 | Integer division operation. | ||
0x05 | SDIV | 5 | low | 2 | 1 | Signed integer division operation (truncated). | ||
0x06 | MOD | 5 | low | 2 | 1 | Modulo remainder operation | ||
0x07 | SMOD | 5 | low | 2 | 1 | Signed modulo remainder operation. | ||
0x08 | ADDMOD | 8 | mid | 3 | 1 | Modulo addition operation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.reddit.com/r/ethereum/comments/6c1jui/delegatecall_forwarders_how_to_save_5098_on/ | |
https://ethereum.stackexchange.com/questions/47174/does-it-cost-more-gas-to-call-another-contracts-functions-in-solidity | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.6.8; | |
/// Trying to answer the question: Is it more expensive to check variable from a constant or from a memory variable? | |
/// The answer is that they both have near 0 gas costs (191 vs 213 gas) but checking from constant gives a lower value | |
contract externalContract { | |
uint256 storedConstant; | |
I hereby claim:
- I am carlos-buendia on github.
- I am buendiadas (https://keybase.io/buendiadas) on keybase.
- I have a public key ASARaaiZS6QVsGHGOYvOevUWa40GZ45_e7toYnro6WSvUAo
To claim this, I am signing this object:
NewerOlder