# Last Look Compensation

{% embed url="<https://github.com/CoinQuoter/CoinQuoter_SmartContracts/blob/main/Quoter-Core/contracts/Quoter/QuoterPenaltyManager.sol>" %}

### Contract info

**Contract name**: Quoter Penalty Manager

**Contract addresses:**&#x20;

Harmony Mainnet: 0xbb73027ba3D0e04781eE0d43761A9Ae8EC54246B

Binance Smart Chain Mainnet: 0x9F60B30BbBd213f966AfBF538900154F61D0EC5b

Harmony Testnet: 0x70591769C2c3b0594f98be31c34B6815aCE06e38

### Functions

#### DepositToken

```solidity
function depositToken(uint256 amount) external returns (uint256);
```

Deposits Quoter token to penalty manager

Parameters:

| Name   | Type    | Description                 |
| ------ | ------- | --------------------------- |
| amount | uint256 | amount of tokens to deposit |

Returns:

<table><thead><tr><th width="194.50464093795802">Type</th><th>Description</th></tr></thead><tbody><tr><td>uint256</td><td>Balance after depositing the tokens</td></tr></tbody></table>

#### WithdrawToken

```solidity
function withdrawToken(uint256 amount) external returns (uint256);
```

Withdraws Quoter token from penalty manager to msg sender

Parameters:

| Name   | Type    | Description                  |
| ------ | ------- | ---------------------------- |
| amount | uint256 | Amount of tokens to withdraw |

Returns:

| Type    | Description                          |
| ------- | ------------------------------------ |
| uint256 | balance after withdrawing the tokens |

#### WithdrawTokenTo

```solidity
function withdrawTokenTo(address to, uint256 amount) external returns (uint256);
```

Withdraws Quoter token from penalty manager to @to

Parameters:

| Name   | Type    | Description                       |
| ------ | ------- | --------------------------------- |
| to     | address | Address of the recepient's wallet |
| amount | uint256 | Amount of tokens to withdraw      |

Returns:

| Type    | Description                          |
| ------- | ------------------------------------ |
| uint256 | Balance after withdrawing the tokens |

#### TransferTo

```solidity
function transferTo(address to, uint256 amount) 
        external returns (uint256 balanceSender, uint256 balanceRecipient);
```

Transfer amount of balance of msg.sender to @to address

Parameters:

| Name   | Type    | Description                           |
| ------ | ------- | ------------------------------------- |
| to     | address | Address of sender's balance recipient |
| amount | uint256 | Amount of tokens to transfer          |

Returns:

| Name             | Type    | Description                      |
| ---------------- | ------- | -------------------------------- |
| balanceSender    | uint256 | Sender balance after transfer    |
| balanceRecipient | uint256 | Recipient balance after transfer |

#### IssuePenalty

```solidity
function issuePenalty(address to, uint256 amount) external returns (uint256);
```

Transfer @amount of balance of @to address to PM owner and to split

Parameters:

| Name   | Type    | Description             |
| ------ | ------- | ----------------------- |
| to     | address | Penalized maker address |
| amount | uint256 | Penalty amount          |

Returns:

| Type    | Description                  |
| ------- | ---------------------------- |
| uint256 | Balance of @to after penalty |

#### IssuePenaltySplit

```solidity
function issuePenaltySplit(address to, address splitRecipient, uint256 amount) 
        external returns (uint256);
```

Transfer amount of balance of to address to PM owner and to split

Parameters:

| Name           | Type    | Description                                                                                         |
| -------------- | ------- | --------------------------------------------------------------------------------------------------- |
| to             | address | Penalized maker address                                                                             |
| splitRecipient | address | Secondary wallet that should receive some amount of @amount based on current split percentage of PM |
| amount         | uint256 | Penalty amount                                                                                      |

Returns:

| Type    | Description                  |
| ------- | ---------------------------- |
| uint256 | Balance of @to after penalty |

#### AddCollector

```solidity
function addCollector(address collector) external;
```

Adds new address that can issue penalties to makers

Parameters:

| Name      | Type    | Description           |
| --------- | ------- | --------------------- |
| collector | address | New collector address |

