Depositing Assets
ASK IS GAS NECESARY FOR DEPOSITING AND WITHDRAWING!!!
In order to use Finny, one needs to send the canister the underlying tokens. From there, Finny gives you a protocol balance which we describe as your canister balance.
Similar to how centralize exchanges have individual balances built into their applications before trading, the Finny canister works using the same principal. Once the canister balances are recorded you may transact on the protocol as you like. (i.e. minting fTokens, repaying borrows, etc.).
🏦Depositing ICP
There are two ways to deposit ICP, one in which you check blocks and submitting the block number for a minted balance and another in which you send to a subaccount and clear it to the finrisk main deposit account. For the first method, if you lose the block before letting the canister know you will have to scan every block on the icp chain for your transaction. For the second method, you don't have to worry about this but you will have to input an extra 0.0001 ICP for the subaccount to the main deposit account.
🏦Method 1: Depositing with blocks
1. Pay Fee using instructions in #Practical Tx Fee Management for Developers and Users Practical Tx Fee Management for Developers and Users
2. Get the Finrisk Canister ID
- View Finrisk Canister ID Candid Notation
- View Finrisk Canister ID with dfx
3. Send ICP to the Finrisk Canister
4. Once the Block Confirmation is Received, Notify the Central Canister by Passing in the Block Number
- Notify Canister Candid Notation
- Notify Canister with dfx
- A Concrete Example with dfx
🏦Method 2 Depositing Using a Subaccount
1. Pay Fee Using Instructions in Practical Tx Fee Management for Developers and Users
2. Get your Subaccount Deposit Account ID
- Getting Deposit Subaccount Candid Notation
The specific getDepositAccountIdAsXXX will depend on whether you use the ledger from dfx or through calling the ledger canister through code.
3. Send to Subaccount
- Send ICP to Subaccount using dfx
Using the deposit account id from step 2:
NOTE: The transfer from the subaccount to the default account requires a 0.0001 ICP fee on top of the --fee flag fee. I.E. If you want 5 ICP to show up in your book, you need to input 5.0001 as below
- A Concrete Example using dfx
4. (Optional) If you want to view your deposit go to https://dashboard.internetcomputer.org/ and plug in that deposit account to the search bar.
5. Notify Fintrest Canister of Deposit
- Notify Canister Candid Notation
You then notify the Finny canister that you have sent ICP to your subaccount. It will then clear this balance sending it to the main canister's default account and mint you ICP on the canister book balance.
NOTE AGAIN: The transfer from the subaccount to the default account requires a 10_000 ICP fee on top of the --fee flag fee. I.E. If you want 500_000_000 ICP to show up in your book, you need to 5_000_100_00 as below
- Notify Canister using dfx
6. See #view-token-balance to view your account balances in the canister
🏦Deposit ICRC-1
Depositing ICRC-1 is only done via the Subaccount method for now. Most ICRC-1 canisters do not yet have archived blocks. Please only deposit the assets in the #assets. If you deposit anything else can't help you, well we probably can but we don't have the time.
1. Pay Fee Using Instructions in Practical Tx Fee Management for Developers and Users
2. Get the Deposit Subaccount
- Getting the Deposit Subaccount Candid Notation
- Getting the Deposit Subaccount with dfx
3. Send tokens to the ICRC-1 Subaccount
- Sending Tokens Using dfx
HEADS UP: The transfer from the subaccount to the default account requires an additional unit of icrc fee on top of the fee flag. I.E. If you want 5 ckbtc to show up in your book, and the fee is 10 you need to amount needs to = 500_000_010 on top of the --fee = 10 fee flag.
Replace the "$ACCOUNT" above with the result you received in step 2
- Concrete dfx Example using ckBtc's canister ID
4. (Optional) View Subaccount balance
5. Notfy the Canister of your Deposit
NOTE AGAIN: The transfer from the subaccount to the default account frequires an additional unit of icrc fee on top of the fee flag. I.E. If you want 50_000_000 ckbtc to show up in your book, and the fee is 10 you need enter in 50_000_010 for "$AMOUNT"
- Concrete example using dfx
6. See #view-token-balance to view your account balances in the canister
🏦Deposit DIP20
Depositing DIP20 tokens into the protocol requires one to approve the canister to use a certain amount of tokens. This is done by calling the 'approve()' method of DIP20 asset you want to deposit (if its supported by Finny). Please only deposit the assets in the token-list. If you deposit anything else can't help you, well we probably can but we don't have the time.
The following function must be called in our protocol and pass the token ID of the asset as stored in Finny.
1. Pay Fee using Instructions in Practical Tx Fee Management for Developers and Users
2. Approve Balance you Want to Send
- Using dfx
- A Concrete Example Using dfx
Please put in the exact amount you want to transfer unlike previous tokens. I.E. if you want 1_000 in your book approve 1_000. Note, upon transfer, your own balance will lose an additional "$DIP-TOKEN-FEE" But you do not need to specify it on approve.
3. (Optional) View Approval Amount
The approval amount should be "$DIP-TOKEN-FEE" + "$AMOUNT"
- Using dfx
-A Concrete Example Using dfx
note the first principal is your principal and the second is the Finny canister's
4. Notify the Finny Canister to Transfer from your Wallet to the Canister.
- Using dfx
- A Concrete Example Using dfx
NOTE: For the amount you want in your book add a fee to the parameter for this function. I.E. if you want 1_000 minted and the fee is 2_000_000_000, put in 2_000_001_000
5. See #view-token-balance to view your account balances in the canister
Last updated