Skip to content

Commit

Permalink
feat: adding cache and sync functionality (#5)
Browse files Browse the repository at this point in the history
* chore: deprecating unused chains

* feat: adding uniV3Factory to constructors

* fix: fixture tests and e2e

* fix: ups

* feat: deprecate polygon

* chore: final tweaks

* fix: workflow url

* fix: upsy

* feat: adding cache functionality

* fix: compilation issues

* fix: unit tests

* fix: e2e and unit tests

* fix: minor comments

* fix: addressing comments in PR

* chore: deployments

* fix: fatal override bug

* feat: adding sync public method

* feat: optimize sync method

* fix: yarn lock

* fix: reverting nasty test trimming

* fix: add natspec

* chore: cleanup contracts to redeploy

* fix: typos

* chore: new deployments

* chore: ups, deployment files
  • Loading branch information
wei3erHase authored Aug 21, 2024
1 parent 9d478c0 commit 07e2c9d
Show file tree
Hide file tree
Showing 25 changed files with 2,536 additions and 2,174 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# HTTPs providers
NODE_URI_ETHEREUM=
NODE_URI_OPTIMISM=
NODE_URI_POLYGON=
NODE_URI_SEPOLIA=
NODE_URI_OPTIMISTICSEPOLIA=

Expand All @@ -11,6 +12,7 @@ TEST_1_PRIVATE_KEY=
# Etherscan (optional, only for verifying smart contracts)
ETHEREUM_ETHERSCAN_API_KEY=
OPTIMISTICETHEREUM_ETHERSCAN_API_KEY=
POLYGON_ETHERSCAN_API_KEY=
SEPOLIA_ETHERSCAN_API_KEY=
OPTIMISTICSEPOLIA_ETHERSCAN_API_KEY=

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ deployments/localhost
deployments/sepoliaDummy
deployments/sepolia
deployments/optimisticSepolia
deployments/**/solcInputs

# Config files
.env
Expand Down
70 changes: 53 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,35 +199,71 @@ For 1 tag manual-deployment and bridging

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.

## Production deployment

Make sure to have the correct addresses for `tokenA` and `tokenB` in `utils/constants.ts` as well as the desired `periodLength`, `strategyCooldown`, `twapPeriod`, and `twapThreshold`. Also check the correct fee, as if an inexistent UniswapV3 pool is referenced, the script will eventually deploy it.

Setup the `receiver` network for the origin chain (e.g. `ethereum`, receiver `polygon`) and select the desired script to run using the origin chain as script selected network (even if the deployment occurs in the sidechain), with the exception of `verify` scripts. Each script will execute the required subsequent ones, so it is not necessary to run them all.

This script will deploy (the OracleFactory if necessary and) the DataReceiver, in the receiver chain of `ethereum` (that it might be `optimism` or `polygon`). This is to enable the off-chain coordination.

```bash
yarn deploy --network ethereum --tags data-receiver
```

Scripts:

- `data-sender`: deploys DataFeed (mainnet)
- `data-receiver`: deploys OracleFactory and DataReceiver (sidechain)
- `connext-setup`: runs both `data-sender` and `data-receiver` (if not yet deployed) plus deploys Connext SenderAdapter and ReceiverAdapter
- `manual-fetch-observation`: runs `data-receiver` and attempts to fetch a new observation with arbitrary timestamps
- `fetch-observation`: runs `data-receiver` plus deploys DataFeedStrategy and attempts to programatically fetch a new observation
- `bridge-observation`: runs up to `connext-setup` and attempts to bridge a recently fetched observation
- `setup-keeper`: runs up to `connext-setup` and deploys StrategyJob
- `work-job`: (runs up to `setup-keeper` and) attempts to work StrategyJob (requires registration in Keep3r contract)

## Address Registry

**TODO: Update with the latest addresses**
#### Mainnet

#### Testnet
##### Optimism (_receiver_)

| Contract | Address |
| ------------------------- | -------------------------------------------- |
| _Connext ReceiverAdapter_ | `0xe5BE7f12B94D185f892c4BBe6F88ABE65CE1A8af` |
| _DataReceiver_ | `0x4E0CeF6426eb70b5708845825A5375688808891d` |
| _OracleFactory_ | `0x0BcD059c1546359b45f2606Ed6E08e1F5ef4f4Bf` |

##### Sepolia (sender and _receiver_)
##### Polygon (_receiver_)

| Contract | Address |
| ------------------------- | -------------------------------------------- |
| DataFeed | `0x8Fb68E83831c7e8622e10C154CC0d24856440809` |
| DataFeedStrategy | `0x606e25c67B8d6550075C8085083c763769Cfe2BE` |
| StrategyJob | `0x606e25c67B8d6550075C8085083c763769Cfe2BE` |
| Connext SenderAdapter | `0xF73E6BC8ca4Fec5e9773C4f22E8EBEEEd12733d6` |
| _Connext ReceiverAdapter_ | `0x05a6CEF3f938E8E9b3112CB44e8B9771638989Ed` |
| _DataReceiver_ | `0xa09683377E5cE0bB7eEa90D2b64e3644f7eA1B8a` |
| _OracleFactory_ | `0x0594Dc74043b93Bdb371f01187704C98D45bd4E6` |
| _Connext ReceiverAdapter_ | `0x4839750090571A0fCcBaa3a8Fffe3DE22b4B7D51` |
| _DataReceiver_ | `0xe5BE7f12B94D185f892c4BBe6F88ABE65CE1A8af` |
| _OracleFactory_ | `0x69ceAA797274fd85F3b3a1f5b29857BFD9B9b259` |

#### Testnet

##### Sepolia (sender)

| Contract | Address |
| --------------------- | -------------------------------------------- |
| DataFeed | `0xcDddb7c04000e492E2e6CbD924b595CdaB9DEFa9` |
| DataFeedStrategy | `0x8379506385432f1e02cE516f5A5F52d15E250c88` |
| StrategyJob | `0xa77E459Eba5F1D05Cd22C8a28fB6b2725dfd4D21` |
| Connext SenderAdapter | `0x54B79C4B3E5BA80275B33B5bCaaeC762bf04E558` |

##### OP Sepolia (_receiver_)

| Contract | Address |
| ------------------------- | -------------------------------------------- |
| _Connext ReceiverAdapter_ | `0x4D81A5C9F7706377df368D1716460da03faEcBcb` |
| _DataReceiver_ | `0x768c227320165A71A4001fE23A0C38CD6B5585c0` |
| _OracleFactory_ | `0xB8aD440Ad7A3298C73258b1Fc202A081Db9107cb` |
| _Connext ReceiverAdapter_ | `0x4839750090571A0fCcBaa3a8Fffe3DE22b4B7D51` |
| _DataReceiver_ | `0x4B11b6BEF9480d62b471a9a91a52C893143Bad19` |
| _OracleFactory_ | `0xa32f6603F9466eF0190CAc36759E41B40653471A` |

##### Whitelisted pipelines:

| Chain - Pool | Chain - OracleSidechain |
| ------------------------------------------------------ | --------------------------------------------------------- |
| Sepolia - `0x317ceCd3eB02158f97DF0B67B788edCda4E066e5` | OP Sepolia - `0x4ECFF2c532d47D7be3D957E4a332AB134cad1fd9` |
| Sepolia - `0x317ceCd3eB02158f97DF0B67B788edCda4E066e5` | Sepolia - `0xED7f635EE962537b4DB13a1e1c3922EC65366fE2` |
| Chain - Pool | Chain - OracleSidechain |
| ------------------------------------------------------ | ----------------------- |
| Mainnet - `0xTODO` | OP - `0xTBD` |
| Sepolia - `0xd0EAFA86eC9C2f3f8f12798974222C645dc8DBF0` | OP Sepolia - `0xTBD` |
Loading

0 comments on commit 07e2c9d

Please sign in to comment.