Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' of github.com:rainlanguage/rain.dex.pubstrats int…
Browse files Browse the repository at this point in the history
…o 2024-08-26-combined
  • Loading branch information
thedavidmeister committed Sep 6, 2024
2 parents 05f9bae + 4ad5079 commit 2b4a4e0
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 17 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ jobs:
RPC_URL_FLARE: ${{ secrets.CI_DEPLOY_FLARE_RPC_URL || vars.CI_DEPLOY_FLARE_RPC_URL }}

steps:
- run: |
echo "MANIFEST_PATH=./lib/h20.test-std/lib/rain.orderbook/Cargo.toml" >> $GITHUB_ENV
echo "SETTINGS_PATH=src/settings.yml" >> $GITHUB_ENV
echo "DOTRAIN_FOLDER_PATH=./src/tranche" >> $GITHUB_ENV
echo "DOTRAIN_EXCLUDE_PATHS='src/learning/ethcc/* src/wip/*'" >> $GITHUB_ENV
echo "COMMIT_SHA=$(cd ./lib/h20.test-std/lib/rain.orderbook && git rev-parse HEAD)" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: recursive
Expand Down Expand Up @@ -50,4 +57,6 @@ jobs:
- run: ./prep-tauri.sh
working-directory: lib/h20.test-std/lib/rain.orderbook

- run: nix develop -c rainix-sol-test
- run: nix develop -c rainix-sol-test

- run: nix run .#check-deployer-words
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 71 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,83 @@
description = "Flake for development workflows.";

inputs = {
rainix.url = "github:rainprotocol/rainix";
flake-utils.url = "github:numtide/flake-utils";
rainix.url = "github:rainprotocol/rainix";
};

