adjusted scripts d2f0aa59
Steve · 2023-10-17 15:22 2 file(s) · +24 −3
scripts/deployContractsScroll.js +22 −2
2 2
const { ethers } = require("hardhat");
3 3
const provider = new ethers.getDefaultProvider("https://sepolia-rpc.scroll.io/")
4 4
const { TokenboundClient } = require("@tokenbound/sdk");
5 +
const { createWalletClient, http } = require('viem')
6 +
const { privateKeyToAccount } = require('viem/accounts')
7 +
const { scrollSepolia } = require('viem/chains')
8 +
9 +
const account = privateKeyToAccount(`0x` + process.env.TEST_PRIVATE_KEY)
10 +
11 +
const walletClient = createWalletClient({
12 +
  account,
13 +
  chain: scrollSepolia,
14 +
  transport: http("https://sepolia-rpc.scroll.io/")
15 +
})
16 +
5 17
6 18
async function Main() {
7 19
35 47
  console.log(`SUPPLY_CONTRACT_ADDRESS=${supplyContractAddress}`);
36 48
37 49
  // Deploy ERC6551
38 -
  /* const RegistryContract = await ethers.getContractFactory("ERC6551Registry");
50 +
  const RegistryContract = await ethers.getContractFactory("ERC6551Registry");
39 51
  const registryContract = await RegistryContract.deploy();
40 52
  const registryContractAddress = await registryContract.getAddress()
41 53
  console.log("Registry Contract deployed to address:", registryContractAddress);
43 55
  const AccountContract = await ethers.getContractFactory("ERC6551Account");
44 56
  const accountContract = await AccountContract.deploy();
45 57
  const accountContractAddress = await accountContract.getAddress()
46 -
  console.log("Account Contract deployed to address:", accountContractAddress); */
58 +
  console.log("Account Contract deployed to address:", accountContractAddress);
47 59
48 60
  // Deploy Operator Contract
49 61
  const OperatorContract = await ethers.getContractFactory("Operator");
56 68
  await currencyContract.transferOwnership(operatorContractAddress);
57 69
  await foodContract.transferOwnership(operatorContractAddress);
58 70
  await supplyContract.transferOwnership(operatorContractAddress);
71 +
72 +
  const tokenboundClient = new TokenboundClient({
73 +
    walletClient: walletClient,
74 +
    chain: scrollSepolia,
75 +
    implementationAddress: accountContractAddress,
76 +
    registryAddress: registryContractAddress,
77 +
  })
78 +
59 79
60 80
  /* for (let i = 0; i < 19; i++) {
61 81
    // create NPC
scripts/deployContractsSepolia.js +2 −1
9 9
  // Get the signers from ethers
10 10
  const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider)
11 11
  const tokenboundClient = new TokenboundClient({ signer: wallet, chainId: 11155111 })
12 -
  console.log(`SERVER_WALLET_PRIVATE_KEY=${process.env.PRIVATE_KEY}`) console.log(`SERVER_WALLET_ADDRESS=${wallet.address}`)
12 +
  console.log(`SERVER_WALLET_PRIVATE_KEY=${process.env.PRIVATE_KEY}`)
13 +
  console.log(`SERVER_WALLET_ADDRESS=${wallet.address}`)
13 14
14 15
  // Deploy NPC contract
15 16
  const NPCContract = await ethers.getContractFactory("CosmicCowboys");