-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from h20liquidity/2024-04-09-test-suite
reorganize dirs
- Loading branch information
Showing
6 changed files
with
159 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// SPDX-License-Identifier: CAL | ||
pragma solidity =0.8.19; | ||
import "src/StrategyTests.sol"; | ||
|
||
/// @title DeployedStrategyTest | ||
/// @notice The contract inherits StrategyTests.sol. | ||
/// DISP and OrderBook contracts need to be intiliazed as part of the setup for | ||
/// running the tests available in StrategyTests.sol. | ||
/// This is how the inheriting repo that has the test suite as a dependency is expected | ||
/// to initialize the suite for a particular fork. | ||
contract DeployedStrategyTest is StrategyTests { | ||
|
||
// Inheriting contract defines the fork block number. | ||
uint256 constant FORK_BLOCK_NUMBER = 196561436; | ||
|
||
// Inheriting contract defines fork selection. | ||
function selectFork() internal { | ||
uint256 fork = vm.createFork(vm.envString("RPC_URL_ARBITRUM")); | ||
vm.selectFork(fork); | ||
vm.rollFork(FORK_BLOCK_NUMBER); | ||
} | ||
|
||
// Inheriting contract initializes the contracts on the fork. | ||
function setUp() public { | ||
selectFork(); | ||
PARSER = IParserV1(0x22410e2a46261a1B1e3899a072f303022801C764); | ||
ORDERBOOK = IOrderBookV3(0x90CAF23eA7E507BB722647B0674e50D8d6468234); | ||
ARB_INSTANCE = IOrderBookV3ArbOrderTaker(0xf382cbF44901cD26D14B247F4EA7260ee8041157); | ||
EXPRESSION_DEPLOYER = IExpressionDeployerV3(0x2AeE87D75CD000583DAEC7A28db103B1c0c18b76); | ||
ROUTE_PROCESSOR = IRouteProcessor(address(0x09bD2A33c47746fF03b86BCe4E885D03C74a8E8C)); | ||
EXTERNAL_EOA = address(0x654FEf5Fb8A1C91ad47Ba192F7AA81dd3C821427); | ||
APPROVED_EOA = address(0x669845c29D9B1A64FFF66a55aA13EB4adB889a88); | ||
ORDER_OWNER = address(0x19f95a84aa1C48A2c6a7B2d5de164331c86D030C); | ||
} | ||
|
||
// Inheriting contract tests OrderBook strategy with test suite. | ||
function testDeployedStrategy() public { | ||
|
||
// Input vaults | ||
IO[] memory inputVaults = new IO[](1); | ||
IO memory inputVault = IO(address(0x6d3AbB80c3CBAe0f60ba274F36137298D8571Fbe), 18, 1); | ||
inputVaults[0] = inputVault; | ||
|
||
// Output vaults | ||
IO[] memory outputVaults = new IO[](1); | ||
IO memory outputVault = IO(address(0x667f41fF7D9c06D2dd18511b32041fC6570Dc468), 18, 1); | ||
outputVaults[0] = outputVault; | ||
|
||
// Expected calculations context | ||
uint256 expectedRatio = 2e18; | ||
uint256 expectedAmountOutputMax = 1e18; | ||
|
||
// Init params for the strategy | ||
LibStrategyDeployment.StrategyDeployment memory strategy = LibStrategyDeployment.StrategyDeployment( | ||
"", | ||
"", | ||
0, | ||
0, | ||
0, | ||
0, | ||
expectedRatio, | ||
expectedAmountOutputMax, | ||
"test/strategies/arbitrum-order.rain", | ||
"arbitrum-order-simulations", | ||
"./lib/rain.orderbook", | ||
"./lib/rain.orderbook/Cargo.toml", | ||
inputVaults, | ||
outputVaults | ||
); | ||
|
||
// Assert strategy calculations | ||
checkStrategyCalculations(strategy); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
networks: | ||
arbitrum-one: | ||
rpc: https://arbitrum.llamarpc.com | ||
chain-id: 42161 | ||
network-id: 42161 | ||
currency: ETH | ||
|
||
subgraphs: | ||
arbitrum-one: https://api.thegraph.com/subgraphs/name/h20liquidity/arbitrum-0x90caf23e | ||
|
||
orderbooks: | ||
arbitrum-one: | ||
address: 0x90CAF23eA7E507BB722647B0674e50D8d6468234 | ||
network: arbitrum-one | ||
subgraph: arbitrum-one | ||
|
||
deployers: | ||
arbitrum-one: | ||
address: 0x2AeE87D75CD000583DAEC7A28db103B1c0c18b76 | ||
network: arbitrum-one | ||
|
||
tokens: | ||
arbitrum-one-red: | ||
network: arbitrum-one | ||
address: 0x6d3AbB80c3CBAe0f60ba274F36137298D8571Fbe | ||
arbitrum-one-blue: | ||
network: arbitrum-one | ||
address: 0x667f41fF7D9c06D2dd18511b32041fC6570Dc468 | ||
|
||
|
||
orders: | ||
arbitrum-order: | ||
inputs: | ||
- token: arbitrum-one-red | ||
vault-id: 0xeede83a4244afae4fef82c8f5b97df1f18bfe3193e65ba02052e37f6171b334b | ||
outputs: | ||
- token: arbitrum-one-blue | ||
vault-id: 0xeede83a4244afae4fef82c8f5b97df1f18bfe3193e65ba02052e37f6171b334b | ||
|
||
scenarios: | ||
arbitrum-order-simulations: | ||
network: arbitrum-one | ||
deployer: arbitrum-one | ||
orderbook: arbitrum-one | ||
runs: 100 | ||
bindings: | ||
max-output: 1e18 | ||
io-ratio: 2e18 | ||
|
||
charts: | ||
arbitrum-simulation: | ||
scenario: arbitrum-order-simulations | ||
plots: | ||
$ amount vs ratio: | ||
marks: | ||
- type: line | ||
options: | ||
x: 0.0 | ||
y: 0.1 | ||
|
||
deployments: | ||
buy-order: | ||
scenario: arbitrum-order-simulations | ||
order: arbitrum-order | ||
|
||
--- | ||
#max-output !OrderBook max output | ||
#io-ratio !OrderBook order ratio | ||
#calculate-io | ||
_ _: max-output io-ratio; | ||
|
||
#handle-io | ||
:; |