Skip to content

Commit

Permalink
fix #119
Browse files Browse the repository at this point in the history
  • Loading branch information
hujw77 committed Feb 19, 2024
1 parent f1b5418 commit 3509b97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/UserConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ contract UserConfig {
/// @param oracle Oracle which the user application choose.
/// @param relayer Relayer which the user application choose.
event AppConfigUpdated(address indexed ua, address oracle, address relayer);
/// @dev Notifies an observer that the setter is changed.
/// @param oldSetter Old setter address.
/// @param newSetter New setter address.
event SetterChanged(address indexed oldSetter, address indexed newSetter);

modifier onlySetter() {
require(msg.sender == setter, "!auth");
Expand All @@ -52,9 +56,11 @@ contract UserConfig {

/// @dev Change setter.
/// @notice Only current setter could call.
/// @param setter_ New setter.
function changeSetter(address setter_) external onlySetter {
setter = setter_;
/// @param newSetter New setter.
function changeSetter(address newSetter) external onlySetter {
address oldSetter = setter;
setter = newSetter;
emit SetterChanged(oldSetter, newSetter);
}

/// @dev Set default user config for all user application.
Expand Down
7 changes: 5 additions & 2 deletions src/eco/Relayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ contract Relayer {
event SetDstPrice(uint256 indexed chainId, uint128 dstPriceRatio, uint128 dstGasPriceInWei);
event SetDstConfig(uint256 indexed chainId, uint64 baseGas, uint64 gasPerByte);
event SetApproved(address operator, bool approve);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

struct DstPrice {
uint128 dstPriceRatio; // dstPrice / localPrice * 10^10
Expand Down Expand Up @@ -69,8 +70,10 @@ contract Relayer {
return approvedOf[operator];
}

function changeOwner(address owner_) external onlyOwner {
owner = owner_;
function changeOwner(address newOwner) external onlyOwner {
address oldOwner = owner;
owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}

function setApproved(address operator, bool approve) public onlyOwner {
Expand Down

0 comments on commit 3509b97

Please sign in to comment.