# Runtime Events

## Auction Related

| Event                | Parameters                                                                                                                                                                                                               | Description                | Module         |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------- | -------------- |
| NewCollateralAuction | 1. `AuctionId` : new collateral auction id\</br> 2. `CurrencyId` : collateral type\</br> 3. `Balance` : collateral amount\</br> 4. `Balance` : target aUSD amount, when bid >= target, auction is in reverse stage\</br> | collateral auction created | AuctionManager |
| NewDebitAuction      | 1. `AuctionId` : auction id\</br> 2. `Balance` : initial avalible ACA amount \</br> 3. `Balance` : fixed aUSD amount, bid must >= it\</br>                                                                               | debit auction created      | AuctionManager |
| NewSurplusAuction    | 1. `AuctionId` : auction id\</br> 2. `Balance` : aUSD amount of surplus\</br>                                                                                                                                            | surplus auction created    | AuctionManager |
| CancelAuction        | 1. `AuctionId` : auction id\</br>                                                                                                                                                                                        | auction canceled           | AuctionManager |
| AuctionDealed        | 1. `AuctionId` : auction id\</br>                                                                                                                                                                                        | auction dealed             | AuctionManager |
| Bid                  | 1. `AuctionId` : auction id\</br> 2. `AccountId` : bidder address \</br> 3. `Balance` : bid price\</br>                                                                                                                  | bid succeeded              | Auction        |

## DEX Related

| Event             | Parameters                                                                                                                                                                                                                                                                   | Description                           | Module |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | ------ |
| AddLiquidity      | 1. `AccountId` : who add liquidity to pool\</br> 2. `CurrencyId` : specific liquidity pool of **other token** / aUSD pair\</br> 3. `Balance` : other token amount added\</br> 4. `Balance` : aUSD amount added\</br> 5. `Share` : increased share amount\</br>               | add liquidity to specific pool        | Dex    |
| WithdrawLiquidity | 1. `AccountId` : who withdraw liquidity from pool\</br> 2. `CurrencyId` : specific liquidity pool of **other token** / aUSD pair\</br> 3. `Balance` : other token amount withdrew \</br> 4. `Balance` : aUSD amount withdrew\</br> 5. `Share` : decreased share amount\</br> | withdraw liquidity from specific pool | Dex    |
| Swap              | 1. `AccountId` : exchanger\</br> 2. `CurrencyId` : the token type which exchanger sold to DEX \</br> 3. `Balance` : amount of sold token \</br> 4. `CurrencyId` : the token type which exchanger bought from DEX\</br> 5. `Balance` : amount of bought token\</br>           | swap token to another token with DEX  | Dex    |

## Homa Related

| Event                  | Parameters                                                                                                                                                                                                  | Description                                    | Module      |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ----------- |
| BondAndMint            | 1. `AccountId` : caller\</br> 2. `Balance` : DOT amount to bond by homa protocol \</br> 3. `Balance` : issued LDOT amount to caller\</br>                                                                   | lock DOT to Homa protocal and issue liquid DOT | StakingPool |
| RedeemByUnbond         | 1. `AccountId` : caller\</br> 2. `Balance` : amount of LDOT to redeem\</br>                                                                                                                                 | redeem DOT by normal unbonding                 | StakingPool |
| RedeemByFreeUnbonded   | 1. `AccountId` : caller\</br> 2. `Balance` : fee in LDOT\</br> 3. `Balance` : LDOT amount to redeem\</br> 4. `Balance` : redeemed DOT amount\</br>                                                          | redeem DOT directly with Homa free pool        | StakingPool |
| RedeemByClaimUnbonding | 1. `AccountId` : caller\</br> 2. `EraIndex`: target era index to claim redeption\</br> 3. `Balance` : fee in LDOT\</br> 4. `Balance` : LDOT amount to redeem\</br> 5. `Balance` : redeemed DOT amount\</br> | redeem DOT by claiming unbonding               | StakingPool |

## CDP Related

