Skip to content
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

[pull] master from foundry-rs:master #3

Open
wants to merge 76 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
4317603
chore(output): weekly command output update (#1336)
github-actions[bot] Oct 20, 2024
c354d9d
Update create-wallet.md (#1338)
juannyG Oct 23, 2024
58dae03
docs: add juannyG as a contributor for doc (#1339)
allcontributors[bot] Oct 23, 2024
1be562e
docs: update default `out` folder (#1337)
guidanoli Oct 25, 2024
f2b5973
doc: add info for vyper lib configuration (#1334)
Philogy Oct 25, 2024
e8d37d2
Revert "Update default `out` folder" (#1340)
DaniPopes Oct 25, 2024
9221001
chore(output): weekly command output update (#1341)
github-actions[bot] Oct 27, 2024
25c558f
docs: fix typo in writing-tests.md (#1344)
RafaelCaso Oct 28, 2024
42da808
Document `vm.mockCalls` (#1325)
Tudmotu Oct 30, 2024
fa3de5d
docs: Update writing-tests.md (#1343)
RafaelCaso Oct 30, 2024
c59ce91
chore(output): weekly command output update (#1348)
github-actions[bot] Nov 3, 2024
cf728dd
Add "Scripting with Arguments" section to Solidity Scripting document…
TomasCImach Nov 6, 2024
3aa4462
docs: add TomasCImach as a contributor for doc (#1349)
allcontributors[bot] Nov 7, 2024
75f9130
docs: update Otterscan's specification link (#1351)
leovct Nov 8, 2024
189c880
chore(output): weekly command output update (#1352)
github-actions[bot] Nov 10, 2024
8a177d0
Update env-bytes32.md (#1355)
adamocallaghan Nov 14, 2024
54357ff
fix(cast-storage): `Emit` -> `Omit` (#1356)
MaxMustermann2 Nov 15, 2024
8394780
chore(output): weekly command output update (#1357)
github-actions[bot] Nov 17, 2024
c56dcf1
chore(output): weekly command output update (#1359)
github-actions[bot] Nov 21, 2024
842ab80
chore: update default `evm_version` to `cancun`, add explainer for pi…
zerosnacks Nov 21, 2024
4d4c5be
Change outdated links to openchain.xyz for signatures (#1362)
velvet-shark Nov 21, 2024
69b4a30
chore(output): weekly command output update (#1364)
github-actions[bot] Nov 24, 2024
b89cb75
chore(output): weekly command output update (#1365)
github-actions[bot] Dec 1, 2024
26ef43d
chore(output): weekly command output update (#1367)
github-actions[bot] Dec 8, 2024
7c52f4a
chore: fix typo (#1368)
standstaff Dec 9, 2024
0fd0949
chore(output): weekly command output update (#1372)
github-actions[bot] Dec 15, 2024
8fd59a6
chore: start defaulting to stable (#1373)
zerosnacks Dec 20, 2024
573479a
Enable packed slots (#1369)
DrakeEvans Dec 21, 2024
36abc7e
chore(output): weekly command output update (#1375)
github-actions[bot] Dec 22, 2024
edd758e
chore(output): weekly command output update (#1377)
github-actions[bot] Dec 29, 2024
96e0f19
chore(output): weekly command output update (#1378)
github-actions[bot] Jan 5, 2025
0ef1fbb
chore: remove forge debug as standalone command, access through `--de…
zerosnacks Jan 6, 2025
6f42d2b
Revert "chore: remove forge debug as standalone command, access throu…
zerosnacks Jan 6, 2025
0fa273d
docs(formatter): add hex_underscore section (#1358)
wiasliaw Jan 9, 2025
337a2cc
chore: improve documentation of individual binaries (#1371)
zerosnacks Jan 10, 2025
ca61a2c
Update an outdated link to Ethereum JSON-RPC API reference (#1384)
s-tikhomirov Jan 10, 2025
205747b
chore(output): weekly command output update (#1385)
github-actions[bot] Jan 12, 2025
13b2e0c
chore: add announcements page (#1386)
zerosnacks Jan 14, 2025
bfdf442
chore(output): weekly command output update (#1388)
github-actions[bot] Jan 19, 2025
18f4ec0
chore: bump version of `foundryup` (#1392)
zerosnacks Jan 21, 2025
dcd6688
Document cast wallet sign default behavior: EIP-191 (#1363)
robriks Jan 22, 2025
e334128
chore: bump foundryup version (9746) (#1394)
zerosnacks Jan 23, 2025
34a03d4
chore: bump foundryup version (9750) (#1395)
zerosnacks Jan 23, 2025
cdb0455
chore(output): weekly command output update (#1397)
github-actions[bot] Jan 26, 2025
768bebf
fix: broken code snippet (#1398)
skhomuti Jan 26, 2025
1911bc6
chore: add note on setting `evm_version` if you are experimenting wit…
zerosnacks Jan 27, 2025
3825c9e
Update optimizer settings to reflect latest (#1401)
grandizzy Jan 28, 2025
9393ec7
Update fuzz and invariant configs (#1402)
grandizzy Jan 28, 2025
fee05b0
Update expect revert sigs, add warning re expect revert depth and nex…
grandizzy Jan 28, 2025
9b76f84
chore: document `EIP-7702` cheatcodes and add `vm.sh` script to autom…
zerosnacks Jan 28, 2025
f273256
chore(signDelegation): improve legibility of signatures (#1405)
zerosnacks Jan 28, 2025
ba87c23
chore: add invariant notes re timeout and show_metrics (#1404)
grandizzy Jan 28, 2025
fd5a204
docs for `isContext` cheatcode, verify with linked libraries and cust…
grandizzy Jan 29, 2025
e0806ed
chore: update gas snapshot docs (#1407)
zerosnacks Jan 30, 2025
045e1a3
chore(output): weekly command output update (#1409)
github-actions[bot] Jan 30, 2025
69095f0
chore: reapply removal of `forge debug` as standalone command referen…
zerosnacks Jan 30, 2025
1e1e56b
fix: improve `vm.expectRevert` docs (#1412)
zerosnacks Jan 31, 2025
5f7f3eb
Add reference to multichain deployment (#1414)
grandizzy Jan 31, 2025
e1171c3
chore: add note on `vm.expectRevert` to announcements page (#1413)
zerosnacks Jan 31, 2025
7478957
chore: bump `foundryup` version (#1415)
zerosnacks Jan 31, 2025
446aa44
chore(output): weekly command output update (#1418)
github-actions[bot] Feb 2, 2025
07d14e6
fix: use release candidate version for update workflow (#1419)
zerosnacks Feb 3, 2025
43bfc20
Update book to reflect testFail removal (#1420)
grandizzy Feb 3, 2025
ba70ddf
fix: remove unused and deprecated `testFail*` tests for update workfl…
zerosnacks Feb 3, 2025
ca27c6f
chore: update codeowners to avoid unnecessary pinging (#1424)
zerosnacks Feb 3, 2025
e52768c
chore: deprecate outdated tutorials, fix workflow (#1425)
zerosnacks Feb 3, 2025
b3f2305
added remapping conflicts section (#1393)
christianangelopoulos Feb 3, 2025
c969507
[WIP] Add v1.0 migration tutorial (#1422)
grandizzy Feb 3, 2025
ffe6306
feat: re-add / update tutorials (#1427)
zerosnacks Feb 3, 2025
3e16c8f
chore: enhance docs of expect revert (#1428)
zerosnacks Feb 3, 2025
25246c1
Add EVM version config and FAQ (#1429)
grandizzy Feb 3, 2025
d6ddfc1
chore: add migration guide + 1.0 rc release to announcements page (#1…
zerosnacks Feb 3, 2025
e9f6841
Add verification docs (#1431)
grandizzy Feb 3, 2025
5916930
fix: add valid link in solidity compiler extra_output reference (#1432)
An-dz Feb 3, 2025
93df1d7
refactor: update create2 deployer explanation (#1437)
PaulRBerg Feb 4, 2025
3574884
chore: bump foundryup version (#1439)
zerosnacks Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add "Scripting with Arguments" section to Solidity Scripting document…
…ation (foundry-rs#1330)

* Scripting with Arguments to tutorial

* replace codeblock by inline explanation
  • Loading branch information
TomasCImach authored Nov 6, 2024
commit cf728dd5389840b123fbef18eb20108c4bdb3982
49 changes: 49 additions & 0 deletions src/tutorials/solidity-scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,55 @@ Forge is going to run our script and broadcast the transactions for us - this ca

This confirms that you have successfully deployed the `NFT` contract to the Sepolia testnet and have also verified it on Etherscan, all with one command.

### Scripting with Arguments

Let's enhance our script to accept arguments, making it more flexible and reusable. This approach allows us to deploy different NFT contracts with varying names, symbols, and base URIs without modifying the script each time. We'll start by modifying the `NFT.s.sol` script:

```solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Script} from "forge-std/Script.sol";
import {NFT} from "../src/NFT.sol";

contract MyScript is Script {
function run(
string calldata _name,
string calldata _symbol,
string calldata _baseUri
) external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);

NFT nft = new NFT(_name, _symbol, _baseUri);

vm.stopBroadcast();
}
}
```

At the root of the project run:

```sh
# To load the variables in the .env file
source .env

# To deploy and verify our contract
forge script --chain sepolia script/NFT.s.sol:MyScript "NFT tutorial" TUT baseUri --sig 'run(string,string,string)' --rpc-url $SEPOLIA_RPC_URL --broadcast --verify -vvvv
```

Let's break down the additions to our command:

`"NFT tutorial" TUT baseUri --sig 'run(string,string,string)'`

- `"NFT tutorial"` - is the first argument of the new run command - the name of the collection
- `TUT` - is the second argument - the symbol of the collection
- `baseUri` - is the third argument - the baseURI of the collection
- `--sig 'run(string,string,string)'` - changes the signature of the function we want to call in the contract

Forge is going to run our script and broadcast the transactions using the parameters we specified on the command line.
You should see an output similar to the previous section.

### Deploying locally

You can deploy to Anvil, the local testnet, by configuring the port as the `fork-url`.
Expand Down