Skip to content

Commit 7a7be34

Browse files
authored
docs(feat): fassets minting reference (#683)
1 parent 23b98ca commit 7a7be34

File tree

2 files changed

+245
-0
lines changed

2 files changed

+245
-0
lines changed

docs/fassets/reference/IAssetManager.mdx

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,113 @@ function getAgentInfo(address _agentVault)
3636
returns (AgentInfo.Info memory);
3737
```
3838

39+
### `reserveCollateral`
40+
41+
Reserves collateral for minting FAssets.
42+
Before paying underlying assets for minting, the minter must reserve collateral and pay a collateral reservation fee.
43+
44+
Parameters:
45+
46+
- `_agentVault`: Agent vault address
47+
- `_lots`: Number of lots for which to reserve collateral
48+
- `_maxMintingFeeBIPS`: Maximum minting fee (BIPS) that can be charged by the agent - best practice is to copy the current agent's published fee; used to prevent agent from front-running reservation request and increasing fee
49+
- `_executor`: Account that is allowed to execute minting (besides minter and agent)
50+
- `_minterUnderlyingAddresses`: Array of minter's underlying addresses - needed only if handshake is required
51+
52+
```solidity
53+
function reserveCollateral(
54+
address _agentVault,
55+
uint256 _lots,
56+
uint256 _maxMintingFeeBIPS,
57+
address payable _executor,
58+
string[] calldata _minterUnderlyingAddresses
59+
) external payable;
60+
```
61+
62+
### `approveCollateralReservation`
63+
64+
Agent approves the collateral reservation request after checking the minter's identity.
65+
66+
Parameters:
67+
68+
- `_collateralReservationId`: Collateral reservation ID
69+
70+
```solidity
71+
function approveCollateralReservation(
72+
uint256 _collateralReservationId
73+
) external notEmergencyPaused;
74+
```
75+
76+
### `rejectCollateralReservation`
77+
78+
Agent rejects the collateral reservation request after checking the minter's identity.
79+
The collateral reservation fee is returned to the minter.
80+
81+
Parameters:
82+
83+
- `_collateralReservationId`: Collateral reservation ID
84+
85+
```solidity
86+
function rejectCollateralReservation(
87+
uint256 _collateralReservationId
88+
) external nonReentrant;
89+
```
90+
91+
### `cancelCollateralReservation`
92+
93+
Minter cancels the collateral reservation request if the agent didn't respond in time.
94+
The collateral reservation fee is returned to the minter.
95+
96+
Parameters:
97+
98+
- `_collateralReservationId`: Collateral reservation ID
99+
100+
```solidity
101+
function cancelCollateralReservation(
102+
uint256 _collateralReservationId
103+
) external nonReentrant;
104+
```
105+
106+
### `collateralReservationFee`
107+
108+
Returns the collateral reservation fee amount.
109+
110+
Parameters:
111+
112+
- `_lots`: The number of lots for which to reserve collateral
113+
114+
Returns:
115+
116+
- `_reservationFeeNATWei`: The amount of reservation fee in NAT wei
117+
118+
```solidity
119+
function collateralReservationFee(
120+
uint256 _lots
121+
) external view returns (uint256 _reservationFeeNATWei);
122+
```
123+
124+
### `executeMinting`
125+
126+
After obtaining proof of underlying payment, the minter calls this method to finish the minting and collect the minted FAssets.
127+
128+
Note: May only be called by:
129+
130+
- The minter (creator of the collateral reservation request)
131+
- The executor appointed by the minter
132+
- The agent owner (owner of the agent vault in the collateral reservation)
133+
134+
Parameters:
135+
136+
- `_payment`: Proof of the underlying payment (must contain exact `value + fee` amount and correct payment reference)
137+
- `_collateralReservationId`: Collateral reservation ID
138+
139+
```solidity
140+
function executeMinting(
141+
IPayment.Proof calldata _payment,
142+
uint256 _collateralReservationId
143+
) external nonReentrant;
144+
```
145+
39146
### `redeem`
40147

41148
Redeem number of lots of FAssets.

docs/fassets/reference/IAssetManagerEvents.mdx

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,144 @@ keywords: [fassets, xrp, bitcoin, dogecoin, flare-network]
88

99
Sourced from `IAssetManagerEvents.sol` on [GitHub](https://github.com/flare-labs-ltd/fassets/blob/main/contracts/userInterfaces/IAssetManagerEvents.sol).
1010

11+
// ... existing code ...
12+
13+
## Events
14+
15+
### `CollateralReserved`
16+
17+
Emitted when a minter has reserved collateral, paid the reservation fee, and is expected to pay the underlying funds. The agent's collateral is reserved at this point.
18+
19+
Parameters:
20+
21+
- `agentVault`: Address of the agent vault
22+
- `minter`: Address of the minter
23+
- `collateralReservationId`: ID of the collateral reservation
24+
- `valueUBA`: Value in underlying base amount
25+
- `feeUBA`: Fee in underlying base amount
26+
- `firstUnderlyingBlock`: First block number on the underlying chain
27+
- `lastUnderlyingBlock`: Last block number on the underlying chain
28+
- `lastUnderlyingTimestamp`: Last timestamp on the underlying chain
29+
- `paymentAddress`: Address for payment
30+
- `paymentReference`: Reference for payment
31+
- `executor`: Address of the executor
32+
- `executorFeeNatWei`: Fee for the executor in NAT wei
33+
34+
```solidity
35+
event CollateralReserved(
36+
address indexed agentVault,
37+
address indexed minter,
38+
uint256 indexed collateralReservationId,
39+
uint256 valueUBA,
40+
uint256 feeUBA,
41+
uint256 firstUnderlyingBlock,
42+
uint256 lastUnderlyingBlock,
43+
uint256 lastUnderlyingTimestamp,
44+
string paymentAddress,
45+
bytes32 paymentReference,
46+
address executor,
47+
uint256 executorFeeNatWei
48+
);
49+
```
50+
51+
### `CollateralReservationRejected`
52+
53+
Emitted when an agent rejects the collateral reservation request due to the minter's identity. The reserved collateral is released.
54+
55+
Parameters:
56+
57+
- `agentVault`: Address of the agent vault
58+
- `minter`: Address of the minter
59+
- `collateralReservationId`: ID of the collateral reservation
60+
61+
```solidity
62+
event CollateralReservationRejected(
63+
address indexed agentVault,
64+
address indexed minter,
65+
uint256 indexed collateralReservationId
66+
);
67+
```
68+
69+
### `CollateralReservationCancelled`
70+
71+
Emitted when a minter cancels the collateral reservation request due to agent inactivity. The reserved collateral is released.
72+
73+
Parameters:
74+
75+
- `agentVault`: Address of the agent vault
76+
- `minter`: Address of the minter
77+
- `collateralReservationId`: ID of the collateral reservation
78+
79+
```solidity
80+
event CollateralReservationCancelled(
81+
address indexed agentVault,
82+
address indexed minter,
83+
uint256 indexed collateralReservationId
84+
);
85+
```
86+
87+
### `MintingExecuted`
88+
89+
Emitted when a minter has successfully paid the underlying funds in time and received the FAssets. The agent's collateral is locked at this point.
90+
91+
Parameters:
92+
93+
- `agentVault`: Address of the agent vault
94+
- `collateralReservationId`: ID of the collateral reservation
95+
- `mintedAmountUBA`: Amount of FAssets minted in underlying base amount
96+
- `agentFeeUBA`: Fee paid to the agent in underlying base amount
97+
- `poolFeeUBA`: Fee paid to the pool in underlying base amount
98+
99+
```solidity
100+
event MintingExecuted(
101+
address indexed agentVault,
102+
uint256 indexed collateralReservationId,
103+
uint256 mintedAmountUBA,
104+
uint256 agentFeeUBA,
105+
uint256 poolFeeUBA
106+
);
107+
```
108+
109+
### `MintingPaymentDefault`
110+
111+
Emitted when a minter fails to pay the underlying funds in time. The collateral reservation fee is paid to the agent and the reserved collateral is released.
112+
113+
Parameters:
114+
115+
- `agentVault`: Address of the agent vault
116+
- `minter`: Address of the minter
117+
- `collateralReservationId`: ID of the collateral reservation
118+
- `reservedAmountUBA`: Amount that was reserved in underlying base amount
119+
120+
```solidity
121+
event MintingPaymentDefault(
122+
address indexed agentVault,
123+
address indexed minter,
124+
uint256 indexed collateralReservationId,
125+
uint256 reservedAmountUBA
126+
);
127+
```
128+
129+
### `CollateralReservationDeleted`
130+
131+
Emitted when both the minter and agent fail to present any proof within the attestation time window, and the agent calls `unstickMinting` to release the reserved collateral.
132+
133+
Parameters:
134+
135+
- `agentVault`: Address of the agent vault
136+
- `minter`: Address of the minter
137+
- `collateralReservationId`: ID of the collateral reservation
138+
- `reservedAmountUBA`: Amount that was reserved in underlying base amount
139+
140+
```solidity
141+
event CollateralReservationDeleted(
142+
address indexed agentVault,
143+
address indexed minter,
144+
uint256 indexed collateralReservationId,
145+
uint256 reservedAmountUBA
146+
);
147+
```
148+
11149
### `RedemptionRequested`
12150

13151
An event is emitted when the redeemer starts the redemption process.

0 commit comments

Comments
 (0)