Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCalibur committed Dec 15, 2024
1 parent 396d947 commit 22c2b49
Show file tree
Hide file tree
Showing 13 changed files with 382 additions and 173 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ pnpm-error.log
# Editor and OS files
.DS_Store
.idea


# Soldeer
/dependencies
2 changes: 1 addition & 1 deletion contracts/AbraOFTAdapterUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SenderWithFees } from "./SenderWithFees.sol";
contract AbraOFTAdapterUpgradeable is OFTAdapterUpgradeable, SenderWithFees {
constructor(address _token, address _lzEndpoint) OFTAdapterUpgradeable(_token, _lzEndpoint) {}

function initialize(address _delegate) public initializer {
function initialize(address _delegate) public virtual initializer {
__OFTAdapter_init(_delegate);
__Ownable_init(_delegate);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/AbraOFTUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SenderWithFees } from "./SenderWithFees.sol";
contract AbraOFTUpgradeable is OFTUpgradeable, SenderWithFees {
constructor(address _lzEndpoint) OFTUpgradeable(_lzEndpoint) {}

function initialize(string memory _name, string memory _symbol, address _delegate) public initializer {
function initialize(string memory _name, string memory _symbol, address _delegate) public virtual initializer {
__OFT_init(_name, _symbol, _delegate);
__Ownable_init(_delegate);
}
Expand Down
10 changes: 5 additions & 5 deletions contracts/Feehandler.sol → contracts/FeeHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { IFeeHandler } from "./interfaces/IFeeHandler.sol";
import { IAggregator } from "./interfaces/IAggregator.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";

enum QuoteType {
Oracle,
Fixed
}

contract FeeHandler is IFeeHandler, Ownable {
event FixedNativeFeeChanged(uint256 previous, uint256 current);
event OracleImplementationChange(IAggregator indexed previous, IAggregator indexed current);
Expand All @@ -15,11 +20,6 @@ contract FeeHandler is IFeeHandler, Ownable {
error InvalidQuoteType(QuoteType);
error Unauthorized();

enum QuoteType {
Oracle,
Fixed
}

uint256 public constant DEFAULT_USD_FEE = 1e18;

address public override feeTo;
Expand Down
4 changes: 0 additions & 4 deletions contracts/SenderWithFees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ abstract contract SenderWithFees is OAppSenderUpgradeable {
);
}

if (msg.value < _fee.nativeFee + protocolNativeFees) {
revert NotEnoughNative(msg.value);
}

if (_fee.lzTokenFee > 0) {
_payLzToken(_fee.lzTokenFee);
}
Expand Down
9 changes: 0 additions & 9 deletions contracts/mocks/AbraOFTAdapterUpgradeableMock.sol

This file was deleted.

13 changes: 0 additions & 13 deletions contracts/mocks/AbraOFTpgradeableMock.sol

This file was deleted.

44 changes: 27 additions & 17 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
[profile.default]
src = "src"
out = "artifacts"
libs = ["node_modules"]
remappings = [
"@axelar-network/=node_modules/@axelar-network/",
"@chainlink/=node_modules/@chainlink/",
"@ensdomains/=node_modules/@ensdomains/",
"@eth-optimism/=node_modules/@eth-optimism/",
"@ethereum-waffle/=node_modules/@ethereum-waffle/",
"@layerzerolabs/=node_modules/@layerzerolabs/",
"@openzeppelin/=node_modules/@openzeppelin/",
"ds-test/=node_modules/ds-test/",
"forge-std/=node_modules/forge-std/",
"hardhat-deploy/=node_modules/hardhat-deploy/",
"hardhat/=node_modules/hardhat/",
"solidity-bytes-utils/=node_modules/solidity-bytes-utils/",
solc-version = '0.8.22'
src = 'contracts'
out = 'out'
test = 'test'
cache_path = 'cache/foundry'
optimizer = true
optimizer_runs = 200

libs = [
# We provide a set of useful contract utilities
# in the lib directory of @layerzerolabs/toolbox-foundry:
#
# - forge-std
# - ds-test
# - solidity-bytes-utils
'node_modules/@layerzerolabs/toolbox-foundry/lib',
'node_modules',
]

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
remappings = [
# Due to a misconfiguration of solidity-bytes-utils, an outdated version
# of forge-std is being dragged in
#
# To remedy this, we'll remap the ds-test and forge-std imports to ou own versions
'ds-test/=node_modules/@layerzerolabs/toolbox-foundry/lib/ds-test',
'forge-std/=node_modules/@layerzerolabs/toolbox-foundry/lib/forge-std',
'@layerzerolabs/=node_modules/@layerzerolabs/',
'@openzeppelin/=node_modules/@openzeppelin/',
]
Loading

0 comments on commit 22c2b49

Please sign in to comment.