-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemp-expire.js
More file actions
40 lines (36 loc) · 1.59 KB
/
emp-expire.js
File metadata and controls
40 lines (36 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// npx hardhat emp-expire --address <address> --network <network-name>
task("emp-expire", "Expires EMPs")
.addOptionalParam(
"gnosisSafe",
"Gnosis safe address, should be given if transactions need to be submitted to gnosis",
undefined,
types.string
)
.addParam("address", "Address of EMP to expire")
.setAction(
async (args, hre) => {
const { expect } = require('chai');
const { getTxUrl } = require('../utils/helper');
const colors = require('colors');
const getGnosisSigner = require('../gnosis/signer');
const EMP = await hre.ethers.getContractFactory("contracts/UMA/financial-templates/expiring-multiparty/ExpiringMultiParty.sol:ExpiringMultiParty");
let emp = await EMP.attach(args.address);
if (args.gnosisSafe) {
emp = emp.connect(await getGnosisSigner(args.gnosisSafe))
}
console.log(colors.blue("\n Expiring EMP: ....."));
try {
expect(await emp.contractState()).to.eq(0);
const expireEmpTx = await emp.expire()
await expireEmpTx.wait();
expect(await emp.contractState()).to.eq(1);
const txUrl = getTxUrl(hre.deployments.getNetworkName(), expireEmpTx.hash);
if (txUrl != null) {
console.log(colors.yellow("\n", txUrl));
}
} catch (error) {
console.log(colors.red("\n Expiring EMP failed: ....."));
console.log(error);
}
}
);