Skip to content

Commit

Permalink
update lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth2207 committed Aug 2, 2024
1 parent 6a171b8 commit cdae951
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/StrategyTests.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract StrategyTests is OrderBookStrategyTest {
// Function to add OrderBook order and deposit tokens.
// Input and Output tokens are extracted from `inputVaults` and `outputVaults`,
// indexed by `inputTokenIndex` and `outputTokenIndex`.
function addOrderDepositOutputTokens(LibStrategyDeployment.StrategyDeployment memory strategy)
function addOrderDepositOutputTokens(LibStrategyDeployment.StrategyDeploymentV3 memory strategy)
internal
returns (OrderV3 memory order)
{
Expand Down Expand Up @@ -41,13 +41,13 @@ contract StrategyTests is OrderBookStrategyTest {
vm, strategy.strategyFile, strategy.strategyScenario, strategy.buildPath, strategy.manifestPath
)
);
order = placeOrder(ORDER_OWNER, bytecode, strategy.inputVaults, strategy.outputVaults, new ActionV1[](0));
order = placeOrder(ORDER_OWNER, bytecode, strategy.inputVaults, strategy.outputVaults, strategy.postActions);
}
}

// Function to assert OrderBook calculations context by calling 'takeOrders' function
// directly from the OrderBook contract.
function checkStrategyCalculations(LibStrategyDeployment.StrategyDeployment memory strategy) internal {
function checkStrategyCalculations(LibStrategyDeployment.StrategyDeploymentV3 memory strategy) internal {
OrderV3 memory order = addOrderDepositOutputTokens(strategy);
{
vm.recordLogs();
Expand All @@ -65,7 +65,7 @@ contract StrategyTests is OrderBookStrategyTest {

// Function to assert OrderBook calculations context by calling 'arb' function
// from the OrderBookV3ArbOrderTaker contract.
function checkStrategyCalculationsArbOrder(LibStrategyDeployment.StrategyDeployment memory strategy) internal {
function checkStrategyCalculationsArbOrder(LibStrategyDeployment.StrategyDeploymentV3 memory strategy) internal {
OrderV3 memory order = addOrderDepositOutputTokens(strategy);

// Move external pool price in opposite direction that of the order
Expand All @@ -92,7 +92,7 @@ contract StrategyTests is OrderBookStrategyTest {
}

function evalExpression(
LibStrategyDeployment.StrategyDeployment memory strategy,
LibStrategyDeployment.StrategyDeploymentV3 memory strategy,
FullyQualifiedNamespace namespace,
uint256[][] memory context,
uint256[] memory inputs,
Expand Down
4 changes: 3 additions & 1 deletion src/lib/LibStrategyDeployment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ pragma solidity =0.8.25;

import {Vm} from "forge-std/Vm.sol";
import {IO} from "rain.orderbook.interface/interface/IOrderBookV3.sol";
import {ActionV1} from "rain.orderbook.interface/interface/unstable/IOrderBookV4.sol";

library LibStrategyDeployment {
struct StrategyDeployment {
struct StrategyDeploymentV3 {
bytes makerRoute;
bytes takerRoute;
uint256 inputTokenIndex;
Expand All @@ -20,5 +21,6 @@ library LibStrategyDeployment {
string manifestPath;
IO[] inputVaults;
IO[] outputVaults;
ActionV1[] postActions;
}
}
10 changes: 6 additions & 4 deletions test/DeployedStrategyTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract DeployedStrategyTest is StrategyTests {
uint256 expectedAmountOutputMax = 1e18;

// Init params for the strategy
LibStrategyDeployment.StrategyDeployment memory strategy = LibStrategyDeployment.StrategyDeployment(
LibStrategyDeployment.StrategyDeploymentV3 memory strategy = LibStrategyDeployment.StrategyDeploymentV3(
"",
"",
0,
Expand All @@ -74,7 +74,8 @@ contract DeployedStrategyTest is StrategyTests {
"./lib/rain.orderbook",
"./lib/rain.orderbook/Cargo.toml",
inputVaults,
outputVaults
outputVaults,
new ActionV1[](0)
);

// Assert strategy calculations by executing order by directly calling 'takeOrder' function
Expand All @@ -99,7 +100,7 @@ contract DeployedStrategyTest is StrategyTests {
uint256 expectedAmountOutputMax = 1e18;

// Init params for the strategy
LibStrategyDeployment.StrategyDeployment memory strategy = LibStrategyDeployment.StrategyDeployment(
LibStrategyDeployment.StrategyDeploymentV3 memory strategy = LibStrategyDeployment.StrategyDeploymentV3(
getEncodedBlueToRedRoute(),
getEncodedRedToBlueRoute(),
0,
Expand All @@ -113,7 +114,8 @@ contract DeployedStrategyTest is StrategyTests {
"./lib/rain.orderbook",
"./lib/rain.orderbook/Cargo.toml",
inputVaults,
outputVaults
outputVaults,
new ActionV1[](0)
);

// Assert strategy calculations by executing order by calling 'arb' function
Expand Down

0 comments on commit cdae951

Please sign in to comment.