Skip to content

Commit

Permalink
Merge pull request #49 from kleros/feat/terms-of-service
Browse files Browse the repository at this point in the history
fix(HomeProxy): add terms of service
  • Loading branch information
unknownunknown1 authored Oct 30, 2024
2 parents bd26eaa + 8474f50 commit 463e5a9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
4 changes: 3 additions & 1 deletion contracts/deploy/01-home-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const paramsByChainId = {
foreignChainId: 1,
},
};
const metadata =
'{"tos":"ipfs://QmPmRkXFUmzP4rq2YfD3wNwL8bg3WDxkYuvTP9A9UZm9gJ/seer-markets-resolution-policy.pdf", "foreignProxy":true}';

async function deployHomeProxy({ deployments, getNamedAccounts, getChainId, ethers, config }) {
const { deploy } = deployments;
Expand Down Expand Up @@ -40,7 +42,7 @@ async function deployHomeProxy({ deployments, getNamedAccounts, getChainId, ethe
const homeProxy = await deploy("RealitioHomeArbitrationProxy", {
from: deployer,
gas: 8000000,
args: [amb, foreignProxyAddress, foreignChainIdAsBytes32, realitio],
args: [amb, foreignProxyAddress, foreignChainIdAsBytes32, realitio, metadata],
});

console.log("Home Proxy:", homeProxy.address);
Expand Down
7 changes: 7 additions & 0 deletions contracts/src/ArbitrationProxyInterfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ interface IHomeArbitrationProxy {
* @param _answer The answer from the arbitrator.
*/
function receiveArbitrationAnswer(bytes32 _questionID, bytes32 _answer) external;

/** @notice Provides a string of json-encoded metadata with the following properties:
- tos: A URI representing the location of a terms-of-service document for the arbitrator.
- template_hashes: An array of hashes of templates supported by the arbitrator. If you have a numerical ID for a template registered with Reality.eth, you can look up this hash by calling the Reality.eth template_hashes() function.
* @dev Template_hashes won't be used by this home proxy.
*/
function metadata() external view returns (string calldata);
}

interface IForeignArbitrationProxy is IArbitrable, IEvidence {
Expand Down
7 changes: 5 additions & 2 deletions contracts/src/RealitioHomeArbitrationProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contract RealitioHomeArbitrationProxy is IHomeArbitrationProxy {
bytes32 public immutable foreignChainId;

/// @dev Metadata for Realitio interface.
string public constant metadata = '{"foreignProxy":true}';
string public override metadata;

enum Status {
None,
Expand Down Expand Up @@ -67,17 +67,20 @@ contract RealitioHomeArbitrationProxy is IHomeArbitrationProxy {
* @param _foreignProxy The address of the proxy.
* @param _foreignChainId The ID of the chain where the foreign proxy is deployed.
* @param _realitio Realitio contract address.
* @param _metadata Metadata for Realitio.
*/
constructor(
IAMB _amb,
address _foreignProxy,
bytes32 _foreignChainId,
RealitioInterface _realitio
RealitioInterface _realitio,
string memory _metadata
) {
amb = _amb;
foreignProxy = _foreignProxy;
foreignChainId = _foreignChainId;
realitio = _realitio;
metadata = _metadata;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/CrossChainArbitrationProxy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ describe("Cross-Chain Arbitration", () => {
termsOfService
);

const homeProxy = await HomeProxy.deploy(amb.address, foreignProxyAddress, foreignChainId, realitio.address);
const homeProxy = await HomeProxy.deploy(amb.address, foreignProxyAddress, foreignChainId, realitio.address, termsOfService);

return {
amb,
Expand Down
3 changes: 2 additions & 1 deletion contracts/test/ForeignProxyWithAppeals.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe("Cross-chain arbitration with appeals", () => {
expect(await foreignProxy.homeProxy()).to.equal(homeProxy.address);
expect(await foreignProxy.homeChainId()).to.equal(homeChainId);
expect(await foreignProxy.termsOfService()).to.equal(termsOfService);
expect(await homeProxy.metadata()).to.equal(termsOfService);

// 0 - winner, 1 - loser, 2 - loserAppealPeriod.
const multipliers = await foreignProxy.getMultipliers();
Expand Down Expand Up @@ -717,7 +718,7 @@ describe("Cross-chain arbitration with appeals", () => {
loserAppealPeriodMultiplier
);

const homeProxy = await HomeProxy.deploy(amb.address, foreignProxyAddress, foreignChainId, realitio.address);
const homeProxy = await HomeProxy.deploy(amb.address, foreignProxyAddress, foreignChainId, realitio.address, termsOfService);

return {
amb,
Expand Down

0 comments on commit 463e5a9

Please sign in to comment.