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

Upgrade to Solidity 0.8.22 #992

Merged
merged 6 commits into from
Nov 5, 2023
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
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
14 changes: 4 additions & 10 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 Down Expand Up @@ -55,7 +49,7 @@ library Assets {
}
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 Down Expand Up @@ -105,6 +99,6 @@ library Assets {
payload = SubstrateTypes.RegisterToken(token);
extraFee = $.registerTokenFee;

emit TokenRegistrationSent(token);
emit IGateway.TokenRegistrationSent(token);
}
}
2 changes: 1 addition & 1 deletion contracts/src/BeefyClient.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 {ECDSA} from "openzeppelin/utils/cryptography/ECDSA.sol";
import {SubstrateMerkleProof} from "./utils/SubstrateMerkleProof.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/DeployScript.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 {WETH9} from "canonical-weth/WETH9.sol";
import {Script} from "forge-std/Script.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/FundAgent.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 {WETH9} from "canonical-weth/WETH9.sol";
import {Script} from "forge-std/Script.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/Gateway.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 {MerkleProof} from "openzeppelin/utils/cryptography/MerkleProof.sol";
import {Verification} from "./Verification.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/GatewayProxy.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 {ERC1967} from "./utils/ERC1967.sol";
import {IInitializable} from "./interfaces/IInitializable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/SubstrateTypes.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 {ScaleCodec} from "./utils/ScaleCodec.sol";
import {ParaID} from "./Types.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/Types.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;

type ParaID is uint256;

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/Verification.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 {SubstrateMerkleProof} from "./utils/SubstrateMerkleProof.sol";
import {BeefyClient} from "./BeefyClient.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/interfaces/IERC20.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2023 Axelar Network

pragma solidity ^0.8.20;
pragma solidity 0.8.22;

/**
* @dev Interface of the ERC20 standard as defined in the EIP.
Expand Down
8 changes: 7 additions & 1 deletion contracts/src/interfaces/IGateway.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 {OperatingMode, InboundMessage, ParaID} from "../Types.sol";
import {Verification} from "../Verification.sol";
Expand Down Expand Up @@ -34,6 +34,12 @@ interface IGateway {
// Emitted when funds are withdrawn from an agent
event AgentFundsWithdrawn(bytes32 indexed agentID, address indexed recipient, uint256 amount);

/// @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);

/**
* Getters
*/
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/interfaces/IInitializable.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 Initialization of gateway contracts
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/storage/AssetsStorage.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;

library AssetsStorage {
struct Layout {
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/storage/CoreStorage.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 {Channel, OperatingMode, ParaID} from "../Types.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/Address.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: 2023 Axelar Network
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>

pragma solidity ^0.8.20;
pragma solidity 0.8.22;

library Address {
// Checks whether `account` is a contract
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/Bitfield.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 {Bits} from "./Bits.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/Bits.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
// Code from https://github.com/ethereum/solidity-examples
pragma solidity 0.8.20;
pragma solidity 0.8.22;

library Bits {
uint256 internal constant ONE = uint256(1);
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/Call.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2023 OpenZeppelin
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
pragma solidity 0.8.20;
pragma solidity 0.8.22;

// Derived from OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
library Call {
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/Counter.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 A utility library for 16 bit counters packed in 256 bit array.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/ERC1967.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 Minimal implementation of ERC1967 storage slot
library ERC1967 {
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/MMRProof.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;

library MMRProof {
error ProofSizeExceeded();
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/Math.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: 2023 OpenZeppelin
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>
// Code from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/Math.sol
pragma solidity ^0.8.20;
pragma solidity 0.8.22;

/**
* @dev Standard math utilities missing in the Solidity language.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/SafeTransfer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: 2023 Axelar Network
// SPDX-FileCopyrightText: 2023 Snowfork <[email protected]>

pragma solidity ^0.8.20;
pragma solidity 0.8.22;

import {IERC20} from "../interfaces/IERC20.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/ScaleCodec.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;

library ScaleCodec {
error UnsupportedCompactEncoding();
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/utils/SubstrateMerkleProof.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;

// Used to verify merkle proofs generated by https://github.com/paritytech/substrate/tree/master/utils/binary-merkle-tree
library SubstrateMerkleProof {
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/Agent.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
pragma solidity 0.8.22;

import "forge-std/Test.sol";
import "forge-std/console.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/BeefyClient.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
pragma solidity 0.8.22;

import {Strings} from "openzeppelin/utils/Strings.sol";
import {Test} from "forge-std/Test.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/Counter.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;
pragma solidity 0.8.22;

import "forge-std/Test.sol";
import "forge-std/console.sol";
Expand Down
Loading