Skip to content

Commit

Permalink
feat: mainnet updates (#39)
Browse files Browse the repository at this point in the history
* feat: update keeper

* feat: turn off health check

* fix: new role

* fix: categorize

* build: keeper

* feat: force registry

* fix: use base fee provider

* fix: downgrade oz
  • Loading branch information
Schlagonia committed Feb 23, 2024
1 parent b5f0610 commit 0668495
Show file tree
Hide file tree
Showing 12 changed files with 746 additions and 471 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Install node.js dependencies
run: yarn --frozen-lockfile
- name: Run linter on *.sol and *.json
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

cd tokenized-strategy-ape-mix

### Set up your virtual enviorment
### Set up your virtual environment

python3 -m venv venv

Expand All @@ -30,7 +30,7 @@

ape test

### Set your enviorment Variables
### Set your environment Variables

export WEB3_INFURA_PROJECT_ID=your_infura_api_key

Expand All @@ -43,11 +43,10 @@ Deployment of periphery contracts such as the [Registry Factory](https://github.
This can be done permissionlessly if the most recent contract has not yet been deployed on a chain you would like to use it on.

1. [Add an Ape account](https://docs.apeworx.io/ape/stable/commands/accounts.html)
2. Go to the contracts specific deployment script under `scripts/` and add your account name to the `accounts.load("you_acct_name")` at the top of the script.
3. Run the deployment script
2. Run the deployment the contracts specific deployment script under `scripts/`
```sh
ape run scripts/deploy_contract_name.py --network YOUR_RPC_URL
```
- For chains that don't support 1559 tx's you may need to add a `type="0x0"` argument at the end of the deployment tx.
- ie `tx = deployer_contract.deploy(bytecode, salt, sender=deployer, type="0x0")`
- ie `tx = deployer_contract.deployCreate2(salt, init_code, sender=deployer, type="0x0")`
3. The address the contract was deployed at will print in the console and should match any other chain the same version has been deployed on.
4 changes: 2 additions & 2 deletions ape-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ default_ecosystem: ethereum
dependencies:
- name: openzeppelin
github: OpenZeppelin/openzeppelin-contracts
ref: 4.8.2
ref: 4.7.3

- name: yearn-vaults
github: yearn/yearn-vaults-v3
Expand All @@ -41,7 +41,7 @@ dependencies:

solidity:
import_remapping:
- "@openzeppelin/contracts=openzeppelin/v4.8.2"
- "@openzeppelin/contracts=openzeppelin/v4.7.3"
- "@yearn-vaults=yearn-vaults/v3.0.1"
- "@tokenized-strategy=tokenized-strategy/v3.0.1"
- "@periphery=periphery/master"
Expand Down
60 changes: 60 additions & 0 deletions contracts/Keeper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.18;

interface IStrategy {
function report() external returns (uint256, uint256);

function tend() external;
}

interface IVault {
function process_report(address) external returns (uint256, uint256);
}

/**
* @title Keeper
* @notice
* To allow permissionless reporting on V3 vaults and strategies.
*
* This will do low level calls so that in can be used without reverting
* it the roles have not been set or the functions are not available.
*/
contract Keeper {
/**
* @notice Reports on a strategy.
*/
function report(address _strategy) external returns (uint256, uint256) {
// Call the target with the provided calldata.
(bool success, bytes memory result) = _strategy.call(
abi.encodeWithSelector(IStrategy.report.selector)
);

if (success) {
return abi.decode(result, (uint256, uint256));
}
}

/**
* @notice Tends a strategy.
*/
function tend(address _strategy) external {
_strategy.call(abi.encodeWithSelector(IStrategy.tend.selector));
}

/**
* @notice Report strategy profits on a vault.
*/
function process_report(
address _vault,
address _strategy
) external returns (uint256, uint256) {
// Call the target with the provided calldata.
(bool success, bytes memory result) = _vault.call(
abi.encodeCall(IVault.process_report, _strategy)
);

if (success) {
return abi.decode(result, (uint256, uint256));
}
}
}
Loading

0 comments on commit 0668495

Please sign in to comment.