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
5 changes: 5 additions & 0 deletions .changeset/chatty-sloths-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@layerzerolabs/oft-evm-upgradeable": patch
---

Add virtual keyword to overridable functions
6 changes: 3 additions & 3 deletions packages/oft-evm-upgradeable/contracts/oft/FeeUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract contract FeeUpgradeable is IFee, Initializable, OwnableUpgradeable {
/**
* @dev Sets the default fee basis points (BPS) for all destinations.
*/
function setDefaultFeeBps(uint16 _feeBps) external onlyOwner {
function setDefaultFeeBps(uint16 _feeBps) external virtual onlyOwner {
if (_feeBps > BPS_DENOMINATOR) revert IFee.InvalidBps();
FeeStorage storage $ = _getFeeStorage();
$.defaultFeeBps = _feeBps;
Expand All @@ -49,7 +49,7 @@ abstract contract FeeUpgradeable is IFee, Initializable, OwnableUpgradeable {
/**
* @dev Sets the fee basis points (BPS) for a specific destination LayerZero EndpointV2 ID.
*/
function setFeeBps(uint32 _dstEid, uint16 _feeBps, bool _enabled) external onlyOwner {
function setFeeBps(uint32 _dstEid, uint16 _feeBps, bool _enabled) external virtual onlyOwner {
if (_feeBps > BPS_DENOMINATOR) revert IFee.InvalidBps();
FeeStorage storage $ = _getFeeStorage();
$.feeBps[_dstEid] = FeeConfig(_feeBps, _enabled);
Expand All @@ -65,7 +65,7 @@ abstract contract FeeUpgradeable is IFee, Initializable, OwnableUpgradeable {
return bps == 0 ? 0 : (_amount * bps) / BPS_DENOMINATOR;
}

function _getFeeBps(uint32 _dstEid) internal view returns (uint16) {
function _getFeeBps(uint32 _dstEid) internal view virtual returns (uint16) {
FeeStorage storage $ = _getFeeStorage();
FeeConfig memory config = $.feeBps[_dstEid];
return config.enabled ? config.feeBps : $.defaultFeeBps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ abstract contract NativeOFTAdapterUpgradeable is OFTCoreUpgradeable {
* @dev Returns the address of the native token
* @return The address of the native token.
*/
function token() public pure returns (address) {
function token() public pure virtual returns (address) {
return address(0);
}

Expand Down Expand Up @@ -135,7 +135,7 @@ abstract contract NativeOFTAdapterUpgradeable is OFTCoreUpgradeable {
* @param _nativeFee The native fee to be paid.
* @return nativeFee The amount of native currency paid.
*/
function _payNative(uint256 _nativeFee) internal pure override returns (uint256 nativeFee) {
function _payNative(uint256 _nativeFee) internal pure virtual override returns (uint256 nativeFee) {
return _nativeFee;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ abstract contract OFTAdapterFeeUpgradeable is OFTAdapterUpgradeable, FeeUpgradea
}
}

function feeBalance() public view returns (uint256) {
function feeBalance() public view virtual returns (uint256) {
OFTAdapterFeeStorage storage $ = _getOFTAdapterFeeStorage();
return $.feeBalance;
}
Expand Down Expand Up @@ -72,7 +72,7 @@ abstract contract OFTAdapterFeeUpgradeable is OFTAdapterUpgradeable, FeeUpgradea
* @notice Withdraws accumulated fees to a specified address.
* @param _to The address to which the fees will be withdrawn.
*/
function withdrawFees(address _to) external onlyOwner {
function withdrawFees(address _to) external virtual onlyOwner {
// @dev doesn't allow owner to pull from the locked assets of the contract,
// only from accumulated fees
OFTAdapterFeeStorage storage $ = _getOFTAdapterFeeStorage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ abstract contract OFTAdapterUpgradeable is OFTCoreUpgradeable {
*
* @dev In the case of OFTAdapter, address(this) and erc20 are NOT the same contract.
*/
function token() public view returns (address) {
function token() public view virtual returns (address) {
return address(innerToken);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ abstract contract OFTCoreUpgradeable is

function __OFTCore_init_unchained() internal onlyInitializing {}

function msgInspector() public view returns (address) {
function msgInspector() public view virtual returns (address) {
OFTCoreStorage storage $ = _getOFTCoreStorage();
return $.msgInspector;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract contract OFTFeeUpgradeable is OFTUpgradeable, FeeUpgradeable {
}
}

function feeBalance() public view returns (uint256) {
function feeBalance() public view virtual returns (uint256) {
OFTFeeStorage storage $ = _getOFTFeeStorage();
return $.feeBalance;
}
Expand Down Expand Up @@ -121,7 +121,7 @@ abstract contract OFTFeeUpgradeable is OFTUpgradeable, FeeUpgradeable {
* @notice Withdraws accumulated fees to a specified address.
* @param _to The address to which the fees will be withdrawn.
*/
function withdrawFees(address _to) external onlyOwner {
function withdrawFees(address _to) external virtual onlyOwner {
OFTFeeStorage storage $ = _getOFTFeeStorage();
uint256 balance = $.feeBalance;
if (balance == 0) revert NoFeesToWithdraw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract contract OFTUpgradeable is OFTCoreUpgradeable, ERC20Upgradeable {
*
* @dev In the case of OFT, address(this) and erc20 are the same contract.
*/
function token() public view returns (address) {
function token() public view virtual returns (address) {
return address(this);
}

Expand Down
Loading