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

refactor: rename src to contracts #314

Merged
merged 25 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.26;
import { IERC20Custody } from "./interfaces/IERC20Custody.sol";
import { IGatewayEVM } from "./interfaces/IGatewayEVM.sol";

import { RevertContext } from "src/Revert.sol";
import { RevertContext } from "../../contracts/Revert.sol";

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import { RevertContext, RevertOptions, Revertable } from "../../contracts/Revert.sol";
import { ZetaConnectorBase } from "./ZetaConnectorBase.sol";
import { IERC20Custody } from "./interfaces/IERC20Custody.sol";
import { IGatewayEVM } from "./interfaces/IGatewayEVM.sol";
import { RevertContext, RevertOptions, Revertable } from "src/Revert.sol";

import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

import { RevertContext } from "src/Revert.sol";
import { IGatewayEVM, IGatewayEVMErrors, IGatewayEVMEvents } from "src/evm/interfaces/IGatewayEVM.sol";
import "src/evm/interfaces/IZetaConnector.sol";
import { RevertContext } from "../../contracts/Revert.sol";
import { IGatewayEVM, IGatewayEVMErrors, IGatewayEVMEvents } from "../../contracts/evm/interfaces/IGatewayEVM.sol";
import "../../contracts/evm/interfaces/IZetaConnector.sol";

/// @title ZetaConnectorBase
/// @notice Abstract base contract for ZetaConnector.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import { RevertContext } from "src/Revert.sol";
import { RevertContext } from "../../../contracts/Revert.sol";

/// @title IERC20CustodyEvents
/// @notice Interface for the events emitted by the ERC20 custody contract.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import "src/Revert.sol";
import "../../../contracts/Revert.sol";

/// @title IGatewayEVMEvents
/// @notice Interface for the events emitted by the GatewayEVM contract.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import { RevertContext } from "src/Revert.sol";
import { RevertContext } from "../../../contracts/Revert.sol";

/// @title IZetaConnectorEvents
/// @notice Interface for the events emitted by the ZetaConnector contracts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pragma solidity 0.8.26;

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

import { RevertContext, RevertOptions } from "../../contracts/Revert.sol";
import "./interfaces/IWZETA.sol";
import { IZRC20 } from "./interfaces/IZRC20.sol";
import { UniversalContract, zContext } from "./interfaces/UniversalContract.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import { RevertContext, RevertOptions } from "src/Revert.sol";

import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
Expand Down
4 changes: 2 additions & 2 deletions v2/src/zevm/ZRC20.sol → v2/contracts/zevm/ZRC20.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import "src/zevm/interfaces/ISystem.sol";
import "src/zevm/interfaces/IZRC20.sol";
import "../../contracts/zevm/interfaces/ISystem.sol";
import "../../contracts/zevm/interfaces/IZRC20.sol";

/**
* @dev Custom errors for ZRC20
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import "../../../contracts/Revert.sol";
import "./UniversalContract.sol";
import "src/Revert.sol";

/// @title IGatewayZEVMEvents
/// @notice Interface for the events emitted by the GatewayZEVM contract.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import { RevertContext } from "src/Revert.sol";
import { RevertContext } from "../../../contracts/Revert.sol";

struct zContext {
bytes origin;
Expand Down
8 changes: 4 additions & 4 deletions v2/foundry.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[profile.default]
src = "src"
out = "out"
src = "contracts"
out = "abi"
libs = ["lib"]

remappings = [
"ds-test/=node_modules/ds-test/src",
"src/=src",
"src/=contracts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this remapping needed if src is set to contracts above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I've removed the remapping and also changed the import paths in tests from src to contracts: 0b0f060

"test/=test",
"forge-std/=lib/forge-std/src/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
Expand All @@ -16,7 +16,7 @@ no-match-contract = '.*EchidnaTest$'
optimizer = true
optimizer_runs = 10_000

fs_permissions = [{ access = "read", path = "out"}]
fs_permissions = [{ access = "read", path = "abi"}]

ffi = true
ast = true
Expand Down
9 changes: 9 additions & 0 deletions v2/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { HardhatUserConfig } from "hardhat/config";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are adding hardhat to this foundry project, just wanted to double check if these instructions are followed, or we don't need to follow them? https://book.getfoundry.sh/config/hardhat

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we'd need it, but it doesn't seem like we're using it. Protocol contracts should now be compatible with hardhat users without having to have any hardhat config.


const config: HardhatUserConfig = {
solidity: {
compilers: [{ version: "0.8.26" }],
},
};

export default config;
5 changes: 4 additions & 1 deletion v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"author": "zetachain",
"files": [
"abi",
"types"
"types",
"contracts"
],
"scripts": {
"lint": "npx eslint . --ignore-pattern coverage/ --ignore-pattern coverage.json --ignore-pattern lib/ --ignore-pattern abi --ignore-pattern cache_forge/",
Expand Down Expand Up @@ -33,6 +34,8 @@
},
"license": "MIT",
"dependencies": {
"@openzeppelin/contracts": "^5.0.2",
"@openzeppelin/contracts-upgradeable": "^5.0.2",
"ethers": "^6.13.1"
},
"packageManager": "[email protected]+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
Expand Down
2 changes: 1 addition & 1 deletion v2/pkg/address.sol/address.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v2/pkg/beaconproxy.sol/beaconproxy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v2/pkg/console.sol/console.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v2/pkg/core.sol/core.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v2/pkg/defender.sol/defender.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v2/pkg/defenderdeploy.sol/defenderdeploy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading