Contains the scripts to deploy the Tinlake contracts to Ethereum mainnet or a testnet.
- Tinlake is build and developed with dapp.tools from DappHub. The deployments happens with bash scripts and the command-line tool
seth
. - On MacOS, install coreutils
brew install coreutils
(this package cotainsrealpath
, a dependency used in the scripts). - On Linux, install
jq
, e. g. withapt-get install jq
- Init/update git submodules:
git submodule update
For a deployment config file needs to be defined.
{
"ETH_RPC_URL": "<<RPC URL>>",
"ETH_FROM": "<<ADDRESS>>",
"TINLAKE_CURRENCY": "<<ADDRESS>>",
"MAIN_DEPLOYER": "<<ADDRESS>>",
"SENIOR_INTEREST_RATE": "<<NUMBER>>",
"MAX_RESERVE": "<<NUMBER>>",
"MAX_SENIOR_RATIO": "<<NUMBER>>",
"MIN_SENIOR_RATIO": "<<NUMBER>>",
"CHALLENGE_TIME": "<<NUMBER>>",
"DISCOUNT_RATE": "<<NUMBER>>",
}
TINLAKE_CURRENCY
defines the stablecoin for the Tinlake. For example on mainnet this could be the DAI
stablecoin or any other ERC20 contract.
MAIN_DEPLOYER
is a contract which deploys our factories with the create2 opcode. The other parameters are default config parameters from seth
SENIOR_INTEREST_RATE
MAX_RESERVE
should follow ONE as 10^18
MAX_SENIOR_RATIO
should follow ONE as 10^27
MIN_SENIOR_RATIO
should follow ONE as 10^27
CHALLENGE_TIME
should be in seconds
DISCOUNT_RATE
FEED_MAX_DAYS
It is possible to use the NFT Feed or the NAV Feed
To use the NAV Feed, set FEED to nav
{
"FEED": "nav"
}
Otherwise, the FEED will default to the NFT Feed
{
"ETH_GAS": "<<NUMBER>>",
"ETH_GAS_PRICE": "<<NUMBER>>",
"ETH_KEYSTORE": "<<DIR PATH>>",
"ETH_PASSWORD": "<<FILE PATH>>",
}
The config file can contain addresses for Fabs.
./bin/util/build_contracts.sh
For deploying the contracts execute the following script.
./bin/deploy.sh <<Optional: Path to config file>>
The default filepath of the configfile is: ./config_$(seth chain).json
seth chain
returns the name of the current chain based on the provided
1. Set env variables
Adjust .env-example.sh
, and run source env-example.sh
.
2. Build contracts
./bin/util/build_contracts.sh
3. Start your own local testnet. Run in a seperated terminal
dapp testnet
4. Generate Test Config File
./bin/test/setup_local_config.sh
This should generate a file at ./bin/config_unknown.json
. Modify that file if needed.
5. Run deploy script
./bin/deploy.sh
1. Build the docker image
docker build -t centrifugeio/tinlake-deploy:latest .
2. Run a docker container
docker run --rm -p 8545:8545 centrifugeio/tinlake-deploy:latest
Create Main Deployer
dapp create MainDeployer