3
3
import { ethers , run } from 'hardhat'
4
4
import type { ContractTransaction } from 'ethers'
5
5
6
+ import { wait } from './utils/wait'
7
+
6
8
async function main ( ) {
7
9
console . log ( 'Starting deploySBTFactory script on sbt-tokens...' )
8
10
@@ -19,7 +21,7 @@ async function main() {
19
21
// @TODO : modify this address when deploying...
20
22
const proxyAdmin = '0xec4562C829661c891FcEadb44F831c8a5e71bC8F'
21
23
// @TODO : check and change this whenever required.
22
- const identifier = ethers . utils . formatBytes32String ( 'First SBT' )
24
+ const identifier = ethers . utils . formatBytes32String ( 'Test Achievement SBT' )
23
25
// @TODO : check and change this whenever required.
24
26
const sbtFactoryAddress = '0x0F0b8697169aF45FC61814C3e5b4d784a909b9A7'
25
27
@@ -37,10 +39,17 @@ async function main() {
37
39
identifier
38
40
) ) as ContractTransaction
39
41
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
+ } )
44
53
const proxyCreationLog = logs . find ( ( log ) => log . name === 'SBTProxyCreated' )
45
54
const implementationCreationLog = logs . find (
46
55
( log ) => log . name === 'SBTImplementationCreated'
@@ -51,6 +60,7 @@ async function main() {
51
60
1
52
61
) as string
53
62
63
+ await wait ( 30 * 1000 ) // For block explorer to scan newly deployed address and attach it's bytecode to it.
54
64
if ( implementationCreationLog ) {
55
65
console . log (
56
66
` - SBT implementation deployed at addr:${ implementationContractAddress } `
@@ -63,6 +73,8 @@ async function main() {
63
73
} )
64
74
}
65
75
76
+ await wait ( 30 * 1000 ) // For block explorer to scan newly deployed address and attach it's bytecode to it.
77
+
66
78
if ( proxyCreationLog ) {
67
79
console . log ( ` - SBT proxy deployed at addr:${ proxyContractAddress } ` )
68
80
console . log ( ' - Verifying SBT proxy contract...' )
0 commit comments