#!/bin/bash
rootdir=$(pwd)
configdir=$(pwd)/deployer

deploymentdir=$rootdir/packages/contracts-bedrock/deployments

cp $configdir/config.json $deploymentdir/

source $rootdir/.envrc

cd packages/contracts-bedrock && \
DEPLOYMENT_OUTFILE=$deploymentdir/artifact.json \
DEPLOY_CONFIG_PATH=$deploymentdir/config.json  \
  forge script scripts/deploy/Deploy.s.sol:Deploy \
    --broadcast --private-key $PRIVATE_KEY \
    --rpc-url $L1_RPC_URL

cp $deploymentdir/artifact.json $configdir/
cd $rootdir
