evm: add foundry

This commit is contained in:
Evan Gray 2022-10-04 10:45:33 -04:00
parent 602c793cd2
commit bed5efbb89
3 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,18 @@
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;
import "../contracts/FastTransfer.sol";
import "forge-std/Test.sol";
contract TestFastTransfer is FastTransfer, Test {
function testWrapAndTransferETH() public {
// Goerli Testnet
wormhole = IWormhole(0x706abc4E45D419950511e474C7B9Ed348A4a716c);
portal = ITokenBridge(0xF890982f9310df57d00f659cf4fd87e65adEd8d7);
// TODO: test
}
}

18
evm/foundry Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# This script is a wrapper around the foundry Docker image.
# In an ideal world, we could just use anvil (and forge) directly, but there are regular
# upstream breaking changes in the nightly builds, and binaries of older
# versions are deleted frequently from their GitHub. The Docker releases are
# available for longer, so we just use those here.
#
# the DOCKER_ARGS environment variable can be used to pass additional args to docker.
set -eo pipefail
# This is a known-to-be-working build.
DOCKER_IMAGE="ghcr.io/foundry-rs/foundry:nightly-0d4468765c264d00ac961275fe176ce003d3e4ca@sha256:88fe2ea1005b9a3a7f8068645fef4cfb0fa7c16a5dd3b35582c70a1e36d16c25"
args=$(printf '"%s" ' "$@")
docker run --rm --platform=linux/amd64 -i $DOCKER_ARGS $DOCKER_IMAGE "$args"

View File

@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "npm run generate && tsc && jest --config jestconfig.json --verbose",
"test": "DOCKER_ARGS=\"-v $(pwd):/app\" ./foundry sh -c \"cd app && forge test\"",
"genTypes": "typechain --target ethers-v5 --out-dir ethers-contracts/abi --show-stack-traces ./build/contracts/*.json",
"generate": "rimraf lib && rimraf ethers-contracts && rimraf build && truffle compile && npm run genTypes",
"build": "truffle compile",