Skip to content

Commit 4c8c180

Browse files
committed
0.1.39
1 parent 21d0c83 commit 4c8c180

29 files changed

+1421
-45
lines changed

foundry.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "flare-periphery"
3-
version = "0.1.38"
3+
version = "0.1.39"
44

55
[profile.default]
66
src = "src"

src/coston/IAssetManager.sol

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ interface IAssetManager is
181181
returns (CollateralType.Data memory);
182182

183183
/**
184-
* Get the list of all available and deprecated tokens used for collateral.
184+
* Get the list of all available tokens used for collateral.
185185
*/
186186
function getCollateralTypes()
187187
external view
@@ -284,16 +284,6 @@ interface IAssetManager is
284284
string memory _name
285285
) external;
286286

287-
/**
288-
* When current pool collateral token contract (WNat) is replaced by the method setPoolWNatCollateralType,
289-
* pools don't switch automatically. Instead, the agent must call this method that swaps old WNat tokens for
290-
* new ones and sets it for use by the pool.
291-
* NOTE: may only be called by the agent vault owner.
292-
*/
293-
function upgradeWNatContract(
294-
address _agentVault
295-
) external;
296-
297287
////////////////////////////////////////////////////////////////////////////////////
298288
// Collateral withdrawal announcement
299289

@@ -616,6 +606,25 @@ interface IAssetManager is
616606
uint256 _collateralReservationId
617607
) external;
618608

