Protocol
Contracts
Deployments

Deployments

Available networks

Primitive Portfolio contracts are deployed at the following addresses:

ContractNetworkAddress
PortfolioMainnet, Arbitrum, Optimism0x...
RegistryMainnet, Arbitrum, Optimism0x...

Deploying Portfolio

Portfolio contracts are deployed using Nugu (opens in a new tab) factory contract. This allows us to have the exact same address across all the different networks.

The actual deployment flow is quite straightforward and only requires a few steps.

1. Set up the .env file

The .env file contains the private key of the wallet that will deploy the contracts and also the RPC of the different networks. It should be filled like this:

PRIVATE_KEY=0xbeefbbefbbef...
MAINNET_RPC_URL=https://eth-mainnet...

2. Compile the contracts

Next step is simply to compile the contracts, this can be done using the following command:

forge b --via-ir --optimizer-runs 0 --skip test

3. Deploy the contracts

Final step is deploying the contracts using the deployment script:

forge script ./scripts/Deploy.s.sol --sig "run(address,address)" WETH_ADDRESS REGISTRY_ADDRESS --broadcast --rpc-url RPC_URL

Here are a few things to consider:

  • WETH_ADDRESS parameter should be replaced by the actual address of the WETH contract on the target network. If a new WETH contract is required (for example on a testnet), the zero address should be passed
  • Same thing for the REGISTRY_ADDRESS parameter, if a new contract is required, simply pass the zero address
  • RPC_URL should be a valid RPC url pointing to the target network
  • Some networks might require the --legacy parameter
  • Gas price (or base fee) is not specified in this example

© 2023 Primitive™