Skip to content

Commit

Permalink
docs(README): add script instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
nlecoufl committed Dec 3, 2024
1 parent 728de05 commit c706abc
Showing 1 changed file with 61 additions and 15 deletions.
76 changes: 61 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,25 @@ You can copy paste `.env.example` file into `.env` and fill with your keys/RPCs.

Warning: always keep your confidential information safe.

### Tests
### Foundry Installation

```bash
curl -L https://foundry.paradigm.xyz | bash

source /root/.zshrc
# or, if you're under bash: source /root/.bashrc

foundryup
```

## Tests

```bash
# Whole test suite
forge test
```

### Deploying

#### Foundry
## Deploying

Run without broadcasting:

Expand All @@ -49,27 +58,64 @@ Run with broadcasting:
yarn foundry:deploy <path_to_script> --rpc-url <network>
```

## Foundry Installation
## Scripts

Scripts can be executed in two ways:

1. With parameters: directly passing values as arguments
2. Without parameters: modifying the default values in the script

### Running Scripts

```bash
curl -L https://foundry.paradigm.xyz | bash
# With parameters
forge script scripts/MockToken.s.sol:Deploy --rpc-url <network> --sender <address> --broadcast -i 1 \
--sig "run(string,string,uint8)" "MyToken" "MTK" 18

source /root/.zshrc
# or, if you're under bash: source /root/.bashrc
# Without parameters (modify default values in the script first)
forge script scripts/MockToken.s.sol:Deploy --rpc-url <network> --sender <address> --broadcast -i 1

foundryup
# Common options:
# --broadcast Broadcasts the transactions to the network
# --sender <address> The address which will execute the script
# -i 1 Open an interactive prompt to enter private key of the sender when broadcasting
```

To install the standard library:
### Examples

```bash
forge install foundry-rs/forge-std
```
# Deploy a Mock Token
forge script scripts/MockToken.s.sol:Deploy --rpc-url <network> --sender <address> --broadcast \
--sig "run(string,string,uint8)" "MyToken" "MTK" 18

To update libraries:
# Mint tokens
forge script scripts/MockToken.s.sol:Mint --rpc-url <network> --sender <address> --broadcast \
--sig "run(address,address,uint256)" <token_address> <recipient> 1000000000000000000

```bash
forge update
# Set minimum reward token amount
forge script scripts/DistributionCreator.s.sol:SetRewardTokenMinAmounts --rpc-url <network> --sender <address> --broadcast \
--sig "run(address,uint256)" <reward_token_address> <min_amount>

# Set fees for campaign
forge script scripts/DistributionCreator.s.sol:SetCampaignFees --rpc-url <network> --sender <address> --broadcast \
--sig "run(uint32,uint256)" <campaign_type> <fees>

# Toggle token whitelist status
forge script scripts/DistributionCreator.s.sol:ToggleTokenWhitelist --rpc-url <network> --sender <address> --broadcast \
--sig "run(address)" <token_address>
```

For scripts without parameters, you can modify the default values directly in the script file:

```solidity
// In scripts/MockToken.s.sol:Deploy
function run() external broadcast {
// MODIFY THESE VALUES TO SET YOUR DESIRED TOKEN PARAMETERS
string memory name = 'My Token'; // <- modify this
string memory symbol = 'MTK'; // <- modify this
uint8 decimals = 18; // <- modify this
_run(name, symbol, decimals);
}
```

## Audits
Expand Down

0 comments on commit c706abc

Please sign in to comment.