Files
onchain-id/tasks/deploy-proxy.task.ts
0407b3bfa4 ONCHAINID v2 (#73)
## [2.0.0]

Version 2.0.0 Audited by Hacken, more details [here](https://tokeny.com/wp-content/uploads/2023/04/Tokeny_ONCHAINID_SC-Audit_Report.pdf)

### Breaking changes

## Deprecation Notice
- ClaimIssuer `revokeClaim` is now deprecated, usage of `revokeClaimBySignature(bytes signature)` is preferred.

### Added
- Add typechain-types (targeting ethers v5).
- Add tests cases for `execute` and `approve` methods.
- Add method `revokeClaimBySignature(bytes signature)` in ClaimIssuer, prefer using this method instead of the now
deprecated `revokeClaim` method.
- Add checks on ClaimIssuer to prevent revoking an already revoked claim.
- Added Factory for ONCHAINIDs

### Updated
- Switch development tooling to hardhat.
- Implemented tests for hardhat (using fixture for faster testing time).
- Prevent calling `approve` method with a non-request execute nonce (added a require on `executionNone`).
- Update NatSpec of `execute` and `approve` methods.

---------

Co-authored-by: Joachim <[email protected]>
2023-04-27 17:27:41 +02:00

23 lines
1.0 KiB
TypeScript

import {task} from "hardhat/config";
import {TaskArguments} from "hardhat/types";
task("deploy-proxy", "Deploy an identity as a proxy using a factory")
.addParam("from", "Will pay the gas for the transaction")
.addParam("factory", "The address of the identity factory")
.addParam("key", "The ethereum address that will own the identity (as a MANAGEMENT key)")
.addOptionalParam("salt", "A salt to use when creating the identity")
.setAction(async (args: TaskArguments, hre) => {
const signer = await hre.ethers.getSigner(args.from);
const factory = await hre.ethers.getContractAt('IdFactory', args.factory, signer);
const tx = await factory.createIdentity(args.key, args.salt ?? args.key);
console.log(`Deploy a new identity as a proxy using factory ${factory.address} . tx: ${tx.hash}`);
await tx.wait();
const identityAddress = await factory.getIdentity(args.key);
console.log(`Deployed a new identity at ${identityAddress} as a proxy using factory ${factory.address} . tx: ${tx.hash}`);
});