started on orderlib

This commit is contained in:
Tim Olson
2023-09-18 17:39:05 -04:00
parent 44f17c14c1
commit 46501a7e6d
5 changed files with 140 additions and 6 deletions

19
bin/build.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
# this script requires the jq command $(sudo apt install jq)
# first-pass build
forge build
# calculate the Vault init code hash using the bytecode generated for Vault
# shellcheck disable=SC2046
VAULT_INIT_CODE_HASH=$(cast keccak $(jq -r .bytecode.object < out/Vault.sol/Vault.json))
# put the hash value into the VaultAddress.sol source file
sed -i "s/bytes32 internal constant VAULT_INIT_CODE_HASH = .*;/bytes32 internal constant VAULT_INIT_CODE_HASH = $VAULT_INIT_CODE_HASH;/" src/VaultAddress.sol
# generate a javascript file with the constant
mkdir gen &> /dev/null
echo "export const VAULT_INIT_CODE_HASH='$VAULT_INIT_CODE_HASH';" > gen/vaultHash.js
# final build after hash values are set
forge build