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

feat: deprecating Goerli for Sepolia as testnet #4

Merged
merged 9 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
12 changes: 4 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# HTTPs providers
NODE_URI_ETHEREUM=
NODE_URI_OPTIMISM=
NODE_URI_POLYGON=
NODE_URI_GOERLI=
NODE_URI_OPTIMISTICGOERLI=
NODE_URI_MUMBAI=
NODE_URI_SEPOLIA=
0xGorilla marked this conversation as resolved.
Show resolved Hide resolved
NODE_URI_OPTIMISTICSEPOLIA=
0xGorilla marked this conversation as resolved.
Show resolved Hide resolved

# Account's private keys
ETHEREUM_1_PRIVATE_KEY=
Expand All @@ -13,10 +11,8 @@ TEST_1_PRIVATE_KEY=
# Etherscan (optional, only for verifying smart contracts)
ETHEREUM_ETHERSCAN_API_KEY=
OPTIMISTICETHEREUM_ETHERSCAN_API_KEY=
GOERLI_ETHERSCAN_API_KEY=
OPTIMISTICGOERLI_ETHERSCAN_API_KEY=
POLYGONMUMBAI_ETHERSCAN_API_KEY=
POLYGON_ETHERSCAN_API_KEY=
SEPOLIA_ETHERSCAN_API_KEY=
OPTIMISTICSEPOLIA_ETHERSCAN_API_KEY=

# Mocha (10 minutes)
MOCHA_TIMEOUT=600000
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ jobs:
run: yarn test:e2e
env:
NODE_URI_ETHEREUM: ${{ secrets.NODE_URI_MAINNET }}
NODE_URI_GOERLI: https://eth-goerli.alchemyapi.io/v2/${{ secrets.ALCHEMYKEY }}
NODE_URI_SEPOLIA: https://eth-sepolia.g.alchemy.com/v2/${{ secrets.ALCHEMYKEY }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ artifacts
typechained
deployments/hardhat
deployments/localhost
deployments/sepoliaDummy
0xGorilla marked this conversation as resolved.
Show resolved Hide resolved
deployments/sepolia
deployments/optimisticSepolia

