https://github.com/ajna-finance/ajna-core

How to Deploy | Ajna Protocol

<aside> 💡 All the contracts MUST be verified on the block explorer for your chain to be added to the ajnafi.com UI

</aside>

SC Deployment process

A deployment script has been created to automate deployment of libraries, factory contracts, and manager contracts.

To use it, ensure the following env variables are in your .env file or exported into your environment.

Environment Variable Purpose
AJNA_TOKEN address of the AJNA token on your target chain
DEPLOY_ADDRESS address from which you wish to deploy
DEPLOY_KEY path to the JSON keystore file for the deployment address
ETHERSCAN_API_KEY required to verify contracts
ETH_RPC_URL node on your target deployment network

To run:

make deploy-contracts

Upon completion, contract addresses will be printed to stdout:

== Logs ==
  Deploying to chain with AJNA token address 0xaadebCF61AA7Da0573b524DE57c67aDa797D46c5
  === Deployment addresses ===
  ERC20PoolFactory       0x14F2474fB5ea9DF82059053c4F85A8C803Ab10C9
  ERC721PoolFactory      0xb0d1c875B240EE9f6C2c3284a31b10f1EC6De7d2
  PoolInfoUtils          0x08F304cBeA7FAF48C93C27ae1305E220913a571d
  PoolInfoUtilsMulticall 0x12874db433dBF1D0f3c73B39F96B009093A56E0E
  PositionManager        0xC4114D90F51960854ab574297Cf7CC131d445F29

Record these addresses. If Etherscan verification fails on the first try, copy the deployment command from the Makefile, and tack a --resume switch onto the end. Failing that, manual verification is possible. Following steps show how to do this on Goerli (chainId 5), using addresses from the example output above.

Validation

Validate the deployment by creating a pool. Set relevant environment variables, and run the following: