https://github.com/cairoeth/foundry-fe
A plug-and-play Foundry library for compiling, debugging, and working with Fe contracts in Solidity.
https://github.com/cairoeth/foundry-fe
Last synced: 10 months ago
JSON representation
A plug-and-play Foundry library for compiling, debugging, and working with Fe contracts in Solidity.
- Host: GitHub
- URL: https://github.com/cairoeth/foundry-fe
- Owner: cairoeth
- License: apache-2.0
- Created: 2023-11-15T11:28:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-18T07:53:33.000Z (over 2 years ago)
- Last Synced: 2025-06-06T09:04:05.272Z (about 1 year ago)
- Language: Solidity
- Homepage:
- Size: 81.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Foundry x Fe
[](https://opensource.org/licenses/Apache-2.0)
A [Foundry](https://github.com/foundry-rs/foundry) library for working with [Fe](https://github.com/ethereum/fe) contracts.
## Installing
First, install the [Fe compiler](https://fe-lang.org/docs/user-guide/installation.html) by running:
```
brew install fe-lang/tap/fe
```
Then, install this library with [forge](https://github.com/foundry-rs/foundry):
```
forge install cairoeth/foundry-fe
```
## Usage
The FeDeployer is a Solidity library that takes a filename and deploys the corresponding Fe contract, returning the address that the bytecode was deployed to. To use it, simply import it into your file by doing:
```js
import {FeDeployer} from "foundry-fe/src/FeDeployer.sol";
```
To compile contracts, you can use `FeDeployer.deploy(string fileName)`, which takes in a single string representing the filename's path relative to the `src` directory. Note that the file ending, i.e. `.fe`, must be omitted.
Here is an example deployment (where the contract is located in [`src/test/contracts/Number.fe`](./src/test/contracts/Number.fe)):
```solidity
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.7.0 <0.9.0;
import {FeDeployer} from "foundry-fe/src/FeDeployer";
interface Number {
function setNumber(uint256) external;
function getNumber() external returns (uint256);
}
contract FeDeployerExample {
function deploy() public {
// Deploy a new instance of src/test/contracts/Number.fe
address addr = FeDeployer.deploy("test/contracts/Number.fe", "Number");
// To call a function on the deployed contract, create an interface and wrap the address like so
Number number = Number(addr);
}
}
```