Skip to content

Commit db0843b

Browse files
shark0derMilGard91
authored andcommitted
docs: fix Cover struct parameters (order and sizes)
1 parent bbfdbaf commit db0843b

1 file changed

Lines changed: 26 additions & 25 deletions

File tree

docs/contracts/Cover.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Represents the basic information about a cover.
1414

1515
```solidity
1616
struct CoverData {
17-
uint productId;
18-
uint coverAsset;
17+
uint24 productId;
18+
uint8 coverAsset;
1919
uint96 amount;
2020
uint32 start;
2121
uint32 period;
@@ -42,7 +42,7 @@ Represents the allocation of coverage to a specific staking pool.
4242

4343
```solidity
4444
struct PoolAllocation {
45-
uint poolId;
45+
uint40 poolId;
4646
uint96 coverAmountInNXM;
4747
uint96 premiumInNXM;
4848
uint24 allocationId;
@@ -133,33 +133,34 @@ function buyCover(
133133

134134
```solidity
135135
struct BuyCoverParams {
136-
uint productId;
137136
uint coverId;
138137
address owner;
139-
uint coverAsset;
140-
uint period;
141-
uint amount;
142-
uint16 commissionRatio;
143-
uint paymentAsset;
138+
uint24 productId;
139+
uint8 coverAsset;
140+
uint96 amount;
141+
uint32 period;
144142
uint maxPremiumInAsset;
143+
uint8 paymentAsset;
144+
uint16 commissionRatio;
145145
address commissionDestination;
146-
bytes ipfsData;
146+
string ipfsData;
147147
}
148+
148149
```
149150

150-
| Field | Description |
151-
|---------------------------|------------------------------------------------------------------------------|
152-
| `productId` | The ID of the product to purchase cover for. |
153-
| `coverId` | The ID of an existing cover to extend or modify, or 0 to create a new cover. |
154-
| `owner` | The address that will own the cover NFT. |
155-
| `coverAsset` | The asset ID used for coverage. See `Pool.getAssets` (e.g., 0 ~ ETH). |
156-
| `period` | The duration of the cover in seconds. |
157-
| `amount` | The amount of coverage in the cover asset. |
158-
| `commissionRatio` | The commission ratio (in basis points, where 10000 = 100%). |
159-
| `paymentAsset` | The asset ID used for payment (must be coverAsset or NXM_ASSET_ID). |
160-
| `maxPremiumInAsset` | The maximum premium the buyer is willing to pay in the payment asset. |
161-
| `commissionDestination` | The address where the commission should be sent. |
162-
| `ipfsData` | IPFS hash of additional data related to the cover (e.g., policy documents). |
151+
| Field | Description |
152+
|---------------------------|--------------------------------------------------------------------------------------|
153+
| `coverId` | The ID of an existing cover to extend or modify, or 0 to create a new cover. |
154+
| `owner` | The address that will own the cover NFT. |
155+
| `productId` | The ID of the product to purchase cover for. |
156+
| `coverAsset` | The asset ID used for coverage. See `Pool.getAssets` (e.g., 0 ~ ETH). |
157+
| `amount` | The amount of coverage in the cover asset. |
158+
| `period` | The duration of the cover in seconds. |
159+
| `maxPremiumInAsset` | The maximum premium the buyer is willing to pay in the payment asset. |
160+
| `paymentAsset` | The asset ID used for payment (must be coverAsset or NXM_ASSET_ID). |
161+
| `commissionRatio` | The commission ratio (in basis points, where 10000 = 100%). |
162+
| `commissionDestination` | The address where the commission should be sent. |
163+
| `ipfsData` | IPFS hash of additional data related to the cover (e.g., list of wallet addresses). |
163164

164165
#### `PoolAllocationRequest` Structure:
165166

@@ -177,13 +178,13 @@ To retrieve data to construct `PoolAllocationRequest`, call the `/quote` endpoin
177178
| `poolId` | ID of the staking pool to allocate cover to. |
178179
| `coverAmountInAsset` | Amount of coverage to allocate to the pool in the cover asset. |
179180

180-
**Returns:** The coverId of the purchased or modified cover.
181+
**Returns:** The coverId of the purchased cover.
181182

182183
**Description:** Purchases new cover or edits an existing cover. Validates input parameters (e.g., cover period, commission ratio), allocates cover amounts across specified staking pools, calculates premiums and commissions, and mints a new Cover NFT if it's a new cover.
183184

184185
### `expireCover`
185186

186-
Expires a cover that has reached its expiration time.
187+
Explicitly expires a cover that has reached its expiration time removing its allocations.
187188

188189
```solidity
189190
function expireCover(uint coverId) external;

0 commit comments

Comments
 (0)