Skip to content

Commit 14b2057

Browse files
authored
Merge pull request #9 from flare-foundation/0.1.39
Version 0.1.39
2 parents 9bf0c23 + f5f39ef commit 14b2057

29 files changed

+1339
-37
lines changed

coston/IAssetManager.sol

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ interface IAssetManager is
163163
) external view returns (CollateralType.Data memory);
164164

165165
/**
166-
* Get the list of all available and deprecated tokens used for collateral.
166+
* Get the list of all available tokens used for collateral.
167167
*/
168168
function getCollateralTypes()
169169
external
@@ -261,14 +261,6 @@ interface IAssetManager is
261261
string memory _name
262262
) external;
263263

264-
/**
265-
* When current pool collateral token contract (WNat) is replaced by the method setPoolWNatCollateralType,
266-
* pools don't switch automatically. Instead, the agent must call this method that swaps old WNat tokens for
267-
* new ones and sets it for use by the pool.
268-
* NOTE: may only be called by the agent vault owner.
269-
*/
270-
function upgradeWNatContract(address _agentVault) external;
271-
272264
////////////////////////////////////////////////////////////////////////////////////
273265
// Collateral withdrawal announcement
274266

@@ -592,6 +584,25 @@ interface IAssetManager is
592584
uint256 _collateralReservationId
593585
) external;
594586

587+
/**
588+
* The minter can make several mistakes in the underlying payment:
589+
* - the payment is too late and is already defaulted before executing
590+
* - the payment is too small so executeMinting reverts
591+
* - the payment is performed twice
592+
* In all of these cases the paid amount ends up on the agent vault's underlying account, but it is not
593+
* confirmed and therefore the agent cannot withdraw it without triggering full liquidation (of course
594+
* the agent can legally withdraw it once the vault is closed).
595+
* This method enables the agent to confirm such payments, converting the deposited amount to agent's
596+
* free underlying.
597+
* NOTE: may only be called by the agent vault owner.
598+
* @param _payment proof of the underlying payment (must have correct payment reference)
599+
* @param _collateralReservationId collateral reservation id
600+
*/
601+
function confirmClosedMintingPayment(
602+
IPayment.Proof calldata _payment,
603+
uint256 _collateralReservationId
604+
) external;
605+
595606
/**
596607
* If a collateral reservation request exists for more than 24 hours, payment or non-payment proof are no longer
597608
* available. In this case the agent can call this method, which burns reserved collateral at market price

coston/IAssetManagerEvents.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ interface IAssetManagerEvents {
174174
uint256 reservedAmountUBA
175175
);
176176

177+
/**
178+
* Emitted when a late or too small payment for an already defaulted or expired minting is confirmed.
179+
* It is equivalent to agent performing underlying topup.
180+
*/
181+
event ConfirmedClosedMintingPayment(
182+
address indexed agentVault,
183+
bytes32 transactionHash,
184+
uint256 depositedUBA
185+
);
186+
177187
/**
178188
* Agent performed self minting, either by executing selfMint with underlying deposit or
179189
* by executing mintFromFreeUnderlying (in this case, `mintFromFreeUnderlying` is true and

coston/ICoreVaultClientSettings.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ interface ICoreVaultClientSettings {
1313
uint256 _transferTimeExtensionSeconds
1414
) external;
1515

16+
function setCoreVaultTransferDefaultPenaltyBIPS(
17+
uint256 _transferDefaultPenaltyBIPS
18+
) external;
19+
1620
function setCoreVaultRedemptionFeeBIPS(uint256 _redemptionFeeBIPS) external;
1721

1822
function setCoreVaultMinimumAmountLeftBIPS(
@@ -30,6 +34,11 @@ interface ICoreVaultClientSettings {
3034
view
3135
returns (uint256);
3236

37+
function getCoreVaultTransferDefaultPenaltyBIPS()
38+
external
39+
view
40+
returns (uint256);
41+
3342
function getCoreVaultRedemptionFeeBIPS() external view returns (uint256);
3443

3544
function getCoreVaultMinimumAmountLeftBIPS()

coston2/IAgentVaultsFacet.sol

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

coston2/IAssetManager.sol

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ interface IAssetManager is
163163
) external view returns (CollateralType.Data memory);
164164

165165
/**
166-
* Get the list of all available and deprecated tokens used for collateral.
166+
* Get the list of all available tokens used for collateral.
167167
*/
168168
function getCollateralTypes()
169169
external
@@ -261,14 +261,6 @@ interface IAssetManager is
261261
string memory _name
262262
) external;
263263

264-
/**
265-
* When current pool collateral token contract (WNat) is replaced by the method setPoolWNatCollateralType,
266-
* pools don't switch automatically. Instead, the agent must call this method that swaps old WNat tokens for
267-
* new ones and sets it for use by the pool.
268-
* NOTE: may only be called by the agent vault owner.
269-
*/
270-
function upgradeWNatContract(address _agentVault) external;
271-
272264
////////////////////////////////////////////////////////////////////////////////////
273265
// Collateral withdrawal announcement
274266

@@ -592,6 +584,25 @@ interface IAssetManager is
592584
uint256 _collateralReservationId
593585
) external;
594586

