Development
이 페이지에서는 스마트 계약을 컴파일 / 배포 / 테스트 / 상호 작용하는 방법을 설명합니다. Cyclone 토큰, GovernorAlpha / Timelock, Aeolus 및 Cyclone (Coin, ERC20)의 네 가지 주요 계약이 있습니다.
Preparation
Install truffle
Install dependencies
Install
ioctl
- the command-line tool to interact with IoTeX blockchain
install ioctl following the instructions: https://docs.iotex.io/developer/ioctl/install.html
Compile contracts
npm run build:contract
Deploy contracts
CycloneToken
Deploy a CycloneToken
ct
Timelock & GovernorAlpha
Deploy Timelock
tl
2. Deploy GorvernorAlpha ga
(e.g., voting duration:3 days)
3. Set Timelock's pending admin to GovernorAlpha ga
4. Accept Admin from GovernorAlpha ga
triggered by guardian
Aeolus
Add Liquidity for CYC/IOTX on MimoFactory and receive CYC-IOTX LP Token
Deploy an Aeolus
as
withct
address
3. Invoke ct
.addMinter() to set as
to be minters for CYC token
CoinCyclone, ERC20Cyclone
Deploy Hasher
hr
Deploy Verifier
vr
Deploy CoinCyclone
cc
, ERC20Cycloneec
linked by Hasherhr
withas
,vr
,ct
,mf
and if necessary, XRC20 token addressInvoke
ct.addMinter()
to setcc
andec
to be minters for CYC tokenInvoke
as
.addAddressToWhitelist() to setcc
andec
to be whitelists for Aeolus to invokeaddReward()
Test contracts
node version
nvm use 11.15.0
build zk circuits
npm run build
if you want to use
test
network, just runnpm run test
(default).If you want to use
development
network,modify truffle-config.js (uncomment development network)
run
ganache-cli i 1337
run
npm run test
Interaction with Cyclone contracts [Anonymity Mining]
Requirements
nvm use 11.15.0
npm install -g npx
Set up .env file
cp .env.example .env
vi .env
- add your private key, deployed contract address and denomination value
Build zk circuits:
npm run build
. Note that if you want to build zk circuits (including verifier.sol, proof/verify-keys) locally, you need to:npm uninstall websnark
npm install websnark@"git+https://github.com/tornadocash/websnark.git#2041cfa5fa0b71cd5cca9022a4eeea4afe28c9f7"
npm run build:local
- It might take more than 10 minutes as it performs the trust-setup locally.
Deposit
Testnet
./client.js deposit IOTX|XRC20 --rpc http://api.testnet.iotex.one:80
Mainnet
./client.js deposit IOTX|XRC20 --rpc http://api.iotex.one:80
Withdraw
Testnet
./client.js withdraw NOTE RECIPIENT_ADDRESS --rpc http://api.testnet.iotex.one:80 --relayer RELAYER_URL
Mainnet
./client.js withdraw NOTE RECIPIENT_ADDRESS --rpc http://api.iotex.one:80 --relayer RELAYER_URL
Interaction with Aeolus contract [Liquidity Mining]
Add Liquidity for CYC/IOTX on MimoFactory and receive CYC-IOTX LP Token
Deposit
Approve CYC-IOTX LP Token
Deposit CYC-IOTX LP Token
3. Withdraw
Interaction with GovernorAlpha contract [Governance]
Self-delegate or delegate your CYC token for governance. If you do not delegate your votes, the token will not be considered as voting power.
2. Propose a new change in cyclone contracts such as updateConfig, changeGovDAO, and updateVerifier. The proposer should have more than 1000 CYC Token. Voting will run for 3 days. -- Use abi-encoder to get encoded argument data.
3. During the 3 days of voting duration, token holders who self-delegate or delegate can cast votes for a certain proposal.
4. After 3 days of voting duration, if the proposal gets more than 4000 CYC votes, the proposer can queue the transaction into Timelock.
5. After the timelock delay, the proposer can execute the transaction in timelock.
Last updated