---
title: Base trait
description: "Every contract and trait in Tact implicitly inherits the BaseTrait trait"
prev:
  link: /ref/evolution/otp-006
  label: "OTP-006: Contract Package"
---

Every [contract](/book/contracts) in Tact implicitly [inherits](/book/contracts#traits) the `BaseTrait{:tact}` trait, which contains a number of [internal functions](/book/contracts#internal-functions) for any contract and a constant `self.storageReserve{:tact}` aimed at advanced users of Tact.

:::tip

  Prior to 1.6.0, `BaseTrait{:tact}` was also implicitly inherited by traits, but now you must explicitly specify `with BaseTrait{:tact}` for your traits to use it.

:::

## Constants

### self.storageReserve {#self-storagereserve}

```tact
virtual const storageReserve: Int = 0;
```

Usage example:

```tact
contract AllYourStorageBelongsToUs {
    // This would change the behavior of the self.forward() function,
    // causing it to try reserving this amount of nanoToncoins before
    // forwarding a message with SendRemainingBalance mode
    override const storageReserve: Int = ton("0.1");
}
```

## Functions

### self.reply {#self-reply}

```tact
virtual fun reply(body: Cell?);
```

A similar but more gas-efficient version of calling the [`self.forward(){:tact}`](#self-forward) function with the following arguments:

```tact
self.forward(sender(), body, true, null);
//           ↑         ↑     ↑     ↑
//           |         |     |     init: StateInit?
//           |         |     bounce: Bool
//           |         body: Cell?
//           to: Address
```

Usage example:

```tact
// This message can bounce back to us!
self.reply("Beware, this is my reply to you!".asComment());
```

### self.notify {#self-notify}

```tact
virtual fun notify(body: Cell?);
```

A similar but more gas-efficient version of calling the [`self.forward(){:tact}`](#self-forward) function with the following arguments:

```tact
self.forward(sender(), body, false, null);
//           ↑         ↑     ↑      ↑
//           |         |     |      init: StateInit?
//           |         |     bounce: Bool
//           |         body: Cell?
//           to: Address
```

Usage example:

```tact
// This message won't bounce!
self.notify("Beware, this is my reply to you!".asComment());
```

### self.forward {#self-forward}

```tact
virtual fun forward(to: Address, body: Cell?, bounce: Bool, init: StateInit?);
```

[Queues the message](/book/send#outbound-message-processing) (bounceable or non-bounceable) to be sent to the specified address `to`. Optionally, you may provide a `body` for the message and the [`init` package](/book/expressions#initof).

When the [`self.storageReserve{:tact}`](#self-storagereserve) constant is overridden to be greater than 0, it also attempts to reserve the `self.storageReserve{:tact}` amount of [nanoToncoins][nano] from the remaining balance before sending the message in the [`SendRemainingBalance{:tact}`](/book/message-mode#base-modes) ($128$) mode.

In case the reservation attempt fails, or in the default case without the attempt, the message is sent with the [`SendRemainingValue{:tact}`](/book/message-mode#base-modes) ($64$) mode instead.

:::note

  Note that `self.forward(){:tact}` never sends additional [nanoToncoins][nano] on top of what's available in the balance.\
  To send more [nanoToncoins][nano] with a single message, use the [`send(){:tact}`](/ref/core-send#send) function.

:::

Usage example:

```tact
import "@stdlib/ownable";

message PayoutOk {
    address: Address;
    value: Int as coins;
}

contract Payout with Ownable {
    completed: Bool;
    owner: Address;

    init(owner: Address) {
        self.owner = owner;
        self.completed = false;
    }

    // ... some actions here ...

    // Bounced receiver function, which is called when the specified outgoing message bounces back
    bounced(msg: bounced<PayoutOk>) {
        // Reset completed flag if our message bounced
        self.completed = false;

        // Send a notification that the payout failed, using the remaining funds to process this send
        self.forward(self.owner, "Payout failed".asComment(), false, null);
    }
}
```

[nano]: /book/integers#nanotoncoin
