Contract Deployment
For developers - How to deploy and setup the contract
📦 Installation
To work with this repository you have to install Foundry here. Run the following command in your terminal, then follow the onscreen instructions (macOS and Linux):
curl -L https://foundry.paradigm.xyz | bash
The above command will install foundryup. Then install Foundry by running foundryup in your terminal.
(Check out the Foundry book for a Windows installation guide: Foundry Book)
Afterwards run this command to install the dependencies:
General config
- The deploy scripts are located in
script - Copy
.env.exampleto.env
You can place required env vars in your .env file and run source .env to get them into your current terminal session or provide them when invoking the command.
⛏️ Compile
This task will compile all smart contracts in the contracts directory.
🌡️ Testing
🚀 Deployment
Local development
- Anvil is a local testnet node shipped with Foundry. You can use it for testing your contracts from frontends or for interacting over RPC.
- Run
anvil -h 0.0.0.0in a terminal window and keep it running
To just deploy all contracts using the default mnemonic's first account, run:
Testnet
- Make sure you have set your environment variables in
.env - Important: Don't forget to set
NATIVE_TOKEN_ADDRESSin.envto the address of the native token you want to use for vesting. - Run the command below to deploy to Goerli testnet:
Mainnet
- Make sure you change the
Testnet
Mainnet
- The Etherscan verification will only work if you have set your API key in
.env.
You can of course also deploy to Sepolia testnet as well, e.g. by using --rpc-url sepolia. Just remember to set the ENV variables in .env accordingly.
After Deployment
Once the contract is deployed you can setup the Token Vesting Frontend
Upon setup the contract requires a few thing to be self sustaining. Trasnfer ownership from deployer address to treasury address, Revoke
Deploy Deploy address - DEFAULT_ADMIN_ROLE, ROLE_CREATE_SCHEDULE Transferer (sender:deployer) - DEFAULT_ADMIN_ROLE (true), ROLE_CREATE_SCHEDULE (true) Transfer Owner (reciever:treasury) - DEFAULT_ADMIN_ROLE (false), ROLE_CREATE_SCHEDULE (false)
Deploy (Deploy Address) -> Grant Roles (Both roles to treasury address from deployer address) -> Transfer ownership (Deploy Address -> Treasury Address) -> Deployer address run renounceRole
Contract Setup for Self-Sustainability
To ensure the contract operates independently, follow these steps:
Before deployment edit ./script/Deploy.s.sol - make sure to change the line:
-
Deploy the Contract
- The deployer address is assigned:
DEFAULT_ADMIN_ROLE✅ROLE_CREATE_SCHEDULE✅
- The deployer address is assigned:
-
Grant Roles to Treasury
- Assign both roles to the treasury address from the deployer address:
DEFAULT_ADMIN_ROLE✅ROLE_CREATE_SCHEDULE✅
- Assign both roles to the treasury address from the deployer address:
-
Transfer Ownership
- Transfer ownership from the deployer to the treasury address.
- After transfer, the deployer keeps both roles.
-
Renounce Roles (Deployer)
- The deployer calls
renounceRole()to remove any remaining privileges.
- The deployer calls