EToken
This is an ERC20 compatible contract that represents the capital of each liquidity provider in a given pool. The valuation is one-to-one with the underlying stablecoin (it’s a rebasing token). The view scr() returns the amount of capital that’s locked backing up policies. For this capital locked, the pool receives an interest (scrInterestRate() / tokenInterestRate()) that is continuously accrued in the balance of eToken holders. See more.
An eToken can have an optional whitelist that controls who can deposit, withdraw or transfer the tokens, and an optional cooler that enforces a cooldown period before withdrawals. Both the eToken and the PremiumsAccounts can also have an optional ERC-4626 yield vault that invests the funds to generate additional yields.
Source: EToken.sol · Full documentation: ensuro.readthedocs.io/en/latest/EToken
Interactions

Parameters
| Field | Type | Description |
|---|---|---|
| liquidityRequirement | uint256 (wad) | Usually 1.0, used on withdrawal to scale the scr locked. |
| minUtilizationRatio | uint256 (wad) | Used to prevent deposits to overdilute the returns. |
| maxUtilizationRatio | uint256 (wad) | Prevents taking locking scr (taking new policies) if utilization ratio exceeds this parameter. |
| internalLoanInterestRate | uint256 (wad) | Interest rate charged for internal loans. |
| whitelist | address (ILPWhitelist) | Optional contract that, if present, controls who can deposit funds in the eToken. See ILPWhitelist. |
| cooler | address (ICooler) | Optional contract that, if present, enforces a cooldown period before withdrawals. See ICooler. |
| yieldVault | address (IERC4626) | Optional contract that, if present, implements the asset management strategy (invests the funds to generate yields). |
Packed parameters
To save gas, the numerical parameters are stored in a packed struct that fits in 256bits (a word in the EVM). This is not visible externally, but put’s limits on the precision of the parameters. The wad ones, have 4 decimals as precision, so 1.12345 will be truncated to 1.1234.
Events
SCRLocked
event SCRLocked(uint256 indexed policyId, uint256 interestRate, uint256 value)
Event emitted when part of the funds of the eToken are locked as solvency capital.
| Name | Type | Description |
|---|---|---|
| policyId | uint256 | The id of the policy that triggered the lock. |
| interestRate | uint256 | The annualized interestRate paid for the capital (wad) |
| value | uint256 | The amount locked |
SCRUnlocked
event SCRUnlocked(uint256 indexed policyId, uint256 interestRate, uint256 value, int256 adjustment)
Event emitted when the locked funds are unlocked and no longer used as solvency capital.
| Name | Type | Description |
|---|---|---|
| policyId | uint256 | The id of the policy that triggered the unlock. |
| interestRate | uint256 | The annualized interestRate that was paid for the capital (wad) |
| value | uint256 | The amount unlocked |
| adjustment | int256 | The discrete adjustment applied to the scale. |
InternalLoan
event InternalLoan(address indexed borrower, uint256 value, uint256 amountAsked)
Event emitted when a PremiumsAccount borrows money from the eToken to cover the payouts.
| Name | Type | Description |
|---|---|---|
| borrower | address | The address of the borrower. |
| value | uint256 | The amount actually borrowed. |
| amountAsked | uint256 | The amount asked to borrow. |
InternalLoanRepaid
event InternalLoanRepaid(address indexed borrower, uint256 value)
Event emitted when the premiums account has a surplus (losses less than expected) and repays the eToken.
| Name | Type | Description |
|---|---|---|
| borrower | address | The address of the borrower. |
| value | uint256 | The amount to repay. |
ETokensRedistributed
event ETokensRedistributed(address indexed owner, uint256 distributedProfit)
Event emitted when eTokens are burned and their value is redistributed to the rest of the LPs (typically when a cooldown is executed and there were profits during the period).
| Name | Type | Description |
|---|---|---|
| owner | address | The owner of the burned tokens (the cooler). |
| distributedProfit | uint256 | The amount distributed between all the LPs. |
CoCRefunded
event CoCRefunded(uint256 indexed policyId, address indexed receiver, uint256 amount)
Event emitted when part of a previously received cost of capital (CoC) is refunded, for example when a policy is cancelled.
| Name | Type | Description |
|---|---|---|
| policyId | uint256 | The id of the policy being refunded. |
| receiver | address | The user that received the refund. |
| amount | uint256 | The amount of the refund. |
External Methods
scr
function scr() public view returns (uint256)
Returns the amount of capital that’s locked as solvency capital for active policies.
totalWithdrawable
function totalWithdrawable() public view returns (uint256)
Returns the total amount of eTokens that can be withdrawn, i.e. the total supply minus the capital that must be kept to back the active policies (scaled by liquidityRequirement).
scrInterestRate
function scrInterestRate() public view returns (uint256)
Returns the annualized interest rate (wad) paid for the capital locked as SCR.
tokenInterestRate
function tokenInterestRate() public view returns (uint256)
Returns the annualized interest rate accrued to the whole eToken supply, computed from the SCR interest rate and the utilization rate.
getCurrentScale
function getCurrentScale(bool updated) public view returns (uint256)
Returns the current scale factor applied to the scaled balances to get the actual balance. If updated is true, the accrued interest up to now is included.
getLoan
function getLoan(address borrower) public view returns (uint256)
Returns the updated debt (principal + interest) of the borrower.
repayLoan
function repayLoan(uint256 amount, address onBehalfOf) external
Repays a loan taken with internalLoan.
| Name | Type | Description |
|---|---|---|
| amount | uint256 | The amount to repay, transferred from msg.sender balance. |
| onBehalfOf | address | The address of the borrower that took the loan. Usually onBehalfOf == msg.sender. |
redistribute
function redistribute(uint256 amount) external
Burns amount of the caller’s eTokens, redistributing their value to the rest of the LPs. Used by the Cooler to distribute the profits generated during a cooldown period.
Inter-protocol methods
Some methods are meant to be called by other contracts of the protocol, not by LPs directly:
depositandwithdraware called from the PolicyPool, which acts as a gateway for LP funds.lockScr,unlockScr,unlockScrWithRefundandinternalLoanare called from the PremiumsAccount to lock/unlock solvency capital and to take internal loans when premiums are exhausted.
See the full documentation for their complete signatures and behavior.