Skip to content

Commit

Permalink
Feat: Add v1 upgradeExecutor getters
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx committed Sep 25, 2024
1 parent 2f33e44 commit 1696a6c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/actions/hasRole.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Address, Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
import { upgradeExecutorABI } from '../contracts/UpgradeExecutor';
import { UpgradeExecutorRole } from '../upgradeExecutorEncodeFunctionData';

export type HasRoleParameters = {
upgradeExecutor: Address;
role: UpgradeExecutorRole;
address: Address;
};

export type HasRoleReturnType = ReadContractReturnType<typeof upgradeExecutorABI, 'hasRole'>;

export async function hasRole<TChain extends Chain>(
client: PublicClient<Transport, TChain>,
args: HasRoleParameters,
): Promise<HasRoleReturnType> {
return client.readContract({
abi: upgradeExecutorABI,
functionName: 'hasRole',
address: args.upgradeExecutor,
args: [args.role, args.address],
});
}

0 comments on commit 1696a6c

Please sign in to comment.