import { ethers } from "hardhat" ; import { generateMerkleTree , getProof } from "../lib/proof" ; const isTestingMode = ! ! process . env . TESTING_CONTRACT ; const treasuryAddress = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" ; async function main ( ) { const DevCoin = await ethers . getContractFactory ( "DevCoin" ) ; const dc = await DevCoin . deploy ( isTestingMode ? ( await ethers . getSigners ( ) ) [ 1 ] . address : treasuryAddress ) ; await dc . deployed ( ) ; console . log ( "Contract deployed to:" , dc . address ) ; if ( process . env . TESTING_CONTRACT ) { console . log ( "Setting merkle root for testing..." ) ; const [ owner , goodSigner ] = await ethers . getSigners ( ) ; const tree = generateMerkleTree ( [ owner . address , goodSigner . address ] ) ; await dc . setMerkleRoot ( tree . getHexRoot ( ) ) ; console . log ( "Contract merkle root set to:" , await dc . merkleRoot ( ) ) ; console . log ( `Proof for signer ${ goodSigner . address } is ${ getProof ( tree , goodSigner . address ) }` ) ; } } main ( ) . catch ( ( error ) => { console . error ( error ) ; process . exitCode = 1 ; } ) ;