Skip to content

Commit

Permalink
add to interface
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh committed Mar 31, 2024
1 parent 104cdbf commit cac7b08
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
8 changes: 6 additions & 2 deletions contracts/src/Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ contract Gateway is IGateway, IInitializable {
}

constructor(
address beefyClient,
address beefyLightClient,
address agentExecutor,
ParaID bridgeHubParaID,
bytes32 bridgeHubAgentID,
Expand All @@ -107,7 +107,7 @@ contract Gateway is IGateway, IInitializable {
revert InvalidConstructorParams();
}

BEEFY_CLIENT = beefyClient;
BEEFY_CLIENT = beefyLightClient;
AGENT_EXECUTOR = agentExecutor;
BRIDGE_HUB_PARA_ID_ENCODED = ScaleCodec.encodeU32(uint32(ParaID.unwrap(bridgeHubParaID)));
BRIDGE_HUB_PARA_ID = bridgeHubParaID;
Expand Down Expand Up @@ -224,6 +224,10 @@ contract Gateway is IGateway, IInitializable {
/**
* Getters
*/
function beefyClient() external view returns (address) {
return BEEFY_CLIENT;
}

function operatingMode() external view returns (OperatingMode) {
return CoreStorage.layout().mode;
}
Expand Down
3 changes: 3 additions & 0 deletions contracts/src/interfaces/IGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ interface IGateway {
/// @dev Emitted when a command is sent to register a new wrapped token on AssetHub
event TokenRegistrationSent(address token);

/// @dev the address of the BEEFY light client used to verify messages.
function beefyClient() external view returns (address);

/// @dev Check whether a token is registered
function isTokenRegistered(address token) external view returns (bool);

Expand Down
4 changes: 4 additions & 0 deletions contracts/test/Gateway.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -909,4 +909,8 @@ contract GatewayTest is Test {
vm.expectRevert(Assets.InvalidDestinationFee.selector);
IGateway(address(gateway)).sendToken{value: fee}(address(token), destPara, recipientAddress32, 0, 1);
}

function testGatewayExposesBeefyCleint() public {
assertEq(IGateway(address(gateway)).beefyClient(), address(0));
}
}
4 changes: 4 additions & 0 deletions contracts/test/mocks/GatewayUpgradeMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ contract GatewayUpgradeMock is IGateway, IInitializable {
return address(0);
}

function beefyClient() external pure returns (address) {
return address(0);
}

function isTokenRegistered(address) external pure returns (bool) {
return true;
}
Expand Down
Loading

0 comments on commit cac7b08

Please sign in to comment.