diff --git a/contracts/deploy/01-home-proxy.js b/contracts/deploy/01-home-proxy.js index d98ec43..c2472d0 100644 --- a/contracts/deploy/01-home-proxy.js +++ b/contracts/deploy/01-home-proxy.js @@ -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; @@ -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); diff --git a/contracts/src/ArbitrationProxyInterfaces.sol b/contracts/src/ArbitrationProxyInterfaces.sol index 81791a8..b691bfd 100644 --- a/contracts/src/ArbitrationProxyInterfaces.sol +++ b/contracts/src/ArbitrationProxyInterfaces.sol @@ -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 { diff --git a/contracts/src/RealitioHomeArbitrationProxy.sol b/contracts/src/RealitioHomeArbitrationProxy.sol index 5456a97..580dcf2 100644 --- a/contracts/src/RealitioHomeArbitrationProxy.sol +++ b/contracts/src/RealitioHomeArbitrationProxy.sol @@ -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, @@ -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; } /** diff --git a/contracts/test/CrossChainArbitrationProxy.test.js b/contracts/test/CrossChainArbitrationProxy.test.js index 11b01af..cc4a227 100644 --- a/contracts/test/CrossChainArbitrationProxy.test.js +++ b/contracts/test/CrossChainArbitrationProxy.test.js @@ -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, diff --git a/contracts/test/ForeignProxyWithAppeals.js b/contracts/test/ForeignProxyWithAppeals.js index db1feae..9bf143b 100644 --- a/contracts/test/ForeignProxyWithAppeals.js +++ b/contracts/test/ForeignProxyWithAppeals.js @@ -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(); @@ -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,