# OCY\_Convex\_A.sol

## Introduction

This contract allocates stablecoins to the alUSD/FRAXBP meta-pool and stakes the LP tokens on Convex.

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

#### State Variables

<table><thead><tr><th width="144.33333333333331">Type</th><th width="233">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>OCT_YDL</td><td>The OCT_YDL contract.</td></tr><tr><td>address</td><td>FRAX</td><td>Index 0, BasePool</td></tr><tr><td>address</td><td>USDC</td><td>Index 1, BasePool</td></tr><tr><td>address</td><td>alUSD</td><td>Index 0, MetaPool</td></tr><tr><td>address</td><td>CRV</td><td>Native Reward #1</td></tr><tr><td>address</td><td>CVX</td><td>Native Reward #2</td></tr><tr><td>address</td><td>convexDeposit</td><td>Convex information.</td></tr><tr><td>address</td><td>convexRewards</td><td>Convex information.</td></tr><tr><td>address</td><td>convexPoolToken</td><td>Convex information.</td></tr><tr><td>uint256</td><td>convexPoolID</td><td>Convex information.</td></tr><tr><td>address</td><td>curveBasePool</td><td>Curve information.</td></tr><tr><td>address</td><td>curveBasePoolToken</td><td>Index 1, MetaPool</td></tr><tr><td>address</td><td>curveMetaPool</td><td>MetaPool &#x26; Token</td></tr></tbody></table>

## **Sections**

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

* [#canpush](#canpush "mention") - Permission for owner to call `pushToLocker()`. See [zivoelocker.sol](https://docs.zivoe.com/developer-docs/core-contracts/zivoelocker.sol "mention")
* [#canpull](#canpull "mention") - Permission for owner to call `pullFromLocker()`. See [zivoelocker.sol](https://docs.zivoe.com/developer-docs/core-contracts/zivoelocker.sol "mention")
* [#canpullmulti](#canpullmulti "mention") - Permission for owner to call `pullFromLockerMulti()`. See [zivoelocker.sol](https://docs.zivoe.com/developer-docs/core-contracts/zivoelocker.sol "mention")
* [#canpullpartial](#canpullpartial "mention") - Permission for owner to call `pullFromLockerPartial()`. See [zivoelocker.sol](https://docs.zivoe.com/developer-docs/core-contracts/zivoelocker.sol "mention")

[#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()`.
* [#claimrewards](#claimrewards "mention") - Claims rewards and forward them to the OCT\_YDL.
* [#updateoctydl](#updateoctydl "mention") - Updates the OCT\_YDL endpoint.

[#events](#events "mention")

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

## Read Functions

#### `canPush()`

Permission for owner to call `pushToLocker()`. See [zivoelocker.sol](https://docs.zivoe.com/developer-docs/core-contracts/zivoelocker.sol "mention")

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

#### `canPull()`

Permission for owner to call `pullFromLocker()`. See [zivoelocker.sol](https://docs.zivoe.com/developer-docs/core-contracts/zivoelocker.sol "mention")

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

#### `canPullMulti()`

Permission for owner to call `pullFromLockerMulti()`. See [zivoelocker.sol](https://docs.zivoe.com/developer-docs/core-contracts/zivoelocker.sol "mention")

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

#### `canPullPartial()`

Permission for owner to call `pullFromLockerPartial()`. See [zivoelocker.sol](https://docs.zivoe.com/developer-docs/core-contracts/zivoelocker.sol "mention")

```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>

#### **`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>

#### **`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>

#### `claimRewards()`

Claims rewards and forward them to the OCT\_YDL.

```solidity
function claimRewards(bool extra) public nonReentrant;
```

<table><thead><tr><th width="171.33333333333331">Type</th><th width="184">Name</th><th>Description</th></tr></thead><tbody><tr><td>bool</td><td>extra</td><td>Flag for claiming extra rewards.</td></tr></tbody></table>

#### `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

## Events

#### **`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>
