VaultTracker
A TypeScript wrapper for the VaultTracker smart contract.
Overview
The VaultTracker contract wrapper allows a user to fetch vault information for a particular market and owner.
Vault information is returned in a struct of the following shape:
Vault
Creating a VaultTracker instance
The snippet below illustrates how you can create a VaultTracker instance and what information you need to do so.
Properties
address
Holds the current contract address used by the VaultTracker instance.
Signature
Getters
admin
Allows a user to get the admin address of this VaultTracker. This is the address of the MarketPlace smart contract that owns this VaultTracker.
Signature
Returns
A promise that resolves with the admin address if the contract call succeeds and rejects otherwise.
swivel
Allows a user to get the Swivel contract address associated with this VaultTracker.
Signature
Returns
A promise that resolves with the Swivel contract's address if the contract call succeeds and rejects otherwise.
maturity
Allows a user to retrieve the vault's maturity. This is a Unix timestamp in seconds.
Signature
Returns
A promise that resolves with the vault's maturity if the contract call succeeds and rejects otherwise.
maturityRate
Allows a user to retrieve the vault's maturity rate. This is the cToken's exchange rate at the time of maturity.
Signature
Returns
A promise that resolves with the vault's maturity rate if the contract call succeeds and rejects otherwise.
cTokenAddr
Allows a user to retrieve the vault's cToken address.
Signature
Returns
A promise that resolves with the vault's cToken address if the contract call succeeds and rejects otherwise.
Methods
constructor
Creates an instance of the VaultTracker smart contract wrapper.
Signature
Parameters
Paramater | Type | Description |
---|---|---|
v |
| A vendor instance (ethers.js or web3.js vendor) to use. |
at
Connects a VaultTracker instance to a deployed VaultTracker smart contract on chain.
Signature
Parameters
Paramater | Type | Description |
---|---|---|
a |
| The address of the deployed VaultTracker smart contract. |
o |
| Optional transaction options to override ethers.js' default transaction options. |
Returns
The connected VaultTracker instance.
vaults
Allows a user to retrieve vault information for a specific owner from the VaultTracker.
Signature
Parameters
Paramater | Type | Description |
---|---|---|
o |
| The address of the vault's owner. |
Returns
A promise that resolves with a Vault
if the contract call succeeds and rejects otherwise.
balancesOf
Allows a user to retrieve the notional and redeemable balances for a specific owner.
Signature
Parameters
Paramater | Type | Description |
---|---|---|
o |
| The address of the vault's owner. |
Returns
A promise that resolves with a tuple containing the notional and redeemable balance if the contract call succeeds and rejects otherwise.