Skip to content

Commit

Permalink
Merge pull request #422 from consensusnetworks/deployment/beta
Browse files Browse the repository at this point in the history
Deploy contracts and configure variables
  • Loading branch information
shanejearley authored Sep 28, 2023
2 parents 893ae96 + 4a3997b commit d09f128
Show file tree
Hide file tree
Showing 152 changed files with 4,898 additions and 2,670 deletions.
20 changes: 2 additions & 18 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
[submodule "scripts/ledger/resources/app-bitcoin"]
path = scripts/ledger/resources/app-bitcoin
url = https://github.com/LedgerHQ/app-bitcoin-new.git
[submodule "scripts/ledger/resources/app-ethereum"]
path = scripts/ledger/resources/app-ethereum
url = https://github.com/LedgerHQ/app-ethereum.git
[submodule "scripts/ledger/resources/app-solana"]
path = scripts/ledger/resources/app-solana
url = https://github.com/LedgerHQ/app-solana.git
[submodule "scripts/ledger/resources/speculos"]
path = scripts/ledger/resources/speculos
url = https://github.com/LedgerHQ/speculos.git
[submodule "scripts/trezor/resources/trezor-user-env"]
path = scripts/trezor/resources/trezor-user-env
url = https://github.com/trezor/trezor-user-env.git
[submodule "contracts/ethereum/scripts/resources/ssv-network"]
path = contracts/ethereum/scripts/resources/ssv-network
url = https://github.com/bloxapp/ssv-network.git
branch = contract-v3
branch = jato-v2
[submodule "contracts/ethereum/lib/forge-std"]
path = contracts/ethereum/lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "services/oracle/scripts/resources/rockx-dkg-cli"]
path = services/oracle/scripts/resources/rockx-dkg-cli
url = https://github.com/RockX-SG/rockx-dkg-cli.git
branch = main
url = https://github.com/consensusnetworks/rockx-dkg-cli.git
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img width="50px" alt="Casimir logo" src="common/images/casimir.png">
<img width="50px" alt="Casimir logo" src="casimir.png">

# Casimir

Expand Down Expand Up @@ -41,15 +41,11 @@ Configure the following prerequisite global dependency versions.