| Event                        | Parameters                                                                                                                                                                                                                                                                                                                                                                                      | Description                                                                                                   | Module    |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------- |
| Authorization                | 1. `AccountId` : authorizer account\</br> 2. `AccountId` : the authorized account\</br> 3. `CurrencyId` : the authorized loan type\</br>                                                                                                                                                                                                                                                        | An account authorize other account to manipulate its specific type of loan                                    | Honzon    |
| UnAuthorization              | 1. `AccountId` : authorizer account\</br> 2. `AccountId` : the authorized account\</br> 3. `CurrencyId` : the authorized loan type\</br>                                                                                                                                                                                                                                                        | authorizer account revoke the right of authorized account to manipulate specific type of loan                 | Honzon    |
| UnAuthorizationAll           | 1. `AccountId` : authorizer account\</br>                                                                                                                                                                                                                                                                                                                                                       | account revoked all authorization to other accounts with all loan types                                       | Honzon    |
| LiquidateUnsafeCDP           | 1. `CurrencyId` : collateral token type\</br> 2. `AccountId` : owner of the liquidated CDP\</br> 3. `Balance` : the confiscated amount for liquidation\</br> 4. `Balance` : the bad debt amount(in aUSD) produced by the liquidated Cdp\</br>                                                                                                                                                   | liquidate an unsafe CDP                                                                                       | CdpEngine |
| SettleCDPInDebit             | 1. `CurrencyId` : collateral token type\</br> 2. `AccountId` : owner of the settled CDP\</br>                                                                                                                                                                                                                                                                                                   | settle a CDP has debit after emergency shutdown begin                                                         | CdpEngine |
| UpdatePosition               | 1. `AccountId` : CDP's owner\</br> 2. `CurrencyId` : CDP's collateral type\</br> 3. `Amount` : collateral adjustment amount, positive means collateral increased, negative means collateral decreased\</br> 4. `DebitAmount` : debit adjustment amount, positive means CDP's debit increased and owner get more aUSD loan, negative means CDP's debit decreased and owner repay some debt\</br> | cdp owner manipulate his loan and collateral                                                                  | Loans     |
| ConfiscateCollateralAndDebit | 1. `AccountId` : CDP's owner\</br> 2. `CurrencyId` : CDP's collateral type\</br> 3. `Balance` : collateral amount to be confiscated \</br> 4. `DebitBalance` : debit balance to be confiscated \</br>                                                                                                                                                                                           | emit by system operations for CDPs, such as settlement, liquidation                                           | Loans     |
| TransferLoan                 | 1. `AccountId` : sender\</br> 2. `AccountId` : receiver\</br> 3. `CurrencyId` : collateral type\</br>                                                                                                                                                                                                                                                                                           | sender transfer his whole specific collateral CDP(include all collateral amount and debit amount) to receiver | Loans     |

## Emergency Shutdown Related

| Event      | Parameters                                                       | Description               | Module            |
| ---------- | ---------------------------------------------------------------- | ------------------------- | ----------------- |
| Shutdown   | 1. `BlockNumber` : block number the emergency shutdown occurs    | system emergency shutdown | EmergencyShutdown |
| OpenRefund | 1. `BlockNumber` : block number when refund operation is allowed | refund operation opened   | EmergencyShutdown |
| Refund     | 1. `Balance` : aUSD amount used to refund                        | refund succeeded          | EmergencyShutdown |

## Risk Management Parameters Related

| Event                              | Parameters                                                                                                                 | Description   | Module      |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------- |
| UpdateStabilityFee                 | 1. `CurrencyId` : collateral type\</br> 2. `Option<Rate>` : extra stalibity fee rate                                       | param updated | CdpEngine   |
| UpdateLiquidationRatio             | 1. `CurrencyId` : collateral type\</br> 2. `Option<Ratio>` : liquidation ratio                                             | param updated | CdpEngine   |
| UpdateLiquidationPenalty           | 1. `CurrencyId` : collateral type\</br> 2. `Option<Rate>` : extra penalty rate when CDP liquidated                         | param updated | CdpEngine   |
| UpdateRequiredCollateralRatio      | 1. `CurrencyId` : collateral type\</br> 2. `Option<Ratio>` : the limit of collateral ratio when owner manipulate           | param updated | CdpEngine   |
| UpdateMaximumTotalDebitValue       | 1. `CurrencyId` : collateral type\</br> 2. `Balance` : aUSD cap issued by this type of collateral                          | param updated | CdpEngine   |
| UpdateSurplusAuctionFixedSize      | 1. `Balance` : fixed aUSD amount to be sold in a surplus auction\</br>                                                     | param updated | CdpTreasury |
| UpdateSurplusBufferSize            | 1. `Balance` : surplus pool buffer size, surplus auction is only created when surplus pool exceed it\</br>                 | param updated | CdpTreasury |
| UpdateInitialAmountPerDebitAuction | 1. `Balance` : initial ACA amount to be sold in a debit auction\</br>                                                      | param updated | CdpTreasury |
| UpdateDebitAuctionFixedSize        | 1. `Balance` : fixed aUSD amount to buy a debit auction\</br>                                                              | param updated | CdpTreasury |
| UpdateCollateralAuctionMaximumSize | 1. `CurrencyId` : collateral type\</br> 2. `Balance` : max collateral amount to be sold when create new collateral auction | param updated | CdpTreasury |
