A quadratic funding implementation on Injective. This implementation distributes matching funds based on quadratic voting and includes grant distribution algorithm (also called "quadratic progressive tax") to ensure fairer distribution.
For previous EVM implementations refer to this repo.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknown
Run tests
cargo test
Initialize the contract.
Start a new round. The valut controlled by the program derrived address. If the init valut is not empty, the value will be treated as a fund in the round.
Set fund in a round.
Register a new track.
Register a project to the round.
Vote to a project which you like.
Only owenr of round can end a round.
After withdraw_grants be called, the administrator can withdraw the corresponding fee.
build
cargo wasm
optimize
cargo run-script optimize
check
cargo run-script check
deploy
export INJ_ADDRESS=inj1t68r9rqkrzdy2xdqmjj9mhxz3n7v480pmx52hz
injectived query bank balances $INJ_ADDRESS --node=https://testnet.sentry.tm.injective.network:443
injectived tx wasm store /var/artifacts/quadratic_grant-aarch64.wasm \
--from=$(echo $INJ_ADDRESS) \
--chain-id="injective-888" \
--yes --fees=1005000000000000inj --gas=3000000 \
--node=https://testnet.sentry.tm.injective.network:443
export INJ_ADDRESS=inj1t68r9rqkrzdy2xdqmjj9mhxz3n7v480pmx52hz
export CONTRACT=inj1ns2vjmxe00guw75ctumc32k2q2e7qxqqwqsj73
START_ROUND='{"start_round":{"tax_adjustment_multiplier": 10, "donation_denom":"inj", "voting_unit": "10", "fund": "4000", "pubkey":[]}}'
yes 12345678 | injectived tx wasm execute $CONTRACT "$START_ROUND" \
--from=$(echo $INJ_ADDRESS) \
--chain-id="injective-888" \
--yes --fees=1000000000000000inj --gas=2000000 \
--node=https://testnet.sentry.tm.injective.network:443 \
--output json
ROUND='{"round":{"round_id": 2}}'
injectived query wasm contract-state smart $CONTRACT "$ROUND" \
--node=https://testnet.sentry.tm.injective.network:443 \
--output json
injectived tx gov submit-proposal wasm-store /var/artifacts/quadratic_grant-aarch64.wasm \
--title="Upload quadratic grant contract" \
--description="A quadratic funding implementation on Injective" \
--instantiate-everybody=true \
--deposit=1000000000000000000inj \
--run-as=inj1t68r9rqkrzdy2xdqmjj9mhxz3n7v480pmx52hz \
--gas=10000000 \
--chain-id=injective-1 \
--broadcast-mode=sync \
--yes \
--from inj1t68r9rqkrzdy2xdqmjj9mhxz3n7v480pmx52hz \
--gas-prices=500000000inj