In futarchy markets, participants trade based on their expectations of how specific decisions will impact the price of a token.
We could have a market asking Will proposal "GIP-120: Should GnosisDAO acquire Headquarters (HQ.xyz) to Accelerate Gnosis 3.0" be accepted by February 1 2025, 00:00 UTC?
You can refer to this Hardhat test for a usage example
Create a futarchy market
To create a futarchy market, call FutarchyFactory.createProposal with the correct parameters:
await futarchy.createProposal({
marketName: `Will proposal "GIP-120: Should GnosisDAO acquire Headquarters (HQ.xyz) to Accelerate Gnosis 3.0" be accepted by February 1 2025, 00:00 UTC?`,
category: "misc",
lang: "en_US",
collateralToken1: GNO_ADDRESS,
collateralToken2: wstETH_ADDRESS,
minBond: 1e18, // Reality.eth minimum bond that may be used for an answer
openingTime: 1767139200, //2025-12-31T00:00:00.000Z
})
Split, merge and redeem a conditional market
To interact with futarchy markets, we use the FutarchyRouter , a specialized version of the Router designed specifically to work with futarchy proposals. All the concepts related to wrapping ERC1155 tokens into ERC20 tokens and other processes explained for standard markets also apply here.
Splitting
await collateralToken.approve(futarchyRouter, 1e18); // allow the router to spend your collateral tokens
await futarchyRouter.splitPosition(
futarchyProposal, // proposal address
collateralToken, // e.g.: GNO or wstETH
1e18, // split amount
);
Merging
await yesOutcome.approve(futarchyRouter, 1e18); // allow the router to spend your yes tokens
await noOutcome.approve(futarchyRouter, 1e18); // allow the router to spend your no tokens
await futarchyRouter.mergePosition(
futarchyProposal, // proposal address
collateralToken, // e.g.: GNO or wstETH
1e18, // merge amount
);
Redeeming
// redeemPositions can redeem only one collateral token
await yesOutcomeGNO.approve(futarchyRouter, 1e18); // allow the router to spend your yes tokens
await router.redeemPositions(
futarchyProposal, // proposal address
yesOutcomeGNO, // token to redeem
1e18, // amount to redeem
);
// redeemProposal can redeem one or both collateral tokens, so you must approve the specific token(s) you intend to redeem
await yesOutcomeGNO.approve(futarchyRouter, 1e18);
await yesOutcomeWSTETH.approve(futarchyRouter, 0.1e18);
await router.redeemProposal(
futarchyProposal, // proposal address
1e18, // amount of token underlying to redeem
0.1e18, // amount of currency underlying to redeem
);