Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chainlink develop #13

Merged
merged 12 commits into from
Dec 9, 2020
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,51 @@ Currently Ganache and Node 14 are not playing well together. To get started:
3. ```npm run-script build```
4. ```npm test``` (to verify the build)

## Features
#### Deploying to local node
Buidler

1. Use node 12 (using nvm is recommended)
2. ```npx buidler node```
3. In second terminal```npx buidler run --network localhost scripts/deploy.ts ```

Ganache

1. Use node 12 (using nvm is recommended)
2. Start Ganache on port 8545
3. In second terminal```npx buidler run --network localhost scripts/deploy.ts ```

#### Deploying to Matic
1. ```npm install truffle -g```

Mumbai Testnet configured in ```./truffle-config.js```

Test deployment using Truffle against a runnning Ganache instance: ```truffle migrate```
Deploy to Mumbai testnet: ```truffle migrate --network matic```

Verify deployment using contract address at the [Matic Explorer](https://explorer-mumbai.maticvigil.com/)

*Verifying & publishing the contract code*

In the [Matic Explorer](https://explorer-mumbai.maticvigil.com/) find your contract based on the address reported by Truffle.
Go to the tab ```Code```

Flattening contract: https://github.com/poanetwork/solidity-flattener and cleanup SPDX licenses and _Chainlink appended to classes like SafeMath, Buffer and ENSResolver

Quite note on setting up Matic:
* Configure Matic network in [MetaMask](https://docs.matic.network/docs/develop/metamask/config-matic/)
* Request funds at [faucet](https://faucet.matic.network/)
* Use this wallet's seed phrase in the .env file to pay the deployment

#### Interacting with the contract
After deploying to a local node
1. ```npx buidler console --network localhost ```
2. ```const CommitPool = await ethers.getContractFactory("SinglePlayerCommit")```
3. ```const commitPool = await CommitPool.attach("<<CONTRACT ADDRESS FROM DEPLOYMENT>>")```

Example for interacting:
```await commitPool.withdraw(1000)```
## Features
[Technical documentation](https://ipfs.io/ipfs/QmdJsGYi822G1azEMtGL39LRwXZtJRC58KT393TGPixP6z)
bitbeckers marked this conversation as resolved.
Show resolved Hide resolved
#### Creation of Commitment

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.
Expand Down
5 changes: 5 additions & 0 deletions buidler.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ const config: BuidlerConfig = {
...createHDAccountConfig("kovan"),
chainId: 42,
},
localhostGanache: {
...createHDAccountConfig("ganache"),
url: "http://127.0.0.1:7545",
chainId: 5777,
},
rinkeby: {
...createHDAccountConfig("rinkeby"),
chainId: 4,
Expand Down
27 changes: 27 additions & 0 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.10;

contract Migrations {
address public owner;

// A function with the signature `last_completed_migration()`, returning a uint, is required.
uint public last_completed_migration;

modifier restricted() {
if (msg.sender == owner) _;
}

constructor() public {
owner = msg.sender;
}

// A function with the signature `setCompleted(uint)` is required.
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}

function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
Loading