Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

HAsset

Git Source

Title: HAsset

Defines an asset (e.g. Keke, Car, Bike, Truck) that riders can acquire through hire purchase and that investors can fund.

The struct holds both the physical/economic settings of the asset and the aggregate economics of the investor pools funding it. The admin configures these values, and they are validated (via the asset/opportunity accuracy calculators) to guarantee that the amount riders pay over time covers the profits promised to senior and junior investors.

struct HAsset {
/// @notice Unique identifier of the asset.
/// @dev    Used as the primary key for assets and referenced by investments.
bytes32 id;

/// @notice Whether the asset is currently active and available for investment.
/// @dev    May only be toggled off while no investor has invested in any
///         investment that uses this asset.
bool active;

/// @notice Human-readable name of the asset (e.g. "Keke-0001-2026", "Bike-0001-2026").
bytes32 name;

/// @notice Purchase/cost price of the asset, in USDC base units (6 decimals).
/// @dev    The amount required to acquire one unit of the asset.
uint256 costPrice;

/// @notice Total amount the rider would need to pay over the life of the hire purchase, in USDC base units (6 decimals).
/// @dev    Must be large enough to cover the asset cost plus the profits
///         promised to both the senior and junior investor pools (except the fixed extra charge for rider slashable, refundable, savings).
uint256 sellPrice;

/// @notice Buying price contributed by one senior investor, in USDC base units (6 decimals).
/// @dev    The senior pool total is this times {totalNumberOfSeniorInvestorsNeeded}.
uint256 oneSeniorInvestorBuyingPrice;

/// @notice Profit one senior investor earns over time, in USDC base units (6 decimals).
/// @dev    Senior investors are paid first and carry the lowest risk/reward.
uint256 oneSeniorInvestorProfit;

/// @notice Buying price contributed by one junior investor, in USDC base units (6 decimals).
/// @dev    The junior pool total is this times {totalNumberOfJuniorInvestorsNeeded}.
uint256 oneJuniorInvestorBuyingPrice;

/// @notice Profit one junior investor earns over time, in USDC base units (6 decimals).
/// @dev    Junior investors are paid after senior investors and carry the
///         higher risk/reward.
uint256 oneJuniorInvestorProfit;

/// @notice At every paying, this amount is charged extra from the rider and saved for the rider,
///         in USDC base units (6 decimals).
///         Then on the day of ownership transfer, its refunded to the rider.
///         This would help with repairs and reward for their faithfulness through the process.
///         If they default, these savings could be slashed as penalty and to fund investor payouts.
uint256 riderSlashableRepayableExtraCharge;

/// @notice Profit owner will earn over time, in USDC base units (6 decimals).
uint256 ownerProfit;

/// @notice Reserved. Payouts are driven by each pool's buying price plus profit (see
///         {HAsset.oneSeniorInvestorBuyingPrice}/{HAsset.oneSeniorInvestorProfit} and their
///         junior equivalents), so this share no longer affects any payout.
uint256 sharingPercentSeniorInvestor;

/// @notice Reserved. Payouts are driven by each pool's buying price plus profit, so this
///         share no longer affects any payout.
uint256 sharingPercentJuniorInvestor;

/// @notice Reserved. The owner receives the remainder after both pools are paid up to
///         their buying price plus profit, so this share no longer affects any payout.
uint256 sharingPercentOwner;

/// @notice Reserved. Payouts are driven by each pool's buying price plus profit, so this
///         share no longer affects any payout.
uint256 sharingPercentJuniorInvestorAfterSeniorPaid;

/// @notice Reserved. The owner receives the remainder after both pools are paid up to
///         their buying price plus profit, so this share no longer affects any payout.
uint256 sharingPercentOwnerAfterSeniorPaid;

/// @notice Number of senior investor slots required to fund one unit of this asset.
/// @dev    Used to know when the senior pool is fully funded.
uint256 totalNumberOfSeniorInvestorsNeeded;

/// @notice Number of junior investor slots required to fund one unit of this asset.
/// @dev    Used to know when the junior pool is fully funded.
uint256 totalNumberOfJuniorInvestorsNeeded;
}