CommitPool helps people meet their personal goals by holding themselves accountable. CommitPool users stake money to credibly commit to meeting their goals, and lose their stake when they don’t.
Our MVP focuses on a single goal type for individuals, hence the Single Player mode.
Currently Ganache and Node 14 are not playing well together. To get started:
- Use node 12 (using nvm is recommended)
npm install
npm run-script build
npm test
(to verify the build)
Note: Hardhat guide on running test in VSCode
Buidler
- Use node 12 (using nvm is recommended)
npx buidler node
- In second terminal
npx buidler run --network localhost scripts/deploy.ts
Buidler & Ganache
- Use node 12 (using nvm is recommended)
- Start Ganache on port 8545
- In second terminal
npx buidler run --network localhost scripts/deploy.ts
Truffle
- Use node 12 (using nvm is recommended)
- Start Ganache on port 8545
- In terminal
truffle migrate
Deployment to the Mumbai Testnet is configured in ./truffle-config.js
npm install truffle -g
- Deploy to Mumbai testnet:
truffle migrate --network matic
- Find your contract based on the address reported by Truffle in the Matic Explorer.
Quite note on deploying to Matic:
- Test deployment using Truffle against a runnning Ganache instance:
truffle migrate
- Configure Matic network in MetaMask
- Request funds at faucet
- Use this wallet's seed phrase in the .env file to pay the deployment
Interaction with the contract on Matic via Truffle:
truffle console --network matic
compile
var singlePlayerCommit = await SinglePlayerCommit.at('<ADDRESS FROM DEPLOYMENT>')
- To test:
await contractTest.activityKeyList(0)
After deploying to a local node
npx buidler console --network localhost
const CommitPool = await ethers.getContractFactory("SinglePlayerCommit")
const commitPool = await CommitPool.attach("<<CONTRACT ADDRESS FROM DEPLOYMENT>>")
Example for interacting:
await commitPool.withdraw(1000)
A commitment consists of an activity
, a goalValue
for given activity, a startTime
, and stake
. We will automagically set the endTime
7 days after the startdate.
An activity consists of a name
and the oracle
address. Activities can be enabled by setting it to allowed
.
The contract can be called to process the commitment based on the address of the committer. A check on time and completion determines whether the stake is returned to the committer.
This repository is a fork from Paul Berg's Solidity Template
Subscribe to our Substack