Skip to content

Feat/kleros liquid proxy #11

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

Merged
merged 11 commits into from
Jan 17, 2022
Next Next commit
refactor: add kleros v1 governor proxy
  • Loading branch information
fnanni-0 committed Dec 27, 2021
commit 429799ceec11e50442b0ed86f3bfaed06c94321e
13 changes: 9 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
## 0.1.0 (2021-12-17)
## 0.1.0 (2021-12-27)

- refactor: add arbitrator data index getter ([47a1623](https://github.com/kleros/kleros-v2/commit/47a1623))
- refactor: add evidence contracts ([09a34f3](https://github.com/kleros/kleros-v2/commit/09a34f3))
- refactor: add interfaces + capped math ([e25b21f](https://github.com/kleros/kleros-v2/commit/e25b21f))
- refactor: add simple evidence home contract ([1b82f62](https://github.com/kleros/kleros-v2/commit/1b82f62))
- refactor: fix contract name ([6eb744a](https://github.com/kleros/kleros-v2/commit/6eb744a))
- refactor: remove foreign evidence interface ([ff8c50c](https://github.com/kleros/kleros-v2/commit/ff8c50c))
- refactor(bridge): use ArbRetryableTx#getSubmissionPrice ([61bc2f3](https://github.com/kleros/kleros-v2/commit/61bc2f3))
- refactor(sdk): rename ([3241d10](https://github.com/kleros/kleros-v2/commit/3241d10))
- test: add evidence contract tests ([590d800](https://github.com/kleros/kleros-v2/commit/590d800))
- test: added a test for IncrementalNG ([65a996b](https://github.com/kleros/kleros-v2/commit/65a996b))
- test(EvidenceModule): add test file ([9f00f98](https://github.com/kleros/kleros-v2/commit/9f00f98))
- chore: .gitignore ([0ed4d74](https://github.com/kleros/kleros-v2/commit/0ed4d74))
- chore: .gitignore and removal of unnecessary yarn cache as we are using "zero installs" ([a6cfdd0](https://github.com/kleros/kleros-v2/commit/a6cfdd0))
- chore: added GitHub code scanning ([4a70475](https://github.com/kleros/kleros-v2/commit/4a70475))
- chore: added the hardhat config for layer 2 networks, added hardhat-deploy and mocha ([a12ea0e](https://github.com/kleros/kleros-v2/commit/a12ea0e))
- chore: gitignore typechain ([b50f777](https://github.com/kleros/kleros-v2/commit/b50f777))
- chore(typechain): clean generated files ([775ddd0](https://github.com/kleros/kleros-v2/commit/775ddd0))
- test: add evidence contract tests ([590d800](https://github.com/kleros/kleros-v2/commit/590d800))
- test: added a test for IncrementalNG ([65a996b](https://github.com/kleros/kleros-v2/commit/65a996b))
- test(EvidenceModule): add test file ([9f00f98](https://github.com/kleros/kleros-v2/commit/9f00f98))
- fix: according to evidence standard + comments ([5c95828](https://github.com/kleros/kleros-v2/commit/5c95828))
- fix: unused code ([26b5dc3](https://github.com/kleros/kleros-v2/commit/26b5dc3))
- fix(Arbitrator): memory to calldata ([4770b1f](https://github.com/kleros/kleros-v2/commit/4770b1f))
Expand All @@ -22,6 +25,8 @@
- fix(IArbitrator): change name to arbitration cost ([0ba4f29](https://github.com/kleros/kleros-v2/commit/0ba4f29))
- fix(IArbitrator): interface simplification ([e81fb8b](https://github.com/kleros/kleros-v2/commit/e81fb8b))
- fix(IArbitrator): replaced appealCost with fundingStatus ([f189dd9](https://github.com/kleros/kleros-v2/commit/f189dd9))
- feat: add arbitrum L1 bridge and dependencies ([b412772](https://github.com/kleros/kleros-v2/commit/b412772))
- feat: add arbitrum L2 bridge ([457b060](https://github.com/kleros/kleros-v2/commit/457b060))
- feat: modern toolchain setup and simple RNG smart contracts ([17f6a76](https://github.com/kleros/kleros-v2/commit/17f6a76))
- feat(Arbitration): standard update ([ed930de](https://github.com/kleros/kleros-v2/commit/ed930de))
- docs: initial commit ([23356e7](https://github.com/kleros/kleros-v2/commit/23356e7))
Expand Down
92 changes: 92 additions & 0 deletions contracts/src/kleros-v1/IKlerosLiquid.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
pragma solidity ^0.8;

import "../arbitration/IArbitrator.sol";

interface IKlerosLiquid is IArbitrator {
enum Period {
evidence, // Evidence can be submitted. This is also when drawing has to take place.
commit, // Jurors commit a hashed vote. This is skipped for courts without hidden votes.
vote, // Jurors reveal/cast their vote depending on whether the court has hidden votes or not.
appeal, // The dispute can be appealed.
execution // Tokens are redistributed and the ruling is executed.
}

struct Dispute {
// Note that appeal `0` is equivalent to the first round of the dispute.
uint96 subcourtID; // The ID of the subcourt the dispute is in.
address arbitrated; // The arbitrated arbitrable contract.
// The number of choices jurors have when voting. This does not include choice `0` which is reserved for "refuse to arbitrate"/"no ruling".
uint256 numberOfChoices;
Period period; // The current period of the dispute.
uint256 lastPeriodChange; // The last time the period was changed.
uint256 drawsInRound; // A counter of draws made in the current round.
uint256 commitsInRound; // A counter of commits made in the current round.
bool ruled; // True if the ruling has been executed, false otherwise.
}
struct Juror {
uint256 stakedTokens; // The juror's total amount of tokens staked in subcourts.
uint256 lockedTokens; // The juror's total amount of tokens locked in disputes.
}

function lockInsolventTransfers() external view returns (bool);

function pinakion() external view returns (address);

function disputes(uint256 _index) external view returns (Dispute memory);

function jurors(address _account) external view returns (Juror memory);

function passPeriod(uint256 _disputeID) external;

function drawJurors(uint256 _disputeID, uint256 _iterations) external;

function execute(
uint256 _disputeID,
uint256 _appeal,
uint256 _iterations
) external;

function changeSubcourtMinStake(uint96 _subcourtID, uint256 _minStake) external;

function changeSubcourtAlpha(uint96 _subcourtID, uint256 _alpha) external;

function changeSubcourtTimesPerPeriod(uint96 _subcourtID, uint256[4] calldata _timesPerPeriod) external;

function executeGovernorProposal(
address _destination,
uint256 _amount,
bytes calldata _data
) external;

// Getters
function getVote(
uint256 _disputeID,
uint256 _appeal,
uint256 _voteID
)
external
view
returns (
address account,
bytes32 commit,
uint256 choice,
bool voted
);

function getDispute(uint256 _disputeID)
external
view
returns (
uint256[] memory votesLengths,
uint256[] memory tokensAtStakePerJuror,
uint256[] memory totalFeesForJurors,
uint256[] memory votesInEachRound,
uint256[] memory repartitionsInEachRound,
uint256[] memory penaltiesInEachRound
);

function getSubcourt(uint96 _subcourtID)
external
view
returns (uint256[] memory children, uint256[4] memory timesPerPeriod);
}
33 changes: 33 additions & 0 deletions contracts/src/kleros-v1/ITokenController.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pragma solidity ^0.8;

/// @dev The token controller contract must implement these functions. See https://github.com/Giveth/minime/blob/master/contracts/TokenController.sol
interface ITokenController {
/// @notice Called when `_owner` sends ether to the MiniMe Token contract
/// @param _owner The address that sent the ether to create tokens
/// @return True if the ether is accepted, false if it throws
function proxyPayment(address _owner) external payable returns (bool);

/// @notice Notifies the controller about a token transfer allowing the
/// controller to react if desired
/// @param _from The origin of the transfer
/// @param _to The destination of the transfer
/// @param _amount The amount of the transfer
/// @return False if the controller does not authorize the transfer
function onTransfer(
address _from,
address _to,
uint256 _amount
) external returns (bool);

/// @notice Notifies the controller about an approval allowing the
/// controller to react if desired
/// @param _owner The address that calls `approve()`
/// @param _spender The spender in the `approve()` call
/// @param _amount The amount in the `approve()` call
/// @return False if the controller does not authorize the approval
function onApprove(
address _owner,
address _spender,
uint256 _amount
) external returns (bool);
}
Loading