Skip to content

Commit

Permalink
feat: rename oval camel case (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Maldonado <[email protected]>
  • Loading branch information
md0x authored Dec 19, 2023
1 parent d090d64 commit 6375242
Show file tree
Hide file tree
Showing 30 changed files with 321 additions and 321 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<div align="center">
<br />
<br />
<h1>OVAL</h1>
<h1>Oval</h1>
<br />
<h3> OVAL enables the redirection and capture of Oracle Extractable Value. </h3>
<h3> Oval enables the redirection and capture of Oracle Extractable Value. </h3>
<br />
</div>

OVAL is designed as an enhancement over the standard oracles like Chainlink, wrapping around them to introduce a novel functionality: the unlocking of price updates. This unique feature allows OVAL-enabled projects to capture _Oracle Extractable Value_(OEV), a form of value generated from oracle updates within a project. By disrupting the traditional MEV (Miner Extractable Value) supply chain, OVAL opens up new revenue streams for projects. For instance, in a money market scenario, the protocol could earn revenue each time liquidations occur within its system. This is achieved by controlling the timing and accessibility of oracle updates, thus allowing the projects to strategically position themselves to benefit from the resulting market movements. This approach sets OVAL apart, leveraging the reliability and familiarity of Chainlink's data while introducing a strategic layer for maximizing the value extracted from oracle updates.
Oval is designed as an enhancement over the standard oracles like Chainlink, wrapping around them to introduce a novel functionality: the unlocking of price updates. This unique feature allows Oval-enabled projects to capture _Oracle Extractable Value_(OEV), a form of value generated from oracle updates within a project. By disrupting the traditional MEV (Miner Extractable Value) supply chain, Oval opens up new revenue streams for projects. For instance, in a money market scenario, the protocol could earn revenue each time liquidations occur within its system. This is achieved by controlling the timing and accessibility of oracle updates, thus allowing the projects to strategically position themselves to benefit from the resulting market movements. This approach sets Oval apart, leveraging the reliability and familiarity of Chainlink's data while introducing a strategic layer for maximizing the value extracted from oracle updates.

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

# Repo contents

This repository contains the main smart contracts for the OVAL Oracle. 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
4 changes: 2 additions & 2 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OVAL scripts
# Oval scripts

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

## Installation

Expand Down
2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oval-contract-scripts",
"version": "1.0.0",
"description": "OVAL simulation scripts",
"description": "Oval simulation scripts",
"main": "dist/index.js",
"repository": "[email protected]:UMAprotocol/oval-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 TestedOVAL manually since it is not unique.
import { TestedOVAL__factory } from "../../contract-types/factories/AaveV2.Liquidation.sol/TestedOVAL__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 OVALAaveV2Borrow = async (): Promise<number> => {
const OvalAaveV2Borrow = async (): Promise<number> => {
// Create and share new fork (delete the old one if it exists).
const alias = "OVAL 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 OVALAaveV2Borrow = async (): Promise<number> => {
const ownerSigner = provider.getSigner(ownerAddress);
const forkTimestamp = (await provider.getBlock(blockNumber)).timestamp;

// Deploy OVAL.
const testedOVALFactory = new TestedOVAL__factory(ownerSigner);
const testedOVAL = await testedOVALFactory.deploy(
// Deploy Oval.
const testedOvalFactory = new TestedOval__factory(ownerSigner);
const testedOval = await testedOvalFactory.deploy(
"0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46",
18
);
await testedOVAL.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 OVAL");
await setForkSimulationDescription(fork.id, fork.headId, "Deploy Oval");

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

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

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

// Unlock latest value.
const unlockLatestValueInput =
testedOVALFactory.interface.encodeFunctionData("unlockLatestValue");
testedOvalFactory.interface.encodeFunctionData("unlockLatestValue");
simulation = await simulateTenderlyTx({
chainId,
from: unlockerAddress,
to: testedOVAL.address,
to: testedOval.address,
input: unlockLatestValueInput,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: simulation.id },
description: "Unlock latest value on OVAL",
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 OVALAaveV2BorrowGas = await OVALAaveV2Borrow();
const gasDiff = OVALAaveV2BorrowGas - 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 TestedOVAL manually since it is not unique.
import { TestedOVAL__factory } from "../../contract-types/factories/AaveV2.Liquidation.sol/TestedOVAL__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 OVALAaveV2Liquidation = async (): Promise<number> => {
const OvalAaveV2Liquidation = async (): Promise<number> => {
// Create and share new fork (delete the old one if it exists).
const alias = "OVAL 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 OVALAaveV2Liquidation = async (): Promise<number> => {
const ownerSigner = provider.getSigner(ownerAddress);
const forkTimestamp = (await provider.getBlock(blockNumber)).timestamp;

// Deploy OVAL.
const testedOVALFactory = new TestedOVAL__factory(ownerSigner);
const testedOVAL = await testedOVALFactory.deploy(
// Deploy Oval.
const testedOvalFactory = new TestedOval__factory(ownerSigner);
const testedOval = await testedOvalFactory.deploy(
"0x8e0b7e6062272B5eF4524250bFFF8e5Bd3497757",
18
);
await testedOVAL.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 OVAL");
await setForkSimulationDescription(fork.id, fork.headId, "Deploy Oval");

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

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

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

// Unlock latest value.
const unlockLatestValueInput =
testedOVALFactory.interface.encodeFunctionData("unlockLatestValue");
testedOvalFactory.interface.encodeFunctionData("unlockLatestValue");
simulation = await simulateTenderlyTx({
chainId,
from: unlockerAddress,
to: testedOVAL.address,
to: testedOval.address,
input: unlockLatestValueInput,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: simulation.id },
description: "Unlock latest value on OVAL",
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 OVALAaveV2LiquidationGas = await OVALAaveV2Liquidation();
const gasDiff = OVALAaveV2LiquidationGas - 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 TestedOVAL manually since it is not unique.
import { TestedOVAL__factory } from "../../contract-types/factories/AaveV3.Liquidation.sol/TestedOVAL__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 OVALAaveV3Borrow = async (): Promise<number> => {
const OvalAaveV3Borrow = async (): Promise<number> => {
// Create and share new fork (delete the old one if it exists).
const alias = "OVAL 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 OVALAaveV3Borrow = async (): Promise<number> => {
const ownerSigner = provider.getSigner(ownerAddress);
const forkTimestamp = (await provider.getBlock(blockNumber)).timestamp;

// Deploy OVAL.
const testedOVALFactory = new TestedOVAL__factory(ownerSigner);
const testedOVAL = await testedOVALFactory.deploy(
// Deploy Oval.
const testedOvalFactory = new TestedOval__factory(ownerSigner);
const testedOval = await testedOvalFactory.deploy(
"0x3E7d1eAB13ad0104d2750B8863b489D65364e32D",
8
);
await testedOVAL.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 OVAL");
await setForkSimulationDescription(fork.id, fork.headId, "Deploy Oval");

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

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

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

// Unlock latest value.
const unlockLatestValueInput =
testedOVALFactory.interface.encodeFunctionData("unlockLatestValue");
testedOvalFactory.interface.encodeFunctionData("unlockLatestValue");
simulation = await simulateTenderlyTx({
chainId,
from: unlockerAddress,
to: testedOVAL.address,
to: testedOval.address,
input: unlockLatestValueInput,
timestampOverride: forkTimestamp,
fork: { id: fork.id, root: simulation.id },
description: "Unlock latest value on OVAL",
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 OVALAaveV3BorrowGas = await OVALAaveV3Borrow();
const gasDiff = OVALAaveV3BorrowGas - regularAaveV3BorrowGas;
const OvalAaveV3BorrowGas = await OvalAaveV3Borrow();
const gasDiff = OvalAaveV3BorrowGas - regularAaveV3BorrowGas;

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

0 comments on commit 6375242

Please sign in to comment.