From d3edf0c095020b1d991c6ff16d23040b28ce5da5 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Wed, 13 Dec 2017 18:32:03 -0500 Subject: [PATCH] Fix missing solvers param when deploying LivepeerVerifier. Fix possible divide by zero in setInflation --- contracts/token/Minter.sol | 7 ++++++- migrations/3_deploy_contracts.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/contracts/token/Minter.sol b/contracts/token/Minter.sol index 34c98af3..8a1f2a36 100644 --- a/contracts/token/Minter.sol +++ b/contracts/token/Minter.sol @@ -126,7 +126,12 @@ contract Minter is Manager, IMinter { * @dev Set inflation based upon the current bonding rate */ function setInflation() internal { - uint256 currentBondingRate = (bondingManager().getTotalBonded() * PERC_DIVISOR) / livepeerToken().totalSupply(); + uint256 currentBondingRate = 0; + uint256 totalSupply = livepeerToken().totalSupply(); + + if (totalSupply > 0) { + currentBondingRate = (bondingManager().getTotalBonded() * PERC_DIVISOR) / totalSupply; + } if (currentBondingRate < targetBondingRate) { // Bonding rate is below the target - increase inflation diff --git a/migrations/3_deploy_contracts.js b/migrations/3_deploy_contracts.js index 5f14fdbf..96662c22 100644 --- a/migrations/3_deploy_contracts.js +++ b/migrations/3_deploy_contracts.js @@ -61,7 +61,7 @@ module.exports = function(deployer, network) { if (network === "development" || network === "testrpc" || network === "parityDev" || network === "gethDev") { await deployAndRegister(deployer, controller, IdentityVerifier, "Verifier", controller.address) } else if (network === "lpTestNet") { - await deployAndRegister(deployer, controller, LivepeerVerifier, "Verifier", controller.address, config.verifier.verificationCodeHash) + await deployAndRegister(deployer, controller, LivepeerVerifier, "Verifier", controller.address, config.verifier.solvers, config.verifier.verificationCodeHash) } else { await deployAndRegister(deployer, controller, OraclizeVerifier, "Verifier", controller.address, config.verifier.verificationCodeHash, config.verifier.gasPrice, config.verifier.gasLimit) }