-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: deploy registry contract to arbitrum goerli
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
- Loading branch information
Showing
4 changed files
with
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,50 @@ | ||
import { Wallet } from 'ethers' | ||
import { task, types } from 'hardhat/config' | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types' | ||
import {Wallet, ethers} from 'ethers'; | ||
import {task, types} from 'hardhat/config'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
import { deploySubscriptions } from '../utils/deploy' | ||
import {deploySubscriptions, deployRegistry} from '../utils/deploy'; | ||
|
||
task('deploy', 'Deploy the subscription contract (use L2 network!)') | ||
.addParam('token', 'Address of the ERC20 token') | ||
.addOptionalParam('epochSeconds', 'Epoch length in seconds.', 3, types.int) | ||
.setAction(async (taskArgs, hre: HardhatRuntimeEnvironment) => { | ||
const accounts = await hre.ethers.getSigners() | ||
const accounts = await hre.ethers.getSigners(); | ||
|
||
if (accounts.length === 0) { | ||
throw new Error('No accounts available, set PRIVATE_KEY or MNEMONIC env variables') | ||
throw new Error( | ||
'No accounts available, set PRIVATE_KEY or MNEMONIC env variables' | ||
); | ||
} | ||
console.log('Deploying subscriptions contract with the account:', accounts[0].address); | ||
|
||
console.log( | ||
'Deploying subscriptions contract with the account:', | ||
accounts[0].address | ||
); | ||
|
||
await deploySubscriptions( | ||
[taskArgs.token, taskArgs.epochSeconds], | ||
accounts[0] as unknown as Wallet, | ||
) | ||
}) | ||
accounts[0] as unknown as Wallet | ||
); | ||
}); | ||
|
||
task('deploy:registry', 'Deploy the registry contract (use L2 network!)') | ||
.addOptionalParam('owner', 'Address of the contract owner') | ||
.setAction(async (taskArgs, hre: HardhatRuntimeEnvironment) => { | ||
const accounts = await hre.ethers.getSigners(); | ||
|
||
if (accounts.length === 0) { | ||
throw new Error( | ||
'No accounts available, set PRIVATE_KEY or MNEMONIC env variables' | ||
); | ||
} | ||
console.log( | ||
'Deploying registry contract with the account:', | ||
accounts[0].address | ||
); | ||
|
||
const registry = await deployRegistry(accounts[0] as unknown as Wallet); | ||
|
||
if (ethers.utils.isAddress(taskArgs.owner)) { | ||
console.log(`Transferring ownership to ${taskArgs.owner}`); | ||
await registry.connect(accounts[0]).transferOwnership(taskArgs.owner); | ||
} | ||
}); |