> For the complete documentation index, see [llms.txt](https://docs.taco.build/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.taco.build/for-developers/conditions/contractcondition/use-custom-contract-calls.md).

# Use custom contract calls

In this section we show how to use implement support for custom contract calls in `ContractCondition`.

Let's start with the following example:

```typescript
import { conditions } from '@nucypher/taco';

const myFunctionAbi: conditions.base.contract.FunctionAbiProps =  {
  name: 'myFunction',
  type: 'function',
  stateMutability: 'view',
  inputs: [
    {
      internalType: 'address',
      name: 'account',
      type: 'address',
    },
    {
      internalType: 'uint256',
      name: 'myCustomParam',
      type: 'uint256',
    },
  ],
  outputs: [
    {
      internalType: 'uint256',
      name: 'someValue',
      type: 'uint256',
    },
  ],
};

const myContractCallCondition = new conditions.base.contract.ContractCondition({
  method: 'myFunction', // `myMethodAbi.name`
  parameters: [':userAddress', ':myCustomParam'], // `myMethodAbi.inputs`
  functionAbi: myFunctionAbi, // Our custom function ABI
  contractAddress: '0x0...1',
  chain: 5,
  returnValueTest: {
    comparator: '>',
    value: 0,
  },
});
```

First, let's take a look at `myFunctionAbi`:

* We define a complete function ABI with `name`, `type`, `stateMutability`, `inputs`, and `outputs`
* With those fields in place, our function shapes up to be defined as `myFunction(address, uint256): uint256`
* Note that `type` field required to be `function` and `stateMutability` to `pure` and `view` to avoid accidentally mutating the contract state

Now, looking at `myContractCallCondition` we can see that:

* We need to pass `myFunction` as `method` and `myFunctionAbi` as `functionAbi` for our contract call to be recognized correctly
* We've mapped our function parameters to `parameters`, so that `address` is represented as `':userAddress'` and `uint256` is represented as `':myCustomParam'`. See [Condition Context and Context Variables](/for-developers/authentication/conditioncontext-and-context-variables.md) for more details.
* Lastly, the `myFunctionAbi.outputs` will be used by `returnValueTest` to compare with the selected threshold `value`, resulting in a test `myFunctionAbi.outputs[0] > 0`

### Learn more

* See how to implement revocation using custom contract calls [here](/for-developers/conditions/contractcondition/implementing-revocation-via-smart-contract.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.taco.build/for-developers/conditions/contractcondition/use-custom-contract-calls.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