1. [Docker (v24.x)](https://docs.docker.com/engine/install/).

2. [Git (v2.x)](https://git-scm.com/downloads)
2. [Go (v1.18.x)](https://golang.org/doc/install).

> 🚩 GitHub submodule support: You also need to make sure to have at least one SSH authentication key on your GitHub account (for the git cloning of submodules in various scripts). See [Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).
3. [Node.js (v18.x)](https://nodejs.org/en/download/).

3. [Go (v1.18.x)](https://golang.org/doc/install).

4. [Node.js (v18.x)](https://nodejs.org/en/download/).

5. [Optional: AWS CLI (v2.x)](https://aws.amazon.com/cli/)
4. [Optional: AWS CLI (v2.x)](https://aws.amazon.com/cli/)

> 🚩 **Consensus Networks team only**: Create an [AWS profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) named `consensus-networks-dev`.
Expand Down Expand Up @@ -129,13 +125,9 @@ echo "USE_SECRETS=false" > .env
| `VIEWS_ADDRESS` | Views contract address | (predicted views address) |
| `CRYPTO_COMPARE_API_KEY` | CryptoCompare API key | `` |
| `TUNNEL` | Whether to tunnel local network RPC URLs (for remote wallets) | `false` |
| `EMULATE` | Whether to emulate wallets | `false` |
| `LEDGER_APP` | Ledger app name | `ethereum` |
| `MOCK_SERVICES` | Whether to mock backend services | `true` |
| `BUILD_PREVIEW` | Whether to preview web app production build | `false` |

> 🚩 While running the Ledger Speculos emulator on MacOS (with EMULATORS=true), if you get a surprising error that port 5000 is in use, go to  > System Preferences... > Sharing and uncheck Airplay Receiver.
### Apps

The apps packages provide a UI to end-users.
Expand Down Expand Up @@ -192,8 +184,6 @@ The common packages provide shared code for the project:

- [@casimir/aws](common/aws): AWS helpers
- [@casimir/data](common/data): data schemas and operational workflows
- [@casimir/helpers](common/helpers): general utilities
- [@casimir/speculos](common/speculos): Ledger emulator helpers
- [@casimir/ssv](common/ssv): SSV helpers
- [@casimir/types](common/types): shared types
- [@casimir/uniswap](common/uniswap): Uniswap helpers
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "0.0.1",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
Expand Down
14 changes: 7 additions & 7 deletions apps/web/src/composables/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ref, readonly } from 'vue'
import { ethers } from 'ethers'
import { CasimirManager, CasimirRegistry, CasimirViews } from '@casimir/ethereum/build/@types'
import ICasimirManagerAbi from '@casimir/ethereum/build/abi/ICasimirManager.json'
import ICasimirRegistryAbi from '@casimir/ethereum/build/abi/ICasimirRegistry.json'
import ICasimirViewsAbi from '@casimir/ethereum/build/abi/ICasimirViews.json'
import CasimirManagerAbi from '@casimir/ethereum/build/abi/CasimirManager.json'
import CasimirRegistryAbi from '@casimir/ethereum/build/abi/CasimirRegistry.json'
import CasimirViewsAbi from '@casimir/ethereum/build/abi/CasimirViews.json'
import useEnvironment from './environment'
import useEthers from '@/composables/ethers'
import useLedger from '@/composables/ledger'
Expand All @@ -14,9 +14,9 @@ import { Operator } from '@casimir/ssv'

const { ethereumUrl, managerAddress, registryAddress, viewsAddress } = useEnvironment()
const provider = new ethers.providers.JsonRpcProvider(ethereumUrl)
const manager: CasimirManager & ethers.Contract = new ethers.Contract(managerAddress, ICasimirManagerAbi, provider) as CasimirManager
const views: CasimirViews & ethers.Contract = new ethers.Contract(viewsAddress, ICasimirViewsAbi, provider) as CasimirViews
const registry: CasimirRegistry & ethers.Contract = new ethers.Contract(registryAddress, ICasimirRegistryAbi, provider) as CasimirRegistry
const manager: CasimirManager & ethers.Contract = new ethers.Contract(managerAddress, CasimirManagerAbi, provider) as CasimirManager
const views: CasimirViews & ethers.Contract = new ethers.Contract(viewsAddress, CasimirViewsAbi, provider) as CasimirViews
const registry: CasimirRegistry & ethers.Contract = new ethers.Contract(registryAddress, CasimirRegistryAbi, provider) as CasimirRegistry

const operators = ref<Operator[]>([])
const { ethersProviderList, getEthersBrowserSigner } = useEthers()
Expand Down Expand Up @@ -107,7 +107,7 @@ export default function useContracts() {
async function _querySSVOperators(address: string) {
try {
const network = 'prater'
const url = `https://api.ssv.network/api/v3/${network}/operators/owned_by/${address}`
const url = `https://api.ssv.network/api/v4/${network}/operators/owned_by/${address}`
const response = await fetch(url)
const { operators } = await response.json()
return operators
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/composables/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function useEnvironment() {
const speculosUrl = import.meta.env.PUBLIC_SPECULOS_URL ? 'http://localhost:5001' : ''
const cryptoCompareApiKey = import.meta.env.PUBLIC_CRYPTO_COMPARE_API_KEY || ''
const ssvNetworkAddress = import.meta.env.PUBLIC_SSV_NETWORK_ADDRESS
const ssvNetworkViewsAddress = import.meta.env.PUBLIC_SSV_NETWORK_VIEWS_ADDRESS
const ssvViewsAddress = import.meta.env.PUBLIC_SSV_VIEWS_ADDRESS
const walletConnectProjectId = import.meta.env.PUBLIC_WALLET_CONNECT_PROJECT_ID

return {
Expand All @@ -26,7 +26,7 @@ export default function useEnvironment() {
registryAddress,
speculosUrl,
ssvNetworkAddress,
ssvNetworkViewsAddress,
ssvViewsAddress,
usersUrl,
viewsAddress,
walletConnectProjectId
Expand Down
22 changes: 11 additions & 11 deletions apps/web/src/composables/operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useLedger from '@/composables/ledger'
import useTrezor from '@/composables/trezor'

const { manager, registry, views } = useContracts()
const { ethereumUrl, ssvNetworkAddress, ssvNetworkViewsAddress, usersUrl } = useEnvironment()
const { ethereumUrl, ssvNetworkAddress, ssvViewsAddress, usersUrl } = useEnvironment()
const { ethersProviderList, getEthersBrowserSigner } = useEthers()
const { getEthersLedgerSigner } = useLedger()
const { getEthersTrezorSigner } = useTrezor()
Expand Down Expand Up @@ -51,7 +51,7 @@ export default function useOperators() {
const scanner = new Scanner({
ethereumUrl,
ssvNetworkAddress,
ssvNetworkViewsAddress
ssvViewsAddress
})

const ssvOperators: Operator[] = []
Expand All @@ -68,14 +68,14 @@ export default function useOperators() {
const pools = await _getPools(operator.id)
// TODO: Replace these Public Nodes URLs once we have this working again
const operatorStore = {
'654': 'https://nodes.casimir.co/eth/goerli/dkg/1',
'655': 'https://nodes.casimir.co/eth/goerli/dkg/2',
'656': 'https://nodes.casimir.co/eth/goerli/dkg/3',
'657': 'https://nodes.casimir.co/eth/goerli/dkg/4',
'658': 'https://nodes.casimir.co/eth/goerli/dkg/5',
'659': 'https://nodes.casimir.co/eth/goerli/dkg/6',
'660': 'https://nodes.casimir.co/eth/goerli/dkg/7',
'661': 'https://nodes.casimir.co/eth/goerli/dkg/8'
'200': 'https://nodes.casimir.co/eth/goerli/dkg/1',
'201': 'https://nodes.casimir.co/eth/goerli/dkg/2',
'202': 'https://nodes.casimir.co/eth/goerli/dkg/3',
'203': 'https://nodes.casimir.co/eth/goerli/dkg/4',
'156': 'https://nodes.casimir.co/eth/goerli/dkg/5',
'157': 'https://nodes.casimir.co/eth/goerli/dkg/6',
'158': 'https://nodes.casimir.co/eth/goerli/dkg/7',
'159': 'https://nodes.casimir.co/eth/goerli/dkg/8'
}
const url = operatorStore[operator.id.toString() as keyof typeof operatorStore]
casimirOperators.push({
Expand Down Expand Up @@ -108,7 +108,7 @@ export default function useOperators() {
]

for (const poolId of poolIds) {
const poolDetails = await views.getPoolDetails(poolId)
const poolDetails = await views.getPool(poolId)
const pool = {
...poolDetails,
operatorIds: poolDetails.operatorIds.map(id => id.toNumber()),
Expand Down
Binary file added casimir.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions common/aws/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export async function getSecret(id: string) {
}
)
)
if (!SecretString) {
throw new Error(`No secret found for ${id}`)
}
return SecretString
}

Expand Down
2 changes: 1 addition & 1 deletion common/data/notebooks/dkg.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down
19 changes: 9 additions & 10 deletions common/data/notebooks/ethereum.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Casimir mainnet node is fully synced\n",
"Casimir goerli node is fully synced\n",
"Casimir hardhat node is fully synced\n"
"Local goerli node is fully synced\n",
"Casimir goerli node is fully synced\n"
]
}
],
Expand All @@ -29,15 +28,15 @@
"from requests.auth import HTTPBasicAuth\n",
"\n",
"networks = {\n",
" \"mainnet\": {\n",
" \"requires_auth\": True\n",
" },\n",
" # \"mainnet\": {\n",
" # \"requires_auth\": True\n",
" # },\n",
" \"goerli\": {\n",
" \"requires_auth\": True\n",
" },\n",
" \"hardhat\": {\n",
" \"requires_auth\": False\n",
" }\n",
" # \"hardhat\": {\n",
" # \"requires_auth\": False\n",
" # }\n",
"}\n",
"\n",
"for network, requires_auth in networks.items():\n",
Expand Down
2 changes: 2 additions & 0 deletions common/data/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import eventSchema from './schemas/event.schema.json'
import nonceSchema from './schemas/nonce.schema.json'
import operatorSchema from './schemas/operator.schema.json'
import operatorStore from './mock/operator.store.json'
import reshareStore from './mock/reshare.store.json'
import userAccountSchema from './schemas/user_account.schema.json'
import userSchema from './schemas/user.schema.json'
import userStore from './mock/user.store.json'
Expand All @@ -21,6 +22,7 @@ export {
nonceSchema,
operatorSchema,
operatorStore,
reshareStore,
userAccountSchema,
userSchema,
userStore,
Expand Down
16 changes: 8 additions & 8 deletions common/data/src/mock/operator.store.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"654": "https://nodes.casimir.co/eth/goerli/dkg/1",
"655": "https://nodes.casimir.co/eth/goerli/dkg/2",
"656": "https://nodes.casimir.co/eth/goerli/dkg/3",
"657": "https://nodes.casimir.co/eth/goerli/dkg/4",
"658": "https://nodes.casimir.co/eth/goerli/dkg/5",
"659": "https://nodes.casimir.co/eth/goerli/dkg/6",
"660": "https://nodes.casimir.co/eth/goerli/dkg/7",
"661": "https://nodes.casimir.co/eth/goerli/dkg/8"
"200": "https://nodes.casimir.co/eth/goerli/dkg/1",
"201": "https://nodes.casimir.co/eth/goerli/dkg/2",
"202": "https://nodes.casimir.co/eth/goerli/dkg/3",
"203": "https://nodes.casimir.co/eth/goerli/dkg/4",
"156": "https://nodes.casimir.co/eth/goerli/dkg/5",
"157": "https://nodes.casimir.co/eth/goerli/dkg/6",
"158": "https://nodes.casimir.co/eth/goerli/dkg/7",
"159": "https://nodes.casimir.co/eth/goerli/dkg/8"
}
1 change: 1 addition & 0 deletions common/data/src/mock/reshare.store.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit d09f128

Please sign in to comment.