outputs = {self, flake-utils, rainix }:
outputs = {self, rainix, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = rainix.pkgs.${system};
in {
packages = rainix.packages.${system};
devShells = rainix.devShells.${system};
in rec {
packages = rec{
network-list = rainix.network-list.${system};
networks = pkgs.lib.concatStringsSep " " network-list;

check-deployer-words = rainix.mkTask.${system} {
name = "check-deployer-words";
body = ''
set -euxo pipefail
# The path to the rain files.
dotrain_folder_path=''${DOTRAIN_FOLDER_PATH:-.}
# Get all the rain files in the sub folders.
dotrain_paths=""
for folder in "$dotrain_folder_path"/*; do
if [ -d "$folder" ]; then
dotrain=$(find "$folder" -type f -name "*.rain" -print)
dotrain_paths+=" $dotrain"
fi
done
# Get all the rain files in the current folder.
for dotrain in "$dotrain_folder_path"/*.rain ; do
dotrain_paths+=" $dotrain"
done
# Remove leading and trailing whitespace.
dotrain_paths=$(echo "$dotrain_paths" | tr -s ' ' | sed 's/^ //;s/ $//')
# Exclude paths.
exclude_paths=''${DOTRAIN_EXCLUDE_PATHS:-}
# Remove the excluded paths.
for exclude_path in $exclude_paths; do
dotrain_paths=$(echo "$dotrain_paths" | tr ' ' '\n' | grep -v "$exclude_path" | tr '\n' ' ')
done
for dotrain in $dotrain_paths
do
echo "Checking deployments within $dotrain"
deployment_keys=$( \
cargo run --manifest-path ''${MANIFEST_PATH} --package rain_orderbook_cli \
order keys \
-f $dotrain ''${SETTINGS_PATH:+-c "''${SETTINGS_PATH}"} \
)
for key in $deployment_keys
do
echo "key: $key"
cargo run --manifest-path ''${MANIFEST_PATH} \
--package rain_orderbook_cli \
words -f $dotrain ''${SETTINGS_PATH:+-c "''${SETTINGS_PATH}"} --deployment "$key" --stdout
done
done
'';
};
} // rainix.packages.${system};

devShells.default = pkgs.mkShell {
packages = [
packages.check-deployer-words
];

shellHook = rainix.devShells.${system}.default.shellHook;
buildInputs = rainix.devShells.${system}.default.buildInputs;
nativeBuildInputs = rainix.devShells.${system}.default.nativeBuildInputs;
};

}
);

Expand Down
37 changes: 34 additions & 3 deletions src/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,48 @@ networks:
rpc: https://rpc.ankr.com/flare
chain-id: 14
currency: FLR
base:
rpc: https://mainnet.base.org
chain-id: 8453
network-id: 8453
currency: ETH
sepolia:
rpc: https://1rpc.io/sepolia
chain-id: 11155111
network-id: 11155111
currency: ETH

subgraphs:
flare: http://replaceme.com

base: http://replaceme.com
sepolia: http://replaceme.com

metaboards:
flare: https://api.goldsky.com/api/public/project_clv14x04y9kzi01saerx7bxpg/subgraphs/mb-flare-0x893BBFB7/0.1/gn
base: https://api.goldsky.com/api/public/project_clv14x04y9kzi01saerx7bxpg/subgraphs/mb-base-0x59401C93/0.1/gn
sepolia: https://api.goldsky.com/api/public/project_clv14x04y9kzi01saerx7bxpg/subgraphs/mb-sepolia-0x77991674/0.1/gn

orderbooks:
flare:
address: 0xaa3b14Af0e29E3854E4148f43321C4410db002bC
network: flare
subgraph: flare
base:
address: 0x80DE00e3cA96AE0569426A1bb1Ae22CD4181dE6F
network: base
subgraph: base
sepolia:
address: 0x0bB72B4C7c0d47b2CaED07c804D9243C1B8a0728
network: sepolia
subgraph: sepolia

deployers:
flare:
address: 0xEBe394cff4980992B826Ec70ef0a9ec8b5D4C640
network: flare
address: 0x3214CdB105a73f8356583eCd85264cCfA8417694
network: flare
base:
address: 0xC1A14cE2fd58A3A2f99deCb8eDd866204eE07f8D
network: base
sepolia:
address: 0x7692BA8446Bb8B3140A2c02df073080BeD0a7F8E
network: sepolia
2 changes: 1 addition & 1 deletion src/tranche/tranche-space-symmetric.rain
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,4 @@ deployments:
:;

#get-cost-basis-io-ratio-test
_ _ _: 1 1 1;
_ _ _: 1 1 1;
6 changes: 3 additions & 3 deletions src/tranche/tranche-space.rain
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ scenarios:
# the input/output token and some external price. Typically this is
# not the case as the io-ratio is defined in terms of the input/output
# token and the io-ratio-multiplier is set to the identity function.
uniswap-words: 0xAFF83Dd453f9EE510d6F623d09322A68E8ee29A3
# uniswap-words: 0xAFF83Dd453f9EE510d6F623d09322A68E8ee29A3

# Uniswap v3 factory contract address and corresponding init code hash.
# If the factory address and the init code aren't available as a literals
Expand Down Expand Up @@ -495,7 +495,7 @@ deployments:
multiplier: 1;

#calculate-io
using-words-from uniswap-words orderbook-subparser
using-words-from orderbook-subparser
tranche-space-now
tranche-space-available
tranche-total-size: call<'calculate-tranche>(),
Expand Down Expand Up @@ -526,5 +526,5 @@ deployments:
),
:call<'set-last-tranche>(tranche-space-after-snapped current-time);

#post-add-order
#handle-add-order
:;
2 changes: 1 addition & 1 deletion test/TrancheSpaceTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract TrancheSpaceTest is StrategyTests {
using Strings for address;
using Strings for uint256;

uint256 constant FORK_BLOCK_NUMBER = 28712894;
uint256 constant FORK_BLOCK_NUMBER = 28982497;

function selectFlareFork() internal {
uint256 fork = vm.createFork(vm.envString("RPC_URL_FLARE"));
Expand Down

0 comments on commit 2b4a4e0

Please sign in to comment.