mirror of
https://github.com/luxfi/onchain-id.git
synced 2026-10-30 15:23:49 +00:00
## [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]>
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import {task} from "hardhat/config";
|
|
import {TaskArguments} from "hardhat/types";
|
|
|
|
task("remove-key", "Remove a purpose from a key on an identity")
|
|
.addParam("from", "A MANAGEMENT key on the claim issuer")
|
|
.addParam("identity", "The address of the identity")
|
|
.addParam("key", "The key (ethereum address)")
|
|
.addParam("type", "The type of the key (ECDSA = 1)")
|
|
.addParam("purpose", "The purpose to remove (MANAGEMENT = 1, ACTION = 2, CLAIM = 3)")
|
|
.setAction(async (args: TaskArguments, hre) => {
|
|
const signer = await hre.ethers.getSigner(args.from);
|
|
|
|
const identity = await hre.ethers.getContractAt('Identity', args.identity, signer);
|
|
|
|
const keyHash = hre.ethers.utils.keccak256(
|
|
hre.ethers.utils.defaultAbiCoder.encode(['address'], [args.key]),
|
|
);
|
|
|
|
const tx = await identity.removeKey(
|
|
keyHash,
|
|
args.purpose,
|
|
);
|
|
|
|
console.log(`Remove purpose ${args.purpose} from key ${args.key} (hash: ${keyHash}) on identity ${args.identity} tx: ${tx.hash}`);
|
|
|
|
await tx.wait();
|
|
|
|
console.log(`Remove purpose ${args.purpose} from key ${args.key} (hash: ${keyHash}) on identity ${args.identity} tx mined: ${tx.hash}`);
|
|
});
|