Search…
Lock
The Lock contract is responsible for locking up UST returned from shorting a mAsset through Mirror Mint operation.

InitMsg

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct InitMsg {
3
pub owner: HumanAddr,
4
pub mint_contract: HumanAddr,
5
pub base_denom: String,
6
pub lockup_period: u64,
7
}
Copied!
Key
Type
Description
owner
HumanAddr
Owner address of Mirror Lock
mint_contract
HumanAddr
Address of Mirror Mint
base_denom
String
Native token denomination for stablecoin (TerraUSD)
lockup_period
u64
Length of time in seconds which the UST from shorting will be locked for

HandleMsg

UpdateConfig

Updates the configuration of Lock contract. Can only be issued by the owner of the Mirror Lock.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum HandleMsg {
4
UpdateConfig {
5
owner: Option<HumanAddr>,
6
mint_contract: Option<HumanAddr>,
7
base_denom: Option<String>,
8
lockup_period: Option<u64>,
9
}
Copied!
1
{
2
"update_config": {
3
"owner": "terra1...",
4
"mint_contract": "terra1...",
5
"base_denom": "uusd",
6
"lockup_period": 8
7
}
8
}
Copied!
Key
Type
Description
owner*
HumanAddr
Owner address of Mirror Lock
mint_contract*
HumanAddr
Address of Mirror Mint
base_denom*
String
Native token denomination for stablecoin (TerraUSD)
lockup_period*
u64
Length of time in seconds which the UST from shorting witll be locked for
*= optional

LockPositionFundsHook

Locks the UST from shorting mAsset when short CDP is successfully created on Mirror Mint.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum HandleMsg {
4
LockPositionFundsHook {
5
position_idx: Uint128,
6
receiver: HumanAddr,
7
}
Copied!
1
{
2
"lock_position_funds_hook": {
3
"position_idx": "10",
4
"receiver": "terra1..."
5
}
6
}
Copied!
Key
Type
Description
position_idx
Uint128
ID number of CDP from Mirror Mint
receiver
HumanAddr
Creator of CDP, who will receive unlocked funds

UnlockPositionFunds

Locked UST fromLockPositionFundsHookis unlocked by sending this message afterlockup_periodhas passed. Can only be issued by the owner of the position (receiver).
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum HandleMsg {
4
UnlockPositionFunds {
5
position_idx: Uint128,
6
}
Copied!
1
{
2
"unlock_position_funds": {
3
"position_idx": "10"
4
}
5
}
Copied!
Key
Type
Description
position_idx
Uint128
ID number of CDP from Mirror Mint to unlock funds from

ReleasePositionFunds

Locked funds will be released and sent to the CDP creator upon closing of the position. This message unlocks funds even whenlock_periodhas not ended yet. Can only be issued by the mint contract when the position is being closed.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum HandleMsg {
4
ReleasePositionFunds {
5
position_idx: Uint128,
6
}
Copied!
1
{
2
"release_position_funds": {
3
"position_idx": "10"
4
}
5
}
Copied!
Key
Type
Description
position_idx
Uint128
ID number of CDP from Mirror Mint to unlock funds from

QueryMsg

Config

Returns the configuration of Mirror Lock.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
Config {}
Copied!

Response

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct ConfigResponse {
3
pub owner: HumanAddr,
4
pub mint_contract: HumanAddr,
5
pub base_denom: String,
6
pub lockup_period: u64,
7
}
Copied!
Key
Type
Description
owner
HumanAddr
Owner address of Mirror Lock
mint_contract
HumanAddr
Address of Mirror Mint
base_denom
String
Native token denomination for stablecoin (TerraUSD)
lockup_period
u64
Length of time in seconds which the UST from shorting will be locked for
1
{
2
"config": {}
3
}
Copied!

Response

1
{
2
"config_response": {
3
"owner": "terra1...",
4
"mint_contract": "terra1...",
5
"base_denom": "uusd",
6
"lockup_period": 10
7
}
8
}
Copied!
Key
Type
Description
owner
HumanAddr
Owner address of Mirror Lock
mint_contract
HumanAddr
Address of Mirror Mint
base_denom
String
Native token denomination for stablecoin (TerraUSD)
lockup_period
u64
Number of blocks which the UST from shorting will be locked for

PositionLockInfo

Returns information about locked funds of a specific CDP.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
PositionLockInfo {
5
position_idx: Uint128,
6
}
Copied!
Key
Type
Description
position_idx
Uint128
ID number of CDP from Mirror Mint to unlock funds from

Response

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct PositionLockInfoResponse {
3
pub idx: Uint128,
4
pub receiver: HumanAddr,
5
pub locked_amount: Uint128,
6
pub unlock_time: u64,
7
}
Copied!
Key
Type
Description
idx
Uint128
ID number of CDP from Mirror Mint to unlock funds from
receiver
HumanAddr
Creator of CDP, who will receive unlocked funds
locked_amount
Uint128
Amount of base_denom locked from creating a Short CDP
unlock_time
u64
Time when user is allowed to claim the locked_amount
1
{
2
"position_lock_info": {
3
"position_idx": "10"
4
}
5
}
Copied!
Key
Type
Description
position_idx
Uint128
ID number of CDP from Mirror Mint to unlock funds from

Response

1
{
2
"position_lock_info_response": {
3
"idx": "10",
4
"receiver": "terra1...",
5
"locked_funds": [
6
[100, "1400"]
7
]
8
}
9
}
Copied!
Key
Type
Description
idx
Uint128
ID number of CDP from Mirror Mint to unlock funds from
receiver
HumanAddr
Creator of CDP, who will receive unlocked funds
locked_funds
Vec<(u64, Uint128)>
Description about 1. Block height which the fund was locked at 2. Amount of base_denom locked from creating a Short CDP
Last modified 4mo ago