Opening a vault

As of July 2021, the Parallel Protocol Vaults supports the following collateral assets: WETH, WBTC, and USDC.

To create a vault and deposit WETH collateral equal to DEPOSIT_AMOUNT to it, follow these steps:

  • Approve the collateral ERC20 asset (WETH) to the VaultsCore address equal to at least the DEPOSIT_AMOUNT.

WETH.approve(VaultsCore address, DEPOSIT_AMOUNT)
  • Call the VaultsCore.deposit() function with the desired collateral address and deposit amount.

VaultsCore.deposit(WETH address, DEPOSIT_AMOUNT)
  • You can view your vault details from the VaultsCore.vaults()view function.

myVaultId = VaultsDataProvider.vaultId(WETH address, your address);
myVault = VaultsDataProvider.vaults(vaultId)
  • Each Vault has the following information:

struct Vault {
    address collateralType;
    address owner;
    uint256 collateralBalance;
    uint256 baseDebt;
    uint256 createdAt;
  }

Last updated