Merge branch 'ah/build-script'
This commit is contained in:
@@ -12,3 +12,8 @@ line_length = 80
|
||||
|
||||
[etherscan]
|
||||
mainnet = { key = "${ETHERSCAN_MAINNET_KEY}" }
|
||||
|
||||
|
||||
[[profile.default.fs_permissions]]
|
||||
access = "read-write"
|
||||
path = "out"
|
||||
|
||||
16
evm/scripts/_buildRuntime.s.sol
Normal file
16
evm/scripts/_buildRuntime.s.sol
Normal file
@@ -0,0 +1,16 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import "forge-std/Script.sol";
|
||||
|
||||
contract buildRuntime is Script {
|
||||
function run() external {
|
||||
bytes memory args = vm.envBytes("__PROPELLER_DEPLOY_ARGS");
|
||||
string memory contractRef = vm.envString("__PROPELLER_CONTRACT");
|
||||
string memory outFilePath = vm.envString("__PROPELLER_OUT_FILE");
|
||||
address deployedContract = deployCode(contractRef, args);
|
||||
|
||||
bytes memory deployedCode = deployedContract.code;
|
||||
vm.writeFileBinary(outFilePath, deployedCode);
|
||||
}
|
||||
}
|
||||
43
evm/scripts/buildRuntime.sh
Executable file
43
evm/scripts/buildRuntime.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Initialize our own variables
|
||||
CONTRACT_NAME=""
|
||||
CONSTRUCTOR_SIGNATURE=""
|
||||
CONSTRUCTOR_ARGUMENTS=""
|
||||
|
||||
# Function to display usage
|
||||
usage() {
|
||||
echo "Usage: $0 -c contract_name [-s constructor_signature -a constructor_arguments]" 1>&2; exit 1;
|
||||
}
|
||||
|
||||
while getopts ":c:s:a:" opt; do
|
||||
case "${opt}" in
|
||||
c)
|
||||
CONTRACT_NAME=${OPTARG};;
|
||||
s)
|
||||
CONSTRUCTOR_SIGNATURE=${OPTARG};;
|
||||
a)
|
||||
CONSTRUCTOR_ARGUMENTS=${OPTARG};;
|
||||
*)
|
||||
usage;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
echo "CONTRACT_NAME: $CONTRACT_NAME"
|
||||
echo "CONSTRUCTOR_SIGNATURE: $CONSTRUCTOR_SIGNATURE"
|
||||
echo "CONSTRUCTOR_ARGUMENTS: $CONSTRUCTOR_ARGUMENTS"
|
||||
|
||||
# Perform operations if CONSTRUCTOR_SIGNATURE and CONSTRUCTOR_ARGUMENTS are set
|
||||
if [[ ! -z "$CONSTRUCTOR_SIGNATURE" && ! -z "$CONSTRUCTOR_ARGUMENTS" ]]; then
|
||||
# Do some operations here
|
||||
export __PROPELLER_DEPLOY_ARGS=$(cast abi-encode $CONSTRUCTOR_SIGNATURE $CONSTRUCTOR_ARGUMENTS)
|
||||
fi
|
||||
|
||||
export __PROPELLER_CONTRACT="$CONTRACT_NAME.sol:$CONTRACT_NAME"
|
||||
export __PROPELLER_OUT_FILE="out/$CONTRACT_NAME.sol/$CONTRACT_NAME.evm.runtime"
|
||||
|
||||
forge script scripts/_buildRuntime.s.sol -v
|
||||
|
||||
echo "Write: $__PROPELLER_OUT_FILE"
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
pragma solidity ^0.8.13;
|
||||
|
||||
import "interfaces/IPairFunctions.sol";
|
||||
|
||||
Reference in New Issue
Block a user