Profiler.bio

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:

forge install

General config

  • The deploy scripts are located in script
  • Copy .env.example to .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

forge build

This task will compile all smart contracts in the contracts directory.

🌡️ Testing

forge test -vv

🚀 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.0 in a terminal window and keep it running

To just deploy all contracts using the default mnemonic's first account, run:

forge script script/Dev.s.sol:DevScript --fork-url $ANVIL_RPC_URL --broadcast -vvvv

Testnet

  • Make sure you have set your environment variables in .env
  • Important: Don't forget to set NATIVE_TOKEN_ADDRESS in .env to 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

forge script script/Deploy.s.sol:DeployScript --rpc-url sepolia --broadcast --verify -vvvv

Mainnet

forge script script/Deploy.s.sol:DeployScript --rpc-url https://mainnet.infura.io/v3/YOUR_INFURA_KEY --broadcast --verify -vvvv
  • 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:

TokenVesting tokenVesting = new TokenVesting(IERC20Metadata(nativeToken), "Virtual Example Token", "vETT");
// TO
TokenVesting tokenVesting = new TokenVesting(IERC20Metadata(nativeToken), "TOKEN_NAME", "TOKEN_SYMBOL");
  1. Deploy the Contract

    • The deployer address is assigned:
      • DEFAULT_ADMIN_ROLE
      • ROLE_CREATE_SCHEDULE
  2. Grant Roles to Treasury

    • Assign both roles to the treasury address from the deployer address:
      • DEFAULT_ADMIN_ROLE
      • ROLE_CREATE_SCHEDULE
  3. Transfer Ownership

    • Transfer ownership from the deployer to the treasury address.
    • After transfer, the deployer keeps both roles.
  4. Renounce Roles (Deployer)

    • The deployer calls renounceRole() to remove any remaining privileges.

Process Flow

Edit .env vars and  ./script/Deploy.s.sol
Deploy Contract (Deployer)  

Grant Roles (Treasury gains required roles)  

Transfer Ownership (Deployer → Treasury)  

Renounce Role (Deployer removes own access)  

On this page