The main logic is
-
creator spend tokens to create an activity
-
other users spend tokens to buy ballots then spend ballot to vote activities
-
admin close activity and mint NFT to voter who vote at right side, this is automatic task at server
-
NFT can increase user voting power
ps: all useful data will emit by event and sync to server database
brew install flow-cli
(if flow-cli not install)cd tests && yarn
yarn test
flow emulator
- open a new terminal
flow project deploy
(maybe need modify emulator-account's key in ./flow.json to servicePrivKey which find the emulator output)
cp .env.example .env
and fill your key info- deploy use
flow project deploy -n testnet
- (redeploy) run
sh remove.sh
, then rewrite all path in contract's init(), for example, replaceself.ActivityStoragePath = /storage/ActivitiesCollection_0
toself.ActivityStoragePath = /storage/ActivitiesCollection_1
, than run 2. - check deploy result at https://flow-view-source.com/testnet/account/[contract_address]
- use
flow keys generate
andflow transactions send ./transactions/account/add_keys.cdc [PK] -n testnet --signer testnet-account
for server key rotation sign.
- fill moderator account and private in .env
flow transactions send transactions/Activity/close_activity.cdc ACTIVITYID --network testnet --signer testnet-account