Compare commits
1 Commits
55877897be
...
deletemewh
| Author | SHA1 | Date | |
|---|---|---|---|
|
533065e527
|
@@ -1,6 +0,0 @@
|
||||
.openzeppelin
|
||||
artifacts
|
||||
cache
|
||||
deployments
|
||||
gitno
|
||||
node_modules
|
||||
40
.drone.yml
40
.drone.yml
@@ -1,40 +0,0 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: setup
|
||||
image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||
commands:
|
||||
- cp -r /app/node_modules /drone/src/node_modules
|
||||
- chown -R drone:drone /drone/src
|
||||
- su drone -c 'npm install'
|
||||
- name: lint js
|
||||
image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||
commands:
|
||||
- su drone -c 'npm run lint:wrapper'
|
||||
depends_on:
|
||||
- setup
|
||||
# - name: lint contracts
|
||||
# image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||
# commands:
|
||||
# - su drone -c 'npm run lint:contracts'
|
||||
# depends_on:
|
||||
# - setup
|
||||
- name: build contracts
|
||||
image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||
commands:
|
||||
- su drone -c 'npm run devchain' &
|
||||
- sleep 5
|
||||
- su drone -c 'npm run build'
|
||||
depends_on:
|
||||
- setup
|
||||
- name: test
|
||||
image: gitea.kosmos.org/kredits/docker-ci:latest
|
||||
commands:
|
||||
- su drone -c 'npm run devchain' &
|
||||
- sleep 5
|
||||
- su drone -c 'npm test'
|
||||
depends_on:
|
||||
- setup
|
||||
- build contracts
|
||||
@@ -1,2 +1 @@
|
||||
/scripts/
|
||||
/test/
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,8 +5,6 @@ node_modules
|
||||
yarn-error.log
|
||||
.DS_Store
|
||||
|
||||
data
|
||||
|
||||
cache
|
||||
artifacts
|
||||
.openzeppelin
|
||||
|
||||
38
.travis.yml
Normal file
38
.travis.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
language: node_js
|
||||
node_js:
|
||||
- "12"
|
||||
|
||||
sudo: false
|
||||
dist: xenial
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
- apps/contribution/node_modules
|
||||
- apps/contributor/node_modules
|
||||
- apps/proposal/node_modules
|
||||
- apps/token/node_modules
|
||||
- apps/vault/node_modules
|
||||
|
||||
install:
|
||||
- npm install -g @aragon/cli
|
||||
- npm install -g truffle
|
||||
- npm install
|
||||
|
||||
before_script:
|
||||
- npm run devchain &
|
||||
- sleep 10
|
||||
|
||||
script:
|
||||
- npm run lint:wrapper
|
||||
- npm run lint:contract-tests
|
||||
# FIXME Fix tests
|
||||
# - npm run test:token
|
||||
# - npm run test:contributor
|
||||
# - npm run test:contribution
|
||||
# - npm run test:proposal
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
13
Dockerfile
13
Dockerfile
@@ -1,13 +0,0 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM node:16.16
|
||||
#ENV NODE_ENV=production
|
||||
|
||||
RUN useradd -ms /bin/bash drone
|
||||
|
||||
WORKDIR /app
|
||||
COPY ["package.json", "package-lock.json*", "./"]
|
||||
RUN chown -R drone:drone /app
|
||||
USER drone
|
||||
RUN npm install
|
||||
USER root
|
||||
856
package-lock.json
generated
856
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kredits-contracts",
|
||||
"version": "7.0.0-beta.0",
|
||||
"version": "6.0.0",
|
||||
"description": "Ethereum contracts and npm wrapper for Kredits",
|
||||
"main": "./lib/kredits.js",
|
||||
"directories": {
|
||||
@@ -21,7 +21,7 @@
|
||||
"lint:contracts": "solhint \"contracts/**/*.sol\" \"apps/*/contracts/**/*.sol\"",
|
||||
"lint:contract-tests": "eslint apps/*/test",
|
||||
"lint:wrapper": "eslint lib/",
|
||||
"test": "hardhat test",
|
||||
"test": "npm run test:token && npm run test:contributor && npm run test:contribution && npm run test:proposal",
|
||||
"test:token": "cd apps/token && npm run test",
|
||||
"test:contributor": "cd apps/contributor && npm run test",
|
||||
"test:contribution": "cd apps/contribution && npm run test",
|
||||
@@ -39,13 +39,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/67P/kredits-contracts#readme",
|
||||
"devDependencies": {
|
||||
"@nomicfoundation/hardhat-chai-matchers": "^1.0.3",
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.2",
|
||||
"@nomiclabs/hardhat-waffle": "^2.0.1",
|
||||
"@openzeppelin/contracts-upgradeable": "^4.3.2",
|
||||
"@openzeppelin/hardhat-upgrades": "^1.10.0",
|
||||
"async-each-series": "^1.1.0",
|
||||
"chai": "^4.3.6",
|
||||
"cli-table": "^0.3.1",
|
||||
"colors": "^1.0.3",
|
||||
"eslint": "^8.14.0",
|
||||
@@ -59,7 +57,6 @@
|
||||
"hardhat-deploy": "^0.11.4",
|
||||
"hardhat-deploy-ethers": "^0.3.0-beta.10",
|
||||
"homedir": "^0.6.0",
|
||||
"mocha": "^10.0.0",
|
||||
"promptly": "^3.0.3",
|
||||
"solhint": "^3.3.7",
|
||||
"truffle-hdwallet-provider": "^1.0.17",
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
const { ethers, upgrades } = require("hardhat");
|
||||
const path = require("path");
|
||||
const fileInject = require("./helpers/file_inject.js");
|
||||
const { ethers, upgrades } = require("hardhat"); const path = require("path"); const fileInject = require("./helpers/file_inject.js");
|
||||
|
||||
function handleError(error) {
|
||||
console.error(error.message);
|
||||
@@ -24,7 +22,7 @@ async function main() {
|
||||
let contract = await upgrades.deployProxy(contractFactories[contractName], params)
|
||||
.catch(handleError);
|
||||
|
||||
contracts[contractName] = contract;
|
||||
contracts[contractName.toLowerCase()] = contract;
|
||||
|
||||
await contract.deployed().then(() => {
|
||||
console.log(`${contractName} deployed to:`, contract.address);
|
||||
@@ -36,68 +34,36 @@ async function main() {
|
||||
|
||||
const blocksVetoPeriod = 40320; // 7 days; 15 seconds block time
|
||||
|
||||
await deployContractProxy('Contributor');
|
||||
await deployContractProxy('Contribution', [ blocksVetoPeriod ]);
|
||||
// await deployContractProxy('Contributor');
|
||||
// await deployContractProxy('Contribution', [ blocksVetoPeriod ]);
|
||||
await deployContractProxy('Token');
|
||||
await deployContractProxy('Reimbursement');
|
||||
// await deployContractProxy('Reimbursement');
|
||||
|
||||
console.log('Calling Contributor#setTokenContract')
|
||||
await contracts.Contributor.functions
|
||||
.setTokenContract(contracts.Token.address)
|
||||
.then(res => {
|
||||
console.log(`...transaction published: ${res.hash}`);
|
||||
return res.wait();
|
||||
}).catch(handleError);
|
||||
// await contracts.Contributor
|
||||
// .setTokenContract(contracts.Token.address)
|
||||
// .then(res => res.wait()).catch(handleError);
|
||||
// await contracts.Contributor
|
||||
// .setContributionContract(contracts.Contribution.address)
|
||||
// .then(res => res.wait()).catch(handleError);
|
||||
//
|
||||
// await contracts.Contribution
|
||||
// .setTokenContract(contracts.Token.address)
|
||||
// .then(res => res.wait()).catch(handleError);
|
||||
// await contracts.Contribution
|
||||
// .setContributorContract(contracts.Contributor.address)
|
||||
// .then(res => res.wait()).catch(handleError);
|
||||
|
||||
console.log('Calling Contributor#setContributionContract')
|
||||
await contracts.Contributor.functions
|
||||
.setContributionContract(contracts.Contribution.address)
|
||||
.then(res => {
|
||||
console.log(`...transaction published: ${res.hash}`);
|
||||
return res.wait();
|
||||
}).catch(handleError);
|
||||
// await contracts.Token
|
||||
// .setContributionContract(contracts.Contribution.address)
|
||||
// .then(res => res.wait()).catch(handleError);
|
||||
await contracts.Token
|
||||
// .setContributorContract(contracts.Contributor.address)
|
||||
.setContributorContract('0xEb4100b5939E243f69873A8E463eDa0aE84e43E8')
|
||||
.then(res => res.wait()).catch(handleError);
|
||||
|
||||
|
||||
console.log('Calling Contribution#setTokenContract')
|
||||
await contracts.Contribution.functions
|
||||
.setTokenContract(contracts.Token.address)
|
||||
.then(res => {
|
||||
console.log(`...transaction published: ${res.hash}`);
|
||||
return res.wait();
|
||||
}).catch(handleError);
|
||||
|
||||
|
||||
console.log('Calling Contribution#setContributorContract')
|
||||
await contracts.Contribution.functions
|
||||
.setContributorContract(contracts.Contributor.address)
|
||||
.then(res => {
|
||||
console.log(`...transaction published: ${res.hash}`);
|
||||
return res.wait();
|
||||
}).catch(handleError);
|
||||
|
||||
console.log('Calling Token#setContributionContract')
|
||||
await contracts.Token.functions
|
||||
.setContributionContract(contracts.Contribution.address)
|
||||
.then(res => {
|
||||
console.log(`...transaction published: ${res.hash}`);
|
||||
return res.wait();
|
||||
}).catch(handleError);
|
||||
|
||||
console.log('Calling Token#setContributorContract')
|
||||
await contracts.Token.functions
|
||||
.setContributorContract(contracts.Contributor.address)
|
||||
.then(res => {
|
||||
console.log(`...transaction published: ${res.hash}`);
|
||||
return res.wait();
|
||||
}).catch(handleError);
|
||||
|
||||
console.log('Calling Reimbursement#setContributorContract')
|
||||
await contracts.Reimbursement.functions
|
||||
.setContributorContract(contracts.Contributor.address)
|
||||
.then(res => {
|
||||
console.log(`...transaction published: ${res.hash}`);
|
||||
return res.wait();
|
||||
}).catch(handleError);
|
||||
// await contracts.Reimbursement
|
||||
// .setContributorContract(contracts.Contributor.address)
|
||||
// .then(res => res.wait()).catch(handleError);
|
||||
|
||||
const addresses = {
|
||||
Contributor: contracts.Contributor.address,
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
const Kredits = require('../../lib/kredits');
|
||||
|
||||
async function main() {
|
||||
kredits = new Kredits(hre.ethers.provider, hre.ethers.provider.getSigner())
|
||||
await kredits.init();
|
||||
|
||||
console.log(`Using Contribution at: ${kredits.Contribution.contract.address}`);
|
||||
|
||||
const count = await kredits.Contribution.count;
|
||||
const currentBlockHeight = await XMLHttpRequest.ethers.provider.getBlockNumber();
|
||||
|
||||
const backup = {};
|
||||
const promises = [];
|
||||
for (let i = 1; i <= count; i++) {
|
||||
promises.push(new Promise((resolve, reject) => {
|
||||
setTimeout(async () => {
|
||||
console.log(`Loading contribution #${i}`);
|
||||
await kredits.Contribution.contract.getContribution(i).then(contractData => {
|
||||
backup[i] = {
|
||||
amount: contractData.amount,
|
||||
contributorId: contractData.contributorId,
|
||||
hashDigest: contractData.hashDigest,
|
||||
hashFunction: contractData.hashFunction,
|
||||
hashSize: contractData.hashSize,
|
||||
confirmedAtBlock: contractData.confirmedAtBlock,
|
||||
confirmed: contractData.confirmedAtBlock <= currentBlockHeight,
|
||||
vetoed: contractData.vetoed,
|
||||
id: contractData.id,
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}, 100 * i);
|
||||
}));
|
||||
}
|
||||
|
||||
await Promise.all(promises).then(() => {
|
||||
fs.writeFileSync("./data/contributions.json", JSON.stringify(backup, null, 2));
|
||||
console.log("Exported");
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -1,38 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const Kredits = require('../../lib/kredits');
|
||||
|
||||
async function main() {
|
||||
kredits = new Kredits(hre.ethers.provider, hre.ethers.provider.getSigner())
|
||||
await kredits.init();
|
||||
|
||||
console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`);
|
||||
|
||||
const count = await kredits.Contributor.count;
|
||||
|
||||
const backup = {};
|
||||
const promises = [];
|
||||
for (let i = 1; i <= count; i++) {
|
||||
promises.push(new Promise((resolve, reject) => {
|
||||
setTimeout(async () => {
|
||||
console.log(`Loading contributor #${i}`);
|
||||
await kredits.Contributor.contract.getContributorById(i).then(contractData => {
|
||||
backup[i] = {
|
||||
account: contractData.account,
|
||||
hashDigest: contractData.hashDigest,
|
||||
hashFunction: contractData.hashFunction,
|
||||
hashSize: contractData.hashSize,
|
||||
id: contractData.id,
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}, 100 * i);
|
||||
}));
|
||||
}
|
||||
|
||||
await Promise.all(promises).then(() => {
|
||||
fs.writeFileSync("./data/contributors.json", JSON.stringify(backup, null, 2));
|
||||
console.log("Exported");
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -1,33 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const Kredits = require('../../lib/kredits');
|
||||
|
||||
async function main() {
|
||||
kredits = new Kredits(hre.ethers.provider, hre.ethers.provider.getSigner())
|
||||
await kredits.init();
|
||||
|
||||
console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`);
|
||||
|
||||
try {
|
||||
const data = fs.readFileSync("./data/contributors.json");
|
||||
const contributors = JSON.parse(data);
|
||||
const ids = Object.keys(contributors)
|
||||
.map(k => parseInt(k))
|
||||
.sort(function(a, b){return a-b});
|
||||
|
||||
for (const contributorId of ids) {
|
||||
const contributor = contributors[contributorId.toString()];
|
||||
const result = await kredits.Contributor.contract.addContributor(
|
||||
contributor.account,
|
||||
contributor.hashDigest,
|
||||
contributor.hashFunction,
|
||||
contributor.hashSize,
|
||||
);
|
||||
// await result.wait();
|
||||
console.log(`Added contributor #${contributorId}: ${result.hash}`);
|
||||
};
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -1,19 +0,0 @@
|
||||
const { expect } = require("chai");
|
||||
const { ethers, upgrades } = require("hardhat");
|
||||
let hardhatContribution;
|
||||
|
||||
describe("Contribution contract", function () {
|
||||
|
||||
describe("Deployment", function () {
|
||||
before(async function () {
|
||||
// const [owner] = await ethers.getSigners();
|
||||
const Contribution = await ethers.getContractFactory("Contribution");
|
||||
hardhatContribution = await upgrades.deployProxy(Contribution, [40321]);
|
||||
});
|
||||
|
||||
it("sets the veto confirmation period", async function () {
|
||||
expect(await hardhatContribution.blocksToWait()).to.equal(40321);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user