Skip to content

Commit

Permalink
Execute with command decoded
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Feb 29, 2024
1 parent 3d18d1a commit 8ceb5ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions contracts/src/AgentExecutor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ contract AgentExecutor {
/// @dev Execute a message which originated from the Polkadot side of the bridge. In other terms,
/// the `data` parameter is constructed by the BridgeHub parachain.
///
function execute(bytes memory data) external {
(AgentExecuteCommand command, bytes memory params) = abi.decode(data, (AgentExecuteCommand, bytes));
function execute(AgentExecuteCommand command, bytes memory params) external {
if (command == AgentExecuteCommand.TransferToken) {
(address token, address recipient, uint128 amount) = abi.decode(params, (address, address, uint128));
_transferToken(token, recipient, amount);
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ contract Gateway is IGateway, IInitializable {
}
}

bytes memory call = abi.encodeCall(AgentExecutor.execute, params.payload);
bytes memory call = abi.encodeCall(AgentExecutor.execute, (command, commandParams));

(bool success, bytes memory returndata) = Agent(payable(agent)).invoke(AGENT_EXECUTOR, call);
if (!success) {
Expand Down

0 comments on commit 8ceb5ee

Please sign in to comment.