Skip to content

Commit

Permalink
version matching script
Browse files Browse the repository at this point in the history
  • Loading branch information
Aodhgan committed Jul 12, 2021
1 parent 21cf937 commit e96b685
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions scripts/matchVersions.js
@@ -0,0 +1,27 @@
const packageDotJson = require("../package.json")
const hardhat = require("hardhat")
const { ethers } = require("hardhat")

function yellow() {
console.log(chalk.yellow.call(chalk, ...arguments))
}

async function run () {
const packageVersion = packageDotJson.version
yellow(`Checking NPM package version ${packageVersion} matches contract VERSION constant..`)

const deployments = await deployments.all()

// get PrizePool VERSION
const prizePoolArtifact = await hardhat.artifacts.readArtifact("PrizePool")
const prizePool = await ethers.getContractAt("PrizePool", deployments["CompoundPrizePool"])
const prizePoolVersion = await prizePool.VERSION()

// get PrizeStrategy VERSION
const prizeStrategy = await hardhat.ethers.getContract("PeriodicPrizeStrategy")
const prizeStrategyVersion = await prizeStrategy.VERSION()

// assert packgeVersion == prizePoolVersion == prizeStrategyVersion

}
run()

0 comments on commit e96b685

Please sign in to comment.