This project contains BLND token contract for StakerDAO project. It also includes the controlling Multisig contract used by the Operations team to control the BLND token.
Contrary to other popular multisig initiatives on Ethereum, the supplied Multisig contract provides off-chain signing. Exposing hashes of half-signed transactions on chain may influence the price of the BLND token. Thus, we want signing to happen off-chain, so that hashes of half-signed transactions to appear on chain before execution.
The project was tested with Node v12.*.
It is strongly suggested that you use nvm
to pick and install the required the node version.
Clone the repository and run npm install -g
to make the blend
command available in your PATH. Alternatively, you can install locally (npm install
) but you would have to use ./bin/staker-blend
to call the CLI.
The package provides a command line interface to deploy and upgrade the BLND token.
For convenience, some preset Ethereum network options are provided in Truffle configuration file: truffle-config.js
. Currently, it contains configurations for local (development
) and public (goerly
) test networks. The configuration uses Infura RPC to access public Ethereum networks.
To run against the local development network, you must have ganache-cli
installed (npm i -g ganache-cli
). To work with public networks, you must supply the required environment variables, as specified in .env.example
.
To deploy the Multisig and the upgradeable BLND token contract, use the following command:
blend deploy <owner1> <owner2> ... <ownerN>
You will be asked for additional parameters in an interactive manner:
network
– one of the preconfigured networks to deploy tothreshold
– how many signatures are required in order to upgrade the BLND token contract laterminter
– the address that would hold BLND tokens initiallysupply
– the initial supply that would be debited tominter
If you pick a development
network, make sure you have ganache-cli
running in the background.
If you pick goerli
network, make sure to have all the variables from .env.example
in your environment.
You can also provide these arguments via the corresponding command line options if you find this more convenient.
After deployment, you can check the deployed instances using blend info
.
This command returns the information about Multisig and BLND token contracts such as multisig owners and token name along with the addresses of the instances.
BLND contract upgrade is a multi-step process that looks as follows:
- Someone (e.g., one of the owners) deploys a new implementation to the Ethereum blockchain.
- He then generates a multisig transaction to point the BLND contract to the new implementation, and sends this not-yet-signed transaction to the multisig owners.
- The owners sign the transaction.
- Once the signatures are collected, someone submits the signed transaction to the network.
Once the transaction is submitted, the Multisig contract checks the signatures and upgrades the contract to the new implementation.
The CLI provides four commands to facilitate the process:
blend upgrade
compiles the new implementation, uploads it to the Ethereum network, and creates a JSON file with a not-yet-signed multisig transaction.blend sign
signs the transaction JSON file.blend merge <file1> <file2> ... <fileN>
merges several transaction JSON files (possibly containing signatures from different owners) into one transaction JSON with all the signatures collected.blend submit
actually submits the signed transaction to the network and upgrades the implementation if all the signatures are correct and the threshold is met.
Note: All the commands will ask for additional information such as input and output file names, the network to use, etc. Please, fill in the corresponding blanks. Alternatively, you can provide all the options straight away: see
blend <command> --help
for options description.
Thus, if you need to upgrade the BLND token contract, you should do the following:
- Update the implementation and call
blend upgrade
to get atx.json
file. - Send this
tx.json
file to the multisig owners. - Ask the owners to call
blend sign tx.json
and send you the results back (tx.alice.json
,tx.bob.json
, etc.) - Merge the results you got from multisig owners via
blend merge tx.alice.json tx.bob.json -o tx.signed.json
- Send the signed transaction:
blend submit tx.signed.json
To use BLND token, you'll need an ERC-20 compatible wallet.
- Navigate to your wallet and find "Add custom token" button.
- Type in the address, symbol and decimals of the BLND token (you can find this information with
blend info
command). - Click "Confirm".
See the process for Metamask wallet:
After these steps, you can send BLND token just like you send Ether or other ERC-20 tokens: