Refer to the deployed instance at testnet. Our npm sdk is the best fit for interaction with ditto factory. And please, enjoy!
First, download repository:
git clone https://github.com/dittonetwork/blast-contracts
cd blast-contracts
Install dependencies:
forge install
Copy the .env.example to .env and fill it in:
cp .env.example .env
ETH_RPC_URL=
POL_RPC_URL=
ARB_RPC_URL=
OPT_RPC_URL=
POLYGON_API_KEY=
ARB_API_KEY=
BNB_API_KEY=
AVAX_API_KEY=
CELO_API_KEY=
PRIVATE_KEY=0x
Run tests
forge test
Env variables must be added to the terminal before deployment
source .env
Contract addresses stored in the Registry
For each network there is a file with a script to deploy to dev or prod (dev deploy is partially involved in creating the test environment)
to run the deploy script on dev
forge script script/FullDeploy.s.sol -vvvv --rpc-url $<network>_RPC_URL --sig "run(bool,bool)" true false --broadcast [--with-gas-price <gas price>]
Where:
- network - the network to which the script will be run
- true - add new implementation to the factory
- false - deploy contracts for dev
- gas price - optional parameter for gas price (e.g., gas price on arb is 0.1 gwei, but foundry takes 3.2 gwei)
Note:
- All contracts that do not equal a
address(0)
in theRegistry
file will not be re-deployed while script execution. - Contracts deployed on the Ditto protocol must be cleared in order to deploy your own env
and the factory address must be modified in the
deployFactory
method to your own:
- vaultFactoryProxyAdmin
- vaultFactoryProxy
- vaultProxyAdmin
- dittoBridgeReceiver
- protocolFees
- entryPointLogic
- executionLogic
- stargateLogic
- layerZeroLogic
After writing a new module, you need to add it to the logics
structure in the Registry
file and add it to the network script where it is needed:
- its methods to the private function
_getData
- its deployment to the public function `deploySystemContracts`` similar to the contracts already existing there
script
- the logic of deployment, test environment creation and the registry of contractssrc
- code of contractstest
- tests for contracts
You can copy and paste the MIT license summary from below.
MIT License
Copyright (c) 2023 Ditto Network
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.