Skip to content

Commit 2c609b2

Browse files
authored
Merge pull request #7 from icon-project/feat/add-setters-for-evm-intents
feat: add setters for evm intents
2 parents 2a84cfe + 96d5703 commit 2c609b2

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

contracts/evm/contracts/Intents/Intents.sol

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ pragma abicoder v2;
55
import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
66
import "openzeppelin-contracts/contracts/utils/Strings.sol";
77
import "@iconfoundation/xcall-solidity-library/utils/ParseAddress.sol";
8+
import "openzeppelin-contracts/contracts/access/Ownable.sol";
9+
810

911
import "./Types.sol";
1012
import "./Encoding.sol";
@@ -16,7 +18,7 @@ import {console} from "forge-std/console.sol";
1618

1719
/// @title ICONIntents
1820
/// @notice Implements the intent-based swapping protocol for cross-chain swaps.
19-
contract Intents is GeneralizedConnection {
21+
contract Intents is GeneralizedConnection, Ownable {
2022
using Encoding for *;
2123
using Strings for string;
2224
using SafeERC20 for IERC20;
@@ -71,6 +73,13 @@ contract Intents is GeneralizedConnection {
7173
permit2 = IPermit2(_premit2);
7274
}
7375

76+
function setFeeHandler(address _feeHandler) external onlyOwner {
77+
feeHandler = _feeHandler;
78+
}
79+
80+
function setProtocolFee(uint16 _protocolFee) external onlyOwner {
81+
protocolFee = _protocolFee;
82+
}
7483

7584
function swap(
7685
Types.SwapOrder memory order

contracts/evm/remappings.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@xcall/contracts/=./contracts/
1+
@intents/contracts/=./contracts/
22
@iconfoundation/xcall-solidity-library/=./library/xcall/
33
@xcall/utils/=./library/utils/
44
ds-test/=lib/forge-std/lib/ds-test/src/

contracts/evm/test/Intents/Intents.t.sol

+24
Original file line numberDiff line numberDiff line change
@@ -642,4 +642,28 @@ contract IntentsTest is Test {
642642
// Assert
643643
assertTrue(intents.finishedOrders(keccak256(order.encode())));
644644
}
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+
}
645669
}

0 commit comments

Comments
 (0)