# User Configurations

Several tips for our bridge builders are given here!

## Consumer

### Deployment parameters

```solidity
import "./base/BoolConsumerBase.sol";

contract UserMock is BoolConsumerBase {
    ...
    constructor(address anchor_) BoolConsumerBase(anchor_) {}
    ...
}
```

Remember to **pass `anchor` to your contract constructor** to match the fundamental requirement of implementing `BoolConsumerBase.sol`.&#x20;

In addition, when updating `consumer` in a deployed Anchor, the Anchor contract will validate the consumer's configuration as follows:

```solidity
require(
    IBoolConsumerBase(consumer_).anchor() == address(this),
    "Anchor: ANCHOR_MISMATCH"
);
```

Hence, please **DO NOT misconfigure** your consumer contract!&#x20;

Alternatively, you can design an additional function in your consumer contract to update the address of the anchor. However, we do not recommend implementing this function in your contract since in terms of the users' trust, `anchor` should never be changed after the deployment.

### Send cross-chain messages to Anchor

Each consumer contract implemented `BoolConsumerBase.sol` should have inherited the following internal function `_sendToAnchor`. It is the intermediary to send cross-chain messages to the connected Anchor contract.

```solidity
function _sendToAnchor(
    address payable refundAddress,
    bytes32 crossType,
    bytes memory extraFeed,
    uint32 dstChainId,
    address dstAnchor,
    bytes memory payload
) internal virtual returns (bytes32 txUniqueIdentification)
```

A consumer contract must define an upper-level function to implement this core internal function and several tips are provided to implement `_sendToAnchor`:

* **pack** the data to be executed on the destination chain into `payload`, such as using `abi.encode` to pack the target function's parameters.
* pass the **correct** `dstAnchor` since cross-chain messages can only be transmitted to remote anchors within the same AMT bridge.
* request`extraFeed` from our primary contracts based on the value of`crossType`: either [`PURE_MESSAGE`](/evm-ecosystem/smart-contracts/on-chain-endpoint-anchor/anchor.sol.md#pure_message) or [`VALUE_MESSAGE`](/evm-ecosystem/smart-contracts/on-chain-endpoint-anchor/anchor.sol.md#value_message).

{% hint style="warning" %}

* Leave `extraFeed` **blank** if `PURE_MESSAGE` selected.
* `VALUE_MESSAGE` has not been enabled yet.
  {% endhint %}

### Receive a Message from Anchor

```solidity
modifier onlyAnchor() {
    require(msg.sender == anchor, "BoolConsumerBase: NOT_ANCHOR");
    _;
}

function receiveFromAnchor(
    bytes memory payload
) external virtual override {}
```

* A consumer contract **must override** `receiveFromAnchor` and define corresponding logic to parse `payload` sent from its corresponding Anchor.
* Two basic operations should be included in the override function: decode payload and forward decoded data to subsequent functions.
* One can use the provided modifier `onlyAnchor` to restrict the accessibility of `receiveFromAnchor`.

## Anchor

### Transfer the ownership of the `Anchor` contract

* The default owner is the initial deployer of an Anchor. One can use [`owner`](/evm-ecosystem/smart-contracts/on-chain-endpoint-anchor/ianchor.sol.md#owner) to inquire about the address of the current owner.&#x20;
* The most important role played by the owner is to update the connected `consumer`.
* The interface for transferring the ownership of an anchor can be found at [`transferOwnership`](/evm-ecosystem/smart-contracts/on-chain-endpoint-anchor/ianchor.sol.md#transferownership).


---

# Agent Instructions: 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:

```
GET https://docs.bool.network/evm-ecosystem/user-configurations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
