sepolia deployment

This commit is contained in:
tim
2025-10-23 13:53:48 -04:00
parent 380c77b37e
commit a1e73df30a
13 changed files with 524 additions and 55 deletions

2
bin/build Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
BUILD=1 bin/deploy "$1"

50
bin/deploy Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/bash
if [ "$1" = "dev" ]; then
DEV=1
shift
else
DEV=0
fi
CHAIN_ID=${1:-11155111} # Defaults to Sepolia
PROJECT=liquidity-party
REMOTE=git.dxod.org/dexorder/dexorder
if [ "$BUILD" != "1" ] && [ "$CHAIN_ID" = "31337" ]; then
echo bin/deploy must specify a production chain ID
exit 1
fi
if [ "$BUILD" != "1" ]; then
if [ "$DEV" = "1" ]; then
TAG="dev$(date +%Y%m%d%H%M%S)"
else
DIRTY="$( git status | grep "Changes " )"
if [ "$DIRTY" != "" ]; then
echo This project has uncommited changes: deployment aborted.
exit 1
fi
TAG="$( git log --oneline | head -1 | cut -d ' ' -f 1 )"
fi
echo Deploying $TAG
else
echo Building
fi
bin/generate-contracts "$CHAIN_ID" || exit 1
npm run build || exit 1
if [ "$BUILD" != "1" ]; then
echo Deploying with tag $TAG
docker build --no-cache -f deploy/Dockerfile -t dexorder/$PROJECT:latest . || exit 1
docker tag dexorder/$PROJECT:latest dexorder/$PROJECT:$TAG
docker tag dexorder/$PROJECT:$TAG $REMOTE/$PROJECT:$TAG
docker tag $REMOTE/$PROJECT:$TAG $REMOTE/$PROJECT:latest
docker push $REMOTE/$PROJECT:$TAG
YAML=$(sed "s#image: dexorder/$PROJECT*#image: $REMOTE/$PROJECT:$TAG#" deploy/liquidity-party.k8s.yaml)
echo "$YAML" | kubectl apply -f - || echo "$YAML" "\nkubectl apply failed" && exit 1
echo "$(date)" deployed $REMOTE/$PROJECT:$TAG
else
echo "$(date)" built
fi

View File

@@ -1,11 +0,0 @@
#!/bin/sh
generate() {
ABI=$(jq '.abi' ../lmsr-amm/out/$1.sol/$1.json)
# echo "import {useReadContract} from \"wagmi\";\n\nconst {data} = useReadContract({abi: ${ABI}});\n\nexport default data;" > ./src/contracts/$1.ts
echo "/* GENERATED FILE: DO NOT EDIT! */\n\nconst ${1}ABI = ${ABI} as const;\n\nexport default ${1}ABI;" > ./src/contracts/$1ABI.ts
}
generate IPartyPlanner
generate IPartyPool
generate IPartyPoolViewer

31
bin/generate-contracts Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
CHAIN_ID=${1:-31337}
if [ "$CHAIN_ID" = "31337" ]; then
ABI_PATH=../lmsr-amm/out
METADATA_PATH=../lmsr-amm/liqp-deployments.json
else
ABI_PATH=../lmsr-amm/deployment/$1/v1/out
METADATA_PATH=../lmsr-amm/deployment/liqp-deployments.json
fi
if [ ! -f "$ABI_PATH/IPartyPool.sol/IPartyPool.json" ]; then
echo "Invalid chain ID $CHAIN_ID"
exit 1
fi
echo Chain $CHAIN_ID
generate() {
ABI=$(jq '.abi' $ABI_PATH/$1.sol/$1.json)
echo "/* GENERATED FILE: DO NOT EDIT! */\n\nconst ${1}ABI = ${ABI} as const;\n\nexport default ${1}ABI;" > ./src/contracts/$1ABI.ts
echo "src/contracts/$1ABI.ts"
}
generate IPartyPlanner
generate IPartyPool
generate IPartyPoolViewer
cp "$METADATA_PATH" src/contracts/
echo liqp-deployments.json