Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions docs/docs/events-and-callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_position: 9
description: Learn how reactive contracts process events and trigger cross-chain callback transactions.
slug: /events-&-callbacks
hide_title: true
unlisted: true
---

![Events and Callbacks Image](./img/events-and-callbacks.jpg)
Expand Down Expand Up @@ -41,15 +42,25 @@ Since `react()` is always called by the system contract, contracts should use th

## Callbacks to Destination Chains

Reactive contracts initiate transactions on destination chains by calling `requestCallback()` or `requestCallbackV_1_0()` on the system contract:
:::info[Callback Authorization]
Reactive Network replaces the first 160 bits of the callback payload with the address of the reactive contract that initiated the callback. The first callback argument is therefore always an `address`, regardless of how it is named in Solidity. On the destination side, contracts extending `AbstractCallback` can use the `onlyCallbackSender` modifier to verify this address matches the expected reactive contract.
:::

Reactive contracts initiate transactions on destination chains by calling methods on the system contract, rather than emitting raw events directly. The system contract handles event emission and validation under the hood, giving developers a more intuitive interface.

Two methods are available today:

```solidity
function requestCallback(CallbackVersion version_, bytes memory config_) external;

function requestCallbackV_1_0(CallbackConfiguration_V_1_0 memory config_) external;
```

When either method is called during `react()` execution, Reactive Network submits a transaction to the specified destination chain.
`requestCallbackV_1_0()` is a typed convenience wrapper, meaning you pass a configuration struct directly with no manual ABI encoding or version flag. This is what most developers should reach for.

`requestCallback()` is the generic entry point. You specify a `CallbackVersion` and pass ABI-encoded configuration matching that version. As new callback types are introduced, each will get its own version and a corresponding typed convenience method like `V_1_0`.

Both methods produce the same `CallbackRequest` event. When either is called during `react()` execution, Reactive Network submits a transaction to the specified destination chain.

The `V_1_0` callback configuration uses the following struct:

Expand All @@ -64,15 +75,9 @@ struct CallbackConfiguration_V_1_0 {

Where:

* `chainId` -- destination network
* `recipient` -- target contract on the destination chain
* `gasLimit` -- execution gas limit
* `payload` -- ABI-encoded function call

The `requestCallbackV_1_0()` method is a typed convenience wrapper that avoids manual ABI encoding. Both methods produce the same result.

:::info[Callback Authorization]
Reactive Network replaces the first 160 bits of the callback payload with the address of the reactive contract that initiated the callback. The first callback argument is therefore always an `address`, regardless of how it is named in Solidity. On the destination side, contracts extending `AbstractCallback` can use the `onlyCallbackSender` modifier to verify this address matches the expected reactive contract.
:::
* `chainId` -> destination network
* `recipient` -> target contract on the destination chain
* `gasLimit` -> execution gas limit
* `payload` -> ABI-encoded function call

[More on callback payment →](./economy#callback-payment)
[//]: # ([More on callback payment →](./economy#callback-payment))
1 change: 1 addition & 0 deletions docs/docs/hyperlane.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_position: 3
description: Learn how to use Hyperlane Mailboxes as alternative transport for cross-chain callbacks in Reactive Contracts.
slug: /hyperlane
hide_title: true
unlisted: true
---

import MailboxAddressTable from "../../src/components/hyperlane-mailbox-table";
Expand Down
Binary file added docs/docs/img/payment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/img/trigger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: Getting Started
description: Explore Reactive Network, an EVM automation layer with CometBFT consensus and instant finality. Build reactive contracts, event-driven smart contracts for cross-chain, on-chain automation.
slug: /
hide_title: true
unlisted: true
---

![Reactive Docs Image](./img/reactive-docs.jpg)
Expand Down
7 changes: 7 additions & 0 deletions docs/docs/reactive-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_position: 4
description: Learn about reactive contracts, event-driven smart contracts for cross-chain, on-chain automation that subscribe to event logs and trigger callback transactions.
slug: /reactive-contracts
hide_title: true
unlisted: true
---

![Reactive Contracts Image](img/reactive-contracts.jpg)
Expand All @@ -16,6 +17,12 @@ Reactive contracts are event-driven smart contracts for cross-chain, on-chain au

Reactive contracts are deployed to Reactive Network like any standard smart contract. Once deployed, the system contract delivers event logs to the contract's `react()` function and processes callback requests.

## System Contract Interaction

![Payment System](img/payment.png)

![Reactive Tx Lifecycle](img/trigger.png)

## Verifying Reactive Contracts

Contracts can be verified during or after deployment using the Sourcify endpoint. Sourcify is a decentralized verification service that matches deployed bytecode with source code, making contracts auditable and transparent.
Expand Down
1 change: 1 addition & 0 deletions docs/docs/reactive-lib.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_position: 8
description: Reference for Reactive library, abstract contracts and interfaces for building reactive contracts.
slug: /reactive-library
hide_title: true
unlisted: true
---

import CronTable from "../../src/components/cron-table";
Expand Down
1 change: 1 addition & 0 deletions docs/docs/reactive-mainnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_position: 7
description: RPC endpoints, chain IDs, and faucet instructions for Reactive Mainnet and Lasna Testnet.
slug: /reactive-mainnet
hide_title: true
unlisted: true
---

[//]: # (import MainnetButton from "../../src/components/mainnet-button";)
Expand Down
1 change: 1 addition & 0 deletions docs/docs/rnk-rpc-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_position: 11
description: Learn about Reactive Network's custom JSON-RPC methods for querying filters, subscriptions, and block sequences.
slug: /rnk-rpc-methods
hide_title: true
unlisted: true
---

![RNK RPC Methods](./img/rnk-rpc-methods.jpg)
Expand Down
1 change: 1 addition & 0 deletions docs/docs/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_position: 10
description: Learn how reactive contracts subscribe to events and configure event-driven automation.
slug: /subscriptions
hide_title: true
unlisted: true
---

![Subscriptions Image](./img/subscriptions.jpg)
Expand Down
8 changes: 8 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,17 @@ const config = {
autoCollapseCategories: true,
},
},
zoom: {
selector: '.markdown :not(em) > img',
background: {
light: 'rgb(255, 255, 255)',
dark: 'rgb(50, 50, 50)',
},
},
}),

plugins: [
'docusaurus-plugin-image-zoom',
[
"@docusaurus/plugin-client-redirects",
{
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@docusaurus/theme-mermaid": "^3.5.2",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"docusaurus-plugin-image-zoom": "^3.0.1",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down
Loading
Loading