Key Modules
The Collar core protocol consists of two key modules: Collar Core and Collar Swap. To help explain these modules, Collar's token terminology is discussed first.

# Collar Tokens

In Collar, every token is grouped in a lending pool. We use this term to mean they share the same expiry and are associated to the same collateral asset (BOND)/lending asset (WANT) pair.
Expiry: Maturity date of a loan, which is specified in every CALL and COLL token.
CALL Token: The right for borrowers to repay their loan. Before expiry, CALL tokens can be used to unlock BOND tokens.
COLL Token: The right to the debt for lenders. After expiry, COLL tokens can be used to collect repaid WANT tokens and defaulted BOND tokens.
BOND Token: The collateral asset deposited by borrowers.
WANT Token: The asset provided by lenders.
COLLAR: The governance and utility token. In Collar, COLLAR not only acts as the voting power, but will also eventually capture earnings from the platform and the ultimate right to claim failed-to-withdraw BOND tokens (see the CIPs).

## CALL and COLL Token Prices

CALL token price info:
• holding a CALL token is like holding a call option for BOND tokens
• CALL tokens function as insurance for the prices of both BOND tokens and WANT tokens
• price of CALL token small compared to BOND/WANT prices (so close to \$0 in USD stablecoin cases)
• price of CALL token increases when WANT token de-pegs
COLL token price info:
• holding a COLL token is like holding a put option for BOND tokens
• at expiry, price of COLL token = price of WANT token if WANT token maintains its peg
• price of COLL token before expiry acts as WANT token loan interest and should increase over time

# Collar Core

View the specification for the Collar core protocol here. A summary of the operations that can be performed using the protocol is provided below for reference.
For each lending pool (group of tokens sharing the same expiry and associated to the same BOND/WANT pair), the Collar Core contains a Collar vault, which is a wallet that stores and ultimately distributes the deposited BOND tokens a repaid WANT tokens. The function of the Collar Core is to mint/burn CALL and COLL tokens whenever BOND and WANT tokens are received/sent by the vault.

## Mint

### MintDual

An account uses MintDual to deposit amount n of BOND tokens into a Collar vault, and then the account will mint both amount n of CALL tokens and amount n of COLL tokens. (before expiry of the lending pool)

### MintColl

An account uses MintColl to deposit amount n of WANT tokens into a Collar vault, and then the account receives amount n of COLL tokens. (before expiry of the lending pool)

## Burn

### BurnDual

An account uses BurnDual to burn both amount n of CALL tokens and amount n of COLL tokens, and then the account receives amount n of BOND tokens from a Collar vault. (before expiry of the lending pool)

### BurnCall

An account uses BurnCall to burn amount n of CALL tokens and deposits amount n of WANT tokens into a Collar vault, and then the account receives amount n of BOND tokens from the vault. (before expiry of the lending pool)

### BurnColl

An account uses BurnColl to burn an amount n of COLL tokens, and then the account receives proportions of BOND tokens and WANT tokens from a Collar vault that are equal to the ratio of burned BOLL tokens to all COLL tokens in existence for that pool. (after expiry of the lending pool)

# Collar Swap

A loan in Collar is a trade between the lender's WANT tokens and the borrower's COLL tokens. This trading is facilitated by an AMM-based decentralized exchange called Collar Swap. The liquidity providers‘ incentive is a COLLAR token reward.
The AMM used in Collar Swap has an upgraded invariant curve. Since the trading involves tokens which derive their value from the Collar mechanism (which was designed specifically for pegged cryptoasset lending), the invariant was designed to satisfy the following requirements:
1. 1.
Reveals true sentiment of money markets, so that (COLL -WANT)/WANT price ratio represents the market interest rate.
2. 2.
Optimizes liquidity.
3. 3.
Defends against arbitrage trading that manipulates prices away from fair interest rate.
The invariant curve used in the Collar Swap AMM is inspired by Curve's StableSwap and is upgraded to better function as a stablecoin-derivatives liquidity provider. The invariant equation is
$(x+K(x, y))(y+aK(x, y)) = (K(x,y))^2$
where x is the amount of COLL, y is the amount of WANT,
$0 \le a <1$
is a constant, and
$K(x, y)$
is a function of the total liquidity in the pool.
Comparison of example invariant curves for different AMMs
For reference, here is the calculation of the function
$K(x, y)$
:
1
function calc_k(uint256 x, uint256 y) public pure returns (uint256) {
2
uint256 a = swap_sqp();
3
uint256 ye9 = y * 1e9;
4
uint256 ax = a * x;
5
uint256 a_ = 1e9 - a;
6
uint256 D = (ax + ye9)**2 + 4 * x * ye9 * a_;
7
return (sqrt(D) + ye9 + ax) / (2 * a_);
8
}
9
10
function swap_sqp() public pure virtual returns (uint256) {
11
return 992187500;
12
}
Copied!