Skip to content

Commit

Permalink
Adding IsPendingAdmin & IsAdmin read APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Chatham committed Dec 10, 2024
1 parent c2ed406 commit fdae593
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions chainio/clients/elcontracts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,3 +718,27 @@ func (r *ChainReader) ListAdmins(
}
return pendingAdmins, nil
}

func (r *ChainReader) IsPendingAdmin(
ctx context.Context,
accountAddress gethcommon.Address,
pendingAdminAddress gethcommon.Address,
) (bool, error) {
isPendingAdmin, err := r.permissionController.IsPendingAdmin(&bind.CallOpts{Context: ctx}, accountAddress, pendingAdminAddress)
if err != nil {
return isPendingAdmin, errors.New("call to permission controller failed: " + err.Error())
}
return isPendingAdmin, nil
}

func (r *ChainReader) IsAdmin(
ctx context.Context,
accountAddress gethcommon.Address,
adminAddress gethcommon.Address,
) (bool, error) {
isAdmin, err := r.permissionController.IsAdmin(&bind.CallOpts{Context: ctx}, accountAddress, adminAddress)
if err != nil {
return isAdmin, errors.New("call to permission controller failed: " + err.Error())
}
return isAdmin, nil
}

0 comments on commit fdae593

Please sign in to comment.