Vault manager
Last updated
Last updated
The vault manager works with vaults that are owned by the contract, which is also used by Oasis Borrow. This intermediary contract allows the use of incrementing integer IDs for vaults, familiar to users of Single-Collateral Sai, as well as other conveniences.
In the code, this is called .
The methods below are all asynchronous.
Return an array describing the vaults owned by the specified address. Note that if the vaults were created in Oasis Borrow, the address of the proxy contract should be used.
Get an existing vault by its numerical ID. Returns a .
A note on caching: When a vault instance is created, its data is pre-fetched from the blockchain, allowing the properties below to be read synchronously. This data is cached in the instance. To refresh this data, do the following:
The USD price of collateral at which the Vault becomes unsafe.
Whether the Vault is currently safe or not.
Deposit the specified amount of collateral.
Generate the specified amount of Dai.
Deposit some collateral and generate some Dai in a single transaction.
Pay back the specified amount of Dai.
Pay back all debt. This method ensures that dust amounts do not remain.
Withdraw the specified amount of collateral.
Pay back some debt and withdraw some collateral in a single transaction.
Pay back all debt, ensuring dust amounts do not remain, and withdraw a specified amount of collateral in a single transaction.
Look up the proxy contract owned by address
and transfer ownership of this vault to that proxy.
Open a new vault with the specified . Will create a if one does not already exist. Returns a . Works with the .
Open a new vault, then lock and/or draw in a single transaction. Will create a if one does not already exist. Returns a .
In the code, these are called .
The amount of collateral tokens locked, as a .
The USD value of collateral locked, given the current price according to the price feed, as a .
The amount of Dai drawn, as a .
All of the methods below are asynchronous and work with the . Amount arguments should be , e.g.:
Transfer ownership of this vault to address
. Note that if the new owner plans to use this vault with Oasis Borrow, it should be transferred to their proxy with instead.