609+
/**
610+
* The minter can make several mistakes in the underlying payment:
611+
* - the payment is too late and is already defaulted before executing
612+
* - the payment is too small so executeMinting reverts
613+
* - the payment is performed twice
614+
* In all of these cases the paid amount ends up on the agent vault's underlying account, but it is not
615+
* confirmed and therefore the agent cannot withdraw it without triggering full liquidation (of course
616+
* the agent can legally withdraw it once the vault is closed).
617+
* This method enables the agent to confirm such payments, converting the deposited amount to agent's
618+
* free underlying.
619+
* NOTE: may only be called by the agent vault owner.
620+
* @param _payment proof of the underlying payment (must have correct payment reference)
621+
* @param _collateralReservationId collateral reservation id
622+
*/
623+
function confirmClosedMintingPayment(
624+
IPayment.Proof calldata _payment,
625+
uint256 _collateralReservationId
626+
) external;
627+
619628
/**
620629
* If a collateral reservation request exists for more than 24 hours, payment or non-payment proof are no longer
621630
* available. In this case the agent can call this method, which burns reserved collateral at market price

src/coston/IAssetManagerEvents.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ interface IAssetManagerEvents {
164164
uint256 indexed collateralReservationId,
165165
uint256 reservedAmountUBA);
166166

167+
/**
168+
* Emitted when a late or too small payment for an already defaulted or expired minting is confirmed.
169+
* It is equivalent to agent performing underlying topup.
170+
*/
171+
event ConfirmedClosedMintingPayment(
172+
address indexed agentVault,
173+
bytes32 transactionHash,
174+
uint256 depositedUBA);
175+
167176
/**
168177
* Agent performed self minting, either by executing selfMint with underlying deposit or
169178
* by executing mintFromFreeUnderlying (in this case, `mintFromFreeUnderlying` is true and

src/coston/ICoreVaultClientSettings.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ interface ICoreVaultClientSettings {
1414
function setCoreVaultTransferTimeExtensionSeconds(uint256 _transferTimeExtensionSeconds)
1515
external;
1616

17+
function setCoreVaultTransferDefaultPenaltyBIPS(uint256 _transferDefaultPenaltyBIPS)
18+
external;
19+
1720
function setCoreVaultRedemptionFeeBIPS(uint256 _redemptionFeeBIPS)
1821
external;
1922

@@ -35,6 +38,10 @@ interface ICoreVaultClientSettings {
3538
external view
3639
returns (uint256);
3740

41+
function getCoreVaultTransferDefaultPenaltyBIPS()
42+
external view
43+
returns (uint256);
44+
3845
function getCoreVaultRedemptionFeeBIPS()
3946
external view
4047
returns (uint256);

src/coston2/IAgentVaultsFacet.sol

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity >=0.8.4 <0.9;
3+
4+
/**
5+
* @title IAgentVaultsFacet
6+
* @notice Interface for the AgentVaultsFacet contract.
7+
*/
8+
interface IAgentVaultsFacet {
9+
10+
/**
11+
* @notice Emitted when an agent vault is added.
12+
* @param agentVaultId The agent vault ID.
13+
* @param agentVaultAddress The agent vault address.
14+
*/
15+
event AgentVaultAdded(
16+
uint256 indexed agentVaultId,
17+
address indexed agentVaultAddress
18+
);
19+
20+
/**
21+
* @notice Emitted when an agent vault is removed.
22+
* @param agentVaultId The agent vault ID.
23+
* @param agentVaultAddress The agent vault address.
24+
*/
25+
event AgentVaultRemoved(
26+
uint256 indexed agentVaultId,
27+
address indexed agentVaultAddress
28+
);
29+
30+
/**
31+
* @notice Reverts if array lengths do not match.
32+
*/
33+
error AgentsVaultsLengthsMismatch();
34+
35+
/**
36+
* @notice Reverts if the agent vault ID is zero.
37+
* @param index The index in the input array.
38+
*/
39+
error AgentVaultIdZero(
40+
uint256 index
41+
);
42+
43+
/**
44+
* @notice Reverts if the agent vault ID is already added.
45+
* @param agentVaultId The agent vault ID.
46+
*/
47+
error AgentVaultIdAlreadyAdded(
48+
uint256 agentVaultId
49+
);
50+
51+
/**
52+
* @notice Reverts if the agent vault address is zero.
53+
* @param index The index in the input array.
54+
*/
55+
error AgentVaultAddressZero(
56+
uint256 index
57+
);
58+
59+
/**
60+
* @notice Reverts if the agent vault address is already added.
61+
* @param agentVaultAddress The agent vault address.
62+
*/
63+
error AgentVaultAddressAlreadyAdded(
64+
address agentVaultAddress
65+
);
66+
67+
/**
68+
* @notice Reverts if the agent vault is invalid.
69+
* @param agentVaultId The agent vault ID.
70+
*/
71+
error InvalidAgentVault(
72+
uint256 agentVaultId
73+
);
74+
75+
/**
76+
* @notice Reverts if the agent is not available.
77+
* @param agentVault The agent vault address.
78+
*/
79+
error AgentNotAvailable(
80+
address agentVault
81+
);
82+
83+
/**
84+
* Returns the list of registered agent vault IDs and their corresponding addresses.
85+
* @return _agentVaultIds The list of registered agent vault IDs.
86+
* @return _agentVaultAddresses The list of registered agent vault addresses.
87+
*/
88+
function getAgentVaults()
89+
external view
90+
returns (uint256[] memory _agentVaultIds, address[] memory _agentVaultAddresses);
91+
}

src/coston2/IAssetManager.sol

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ interface IAssetManager is
181181
returns (CollateralType.Data memory);
182182

183183
/**
184-
* Get the list of all available and deprecated tokens used for collateral.
184+
* Get the list of all available tokens used for collateral.
185185
*/
186186
function getCollateralTypes()
187187
external view
@@ -284,16 +284,6 @@ interface IAssetManager is
284284
string memory _name
285285
) external;
286286

287-
/**
288-
* When current pool collateral token contract (WNat) is replaced by the method setPoolWNatCollateralType,
289-
* pools don't switch automatically. Instead, the agent must call this method that swaps old WNat tokens for
290-
* new ones and sets it for use by the pool.
291-
* NOTE: may only be called by the agent vault owner.
292-
*/
293-
function upgradeWNatContract(
294-
address _agentVault
295-
) external;
296-
297287
////////////////////////////////////////////////////////////////////////////////////
298288
// Collateral withdrawal announcement
299289

@@ -616,6 +606,25 @@ interface IAssetManager is
616606
uint256 _collateralReservationId
617607
) external;
618608

