Skip to content

Commit

Permalink
Submit selectors to openchain
Browse files Browse the repository at this point in the history
  • Loading branch information
lykhonis committed Aug 31, 2023
1 parent 378dfaf commit ba08a3b
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
src = "src"
out = "out"
libs = ["lib"]
extra_output_files = ["metadata"]

# solidity compiler
solc = "0.8.17"
Expand Down
101 changes: 101 additions & 0 deletions tools/submit_selectors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/bin/bash

set -e

PROJECT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." &>/dev/null && pwd)

help() {
echo ""
echo "Usage: $0 -t NETWORK"
echo -e "\t-t --target: Target network to deploy to"
echo -e "\t-h --help: Prints this message"
exit 1
}

while [ -n "$1" ]; do
case "$1" in
-h | --help)
help
;;
-t | --target)
[[ ! "$2" =~ ^- ]] && TARGET=$2
shift 2
;;
--)
# remaining options are captured as "$*"
shift
break
;;
*)
echo -e "Unknown option: $1"
help
;;
esac
done

if [ -z "${TARGET}" ]; then
help
fi

case "${TARGET}" in
local | testnet | mainnet) ;;
*)
echo -e "Unknown target: ${TARGET}"
help
;;
esac

set -a
source "${PROJECT_DIR}/.env"
source "${PROJECT_DIR}/.env.${TARGET}"
set +a

SRC_DIR=${PROJECT_DIR}/src

submit() {
path=$(dirname $1)
name=$(basename $1)

echo "Submitting selectors of ${name}"
# forge inspect ${name} methodIdentifiers

# abi=$(forge inspect "${SRC_DIR}/${path}/${name}.sol:${name}" abi)
# content="{ \"contract_abi\": ${abi} }"

# https://openchain.xyz
forge selectors upload ${name}

# https://www.4byte.directory
# curl \
# --header "Content-Type: application/json" \
# --request POST \
# --data "${content}" \
# "https://www.4byte.directory/api/v1/import-solidity/"
}

submit "assets/lsp7/GenesisDigitalAsset"

submit "assets/lsp7/DigitalAssetDrop"

submit "assets/lsp7/MintableDigitalAsset"

submit "assets/lsp8/MintableIdentifiableDigitalAsset"

submit "assets/lsp8/CollectorIdentifiableDigitalAsset"

submit "drops/LSP7DropsDigitalAsset"

submit "drops/LSP8DropsDigitalAsset"

submit "marketplace/Participant"

submit "marketplace/lsp7/LSP7Listings"
submit "marketplace/lsp7/LSP7Offers"
submit "marketplace/lsp7/LSP7Marketplace"

submit "marketplace/lsp8/LSP8Listings"
submit "marketplace/lsp8/LSP8Offers"
submit "marketplace/lsp8/LSP8Auctions"
submit "marketplace/lsp8/LSP8Marketplace"

submit "page/PageName"

0 comments on commit ba08a3b

Please sign in to comment.