Skip to content

Commit

Permalink
feat(deployer): split contracts config (#378)
Browse files Browse the repository at this point in the history
## Description

Remove development related code from core and react SDKs.

## What type of PR is this? (check all applicable)

- [x] 🍕 Feature (`feat:`)

---------

Co-authored-by: kwiss <[email protected]>
  • Loading branch information
gershon and kwiss authored Jun 4, 2024
1 parent fc6405f commit 689d378
Show file tree
Hide file tree
Showing 88 changed files with 3,483 additions and 3,625 deletions.
27 changes: 8 additions & 19 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,71 +1,60 @@
# DEV
# Starknet accounts dev
# Responsible for deploying the contracts on starknet

# STARKNET_ADMIN_ADDRESS_DEV=0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03
# STARKNET_ADMIN_PRIVATE_KEY_DEV=0x1800000000300000180000000000030000000000003006001800006600
# STARKNET_ADMIN_PUBLIC_KEY_DEV=0x2b191c2f3ecf685a91af7cf72a43e7b90e2e41220175de5c4f7498981b10053

STARKNET_ADMIN_ADDRESS_DEV=0xb3ff441a68610b30fd5e2abbf3a1548eb6ba6f3559f2862bf2dc757e5828ca
STARKNET_ADMIN_PRIVATE_KEY_DEV=0x2bbf4f9fd0bbb2e60b0316c1fe0b76cf7a4d0198bd493ced9b8df2a3a24d68a

# Responsible for doing the transactions on starknet from the sequencer
STARKNET_SOLIS_ACCOUNT_ADDRESS_DEV=0x2d71e9c974539bb3ffb4b115e66a23d0f62a641ea66c4016e903454c8753bbc
STARKNET_SOLIS_ACCOUNT_PRIVATE_KEY_DEV=0x33003003001800009900180300d206308b0070db00121318d17b5e6262150b
STARKNET_SOLIS_ACCOUNT_PUBLIC_KEY_DEV=0x2b191c2f3ecf685a91af7cf72a43e7b90e2e41220175de5c4f7498981b10053
# Solis accounts dev
# Responsible for deploying the contracts on solis dev
SOLIS_ADMIN_ADDRESS_DEV=0x6b86e40118f29ebe393a75469b4d926c7a44c2e2681b6d319520b7c1156d114
SOLIS_ADMIN_PRIVATE_KEY_DEV=0x1c9053c053edf324aec366a34c6901b1095b07af69495bffec7d7fe21effb1b
SOLIS_ADMIN_PUBLIC_KEY_DEV=0x2b191c2f3ecf685a91af7cf72a43e7b90e2e41220175de5c4f7498981b10053

# SEPOLIA
# Starknet account sepolia
# Responsible for deploying the contracts on starknet
STARKNET_ADMIN_ADDRESS_SEPOLIA=
STARKNET_ADMIN_PRIVATE_KEY_SEPOLIA=
STARKNET_ADMIN_PUBLIC_KEY_SEPOLIA=
# Responsible for doing the transactions on starknet from the sequencer
STARKNET_SOLIS_ACCOUNT_ADDRESS_SEPOLIA=
STARKNET_SOLIS_ACCOUNT_PRIVATE_KEY_SEPOLIA=
STARKNET_SOLIS_ACCOUNT_PUBLIC_KEY_SEPOLIA=
# Solis accounts sepolia
# Responsible for deploying the contracts on solis sepolia
SOLIS_ADMIN_ADDRESS_SEPOLIA=
SOLIS_ADMIN_PRIVATE_KEY_SEPOLIA=
SOLIS_ADMIN_PUBLIC_KEY_SEPOLIA=

# MAINNET
# Starknet account mainnet
# Responsible for deploying the contracts on starknet
STARKNET_ADMIN_ADDRESS_MAINNET=
STARKNET_ADMIN_PRIVATE_KEY_MAINNET=
STARKNET_ADMIN_PUBLIC_KEY_MAINNET=
# Responsible for doing the transactions on starknet from the sequencer
STARKNET_SOLIS_ACCOUNT_ADDRESS_MAINNET=
STARKNET_SOLIS_ACCOUNT_PRIVATE_KEY_MAINNET=
STARKNET_SOLIS_ACCOUNT_PUBLIC_KEY_MAINNET=
# Solis accounts mainnet
# Responsible for deploying the contracts on solis sepolia
SOLIS_ADMIN_ADDRESS_MAINNET=
SOLIS_ADMIN_PRIVATE_KEY_MAINNET=
SOLIS_ADMIN_PUBLIC_KEY_MAINNET=

# Starknet RPC
# you should change the url to the one you want to use, preferably the one yours or not a public one
# You should change the URL to the one you want to use, preferably your own and not a public one.
STARKNET_NODE_URL_DEV=http://localhost:5050
STARKNET_NODE_URL_SEPOLIA=https://starknet-sepolia.public.blastapi.io
STARKNET_NODE_URL_MAINNET=https://starknet-mainnet.public.blastapi.io/rpc/v0_6

# Solis RPC
SOLIS_NODE_URL_DEV=http://0.0.0.0:7777
SOLIS_NODE_URL_MAINNET=https://staging.solis.arkproject.dev
SOLIS_NODE_URL_MAINNET=https://production.solis.arkproject.dev
RPC_USER=solis
RPC_PASSWORD=password

## Demo App env
NEXT_PUBLIC_NFT_API_KEY=AY1oXgEAmF139oBoxDSomzVnHqy8ZdQ2NxLmzJ6i
NEXT_PUBLIC_NFT_API_URL=https://api.arkproject.dev
NEXT_PUBLIC_ORDERBOOK_API_URL=https://api-orderbook.arkproject.dev

## Demo App env
NEXT_PUBLIC_BROKER_ID = "0xe29882a1fcba1e7e10cad46212257fea5c752a4f9b1b1ec683c503a2cf5c8a"
# The default broker_id should be an address used to receive marketplace fees.
NEXT_PUBLIC_BROKER_ID=0x00E4769a4d2F7F69C70951A003eBA5c32707Cef3CdfB6B27cA63567f51cdd078
# Use the corresponding contract for the network used in the example app (default is mainnet).
# The contract can be found in contracts.json in the repo root.
NEXT_PUBLIC_STARKNET_NFT_CONTRACT=0x32d99485b22f2e58c8a0206d3b3bb259997ff0db70cffd25585d7dd9a5b0546
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ dbdata/

# cairo
.snfoundry_cache

# contracts
contracts.dev.json
45 changes: 16 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,65 +72,52 @@ by Diri.

## Quick start for local development

install the latest dojo version on your machine (currently 0.0.7-alpha.1)
> Install the latest dojo version on your machine (currently 0.0.7-alpha.1)
> https://book.dojoengine.org/getting-started
https://book.dojoengine.org/getting-started

launch a katana (0.6.0)

```bash
katana
```

install packages
Install packages

```bash
pnpm install
```

build the contracts
WARNING: be sure to have the scarb version specified in the .tool-versions file installed
Build contracts

```bash
cd contracts
scarb build
```
cd contracts && scarb build --workspaces
```

WARNING: be sure to remove old contracts addresses in contracts.json (dev part)

deploy starknet contracts
Launch a katana (0.6.0)

```bash
pnpm deploy:starknet
katana
```

it should modify the messaging.local.json file to add the contract addresses that will use to on solis

deploy starknet test tokens contracts for erc20 and erc721
Deploy starknet contracts

```bash
pnpm deploy:starknet:tokens
pnpm deploy:starknet:local
```

Launch Solis sequencer
Launch solis

```bash
cargo run -p solis -- --chain-id 0x736f6c6973 --messaging crates/solis/messaging.local.json --disable-fee -p 7777
```

deploy Solis ArkProject contracts
Deploy solis contracts

```bash
pnpm deploy:solis
pnpm deploy:solis:local
```

Build the SDKs
Build the core and react SDKs

```bash
pnpm run build
pnpm build --filer=core --filer-react
```

Try some examples
Try some core SDK examples

```bash
cd examples/core
Expand Down
8 changes: 4 additions & 4 deletions apps/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.7",
"@starknet-react/chains": "^0.1.0",
"@starknet-react/core": "^2.2.2",
"@starknet-react/chains": "^0.1.7",
"@starknet-react/core": "^2.8.1",
"@t3-oss/env-nextjs": "^0.8.0",
"@tanstack/react-table": "^8.11.7",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"cmdk": "^0.2.0",
"date-fns": "^3.3.1",
"get-starknet-core": "^3.2.0",
"get-starknet-core": "^3.3.0",
"next": "14.0.2",
"next-themes": "^0.2.0",
"react": "^18",
Expand All @@ -44,7 +44,7 @@
"react-query": "^3.39.3",
"react-resizable-panels": "^2.0.1",
"react-wrap-balancer": "^1.1.0",
"starknet": "6.6.6",
"starknet": "^6.9.0",
"tailwind-merge": "^2.1.0",
"tailwindcss-animate": "^1.0.7",
"viem": "^2.12.1",
Expand Down
3 changes: 2 additions & 1 deletion apps/example/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import React from "react";

// import type { Metadata } from "next";
import { Inter as FontSans } from "next/font/google";

import { networks } from "@ark-project/core";
Expand All @@ -29,8 +28,10 @@ export default function RootLayout({
children: React.ReactNode;
}) {
const config = {
starknetNetwork: networks.mainnet,
arkchainNetwork: networks.mainnet
};

return (
<html lang="en" suppressHydrationWarning>
<body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function CreateOffer({ token }: CreateOfferProps) {

const processedValues = {
brokerId: env.NEXT_PUBLIC_BROKER_ID,
currencyAddress: config?.starknetContracts.eth,
currencyAddress: config?.starknetCurrencyContract,
tokenAddress: token.contract_address,
tokenId: BigInt(token.token_id),
startAmount: parseEther(values.startAmount)
Expand Down
8 changes: 3 additions & 5 deletions apps/example/src/app/marketplace/mint/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { useEffect, useMemo, useState } from "react";

import { env } from "@/env";
import {
useAccount,
useContract,
Expand All @@ -11,8 +12,6 @@ import {
} from "@starknet-react/core";
import Image from "next/image";

import { useConfig } from "@ark-project/react";

import { Button } from "@/components/ui/Button";
import {
Card,
Expand All @@ -35,20 +34,19 @@ type TokenMetadata = {

export default function Home() {
const { address } = useAccount();
const config = useConfig();
const [tokenId, setTokenId] = useState<number | null>(null);
const [tokenMetadata, setTokenMetadata] = useState<TokenMetadata | null>(
null
);

const { contract } = useContract({
abi: ABI,
address: config?.starknetContracts.nftContract
address: env.NEXT_PUBLIC_STARKNET_NFT_CONTRACT
});
const { data, isError, isLoading, error } = useContractRead({
functionName: "get_current_token_id",
abi: ABI,
address: config?.starknetContracts.nftContract,
address: env.NEXT_PUBLIC_STARKNET_NFT_CONTRACT,
watch: true
});

Expand Down
7 changes: 5 additions & 2 deletions apps/example/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const env = createEnv({
NEXT_PUBLIC_ORDERBOOK_API_URL: z.string(),
NEXT_PUBLIC_NFT_API_URL: z.string(),
NEXT_PUBLIC_NFT_API_KEY: z.string(),
NEXT_PUBLIC_BROKER_ID: z.string()
NEXT_PUBLIC_BROKER_ID: z.string(),
NEXT_PUBLIC_STARKNET_NFT_CONTRACT: z.string()
},
/*
* Due to how Next.js bundles environment variables on Edge and Client,
Expand All @@ -28,6 +29,8 @@ export const env = createEnv({
NEXT_PUBLIC_NFT_API_KEY: process.env.NEXT_PUBLIC_NFT_API_KEY,
NEXT_PUBLIC_ORDERBOOK_API_URL: process.env.NEXT_PUBLIC_ORDERBOOK_API_URL,
NEXT_PUBLIC_NFT_API_URL: process.env.NEXT_PUBLIC_NFT_API_URL,
NEXT_PUBLIC_BROKER_ID: process.env.NEXT_PUBLIC_BROKER_ID
NEXT_PUBLIC_BROKER_ID: process.env.NEXT_PUBLIC_BROKER_ID,
NEXT_PUBLIC_STARKNET_NFT_CONTRACT:
process.env.NEXT_PUBLIC_STARKNET_NFT_CONTRACT
}
});
10 changes: 9 additions & 1 deletion contracts.json
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
{"goerli":{"nftContract":"0x22411b480425fe6e627fdf4d1b6ac7f8567314ada5617a0a6d8ef3e74b69436","messaging":"0x2c3d3e0c37d29364a13ba8cff046e7bc5624655a72526961876a1c8bb3f63c8","executor":"0x73148536f8ea9546e92761d11515548cc433df46883d5ee98871a6f63a0bbbc","orderbook":"0x66f1e6acf9bdbd23837b2eea271430298b355c506978edb132737e7fcb6b310"},"sepolia":{},"mainnet":{"nftContract":"0x32d99485b22f2e58c8a0206d3b3bb259997ff0db70cffd25585d7dd9a5b0546","messaging":"0x57d45cc46de463f7ae63b74ce9b6b6b496a1178b02e7ad04d7c307caa698b7b","executor":"0x7b42945bc47001db92fe1b9739d753925263f2f1036c2ae1f87536c916ee6a","orderbook":"0x51d61ee6b0814a990a82fa7c8d9515c19f82d4bdb34e35e3d00762caa752bdb"},"dev":{"messaging":"0xf4d2ec292d26287b6e6c200a12e279fb412e3396925db2df596c64f22ed89f","executor":"0x2dfd771779cdfe0b0e064e2faf79bb561359bc90706fc26292ad2583c01cd61","nftContract":"0x563b45958320651042914b33f82ba0a9783bd17dfa9e00d70df94593978cafd","eth":"0x200184bde479ccffa50a89485417c907bc1d3779f9b1863d2158733135facce","orderbook":"0x5c365d9fde044e0025c29d80207b6f30328225cc1291a8df009fa9505a841ba"}}
{
"sepolia": {},
"mainnet": {
"nftContract": "0x32d99485b22f2e58c8a0206d3b3bb259997ff0db70cffd25585d7dd9a5b0546",
"messaging": "0x57d45cc46de463f7ae63b74ce9b6b6b496a1178b02e7ad04d7c307caa698b7b",
"executor": "0x7b42945bc47001db92fe1b9739d753925263f2f1036c2ae1f87536c916ee6a",
"orderbook": "0x51d61ee6b0814a990a82fa7c8d9515c19f82d4bdb34e35e3d00762caa752bdb"
}
}
3 changes: 1 addition & 2 deletions crates/solis/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
messaging.goerli.json
messaging.json
messaging.local.json
9 changes: 0 additions & 9 deletions crates/solis/messaging.local.json

This file was deleted.

Loading

0 comments on commit 689d378

Please sign in to comment.