609+
/**
610+
* The minter can make several mistakes in the underlying payment:
611+
* - the payment is too late and is already defaulted before executing
612+
* - the payment is too small so executeMinting reverts
613+
* - the payment is performed twice
614+
* In all of these cases the paid amount ends up on the agent vault's underlying account, but it is not
615+
* confirmed and therefore the agent cannot withdraw it without triggering full liquidation (of course
616+
* the agent can legally withdraw it once the vault is closed).
617+
* This method enables the agent to confirm such payments, converting the deposited amount to agent's
618+
* free underlying.
619+
* NOTE: may only be called by the agent vault owner.
620+
* @param _payment proof of the underlying payment (must have correct payment reference)
621+
* @param _collateralReservationId collateral reservation id
622+
*/
623+
function confirmClosedMintingPayment(
624+
IPayment.Proof calldata _payment,
625+
uint256 _collateralReservationId
626+
) external;
627+
619628
/**
620629
* If a collateral reservation request exists for more than 24 hours, payment or non-payment proof are no longer
621630
* available. In this case the agent can call this method, which burns reserved collateral at market price

src/coston2/IAssetManagerEvents.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ interface IAssetManagerEvents {
164164
uint256 indexed collateralReservationId,
165165
uint256 reservedAmountUBA);
166166

167+
/**
168+
* Emitted when a late or too small payment for an already defaulted or expired minting is confirmed.
169+
* It is equivalent to agent performing underlying topup.
170+
*/
171+
event ConfirmedClosedMintingPayment(
172+
address indexed agentVault,
173+
bytes32 transactionHash,
174+
uint256 depositedUBA);
175+
167176
/**
168177
* Agent performed self minting, either by executing selfMint with underlying deposit or
169178
* by executing mintFromFreeUnderlying (in this case, `mintFromFreeUnderlying` is true and

src/coston2/ICoreVaultClientSettings.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ interface ICoreVaultClientSettings {
1414
function setCoreVaultTransferTimeExtensionSeconds(uint256 _transferTimeExtensionSeconds)
1515
external;
1616

17+
function setCoreVaultTransferDefaultPenaltyBIPS(uint256 _transferDefaultPenaltyBIPS)
18+
external;
19+
1720
function setCoreVaultRedemptionFeeBIPS(uint256 _redemptionFeeBIPS)
1821
external;
1922

@@ -35,6 +38,10 @@ interface ICoreVaultClientSettings {
3538
external view
3639
returns (uint256);
3740

41+
function getCoreVaultTransferDefaultPenaltyBIPS()
42+
external view
43+
returns (uint256);
44+
3845
function getCoreVaultRedemptionFeeBIPS()
3946
external view
4047
returns (uint256);

src/coston2/IExecutorsFacet.sol

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity >=0.8.4 <0.9;
3+
4+
/**
5+
* @title IExecutorsFacet
6+
* @notice Interface for the ExecutorsFacet contract.
7+
*/
8+
interface IExecutorsFacet {
9+
10+
/**
11+
* @notice Emitted when the executor address is set.
12+
* @param executor The new executor address.
13+
*/
14+
event ExecutorSet(
15+
address executor
16+
);
17+
18+
/**
19+
* @notice Emitted when the executor fee is set.
20+
* @param executorFee The new executor fee.
21+
*/
22+
event ExecutorFeeSet(
23+
uint256 executorFee
24+
);
25+
26+
/**
27+
* @notice Reverts if the executor address is invalid.
28+
*/
29+
error InvalidExecutor();
30+
31+
/**
32+
* @notice Reverts if the executor fee is invalid.
33+
*/
34+
error InvalidExecutorFee();
35+
36+
/**
37+
* Returns the executor address and fee.
38+
* @return _executor The executor address.
39+
* @return _executorFee The executor fee (in wei).
40+
*/
41+
function getExecutorInfo()
42+
external view
43+
returns (address payable _executor, uint256 _executorFee);
44+
}

0 commit comments

Comments
 (0)