Skip to main content

ForfeitedAssetsPool

Git Source

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

NameTypeDescription
name_stringThe name of the token
symbol_stringThe symbol of the token
_adminaddressThe 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

NameTypeDescription
assetaddressThe 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

NameTypeDescription
assetaddressThe 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

NameTypeDescription
indexuint256The index of the asset to get

Returns

NameTypeDescription
<none>addressThe 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

NameTypeDescription
<none>uint256The 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

NameTypeDescription
assetaddressThe address of the asset to deposit
amountuint256The amount of the asset to deposit
liabilityuint256The 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

NameTypeDescription
receiveraddressThe address to send the assets to
liabilityuint256The amount of liabilities to burn in order to purchase assets from the forfeited assets pool.

Returns

NameTypeDescription
redeemedAssetsaddress[]The list of assets purchased
redeemedAmountsuint256[]The amount of assets purchased

setPaused

Pause or unpause the contract

function setPaused(bool pause) external override onlyRole(Roles.PAUSE_ROLE);

Parameters

NameTypeDescription
pauseboolThe new paused state