Skip to content

Commit

Permalink
feat: rename oev share to oval (#96)
Browse files Browse the repository at this point in the history
* feat: rename oev share to oval

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* feat: ovaling

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* feat: format

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* fix: names

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* refactor: format

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* fix: test

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* feat: try fix

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* feat: try fix

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* feat: test change

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* revert changes

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* fix: ci

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* feat: format

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

* feat: remove logo

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>

---------

Signed-off-by: Pablo Maldonado <pablo@umaproject.org>
  • Loading branch information
md0x committed Dec 6, 2023
1 parent 9404cf7 commit bd6b77b
Show file tree
Hide file tree
Showing 42 changed files with 511 additions and 515 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<div align="center">
<br />
<br />
<a href="x"><img alt="OevShare" src="./logo.jpg" width=600></a>
<h1>OVAL</h1>
<br />
<h3> OEVShare enables the redirection and capture of Oracle Extractable Value. </h3>
<h3> OVAL enables the redirection and capture of Oracle Extractable Value. </h3>
<br />
</div>

OEVShare enabled projects to do two main things:
OVAL enabled projects to do two main things:

1. capture MEV created as a result of oracle updates in their project, known as _Oracle Extractable Value_(OEV). This works by disrupting the MEV supply chain. For example a money market could get paid every time there are liquidations within their protocol.
2. aggregate multiple source oracles to provide increased security and fault tolerance. For example the [BoundedUnionAdapter]() returns the newest of Chainlink, Chronicle and Pyth, contingient on the value being within a tollerance percentage of at least one of the other feeds.

For more information on how OEVShare works and how to integrate with it see [oev.docs.uma.xyz]().
For more information on how OVAL works and how to integrate with it see [oev.docs.uma.xyz]().

# Repo contents

This repository contains the main smart contracts for the OEVOracle. It uses [foundry](https://github.com/foundry-rs/foundry).
This repository contains the main smart contracts for the OVAL Oracle. It uses [foundry](https://github.com/foundry-rs/foundry).

### Building Contracts

Expand Down
Binary file removed logo.jpg
Binary file not shown.
4 changes: 2 additions & 2 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OEVShare scripts
# OVAL scripts

This package contains scripts for gas profiling of OEVShare.
This package contains scripts for gas profiling of OVAL.

## Installation

Expand Down
4 changes: 2 additions & 2 deletions scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oev-contract-scripts",
"name": "oval-contract-scripts",
"version": "1.0.0",
"description": "OEVShare simulation scripts",
"description": "OVAL simulation scripts",
"main": "dist/index.js",
"repository": "git@github.com:UMAprotocol/oev-contracts.git",
"author": "UMA team",
Expand Down
42 changes: 21 additions & 21 deletions scripts/src/gasProfiling/aaveV2Borrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
TenderlySimulationResult,
simulateTenderlyTx,
} from "../TenderlyHelpers/TenderlySimulation";
// Have to import TestedOevShare manually since it is not unique.
import { TestedOevShare__factory } from "../../contract-types/factories/AaveV2.Liquidation.sol/TestedOevShare__factory";
// Have to import TestedOVAL manually since it is not unique.
import { TestedOVAL__factory } from "../../contract-types/factories/AaveV2.Liquidation.sol/TestedOVAL__factory";

// Common constants.
const blockNumber = 18426914;
Expand Down Expand Up @@ -75,9 +75,9 @@ const regularAaveV2Borrow = async (): Promise<number> => {
return simulation.gasUsed;
};

const oevShareAaveV2Borrow = async (): Promise<number> => {
const OVALAaveV2Borrow = async (): Promise<number> => {
// Create and share new fork (delete the old one if it exists).
const alias = "OEVShare AAVE V2 Borrow";
const alias = "OVAL AAVE V2 Borrow";
const description =
"Genereated: " + utils.keccak256(utils.toUtf8Bytes(alias));
const existingFork = await findForkByDescription(description);
Expand All @@ -98,37 +98,37 @@ const oevShareAaveV2Borrow = async (): Promise<number> => {
const ownerSigner = provider.getSigner(ownerAddress);
const forkTimestamp = (await provider.getBlock(blockNumber)).timestamp;

// Deploy OevShare.
const testedOevShareFactory = new TestedOevShare__factory(ownerSigner);
const testedOevShare = await testedOevShareFactory.deploy(
// Deploy OVAL.
const testedOVALFactory = new TestedOVAL__factory(ownerSigner);
const testedOVAL = await testedOVALFactory.deploy(
"0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46",
18
);
await testedOevShare.deployTransaction.wait();
await testedOVAL.deployTransaction.wait();
fork = await getTenderlyFork(fork.id); // Refresh to get head id since we submitted tx through RPC.
if (!fork.headId) throw new Error("Fork head id not found.");
await setForkSimulationDescription(fork.id, fork.headId, "Deploy OevShare");
await setForkSimulationDescription(fork.id, fork.headId, "Deploy OVAL");

// Enable unlocker on TestedOevShare.
const setUnlockerInput = testedOevShareFactory.interface.encodeFunctionData(
// Enable unlocker on TestedOVAL.
const setUnlockerInput = testedOVALFactory.interface.encodeFunctionData(
"setUnlocker",
[unlockerAddress, true]
);
let simulation = await simulateTenderlyTx({
chainId,
from: ownerAddress,
to: testedOevShare.address,
to: testedOVAL.address,
input: setUnlockerInput,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: fork.headId },
description: "Enable unlocker on OEVShare",
description: "Enable unlocker on OVAL",
});

// setOevShareAsAaveSource
// setOVALAsAaveSource
const aaveOracleInterface = new utils.Interface(aaveOracleAbi);
const aaveOracleCallData = aaveOracleInterface.encodeFunctionData(
"setAssetSources",
[["0xdac17f958d2ee523a2206206994597c13d831ec7"], [testedOevShare.address]]
[["0xdac17f958d2ee523a2206206994597c13d831ec7"], [testedOVAL.address]]
);

simulation = await simulateTenderlyTx({
Expand All @@ -138,20 +138,20 @@ const oevShareAaveV2Borrow = async (): Promise<number> => {
input: aaveOracleCallData,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: simulation.id },
description: "Change OEVShare as Aave source",
description: "Change OVAL as Aave source",
});

// Unlock latest value.
const unlockLatestValueInput =
testedOevShareFactory.interface.encodeFunctionData("unlockLatestValue");
testedOVALFactory.interface.encodeFunctionData("unlockLatestValue");
simulation = await simulateTenderlyTx({
chainId,
from: unlockerAddress,
to: testedOevShare.address,
to: testedOVAL.address,
input: unlockLatestValueInput,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: simulation.id },
description: "Unlock latest value on OEVShare",
description: "Unlock latest value on OVAL",
});

// Open user position.
Expand All @@ -168,8 +168,8 @@ export const aaveV2Borrow = async () => {
console.log("AAVE V2 Borrow gas comparison with unlock:\n");

const regularAaveV2BorrowGas = await regularAaveV2Borrow();
const oevShareAaveV2BorrowGas = await oevShareAaveV2Borrow();
const gasDiff = oevShareAaveV2BorrowGas - regularAaveV2BorrowGas;
const OVALAaveV2BorrowGas = await OVALAaveV2Borrow();
const gasDiff = OVALAaveV2BorrowGas - regularAaveV2BorrowGas;

console.log("Gas difference: " + gasDiff);
};
42 changes: 21 additions & 21 deletions scripts/src/gasProfiling/aaveV2Liquidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
TenderlySimulationResult,
} from "../TenderlyHelpers/TenderlySimulation";
import { UniswapAnchoredViewDestinationAdapter__factory } from "../../contract-types";
// Have to import TestedOevShare manually since it is not unique.
import { TestedOevShare__factory } from "../../contract-types/factories/AaveV2.Liquidation.sol/TestedOevShare__factory";
// Have to import TestedOVAL manually since it is not unique.
import { TestedOVAL__factory } from "../../contract-types/factories/AaveV2.Liquidation.sol/TestedOVAL__factory";

// Common constants.
const blockNumber = 17937311;
Expand Down Expand Up @@ -91,9 +91,9 @@ const regularAaveV2Liquidation = async (): Promise<number> => {
return simulation.gasUsed;
};

const oevShareAaveV2Liquidation = async (): Promise<number> => {
const OVALAaveV2Liquidation = async (): Promise<number> => {
// Create and share new fork (delete the old one if it exists).
const alias = "OEVShare AAVE V2 Liquidation";
const alias = "OVAL AAVE V2 Liquidation";
const description =
"Genereated: " + utils.keccak256(utils.toUtf8Bytes(alias));
const existingFork = await findForkByDescription(description);
Expand All @@ -114,37 +114,37 @@ const oevShareAaveV2Liquidation = async (): Promise<number> => {
const ownerSigner = provider.getSigner(ownerAddress);
const forkTimestamp = (await provider.getBlock(blockNumber)).timestamp;

// Deploy OevShare.
const testedOevShareFactory = new TestedOevShare__factory(ownerSigner);
const testedOevShare = await testedOevShareFactory.deploy(
// Deploy OVAL.
const testedOVALFactory = new TestedOVAL__factory(ownerSigner);
const testedOVAL = await testedOVALFactory.deploy(
"0x8e0b7e6062272B5eF4524250bFFF8e5Bd3497757",
18
);
await testedOevShare.deployTransaction.wait();
await testedOVAL.deployTransaction.wait();
fork = await getTenderlyFork(fork.id); // Refresh to get head id since we submitted tx through RPC.
if (!fork.headId) throw new Error("Fork head id not found.");
await setForkSimulationDescription(fork.id, fork.headId, "Deploy OevShare");
await setForkSimulationDescription(fork.id, fork.headId, "Deploy OVAL");

// Enable unlocker on TestedOevShare.
const setUnlockerInput = testedOevShareFactory.interface.encodeFunctionData(
// Enable unlocker on TestedOVAL.
const setUnlockerInput = testedOVALFactory.interface.encodeFunctionData(
"setUnlocker",
[unlockerAddress, true]
);
let simulation = await simulateTenderlyTx({
chainId,
from: ownerAddress,
to: testedOevShare.address,
to: testedOVAL.address,
input: setUnlockerInput,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: fork.headId },
description: "Enable unlocker on OEVShare",
description: "Enable unlocker on OVAL",
});

// setOevShareAsAaveSource
// setOVALAsAaveSource
const aaveOracleInterface = new utils.Interface(aaveOracleAbi);
const aaveOracleCallData = aaveOracleInterface.encodeFunctionData(
"setAssetSources",
[["0x57Ab1ec28D129707052df4dF418D58a2D46d5f51"], [testedOevShare.address]]
[["0x57Ab1ec28D129707052df4dF418D58a2D46d5f51"], [testedOVAL.address]]
);

simulation = await simulateTenderlyTx({
Expand All @@ -154,20 +154,20 @@ const oevShareAaveV2Liquidation = async (): Promise<number> => {
input: aaveOracleCallData,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: simulation.id },
description: "Change OEVShare as Aave source",
description: "Change OVAL as Aave source",
});

// Unlock latest value.
const unlockLatestValueInput =
testedOevShareFactory.interface.encodeFunctionData("unlockLatestValue");
testedOVALFactory.interface.encodeFunctionData("unlockLatestValue");
simulation = await simulateTenderlyTx({
chainId,
from: unlockerAddress,
to: testedOevShare.address,
to: testedOVAL.address,
input: unlockLatestValueInput,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: simulation.id },
description: "Unlock latest value on OEVShare",
description: "Unlock latest value on OVAL",
});

// Open user position.
Expand All @@ -184,8 +184,8 @@ export const aaveV2Liquidation = async () => {
console.log("AAVE V2 Liquidation gas comparison with unlock:\n");

const regularAaveV2LiquidationGas = await regularAaveV2Liquidation();
const oevShareAaveV2LiquidationGas = await oevShareAaveV2Liquidation();
const gasDiff = oevShareAaveV2LiquidationGas - regularAaveV2LiquidationGas;
const OVALAaveV2LiquidationGas = await OVALAaveV2Liquidation();
const gasDiff = OVALAaveV2LiquidationGas - regularAaveV2LiquidationGas;

console.log("Gas difference: " + gasDiff);
};
42 changes: 21 additions & 21 deletions scripts/src/gasProfiling/aaveV3Borrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
TenderlySimulationResult,
simulateTenderlyTx,
} from "../TenderlyHelpers/TenderlySimulation";
// Have to import TestedOevShare manually since it is not unique.
import { TestedOevShare__factory } from "../../contract-types/factories/AaveV3.Liquidation.sol/TestedOevShare__factory";
// Have to import TestedOVAL manually since it is not unique.
import { TestedOVAL__factory } from "../../contract-types/factories/AaveV3.Liquidation.sol/TestedOVAL__factory";

// Common constants.
const blockNumber = 18427678;
Expand Down Expand Up @@ -74,9 +74,9 @@ const regularAaveV3Borrow = async (): Promise<number> => {
return simulation.gasUsed;
};

const oevShareAaveV3Borrow = async (): Promise<number> => {
const OVALAaveV3Borrow = async (): Promise<number> => {
// Create and share new fork (delete the old one if it exists).
const alias = "OEVShare AAVE V3 Borrow";
const alias = "OVAL AAVE V3 Borrow";
const description =
"Genereated: " + utils.keccak256(utils.toUtf8Bytes(alias));
const existingFork = await findForkByDescription(description);
Expand All @@ -97,37 +97,37 @@ const oevShareAaveV3Borrow = async (): Promise<number> => {
const ownerSigner = provider.getSigner(ownerAddress);
const forkTimestamp = (await provider.getBlock(blockNumber)).timestamp;

// Deploy OevShare.
const testedOevShareFactory = new TestedOevShare__factory(ownerSigner);
const testedOevShare = await testedOevShareFactory.deploy(
// Deploy OVAL.
const testedOVALFactory = new TestedOVAL__factory(ownerSigner);
const testedOVAL = await testedOVALFactory.deploy(
"0x3E7d1eAB13ad0104d2750B8863b489D65364e32D",
8
);
await testedOevShare.deployTransaction.wait();
await testedOVAL.deployTransaction.wait();
fork = await getTenderlyFork(fork.id); // Refresh to get head id since we submitted tx through RPC.
if (!fork.headId) throw new Error("Fork head id not found.");
await setForkSimulationDescription(fork.id, fork.headId, "Deploy OevShare");
await setForkSimulationDescription(fork.id, fork.headId, "Deploy OVAL");

// Enable unlocker on TestedOevShare.
const setUnlockerInput = testedOevShareFactory.interface.encodeFunctionData(
// Enable unlocker on TestedOVAL.
const setUnlockerInput = testedOVALFactory.interface.encodeFunctionData(
"setUnlocker",
[unlockerAddress, true]
);
let simulation = await simulateTenderlyTx({
chainId,
from: ownerAddress,
to: testedOevShare.address,
to: testedOVAL.address,
input: setUnlockerInput,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: fork.headId },
description: "Enable unlocker on OEVShare",
description: "Enable unlocker on OVAL",
});

// setOevShareAsAaveSource
// setOVALAsAaveSource
const aaveOracleInterface = new utils.Interface(aaveOracleAbi);
const aaveOracleCallData = aaveOracleInterface.encodeFunctionData(
"setAssetSources",
[["0xdac17f958d2ee523a2206206994597c13d831ec7"], [testedOevShare.address]]
[["0xdac17f958d2ee523a2206206994597c13d831ec7"], [testedOVAL.address]]
);

simulation = await simulateTenderlyTx({
Expand All @@ -137,20 +137,20 @@ const oevShareAaveV3Borrow = async (): Promise<number> => {
input: aaveOracleCallData,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: simulation.id },
description: "Change OEVShare as Aave source",
description: "Change OVAL as Aave source",
});

// Unlock latest value.
const unlockLatestValueInput =
testedOevShareFactory.interface.encodeFunctionData("unlockLatestValue");
testedOVALFactory.interface.encodeFunctionData("unlockLatestValue");
simulation = await simulateTenderlyTx({
chainId,
from: unlockerAddress,
to: testedOevShare.address,
to: testedOVAL.address,
input: unlockLatestValueInput,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: simulation.id },
description: "Unlock latest value on OEVShare",
description: "Unlock latest value on OVAL",
});

// Open user position.
Expand All @@ -167,8 +167,8 @@ export const aaveV3Borrow = async () => {
console.log("AAVE V3 Borrow gas comparison with unlock:\n");

const regularAaveV3BorrowGas = await regularAaveV3Borrow();
const oevShareAaveV3BorrowGas = await oevShareAaveV3Borrow();
const gasDiff = oevShareAaveV3BorrowGas - regularAaveV3BorrowGas;
const OVALAaveV3BorrowGas = await OVALAaveV3Borrow();
const gasDiff = OVALAaveV3BorrowGas - regularAaveV3BorrowGas;

console.log("Gas difference: " + gasDiff);
};
Loading

0 comments on commit bd6b77b

Please sign in to comment.