Defire Funds

Overview

Defire's fund are smart contracts to create unique DeFi investment strategies. For example, a manager can create a low risk fund to lend assets and a high risk fund to do ETH margin trades. Any account or smart contract (that is not a fund) can participate in a fund investment by executing the deposit operation, in exchange they will receive an IOU token from the fund that they can use to withdraw their earnings.
Click here for more information on Defire Funds.

Operations

Deposit in Fund

In Assets: Assets that the fund holds Out Assets: Fund token
An investor always supplies a percentage of the assets that the fund holds. For example if a fund has 50 DAI and 10 ETH, an investor that wants to have 10% share of the fund will need to supply 5 DAI and 1 ETH.
If the fund is empty, any asset can be deposited. For example, if there is a fund with no assets, an investor can deposit 3 DAI, 15 DAI or any amount of DAI he/she wants.
The operation always sends back the right proportion of its fund tokens that are IOU of the assets deposited.
JavaScript & Node
1
const operation = new defire.Operations.Defire.Fund.Deposit({
2
fundAddress: "0x52666C2ccf05fe274c601731a56b11a091afC2ff",
3
amounts: [{
4
asset: defire.Assets.DAI,
5
amount: "5000000000000000000" //5 DAI
6
}]
7
});
Copied!
Constructor object fields
fundAddress required string
Address of the fund to deposit to
amounts required array of object :
    asset required string (Address of the asset)
    amount required string | number | JSBI (Amount of the asset to deposit in wei format)
Amounts to deposit for each asset the fund holds. They have to be deposit proportionally.
Returns
Creates a new operation object

Withdraw from Fund

In Assets: Fund token Out Assets: Assets that the fund holds
An investor sends fund token to the fund and receives in exchange the corresponding proportion of the assets that the fund holds.
JavaScript & Node
1
const operation = new defire.Operations.Defire.Fund.Withdraw({
2
fundAddress: "0x52666C2ccf05fe274c601731a56b11a091afC2ff",
3
amount: "3000000000000000000" //3 Fund tokens
4
});
Copied!
Constructor object fields
fundAddress required string
Address of the fund to withdraw from
amount required Amount
Total number of fund tokens to return in wei format.
Returns
Creates a new operation object
Last modified 1yr ago