Default Extension contract
Vesu comes with a already implemented extension which we call the factory extension or default extension.
In this article we explore this contract into more detail, to learn how to write our own extension contract and get some inspiration.
The interface we need to implement defines the functions
- singleton
- price
- interest_rate
- rate_accumulator
- before_modify_position
- after_modify_position
- before_transfer_position
- after_transfer_position
- before_liquidate_position
- after_liquidate_position
Let's see how the default extension implements it.
singleton
Returns the address of the singleton contract
fn singleton(self: @ContractState) -> ContractAddress {
self.singleton.read()
}