-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tools/foundry subchapter #1151
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for oasisprotocol-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also mention the forge verify
command they can use after the contract is deployed. Details are on the Contract verification page.
d082058
to
af86c0a
Compare
|
||
## Setup and Configuration | ||
|
||
Foundry uses default revm EVM implementation which does not contain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this paragraph under the Installing Sapphire Foundry (Optional)
section.
Also:
Foundry uses default revm EVM implementation which does not contain | |
Foundry uses [revm] EVM implementation which does not contain |
and below:
[revm]: https://github.com/bluealloy/revm
**Sapphire Contracts** package is also provided. It contains | ||
helper solidity contracts and libraries that enable convenient access to | ||
on-chain data and precompiles (rng, signatures, on-chain encryption, etc.). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this under step 3. below.
package using Foundry package manager [soldeer]: | ||
|
||
```shell | ||
forge soldeer install @oasisprotocol-sapphire-contracts~0.2.11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version could be omitted right?
forge soldeer install @oasisprotocol-sapphire-contracts~0.2.11 | |
forge soldeer install @oasisprotocol-sapphire-contracts |
1. Install the **Sapphire Foundry** soldeer package: | ||
|
||
```shell | ||
forge soldeer install @oasisprotocol-sapphire-foundry~0.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forge soldeer install @oasisprotocol-sapphire-foundry~0.1.0 | |
forge soldeer install @oasisprotocol-sapphire-foundry |
forge soldeer install @oasisprotocol-sapphire-foundry~0.1.0 | ||
``` | ||
|
||
2. Add `ffi = true` to your foundry.toml file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Add `ffi = true` to your foundry.toml file: | |
2. Add `ffi = true` to your `foundry.toml` file: |
3. Your foundry.toml file should now look like this: | ||
|
||
```toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge 2. and 3.:
3. Your foundry.toml file should now look like this: | |
```toml | |
```toml title="foundry.toml" |
``` | ||
and then inherit from `SapphireTest` from `BaseSapphireTest.sol` | ||
and override the `setUp()` function: | ||
```solidity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` | |
and then inherit from `SapphireTest` from `BaseSapphireTest.sol` | |
and override the `setUp()` function: | |
```solidity | |
``` | |
and then inherit from `SapphireTest` from `BaseSapphireTest.sol` | |
and override the `setUp()` function: | |
```solidity |
|
||
Forge scripts should run the same way as tests. | ||
|
||
## A note on Forks/External RPC nodes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## A note on Forks/External RPC nodes | |
## A Note on Forks/External RPC Nodes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more suggestions.
cargo +nightly build --release | ||
``` | ||
|
||
## Sapphire specific features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Sapphire specific features | |
## Sapphire-specific tests |
The `@oasisprotocol-sapphire-foundry` package enables | ||
testing with precompiles and encrypted calls. | ||
|
||
#### Precompiles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#### Precompiles | |
### Precompiles |
} | ||
``` | ||
|
||
#### Encrypted Transactions and Calls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#### Encrypted Transactions and Calls | |
### Encrypted Transactions and Calls |
3. `vm.broadcastRawTransaction(raw_tx)` to send the raw transaction. | ||
|
||
|
||
### Forge Tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Forge Tests | |
### `forge test` |
|
||
[foundry-example]: https://github.com/oasisprotocol/sapphire-paratime/tree/main/examples/foundry | ||
|
||
### Forge Script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Forge Script | |
### `forge script` |
This PR adds foundry subchapter to tools.