# Config files
.env
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
- [Setup](#setup)
- [Address Registry](#address-registry)
- [Testnet](#testnet)
- [Goerli (sender and _receiver_)](#goerli-sender-and-receiver)
- [OP Goerli (_receiver_)](#op-goerli-receiver)
- [Mumbai (manual sender)](#mumbai-manual-sender)
- [Sepolia (sender and _receiver_)](#sepolia-sender-and-receiver)
- [OP Sepolia (_receiver_)](#op-sepolia-receiver)
- [Mumbai (manual sender)](#sepolia-manual-sender)
- [Whitelisted pipelines](#whitelisted-pipelines)

## Scope
Expand Down Expand Up @@ -169,7 +169,7 @@ NOTE: A more gas-efficient array-filling strategy can be built by making more ex

## Setup

Clone the repo in your preferred way, and fill the `.env` file using the `.env.example` as a reference. The environment is yet set to work with testnets, using Goerli to OP Goerli bridge as default.
Clone the repo in your preferred way, and fill the `.env` file using the `.env.example` as a reference. The environment is yet set to work with testnets, using Sepolia to OP Sepolia bridge as default.

For a dummy setup (without bridging) run:

Expand All @@ -195,15 +195,15 @@ yarn deploy:work
```

For 1 tag manual-deployment and bridging
`yarn deploy --network mumbai --tags manual-send-test-observation`
`yarn deploy --network sepolia --tags manual-send-test-observation`

In `/utils/constants.ts`, one can find the configuration of the strategies chosen by chain. The default for Goerli is set to refresh each 1/2 day, using periods of 1hr, and comparing a 2hr twap with 500 ticks (+-5%) threshold.
In `/utils/constants.ts`, one can find the configuration of the strategies chosen by chain. The default for Sepolia is set to refresh each 1/2 day, using periods of 1hr, and comparing a 2hr twap with 500 ticks (+-5%) threshold.

## Address Registry

#### Testnet

##### Goerli (sender and _receiver_)
##### Sepolia (sender and _receiver_)

| Contract | Address |
| ------------------------- | -------------------------------------------- |
Expand All @@ -215,7 +215,7 @@ In `/utils/constants.ts`, one can find the configuration of the strategies chose
| _DataReceiver_ | `0xa09683377E5cE0bB7eEa90D2b64e3644f7eA1B8a` |
| _OracleFactory_ | `0x0594Dc74043b93Bdb371f01187704C98D45bd4E6` |

##### OP Goerli (_receiver_)
##### OP Sepolia (_receiver_)

| Contract | Address |
| ------------------------- | -------------------------------------------- |
Expand All @@ -232,8 +232,8 @@ In `/utils/constants.ts`, one can find the configuration of the strategies chose

##### Whitelisted pipelines:

| Chain - Pool | Chain - OracleSidechain |
| ----------------------------------------------------- | -------------------------------------------------------- |
| Goerli - `0x317ceCd3eB02158f97DF0B67B788edCda4E066e5` | OP Goerli - `0x4ECFF2c532d47D7be3D957E4a332AB134cad1fd9` |
| Mumbai - `0xd69f1635dc28a11E05841AE25Fd1572FD0EF1eF4` | Goerli - `0x050BBA5E4abde750Ea5610D8412cD46171C665e7` |
| Goerli - `0x317ceCd3eB02158f97DF0B67B788edCda4E066e5` | Goerli - `0xED7f635EE962537b4DB13a1e1c3922EC65366fE2` |
| Chain - Pool | Chain - OracleSidechain |
| ------------------------------------------------------ | --------------------------------------------------------- |
| Sepolia - `0x317ceCd3eB02158f97DF0B67B788edCda4E066e5` | OP Sepolia - `0x4ECFF2c532d47D7be3D957E4a332AB134cad1fd9` |
| Mumbai - `0xd69f1635dc28a11E05841AE25Fd1572FD0EF1eF4` | Sepolia - `0x050BBA5E4abde750Ea5610D8412cD46171C665e7` |
0xGorilla marked this conversation as resolved.
Show resolved Hide resolved
| Sepolia - `0x317ceCd3eB02158f97DF0B67B788edCda4E066e5` | Sepolia - `0xED7f635EE962537b4DB13a1e1c3922EC65366fE2` |
4 changes: 2 additions & 2 deletions deploy/0-deployments/003_data_feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { dataFeedSettings } from '../../utils/constants';

const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer } = await hre.getNamedAccounts();
const { deployer, uniV3Factory } = await hre.getNamedAccounts();

const chainId = Number(await hre.getChainId());
const minLastOracleDelta = dataFeedSettings[chainId];

const CONSTRUCTOR_ARGS = [deployer, deployer, minLastOracleDelta];
const CONSTRUCTOR_ARGS = [deployer, deployer, uniV3Factory, minLastOracleDelta];

await hre.deployments.deploy('DataFeed', {
contract: 'solidity/contracts/DataFeed.sol:DataFeed',
Expand Down
4 changes: 2 additions & 2 deletions deploy/0-deployments/004_data_feed_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { strategySettings } from '../../utils/constants';

const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer } = await hre.getNamedAccounts();
const { deployer, uniV3Factory } = await hre.getNamedAccounts();

const chainId = Number(await hre.getChainId());
const deploymentSettings = strategySettings[chainId];

const dataFeed = await hre.deployments.get('DataFeed');
const CONSTRUCTOR_ARGS = [deployer, dataFeed.address, deploymentSettings];
const CONSTRUCTOR_ARGS = [deployer, dataFeed.address, uniV3Factory, deploymentSettings];

await hre.deployments.deploy('DataFeedStrategy', {
contract: 'solidity/contracts/DataFeedStrategy.sol:DataFeedStrategy',
Expand Down
7 changes: 4 additions & 3 deletions deploy/1-setup/102_setup_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { DeployFunction } from 'hardhat-deploy/types';
import { calculateSalt } from '../../test/utils/misc';
import { ZERO_ADDRESS } from '../../test/utils/constants';
import { TEST_FEE, UNI_V3_FACTORY } from '../../utils/constants';
import { TEST_FEE } from '../../utils/constants';
import { getReceiverChainId } from '../../utils/deploy';

const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer, tokenA, tokenB } = await hre.getNamedAccounts();
const { deployer, tokenA, tokenB, uniV3Factory } = await hre.getNamedAccounts();
const DESTINATION_CHAIN_ID = await getReceiverChainId(hre);

const txSettings = {
Expand All @@ -18,7 +18,7 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro

await hre.deployments.save('UniswapV3Factory', {
abi: IUniswapV3Factory.abi,
address: UNI_V3_FACTORY,
address: uniV3Factory,
});

const POOL_ADDRESS = await hre.deployments.read('UniswapV3Factory', 'getPool', tokenA, tokenB, TEST_FEE);
Expand All @@ -40,5 +40,6 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro
}
};

deployFunction.dependencies = ['create-pool'];
deployFunction.tags = ['pool-whitelisting'];
export default deployFunction;
7 changes: 4 additions & 3 deletions deploy/1-setup/121_setup_dummy_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { DeployFunction } from 'hardhat-deploy/types';
import { calculateSalt } from '../../test/utils/misc';
import { ZERO_ADDRESS } from '../../test/utils/constants';
import { TEST_FEE, UNI_V3_FACTORY } from '../../utils/constants';
import { TEST_FEE } from '../../utils/constants';

const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer, tokenA, tokenB } = await hre.getNamedAccounts();
const { deployer, tokenA, tokenB, uniV3Factory } = await hre.getNamedAccounts();
const DESTINATION_CHAIN_ID = await hre.getChainId();

const txSettings = {
Expand All @@ -17,7 +17,7 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro

await hre.deployments.save('UniswapV3Factory', {
abi: IUniswapV3Factory.abi,
address: UNI_V3_FACTORY,
address: uniV3Factory,
});

const POOL_ADDRESS = await hre.deployments.read('UniswapV3Factory', 'getPool', tokenA, tokenB, TEST_FEE);
Expand All @@ -39,5 +39,6 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro
}
};

deployFunction.dependencies = ['create-pool'];
deployFunction.tags = ['test-pool-whitelisting'];
export default deployFunction;
6 changes: 3 additions & 3 deletions deploy/2-token-actions/202_save_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import IUniswapV3Pool from '../../artifacts/@uniswap/v3-core/contracts/interface
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { DeployFunction } from 'hardhat-deploy/types';
import { ZERO_ADDRESS } from '../../test/utils/constants';
import { TEST_FEE, UNI_V3_FACTORY } from '../../utils/constants';
import { TEST_FEE } from '../../utils/constants';

const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { tokenA, tokenB } = await hre.getNamedAccounts();
const { tokenA, tokenB, uniV3Factory } = await hre.getNamedAccounts();

await hre.deployments.save('UniswapV3Factory', {
abi: IUniswapV3Factory.abi,
address: UNI_V3_FACTORY,
address: uniV3Factory,
});

const POOL_ADDRESS = await hre.deployments.read('UniswapV3Factory', 'getPool', tokenA, tokenB, TEST_FEE);
Expand Down
13 changes: 3 additions & 10 deletions deploy/2-token-actions/212_deploy_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import IUniswapV3Factory from '../../artifacts/@uniswap/v3-core/contracts/interf
import IUniswapV3Pool from '../../artifacts/@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol/IUniswapV3Pool.json';
import { HardhatRuntimeEnvironment } from 'hardhat/types';
import { DeployFunction } from 'hardhat-deploy/types';
import { TEST_FEE, UNI_V3_FACTORY } from '../../utils/constants';
import { TEST_FEE } from '../../utils/constants';

const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer } = await hre.getNamedAccounts();
const { deployer, uniV3Factory } = await hre.getNamedAccounts();
const addressZero = '0x0000000000000000000000000000000000000000';

const txSettings = {
Expand All @@ -15,7 +15,7 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro

await hre.deployments.save('UniswapV3Factory', {
abi: IUniswapV3Factory.abi,
address: UNI_V3_FACTORY,
address: uniV3Factory,
});

/* DEPLOY POOL */
Expand All @@ -36,13 +36,6 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro
address: UNI_V3_POOL_ADDRESS,
});

console.log('deployed', {
tokenA: tokenA.address,
tokenB: tokenB.address,
fee: TEST_FEE,
pool: UNI_V3_POOL_ADDRESS,
});

/* INITIALIZE POOL */

let poolSlot0 = await hre.deployments.read('UniswapV3Pool', 'slot0');
Expand Down
1 change: 0 additions & 1 deletion deploy/3-bridge-actions/312_dummy_bridge_observation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro
abi: OracleSidechain.abi,
address: DUMMY_ORACLE_ADDRESS,
});
await verifyContractByAddress(hre, DUMMY_ORACLE_ADDRESS);
await hre.deployments.execute('DummyOracleSidechain', txSettings, 'initializePoolInfo', tokenA, tokenB, TEST_FEE);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro

const dataFeedContract = await hre.ethers.getContractAt('DataFeed', dataFeed.address);

const SECONDS_AGOS = [10000, 5000, 0];
const SECONDS_AGOS = [3600, 1800, 0];
const FETCH_OBSERVATION_ARGS = [salt, SECONDS_AGOS];
await hre.deployments.execute('DataFeed', txSettings, 'fetchObservations(bytes32,uint32[])', ...FETCH_OBSERVATION_ARGS);

Expand Down
3 changes: 3 additions & 0 deletions deploy/4-verify/413_verify_dummy_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { verifyContract } from 'utils/deploy';
const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const dummyAdapter = await hre.deployments.get('DummyAdapterForTest');
await verifyContract(hre, dummyAdapter, 'solidity/for-test/DummyAdapterForTest.sol/DummyAdapterForTest');

const dummyOracleSidechain = await hre.deployments.get('DummyOracleSidechain');
await verifyContract(hre, dummyOracleSidechain, 'solidity/for-test/DummyOracleSidechain.sol/DummyOracleSidechain');
};

deployFunction.tags = ['verify-dummy-adapter'];
Expand Down
1 change: 0 additions & 1 deletion deployments/goerli/.chainId

This file was deleted.

Loading
Loading