> For the complete documentation index, see [llms.txt](https://docs.wagent.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wagent.app/contracts/wagent-v1.md).

# Wagent V1

The Wagent contract is fully open-source, unupgradeable, and trustless, allowing anyone to use it with confidence. It acts as a proxy between the payer and the merchant, handling payments in a secure and decentralized manner. The contract offers two primary functions: `pay` and `pay_stream`.

Before interacting with the contract, ensure that the sender (or payment creator) has set sufficient **allowance** for the contract address. This allows the contract to transfer the necessary tokens to complete the payment.

**`pay`**&#x20;

The `pay` function facilitates direct, one-time payments and is structured as follows:

```rust
fn pay(
    e: Env,
    token_address: Address,
    sender: Address,
    receiver: Address,
    amount: i128,
    order_id: String,
);
```

**`pay_stream`**&#x20;

The `pay_stream` function supports streaming payments over a specified duration and is written as:

```rust
fn pay_stream(
    e: Env,
    token_address: Address,
    sender: Address,
    receiver: Address,
    amount: i128,
    order_id: String,
    duration: u64,
    minimum_cancellable_duration: u64,
) -> u64;
```

This function leverages the **Fluxity contract**, meaning that once called, the payer can monitor their active stream through the **Fluxity Dashboard** [here](https://dashboard.fluxity.finance).
