Skip to content

Commit

Permalink
Use Goerli network
Browse files Browse the repository at this point in the history
* new contract address for stage
* get balanse in health endpoint
* updated the graph endpoints
  • Loading branch information
Øyvind Hatland committed Oct 20, 2023
1 parent 4cc6782 commit 5e3a3ef
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 23 deletions.
11 changes: 4 additions & 7 deletions packages/api/src/contants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ const Networks = {
} as const;

const StartBlocks = {
[Networks.ARBITRUM_GOERLI]: 5074309,
[Networks.ARBITRUM_GOERLI]: 49339985,
[Networks.LOCALHOST]: 0,
[Networks.ARBITRUM_SEPOLIA]: 628100,
[Networks.ARBITRUM_ONE]: 142000000,
} as const;

const ContractAddresses = {
[Networks.ARBITRUM_GOERLI]: brokDevContracts,
[Networks.ARBITRUM_GOERLI]: brokStageContracts,
[Networks.LOCALHOST]: localhostContracts,
[Networks.ARBITRUM_SEPOLIA]: brokStageContracts,
[Networks.ARBITRUM_ONE]: brokProdContracts,
} as const;

Expand All @@ -34,8 +33,6 @@ export const DEFAULT_NETWORK = (() => {
case "localhost":
return Networks.LOCALHOST;
case "brokStage":
return Networks.ARBITRUM_SEPOLIA;
case "brokDev":
return Networks.ARBITRUM_GOERLI;
case "brokProd":
return Networks.ARBITRUM_ONE;
Expand All @@ -47,8 +44,6 @@ export const RPC_URL = (() => {
switch (DEFAULT_NETWORK) {
case Networks.LOCALHOST:
return process.env.RPC_LOCAL;
case Networks.ARBITRUM_SEPOLIA:
return process.env.RPC_SEPOLIA;
case Networks.ARBITRUM_ONE:
return process.env.RPC_ONE;
case Networks.ARBITRUM_GOERLI:
Expand All @@ -75,6 +70,8 @@ const SIGNATURE = WALLET.signMessage("This is just to create an stealth address"
// export const SPEND_KEY = async () => (await STEALTH_KEYS()).spend;
// export const VIEW_KEY = async () => (await STEALTH_KEYS()).view;

// BR - 0x0a665B1Bc813cAE9fcDd2Eb7E25b8E55A5F35f23
// TODO legg til BR og Fagsystem public address
export const CONTROLLERS = ["0x0a665B1Bc813cAE9fcDd2Eb7E25b8E55A5F35f23"];
export const DEFAULT_PARTITION = ethers.utils.formatBytes32String("ordinære");
export const THE_GRAPH_URL = process.env.THE_GRAPH_URL
3 changes: 3 additions & 0 deletions packages/api/src/pages/api/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CONTRACT_ADDRESSES, GET_PROVIDER, WALLET } from "../../contants";
import debug from "debug";
import { ApiRequestLogger } from "../../utils/api";
import { checkIfNavnetjenerIsHealthy } from "../../utils/navnetjener";
import { ethers } from 'ethers';

type Data = {};
const log = debug("brok:api:health");
Expand All @@ -30,6 +31,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
const operatorRole = await registry.OPERATOR_ROLE();
const isAuthorized = await registry.hasRole(operatorRole, wallet.address);
const navnetjenerAlive = await checkIfNavnetjenerIsHealthy();
const ethereumBalance = ethers.utils.formatEther(await wallet.getBalance())
log("checkAuth:", isAuthorized);
if (!isAuthorized) {
return res.status(500).json({
Expand All @@ -42,6 +44,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
status: "ok",
address: wallet.address,
registryAddress: registry.address,
ethereumBalance,
"connected to navnetjener": navnetjenerAlive,
});
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion packages/captable/deployments/brokStageContracts.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const brokStageContracts = {"CAP_TABLE_REGISTRY":"0x99FB2BFbe3723d757702037c4Ce052d84e49FFB8"} as const;
export const brokStageContracts = {"CAP_TABLE_REGISTRY":"0xF80Aa7b8F817DE61E7A864B288A88329b530345A"} as const;
4 changes: 2 additions & 2 deletions packages/captable/deployments/deploys.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

export * from "./localhostContracts";
export * from "./brokDevContracts";
export * from "./brokStageContracts";
export * from "./brokProdContracts";
export * from "./containerhardhatContracts";
export * from "./containerhardhatContracts";
export * from "./brokStageContracts";
4 changes: 2 additions & 2 deletions packages/graph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"deploy:localhost": "pnpm prepare:localhost && pnpm build && pnpm create:local && pnpm deploy:local",
"deploy:container-compose": "pnpm prepare:localhost && pnpm build && pnpm create:container && pnpm deploy:container",
"deploy:brokDev": "pnpm prepare:brokDev && pnpm graph deploy --product hosted-service ohatland/brok_dev_13",
"deploy:brokStage": "pnpm prepare:brokStage && pnpm graph deploy --product hosted-service ohatland/brok-ppe",
"deploy:brokProd": "pnpm prepare:brokProd && pnpm graph deploy --product hosted-service ohatland/brok-prd"
"deploy:brokStage": "pnpm prepare:brokStage && pnpm graph deploy --product hosted-service ohatland/brok-ppe-v4",
"deploy:brokProd": "pnpm prepare:brokProd && pnpm graph deploy --product hosted-service ohatland/brok-prd-v4"
},
"dependencies": {
"@brok/captable": "workspace:*",
Expand Down
18 changes: 10 additions & 8 deletions packages/graph/scripts/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ for (const dataSource of subgraphConfig.dataSources) {
dataSource.source.startBlock = 1;
}
if (env === "brokStage" || env === "brokDev") {
dataSource.source.startBlock = 628100;
dataSource.source.startBlock = 49339985;
}
if (env === "brokProd") {
dataSource.source.startBlock = 15853316;
dataSource.source.startBlock = 142000000;
}
}
// set chain
Expand All @@ -28,20 +28,22 @@ if (env === "localhost") {
for (const template of subgraphConfig.templates) {
template.network = "mainnet";
}
} else if (env === "brokProd") {
} else if (env === "brokStage") {
for (const dataSource of subgraphConfig.dataSources) {
dataSource.network = "mainnet";
dataSource.network = "arbitrum-goerli";
}
for (const template of subgraphConfig.templates) {
template.network = "mainnet";
template.network = "arbitrum-goerli";
}
} else {
} else if (env === "brokProd") {
for (const dataSource of subgraphConfig.dataSources) {
dataSource.network = "mainnet";
dataSource.network = "arbitrum-one";
}
for (const template of subgraphConfig.templates) {
template.network = "mainnet";
template.network = "arbitrum-one";
}
} else {
throw new Error("could not determine network")
}

fs.writeFileSync("subgraph.yaml", yaml.dump(subgraphConfig));
6 changes: 3 additions & 3 deletions packages/graph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ schema:
dataSources:
- kind: ethereum/contract
name: CapTableRegistry
network: mainnet
network: arbitrum-one
source:
address: '0xE9294466F1806e6074D70883c51B40d77fA68650'
abi: CapTableRegistry
startBlock: 15853316
startBlock: 142000000
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand All @@ -31,7 +31,7 @@ dataSources:
templates:
- name: CapTable
kind: ethereum/contract
network: mainnet
network: arbitrum-one
source:
abi: CapTable
mapping:
Expand Down

0 comments on commit 5e3a3ef

Please sign in to comment.