#### RemoveCollector

```solidity
function removeCollector(address collector) external;
```

Removes collector, @collector address will not be able to issue penalties anymore

Parameters:

| Name      | Type    | Description                 |
| --------- | ------- | --------------------------- |
| collector | address | Collector address to remove |

#### isCollector

```solidity
function isCollector(address addr) external returns(bool);
```

Checks if given address is colector

Parameters:

| Name | Type    | Description      |
| ---- | ------- | ---------------- |
| addr | address | Address to check |

#### balanceOf

```solidity
function balanceOf(address addr) external returns (uint256);
```

Returns balance of Quoter token available for use as penalty

Parameters:

| Name | Type    | Description                           |
| ---- | ------- | ------------------------------------- |
| addr | address | Address of wallet to check balance of |

Returns:

| Type    | Description            |
| ------- | ---------------------- |
| uint256 | Balance of given token |

#### Heading

```solidity
function transferOwnership(address to) 
        external returns (address oldOwner, address newOwner);
```

Transfer ownership of penalty manager to @to address

Parameters:

| Name | Type    | Description                                   |
| ---- | ------- | --------------------------------------------- |
| to   | address | Address of wallet that will receive ownership |

Returns:

| Name     | Type    | Description               |
| -------- | ------- | ------------------------- |
| oldOwner | address | Address of previous owner |
| newOwner | address | Address of new owner      |

### Events

#### TokenDeposited

```solidity
event TokenDeposited(
        address indexed sender,
        uint256 amount,
        uint256 balance
    );
```

Event emitted on successful deposit of Quoter token

Parameters:

| Name    | Type    | Description                            |
| ------- | ------- | -------------------------------------- |
| sender  | address | The address of wallet depositing token |
| amount  | uint256 | Deposit amount                         |
| balance | uint256 | Sender balance after deposit           |

#### TokenWithdrawn

```solidity
event TokenWithdrawn(
        address indexed sender,
        uint256 amount,
        uint256 balance
    );
```

Event emitted on successful withdrawn of Quoter token

Parameters:

| Name    | Type    | Description                             |
| ------- | ------- | --------------------------------------- |
| sender  | address | The address of wallet withdrawing token |
| amount  | uint256 | Withdraw amount                         |
| balance | uint256 | Sender balance after withdraw           |

#### BalanceTransfered

```solidity
 event BalanceTransfered(
        address indexed from,
        address indexed to,
        uint256 amount,
        uint256 balanceFrom,
        uint256 balanceTo
    );
```

Event emitted on successful balance transfer

Parameters:

| Name      | Type    | Description                           |
| --------- | ------- | ------------------------------------- |
| from      | address | Address of wallet transfering balance |
| to        | address | Address of wallet receiving balance   |
| amount    | uint256 | Amount of balance transfered          |
| balance   | uint256 | Balance of sender after transfer      |
| balanceTo | uint256 | Balance of recipient after transfer   |

#### PenaltyIssued

```solidity
event PenaltyIssued(
        address indexed receiver,
        uint256 amount,
        uint256 balance
    );
```

Event emitted on penalty issued by collector

Parameters:

| Name     | Type    | Description                             |
| -------- | ------- | --------------------------------------- |
| receiver | address | Address of wallet that received penalty |
| amount   | uint256 | Penalty amount                          |
| balance  | uint256 | Balance after penalty                   |

#### SplitPenaltyIssued

```solidity
event SplitPenaltyIssued(
        address indexed receiver,
        address indexed splitTo,
        uint256 splitPercentage,
        uint256 amount,
        uint256 balance
    );
```

Event emitted on penalty issued by collector

| Name            | Type    | Description                                                                           |
| --------------- | ------- | ------------------------------------------------------------------------------------- |
| receiver        | address | Address of wallet that received penalty                                               |
| splitTo         | address | Address of wallet that received penalty                                               |
| splitPercentage | uint256 | Split percentage, i.e. how much should go to @splitTo address and to PM owner address |
| amount          | uint256 | Penalty amount                                                                        |
| balance         | uint256 | Balance after penalty                                                                 |
