Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions contracts/src/FeeVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,31 @@ contract FeeVault {
hypNativeMinter = IHypNativeMinter(_hypNativeMinter);
emit HypNativeMinterUpdated(_hypNativeMinter);
}

/// @notice Return the full configuration currently stored in the contract.
function getConfig()
external
view
returns (
address _owner,
uint32 _destinationDomain,
bytes32 _recipientAddress,
uint256 _minimumAmount,
uint256 _callFee,
uint256 _bridgeShareBps,
address _otherRecipient,
address _hypNativeMinter
)
{
return (
owner,
destinationDomain,
recipientAddress,
minimumAmount,
callFee,
bridgeShareBps,
otherRecipient,
address(hypNativeMinter)
);
}
Comment on lines +134 to +159
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and future extensibility, consider returning a struct instead of a large tuple. This makes it easier for clients to consume the data and allows for non-breaking changes if more configuration variables are added later.

You would need to define a Config struct at the contract level like this:

struct Config {
    address owner;
    uint32 destinationDomain;
    bytes32 recipientAddress;
    uint256 minimumAmount;
    uint256 callFee;
    uint256 bridgeShareBps;
    address otherRecipient;
    address hypNativeMinter;
}

Then, the function can be updated as follows. Note that this will require updating test_GetConfig in FeeVault.t.sol to handle the struct return type.

    /// @notice Return the full configuration currently stored in the contract.
    function getConfig() external view returns (Config memory) {
        return Config({
            owner: owner,
            destinationDomain: destinationDomain,
            recipientAddress: recipientAddress,
            minimumAmount: minimumAmount,
            callFee: callFee,
            bridgeShareBps: bridgeShareBps,
            otherRecipient: otherRecipient,
            hypNativeMinter: address(hypNativeMinter)
        });
    }

}
22 changes: 22 additions & 0 deletions contracts/test/FeeVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ contract FeeVaultTest is Test {
feeVault.setHypNativeMinter(address(mockMinter));
}

function test_GetConfig() public {
(
address cfgOwner,
uint32 cfgDestination,
bytes32 cfgRecipient,
uint256 cfgMinAmount,
uint256 cfgCallFee,
uint256 cfgBridgeShare,
address cfgOtherRecipient,
address cfgHypNativeMinter
) = feeVault.getConfig();

assertEq(cfgOwner, owner);
assertEq(cfgDestination, destination);
assertEq(cfgRecipient, recipient);
assertEq(cfgMinAmount, minAmount);
assertEq(cfgCallFee, fee);
assertEq(cfgBridgeShare, 10000);
assertEq(cfgOtherRecipient, otherRecipient);
assertEq(cfgHypNativeMinter, address(mockMinter));
}

function test_Receive() public {
uint256 amount = 1 ether;
(bool success,) = address(feeVault).call{value: amount}("");
Expand Down
Loading