Skip to content

Commit 7f4cb51

Browse files
author
Yash Agrawal
committed
feat: minor fixes
1 parent b2b11f0 commit 7f4cb51

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

scripts/deployWithSBTFactory.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import { ethers, run } from 'hardhat'
44
import type { ContractTransaction } from 'ethers'
55

6+
import { wait } from './utils/wait'
7+
68
async function main() {
79
console.log('Starting deploySBTFactory script on sbt-tokens...')
810

@@ -19,7 +21,7 @@ async function main() {
1921
// @TODO: modify this address when deploying...
2022
const proxyAdmin = '0xec4562C829661c891FcEadb44F831c8a5e71bC8F'
2123
// @TODO: check and change this whenever required.
22-
const identifier = ethers.utils.formatBytes32String('First SBT')
24+
const identifier = ethers.utils.formatBytes32String('Test Achievement SBT')
2325
// @TODO: check and change this whenever required.
2426
const sbtFactoryAddress = '0x0F0b8697169aF45FC61814C3e5b4d784a909b9A7'
2527

@@ -37,10 +39,17 @@ async function main() {
3739
identifier
3840
)) as ContractTransaction
3941
console.log(` - SBT deployment using SBTFactory at txn:${txn.hash}`)
40-
const txReceipt = await txn.wait(2)
41-
const logs = txReceipt.logs.map((log) =>
42-
sbtFactoryInstance.interface.parseLog(log)
43-
)
42+
const txReceipt = await txn.wait(10)
43+
const logs = txReceipt.logs.map((log) => {
44+
try {
45+
// Because here events/logs contains some deployment/general blockchain events which cannot be parsed by contract.interface.
46+
const l = sbtFactoryInstance.interface.parseLog(log)
47+
return l
48+
} catch (err) {
49+
// Hence, we are removing those as we do not need those events.
50+
return { name: '', args: [] }
51+
}
52+
})
4453
const proxyCreationLog = logs.find((log) => log.name === 'SBTProxyCreated')
4554
const implementationCreationLog = logs.find(
4655
(log) => log.name === 'SBTImplementationCreated'
@@ -51,6 +60,7 @@ async function main() {
5160
1
5261
) as string
5362

63+
await wait(30 * 1000) // For block explorer to scan newly deployed address and attach it's bytecode to it.
5464
if (implementationCreationLog) {
5565
console.log(
5666
` - SBT implementation deployed at addr:${implementationContractAddress}`
@@ -63,6 +73,8 @@ async function main() {
6373
})
6474
}
6575

76+
await wait(30 * 1000) // For block explorer to scan newly deployed address and attach it's bytecode to it.
77+
6678
if (proxyCreationLog) {
6779
console.log(` - SBT proxy deployed at addr:${proxyContractAddress}`)
6880
console.log(' - Verifying SBT proxy contract...')

scripts/utils/wait.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const wait = async (ms: number) =>
2+
new Promise((resolve) => {
3+
setInterval(resolve, ms)
4+
})

0 commit comments

Comments
 (0)