#!/bin/bash

# remove dbg files
find ./artifacts -type f -name "*.dbg.json" -delete

# remove build-info
rm -rf ./artifacts/build-info

# move json files up one directory (out of .sol directories)
find ./artifacts -type f -name '*.json' -exec sh -c 'mv -i "$1" "${1%/*}/.."' sh {} \;

# delete empty .sol repositories that are left
find ./artifacts -type d -empty -delete

# copy all json into abi
cp -rf ./artifacts/contracts/* ./abi/
