-
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.
* add rate bot service * fix rate_daddy command for alpine * create env var for the amount of time to wait before changing the rate * Modify profiles and address source * Add artifacts volume * Fix volumes * Change service name * remove dynamic-rate from --all until published * Add rate bot to test_images * Add rate bot to docker publish workflow --------- Co-authored-by: Ryan Goree <[email protected]>
- Loading branch information
Showing
8 changed files
with
64 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: "3.9" | ||
services: | ||
rate-bot: | ||
image: ${RATE_BOT_IMAGE} | ||
profiles: | ||
- "dynamic-rate" | ||
volumes: | ||
- artifacts:/artifacts/ | ||
|
||
volumes: | ||
artifacts: |
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,15 @@ | ||
FROM ghcr.io/foundry-rs/foundry:master | ||
WORKDIR /src | ||
|
||
COPY ./rate_daddy.sh ./rate_daddy.sh | ||
|
||
ENV ETH_FROM=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
ENV PRIVATE_KEY=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 | ||
ENV RPC_URL=http://ethereum:8545 | ||
ENV WAIT_TIME=1800 | ||
RUN apk add --no-cache jq curl bc sed | ||
RUN chmod +x ./rate_daddy.sh | ||
|
||
#ENTRYPOINT ["watch", "-n", "${WAIT_TIME}", "./rate_daddy.sh"] | ||
ENTRYPOINT watch -n ${WAIT_TIME} ./rate_daddy.sh | ||
|
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,4 @@ | ||
# must be ended with a new line "LF" (Unix) and not "CRLF" (Windows) | ||
*/30 * * * * rate_daddy.sh >> /var/log/cron.log 2>&1 | ||
# An empty line is required at the end of this file for a valid cron file. | ||
|
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,10 @@ | ||
#!/bin/sh | ||
|
||
# Get the base token address from /artifact/addresses.json | ||
CONTRACT_ADDRESS=$(jq -r '.mockHyperdrive' /artifacts/addresses.json) | ||
|
||
sleep 3 | ||
VAULT_ADDRESS=$(cast call ${CONTRACT_ADDRESS} "pool()(address)" --rpc-url ${RPC_URL}) | ||
NEW_RATE=$(echo "scale=16; 3+$(od -t u2 -An -N2 /dev/random)/(2 ^ 16)"| bc |sed 's/\.//g') | ||
cast send --from ${ETH_FROM} --private-key ${PRIVATE_KEY} $VAULT_ADDRESS "setRate(uint256)" $NEW_RATE --rpc-url ${RPC_URL} | ||
|
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