🖥️Developer Integration

Developer

Module Address: 0x9770fa9c725cbd97eb50b2be5f7416efdfd1f1554beb0750d4dae4c64e860da3

To start deposit into Aries, you need to first register_user

/// Register the user and also create a default `Profile` with the given name.
/// We requires that a name is given instead of a default name such as "main" because it might be
/// possible for user to already have a `ResourceAccount` that collides with our default name.
public entry fun register_user(
    account: &signer,
    default_profile_name: vector<u8>
) 
/// Deposit funds into the Aries protocol, this can result in two scenarios:
///
/// 1. User has an existing `Coin0` loan: the amount will first used to repay the loan then the
///    remaining part contribute to the collateral.
///
/// 2. User doesn't have an existing loan: all the amount will be contributed to collateral.
///
/// When the amount is `u64::max`, we will repay all the debt without deposit to Aries. This is
/// so that we don't leave any dust when users try to repay all.
public entry fun deposit<Coin0>(
    account: &signer,
    profile_name: vector<u8>,
    amount: u64,
    repay_only: bool,
)
/// Withdraw fund into the Aries protocol, there are two scenarios:
///
/// 1. User have an existing `Coin0` deposit: the existing deposit will be withdrawn first, if
/// it is not enough and user `allow_borrow`, a loan will be taken out.
///
/// 2. User doesn't have an existing `Coin0` deposit: if user `allow_borrow`, a loan will be taken out.
///
/// When the amount is `u64::max`, we will repay all the deposited funds from Aries. This is so
/// that we don't leave any dust when users try to withdraw all.
public entry fun withdraw<Coin0>(
    account: &signer,
    profile_name: vector<u8>,
    amount: u64,
    allow_borrow: bool,
)

Last updated