Configure Your Local Environment
At the end, you’ll have a development environment set up that you can use to build the rest of the examples under "Guides", or start your own integration project.
Pre-requisites
You will need the following software on your machine:In addition, familiarity with Ethereum and Solidity is requisite.
Set up using Foundry template
tip
Make sure you are using the latest version of Foundry by running foundryup
.
Let's use this command to spin up a new Foundry project:
$ forge init my-project
$ cd my-project
Once the initialization completes, take a look around at what got set up:├── foundry.toml
├── script
├── src
└── test
The folder structure should be intuitive:src
is where you'll write Solidity contractstest
is where you'll write tests (also in Solidity)script
is where you'll write scripts to perform actions like deploying contracts (you guessed it, in Solidity)foundry.toml
is where you can configure your Foundry settings, which we will leave as is in this guide
note
You might notice that the CLI is forge
rather than foundry
. This is because Foundry is a toolkit, and forge
is
just one of the tools that comes with it.
Install Merkle Airdrops npm packages
tip
If you are integrating with MerkleLL
or MerkleLT
, you will also have to install
Lockup npm package. Both MerkleLL
and
MerkleLT
contracts interact with Lockup protocol to setup up vesting for airdropped tokens.
$ bun add @sablier/airdrops
Bun will download the Airdrops contracts, along with their dependencies, and put them in the node_modules
directory.Let's remap the package names to point to the installed contracts. This step is required so that the Solidity compiler can find the Airdrops contracts when you import them:
$ echo "@sablier/airdrops=node_modules/@sablier/airdrops/" >> remappings.txt
$ echo "@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/" >> remappings.txt
$ echo "@prb/math/=node_modules/@prb/math/" >> remappings.txt
That's it! You should now have a functional development environment to start building onchain Airdropsintegrations. Let's run a quick test to confirm everything is set up properly.
Next steps
Congratulations! Your environment is now configured, and you are prepared to start building. Explore the guides section to discover various features available for Airdrops integration. Remember to include all contracts (.sol
files) in the src
folder and their corresponding tests in the test
folder.As far as Foundry is concerned, there is much more to uncover. If you want to learn more about it, check out the Foundry Book, which contains numerous examples and tutorials. A deep understanding of Foundry will enable you to create more sophisticated integrations with Airdrops protocol.