Skip to content

Commit

Permalink
chore(deploy): base-sepolia and update contracts pacakge
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbeckers committed Aug 19, 2024
1 parent 055efcd commit 618e445
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 82 deletions.
8 changes: 2 additions & 6 deletions contracts/hardhat.config.cts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,11 @@ const ARBISCAN_API_KEY = requireEnv(process.env.ARBISCAN_API_KEY, "ARBISCAN_API_
*/
const chainIds = {
hardhat: 31337,
// Ethereum: https://docs.infura.io/infura/networks/ethereum/how-to/choose-a-network
sepolia: 11155111,
// Optimism: https://docs.infura.io/infura/networks/optimism/how-to/choose-a-network
"optimism-mainnet": 10,
// Celo
"celo-mainnet": 42220,
// Base
"base-sepolia": 84532,
"base-mainnet": 8453,
// Arbitrum
"arb-sepolia": 421614,
"arb-mainnet": 42161,
};
Expand All @@ -88,7 +83,8 @@ function getChainConfig(chain: keyof typeof chainIds) {
if (chain === "optimism-mainnet") {
config = {
...config,
url: `https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}`,
url: "https://virtual.optimism.rpc.tenderly.co/41aca07e-03d1-4a5c-807a-e43c1777100a"
// url: `https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}`,
};
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hypercerts-org/contracts",
"description": "EVM compatible protocol for managing impact claims",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.4",
"author": {
"name": "Hypercerts Foundation",
"url": "https://github.com/hypercerts-org/hypercerts"
Expand Down
8 changes: 8 additions & 0 deletions contracts/src/deployments/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import deployments_marketplace_base_sepolia from "./deployment-marketplace-base-sepolia.json"
import deployments_marketplace_sepolia from "./deployment-marketplace-sepolia.json";
import deployments_protocol from "./deployments-protocol.json";

const deployments_marketplace = {
"84532": {
TransferManager: deployments_marketplace_base_sepolia.TransferManager.address,
HypercertExchange: deployments_marketplace_base_sepolia.HypercertExchange.address,
OrderValidatorV2A: deployments_marketplace_base_sepolia.OrderValidator.address,
RoyaltyFeeRegistry: deployments_marketplace_base_sepolia.RoyaltyFeeRegistry.address,
StrategyHypercertFractionOffer: deployments_marketplace_base_sepolia.StrategyHypercertFractionOffer.address,
},
"11155111": {
TransferManager: deployments_marketplace_sepolia.TransferManager.address,
HypercertExchange: deployments_marketplace_sepolia.HypercertExchange.address,
Expand Down
11 changes: 6 additions & 5 deletions contracts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export type DeploymentMarketplace = {
HypercertExchange: `0x${string}`;
OrderValidatorV2A: `0x${string}`;
RoyaltyFeeRegistry: `0x${string}`;
StrategyCollectionOffer: `0x${string}`;
StrategyDutchAuction: `0x${string}`;
StrategyItemIdsRange: `0x${string}`;
StrategyHypercertCollectionOffer: `0x${string}`;
StrategyHypercertDutchAuction: `0x${string}`;
// StrategyCollectionOffer: `0x${string}`;
// StrategyDutchAuction: `0x${string}`;
// StrategyItemIdsRange: `0x${string}`;
// StrategyHypercertCollectionOffer: `0x${string}`;
// StrategyHypercertDutchAuction: `0x${string}`;
StrategyHypercertFractionOffer: `0x${string}`;
};

Expand All @@ -71,6 +71,7 @@ const deployments = {
},
84532: {
...DEPLOYMENTS.protocol["84532"],
...DEPLOYMENTS.marketplace["84532"],
},
8453: {
...DEPLOYMENTS.protocol["8453"],
Expand Down
78 changes: 78 additions & 0 deletions contracts/tasks/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
export type TokenAddressType = { sepolia: string; [key: string]: string };

const WETH: TokenAddressType = {
localhost: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9", //dummy
hardhat: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9", //dummy
sepolia: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
"optimism-mainnet": "0x4200000000000000000000000000000000000006",
"base-sepolia": "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
};

// LINK faucet for Sepolia: https://faucets.chain.link/
const DAI: TokenAddressType = {
localhost: "0x779877A7B0D9E8603169DdbD7836e478b4624789",
hardhat: "0x779877A7B0D9E8603169DdbD7836e478b4624789",
sepolia: "0x779877A7B0D9E8603169DdbD7836e478b4624789",
"optimism-mainnet": "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",
"base-sepolia": "0xE4aB69C077896252FAFBD49EFD26B5D171A32410",
};

// USDC https://faucet.circle.com/
// https://developers.circle.com/stablecoins/docs/usdc-on-main-networks
const USDC: TokenAddressType = {
localhost: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
hardhat: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
sepolia: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
"optimism-mainnet": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
"base-sepolia": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
};

export const getTokenAddresses = (network: string) => {
return {
wethAddress: WETH[network],
usdceAddress: USDC[network],
daiAddress: DAI[network],
};
};

const ADMIN_ACCOUNT: { [key: string]: string } = {
localhost: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
hardhat: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
sepolia: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
"base-sepolia": "0xA2Cb9D926b090577AD45fC0F40C753BF369B82Ff",
"optimism-mainnet": "0x560adA72a80b4707e493cA8c3B7B7528930E7Be5",
celo: "0x14ae502FEF3843fF3a1735B3209D39B320130af9",
base: "0x14ae502FEF3843fF3a1735B3209D39B320130af9",
arbitrum: "0x14ae502FEF3843fF3a1735B3209D39B320130af9",
};

export const getAdminAccount = (network: string): string => {
const account = ADMIN_ACCOUNT[network];

if (!account || account === null || account.trim() === "") {
throw new Error(`Admin account for network "${network}" is not defined, null, or empty.`);
}

return account;
};

const FEE_RECIPIENT: { [key: string]: string } = {
localhost: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
hardhat: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
sepolia: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
"base-sepolia": "0xe518aED97D9d45174a06bB8EF663B4fB51330725",
"optimism-mainnet": "0xE7C4531ad8828794904D332a12702beC8ff1A498",
celo: "0xE7C4531ad8828794904D332a12702beC8ff1A498",
base: "0xE7C4531ad8828794904D332a12702beC8ff1A498",
arbitrum: "0xE7C4531ad8828794904D332a12702beC8ff1A498",
};

export const getFeeRecipient = (network: string): string => {
const recipient = FEE_RECIPIENT[network];

if (!recipient || recipient === null || recipient.trim() === "") {
throw new Error(`Fee recipient for network "${network}" is not defined, null, or empty.`);
}

return recipient;
};
71 changes: 1 addition & 70 deletions contracts/tasks/deploy-marketplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,81 +10,12 @@ import {
PublicClient,
} from "viem";
import { writeFile } from "node:fs/promises";
import { getAdminAccount, getFeeRecipient, getTokenAddresses } from "./config";

function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}

type TokenAddressType = { sepolia: string; [key: string]: string };

const WETH: TokenAddressType = {
localhost: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9", //dummy
hardhat: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9", //dummy
sepolia: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
optimism: "0x4200000000000000000000000000000000000006",
"base-sepolia": "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
};

// LINK faucet for Sepolia: https://faucets.chain.link/
const DAI: TokenAddressType = {
localhost: "0x779877A7B0D9E8603169DdbD7836e478b4624789",
hardhat: "0x779877A7B0D9E8603169DdbD7836e478b4624789",
sepolia: "0x779877A7B0D9E8603169DdbD7836e478b4624789",
optimism: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1",
"base-sepolia": "0xE4aB69C077896252FAFBD49EFD26B5D171A32410",
};

// USDC https://faucet.circle.com/
const USDC: TokenAddressType = {
localhost: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
hardhat: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
sepolia: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
optimism: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
"base-sepolia": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
};

const getTokenAddresses = (network: string) => {
return {
wethAddress: WETH[network],
usdceAddress: USDC[network],
daiAddress: DAI[network],
};
};

const ADMIN_ACCOUNT: { [key: string]: string } = {
localhost: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
hardhat: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
sepolia: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
"base-sepolia": "0xA2Cb9D926b090577AD45fC0F40C753BF369B82Ff",
};

const getAdminAccount = (network: string): string => {
const account = ADMIN_ACCOUNT[network];

if (!account || account === null || account.trim() === "") {
throw new Error(`Admin account for network "${network}" is not defined, null, or empty.`);
}

return account;
};

const FEE_RECIPIENT: { [key: string]: string } = {
localhost: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
hardhat: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
sepolia: "0x4f37308832c6eFE5A74737955cBa96257d76De17",
"base-sepolia": "0xe518aED97D9d45174a06bB8EF663B4fB51330725",
};

const getFeeRecipient = (network: string): string => {
const recipient = FEE_RECIPIENT[network];

if (!recipient || recipient === null || recipient.trim() === "") {
throw new Error(`Fee recipient for network "${network}" is not defined, null, or empty.`);
}

return recipient;
};

const getCreate2Address = async (
deployer: WalletClient,
factory: `0x${string}`,
Expand Down

0 comments on commit 618e445

Please sign in to comment.