> For the complete documentation index, see [llms.txt](https://docs.zivoe.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zivoe.com/developer-docs/lockers/ocy_ousd.sol.md).

# OCY\_OUSD.sol

## Introduction

This contract escrows OUSD and handles accounting for yield distributions.

{% embed url="<https://www.figma.com/board/qjuQ0uGQl9QD7KeBwyf73d/Zivoe-Visualization?node-id=207-558&t=xMaSm0a03jWFmwbH-4>" %}

#### State Variables

<table><thead><tr><th width="144.33333333333331">Type</th><th width="150">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>GBL</td><td>The ZivoeGlobals contract.</td></tr><tr><td>address</td><td>OUSD</td><td>Origin Dollar contract.</td></tr><tr><td>address</td><td>OCT_YDL</td><td>The OCT_YDL contract.</td></tr><tr><td>uint256</td><td>basis</td><td>The basis of OUSD for distribution accounting.</td></tr></tbody></table>

## **Sections**

[#read-functions](#read-functions "mention")

* [#canpush](#canpush "mention") - Permission for owner to call `pushToLocker()`. See [ZivoeLocker.sol](/developer-docs/core-contracts/zivoelocker.sol.md)
* [#canpull](#canpull "mention") - Permission for owner to call `pullFromLocker()`. See [ZivoeLocker.sol](/developer-docs/core-contracts/zivoelocker.sol.md)
* [#canpullpartial](#canpullpartial "mention") - Permission for owner to call `pullFromLockerPartial()`. See [ZivoeLocker.sol](/developer-docs/core-contracts/zivoelocker.sol.md)

[#write-functions](#write-functions "mention")

* [#pushtolocker](#pushtolocker "mention") - Migrates specific amount of ERC20 from owner() to locker.
* [#pullfromlocker](#pullfromlocker "mention") - Migrates entire ERC20 balance from locker to `owner()`.
* [#pullfromlockerpartial](#pullfromlockerpartial "mention") - Migrates specific amount of ERC20 from locker to `owner()`.
* [#rebase](#rebase "mention") - Ensures this locker has opted-in for the OUSD rebase.
* [#updateoctydl](#updateoctydl "mention") - Updates the OCT\_YDL endpoint.
* [#forwardyield](#forwardyield "mention") - Forwards excess basis to OCT\_YDL for conversion.

[#events](#events "mention")

* [#basisadjusted](#basisadjusted "mention")
* [#updatedoctydl](#updatedoctydl "mention")
* [#yieldforwarded](#yieldforwarded "mention")

## Read Functions

#### `canPush()`

Permission for owner to call `pushToLocker()`. See [ZivoeLocker.sol](/developer-docs/core-contracts/zivoelocker.sol.md)

```solidity
 function canPush() public override pure returns (bool) { return true; }
```

#### `canPull()`

Permission for owner to call `pullFromLocker()`. See [ZivoeLocker.sol](/developer-docs/core-contracts/zivoelocker.sol.md)

```solidity
function canPull() public override pure returns (bool) { return true; }
```

#### `canPullPartial()`

Permission for owner to call `pullFromLockerPartial()`. See [ZivoeLocker.sol](/developer-docs/core-contracts/zivoelocker.sol.md)

```solidity
function canPullPartial() public override pure returns (bool) { return true; }
```

## Write Functions

#### **`pushToLocker()`**

Migrates specific amount of ERC20 from owner() to locker.

```solidity
function pushToLocker(
    address asset, 
    uint256 amount, 
    bytes calldata data
) external override onlyOwner;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="160">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>asset</td><td>The asset to migrate.</td></tr><tr><td>uint256</td><td>amount</td><td>The amount of "asset" to migrate.</td></tr><tr><td>bytes</td><td>data</td><td>Accompanying transaction data.</td></tr></tbody></table>

Emits the [#basisadjusted](#basisadjusted "mention") event

#### **`pullFromLocker()`**

Migrates entire ERC20 balance from locker to `owner()`.

```solidity
function pullFromLocker(address asset, bytes calldata data) external;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="160">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>asset</td><td>The asset to migrate.</td></tr><tr><td>bytes</td><td>data</td><td>Accompanying transaction data.</td></tr></tbody></table>

Emits the [#basisadjusted](#basisadjusted "mention") event

#### **`pullFromLockerPartial()`**

Migrates specific amount of ERC20 from locker to `owner()`.

```solidity
function pullFromLockerPartial(
    address asset, 
    uint256 amount, 
    bytes calldata data
) external;

```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="160">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>asset</td><td>The asset to migrate.</td></tr><tr><td>uint256</td><td>amount</td><td>The amount of "asset" to migrate.</td></tr><tr><td>bytes</td><td>data</td><td>Accompanying transaction data.</td></tr></tbody></table>

Emits the [#basisadjusted](#basisadjusted "mention") event

#### `rebase()`

Ensures this locker has opted-in for the OUSD rebase.

```solidity
function rebase() public;
```

#### `updateOCTYDL()`

Updates the OCT\_YDL endpoint.

```solidity
function updateOCTYDL(address _OCT_YDL) external;
```

<table><thead><tr><th width="171.33333333333331">Type</th><th width="184">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td><code>_OCT_YDL</code></td><td>The new address for OCT_YDL.</td></tr></tbody></table>

Emits the [#updatedoctydl](#updatedoctydl "mention") event

#### `forwardYield()`

Forwards excess basis to OCT\_YDL for conversion.

```solidity
function forwardYield() public nonReentrant;
```

Emits the [#yieldforwarded](#yieldforwarded "mention") event

## Events

#### **`BasisAdjusted()`**

Emitted during [#pushtolocker](#pushtolocker "mention"), [#pullfromlocker](#pullfromlocker "mention"), and [#pullfromlockerpartial](#pullfromlockerpartial "mention")

```solidity
event BasisAdjusted(uint256 priorBasis, uint256 newBasis);
```

<table><thead><tr><th width="127.33333333333331">Type</th><th width="98">Indexed</th><th width="132">Name</th><th>Description</th></tr></thead><tbody><tr><td>uint256</td><td>False</td><td>priorBasis</td><td>The prior value of basis.</td></tr><tr><td>uint256</td><td>False</td><td>newBasis</td><td>The new value of basis.</td></tr></tbody></table>

#### **`UpdatedOCTYDL()`**

Emitted during [#updateoctydl](#updateoctydl "mention")

```solidity
event UpdatedOCTYDL(address indexed newOCT, address indexed oldOCT);
```

<table><thead><tr><th width="127.33333333333331">Type</th><th width="98">Indexed</th><th width="132">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>True</td><td>newOCT</td><td>The new OCT_YDL contract.</td></tr><tr><td>address</td><td>True</td><td>oldOCT</td><td>The old OCT_YDL contract.</td></tr></tbody></table>

#### **`YieldForwarded()`**

Emitted during [#forwardyield](#forwardyield "mention")

```solidity
event YieldForwarded(uint256 amount, uint256 newBasis);
```

<table><thead><tr><th width="127.33333333333331">Type</th><th width="98">Indexed</th><th width="132">Name</th><th>Description</th></tr></thead><tbody><tr><td>uint256</td><td>False</td><td>amount</td><td>The amount of OUSD forwarded.</td></tr><tr><td>uint256</td><td>False</td><td>newBasis</td><td>The new basis value.</td></tr></tbody></table>


---

# 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.zivoe.com/developer-docs/lockers/ocy_ousd.sol.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.
