Guardian Exec Contract

The exec contract is handling all the external communication with the CW20 Contracts and Stake Contracts for the corresponding asset class. It will be one instance for each guardian.

These are just the mandatory interfaces that are used from the Guardian Manager.

Config

There might be additional config parameters that depend on the collateral types...

InstantiateMsg

{
    "owner_addr" : "terra1...", // guardian manager only he is allow to exec 
    "custody_addr" : "terra1...", // thats where the recipe token are hold  
    "guardian_token": "terra1...", // cw20 from the recipe token
    "reward_token: [ "terra1...",  // some guardians might have rewards
                     "terra1..." ] // e.g. Astro or Anc or multiples
    "staking_contract": "terra1...", // cw20 from the recipe token
    "unstaking_contract": "terra1...", // cw20 from the orginal lp token
    "element_token: [ "terra1...",   // optinal cw20 that the lp is split into
                     "terra1..." ] 
}

ExecuteMsg

ExecuteStrategy

Withdraws the token from any staking contract.

Logic:

  • If required collects rewards and distributes them to all borrowers, internally

  • unstake the recipe token to get the actual token (calculate amount based on unwind_amount provided)

  • split unstaked token into its elements if needed

  • repay loan

  • return reward tokens and element tokens not used to repay the loan to the borrower

{
    "borrower" : "terra1...", // whos lps we have to unwind
    "unwind_amount": Uint256  // how much if empty we take all
}

Withdraw

Withdraw recipe token and return to the borrower

{
    "borrower" : "terra1...", // whos lps we have to unwind
    "amount": Uint256  // how much if empty we take all
}

CollectRewards

If rewards are supported we need to collect them all from time to time and proportionally split them between all borrowers with this guardian internally

{
  "CollectRewards": { }
}

WithdrawRewards

Return proportional rewards to the borrower...do a last CollectRewards just before the Withdraw ?

{
    "borrower" : "terra1...", // send rewards to borrower address
}

QueryMsg

Config

// Some code

ConfigReponse

// Some code

TODO:

StakedRewards

StakedRewardsResponse

CollectedRewards

CollectedRewardsReponse

AllRewards

AllRewardsReponse

Last updated