Skip to content

TL:DR

Step 3: Create a Fund

A Fund is the sub-entity to the Company that contains one or more Wallets and defines the custodial policies for transfers and withdrawals of assets out of these Wallets. With Qredo, a Wallet always belongs to a Fund and any transaction that moves assets out of a given Qredo Wallet, undergoes custody.

Every transaction out of a Qredo Wallet requires an approval

  • On the Qredo Network, a transaction to move assets out of a Qredo Wallet can only take place after it has been approved by the approvers of that Wallet. This includes transactions out of a Wallet: transfers or withdrawals.
  • The approval process on Qredo requires that a minimum threshold of enlisted approvers must provide their approval for a transfer out transaction to go through.

Fund and Wallet definition

A Company must have at least one Fund. The Fund can contain one or multiple Wallets In terms of the Partner API, a Fund definition contains:

  • a Fund custodial policy: custodygroup_withdraw. The policy includes its dedicated list of appointed approvers and a threshold value: the number of required approvals. Default configuration to all Wallets with no such custom policy configured.
  • a Fund transfer out custodial policy: custodygroup_tx. The policy includes its dedicated list of appointed approvers and a threshold value: the number of required approvals. Default configuration to all Wallets with no such custom policy configured.
  • one or more wallets (per asset, such as BTC or ETH). You can configure custodial policies in the Wallet definition to override Fund policies.

Fund definition object

Use POST /company/{company_id}/fund to create a Fund. You can see the simplified view of what the Fund definition contains.

{
  "name": "Fund 01",
  "description": "Fund for demonstration purposes",
  "custodygroup_withdraw": {
    "threshold": 2,
    "members": [ list of withdrawal approvers
    ]
  },
  "custodygroup_tx": {
    "threshold": 2,
    "members": [ list of tx approvers
    ]
  },
  "wallets": [ list of Wallet definitions
  ]
    }
  ]
}

Make sure your Fund definition has valid definitions of:

  • withdrawal custody policy
  • transfer custody policy
  • at least one Wallet

It is not required for the Wallet definition to have custom custodial policies.

Wallet definition object

You can add more Wallets to your Fund at a later stage using POST /company/{company_id}/fund/{fund_ID}/wallet.

{
  "name": "New Wallet with custom custody group",
  "asset": "BTC-TESTNET",
  "custodygroup_withdraw": {
  "threshold": 1,
  "members": [ list of withdrawal approvers
  ]
  },
  "custodygroup_tx": {
  "threshold": 1,
  "members": [ list of tx approvers
  ]
  }
}

If the Wallet definition does not include a custodial policy, it automatically inherits the corresponding one of the Fund. You are not required to add custom (per Wallet) custodial policies.

<<<<<<< HEAD A Fund can have multiple Wallets. It is up to you to define a structure that suits your purposes and use cases.

Fund and Wallets created in Partner API not visible in Qredo Web App

Similar to the Company and trusted parties, the Funds (and Wallets) you create in the API will not be visible in the Web App.

Create a Fund

To complete this step, you must use the POST /fund to create your Fund. Along with a Fund name, you will add custodial policies and Wallets to your Fund.

Example request: POST /fund

This example creates a Fund named "Awesome Fund" that contains the following definitions:

  • a custodygroup_withdraw policy with threshold set to 2 and 3 specified trusted network members
  • a custodygroup_tx policy with threshold set to 3 and 4 specified trusted network members
  • two Wallets: one with global custodial policies and one with custom custodial policies

With this API resource, you pass company_id as a URL parameter.

curl -X POST "https://api.qredo.network/api/v1/p/company/{company_id}/fund" 

Request body

The following top-level parameters are required: name, description, custodygroup_withdraw, custodygroup_tx. You can add more Wallets at a later stage but, once created, you cannot remove Wallets.

{
  "name": "Awesome fund",
  "description": "A demo fund",
  "custodygroup_withdraw": {
    "threshold": 3,
    "members": [
      "<withdrawal trusted party01 id>",
      "<withdrawal trusted party02 id>",
      "<withdrawal trusted party03 id>"
    ]
  },
  "custodygroup_tx": {
    "threshold": 2,
    "members": [
      "<tx trusted party 01 id>",
      "<tx trusted party 02 id>",
      "<tx trusted party 03 id>",
      "<tx trusted party 04 id>"
    ]
  },
  "wallets": [
    {
      "name": "Demo ETH-TESTNET Wallet that uses global custodial policies",
      "asset": "<asset type: BTC, ETH, etc.>",
    },
    {
      "name": "Demo ETH-TESTNET Wallet with custom custodial policies",
      "asset": "<asset type: BTC, ETH, etc.>",
      "custodygroup_withdraw": {
        "threshold": 2,
        "members": [
          "<withdrawal trusted party01 id>",
          "<withdrawal trusted party02 id>"
        ]
      },
      "custodygroup_tx": {
        "threshold": 1,
        "members": [
          "<tx trusted party 01 id>",
          "<tx trusted party 02 id>"
        ]
      }
    }
  ]
}

You cannot update the Fund's custodial policies!

Once you create a Fund, you cannot update the custodial policies. You can update the custodial policies of a Wallet.

Custodial policies explained

The custodygroup_withdraw on top level is the global (per Fund) withdrawal custodial policy definition. The custodygroup_withdraw, part of the "Demo ETH-TESTNET Wallet with custom custodial policies" is the definition the overriding policy.

It is the same with the global vs. custom transfer policies.

Both with transfers and withdrawals, a custody policy includes:

  • threshold: this value defines how many approvals are required for a transaction to go through. In this case it is set to 2
  • members: this list includes IDs of members of your trusted network. In this case, three members are listed and at least two approvals are required

Obviously, for transactions to pass through custody, the threshold value must be less than or equal to the number of specified members.

The custodygroup_tx is configured similarly to custodygroup_withdraw and in this case is set to require 3 approvals (threshold set to 3) from three of the four specified members.

Always define custodial policies per Fund!

If you create a Fund without custodial policies and you add Wallets without custodial policies, transactions using these addresses may get stuck in the custodial approval process.

Definitions of custom (per Wallet) custodial policies have the exact same structure.

Wallet definitions explained

  • A Wallet on the Qredochain is not merely an address per asset type: it is rather a definition, that may or may not include custodial policies and dedicated approvers.
  • A Wallet on the Qredochain always belongs to the Fund it was created in: with Qredo, there are no Wallets outside a Fund.

The wallets object lists two Wallets: one that uses the global custodial policies (has no custom policy definitions) and another that uses custom ones.

Example response: POST /fund

Upon success, the response returns the fund_id hash as a string value plus policies, assets, trusted network members and Wallets.

{
  "fund id": "<ID of your Fund>",
  "name": "<name of your Fund>",
  "description": "<description of your Fund>",
  "custodygroup withdraw": "<Fund custodial policy ID for withdrawals>",
  "custodygroup tx": "<Fund custodial policy ID for transactions>",
  "policy withdraw": "<object containing withdraw policy info>",
  "policy tx": "<object containing withdraw policy info>",
  "members": "<list of Fund members and details of each>",
  "assets": "<list of supported assets in your Fund>",
  "wallets": "<list of Wallet objects with info like addresses and balances>"
}

The response, as shown, is significantly shortened: objects are presented as "collapsed". This is intentional and aims to keep things simple.

Pass fund_id with deposits, withdrawals, Wallets, ledger, etc.

Save the fund_id value to perform different Fund-specific actions, such as deposit and withdrawal transactions, creation of additional Wallets and retrieving ledger tx history. Transfer transactions do not require fund_id.


Last update: 2022-12-14