Shares
Shares
Typedef on uint256
to represent user shares in vault contracts. Allows type checking to prevent errors where shares and collateral intermix
PerShare
User-defined type: an X-per-share rate (really a FPUnsigned
). Because Shares values are multiples of 1E18 on top of however many decimals the collateral token has, "seconds per share" is a very small number. To avoid precision loss, we store them inverted (shares per second) and expose methods that allow us to treat this as the sensible quantity of seconds per share.
SharesUtil
Addresses
Chain | Address |
---|
Functions
min
The minimum of a
and b
.
function min(Shares a, Shares b) internal pure returns (Shares)
Parameters
Name | Type | Description |
---|---|---|
a | Shares | a FPUnsigned. |
b | Shares | a FPUnsigned. |
Return Values
Name | Type | Description |
---|---|---|
[0] | Shares | the minimum of a and b . |
max
The maximum of a
and b
.
function max(Shares a, Shares b) internal pure returns (Shares)
Parameters
Name | Type | Description |
---|---|---|
a | Shares | a FPUnsigned. |
b | Shares | a FPUnsigned. |
Return Values
Name | Type | Description |
---|---|---|
[0] | Shares | the maximum of a and b . |