587+
/**
588+
* The minter can make several mistakes in the underlying payment:
589+
* - the payment is too late and is already defaulted before executing
590+
* - the payment is too small so executeMinting reverts
591+
* - the payment is performed twice
592+
* In all of these cases the paid amount ends up on the agent vault's underlying account, but it is not
593+
* confirmed and therefore the agent cannot withdraw it without triggering full liquidation (of course
594+
* the agent can legally withdraw it once the vault is closed).
595+
* This method enables the agent to confirm such payments, converting the deposited amount to agent's
596+
* free underlying.
597+
* NOTE: may only be called by the agent vault owner.
598+
* @param _payment proof of the underlying payment (must have correct payment reference)
599+
* @param _collateralReservationId collateral reservation id
600+
*/
601+
function confirmClosedMintingPayment(
602+
IPayment.Proof calldata _payment,
603+
uint256 _collateralReservationId
604+
) external;
605+
595606
/**
596607
* If a collateral reservation request exists for more than 24 hours, payment or non-payment proof are no longer
597608
* available. In this case the agent can call this method, which burns reserved collateral at market price

coston2/IAssetManagerEvents.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ interface IAssetManagerEvents {
174174
uint256 reservedAmountUBA
175175
);
176176

177+
/**
178+
* Emitted when a late or too small payment for an already defaulted or expired minting is confirmed.
179+
* It is equivalent to agent performing underlying topup.
180+
*/
181+
event ConfirmedClosedMintingPayment(
182+
address indexed agentVault,
183+
bytes32 transactionHash,
184+
uint256 depositedUBA
185+
);
186+
177187
/**
178188
* Agent performed self minting, either by executing selfMint with underlying deposit or
179189
* by executing mintFromFreeUnderlying (in this case, `mintFromFreeUnderlying` is true and

coston2/ICoreVaultClientSettings.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ interface ICoreVaultClientSettings {
1313
uint256 _transferTimeExtensionSeconds
1414
) external;
1515

16+
function setCoreVaultTransferDefaultPenaltyBIPS(
17+
uint256 _transferDefaultPenaltyBIPS
18+
) external;
19+
1620
function setCoreVaultRedemptionFeeBIPS(uint256 _redemptionFeeBIPS) external;
1721

1822
function setCoreVaultMinimumAmountLeftBIPS(
@@ -30,6 +34,11 @@ interface ICoreVaultClientSettings {
3034
view
3135
returns (uint256);
3236

37+
function getCoreVaultTransferDefaultPenaltyBIPS()
38+
external
39+
view
40+
returns (uint256);
41+
3342
function getCoreVaultRedemptionFeeBIPS() external view returns (uint256);
3443

3544
function getCoreVaultMinimumAmountLeftBIPS()

coston2/IExecutorsFacet.sol

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
* @notice Emitted when the executor address is set.
11+
* @param executor The new executor address.
12+
*/
13+
event ExecutorSet(address executor);
14+
15+
/**
16+
* @notice Emitted when the executor fee is set.
17+
* @param executorFee The new executor fee.
18+
*/
19+
event ExecutorFeeSet(uint256 executorFee);
20+
21+
/**
22+
* @notice Reverts if the executor address is invalid.
23+
*/
24+
error InvalidExecutor();
25+
26+
/**
27+
* @notice Reverts if the executor fee is invalid.
28+
*/
29+
error InvalidExecutorFee();
30+
31+
/**
32+
* Returns the executor address and fee.
33+
* @return _executor The executor address.
34+
* @return _executorFee The executor fee (in wei).
35+
*/
36+
function getExecutorInfo()
37+
external
38+
view
39+
returns (address payable _executor, uint256 _executorFee);
40+
}

coston2/IInstructionFeesFacet.sol

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity >=0.8.4 <0.9;
3+
4+
/**
5+
* @title IInstructionFeesFacet
6+
* @notice Interface for the InstructionFeesFacet contract.
7+
*/
8+
interface IInstructionFeesFacet {
9+
/**
10+
* @notice Emitted when the default instruction fee is set.
11+
* @param defaultInstructionFee The new default instruction fee.
12+
*/
13+
event DefaultInstructionFeeSet(uint256 defaultInstructionFee);
14+
15+
/**
16+
* @notice Emitted when an instruction-specific fee is set.
17+
* @param instructionId The instruction ID.
18+
* @param instructionFee The fee for the instruction.
19+
*/
20+
event InstructionFeeSet(
21+
uint256 indexed instructionId,
22+
uint256 instructionFee
23+
);
24+
25+
/**
26+
* @notice Emitted when an instruction-specific fee is removed.
27+
* @param instructionId The instruction ID.
28+
*/
29+
event InstructionFeeRemoved(uint256 indexed instructionId);
30+
31+
/**
32+
* @notice Reverts if array lengths do not match.
33+
*/
34+
error InstructionFeesLengthsMismatch();
35+
36+
/**
37+
* @notice Reverts if the instruction fee is invalid.
38+
* @param instructionId The instruction ID.
39+
*/
40+
error InvalidInstructionFee(uint256 instructionId);
41+
42+
/**
43+
* @notice Reverts if the instruction fee is not set.
44+
* @param instructionId The instruction ID.
45+
*/
46+
error InstructionFeeNotSet(uint256 instructionId);
47+
48+
/**
49+
* @notice Returns the default instruction fee.
50+
* @return The default instruction fee in underlying asset's smallest unit (e.g., drops for XRP).
51+
*/
52+
function getDefaultInstructionFee() external view returns (uint256);
53+
54+
/**
55+
* @notice Returns the instruction fee for a given instruction ID.
56+
* @param _instructionId The ID of the instruction.
57+
* @return The instruction fee in underlying asset's smallest unit (e.g., drops for XRP).
58+
*/
59+
function getInstructionFee(
60+
uint256 _instructionId
61+
) external view returns (uint256);
62+
}

0 commit comments

Comments
 (0)