Guardian Manager Contract

This contract is responsible for storing all information about key guardian contracts. It will also connect to the Exec contract to trigger the unwind strategy when required.

Config

InstantiateMsg

{
  "owner_addr": "terra1...",  // should be gov contract
  "overseer_addr": "terra1...",
  "liquidator_fee": 0.01 // same as liquidation queue 
}

ExecuteMsg

UpdateConfig

Update configuration

{ 
  "UpdateConfig":
  {
    "owner_addr": "terra1...",  // should be gov contract
    "overseer_addr": "terra1...",
    "liquidator_fee": 0.01 // same as liquidation queue 
  }
}

ListGuardian

Whitelist a new guardian that is accepted

Security: This can only be called from owner contract !

{
  "ListGuardian": { 
    "name": "Luna/UST LP Astroport", 
    "symbol": "aLP",
    "token_type": "LP", // LP, Stake, or others...used for description
    "token_org" : "e.g. Astroport",  
    "guardian_token": "terra1...", 
    "guardian_exec": "terra1...", 
    "repayloan": "true", 
    "addcollateral": "false",         
    "active": "false"
  }
}

UpdateGuardian

Deactivate a guardian that is no longer accepted. Will stop depositing but allows withdraw for all users.

Security: This can only be called from gov contract !

{
  "UpdateGuardian": { 
    "name": "Luna/UST LP Astroport", 
    "symbol": "aLP",
    "token_type": "LP", // LP, Stake, or others...used for description
    "token_org" : "e.g. Astroport",  
    "guardian_token": "terra1...", 
    "guardian_exec": "terra1...", 
    "repayloan": "true", 
    "addcollateral": "false",         
    "active": "false"
  }
}

ProtectLoan

This is called from overseer contract if LiquidateCollateral is called and the LTV is to low. It is called before a the liquidation queue is triggered and prevents actual liquidation.

Security: This can only be called from Overseer contract !

{
    "borrower": "terra1...", // who
    "borrow_amount": "100000000" // amount that need to be repayed
    "borrow_limit": "100000000" // amount that collaral need to be 
    "collaterals" :   ["terra1...", "100000000"], // (Cw20 contract address, Locked amount)
                      ["terra1...", "100000000"] 
    "collateral_prices": [
      "123.456789", // Price of collateral
      "123.456789" 
    ]
}

DepositGuardian

This is called from the User when he wants to deposit a new guardian to the contract

{
  "DepositGuardian": [ 
  { 
    "guardian_token": "terra1...", 
    "amount": Uint256
    "priority" Uint256;  
  },
  { 
    "guardian_token": "terra1...", 
    "amount": Uint256
    "priority" Uint256;  
  }  
  ]
}

WithdrawGuardian

This is also called from the User when he want to get is guardian back

{
  "WithdrawGuardian": [
  { 
    "guardian_token": "terra1...", 
    "amount": Uint128
  },
  { 
    "guardian_token": "terra1...", 
    "amount": Uint128
  },  
  ]
}

WithdrawRewards

Not all Guardians will collect external rewards but if they do the user can call this function and receive the amount of rewards that are his for each of the provided Guardian. ( Maybe provide option to just withdraw for one of them.)

{
  "withdraw_rewards": { }
}

QueryMsg

Config

{
  "config": { }
}

ConfigResponse

Maybe more in the future...

{
  "owner_addr": "terra1...",  
  "overseer_addr": "terra1..."
  "liquidator_fee": Decimal256, 
}

Guardians

List the guardians, if no parameter it returns all. If token is specified to takes just the one. start_after and limit can be used to get just some of them from the list

  "guardian": { 
    "guardian_token": "terra1...", 
    "start_after": "terra1...", 
    "limit": u32, 
  }

GuardiansResponse

 "guardians" : [
  {
    "name": "Luna/UST LP Astroport", 
    "symbol": "aLP", 
    "guardian_token": "terra1...", 
    "guardian_custody": "terra1...", 
    "guardian_exec": "terra1...", 
    "reward_token: [ "terra1...",  // some guardians might have rewards
                     "terra1..." ] // e.g. Astro or Anc or multiples
    "active": "true"  
  },
  {
    "name": "aUST Anchor", 
    "symbol": "aUST", 
    "guardian_token": "terra1...", 
    "guardian_custody": "terra1...", 
    "guardian_exec": "terra1...", 
    "reward_token: [ "terra1...",  // some guardians might have rewards
                     "terra1..." ] // e.g. Astro or Anc or multiples
    "active": "true"  
  }  
 ]

BorrowerGuardians

{
  "borrower": "terra1...",  
}

BorrowerGuardiansResponse

{
  borrower: "terra1...",  
  guardians: [
    {
      "guardian_token": "terra1...", 
      "amount": u128
    },
    {
      "guardian_token": "terra1...", 
      "amount": u128        
    }
  ]
}

AllBorrowerGuardians

// Some code

AllBorrowerGuardiansResponse

  {
  allguardians: [ 
    {
      borrower: "terra1...",  
      guardians: [
        {
          "guardian_token": "terra1...", 
          "amount": u128
        },
        {
          "guardian_token": "terra1...", 
          "amount": u128        
        }
      ]
    },
    {
      borrower: "terra1...",  
      guardians: [
        {
          "guardian_token": "terra1...", 
          "amount": u128
        },
        {
          "guardian_token": "terra1...", 
          "amount": u128        
        }
      ]
    }    
  ]
}

Last updated