006-OVM_BondManager.deploy.ts 809 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/* Imports: External */
import { DeployFunction } from 'hardhat-deploy/dist/types'

/* Imports: Internal */
import { getDeployedContract } from '../src/hardhat-deploy-ethers'

const deployFn: DeployFunction = async (hre) => {
  const { deploy } = hre.deployments
  const { deployer } = await hre.getNamedAccounts()

  const Lib_AddressManager = await getDeployedContract(
    hre,
    'Lib_AddressManager',
    {
      signerOrProvider: deployer,
    }
  )

19
  const result = await deploy('BondManager', {
20 21 22 23 24 25 26 27 28
    from: deployer,
    args: [Lib_AddressManager.address],
    log: true,
  })

  if (!result.newlyDeployed) {
    return
  }

29
  await Lib_AddressManager.setAddress('BondManager', result.address)
30 31 32
}

deployFn.dependencies = ['Lib_AddressManager']
33
deployFn.tags = ['BondManager']
34 35

export default deployFn