# 6.3 Closing a Collateral Debt Position: Burning CCC

# Use cases

Closes the CDP having the given timestamp.

Before closing the CDP you must have opened it previously with MintHelper function openCdp (chapter 6.2)

# Tools

The CommercioSDK, our own open source tool to format transactions to Commercio.network.

# Functions and APIs

  • MintHelper closeCdp.

# Background

From Wikipedia:

A timestamp is a sequence of characters or encoded information identifying when a certain event occurred, usually giving date and time of day, sometimes accurate to a small fraction of a second.

# Step by step sequence

  1. Derive the wallet;
  2. Execute the MintHelper closeCdp function.

# Code Examples

Here's an example of the implemetation in all the available languages.

# Dart

final networkInfo = NetworkInfo(
  bech32Hrp: 'did:com:',
  lcdUrl: 'http://localhost:1317',
);

final mnemonic = ['curve', 'attend', 'elephant', 'garage', 'tide', 'neither', 'enforce', 'auction', 'dumb', 'brief', 'divert', 'creek', 'palm', 'equip', 'festival', 'spice', 'race', 'message', 'domain', 'seed', 'ship', 'hunt', 'mercy', 'mail',];

final wallet = Wallet.derive(mnemonic, networkInfo);

final response = await MintHelper.closeCdp(757, wallet);
1
2
3
4
5
6
7
8
9
10

# Kotlin

val networkInfo = NetworkInfo(
    bech32Hrp = "did:com:",
    lcdUrl = "http://localhost:1317")

val mnemonic = listOf("curve", "attend", "elephant", "garage", "tide", "neither", "enforce", "auction", "dumb", "brief", "divert", "creek", "palm", "equip", "festival", "spice", "race", "message", "domain", "seed", "ship", "hunt", "mercy", "mail")

val wallet = Wallet.derive(mnemonic = mnemonic, networkInfo = networkInfo)

MintHelper.closeCdp(timestamp = 757, wallet = wallet)
1
2
3
4
5
6
7
8
9

# C#

static commercio.sacco.lib.NetworkInfo networkInfo = new commercio.sacco.lib.NetworkInfo(
                bech32Hrp: "did:com:",
                lcdUrl: "http://localhost:1317"
              );

String mnemonicString = "curve attend elephant garage tide neither enforce auction dumb brief divert creek palm equip festival spice race message domain seed ship hunt mercy mail";
List<String> mnemonic = new List<String>(mnemonicString.Split(" ", StringSplitOptions.RemoveEmptyEntries));

var wallet = commercio.sacco.lib.Wallet.derive(mnemonic, networkInfo);

var res = commercio.sdk.MintHelper.closeCdp(757, wallet);
1
2
3
4
5
6
7
8
9
10
11