Skip to content

Commit

Permalink
Merge pull request #68 from Params10/master
Browse files Browse the repository at this point in the history
Added hardhat-deploy support and updated few packages.
  • Loading branch information
greenlucid committed Dec 12, 2022
2 parents 0593720 + 5ed82d7 commit 72e547e
Show file tree
Hide file tree
Showing 17 changed files with 10,471 additions and 5,958 deletions.
16 changes: 16 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#for deployment
PRIVATE_KEY_GOVERNOR=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
PRIVATE_KEY_REQUESTER=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1

#for deployment + testing add these keys as well
PRIVATE_KEY_CHALLENGER=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
PRIVATE_KEY_GOVERNOR2=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
PRIVATE_KEY_OTHER=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
PRIVATE_KEY_DEPLOYER=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1

#for verification of contracts
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
INFURA_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1

#For polygon add
POLYGONSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Contracts for creating arbitrable permission lists on Ethereum.
## Development

1. Clone this repo.
2. Run `yarn` to install dependencies and then `yarn build` to compile the contracts.
2. Run `yarn install` to install dependencies and then `yarn build` to compile the contracts.

## Release

Expand All @@ -39,6 +39,18 @@ To bump the version of the package, use `yarn release`.
Testrpc default gas limit is lower than the mainnet which prevents deploying some contracts. Before running truffle tests use:
`testrpc -l 8000000`.

## Testing contracts

- Run `npx hardhat compile` to compile the contracts.
- Run `npx hardhat test` to run all test cases in test folder.
- Run `npx hardhat test <location of test file>` to run the test cases for specific contract.

## Testing contracts on specific network

- Run `npx hardhat test --network <network name in hardhat.config.js>` to run all test cases in test folder.
- Run `npx hardhat test <location of test file> --network <network name in hardhat.config.js>` to run the test cases for specific contract.
- Add private keys for the roles needed to test the contracts according to hardhat.config.js.

## Contributing

See [contributing](https://kleros.gitbook.io/contributing-md/).
Expand Down
58 changes: 58 additions & 0 deletions deploy/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy } = deployments;
const { deployer, governor } = await getNamedAccounts();
const arbitratorExtraData = "0x85";
const arbitrationCost = 1000;
const appealTimeOut = 180;

// the following will deploy "EnhancedAppealableArbitrator" if the contract was never deployed or if the code changed since last deployment
const EnhancedArbitrator = await deploy("EnhancedAppealableArbitrator", {
from: governor,
args: [arbitrationCost, governor, arbitratorExtraData, appealTimeOut],
});
console.log(EnhancedArbitrator.address, "EnhancedAppealableArbitrator");
const GTCRFactory = await deploy("GTCRFactory", {
from: deployer,
args: [],
});

console.log(GTCRFactory.address, "GTCRFactory address");
const LGTCR = await deploy("LightGeneralizedTCR", {
from: deployer,
args: [],
});
console.log(LGTCR.address, "address of LGTCR");
const LGTCRFactory = await deploy("LightGTCRFactory", {
from: deployer,
args: [LGTCR.address],
});
const RelayMock = await deploy("RelayMock", {
from: governor,
args: [],
});
console.log(RelayMock.address, "address of RelayMock");
console.log(LGTCRFactory.address, "address of LGTCR factory");
const LightGeneralizedTCRView = await deploy("LightGeneralizedTCRView", {
from: governor,
args: [],
});
console.log(LightGeneralizedTCRView.address, "address of LightGeneralizedTCRView");

const GeneralizedTCRView = await deploy("GeneralizedTCRView", {
from: governor,
args: [],
});
console.log(GeneralizedTCRView.address, "address of GeneralizedTCRView");

const BatchWithdraw = await deploy("BatchWithdraw", {
from: governor,
args: [],
});
console.log(BatchWithdraw.address, "address of BatchWithdraw");
const LBatchWithdraw = await deploy("LightBatchWithdraw", {
from: governor,
args: [],
});
console.log(LBatchWithdraw.address, "address of LightBatchWithdraw");
};
module.exports.tags = ["gtcrContracts"];
1 change: 1 addition & 0 deletions deployments/goerli/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
1 change: 1 addition & 0 deletions deployments/mainnet/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
90 changes: 90 additions & 0 deletions deployments/mainnet/BatchWithdraw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"address": "0x38aA214Dc986d0bAB53E5861071f3d5a56066b4D",
"abi": [
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_address",
"type": "address"
},
{
"internalType": "address payable",
"name": "_contributor",
"type": "address"
},
{
"internalType": "bytes32",
"name": "_itemID",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "_cursor",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_count",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_roundCursor",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_roundCount",
"type": "uint256"
}
],
"name": "batchRequestWithdraw",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "_address",
"type": "address"
},
{
"internalType": "address payable",
"name": "_contributor",
"type": "address"
},
{
"internalType": "bytes32",
"name": "_itemID",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "_request",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_cursor",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_count",
"type": "uint256"
}
],
"name": "batchRoundWithdraw",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
]
}
Loading

0 comments on commit 72e547e

Please sign in to comment.