File tree 3 files changed +35
-2
lines changed
3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ pragma abicoder v2;
5
5
import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol " ;
6
6
import "openzeppelin-contracts/contracts/utils/Strings.sol " ;
7
7
import "@iconfoundation/xcall-solidity-library/utils/ParseAddress.sol " ;
8
+ import "openzeppelin-contracts/contracts/access/Ownable.sol " ;
9
+
8
10
9
11
import "./Types.sol " ;
10
12
import "./Encoding.sol " ;
@@ -16,7 +18,7 @@ import {console} from "forge-std/console.sol";
16
18
17
19
/// @title ICONIntents
18
20
/// @notice Implements the intent-based swapping protocol for cross-chain swaps.
19
- contract Intents is GeneralizedConnection {
21
+ contract Intents is GeneralizedConnection , Ownable {
20
22
using Encoding for * ;
21
23
using Strings for string ;
22
24
using SafeERC20 for IERC20 ;
@@ -71,6 +73,13 @@ contract Intents is GeneralizedConnection {
71
73
permit2 = IPermit2 (_premit2);
72
74
}
73
75
76
+ function setFeeHandler (address _feeHandler ) external onlyOwner {
77
+ feeHandler = _feeHandler;
78
+ }
79
+
80
+ function setProtocolFee (uint16 _protocolFee ) external onlyOwner {
81
+ protocolFee = _protocolFee;
82
+ }
74
83
75
84
function swap (
76
85
Types.SwapOrder memory order
Original file line number Diff line number Diff line change 1
- @xcall /contracts/=./contracts/
1
+ @intents /contracts/=./contracts/
2
2
@iconfoundation/xcall-solidity-library/=./library/xcall/
3
3
@xcall/utils/=./library/utils/
4
4
ds-test/=lib/forge-std/lib/ds-test/src/
Original file line number Diff line number Diff line change @@ -642,4 +642,28 @@ contract IntentsTest is Test {
642
642
// Assert
643
643
assertTrue (intents.finishedOrders (keccak256 (order.encode ())));
644
644
}
645
+
646
+ function testSetFeeHandler () public {
647
+ address newFeeHandler = address (0x891 );
648
+ intents.setFeeHandler (newFeeHandler);
649
+ assertEq (intents.feeHandler (), newFeeHandler);
650
+
651
+ address nonOwner = address (0x892 );
652
+ vm.startPrank (nonOwner);
653
+
654
+ vm.expectRevert ("Ownable: caller is not the owner " );
655
+ intents.setFeeHandler (newFeeHandler);
656
+ }
657
+
658
+ function testSetProtocolFee () public {
659
+ uint16 newFee = 13 ;
660
+ intents.setProtocolFee (newFee);
661
+ assertEq (intents.protocolFee (), newFee);
662
+
663
+ address nonOwner = address (0x892 );
664
+ vm.startPrank (nonOwner);
665
+
666
+ vm.expectRevert ("Ownable: caller is not the owner " );
667
+ intents.setProtocolFee (newFee);
668
+ }
645
669
}
You can’t perform that action at this time.
0 commit comments