Skip to content

Commit

Permalink
abi.ContractInspector to return number of inspected methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksej-paschenko committed Jun 12, 2024
1 parent 7fc1502 commit 9ad0621
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions abi/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type ContractDescription struct {
// Interfaces is a list of interfaces implemented by a contract.
ContractInterfaces []ContractInterface
GetMethods []MethodInvocation
MethodsInspected int
}

func (d ContractDescription) hasAllResults(results []string) bool {
Expand Down Expand Up @@ -139,6 +140,7 @@ func (ci contractInspector) InspectContract(ctx context.Context, code []byte, ex
if contract, ok := knownContracts[info.hash]; ok { //for known contracts we just need to run get methods
desc.ContractInterfaces = contract.contractInterfaces
for _, method := range contract.getMethods {
desc.MethodsInspected += 1
typeHint, result, err := method(ctx, executor, reqAccountID)
if err != nil {
return &desc, nil
Expand All @@ -156,6 +158,7 @@ func (ci contractInspector) InspectContract(ctx context.Context, code []byte, ex
if !ci.scanAllMethods && !info.isMethodOkToTry(method.Name) {
continue
}
desc.MethodsInspected += 1
typeHint, result, err := method.InvokeFn(ctx, executor, reqAccountID)
if err != nil {
continue
Expand Down

0 comments on commit 9ad0621

Please sign in to comment.