-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ERC1155NonTransferable deploy fixes (#349)
* properly add environment to output file * separate verification script * Pass erc1155nt address as env variable * Warn if erc1155nt address not provided * empty env value in env.example * format * added npm scripts
- Loading branch information
Showing
7 changed files
with
75 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import {isValidEnv, getAddressesFilePath} from './utils'; | ||
import fs from 'fs'; | ||
import hre from 'hardhat'; | ||
|
||
export async function verifyContracts(env: string): Promise<void> { | ||
const contracts = JSON.parse( | ||
fs.readFileSync( | ||
getAddressesFilePath(hre.network.config.chainId, env, 'erc1155nt'), | ||
'utf-8' | ||
) | ||
); | ||
|
||
if (contracts.chainId != hre.network.config.chainId) { | ||
throw new Error( | ||
'Contracts are not deployed on the same network, that you are trying to verify!' | ||
); | ||
} | ||
|
||
if (!isValidEnv(env.toLowerCase())) { | ||
throw new Error(`Env: ${env} is not recognized!`); | ||
} | ||
|
||
//verify ERC1155NonTransferable | ||
try { | ||
await hre.run('verify:verify', { | ||
address: contracts.erc1155NonTransferable, | ||
constructorArguments: [process.env.CONDITIONAL_COMMIT_TOKEN_METADATA_URI], | ||
}); | ||
} catch (error) { | ||
logError('ERC1155NonTransferable', error.message); | ||
} | ||
} | ||
|
||
function logError(contractName, msg) { | ||
console.log( | ||
`\x1b[31mError while trying to verify contract: ${contractName}!` | ||
); | ||
console.log(`Error message: ${msg}`); | ||
resetConsoleColor(); | ||
} | ||
|
||
function resetConsoleColor() { | ||
console.log('\x1b[0m'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters