ForfeitedAssetsPool
Inherits: IForfeitedAssetsPool, ERC165, AccessControl, ERC20
Title: The Forfeited Assets Pool contract
Author: SocksNFlops
The Forfeited Assets Pool is a contract that holds assets seized from foreclosed mortgages. They can be purchased for Consol that is burned in exchange.
In order to minimize smart contract risk, we are hedging towards immutability.
State Variables
assets
The set of assets in the forfeited assets pool
EnumerableSet.AddressSet private assets
paused
Get the paused state of the contract
bool public override paused
Functions
constructor
Constructor
constructor(string memory name_, string memory symbol_, address _admin) ERC20(name_, symbol_);
Parameters
| Name | Type | Description |
|---|---|---|
name_ | string | The name of the token |
symbol_ | string | The symbol of the token |
_admin | address | The address of the admin |
whenNotPaused
Modifier to check if the contract is paused
modifier whenNotPaused() ;
supportsInterface
function supportsInterface(bytes4 interfaceId) public view override(ERC165, AccessControl) returns (bool);
addAsset
Add an asset to the forfeited assets pool. Only callable by admin role.
function addAsset(address asset) external override onlyRole(Roles.DEFAULT_ADMIN_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
asset | address | The address of the asset to add |
removeAsset
Remove an asset from the forfeited assets pool. Only callable by admin role.
function removeAsset(address asset) external override onlyRole(Roles.DEFAULT_ADMIN_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
asset | address | The address of the asset to remove |
getAsset
Get the list of assets in the forfeited assets pool
function getAsset(uint256 index) external view override returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
index | uint256 | The index of the asset to get |
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The address of the asset at the given index |
totalAssets
Get the total amount of assets in the forfeited assets pool
function totalAssets() external view override returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total amount of assets in the forfeited assets pool |
depositAsset
Deposits an asset into the forfeited assets pool and updates the foreclosed liabilities. Only callable by permissioned depositors.
function depositAsset(address asset, uint256 amount, uint256 liability)
external
override
whenNotPaused
onlyRole(Roles.DEPOSITOR_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
asset | address | The address of the asset to deposit |
amount | uint256 | The amount of the asset to deposit |
liability | uint256 | The liability to add to the foreclosed liabilities |
burn
Purchase assets from the forfeited assets pool in proportion to the amount of Consol burned. redemptionPercentage = (amount / foreclosedLiabilities)
function burn(address receiver, uint256 liability)
external
override
whenNotPaused
returns (address[] memory redeemedAssets, uint256[] memory redeemedAmounts);
Parameters
| Name | Type | Description |
|---|---|---|
receiver | address | The address to send the assets to |
liability | uint256 | The amount of liabilities to burn in order to purchase assets from the forfeited assets pool. |
Returns
| Name | Type | Description |
|---|---|---|
redeemedAssets | address[] | The list of assets purchased |
redeemedAmounts | uint256[] | The amount of assets purchased |
setPaused
Pause or unpause the contract
function setPaused(bool pause) external override onlyRole(Roles.PAUSE_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
pause | bool | The new paused state |