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

Fix contract examples package json #672

Merged
merged 6 commits into from
Jun 16, 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 .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
# Specific directories:

peer/ @anusha-ctrl @ceyonur @darioush @aaronbuchwald
contract-examples/ @anusha-ctrl @ceyonur @darioush @aaronbuchwald
contracts/ @anusha-ctrl @ceyonur @darioush @aaronbuchwald
scripts/ @anusha-ctrl @ceyonur @darioush @aaronbuchwald

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
node-version: "18.x"
- name: NPM Clean Install
run: npm ci
working-directory: ./contract-examples
working-directory: ./contracts
- name: Install AvalancheGo Release
shell: bash
run: BASEDIR=/tmp/e2e-test AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/install_avalanchego_release.sh
Expand Down
11 changes: 6 additions & 5 deletions cmd/precompilegen/template-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ Modifying code outside of these areas should be done with caution and with a dee
6- Add your config unit tests under generated package config_test.go
7- Add your contract unit tests under generated package contract_test.go
8- Additionally you can add a full-fledged VM test for your precompile under plugin/vm/vm_test.go. See existing precompile tests for examples.
9- Add your solidity interface and test contract to contract-examples/contracts
10- Write solidity tests for your precompile in contract-examples/test
11- Create your genesis with your precompile enabled in tests/precompile/genesis/
12- Create e2e test for your solidity test in tests/precompile/solidity/suites.go
13- Run your e2e precompile Solidity tests with './scripts/run_ginkgo.sh`
9- Add your solidity interface and test contract to contracts/contracts
10- Write solidity contract tests for your precompile in contracts/contracts/test
11- Write TypeScript DS-Test counterparts for your solidity tests in contracts/test
12- Create your genesis with your precompile enabled in tests/precompile/genesis/
13- Create e2e test for your solidity test in tests/precompile/solidity/suites.go
14- Run your e2e precompile Solidity tests with './scripts/run_ginkgo.sh`
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions contract-examples/README.md → contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Clone the repo and install the necessary packages via `yarn`.

```zsh
$ git clone https://github.com/ava-labs/subnet-evm.git
$ cd contract-examples
$ cd contracts
$ npm install
```

Expand All @@ -48,7 +48,7 @@ For more information about precompiles see [subnet-evm precompiles](https://gith

Hardhat uses `hardhat.config.js` as the configuration file. You can define tasks, networks, compilers and more in that file. For more information see [here](https://hardhat.org/config/).

In Subnet-EVM, we provide a pre-configured file [hardhat.config.ts](https://github.com/ava-labs/subnet-evm/blob/master/contract-examples/hardhat.config.ts).
In Subnet-EVM, we provide a pre-configured file [hardhat.config.ts](https://github.com/ava-labs/subnet-evm/blob/master/contracts/hardhat.config.ts).

The HardHat config file includes a single network configuration: `local`. `local` defaults to using the following values for the RPC URL and the Chain ID:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IAllowList.sol";
import "./interfaces/IAllowList.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

// AllowList is a base contract to use AllowList precompile capabilities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./AllowList.sol";
import "./INativeMinter.sol";
import "./interfaces/INativeMinter.sol";

// Precompiled Native Minter Contract Address
address constant MINTER_ADDRESS = 0x0200000000000000000000000000000000000001;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./IAllowList.sol";
import "./interfaces/IAllowList.sol";
import "./AllowList.sol";

address constant DEPLOYER_LIST = 0x0200000000000000000000000000000000000000;
Expand All @@ -20,5 +20,6 @@ contract ExampleDeployerList is AllowList {
}

// This is an empty contract that can be used to test contract deployment
contract Example {}
contract Example {

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./AllowList.sol";
import "./IFeeManager.sol";
import "./interfaces/IFeeManager.sol";

address constant FEE_MANAGER_ADDRESS = 0x0200000000000000000000000000000000000003;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IRewardManager.sol";
import "./interfaces/IRewardManager.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

address constant REWARD_MANAGER_ADDRESS = 0x0200000000000000000000000000000000000004;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import "./AllowList.sol";
import "./IAllowList.sol";
import "./interfaces/IAllowList.sol";

// Precompiled Allow List Contract Address
address constant TX_ALLOW_LIST = 0x0200000000000000000000000000000000000002;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import "../ERC20NativeMinter.sol";
import "../INativeMinter.sol";
import "../interfaces/INativeMinter.sol";
import "./AllowListTest.sol";

// TODO:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import "../ExampleDeployerList.sol";
import "../IAllowList.sol";
import "../interfaces/IAllowList.sol";
import "../AllowList.sol";
import "./AllowListTest.sol";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma experimental ABIEncoderV2;
import "../ExampleFeeManager.sol";
import "./AllowListTest.sol";
import "../AllowList.sol";
import "../IFeeManager.sol";
import "../interfaces/IFeeManager.sol";

contract ExampleFeeManagerTest is AllowListTest {
IFeeManager manager = IFeeManager(FEE_MANAGER_ADDRESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import "../ExampleRewardManager.sol";
import "../IRewardManager.sol";
import "../interfaces/IRewardManager.sol";
import "./AllowListTest.sol";

address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

import "../ExampleTxAllowList.sol";
import "../AllowList.sol";
import "../IAllowList.sol";
import "../interfaces/IAllowList.sol";
import "./AllowListTest.sol";

contract ExampleTxAllowListTest is AllowListTest {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions contracts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { test } from './test/utils';
Loading