Skip to content

Commit

Permalink
Merge recent from main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Nov 6, 2023
1 parent ae15055 commit 39027c0
Show file tree
Hide file tree
Showing 65 changed files with 926 additions and 581 deletions.
2 changes: 1 addition & 1 deletion contracts/foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[profile.default]
solc_version = "0.8.20"
solc_version = "0.8.22"
optimizer = true
optimizer_runs = 20_000
via_ir = true
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/Agent.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
pragma solidity 0.8.20;
pragma solidity 0.8.22;

/// @title An agent contract that acts on behalf of a consensus system on Polkadot
/// @dev Instances of this contract act as an agents for arbitrary consensus systems on Polkadot. These consensus systems
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/AgentExecutor.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
pragma solidity 0.8.20;
pragma solidity 0.8.22;

import {AgentExecuteCommand, ParaID} from "./Types.sol";
import {SubstrateTypes} from "./SubstrateTypes.sol";
Expand Down
20 changes: 7 additions & 13 deletions contracts/src/Assets.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
pragma solidity 0.8.20;
pragma solidity 0.8.22;

import {IERC20} from "./interfaces/IERC20.sol";
import {IGateway} from "./interfaces/IGateway.sol";
Expand All @@ -17,12 +17,6 @@ library Assets {
using Address for address;
using SafeTokenTransferFrom for IERC20;

/// @dev Emitted once the funds are locked and a message is successfully queued.
event TokenSent(
address indexed token, address indexed sender, ParaID destinationChain, bytes destinationAddress, uint128 amount
);
event TokenRegistrationSent(address token);

/* Errors */
error InvalidToken();
error InvalidAmount();
Expand All @@ -49,13 +43,13 @@ library Assets {

_transferToAgent(assetHubAgent, token, sender, amount);
if (destinationChain == assetHubParaID) {
payload = SubstrateTypes.SendToken(address(this), token, destinationAddress, amount);
payload = SubstrateTypes.SendToken(token, destinationAddress, amount);
} else {
payload = SubstrateTypes.SendToken(address(this), token, destinationChain, destinationAddress, amount);
payload = SubstrateTypes.SendToken(token, destinationChain, destinationAddress, amount);
}
extraFee = $.sendTokenFee;

emit TokenSent(sender, token, destinationChain, abi.encodePacked(destinationAddress), amount);
emit IGateway.TokenSent(sender, token, destinationChain, abi.encodePacked(destinationAddress), amount);
}

function sendToken(
Expand All @@ -77,7 +71,7 @@ library Assets {

payload = SubstrateTypes.SendToken(address(this), token, destinationChain, destinationAddress, amount);
extraFee = $.sendTokenFee;
emit TokenSent(sender, token, destinationChain, abi.encodePacked(destinationAddress), amount);
emit IGateway.TokenSent(sender, token, destinationChain, abi.encodePacked(destinationAddress), amount);
}

/// @dev transfer tokens from the sender to the specified
Expand All @@ -102,9 +96,9 @@ library Assets {
revert InvalidToken();
}

payload = SubstrateTypes.RegisterToken(address(this), token);
payload = SubstrateTypes.RegisterToken(token);
extraFee = $.registerTokenFee;

emit TokenRegistrationSent(token);
emit IGateway.TokenRegistrationSent(token);
}
}
Loading

0 comments on commit 39027c0

Please sign in to comment.