-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from TogetherCrew/roles
Roles
- Loading branch information
Showing
13 changed files
with
143 additions
and
111 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ import {AccessManagedUpgradeable} from "@openzeppelin/contracts-upgradeable/acce | |
import {IEAS} from "@ethereum-attestation-service/eas-contracts/contracts/IEAS.sol"; | ||
import {Attestation} from "@ethereum-attestation-service/eas-contracts/contracts/Common.sol"; | ||
import {SchemaResolver} from "@ethereum-attestation-service/eas-contracts/contracts/resolver/SchemaResolver.sol"; | ||
import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol"; | ||
import {OIDAccessManager} from "./OIDAccessManager.sol"; | ||
|
||
contract OIDResolver is SchemaResolver, AccessManagedUpgradeable { | ||
error UnauthorizedAttester(address attester); | ||
|
@@ -47,7 +47,11 @@ contract OIDResolver is SchemaResolver, AccessManagedUpgradeable { | |
} | ||
|
||
function _checkAttester(address attester) internal virtual { | ||
(bool isMember, ) = IAccessManager(authority()).hasRole(2, attester); | ||
OIDAccessManager authority = OIDAccessManager(authority()); | ||
Check notice Code scanning / Slither Local variable shadowing Low
OIDResolver._checkAttester(address).authority shadows:
- AccessManagedUpgradeable.authority() (function) - IAccessManaged.authority() (function) |
||
(bool isMember, ) = authority.hasRole( | ||
authority.ATTESTATION_MANAGER_ROLE(), | ||
attester | ||
); | ||
if (!isMember) { | ||
revert UnauthorizedAttester(attester); | ||
} | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import hre from "hardhat"; | ||
import type { WalletClient } from "viem"; | ||
|
||
export async function deployAccessManager(deployer: WalletClient) { | ||
const contract = await hre.viem.deployContract("OIDAccessManager", [], { | ||
account: deployer.account, | ||
}); | ||
await contract.write.initialize(); | ||
return contract; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { SchemaRegistry } from "@ethereum-attestation-service/eas-sdk"; | ||
import hre from "hardhat"; | ||
import type { | ||
Account, | ||
Address, | ||
Chain, | ||
Client, | ||
Transport, | ||
WalletClient, | ||
} from "viem"; | ||
import { clientToSigner } from "./clientToSigner"; | ||
|
||
export async function deployEAS(deployer: WalletClient) { | ||
const registry = await hre.viem.deployContract("SchemaRegistry", [], { | ||
account: deployer.account, | ||
}); | ||
const eas = await hre.viem.deployContract("EAS", [registry.address], { | ||
account: deployer.account, | ||
}); | ||
return { | ||
registry, | ||
eas, | ||
}; | ||
} | ||
|
||
export async function deploySchema( | ||
deployer: Client<Transport, Chain, Account>, | ||
registryAddress: string, | ||
schema: string, | ||
resolverAddress = "0x0000000000000000000000000000000000000000", | ||
revocable = true, | ||
): Promise<Address> { | ||
const registry = new SchemaRegistry(registryAddress); | ||
|
||
const signer = clientToSigner(deployer); | ||
registry.connect(signer); | ||
const tx = await registry.register({ schema, resolverAddress, revocable }); | ||
return (await tx.wait()) as Address; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.