Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add setters for evm intents #7

Merged
merged 1 commit into from
Oct 28, 2024
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
11 changes: 10 additions & 1 deletion contracts/evm/contracts/Intents/Intents.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ pragma abicoder v2;
import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import "openzeppelin-contracts/contracts/utils/Strings.sol";
import "@iconfoundation/xcall-solidity-library/utils/ParseAddress.sol";
import "openzeppelin-contracts/contracts/access/Ownable.sol";


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

/// @title ICONIntents
/// @notice Implements the intent-based swapping protocol for cross-chain swaps.
contract Intents is GeneralizedConnection {
contract Intents is GeneralizedConnection, Ownable {
using Encoding for *;
using Strings for string;
using SafeERC20 for IERC20;
Expand Down Expand Up @@ -71,6 +73,13 @@ contract Intents is GeneralizedConnection {
permit2 = IPermit2(_premit2);
}

function setFeeHandler(address _feeHandler) external onlyOwner {
feeHandler = _feeHandler;
}

function setProtocolFee(uint16 _protocolFee) external onlyOwner {
protocolFee = _protocolFee;
}

function swap(
Types.SwapOrder memory order
Expand Down
2 changes: 1 addition & 1 deletion contracts/evm/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@xcall/contracts/=./contracts/
@intents/contracts/=./contracts/
@iconfoundation/xcall-solidity-library/=./library/xcall/
@xcall/utils/=./library/utils/
ds-test/=lib/forge-std/lib/ds-test/src/
Expand Down
24 changes: 24 additions & 0 deletions contracts/evm/test/Intents/Intents.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -642,4 +642,28 @@ contract IntentsTest is Test {
// Assert
assertTrue(intents.finishedOrders(keccak256(order.encode())));
}

function testSetFeeHandler() public {
address newFeeHandler = address(0x891);
intents.setFeeHandler(newFeeHandler);
assertEq(intents.feeHandler(), newFeeHandler);

address nonOwner = address(0x892);
vm.startPrank(nonOwner);

vm.expectRevert("Ownable: caller is not the owner");
intents.setFeeHandler(newFeeHandler);
}

function testSetProtocolFee() public {
uint16 newFee = 13;
intents.setProtocolFee(newFee);
assertEq(intents.protocolFee(), newFee);

address nonOwner = address(0x892);
vm.startPrank(nonOwner);

vm.expectRevert("Ownable: caller is not the owner");
intents.setProtocolFee(newFee);
}
}
Loading