Skip to content

Commit

Permalink
Update deployment script and add new transfer manager
Browse files Browse the repository at this point in the history
  • Loading branch information
0xandee committed Mar 12, 2024
1 parent dc32272 commit a69103d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 82 deletions.
6 changes: 3 additions & 3 deletions deployment-script/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PROVIDER_URL=
ACCOUNT_PUBLIC=
ACCOUNT_PRIVATE=
PROVIDER_URL=XXX
ACCOUNT_PUBLIC=XXX
ACCOUNT_PRIVATE=XXX
79 changes: 0 additions & 79 deletions deployment-script/deploymentTransferManager.ts

This file was deleted.

52 changes: 52 additions & 0 deletions deployment-script/deploymentTransferManager1155.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { Account, hash, Contract, json, Calldata, CallData, RpcProvider, shortString } from "starknet"
import fs from 'fs'
import dotenv from 'dotenv'

dotenv.config()

const ethAddress = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
const strkAddress = "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"
const marketplaceAddress = "0x1ad73c66d2f526e8ffed6db27652b658c0351f58c355e33a4c784a977caec4"
const transferSelectorAddress = "0x6ff00cf55c7a0bb534aa6f4f78fbd7923168c60b3f9b80df7f9c7ffd8a007e"

async function deploy() {
// connect provider
const providerUrl = process.env.PROVIDER_URL
console.log("providerUrl", providerUrl);
const provider = new RpcProvider({ nodeUrl: providerUrl! })
// connect your account. To adapt to your own account :
const privateKey0 = process.env.ACCOUNT_PRIVATE
console.log("privateKey0", privateKey0);
const account0Address = process.env.ACCOUNT_PUBLIC
console.log("account0Address", account0Address);
const account0 = new Account(provider, account0Address!, privateKey0!)
console.log("🚀 Deploying with Account: " + account0Address)

const compiledMarketplaceSierra = json.parse(fs.readFileSync("../target/dev/flex_MarketPlace.contract_class.json").toString("ascii"))
const marketplaceContract = new Contract(compiledMarketplaceSierra.abi, marketplaceAddress, provider)
marketplaceContract.connect(account0);

console.log("\n📦 Deploying TransferManagerERC1155...")
const compiledERC1155TransferManagerCasm = json.parse(fs.readFileSync("../target/dev/flex_ERC1155TransferManager.compiled_contract_class.json").toString("ascii"))
const compiledERC1155TransferManagerSierra = json.parse(fs.readFileSync("../target/dev/flex_ERC1155TransferManager.contract_class.json").toString("ascii"))
const ERC1155TransferManagerCallData: CallData = new CallData(compiledERC1155TransferManagerSierra.abi)
const ERC1155TransferManagerConstructor: Calldata = ERC1155TransferManagerCallData.compile("constructor", { marketplace: marketplaceAddress, owner: account0.address })
const deployERC1155TransferManagerResponse = await account0.declareAndDeploy({
contract: compiledERC1155TransferManagerSierra,
casm: compiledERC1155TransferManagerCasm,
constructorCalldata: ERC1155TransferManagerConstructor
})
console.log("✅ ERC1155TransferManager Deployed: ", deployERC1155TransferManagerResponse.deploy.contract_address)

const compiledTransferSelectorNFTSierra = json.parse(fs.readFileSync("../target/dev/flex_TransferSelectorNFT.contract_class.json").toString("ascii"))
const transferSelectorNFTContract = new Contract(compiledTransferSelectorNFTSierra.abi, transferSelectorAddress, provider)
transferSelectorNFTContract.connect(account0);

console.log("\n📦 update_TRANSFER_MANAGER_ERC1155 in TransferSelectorNFT...")
const transferSelectorCall = transferSelectorNFTContract.populate("update_TRANSFER_MANAGER_ERC1155", [deployERC1155TransferManagerResponse.deploy.contract_address])
const add_transferSelector_tx = await transferSelectorNFTContract.update_TRANSFER_MANAGER_ERC1155(transferSelectorCall.calldata)
await provider.waitForTransaction(add_transferSelector_tx.transaction_hash)
console.log("✅ Updated TRANSFER_MANAGER_ERC1155 in TransferSelectorNFT")
}

deploy()
1 change: 1 addition & 0 deletions deployment-script/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"scripts": {
"deploy": "scarb build && ts-node ./deployment.ts",
"marketplace-deploy": "scarb build && ts-node ./deploymentMarketplace.ts",
"transfermanager1155-deploy": "scarb build && ts-node ./deploymentTransferManager1155.ts",
"signaturechecker-deploy": "scarb build && ts-node ./deploymentSignatureChecker.ts"
},
"license": "MIT"
Expand Down

0 comments on commit a69103d

Please sign in to comment.