├── .eslintignore ├── src ├── matic │ ├── index.ts │ └── withdraw.ts ├── adapter │ ├── index.ts │ └── initialize.ts ├── debt │ ├── index.ts │ ├── takeOn.ts │ └── pay.ts ├── conditionalTokens │ ├── index.ts │ ├── redeem.ts │ ├── merge.ts │ └── split.ts ├── types.ts ├── markets │ ├── index.ts │ ├── removeFunding.ts │ ├── addLiquidityRequest.ts │ ├── addFunding.ts │ ├── buy.ts │ ├── sell.ts │ └── safeAddFunding.ts ├── index.ts ├── utils │ ├── transferEth.ts │ ├── index.ts │ ├── getMarketIndex.ts │ ├── getIndexSet.ts │ ├── approveErc1155.ts │ ├── approveErc20.ts │ └── transferErc20.ts ├── negRisk │ └── index.ts ├── abi │ ├── LiquidityRequestLog.json │ ├── ERC20.json │ ├── ERC1155.json │ ├── FixedProductMarketMaker.json │ ├── ConditionalTokens.json │ ├── NegRiskAdapter.json │ ├── UmaCtfAdapter.json │ └── NegRiskUmaCtfAdapter.json └── proxyWallet.ts ├── .gitignore ├── .commitlintrc.js ├── tsconfig.production.json ├── .lintstagedrc.js ├── .prettierrc ├── .npmignore ├── jest.config.js ├── tsconfig.json ├── .eslintrc.js ├── test ├── getIndexSet.test.ts ├── getMarketIndex.test.ts └── proxywallet_address.ts ├── LICENSE └── package.json /.eslintignore: -------------------------------------------------------------------------------- 1 | # folders 2 | lib/ 3 | node_modules/ 4 | src/abi 5 | -------------------------------------------------------------------------------- /src/matic/index.ts: -------------------------------------------------------------------------------- 1 | export { withdrawFundsOnMatic } from "./withdraw"; 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # folders 2 | node_modules/ 3 | lib 4 | 5 | *.log 6 | *.tgz 7 | .idea 8 | -------------------------------------------------------------------------------- /src/adapter/index.ts: -------------------------------------------------------------------------------- 1 | export { initialize, negRiskInitialize } from "./initialize"; 2 | -------------------------------------------------------------------------------- /.commitlintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ["@commitlint/config-conventional"], 3 | }; 4 | -------------------------------------------------------------------------------- /src/debt/index.ts: -------------------------------------------------------------------------------- 1 | export { takeOnDebt } from "./takeOn"; 2 | export { payDebt } from "./pay"; 3 | -------------------------------------------------------------------------------- /tsconfig.production.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["test"] 4 | } 5 | -------------------------------------------------------------------------------- /.lintstagedrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "*.ts": ["eslint --fix"], 3 | "*.tsx": ["eslint --fix"], 4 | }; 5 | -------------------------------------------------------------------------------- /src/conditionalTokens/index.ts: -------------------------------------------------------------------------------- 1 | export { mergePositions } from "./merge"; 2 | export { redeemPositions } from "./redeem"; 3 | export { splitPosition } from "./split"; 4 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "printWidth": 120, 5 | "singleQuote": false, 6 | "tabWidth": 2, 7 | "trailingComma": "all" 8 | } 9 | -------------------------------------------------------------------------------- /src/types.ts: -------------------------------------------------------------------------------- 1 | export enum CallType { 2 | Invalid = "0", 3 | Call = "1", 4 | DelegateCall = "2", 5 | } 6 | 7 | export interface Transaction { 8 | to: string; 9 | typeCode: CallType; 10 | data: string; 11 | value: string; 12 | } 13 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | #folders 2 | src 3 | test 4 | 5 | #files 6 | .commitlintrc.js 7 | .eslintignore 8 | .eslintrc.js 9 | .gitignore 10 | .lintstagedrc.js 11 | .prettierrc 12 | jest.config.js 13 | tsconfig.json 14 | tsconfig.production.json 15 | yarn.lock 16 | 17 | *.log 18 | *.tgz -------------------------------------------------------------------------------- /src/markets/index.ts: -------------------------------------------------------------------------------- 1 | export { buyMarketOutcome } from "./buy"; 2 | export { sellMarketOutcome } from "./sell"; 3 | export { addFundingToMarket } from "./addFunding"; 4 | export { removeFundingFromMarket } from "./removeFunding"; 5 | export { safeAddFundingToMarket } from "./safeAddFunding"; 6 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | collectCoverageFrom: ["/src/**/*.ts", "!/src/**/*.d.ts"], 3 | coveragePathIgnorePatterns: ["node_modules"], 4 | coverageReporters: ["lcov", "html"], 5 | preset: "ts-jest", 6 | testEnvironment: "node", 7 | testMatch: ["**/test/**/*.ts"], 8 | }; 9 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./conditionalTokens"; 2 | export * from "./matic"; 3 | export * from "./markets"; 4 | export * from "./debt"; 5 | 6 | export { ethTransferTransaction, erc20TransferTransaction, getIndexSet, getMarketIndex } from "./utils"; 7 | export { getProxyWalletAddress } from "./proxyWallet"; 8 | export { negRiskOperations } from "./negRisk"; 9 | -------------------------------------------------------------------------------- /src/utils/transferEth.ts: -------------------------------------------------------------------------------- 1 | import { BigNumberish } from "@ethersproject/bignumber"; 2 | import { CallType, Transaction } from "../types"; 3 | 4 | export const ethTransferTransaction = (recipient: string, amount: BigNumberish): Transaction => ({ 5 | to: recipient, 6 | typeCode: CallType.Call, 7 | data: "0x", 8 | value: amount.toString(), 9 | }); 10 | -------------------------------------------------------------------------------- /src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export { erc20ApprovalTransaction } from "./approveErc20"; 2 | export { erc1155ApprovalTransaction } from "./approveErc1155"; 3 | export { erc20TransferTransaction } from "./transferErc20"; 4 | export { ethTransferTransaction } from "./transferEth"; 5 | export { getIndexSet } from "./getIndexSet"; 6 | export { getMarketIndex } from "./getMarketIndex"; 7 | -------------------------------------------------------------------------------- /src/utils/getMarketIndex.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Gets the index of a neg-risk market index from the questionId. 3 | * @remarks 4 | * The last byte of the questionId contains the index of the neg-risk market. 5 | * @param questionId The questionId of the neg-risk market. 6 | * @returns The index of the neg-risk market. 7 | */ 8 | const getMarketIndex = (questionId: string): number => parseInt(questionId.slice(-2), 16); 9 | 10 | export { getMarketIndex }; 11 | -------------------------------------------------------------------------------- /src/utils/getIndexSet.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Gets the index set corresponding to an array of market indices using BigInt. 3 | * This version supports indices up to 100 (or more) by utilizing BigInt arithmetic. 4 | * @param indices An array of market indices. 5 | * @returns The corresponding index set as a BigInt. 6 | */ 7 | const getIndexSet = (indices: number[]): bigint => 8 | [...new Set(indices)].reduce((acc, index) => acc + (1n << BigInt(index)), 0n); 9 | 10 | export { getIndexSet }; 11 | -------------------------------------------------------------------------------- /src/utils/approveErc1155.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import ERC1155ABI from "../abi/ERC1155.json"; 3 | import { CallType, Transaction } from "../types"; 4 | 5 | const encodeTokenApproval = (approvedAddress: string, approval: boolean): string => 6 | new Interface(ERC1155ABI).encodeFunctionData("setApprovalForAll(address,bool)", [approvedAddress, approval]); 7 | 8 | export const erc1155ApprovalTransaction = (tokenAddress: string, spender: string, approval: boolean): Transaction => ({ 9 | to: tokenAddress, 10 | typeCode: CallType.Call, 11 | data: encodeTokenApproval(spender, approval), 12 | value: "0", 13 | }); 14 | -------------------------------------------------------------------------------- /src/utils/approveErc20.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import ERC20ABI from "../abi/ERC20.json"; 4 | import { CallType, Transaction } from "../types"; 5 | 6 | const encodeTokenApproval = (approvedAddress: string, approvalAmount: BigNumberish): string => 7 | new Interface(ERC20ABI).encodeFunctionData("approve(address,uint256)", [approvedAddress, approvalAmount]); 8 | 9 | export const erc20ApprovalTransaction = (tokenAddress: string, spender: string, amount: BigNumberish): Transaction => ({ 10 | to: tokenAddress, 11 | typeCode: CallType.Call, 12 | data: encodeTokenApproval(spender, amount), 13 | value: "0", 14 | }); 15 | -------------------------------------------------------------------------------- /src/utils/transferErc20.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import ERC20ABI from "../abi/ERC20.json"; 4 | import { CallType, Transaction } from "../types"; 5 | 6 | const encodeTokenTransfer = (recipientAddress: string, amount: BigNumberish): string => 7 | new Interface(ERC20ABI).encodeFunctionData("transfer(address,uint256)", [recipientAddress, amount]); 8 | 9 | export const erc20TransferTransaction = ( 10 | tokenAddress: string, 11 | recipient: string, 12 | amount: BigNumberish, 13 | ): Transaction => ({ 14 | to: tokenAddress, 15 | typeCode: CallType.Call, 16 | data: encodeTokenTransfer(recipient, amount), 17 | value: "0", 18 | }); 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "commonjs", 5 | "outDir": "lib", 6 | "lib": ["dom"], 7 | "sourceMap": false, 8 | "allowJs": false, 9 | "declaration": true, 10 | "declarationDir": "lib", 11 | "moduleResolution": "node", 12 | "forceConsistentCasingInFileNames": true, 13 | "allowSyntheticDefaultImports": true, 14 | "downlevelIteration": true, 15 | "esModuleInterop": true, 16 | "isolatedModules": true, 17 | "noImplicitAny": true, 18 | "skipLibCheck": true, 19 | "strict": true, 20 | "resolveJsonModule": true 21 | }, 22 | "include": ["src", "test", "jest.config.js"], 23 | "exclude": ["node_modules", "lib"] 24 | } 25 | -------------------------------------------------------------------------------- /src/matic/withdraw.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import { CallType, Transaction } from "../types"; 4 | 5 | const encodeWithdraw = (withdrawAmount: BigNumberish): string => 6 | new Interface(["function withdraw(uint256)"]).encodeFunctionData("withdraw(uint256)", [withdrawAmount]); 7 | 8 | const withdrawTransaction = (tokenAddress: string, withdrawAmount: BigNumberish): Transaction => ({ 9 | to: tokenAddress, 10 | typeCode: CallType.Call, 11 | data: encodeWithdraw(withdrawAmount), 12 | value: "0", 13 | }); 14 | 15 | export const withdrawFundsOnMatic = (tokenAddress: string, withdrawAmount: BigNumberish): Transaction[] => [ 16 | withdrawTransaction(tokenAddress, withdrawAmount), 17 | ]; 18 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: "airbnb-typescript-prettier", 3 | parserOptions: { 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname, 6 | sourceType: "module", 7 | }, 8 | rules: { 9 | "@typescript-eslint/no-inferrable-types": "off", 10 | "@typescript-eslint/no-shadow": "off", 11 | "@typescript-eslint/no-unused-vars": [ 12 | "error", 13 | { 14 | argsIgnorePattern: "_", 15 | varsIgnorePattern: "_", 16 | }, 17 | ], 18 | "import/extensions": [ 19 | "error", 20 | "ignorePackages", 21 | { 22 | js: "never", 23 | ts: "never", 24 | }, 25 | ], 26 | "import/prefer-default-export": "off", 27 | "prefer-destructuring": "off", 28 | "prefer-template": "off", 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /src/debt/takeOn.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumber } from "@ethersproject/bignumber"; 3 | import { CallType, Transaction } from "../types"; 4 | 5 | const encodeTakeOnDebt = (amount: BigNumber, txHash: string): string => 6 | new Interface(["function takeOnDebt(uint256,bytes32)"]).encodeFunctionData("takeOnDebt(uint256,bytes32)", [ 7 | amount, 8 | txHash, 9 | ]); 10 | 11 | const takeOnDebtTransaction = (debtTracker: string, amount: BigNumber, txHash: string): Transaction => ({ 12 | to: debtTracker, 13 | typeCode: CallType.Call, 14 | data: encodeTakeOnDebt(amount, txHash), 15 | value: "0", 16 | }); 17 | 18 | export const takeOnDebt = (debtTracker: string, amount: BigNumber, txHash: string): Transaction[] => [ 19 | takeOnDebtTransaction(debtTracker, amount, txHash), 20 | ]; 21 | -------------------------------------------------------------------------------- /src/debt/pay.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumber } from "@ethersproject/bignumber"; 3 | import { Transaction, CallType } from "../types"; 4 | import { erc20ApprovalTransaction } from "../utils"; 5 | 6 | const encodePayDebt = (amount: BigNumber): string => 7 | new Interface(["function payDebt(uint256)"]).encodeFunctionData("payDebt(uint256)", [amount]); 8 | 9 | const payDebtTransaction = (debtTracker: string, amount: BigNumber): Transaction => ({ 10 | to: debtTracker, 11 | typeCode: CallType.Call, 12 | data: encodePayDebt(amount), 13 | value: "0", 14 | }); 15 | 16 | export const payDebt = (debtTracker: string, tokenAddress: string, amount: BigNumber): Transaction[] => [ 17 | erc20ApprovalTransaction(tokenAddress, debtTracker, amount), 18 | payDebtTransaction(debtTracker, amount), 19 | ]; 20 | -------------------------------------------------------------------------------- /test/getIndexSet.test.ts: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | 3 | import { getIndexSet } from "../src"; 4 | 5 | const testCases = [ 6 | [[0], BigInt(1)], 7 | [[1], BigInt(2)], 8 | [[0, 1], BigInt(3)], 9 | [[0, 0, 1], BigInt(3)], 10 | [[2], BigInt(4)], 11 | [[0, 2], BigInt(5)], 12 | [[1, 2], BigInt(6)], 13 | [[0, 1, 2], BigInt(7)], 14 | [[3], BigInt(8)], 15 | [[0, 3], BigInt(9)], 16 | [[1, 3], BigInt(10)], 17 | [[0, 1, 3], BigInt(11)], 18 | [[2, 3], BigInt(12)], 19 | [[0, 2, 3], BigInt(13)], 20 | [[1, 2, 3], BigInt(14)], 21 | [[0, 1, 2, 3], BigInt(15)], 22 | [[33], BigInt(8589934592)], 23 | ] as [number[], bigint][]; 24 | 25 | describe("getIndexSet", () => { 26 | it.each(testCases)(`should get the index set`, (indices, expectedIndexSet) => { 27 | expect(getIndexSet(indices)).toEqual(expectedIndexSet); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /test/getMarketIndex.test.ts: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | 3 | import { getMarketIndex } from "../src"; 4 | 5 | const testCases: [string, number][] = [ 6 | ["0xb20c874543db3de05e85f24dc912e915a641c579db553ff12ed135a68b3f7500", 0], 7 | ["0xb20c874543db3de05e85f24dc912e915a641c579db553ff12ed135a68b3f7501", 1], 8 | ["0xb20c874543db3de05e85f24dc912e915a641c579db553ff12ed135a68b3f7510", 16], 9 | ["0x1d2daa077aa4441be685c80a2ffac5c962eebf791ee72b8d178bfaf305847c11", 17], 10 | ["0x1d2daa077aa4441be685c80a2ffac5c962eebf791ee72b8d178bfaf305847cFF", 255], 11 | ["0x1d2daa077aa4441be685c80a2ffac5c962eebf791ee72b8d178bfaf305847c0A", 10], 12 | ]; 13 | 14 | describe("getMarketIndex", () => { 15 | it.each(testCases)(`should get the market index`, (questionId, expectedMarketIndex) => { 16 | expect(getMarketIndex(questionId)).toEqual(expectedMarketIndex); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /src/markets/removeFunding.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import FixedProductMarketMakerABI from "../abi/FixedProductMarketMaker.json"; 4 | import { CallType, Transaction } from "../types"; 5 | 6 | const encodeRemoveFunding = (sharesToBurn: BigNumberish): string => 7 | new Interface(FixedProductMarketMakerABI).encodeFunctionData("removeFunding(uint256)", [sharesToBurn]); 8 | 9 | const removeFundingTransaction = (marketMakerAddress: string, sharesToBurn: BigNumberish): Transaction => ({ 10 | to: marketMakerAddress, 11 | typeCode: CallType.Call, 12 | data: encodeRemoveFunding(sharesToBurn), 13 | value: "0", 14 | }); 15 | 16 | export const removeFundingFromMarket = (marketMakerAddress: string, sharesToBurn: BigNumberish): Transaction[] => [ 17 | removeFundingTransaction(marketMakerAddress, sharesToBurn), 18 | ]; 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Polymarket 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/markets/addLiquidityRequest.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumber } from "@ethersproject/bignumber"; 3 | import { CallType, Transaction } from "../types"; 4 | import LiquidityRequestLogABI from "../abi/LiquidityRequestLog.json"; 5 | 6 | const encodeAddLiquidityRequest = (reason: string, marketMakerAddress: string, tradeAmount: BigNumber): string => 7 | new Interface(LiquidityRequestLogABI).encodeFunctionData("addLiquidityRequest(string,address,uint256)", [ 8 | reason, 9 | marketMakerAddress, 10 | tradeAmount, 11 | ]); 12 | 13 | const addLiquidityRequestTransaction = ( 14 | liquidityRequestLog: string, 15 | reason: string, 16 | marketMakerAddress: string, 17 | tradeAmount: BigNumber, 18 | ): Transaction => ({ 19 | to: liquidityRequestLog, 20 | typeCode: CallType.Call, 21 | data: encodeAddLiquidityRequest(reason, marketMakerAddress, tradeAmount), 22 | value: "0", 23 | }); 24 | 25 | export const addLiquidityRequest = ( 26 | liquidityRequestLog: string, 27 | reason: string, 28 | marketMakerAddress: string, 29 | tradeAmount: BigNumber, 30 | ): Transaction[] => [addLiquidityRequestTransaction(liquidityRequestLog, reason, marketMakerAddress, tradeAmount)]; 31 | -------------------------------------------------------------------------------- /src/markets/addFunding.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import FixedProductMarketMakerABI from "../abi/FixedProductMarketMaker.json"; 4 | import { erc20ApprovalTransaction } from "../utils"; 5 | import { CallType, Transaction } from "../types"; 6 | 7 | const encodeAddFunding = (investmentAmount: BigNumberish, distributionHint: BigNumberish[]): string => 8 | new Interface(FixedProductMarketMakerABI).encodeFunctionData("addFunding(uint256,uint256[])", [ 9 | investmentAmount, 10 | distributionHint, 11 | ]); 12 | 13 | const addFundingTransaction = ( 14 | marketMakerAddress: string, 15 | investmentAmount: BigNumberish, 16 | distributionHint: BigNumberish[], 17 | ): Transaction => ({ 18 | to: marketMakerAddress, 19 | typeCode: CallType.Call, 20 | data: encodeAddFunding(investmentAmount, distributionHint), 21 | value: "0", 22 | }); 23 | 24 | export const addFundingToMarket = ( 25 | marketMakerAddress: string, 26 | collateralTokenAddress: string, 27 | investmentAmount: BigNumberish, 28 | distributionHint: BigNumberish[] = [], 29 | ): Transaction[] => [ 30 | erc20ApprovalTransaction(collateralTokenAddress, marketMakerAddress, investmentAmount), 31 | addFundingTransaction(marketMakerAddress, investmentAmount, distributionHint), 32 | ]; 33 | -------------------------------------------------------------------------------- /src/markets/buy.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import FixedProductMarketMakerABI from "../abi/FixedProductMarketMaker.json"; 4 | import { erc20ApprovalTransaction } from "../utils"; 5 | import { CallType, Transaction } from "../types"; 6 | 7 | const encodeBuy = ( 8 | investmentAmount: BigNumberish, 9 | outcomeIndex: BigNumberish, 10 | minOutcomeTokensToBuy: BigNumberish, 11 | ): string => 12 | new Interface(FixedProductMarketMakerABI).encodeFunctionData("buy(uint256,uint256,uint256)", [ 13 | investmentAmount, 14 | outcomeIndex, 15 | minOutcomeTokensToBuy, 16 | ]); 17 | 18 | const buyTransaction = ( 19 | marketMakerAddress: string, 20 | investmentAmount: BigNumberish, 21 | outcomeIndex: BigNumberish, 22 | minOutcomeTokensToBuy: BigNumberish, 23 | ): Transaction => ({ 24 | to: marketMakerAddress, 25 | typeCode: CallType.Call, 26 | data: encodeBuy(investmentAmount, outcomeIndex, minOutcomeTokensToBuy), 27 | value: "0", 28 | }); 29 | 30 | export const buyMarketOutcome = ( 31 | marketMakerAddress: string, 32 | collateralTokenAddress: string, 33 | investmentAmount: BigNumberish, 34 | outcomeIndex: BigNumberish, 35 | minOutcomeTokensToBuy: BigNumberish, 36 | ): Transaction[] => [ 37 | erc20ApprovalTransaction(collateralTokenAddress, marketMakerAddress, investmentAmount), 38 | buyTransaction(marketMakerAddress, investmentAmount, outcomeIndex, minOutcomeTokensToBuy), 39 | ]; 40 | -------------------------------------------------------------------------------- /src/markets/sell.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import FixedProductMarketMakerABI from "../abi/FixedProductMarketMaker.json"; 4 | import { erc1155ApprovalTransaction } from "../utils"; 5 | import { CallType, Transaction } from "../types"; 6 | 7 | const encodeSell = ( 8 | returnAmount: BigNumberish, 9 | outcomeIndex: BigNumberish, 10 | maxOutcomeTokensToSell: BigNumberish, 11 | ): string => 12 | new Interface(FixedProductMarketMakerABI).encodeFunctionData("sell(uint256,uint256,uint256)", [ 13 | returnAmount, 14 | outcomeIndex, 15 | maxOutcomeTokensToSell, 16 | ]); 17 | 18 | const sellTransaction = ( 19 | marketMakerAddress: string, 20 | returnAmount: BigNumberish, 21 | outcomeIndex: BigNumberish, 22 | maxOutcomeTokensToSell: BigNumberish, 23 | ): Transaction => ({ 24 | to: marketMakerAddress, 25 | typeCode: CallType.Call, 26 | data: encodeSell(returnAmount, outcomeIndex, maxOutcomeTokensToSell), 27 | value: "0", 28 | }); 29 | 30 | export const sellMarketOutcome = ( 31 | marketMakerAddress: string, 32 | conditionalTokensAddress: string, 33 | returnAmount: BigNumberish, 34 | outcomeIndex: BigNumberish, 35 | maxOutcomeTokensToSell: BigNumberish, 36 | ): Transaction[] => [ 37 | erc1155ApprovalTransaction(conditionalTokensAddress, marketMakerAddress, true), 38 | sellTransaction(marketMakerAddress, returnAmount, outcomeIndex, maxOutcomeTokensToSell), 39 | erc1155ApprovalTransaction(conditionalTokensAddress, marketMakerAddress, false), 40 | ]; 41 | -------------------------------------------------------------------------------- /src/negRisk/index.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import { CallType, Transaction } from "../types"; 4 | import NegRiskAdapterABI from "../abi/NegRiskAdapter.json"; 5 | 6 | type ConvertPositionsParams = { 7 | negRiskAdapterAddress: string; 8 | marketId: string; 9 | indexSet: BigNumberish; 10 | amount: BigNumberish; 11 | }; 12 | 13 | type RedeemPositionsParams = { 14 | negRiskAdapterAddress: string; 15 | conditionId: string; 16 | amounts: [BigNumberish, BigNumberish]; 17 | }; 18 | 19 | const NegRiskAdapterInterface = new Interface(NegRiskAdapterABI); 20 | const convertPositionsSignature = "convertPositions(bytes32,uint256,uint256)"; 21 | const redeemPositionsSignature = "redeemPositions(bytes32,uint256[])"; 22 | 23 | const convertPositions = ({ 24 | negRiskAdapterAddress, 25 | marketId, 26 | indexSet, 27 | amount, 28 | }: ConvertPositionsParams): Transaction => ({ 29 | to: negRiskAdapterAddress, 30 | typeCode: CallType.Call, 31 | data: NegRiskAdapterInterface.encodeFunctionData(convertPositionsSignature, [marketId, indexSet, amount]), 32 | value: "0", 33 | }); 34 | 35 | const redeemPositions = ({ negRiskAdapterAddress, conditionId, amounts }: RedeemPositionsParams): Transaction => ({ 36 | to: negRiskAdapterAddress, 37 | typeCode: CallType.Call, 38 | data: NegRiskAdapterInterface.encodeFunctionData(redeemPositionsSignature, [conditionId, amounts]), 39 | value: "0", 40 | }); 41 | 42 | const negRiskOperations = { convertPositions, redeemPositions }; 43 | 44 | export { negRiskOperations }; 45 | -------------------------------------------------------------------------------- /src/conditionalTokens/redeem.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import { HashZero } from "@ethersproject/constants"; 4 | import ConditionalTokensABI from "../abi/ConditionalTokens.json"; 5 | import { CallType, Transaction } from "../types"; 6 | 7 | const encodeRedeem = ( 8 | collateralTokenAddress: string, 9 | parentCollectionId: string, 10 | conditionId: string, 11 | partition: BigNumberish[], 12 | ): string => 13 | new Interface(ConditionalTokensABI).encodeFunctionData("redeemPositions(address,bytes32,bytes32,uint256[])", [ 14 | collateralTokenAddress, 15 | parentCollectionId, 16 | conditionId, 17 | partition, 18 | ]); 19 | 20 | const redeemTransaction = ( 21 | conditionalTokensAddress: string, 22 | collateralTokenAddress: string, 23 | parentCollectionId: string, 24 | conditionId: string, 25 | partition: BigNumberish[], 26 | ): Transaction => ({ 27 | to: conditionalTokensAddress, 28 | typeCode: CallType.Call, 29 | data: encodeRedeem(collateralTokenAddress, parentCollectionId, conditionId, partition), 30 | value: "0", 31 | }); 32 | 33 | export const redeemPositions = ( 34 | conditionalTokensAddress: string, 35 | collateralTokenAddress: string, 36 | // parentCollectionId: string, 37 | conditionId: string, 38 | outcomeSlotCount: number, 39 | // partition: BigNumberish[], 40 | ): Transaction[] => { 41 | // Assume that we're redeeming a condition which has been split from collateral 42 | const parentCollectionId = HashZero; 43 | // Assume that we're redeeming a full set of outcome tokens 44 | // eslint-disable-next-line no-bitwise 45 | const partition = Array.from({ length: outcomeSlotCount }, (_: undefined, i: number) => 1 << i); 46 | return [ 47 | redeemTransaction(conditionalTokensAddress, collateralTokenAddress, parentCollectionId, conditionId, partition), 48 | ]; 49 | }; 50 | -------------------------------------------------------------------------------- /src/conditionalTokens/merge.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import ConditionalTokensABI from "../abi/ConditionalTokens.json"; 4 | import { CallType, Transaction } from "../types"; 5 | 6 | const encodeMerge = ( 7 | collateralTokenAddress: string, 8 | parentCollectionId: string, 9 | conditionId: string, 10 | partition: BigNumberish[], 11 | amount: BigNumberish, 12 | ): string => 13 | new Interface(ConditionalTokensABI).encodeFunctionData("mergePositions(address,bytes32,bytes32,uint256[],uint256)", [ 14 | collateralTokenAddress, 15 | parentCollectionId, 16 | conditionId, 17 | partition, 18 | amount, 19 | ]); 20 | 21 | const mergeTransaction = ( 22 | conditionalTokensAddress: string, 23 | collateralTokenAddress: string, 24 | parentCollectionId: string, 25 | conditionId: string, 26 | partition: BigNumberish[], 27 | amount: BigNumberish, 28 | ): Transaction => ({ 29 | to: conditionalTokensAddress, 30 | typeCode: CallType.Call, 31 | data: encodeMerge(collateralTokenAddress, parentCollectionId, conditionId, partition, amount), 32 | value: "0", 33 | }); 34 | 35 | export const mergePositions = ( 36 | conditionalTokensAddress: string, 37 | collateralTokenAddress: string, 38 | // parentCollectionId: string, 39 | conditionId: string, 40 | outcomeSlotCount: number, 41 | // partition: BigNumberish[], 42 | amount: BigNumberish, 43 | ): Transaction[] => { 44 | // Assume that we're merging a condition which has been split from collateral 45 | const parentCollectionId = `0x${"0".repeat(64)}`; 46 | // Assume that we're mergine a full set of outcome tokens 47 | // eslint-disable-next-line no-bitwise 48 | const partition = Array.from({ length: outcomeSlotCount }, (_: undefined, i: number) => 1 << i); 49 | return [ 50 | mergeTransaction( 51 | conditionalTokensAddress, 52 | collateralTokenAddress, 53 | parentCollectionId, 54 | conditionId, 55 | partition, 56 | amount, 57 | ), 58 | ]; 59 | }; 60 | -------------------------------------------------------------------------------- /src/conditionalTokens/split.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import { HashZero } from "@ethersproject/constants"; 4 | import ConditionalTokensABI from "../abi/ConditionalTokens.json"; 5 | import { erc20ApprovalTransaction } from "../utils"; 6 | import { CallType, Transaction } from "../types"; 7 | 8 | const encodeSplit = ( 9 | collateralTokenAddress: string, 10 | parentCollectionId: string, 11 | conditionId: string, 12 | partition: BigNumberish[], 13 | amount: BigNumberish, 14 | ): string => 15 | new Interface(ConditionalTokensABI).encodeFunctionData("splitPosition(address,bytes32,bytes32,uint256[],uint256)", [ 16 | collateralTokenAddress, 17 | parentCollectionId, 18 | conditionId, 19 | partition, 20 | amount, 21 | ]); 22 | 23 | const splitTransaction = ( 24 | conditionalTokensAddress: string, 25 | collateralTokenAddress: string, 26 | parentCollectionId: string, 27 | conditionId: string, 28 | partition: BigNumberish[], 29 | amount: BigNumberish, 30 | ): Transaction => ({ 31 | to: conditionalTokensAddress, 32 | typeCode: CallType.Call, 33 | data: encodeSplit(collateralTokenAddress, parentCollectionId, conditionId, partition, amount), 34 | value: "0", 35 | }); 36 | 37 | export const splitPosition = ( 38 | conditionalTokensAddress: string, 39 | collateralTokenAddress: string, 40 | // parentCollectionId: string, 41 | conditionId: string, 42 | outcomeSlotCount: number, 43 | // partition: BigNumberish[], 44 | amount: BigNumberish, 45 | ): Transaction[] => { 46 | // Assume that we're merging a condition which has been split from collateral 47 | const parentCollectionId = HashZero; 48 | // Assume that we're mergine a full set of outcome tokens 49 | // eslint-disable-next-line no-bitwise 50 | const partition = Array.from({ length: outcomeSlotCount }, (_: undefined, i: number) => 1 << i); 51 | return [ 52 | splitTransaction( 53 | conditionalTokensAddress, 54 | collateralTokenAddress, 55 | parentCollectionId, 56 | conditionId, 57 | partition, 58 | amount, 59 | ), 60 | ]; 61 | }; 62 | -------------------------------------------------------------------------------- /src/adapter/initialize.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import { CallType, Transaction } from "../types"; 4 | import AdapterAbi from "../abi/UmaCtfAdapter.json"; 5 | import NegRiskAdapterAbi from "../abi/NegRiskUmaCtfAdapter.json"; 6 | 7 | const AdapterInterface = new Interface(AdapterAbi); 8 | const NegRiskAdapterInterface = new Interface(NegRiskAdapterAbi); 9 | 10 | const initializeSig = "initialize(bytes,address,uint256,uint256)"; 11 | const negRiskInitializeSig = "initialize(bytes,address,uint256,uint256,uint256)"; 12 | 13 | const encodeInitialize = ( 14 | ancillaryData: Uint8Array, 15 | rewardToken: string, 16 | reward: BigNumberish, 17 | proposalBond: BigNumberish, 18 | ): string => { 19 | return AdapterInterface.encodeFunctionData(initializeSig, [ancillaryData, rewardToken, reward, proposalBond]); 20 | }; 21 | 22 | const encodeNegRiskInitialize = ( 23 | ancillaryData: Uint8Array, 24 | rewardToken: string, 25 | reward: BigNumberish, 26 | proposalBond: BigNumberish, 27 | liveness: BigNumberish, 28 | ): string => { 29 | return NegRiskAdapterInterface.encodeFunctionData(negRiskInitializeSig, [ 30 | ancillaryData, 31 | rewardToken, 32 | reward, 33 | proposalBond, 34 | liveness, 35 | ]); 36 | }; 37 | 38 | export const initialize = ( 39 | adapterAddress: string, 40 | ancillaryData: Uint8Array, 41 | rewardToken: string, 42 | reward: BigNumberish, 43 | proposalBond: BigNumberish, 44 | ): Transaction => { 45 | return { 46 | to: adapterAddress, 47 | typeCode: CallType.Call, 48 | data: encodeInitialize(ancillaryData, rewardToken, reward, proposalBond), 49 | value: "0", 50 | }; 51 | }; 52 | 53 | export const negRiskInitialize = ( 54 | adapterAddress: string, 55 | ancillaryData: Uint8Array, 56 | rewardToken: string, 57 | reward: BigNumberish, 58 | proposalBond: BigNumberish, 59 | liveness: BigNumberish, 60 | ): Transaction => { 61 | return { 62 | to: adapterAddress, 63 | typeCode: CallType.Call, 64 | data: encodeNegRiskInitialize(ancillaryData, rewardToken, reward, proposalBond, liveness), 65 | value: "0", 66 | }; 67 | }; 68 | -------------------------------------------------------------------------------- /src/markets/safeAddFunding.ts: -------------------------------------------------------------------------------- 1 | import { Interface } from "@ethersproject/abi"; 2 | import { BigNumberish } from "@ethersproject/bignumber"; 3 | import { erc20ApprovalTransaction } from "../utils"; 4 | import { CallType, Transaction } from "../types"; 5 | 6 | const encodeSafeAddFunding = ( 7 | marketMakerAddress: string, 8 | investmentAmount: BigNumberish, 9 | distributionHint: BigNumberish[], 10 | positionIds: BigNumberish[], 11 | minRefunds: BigNumberish[], 12 | maxRefunds: BigNumberish[], 13 | ): string => 14 | new Interface([ 15 | "function addFunding(address,uint256,uint256[] memory,uint256[] memory,uint256[] memory,uint256[] memory)", 16 | ]).encodeFunctionData( 17 | "addFunding(address,uint256,uint256[] memory,uint256[] memory,uint256[] memory,uint256[] memory)", 18 | [marketMakerAddress, investmentAmount, distributionHint, positionIds, minRefunds, maxRefunds], 19 | ); 20 | 21 | const safeAddFundingTransaction = ( 22 | slippageCheckerAddress: string, 23 | marketMakerAddress: string, 24 | investmentAmount: BigNumberish, 25 | distributionHint: BigNumberish[], 26 | positionIds: BigNumberish[], 27 | minRefunds: BigNumberish[], 28 | maxRefunds: BigNumberish[], 29 | ): Transaction => ({ 30 | to: slippageCheckerAddress, 31 | typeCode: CallType.DelegateCall, 32 | data: encodeSafeAddFunding( 33 | marketMakerAddress, 34 | investmentAmount, 35 | distributionHint, 36 | positionIds, 37 | minRefunds, 38 | maxRefunds, 39 | ), 40 | value: "0", 41 | }); 42 | 43 | export const safeAddFundingToMarket = ( 44 | slippageCheckerAddress: string, 45 | marketMakerAddress: string, 46 | collateralTokenAddress: string, 47 | investmentAmount: BigNumberish, 48 | distributionHint: BigNumberish[] = [], 49 | positionIds: BigNumberish[], 50 | minRefunds: BigNumberish[], 51 | maxRefunds: BigNumberish[], 52 | ): Transaction[] => [ 53 | erc20ApprovalTransaction(collateralTokenAddress, marketMakerAddress, investmentAmount), 54 | safeAddFundingTransaction( 55 | slippageCheckerAddress, 56 | marketMakerAddress, 57 | investmentAmount, 58 | distributionHint, 59 | positionIds, 60 | minRefunds, 61 | maxRefunds, 62 | ), 63 | ]; 64 | -------------------------------------------------------------------------------- /test/proxywallet_address.ts: -------------------------------------------------------------------------------- 1 | /* eslint-env jest */ 2 | import { getProxyWalletAddress } from "../src"; 3 | 4 | const testCases: [[string, string], string][] = [ 5 | [ 6 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0x00002569317Dc5588b59BAe5F63F5F8945912e58"], 7 | "0x0D56FeAd54dd28cb7A903E7C6f2AeED9a26D6910", 8 | ], 9 | [ 10 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0x002b8410e87FE36907602bAD0706642AaA3B9f8d"], 11 | "0xeDB217f9B4BEF2A328453C9ce669C01103b76256", 12 | ], 13 | [ 14 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0x0050aCEb61fAD6F7130b678991a8AAb9e8bA01d4"], 15 | "0x4631a2C46512B3639881b3b110189D520556d3A6", 16 | ], 17 | [ 18 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0xffeE4f6510312b7E9d066b124bf84Cb81cF6d2D2"], 19 | "0xa810B581E0614749845D8f8a1F77199b486D3b43", 20 | ], 21 | [ 22 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0xff5Dc13E00593957F6a62F3a2F39e8446Bca2086"], 23 | "0x28D96cFcAc8210167Ed63401850AB8609898d31E", 24 | ], 25 | [ 26 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0xFF8F0f472C1B2c51a9869FfbFE59578e9f814eA3"], 27 | "0xc7498D2C55dA9134f4Fcf8A8F5926bECCdBA409E", 28 | ], 29 | [ 30 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0xFEf1a35FC07A89FF46E969F4a4Db6F601fA2E0d6"], 31 | "0xaE7Be8967fd2d17cDeF9923035633f2905Ac0B9f", 32 | ], 33 | [ 34 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0xfF161f8A02315BfddB94c8aC6c7AdaB3D605C155"], 35 | "0x7D9023ed6C6a99F22aD6E5a9135BFb002088B92e", 36 | ], 37 | [ 38 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0xfDd284a9B2A8Ff58585cA8fb027aecDe948C3f3e"], 39 | "0xce2EF09B3E4F85C40CE593A4C7630648648e794f", 40 | ], 41 | [ 42 | ["0xaB45c5A4B0c941a2F231C04C3f49182e1A254052", "0xFD742C2b0359f73E79e13505c881B9D7aF81467D"], 43 | "0x26aff3bD0ecd5Ff24b3200C71c052f5F804a04de", 44 | ], 45 | ]; 46 | 47 | describe("getProxyWalletAddress", () => { 48 | it.each(testCases)( 49 | `should compute the correct proxy wallet address`, 50 | ([factoryAddress, userAddress], expectedProxyWalletAddress) => 51 | expect(getProxyWalletAddress(factoryAddress, userAddress)).toEqual(expectedProxyWalletAddress), 52 | ); 53 | }); 54 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@polymarket/sdk", 3 | "version": "6.0.1", 4 | "description": "SDK to simplify common interactions with the Polymarket proxy wallet", 5 | "author": "Tom French ", 6 | "repository": "https://github.com/Polymarket/polymarket-sdk.git", 7 | "main": "lib/index.js", 8 | "types": "lib/index.d.ts", 9 | "engines": { 10 | "node": ">=8", 11 | "npm": ">=5" 12 | }, 13 | "contributors": [ 14 | { 15 | "name": "Tom French", 16 | "url": "https://github.com/tomafrench" 17 | }, 18 | { 19 | "name": "Mike Shrieve", 20 | "url": "https://github.com/mshrieve" 21 | }, 22 | { 23 | "name": "Jonathan Amenechi", 24 | "url": "https://github.com/JonathanAmenechi" 25 | } 26 | ], 27 | "peerDependencies": { 28 | "@ethersproject/abi": "^5.4.1", 29 | "@ethersproject/address": "^5.0.8", 30 | "@ethersproject/bignumber": "^5.0.8", 31 | "@ethersproject/constants": "^5.0.8", 32 | "@ethersproject/contracts": "^5.0.9", 33 | "@ethersproject/keccak256": "^5.0.6", 34 | "@ethersproject/providers": "^5.0.14", 35 | "@ethersproject/solidity": "^5.0.7" 36 | }, 37 | "devDependencies": { 38 | "@ethersproject/abi": "^5.0.7", 39 | "@ethersproject/address": "^5.0.8", 40 | "@ethersproject/bignumber": "^5.0.8", 41 | "@ethersproject/constants": "^5.0.8", 42 | "@ethersproject/contracts": "^5.0.9", 43 | "@ethersproject/keccak256": "^5.0.6", 44 | "@ethersproject/providers": "^5.0.14", 45 | "@ethersproject/solidity": "^5.0.7", 46 | "@types/jest": "^27.0.1", 47 | "@types/mocha": "^9.0.0", 48 | "eslint": "^7.18.0", 49 | "eslint-config-airbnb-typescript-prettier": "^4.1.0", 50 | "jest": "^26.6.3", 51 | "lint-staged": "^10.5.3", 52 | "prettier": "^2.2.1", 53 | "shx": "^0.3.3", 54 | "ts-jest": "^26.4.4", 55 | "typescript": "^4.1.3" 56 | }, 57 | "keywords": [ 58 | "blockchain", 59 | "ethereum", 60 | "matic", 61 | "typescript" 62 | ], 63 | "license": "MIT", 64 | "scripts": { 65 | "prebuild": "yarn clean", 66 | "build": "tsc --project tsconfig.production.json", 67 | "clean": "shx rm -rf ./lib", 68 | "lint": "eslint --config ./.eslintrc.js --ignore-path ./.eslintignore ./src/**/*", 69 | "prepack": "yarn test && yarn build", 70 | "test": "jest" 71 | } 72 | } -------------------------------------------------------------------------------- /src/abi/LiquidityRequestLog.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "owner", 7 | "type": "address" 8 | } 9 | ], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "anonymous": false, 15 | "inputs": [ 16 | { 17 | "indexed": true, 18 | "internalType": "address", 19 | "name": "requesterAddress", 20 | "type": "address" 21 | }, 22 | { 23 | "components": [ 24 | { 25 | "internalType": "address", 26 | "name": "requesterAddress", 27 | "type": "address" 28 | }, 29 | { 30 | "internalType": "uint256", 31 | "name": "requestDate", 32 | "type": "uint256" 33 | }, 34 | { 35 | "internalType": "string", 36 | "name": "reason", 37 | "type": "string" 38 | }, 39 | { 40 | "internalType": "address", 41 | "name": "marketMakerAddress", 42 | "type": "address" 43 | }, 44 | { 45 | "internalType": "uint256", 46 | "name": "tradeAmount", 47 | "type": "uint256" 48 | } 49 | ], 50 | "indexed": false, 51 | "internalType": "struct LiquidityRequestLog.LiquidityRequest", 52 | "name": "liquidityRequest", 53 | "type": "tuple" 54 | } 55 | ], 56 | "name": "LiquidityRequestAdded", 57 | "type": "event" 58 | }, 59 | { 60 | "anonymous": false, 61 | "inputs": [ 62 | { 63 | "indexed": true, 64 | "internalType": "address", 65 | "name": "previousOwner", 66 | "type": "address" 67 | }, 68 | { 69 | "indexed": true, 70 | "internalType": "address", 71 | "name": "newOwner", 72 | "type": "address" 73 | } 74 | ], 75 | "name": "OwnershipTransferred", 76 | "type": "event" 77 | }, 78 | { 79 | "inputs": [ 80 | { 81 | "internalType": "string", 82 | "name": "reason", 83 | "type": "string" 84 | }, 85 | { 86 | "internalType": "address", 87 | "name": "marketMakerAddress", 88 | "type": "address" 89 | }, 90 | { 91 | "internalType": "uint256", 92 | "name": "tradeAmount", 93 | "type": "uint256" 94 | } 95 | ], 96 | "name": "addLiquidityRequest", 97 | "outputs": [], 98 | "stateMutability": "nonpayable", 99 | "type": "function" 100 | }, 101 | { 102 | "inputs": [], 103 | "name": "owner", 104 | "outputs": [ 105 | { 106 | "internalType": "address", 107 | "name": "", 108 | "type": "address" 109 | } 110 | ], 111 | "stateMutability": "view", 112 | "type": "function" 113 | }, 114 | { 115 | "inputs": [], 116 | "name": "renounceOwnership", 117 | "outputs": [], 118 | "stateMutability": "nonpayable", 119 | "type": "function" 120 | }, 121 | { 122 | "inputs": [ 123 | { 124 | "internalType": "address", 125 | "name": "newOwner", 126 | "type": "address" 127 | } 128 | ], 129 | "name": "transferOwnership", 130 | "outputs": [], 131 | "stateMutability": "nonpayable", 132 | "type": "function" 133 | } 134 | ] 135 | -------------------------------------------------------------------------------- /src/abi/ERC20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [], 5 | "name": "name", 6 | "outputs": [ 7 | { 8 | "name": "", 9 | "type": "string" 10 | } 11 | ], 12 | "payable": false, 13 | "stateMutability": "view", 14 | "type": "function" 15 | }, 16 | { 17 | "constant": false, 18 | "inputs": [ 19 | { 20 | "name": "_spender", 21 | "type": "address" 22 | }, 23 | { 24 | "name": "_value", 25 | "type": "uint256" 26 | } 27 | ], 28 | "name": "approve", 29 | "outputs": [ 30 | { 31 | "name": "", 32 | "type": "bool" 33 | } 34 | ], 35 | "payable": false, 36 | "stateMutability": "nonpayable", 37 | "type": "function" 38 | }, 39 | { 40 | "constant": true, 41 | "inputs": [], 42 | "name": "totalSupply", 43 | "outputs": [ 44 | { 45 | "name": "", 46 | "type": "uint256" 47 | } 48 | ], 49 | "payable": false, 50 | "stateMutability": "view", 51 | "type": "function" 52 | }, 53 | { 54 | "constant": false, 55 | "inputs": [ 56 | { 57 | "name": "_from", 58 | "type": "address" 59 | }, 60 | { 61 | "name": "_to", 62 | "type": "address" 63 | }, 64 | { 65 | "name": "_value", 66 | "type": "uint256" 67 | } 68 | ], 69 | "name": "transferFrom", 70 | "outputs": [ 71 | { 72 | "name": "", 73 | "type": "bool" 74 | } 75 | ], 76 | "payable": false, 77 | "stateMutability": "nonpayable", 78 | "type": "function" 79 | }, 80 | { 81 | "constant": true, 82 | "inputs": [], 83 | "name": "decimals", 84 | "outputs": [ 85 | { 86 | "name": "", 87 | "type": "uint8" 88 | } 89 | ], 90 | "payable": false, 91 | "stateMutability": "view", 92 | "type": "function" 93 | }, 94 | { 95 | "constant": true, 96 | "inputs": [ 97 | { 98 | "name": "_owner", 99 | "type": "address" 100 | } 101 | ], 102 | "name": "balanceOf", 103 | "outputs": [ 104 | { 105 | "name": "balance", 106 | "type": "uint256" 107 | } 108 | ], 109 | "payable": false, 110 | "stateMutability": "view", 111 | "type": "function" 112 | }, 113 | { 114 | "constant": true, 115 | "inputs": [], 116 | "name": "symbol", 117 | "outputs": [ 118 | { 119 | "name": "", 120 | "type": "string" 121 | } 122 | ], 123 | "payable": false, 124 | "stateMutability": "view", 125 | "type": "function" 126 | }, 127 | { 128 | "constant": false, 129 | "inputs": [ 130 | { 131 | "name": "_to", 132 | "type": "address" 133 | }, 134 | { 135 | "name": "_value", 136 | "type": "uint256" 137 | } 138 | ], 139 | "name": "transfer", 140 | "outputs": [ 141 | { 142 | "name": "", 143 | "type": "bool" 144 | } 145 | ], 146 | "payable": false, 147 | "stateMutability": "nonpayable", 148 | "type": "function" 149 | }, 150 | { 151 | "constant": true, 152 | "inputs": [ 153 | { 154 | "name": "_owner", 155 | "type": "address" 156 | }, 157 | { 158 | "name": "_spender", 159 | "type": "address" 160 | } 161 | ], 162 | "name": "allowance", 163 | "outputs": [ 164 | { 165 | "name": "", 166 | "type": "uint256" 167 | } 168 | ], 169 | "payable": false, 170 | "stateMutability": "view", 171 | "type": "function" 172 | }, 173 | { 174 | "payable": true, 175 | "stateMutability": "payable", 176 | "type": "fallback" 177 | }, 178 | { 179 | "anonymous": false, 180 | "inputs": [ 181 | { 182 | "indexed": true, 183 | "name": "owner", 184 | "type": "address" 185 | }, 186 | { 187 | "indexed": true, 188 | "name": "spender", 189 | "type": "address" 190 | }, 191 | { 192 | "indexed": false, 193 | "name": "value", 194 | "type": "uint256" 195 | } 196 | ], 197 | "name": "Approval", 198 | "type": "event" 199 | }, 200 | { 201 | "anonymous": false, 202 | "inputs": [ 203 | { 204 | "indexed": true, 205 | "name": "from", 206 | "type": "address" 207 | }, 208 | { 209 | "indexed": true, 210 | "name": "to", 211 | "type": "address" 212 | }, 213 | { 214 | "indexed": false, 215 | "name": "value", 216 | "type": "uint256" 217 | } 218 | ], 219 | "name": "Transfer", 220 | "type": "event" 221 | } 222 | ] 223 | -------------------------------------------------------------------------------- /src/abi/ERC1155.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [ 5 | { 6 | "name": "interfaceId", 7 | "type": "bytes4" 8 | } 9 | ], 10 | "name": "supportsInterface", 11 | "outputs": [ 12 | { 13 | "name": "", 14 | "type": "bool" 15 | } 16 | ], 17 | "payable": false, 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [], 23 | "payable": false, 24 | "stateMutability": "nonpayable", 25 | "type": "constructor" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "name": "operator", 33 | "type": "address" 34 | }, 35 | { 36 | "indexed": true, 37 | "name": "from", 38 | "type": "address" 39 | }, 40 | { 41 | "indexed": true, 42 | "name": "to", 43 | "type": "address" 44 | }, 45 | { 46 | "indexed": false, 47 | "name": "id", 48 | "type": "uint256" 49 | }, 50 | { 51 | "indexed": false, 52 | "name": "value", 53 | "type": "uint256" 54 | } 55 | ], 56 | "name": "TransferSingle", 57 | "type": "event" 58 | }, 59 | { 60 | "anonymous": false, 61 | "inputs": [ 62 | { 63 | "indexed": true, 64 | "name": "operator", 65 | "type": "address" 66 | }, 67 | { 68 | "indexed": true, 69 | "name": "from", 70 | "type": "address" 71 | }, 72 | { 73 | "indexed": true, 74 | "name": "to", 75 | "type": "address" 76 | }, 77 | { 78 | "indexed": false, 79 | "name": "ids", 80 | "type": "uint256[]" 81 | }, 82 | { 83 | "indexed": false, 84 | "name": "values", 85 | "type": "uint256[]" 86 | } 87 | ], 88 | "name": "TransferBatch", 89 | "type": "event" 90 | }, 91 | { 92 | "anonymous": false, 93 | "inputs": [ 94 | { 95 | "indexed": true, 96 | "name": "owner", 97 | "type": "address" 98 | }, 99 | { 100 | "indexed": true, 101 | "name": "operator", 102 | "type": "address" 103 | }, 104 | { 105 | "indexed": false, 106 | "name": "approved", 107 | "type": "bool" 108 | } 109 | ], 110 | "name": "ApprovalForAll", 111 | "type": "event" 112 | }, 113 | { 114 | "anonymous": false, 115 | "inputs": [ 116 | { 117 | "indexed": false, 118 | "name": "value", 119 | "type": "string" 120 | }, 121 | { 122 | "indexed": true, 123 | "name": "id", 124 | "type": "uint256" 125 | } 126 | ], 127 | "name": "URI", 128 | "type": "event" 129 | }, 130 | { 131 | "constant": true, 132 | "inputs": [ 133 | { 134 | "name": "owner", 135 | "type": "address" 136 | }, 137 | { 138 | "name": "id", 139 | "type": "uint256" 140 | } 141 | ], 142 | "name": "balanceOf", 143 | "outputs": [ 144 | { 145 | "name": "", 146 | "type": "uint256" 147 | } 148 | ], 149 | "payable": false, 150 | "stateMutability": "view", 151 | "type": "function" 152 | }, 153 | { 154 | "constant": true, 155 | "inputs": [ 156 | { 157 | "name": "owners", 158 | "type": "address[]" 159 | }, 160 | { 161 | "name": "ids", 162 | "type": "uint256[]" 163 | } 164 | ], 165 | "name": "balanceOfBatch", 166 | "outputs": [ 167 | { 168 | "name": "", 169 | "type": "uint256[]" 170 | } 171 | ], 172 | "payable": false, 173 | "stateMutability": "view", 174 | "type": "function" 175 | }, 176 | { 177 | "constant": false, 178 | "inputs": [ 179 | { 180 | "name": "operator", 181 | "type": "address" 182 | }, 183 | { 184 | "name": "approved", 185 | "type": "bool" 186 | } 187 | ], 188 | "name": "setApprovalForAll", 189 | "outputs": [], 190 | "payable": false, 191 | "stateMutability": "nonpayable", 192 | "type": "function" 193 | }, 194 | { 195 | "constant": true, 196 | "inputs": [ 197 | { 198 | "name": "owner", 199 | "type": "address" 200 | }, 201 | { 202 | "name": "operator", 203 | "type": "address" 204 | } 205 | ], 206 | "name": "isApprovedForAll", 207 | "outputs": [ 208 | { 209 | "name": "", 210 | "type": "bool" 211 | } 212 | ], 213 | "payable": false, 214 | "stateMutability": "view", 215 | "type": "function" 216 | }, 217 | { 218 | "constant": false, 219 | "inputs": [ 220 | { 221 | "name": "from", 222 | "type": "address" 223 | }, 224 | { 225 | "name": "to", 226 | "type": "address" 227 | }, 228 | { 229 | "name": "id", 230 | "type": "uint256" 231 | }, 232 | { 233 | "name": "value", 234 | "type": "uint256" 235 | }, 236 | { 237 | "name": "data", 238 | "type": "bytes" 239 | } 240 | ], 241 | "name": "safeTransferFrom", 242 | "outputs": [], 243 | "payable": false, 244 | "stateMutability": "nonpayable", 245 | "type": "function" 246 | }, 247 | { 248 | "constant": false, 249 | "inputs": [ 250 | { 251 | "name": "from", 252 | "type": "address" 253 | }, 254 | { 255 | "name": "to", 256 | "type": "address" 257 | }, 258 | { 259 | "name": "ids", 260 | "type": "uint256[]" 261 | }, 262 | { 263 | "name": "values", 264 | "type": "uint256[]" 265 | }, 266 | { 267 | "name": "data", 268 | "type": "bytes" 269 | } 270 | ], 271 | "name": "safeBatchTransferFrom", 272 | "outputs": [], 273 | "payable": false, 274 | "stateMutability": "nonpayable", 275 | "type": "function" 276 | } 277 | ] 278 | -------------------------------------------------------------------------------- /src/proxyWallet.ts: -------------------------------------------------------------------------------- 1 | import { defaultAbiCoder } from "@ethersproject/abi"; 2 | import { keccak256 } from "@ethersproject/keccak256"; 3 | import { getCreate2Address } from "@ethersproject/address"; 4 | import { keccak256 as solidityKeccak256 } from "@ethersproject/solidity"; 5 | 6 | const WALLET_FACTORY_SALT = solidityKeccak256(["string"], ["polymarket-wallet-factory"]); 7 | const PROXY_WALLET_BYTECODE = 8 | "0x608060405234801561001057600080fd5b50610cc1806100206000396000f3fe60806040526004361061003f5760003560e01c806334ee9791146100445780638129fc1c1461006d578063bc197c8114610084578063f23a6e61146100b1575b600080fd5b6100576100523660046108fb565b6100d1565b6040516100649190610ad8565b60405180910390f35b34801561007957600080fd5b506100826101c2565b005b34801561009057600080fd5b506100a461009f3660046107e7565b6101fd565b6040516100649190610ae9565b3480156100bd57600080fd5b506100a46100cc3660046108a4565b61020e565b6060336100dc61021f565b6001600160a01b03161461010b5760405162461bcd60e51b815260040161010290610b08565b60405180910390fd5b815160405190808252806020026020018201604052801561014057816020015b606081526020019060019003908161012b5790505b50905060005b82518110156101bc576000606061016f85848151811061016257fe5b6020026020010151610244565b915091508161019a5761018181610350565b60405162461bcd60e51b81526004016101029190610af7565b808484815181106101a757fe5b60209081029190910101525050600101610146565b50919050565b60006101cc61021f565b6001600160a01b0316146101f25760405162461bcd60e51b815260040161010290610b18565b6101fb3361045d565b565b63bc197c8160e01b95945050505050565b63f23a6e6160e01b95945050505050565b7f734a2a5caf82146a5ddd5263d9af379f9f72724959f0567ddc9df2c40cf2cc205490565b6000606060028351600281111561025757fe5b14156102c85782602001516001600160a01b0316836060015160405161027d9190610ac5565b600060405180830381855af49150503d80600081146102b8576040519150601f19603f3d011682016040523d82523d6000602084013e6102bd565b606091505b50909250905061034b565b6001835160028111156102d757fe5b141561034b5782602001516001600160a01b0316836040015184606001516040516103029190610ac5565b60006040518083038185875af1925050503d806000811461033f576040519150601f19603f3d011682016040523d82523d6000602084013e610344565b606091505b5090925090505b915091565b6060815160001415610396575060408051808201909152601c81527f636170747572656420656d7074792072657665727420627566666572000000006020820152610458565b6308c379a06103b06103ab8460006004610481565b6104aa565b63ffffffff16146103db576040518060600160405280603f8152602001610c40603f91399050610458565b60606103f66103f184600463ffffffff6104bf16565b6104ec565b905080516000141561043d57505060408051808201909152601d81527f636170747572656420656d70747920726576657274206d6573736167650000006020820152610458565b6060818060200190516104539190810190610938565b925050505b919050565b7f734a2a5caf82146a5ddd5263d9af379f9f72724959f0567ddc9df2c40cf2cc2055565b6104896105ad565b6104938484610545565b815260208101919091526040810191909152919050565b8051602082015160009190610453828261054c565b6104c76105ad565b81835110156104d557825191505b6104e3838384865103610481565b90505b92915050565b60208082015160408051828152601f19601f8401168101909301905260609181801561051f576020820181803883390190505b508351909250600061053084610569565b905061053d81838561056f565b505050919050565b0160200190565b6000600180600884021b0380836020038503511691505092915050565b60200190565b5b6020811061058f578151835260209283019290910190601f1901610570565b600180600883602003021b0380845116811984511617845250505050565b60405180606001604052806000815260200160008152602001600081525090565b80356104e681610c12565b600082601f8301126105ea57600080fd5b81356105fd6105f882610b4f565b610b28565b81815260209384019390925082018360005b8381101561063b57813586016106258882610755565b845250602092830192919091019060010161060f565b5050505092915050565b600082601f83011261065657600080fd5b81356106646105f882610b4f565b9150818183526020840193506020810190508385602084028201111561068957600080fd5b60005b8381101561063b578161069f88826107dc565b845250602092830192919091019060010161068c565b600082601f8301126106c657600080fd5b81356106d46105f882610b70565b915080825260208301602083018583830111156106f057600080fd5b6106fb838284610bcc565b50505092915050565b80356104e681610c29565b600082601f83011261072057600080fd5b815161072e6105f882610b70565b9150808252602083016020830185838301111561074a57600080fd5b6106fb838284610bd8565b60006080828403121561076757600080fd5b6107716080610b28565b9050600061077f8484610704565b8252506020610790848483016105ce565b60208301525060406107a4848285016107dc565b604083015250606082013567ffffffffffffffff8111156107c457600080fd5b6107d0848285016106b5565b60608301525092915050565b80356104e681610c36565b600080600080600060a086880312156107ff57600080fd5b600061080b88886105ce565b955050602061081c888289016105ce565b945050604086013567ffffffffffffffff81111561083957600080fd5b61084588828901610645565b935050606086013567ffffffffffffffff81111561086257600080fd5b61086e88828901610645565b925050608086013567ffffffffffffffff81111561088b57600080fd5b610897888289016106b5565b9150509295509295909350565b600080600080600060a086880312156108bc57600080fd5b60006108c888886105ce565b95505060206108d9888289016105ce565b94505060406108ea888289016107dc565b935050606061086e888289016107dc565b60006020828403121561090d57600080fd5b813567ffffffffffffffff81111561092457600080fd5b610930848285016105d9565b949350505050565b60006020828403121561094a57600080fd5b815167ffffffffffffffff81111561096157600080fd5b6109308482850161070f565b60006104e383836109f6565b600061098482610b98565b61098e8185610b9c565b9350836020820285016109a085610569565b8060005b858110156109da57848403895281516109bd858261096d565b94506109c883610569565b60209a909a01999250506001016109a4565b5091979650505050505050565b6109f081610bb0565b82525050565b6000610a0182610b98565b610a0b8185610b9c565b9350610a1b818560208601610bd8565b610a2481610c08565b9093019392505050565b6000610a3982610b98565b610a438185610458565b9350610a53818560208601610bd8565b9290920192915050565b6000610a6a601783610b9c565b7f6d7573742062652063616c6c6564206265206f776e6572000000000000000000815260200192915050565b6000610aa3601383610b9c565b72185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b815260200192915050565b6000610ad18284610a2e565b9392505050565b602080825281016104e38184610979565b602081016104e682846109e7565b602080825281016104e381846109f6565b602080825281016104e681610a5d565b602080825281016104e681610a96565b60405181810167ffffffffffffffff81118282101715610b4757600080fd5b604052919050565b600067ffffffffffffffff821115610b6657600080fd5b5060209081020190565b600067ffffffffffffffff821115610b8757600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b60006104e682610bbd565b6001600160e01b03191690565b6001600160a01b031690565b90565b82818337506000910152565b60005b83811015610bf3578181015183820152602001610bdb565b83811115610c02576000848401525b50505050565b601f01601f191690565b610c1b81610ba5565b8114610c2657600080fd5b50565b60038110610c2657600080fd5b610c1b81610bc956fe6361707475726564206120726576657274206572726f722c2062757420697420646f65736e277420636f6e666f726d20746f20746865207374616e64617264a365627a7a7230582045d8d817563bf1ad2fc12429d13de585835405e2079059db7e3941a7b1bf5b6f6c6578706572696d656e74616cf564736f6c634300050a0040"; 9 | const WALLET_IMPLEMENTATION_HASH = keccak256(PROXY_WALLET_BYTECODE); 10 | 11 | const getProxyWalletImplementationAddress = (factory: string): string => 12 | getCreate2Address(factory, WALLET_FACTORY_SALT, WALLET_IMPLEMENTATION_HASH); 13 | 14 | const assembleProxyWalletDeployCode = (factory: string): string => { 15 | return `0x3d3d606380380380913d393d73${factory 16 | .substr(2) 17 | .toLowerCase()}5af4602a57600080fd5b602d8060366000396000f3363d3d373d3d3d363d73${getProxyWalletImplementationAddress( 18 | factory, 19 | ) 20 | .substr(2) 21 | .toLowerCase()}5af43d82803e903d91602b57fd5bf352e831dd${defaultAbiCoder.encode(["bytes"], ["0x"]).substr(2)}`; 22 | }; 23 | 24 | /** 25 | * Calculates the address of a given address's proxywallet 26 | * @param factory - address of the proxy wallet factory contract 27 | * @param user - address which owns the proxy wallet we want to calculate the address of 28 | */ 29 | export const getProxyWalletAddress = (factory: string, user: string): string => 30 | getCreate2Address(factory, solidityKeccak256(["address"], [user]), keccak256(assembleProxyWalletDeployCode(factory))); 31 | -------------------------------------------------------------------------------- /src/abi/FixedProductMarketMaker.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [ 5 | { 6 | "name": "interfaceId", 7 | "type": "bytes4" 8 | } 9 | ], 10 | "name": "supportsInterface", 11 | "outputs": [ 12 | { 13 | "name": "", 14 | "type": "bool" 15 | } 16 | ], 17 | "payable": false, 18 | "stateMutability": "view", 19 | "type": "function" 20 | }, 21 | { 22 | "constant": false, 23 | "inputs": [ 24 | { 25 | "name": "spender", 26 | "type": "address" 27 | }, 28 | { 29 | "name": "amount", 30 | "type": "uint256" 31 | } 32 | ], 33 | "name": "approve", 34 | "outputs": [ 35 | { 36 | "name": "", 37 | "type": "bool" 38 | } 39 | ], 40 | "payable": false, 41 | "stateMutability": "nonpayable", 42 | "type": "function" 43 | }, 44 | { 45 | "constant": true, 46 | "inputs": [], 47 | "name": "totalSupply", 48 | "outputs": [ 49 | { 50 | "name": "", 51 | "type": "uint256" 52 | } 53 | ], 54 | "payable": false, 55 | "stateMutability": "view", 56 | "type": "function" 57 | }, 58 | { 59 | "constant": false, 60 | "inputs": [ 61 | { 62 | "name": "sender", 63 | "type": "address" 64 | }, 65 | { 66 | "name": "recipient", 67 | "type": "address" 68 | }, 69 | { 70 | "name": "amount", 71 | "type": "uint256" 72 | } 73 | ], 74 | "name": "transferFrom", 75 | "outputs": [ 76 | { 77 | "name": "", 78 | "type": "bool" 79 | } 80 | ], 81 | "payable": false, 82 | "stateMutability": "nonpayable", 83 | "type": "function" 84 | }, 85 | { 86 | "constant": false, 87 | "inputs": [ 88 | { 89 | "name": "spender", 90 | "type": "address" 91 | }, 92 | { 93 | "name": "addedValue", 94 | "type": "uint256" 95 | } 96 | ], 97 | "name": "increaseAllowance", 98 | "outputs": [ 99 | { 100 | "name": "", 101 | "type": "bool" 102 | } 103 | ], 104 | "payable": false, 105 | "stateMutability": "nonpayable", 106 | "type": "function" 107 | }, 108 | { 109 | "constant": true, 110 | "inputs": [], 111 | "name": "conditionalTokens", 112 | "outputs": [ 113 | { 114 | "name": "", 115 | "type": "address" 116 | } 117 | ], 118 | "payable": false, 119 | "stateMutability": "view", 120 | "type": "function" 121 | }, 122 | { 123 | "constant": true, 124 | "inputs": [ 125 | { 126 | "name": "account", 127 | "type": "address" 128 | } 129 | ], 130 | "name": "balanceOf", 131 | "outputs": [ 132 | { 133 | "name": "", 134 | "type": "uint256" 135 | } 136 | ], 137 | "payable": false, 138 | "stateMutability": "view", 139 | "type": "function" 140 | }, 141 | { 142 | "constant": false, 143 | "inputs": [ 144 | { 145 | "name": "spender", 146 | "type": "address" 147 | }, 148 | { 149 | "name": "subtractedValue", 150 | "type": "uint256" 151 | } 152 | ], 153 | "name": "decreaseAllowance", 154 | "outputs": [ 155 | { 156 | "name": "", 157 | "type": "bool" 158 | } 159 | ], 160 | "payable": false, 161 | "stateMutability": "nonpayable", 162 | "type": "function" 163 | }, 164 | { 165 | "constant": false, 166 | "inputs": [ 167 | { 168 | "name": "recipient", 169 | "type": "address" 170 | }, 171 | { 172 | "name": "amount", 173 | "type": "uint256" 174 | } 175 | ], 176 | "name": "transfer", 177 | "outputs": [ 178 | { 179 | "name": "", 180 | "type": "bool" 181 | } 182 | ], 183 | "payable": false, 184 | "stateMutability": "nonpayable", 185 | "type": "function" 186 | }, 187 | { 188 | "constant": true, 189 | "inputs": [], 190 | "name": "collateralToken", 191 | "outputs": [ 192 | { 193 | "name": "", 194 | "type": "address" 195 | } 196 | ], 197 | "payable": false, 198 | "stateMutability": "view", 199 | "type": "function" 200 | }, 201 | { 202 | "constant": true, 203 | "inputs": [ 204 | { 205 | "name": "", 206 | "type": "uint256" 207 | } 208 | ], 209 | "name": "conditionIds", 210 | "outputs": [ 211 | { 212 | "name": "", 213 | "type": "bytes32" 214 | } 215 | ], 216 | "payable": false, 217 | "stateMutability": "view", 218 | "type": "function" 219 | }, 220 | { 221 | "constant": true, 222 | "inputs": [ 223 | { 224 | "name": "owner", 225 | "type": "address" 226 | }, 227 | { 228 | "name": "spender", 229 | "type": "address" 230 | } 231 | ], 232 | "name": "allowance", 233 | "outputs": [ 234 | { 235 | "name": "", 236 | "type": "uint256" 237 | } 238 | ], 239 | "payable": false, 240 | "stateMutability": "view", 241 | "type": "function" 242 | }, 243 | { 244 | "constant": true, 245 | "inputs": [], 246 | "name": "fee", 247 | "outputs": [ 248 | { 249 | "name": "", 250 | "type": "uint256" 251 | } 252 | ], 253 | "payable": false, 254 | "stateMutability": "view", 255 | "type": "function" 256 | }, 257 | { 258 | "anonymous": false, 259 | "inputs": [ 260 | { 261 | "indexed": true, 262 | "name": "funder", 263 | "type": "address" 264 | }, 265 | { 266 | "indexed": false, 267 | "name": "amountsAdded", 268 | "type": "uint256[]" 269 | }, 270 | { 271 | "indexed": false, 272 | "name": "sharesMinted", 273 | "type": "uint256" 274 | } 275 | ], 276 | "name": "FPMMFundingAdded", 277 | "type": "event" 278 | }, 279 | { 280 | "anonymous": false, 281 | "inputs": [ 282 | { 283 | "indexed": true, 284 | "name": "funder", 285 | "type": "address" 286 | }, 287 | { 288 | "indexed": false, 289 | "name": "amountsRemoved", 290 | "type": "uint256[]" 291 | }, 292 | { 293 | "indexed": false, 294 | "name": "collateralRemovedFromFeePool", 295 | "type": "uint256" 296 | }, 297 | { 298 | "indexed": false, 299 | "name": "sharesBurnt", 300 | "type": "uint256" 301 | } 302 | ], 303 | "name": "FPMMFundingRemoved", 304 | "type": "event" 305 | }, 306 | { 307 | "anonymous": false, 308 | "inputs": [ 309 | { 310 | "indexed": true, 311 | "name": "buyer", 312 | "type": "address" 313 | }, 314 | { 315 | "indexed": false, 316 | "name": "investmentAmount", 317 | "type": "uint256" 318 | }, 319 | { 320 | "indexed": false, 321 | "name": "feeAmount", 322 | "type": "uint256" 323 | }, 324 | { 325 | "indexed": true, 326 | "name": "outcomeIndex", 327 | "type": "uint256" 328 | }, 329 | { 330 | "indexed": false, 331 | "name": "outcomeTokensBought", 332 | "type": "uint256" 333 | } 334 | ], 335 | "name": "FPMMBuy", 336 | "type": "event" 337 | }, 338 | { 339 | "anonymous": false, 340 | "inputs": [ 341 | { 342 | "indexed": true, 343 | "name": "seller", 344 | "type": "address" 345 | }, 346 | { 347 | "indexed": false, 348 | "name": "returnAmount", 349 | "type": "uint256" 350 | }, 351 | { 352 | "indexed": false, 353 | "name": "feeAmount", 354 | "type": "uint256" 355 | }, 356 | { 357 | "indexed": true, 358 | "name": "outcomeIndex", 359 | "type": "uint256" 360 | }, 361 | { 362 | "indexed": false, 363 | "name": "outcomeTokensSold", 364 | "type": "uint256" 365 | } 366 | ], 367 | "name": "FPMMSell", 368 | "type": "event" 369 | }, 370 | { 371 | "anonymous": false, 372 | "inputs": [ 373 | { 374 | "indexed": true, 375 | "name": "from", 376 | "type": "address" 377 | }, 378 | { 379 | "indexed": true, 380 | "name": "to", 381 | "type": "address" 382 | }, 383 | { 384 | "indexed": false, 385 | "name": "value", 386 | "type": "uint256" 387 | } 388 | ], 389 | "name": "Transfer", 390 | "type": "event" 391 | }, 392 | { 393 | "anonymous": false, 394 | "inputs": [ 395 | { 396 | "indexed": true, 397 | "name": "owner", 398 | "type": "address" 399 | }, 400 | { 401 | "indexed": true, 402 | "name": "spender", 403 | "type": "address" 404 | }, 405 | { 406 | "indexed": false, 407 | "name": "value", 408 | "type": "uint256" 409 | } 410 | ], 411 | "name": "Approval", 412 | "type": "event" 413 | }, 414 | { 415 | "constant": true, 416 | "inputs": [], 417 | "name": "collectedFees", 418 | "outputs": [ 419 | { 420 | "name": "", 421 | "type": "uint256" 422 | } 423 | ], 424 | "payable": false, 425 | "stateMutability": "view", 426 | "type": "function" 427 | }, 428 | { 429 | "constant": true, 430 | "inputs": [ 431 | { 432 | "name": "account", 433 | "type": "address" 434 | } 435 | ], 436 | "name": "feesWithdrawableBy", 437 | "outputs": [ 438 | { 439 | "name": "", 440 | "type": "uint256" 441 | } 442 | ], 443 | "payable": false, 444 | "stateMutability": "view", 445 | "type": "function" 446 | }, 447 | { 448 | "constant": false, 449 | "inputs": [ 450 | { 451 | "name": "account", 452 | "type": "address" 453 | } 454 | ], 455 | "name": "withdrawFees", 456 | "outputs": [], 457 | "payable": false, 458 | "stateMutability": "nonpayable", 459 | "type": "function" 460 | }, 461 | { 462 | "constant": false, 463 | "inputs": [ 464 | { 465 | "name": "addedFunds", 466 | "type": "uint256" 467 | }, 468 | { 469 | "name": "distributionHint", 470 | "type": "uint256[]" 471 | } 472 | ], 473 | "name": "addFunding", 474 | "outputs": [], 475 | "payable": false, 476 | "stateMutability": "nonpayable", 477 | "type": "function" 478 | }, 479 | { 480 | "constant": false, 481 | "inputs": [ 482 | { 483 | "name": "sharesToBurn", 484 | "type": "uint256" 485 | } 486 | ], 487 | "name": "removeFunding", 488 | "outputs": [], 489 | "payable": false, 490 | "stateMutability": "nonpayable", 491 | "type": "function" 492 | }, 493 | { 494 | "constant": false, 495 | "inputs": [ 496 | { 497 | "name": "operator", 498 | "type": "address" 499 | }, 500 | { 501 | "name": "from", 502 | "type": "address" 503 | }, 504 | { 505 | "name": "id", 506 | "type": "uint256" 507 | }, 508 | { 509 | "name": "value", 510 | "type": "uint256" 511 | }, 512 | { 513 | "name": "data", 514 | "type": "bytes" 515 | } 516 | ], 517 | "name": "onERC1155Received", 518 | "outputs": [ 519 | { 520 | "name": "", 521 | "type": "bytes4" 522 | } 523 | ], 524 | "payable": false, 525 | "stateMutability": "nonpayable", 526 | "type": "function" 527 | }, 528 | { 529 | "constant": false, 530 | "inputs": [ 531 | { 532 | "name": "operator", 533 | "type": "address" 534 | }, 535 | { 536 | "name": "from", 537 | "type": "address" 538 | }, 539 | { 540 | "name": "ids", 541 | "type": "uint256[]" 542 | }, 543 | { 544 | "name": "values", 545 | "type": "uint256[]" 546 | }, 547 | { 548 | "name": "data", 549 | "type": "bytes" 550 | } 551 | ], 552 | "name": "onERC1155BatchReceived", 553 | "outputs": [ 554 | { 555 | "name": "", 556 | "type": "bytes4" 557 | } 558 | ], 559 | "payable": false, 560 | "stateMutability": "nonpayable", 561 | "type": "function" 562 | }, 563 | { 564 | "constant": true, 565 | "inputs": [ 566 | { 567 | "name": "investmentAmount", 568 | "type": "uint256" 569 | }, 570 | { 571 | "name": "outcomeIndex", 572 | "type": "uint256" 573 | } 574 | ], 575 | "name": "calcBuyAmount", 576 | "outputs": [ 577 | { 578 | "name": "", 579 | "type": "uint256" 580 | } 581 | ], 582 | "payable": false, 583 | "stateMutability": "view", 584 | "type": "function" 585 | }, 586 | { 587 | "constant": true, 588 | "inputs": [ 589 | { 590 | "name": "returnAmount", 591 | "type": "uint256" 592 | }, 593 | { 594 | "name": "outcomeIndex", 595 | "type": "uint256" 596 | } 597 | ], 598 | "name": "calcSellAmount", 599 | "outputs": [ 600 | { 601 | "name": "outcomeTokenSellAmount", 602 | "type": "uint256" 603 | } 604 | ], 605 | "payable": false, 606 | "stateMutability": "view", 607 | "type": "function" 608 | }, 609 | { 610 | "constant": false, 611 | "inputs": [ 612 | { 613 | "name": "investmentAmount", 614 | "type": "uint256" 615 | }, 616 | { 617 | "name": "outcomeIndex", 618 | "type": "uint256" 619 | }, 620 | { 621 | "name": "minOutcomeTokensToBuy", 622 | "type": "uint256" 623 | } 624 | ], 625 | "name": "buy", 626 | "outputs": [], 627 | "payable": false, 628 | "stateMutability": "nonpayable", 629 | "type": "function" 630 | }, 631 | { 632 | "constant": false, 633 | "inputs": [ 634 | { 635 | "name": "returnAmount", 636 | "type": "uint256" 637 | }, 638 | { 639 | "name": "outcomeIndex", 640 | "type": "uint256" 641 | }, 642 | { 643 | "name": "maxOutcomeTokensToSell", 644 | "type": "uint256" 645 | } 646 | ], 647 | "name": "sell", 648 | "outputs": [], 649 | "payable": false, 650 | "stateMutability": "nonpayable", 651 | "type": "function" 652 | } 653 | ] 654 | -------------------------------------------------------------------------------- /src/abi/ConditionalTokens.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [ 5 | { 6 | "name": "owner", 7 | "type": "address" 8 | }, 9 | { 10 | "name": "id", 11 | "type": "uint256" 12 | } 13 | ], 14 | "name": "balanceOf", 15 | "outputs": [ 16 | { 17 | "name": "", 18 | "type": "uint256" 19 | } 20 | ], 21 | "payable": false, 22 | "stateMutability": "view", 23 | "type": "function" 24 | }, 25 | { 26 | "constant": true, 27 | "inputs": [ 28 | { 29 | "name": "interfaceId", 30 | "type": "bytes4" 31 | } 32 | ], 33 | "name": "supportsInterface", 34 | "outputs": [ 35 | { 36 | "name": "", 37 | "type": "bool" 38 | } 39 | ], 40 | "payable": false, 41 | "stateMutability": "view", 42 | "type": "function" 43 | }, 44 | { 45 | "constant": true, 46 | "inputs": [ 47 | { 48 | "name": "", 49 | "type": "bytes32" 50 | }, 51 | { 52 | "name": "", 53 | "type": "uint256" 54 | } 55 | ], 56 | "name": "payoutNumerators", 57 | "outputs": [ 58 | { 59 | "name": "", 60 | "type": "uint256" 61 | } 62 | ], 63 | "payable": false, 64 | "stateMutability": "view", 65 | "type": "function" 66 | }, 67 | { 68 | "constant": false, 69 | "inputs": [ 70 | { 71 | "name": "from", 72 | "type": "address" 73 | }, 74 | { 75 | "name": "to", 76 | "type": "address" 77 | }, 78 | { 79 | "name": "ids", 80 | "type": "uint256[]" 81 | }, 82 | { 83 | "name": "values", 84 | "type": "uint256[]" 85 | }, 86 | { 87 | "name": "data", 88 | "type": "bytes" 89 | } 90 | ], 91 | "name": "safeBatchTransferFrom", 92 | "outputs": [], 93 | "payable": false, 94 | "stateMutability": "nonpayable", 95 | "type": "function" 96 | }, 97 | { 98 | "constant": true, 99 | "inputs": [ 100 | { 101 | "name": "owners", 102 | "type": "address[]" 103 | }, 104 | { 105 | "name": "ids", 106 | "type": "uint256[]" 107 | } 108 | ], 109 | "name": "balanceOfBatch", 110 | "outputs": [ 111 | { 112 | "name": "", 113 | "type": "uint256[]" 114 | } 115 | ], 116 | "payable": false, 117 | "stateMutability": "view", 118 | "type": "function" 119 | }, 120 | { 121 | "constant": false, 122 | "inputs": [ 123 | { 124 | "name": "operator", 125 | "type": "address" 126 | }, 127 | { 128 | "name": "approved", 129 | "type": "bool" 130 | } 131 | ], 132 | "name": "setApprovalForAll", 133 | "outputs": [], 134 | "payable": false, 135 | "stateMutability": "nonpayable", 136 | "type": "function" 137 | }, 138 | { 139 | "constant": true, 140 | "inputs": [ 141 | { 142 | "name": "", 143 | "type": "bytes32" 144 | } 145 | ], 146 | "name": "payoutDenominator", 147 | "outputs": [ 148 | { 149 | "name": "", 150 | "type": "uint256" 151 | } 152 | ], 153 | "payable": false, 154 | "stateMutability": "view", 155 | "type": "function" 156 | }, 157 | { 158 | "constant": true, 159 | "inputs": [ 160 | { 161 | "name": "owner", 162 | "type": "address" 163 | }, 164 | { 165 | "name": "operator", 166 | "type": "address" 167 | } 168 | ], 169 | "name": "isApprovedForAll", 170 | "outputs": [ 171 | { 172 | "name": "", 173 | "type": "bool" 174 | } 175 | ], 176 | "payable": false, 177 | "stateMutability": "view", 178 | "type": "function" 179 | }, 180 | { 181 | "constant": false, 182 | "inputs": [ 183 | { 184 | "name": "from", 185 | "type": "address" 186 | }, 187 | { 188 | "name": "to", 189 | "type": "address" 190 | }, 191 | { 192 | "name": "id", 193 | "type": "uint256" 194 | }, 195 | { 196 | "name": "value", 197 | "type": "uint256" 198 | }, 199 | { 200 | "name": "data", 201 | "type": "bytes" 202 | } 203 | ], 204 | "name": "safeTransferFrom", 205 | "outputs": [], 206 | "payable": false, 207 | "stateMutability": "nonpayable", 208 | "type": "function" 209 | }, 210 | { 211 | "anonymous": false, 212 | "inputs": [ 213 | { 214 | "indexed": true, 215 | "name": "conditionId", 216 | "type": "bytes32" 217 | }, 218 | { 219 | "indexed": true, 220 | "name": "oracle", 221 | "type": "address" 222 | }, 223 | { 224 | "indexed": true, 225 | "name": "questionId", 226 | "type": "bytes32" 227 | }, 228 | { 229 | "indexed": false, 230 | "name": "outcomeSlotCount", 231 | "type": "uint256" 232 | } 233 | ], 234 | "name": "ConditionPreparation", 235 | "type": "event" 236 | }, 237 | { 238 | "anonymous": false, 239 | "inputs": [ 240 | { 241 | "indexed": true, 242 | "name": "conditionId", 243 | "type": "bytes32" 244 | }, 245 | { 246 | "indexed": true, 247 | "name": "oracle", 248 | "type": "address" 249 | }, 250 | { 251 | "indexed": true, 252 | "name": "questionId", 253 | "type": "bytes32" 254 | }, 255 | { 256 | "indexed": false, 257 | "name": "outcomeSlotCount", 258 | "type": "uint256" 259 | }, 260 | { 261 | "indexed": false, 262 | "name": "payoutNumerators", 263 | "type": "uint256[]" 264 | } 265 | ], 266 | "name": "ConditionResolution", 267 | "type": "event" 268 | }, 269 | { 270 | "anonymous": false, 271 | "inputs": [ 272 | { 273 | "indexed": true, 274 | "name": "stakeholder", 275 | "type": "address" 276 | }, 277 | { 278 | "indexed": false, 279 | "name": "collateralToken", 280 | "type": "address" 281 | }, 282 | { 283 | "indexed": true, 284 | "name": "parentCollectionId", 285 | "type": "bytes32" 286 | }, 287 | { 288 | "indexed": true, 289 | "name": "conditionId", 290 | "type": "bytes32" 291 | }, 292 | { 293 | "indexed": false, 294 | "name": "partition", 295 | "type": "uint256[]" 296 | }, 297 | { 298 | "indexed": false, 299 | "name": "amount", 300 | "type": "uint256" 301 | } 302 | ], 303 | "name": "PositionSplit", 304 | "type": "event" 305 | }, 306 | { 307 | "anonymous": false, 308 | "inputs": [ 309 | { 310 | "indexed": true, 311 | "name": "stakeholder", 312 | "type": "address" 313 | }, 314 | { 315 | "indexed": false, 316 | "name": "collateralToken", 317 | "type": "address" 318 | }, 319 | { 320 | "indexed": true, 321 | "name": "parentCollectionId", 322 | "type": "bytes32" 323 | }, 324 | { 325 | "indexed": true, 326 | "name": "conditionId", 327 | "type": "bytes32" 328 | }, 329 | { 330 | "indexed": false, 331 | "name": "partition", 332 | "type": "uint256[]" 333 | }, 334 | { 335 | "indexed": false, 336 | "name": "amount", 337 | "type": "uint256" 338 | } 339 | ], 340 | "name": "PositionsMerge", 341 | "type": "event" 342 | }, 343 | { 344 | "anonymous": false, 345 | "inputs": [ 346 | { 347 | "indexed": true, 348 | "name": "redeemer", 349 | "type": "address" 350 | }, 351 | { 352 | "indexed": true, 353 | "name": "collateralToken", 354 | "type": "address" 355 | }, 356 | { 357 | "indexed": true, 358 | "name": "parentCollectionId", 359 | "type": "bytes32" 360 | }, 361 | { 362 | "indexed": false, 363 | "name": "conditionId", 364 | "type": "bytes32" 365 | }, 366 | { 367 | "indexed": false, 368 | "name": "indexSets", 369 | "type": "uint256[]" 370 | }, 371 | { 372 | "indexed": false, 373 | "name": "payout", 374 | "type": "uint256" 375 | } 376 | ], 377 | "name": "PayoutRedemption", 378 | "type": "event" 379 | }, 380 | { 381 | "anonymous": false, 382 | "inputs": [ 383 | { 384 | "indexed": true, 385 | "name": "operator", 386 | "type": "address" 387 | }, 388 | { 389 | "indexed": true, 390 | "name": "from", 391 | "type": "address" 392 | }, 393 | { 394 | "indexed": true, 395 | "name": "to", 396 | "type": "address" 397 | }, 398 | { 399 | "indexed": false, 400 | "name": "id", 401 | "type": "uint256" 402 | }, 403 | { 404 | "indexed": false, 405 | "name": "value", 406 | "type": "uint256" 407 | } 408 | ], 409 | "name": "TransferSingle", 410 | "type": "event" 411 | }, 412 | { 413 | "anonymous": false, 414 | "inputs": [ 415 | { 416 | "indexed": true, 417 | "name": "operator", 418 | "type": "address" 419 | }, 420 | { 421 | "indexed": true, 422 | "name": "from", 423 | "type": "address" 424 | }, 425 | { 426 | "indexed": true, 427 | "name": "to", 428 | "type": "address" 429 | }, 430 | { 431 | "indexed": false, 432 | "name": "ids", 433 | "type": "uint256[]" 434 | }, 435 | { 436 | "indexed": false, 437 | "name": "values", 438 | "type": "uint256[]" 439 | } 440 | ], 441 | "name": "TransferBatch", 442 | "type": "event" 443 | }, 444 | { 445 | "anonymous": false, 446 | "inputs": [ 447 | { 448 | "indexed": true, 449 | "name": "owner", 450 | "type": "address" 451 | }, 452 | { 453 | "indexed": true, 454 | "name": "operator", 455 | "type": "address" 456 | }, 457 | { 458 | "indexed": false, 459 | "name": "approved", 460 | "type": "bool" 461 | } 462 | ], 463 | "name": "ApprovalForAll", 464 | "type": "event" 465 | }, 466 | { 467 | "anonymous": false, 468 | "inputs": [ 469 | { 470 | "indexed": false, 471 | "name": "value", 472 | "type": "string" 473 | }, 474 | { 475 | "indexed": true, 476 | "name": "id", 477 | "type": "uint256" 478 | } 479 | ], 480 | "name": "URI", 481 | "type": "event" 482 | }, 483 | { 484 | "constant": false, 485 | "inputs": [ 486 | { 487 | "name": "oracle", 488 | "type": "address" 489 | }, 490 | { 491 | "name": "questionId", 492 | "type": "bytes32" 493 | }, 494 | { 495 | "name": "outcomeSlotCount", 496 | "type": "uint256" 497 | } 498 | ], 499 | "name": "prepareCondition", 500 | "outputs": [], 501 | "payable": false, 502 | "stateMutability": "nonpayable", 503 | "type": "function" 504 | }, 505 | { 506 | "constant": false, 507 | "inputs": [ 508 | { 509 | "name": "questionId", 510 | "type": "bytes32" 511 | }, 512 | { 513 | "name": "payouts", 514 | "type": "uint256[]" 515 | } 516 | ], 517 | "name": "reportPayouts", 518 | "outputs": [], 519 | "payable": false, 520 | "stateMutability": "nonpayable", 521 | "type": "function" 522 | }, 523 | { 524 | "constant": false, 525 | "inputs": [ 526 | { 527 | "name": "collateralToken", 528 | "type": "address" 529 | }, 530 | { 531 | "name": "parentCollectionId", 532 | "type": "bytes32" 533 | }, 534 | { 535 | "name": "conditionId", 536 | "type": "bytes32" 537 | }, 538 | { 539 | "name": "partition", 540 | "type": "uint256[]" 541 | }, 542 | { 543 | "name": "amount", 544 | "type": "uint256" 545 | } 546 | ], 547 | "name": "splitPosition", 548 | "outputs": [], 549 | "payable": false, 550 | "stateMutability": "nonpayable", 551 | "type": "function" 552 | }, 553 | { 554 | "constant": false, 555 | "inputs": [ 556 | { 557 | "name": "collateralToken", 558 | "type": "address" 559 | }, 560 | { 561 | "name": "parentCollectionId", 562 | "type": "bytes32" 563 | }, 564 | { 565 | "name": "conditionId", 566 | "type": "bytes32" 567 | }, 568 | { 569 | "name": "partition", 570 | "type": "uint256[]" 571 | }, 572 | { 573 | "name": "amount", 574 | "type": "uint256" 575 | } 576 | ], 577 | "name": "mergePositions", 578 | "outputs": [], 579 | "payable": false, 580 | "stateMutability": "nonpayable", 581 | "type": "function" 582 | }, 583 | { 584 | "constant": false, 585 | "inputs": [ 586 | { 587 | "name": "collateralToken", 588 | "type": "address" 589 | }, 590 | { 591 | "name": "parentCollectionId", 592 | "type": "bytes32" 593 | }, 594 | { 595 | "name": "conditionId", 596 | "type": "bytes32" 597 | }, 598 | { 599 | "name": "indexSets", 600 | "type": "uint256[]" 601 | } 602 | ], 603 | "name": "redeemPositions", 604 | "outputs": [], 605 | "payable": false, 606 | "stateMutability": "nonpayable", 607 | "type": "function" 608 | }, 609 | { 610 | "constant": true, 611 | "inputs": [ 612 | { 613 | "name": "conditionId", 614 | "type": "bytes32" 615 | } 616 | ], 617 | "name": "getOutcomeSlotCount", 618 | "outputs": [ 619 | { 620 | "name": "", 621 | "type": "uint256" 622 | } 623 | ], 624 | "payable": false, 625 | "stateMutability": "view", 626 | "type": "function" 627 | }, 628 | { 629 | "constant": true, 630 | "inputs": [ 631 | { 632 | "name": "oracle", 633 | "type": "address" 634 | }, 635 | { 636 | "name": "questionId", 637 | "type": "bytes32" 638 | }, 639 | { 640 | "name": "outcomeSlotCount", 641 | "type": "uint256" 642 | } 643 | ], 644 | "name": "getConditionId", 645 | "outputs": [ 646 | { 647 | "name": "", 648 | "type": "bytes32" 649 | } 650 | ], 651 | "payable": false, 652 | "stateMutability": "pure", 653 | "type": "function" 654 | }, 655 | { 656 | "constant": true, 657 | "inputs": [ 658 | { 659 | "name": "parentCollectionId", 660 | "type": "bytes32" 661 | }, 662 | { 663 | "name": "conditionId", 664 | "type": "bytes32" 665 | }, 666 | { 667 | "name": "indexSet", 668 | "type": "uint256" 669 | } 670 | ], 671 | "name": "getCollectionId", 672 | "outputs": [ 673 | { 674 | "name": "", 675 | "type": "bytes32" 676 | } 677 | ], 678 | "payable": false, 679 | "stateMutability": "view", 680 | "type": "function" 681 | }, 682 | { 683 | "constant": true, 684 | "inputs": [ 685 | { 686 | "name": "collateralToken", 687 | "type": "address" 688 | }, 689 | { 690 | "name": "collectionId", 691 | "type": "bytes32" 692 | } 693 | ], 694 | "name": "getPositionId", 695 | "outputs": [ 696 | { 697 | "name": "", 698 | "type": "uint256" 699 | } 700 | ], 701 | "payable": false, 702 | "stateMutability": "pure", 703 | "type": "function" 704 | } 705 | ] 706 | -------------------------------------------------------------------------------- /src/abi/NegRiskAdapter.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_ctf", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "_collateral", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "address", 16 | "name": "_vault", 17 | "type": "address" 18 | } 19 | ], 20 | "stateMutability": "nonpayable", 21 | "type": "constructor" 22 | }, 23 | { 24 | "inputs": [], 25 | "name": "DeterminedFlagAlreadySet", 26 | "type": "error" 27 | }, 28 | { 29 | "inputs": [], 30 | "name": "FeeBipsOutOfBounds", 31 | "type": "error" 32 | }, 33 | { 34 | "inputs": [], 35 | "name": "IndexOutOfBounds", 36 | "type": "error" 37 | }, 38 | { 39 | "inputs": [], 40 | "name": "InvalidIndexSet", 41 | "type": "error" 42 | }, 43 | { 44 | "inputs": [], 45 | "name": "LengthMismatch", 46 | "type": "error" 47 | }, 48 | { 49 | "inputs": [], 50 | "name": "MarketAlreadyDetermined", 51 | "type": "error" 52 | }, 53 | { 54 | "inputs": [], 55 | "name": "MarketAlreadyPrepared", 56 | "type": "error" 57 | }, 58 | { 59 | "inputs": [], 60 | "name": "MarketNotPrepared", 61 | "type": "error" 62 | }, 63 | { 64 | "inputs": [], 65 | "name": "NoConvertiblePositions", 66 | "type": "error" 67 | }, 68 | { 69 | "inputs": [], 70 | "name": "NotApprovedForAll", 71 | "type": "error" 72 | }, 73 | { 74 | "inputs": [], 75 | "name": "OnlyOracle", 76 | "type": "error" 77 | }, 78 | { 79 | "inputs": [], 80 | "name": "UnexpectedCollateralToken", 81 | "type": "error" 82 | }, 83 | { 84 | "anonymous": false, 85 | "inputs": [ 86 | { 87 | "indexed": true, 88 | "internalType": "bytes32", 89 | "name": "marketId", 90 | "type": "bytes32" 91 | }, 92 | { 93 | "indexed": true, 94 | "internalType": "address", 95 | "name": "oracle", 96 | "type": "address" 97 | }, 98 | { 99 | "indexed": false, 100 | "internalType": "uint256", 101 | "name": "feeBips", 102 | "type": "uint256" 103 | }, 104 | { 105 | "indexed": false, 106 | "internalType": "bytes", 107 | "name": "data", 108 | "type": "bytes" 109 | } 110 | ], 111 | "name": "MarketPrepared", 112 | "type": "event" 113 | }, 114 | { 115 | "anonymous": false, 116 | "inputs": [ 117 | { 118 | "indexed": true, 119 | "internalType": "bytes32", 120 | "name": "marketId", 121 | "type": "bytes32" 122 | }, 123 | { 124 | "indexed": true, 125 | "internalType": "bytes32", 126 | "name": "questionId", 127 | "type": "bytes32" 128 | }, 129 | { 130 | "indexed": false, 131 | "internalType": "bool", 132 | "name": "outcome", 133 | "type": "bool" 134 | } 135 | ], 136 | "name": "OutcomeReported", 137 | "type": "event" 138 | }, 139 | { 140 | "anonymous": false, 141 | "inputs": [ 142 | { 143 | "indexed": true, 144 | "internalType": "address", 145 | "name": "redeemer", 146 | "type": "address" 147 | }, 148 | { 149 | "indexed": true, 150 | "internalType": "bytes32", 151 | "name": "conditionId", 152 | "type": "bytes32" 153 | }, 154 | { 155 | "indexed": false, 156 | "internalType": "uint256[]", 157 | "name": "amounts", 158 | "type": "uint256[]" 159 | }, 160 | { 161 | "indexed": false, 162 | "internalType": "uint256", 163 | "name": "payout", 164 | "type": "uint256" 165 | } 166 | ], 167 | "name": "PayoutRedemption", 168 | "type": "event" 169 | }, 170 | { 171 | "anonymous": false, 172 | "inputs": [ 173 | { 174 | "indexed": true, 175 | "internalType": "address", 176 | "name": "stakeholder", 177 | "type": "address" 178 | }, 179 | { 180 | "indexed": true, 181 | "internalType": "bytes32", 182 | "name": "conditionId", 183 | "type": "bytes32" 184 | }, 185 | { 186 | "indexed": false, 187 | "internalType": "uint256", 188 | "name": "amount", 189 | "type": "uint256" 190 | } 191 | ], 192 | "name": "PositionSplit", 193 | "type": "event" 194 | }, 195 | { 196 | "anonymous": false, 197 | "inputs": [ 198 | { 199 | "indexed": true, 200 | "internalType": "address", 201 | "name": "stakeholder", 202 | "type": "address" 203 | }, 204 | { 205 | "indexed": true, 206 | "internalType": "bytes32", 207 | "name": "marketId", 208 | "type": "bytes32" 209 | }, 210 | { 211 | "indexed": true, 212 | "internalType": "uint256", 213 | "name": "indexSet", 214 | "type": "uint256" 215 | }, 216 | { 217 | "indexed": false, 218 | "internalType": "uint256", 219 | "name": "amount", 220 | "type": "uint256" 221 | } 222 | ], 223 | "name": "PositionsConverted", 224 | "type": "event" 225 | }, 226 | { 227 | "anonymous": false, 228 | "inputs": [ 229 | { 230 | "indexed": true, 231 | "internalType": "address", 232 | "name": "stakeholder", 233 | "type": "address" 234 | }, 235 | { 236 | "indexed": true, 237 | "internalType": "bytes32", 238 | "name": "conditionId", 239 | "type": "bytes32" 240 | }, 241 | { 242 | "indexed": false, 243 | "internalType": "uint256", 244 | "name": "amount", 245 | "type": "uint256" 246 | } 247 | ], 248 | "name": "PositionsMerge", 249 | "type": "event" 250 | }, 251 | { 252 | "anonymous": false, 253 | "inputs": [ 254 | { 255 | "indexed": true, 256 | "internalType": "bytes32", 257 | "name": "marketId", 258 | "type": "bytes32" 259 | }, 260 | { 261 | "indexed": true, 262 | "internalType": "bytes32", 263 | "name": "questionId", 264 | "type": "bytes32" 265 | }, 266 | { 267 | "indexed": false, 268 | "internalType": "uint256", 269 | "name": "index", 270 | "type": "uint256" 271 | }, 272 | { 273 | "indexed": false, 274 | "internalType": "bytes", 275 | "name": "data", 276 | "type": "bytes" 277 | } 278 | ], 279 | "name": "QuestionPrepared", 280 | "type": "event" 281 | }, 282 | { 283 | "inputs": [], 284 | "name": "FEE_DENOMINATOR", 285 | "outputs": [ 286 | { 287 | "internalType": "uint256", 288 | "name": "", 289 | "type": "uint256" 290 | } 291 | ], 292 | "stateMutability": "view", 293 | "type": "function" 294 | }, 295 | { 296 | "inputs": [], 297 | "name": "NO_TOKEN_BURN_ADDRESS", 298 | "outputs": [ 299 | { 300 | "internalType": "address", 301 | "name": "", 302 | "type": "address" 303 | } 304 | ], 305 | "stateMutability": "view", 306 | "type": "function" 307 | }, 308 | { 309 | "inputs": [ 310 | { 311 | "internalType": "address", 312 | "name": "_owner", 313 | "type": "address" 314 | }, 315 | { 316 | "internalType": "uint256", 317 | "name": "_id", 318 | "type": "uint256" 319 | } 320 | ], 321 | "name": "balanceOf", 322 | "outputs": [ 323 | { 324 | "internalType": "uint256", 325 | "name": "", 326 | "type": "uint256" 327 | } 328 | ], 329 | "stateMutability": "view", 330 | "type": "function" 331 | }, 332 | { 333 | "inputs": [ 334 | { 335 | "internalType": "address[]", 336 | "name": "_owners", 337 | "type": "address[]" 338 | }, 339 | { 340 | "internalType": "uint256[]", 341 | "name": "_ids", 342 | "type": "uint256[]" 343 | } 344 | ], 345 | "name": "balanceOfBatch", 346 | "outputs": [ 347 | { 348 | "internalType": "uint256[]", 349 | "name": "", 350 | "type": "uint256[]" 351 | } 352 | ], 353 | "stateMutability": "view", 354 | "type": "function" 355 | }, 356 | { 357 | "inputs": [], 358 | "name": "col", 359 | "outputs": [ 360 | { 361 | "internalType": "contract ERC20", 362 | "name": "", 363 | "type": "address" 364 | } 365 | ], 366 | "stateMutability": "view", 367 | "type": "function" 368 | }, 369 | { 370 | "inputs": [ 371 | { 372 | "internalType": "bytes32", 373 | "name": "_marketId", 374 | "type": "bytes32" 375 | }, 376 | { 377 | "internalType": "uint256", 378 | "name": "_indexSet", 379 | "type": "uint256" 380 | }, 381 | { 382 | "internalType": "uint256", 383 | "name": "_amount", 384 | "type": "uint256" 385 | } 386 | ], 387 | "name": "convertPositions", 388 | "outputs": [], 389 | "stateMutability": "nonpayable", 390 | "type": "function" 391 | }, 392 | { 393 | "inputs": [], 394 | "name": "ctf", 395 | "outputs": [ 396 | { 397 | "internalType": "contract IConditionalTokens", 398 | "name": "", 399 | "type": "address" 400 | } 401 | ], 402 | "stateMutability": "view", 403 | "type": "function" 404 | }, 405 | { 406 | "inputs": [ 407 | { 408 | "internalType": "bytes32", 409 | "name": "_questionId", 410 | "type": "bytes32" 411 | } 412 | ], 413 | "name": "getConditionId", 414 | "outputs": [ 415 | { 416 | "internalType": "bytes32", 417 | "name": "", 418 | "type": "bytes32" 419 | } 420 | ], 421 | "stateMutability": "view", 422 | "type": "function" 423 | }, 424 | { 425 | "inputs": [ 426 | { 427 | "internalType": "bytes32", 428 | "name": "_marketId", 429 | "type": "bytes32" 430 | } 431 | ], 432 | "name": "getDetermined", 433 | "outputs": [ 434 | { 435 | "internalType": "bool", 436 | "name": "", 437 | "type": "bool" 438 | } 439 | ], 440 | "stateMutability": "view", 441 | "type": "function" 442 | }, 443 | { 444 | "inputs": [ 445 | { 446 | "internalType": "bytes32", 447 | "name": "_marketId", 448 | "type": "bytes32" 449 | } 450 | ], 451 | "name": "getFeeBips", 452 | "outputs": [ 453 | { 454 | "internalType": "uint256", 455 | "name": "", 456 | "type": "uint256" 457 | } 458 | ], 459 | "stateMutability": "view", 460 | "type": "function" 461 | }, 462 | { 463 | "inputs": [ 464 | { 465 | "internalType": "bytes32", 466 | "name": "_marketId", 467 | "type": "bytes32" 468 | } 469 | ], 470 | "name": "getMarketData", 471 | "outputs": [ 472 | { 473 | "internalType": "MarketData", 474 | "name": "", 475 | "type": "bytes32" 476 | } 477 | ], 478 | "stateMutability": "view", 479 | "type": "function" 480 | }, 481 | { 482 | "inputs": [ 483 | { 484 | "internalType": "bytes32", 485 | "name": "_marketId", 486 | "type": "bytes32" 487 | } 488 | ], 489 | "name": "getOracle", 490 | "outputs": [ 491 | { 492 | "internalType": "address", 493 | "name": "", 494 | "type": "address" 495 | } 496 | ], 497 | "stateMutability": "view", 498 | "type": "function" 499 | }, 500 | { 501 | "inputs": [ 502 | { 503 | "internalType": "bytes32", 504 | "name": "_questionId", 505 | "type": "bytes32" 506 | }, 507 | { 508 | "internalType": "bool", 509 | "name": "_outcome", 510 | "type": "bool" 511 | } 512 | ], 513 | "name": "getPositionId", 514 | "outputs": [ 515 | { 516 | "internalType": "uint256", 517 | "name": "", 518 | "type": "uint256" 519 | } 520 | ], 521 | "stateMutability": "view", 522 | "type": "function" 523 | }, 524 | { 525 | "inputs": [ 526 | { 527 | "internalType": "bytes32", 528 | "name": "_marketId", 529 | "type": "bytes32" 530 | } 531 | ], 532 | "name": "getQuestionCount", 533 | "outputs": [ 534 | { 535 | "internalType": "uint256", 536 | "name": "", 537 | "type": "uint256" 538 | } 539 | ], 540 | "stateMutability": "view", 541 | "type": "function" 542 | }, 543 | { 544 | "inputs": [ 545 | { 546 | "internalType": "bytes32", 547 | "name": "_marketId", 548 | "type": "bytes32" 549 | } 550 | ], 551 | "name": "getResult", 552 | "outputs": [ 553 | { 554 | "internalType": "uint256", 555 | "name": "", 556 | "type": "uint256" 557 | } 558 | ], 559 | "stateMutability": "view", 560 | "type": "function" 561 | }, 562 | { 563 | "inputs": [ 564 | { 565 | "internalType": "address", 566 | "name": "_collateralToken", 567 | "type": "address" 568 | }, 569 | { 570 | "internalType": "bytes32", 571 | "name": "", 572 | "type": "bytes32" 573 | }, 574 | { 575 | "internalType": "bytes32", 576 | "name": "_conditionId", 577 | "type": "bytes32" 578 | }, 579 | { 580 | "internalType": "uint256[]", 581 | "name": "", 582 | "type": "uint256[]" 583 | }, 584 | { 585 | "internalType": "uint256", 586 | "name": "_amount", 587 | "type": "uint256" 588 | } 589 | ], 590 | "name": "mergePositions", 591 | "outputs": [], 592 | "stateMutability": "nonpayable", 593 | "type": "function" 594 | }, 595 | { 596 | "inputs": [ 597 | { 598 | "internalType": "bytes32", 599 | "name": "_conditionId", 600 | "type": "bytes32" 601 | }, 602 | { 603 | "internalType": "uint256", 604 | "name": "_amount", 605 | "type": "uint256" 606 | } 607 | ], 608 | "name": "mergePositions", 609 | "outputs": [], 610 | "stateMutability": "nonpayable", 611 | "type": "function" 612 | }, 613 | { 614 | "inputs": [ 615 | { 616 | "internalType": "address", 617 | "name": "", 618 | "type": "address" 619 | }, 620 | { 621 | "internalType": "address", 622 | "name": "", 623 | "type": "address" 624 | }, 625 | { 626 | "internalType": "uint256[]", 627 | "name": "", 628 | "type": "uint256[]" 629 | }, 630 | { 631 | "internalType": "uint256[]", 632 | "name": "", 633 | "type": "uint256[]" 634 | }, 635 | { 636 | "internalType": "bytes", 637 | "name": "", 638 | "type": "bytes" 639 | } 640 | ], 641 | "name": "onERC1155BatchReceived", 642 | "outputs": [ 643 | { 644 | "internalType": "bytes4", 645 | "name": "", 646 | "type": "bytes4" 647 | } 648 | ], 649 | "stateMutability": "nonpayable", 650 | "type": "function" 651 | }, 652 | { 653 | "inputs": [ 654 | { 655 | "internalType": "address", 656 | "name": "", 657 | "type": "address" 658 | }, 659 | { 660 | "internalType": "address", 661 | "name": "", 662 | "type": "address" 663 | }, 664 | { 665 | "internalType": "uint256", 666 | "name": "", 667 | "type": "uint256" 668 | }, 669 | { 670 | "internalType": "uint256", 671 | "name": "", 672 | "type": "uint256" 673 | }, 674 | { 675 | "internalType": "bytes", 676 | "name": "", 677 | "type": "bytes" 678 | } 679 | ], 680 | "name": "onERC1155Received", 681 | "outputs": [ 682 | { 683 | "internalType": "bytes4", 684 | "name": "", 685 | "type": "bytes4" 686 | } 687 | ], 688 | "stateMutability": "nonpayable", 689 | "type": "function" 690 | }, 691 | { 692 | "inputs": [ 693 | { 694 | "internalType": "uint256", 695 | "name": "_feeBips", 696 | "type": "uint256" 697 | }, 698 | { 699 | "internalType": "bytes", 700 | "name": "_metadata", 701 | "type": "bytes" 702 | } 703 | ], 704 | "name": "prepareMarket", 705 | "outputs": [ 706 | { 707 | "internalType": "bytes32", 708 | "name": "", 709 | "type": "bytes32" 710 | } 711 | ], 712 | "stateMutability": "nonpayable", 713 | "type": "function" 714 | }, 715 | { 716 | "inputs": [ 717 | { 718 | "internalType": "bytes32", 719 | "name": "_marketId", 720 | "type": "bytes32" 721 | }, 722 | { 723 | "internalType": "bytes", 724 | "name": "_metadata", 725 | "type": "bytes" 726 | } 727 | ], 728 | "name": "prepareQuestion", 729 | "outputs": [ 730 | { 731 | "internalType": "bytes32", 732 | "name": "", 733 | "type": "bytes32" 734 | } 735 | ], 736 | "stateMutability": "nonpayable", 737 | "type": "function" 738 | }, 739 | { 740 | "inputs": [ 741 | { 742 | "internalType": "bytes32", 743 | "name": "_conditionId", 744 | "type": "bytes32" 745 | }, 746 | { 747 | "internalType": "uint256[]", 748 | "name": "_amounts", 749 | "type": "uint256[]" 750 | } 751 | ], 752 | "name": "redeemPositions", 753 | "outputs": [], 754 | "stateMutability": "nonpayable", 755 | "type": "function" 756 | }, 757 | { 758 | "inputs": [ 759 | { 760 | "internalType": "bytes32", 761 | "name": "_questionId", 762 | "type": "bytes32" 763 | }, 764 | { 765 | "internalType": "bool", 766 | "name": "_outcome", 767 | "type": "bool" 768 | } 769 | ], 770 | "name": "reportOutcome", 771 | "outputs": [], 772 | "stateMutability": "nonpayable", 773 | "type": "function" 774 | }, 775 | { 776 | "inputs": [ 777 | { 778 | "internalType": "address", 779 | "name": "_from", 780 | "type": "address" 781 | }, 782 | { 783 | "internalType": "address", 784 | "name": "_to", 785 | "type": "address" 786 | }, 787 | { 788 | "internalType": "uint256[]", 789 | "name": "_ids", 790 | "type": "uint256[]" 791 | }, 792 | { 793 | "internalType": "uint256[]", 794 | "name": "_values", 795 | "type": "uint256[]" 796 | }, 797 | { 798 | "internalType": "bytes", 799 | "name": "_data", 800 | "type": "bytes" 801 | } 802 | ], 803 | "name": "safeBatchTransferFrom", 804 | "outputs": [], 805 | "stateMutability": "nonpayable", 806 | "type": "function" 807 | }, 808 | { 809 | "inputs": [ 810 | { 811 | "internalType": "address", 812 | "name": "_from", 813 | "type": "address" 814 | }, 815 | { 816 | "internalType": "address", 817 | "name": "_to", 818 | "type": "address" 819 | }, 820 | { 821 | "internalType": "uint256", 822 | "name": "_id", 823 | "type": "uint256" 824 | }, 825 | { 826 | "internalType": "uint256", 827 | "name": "_value", 828 | "type": "uint256" 829 | }, 830 | { 831 | "internalType": "bytes", 832 | "name": "_data", 833 | "type": "bytes" 834 | } 835 | ], 836 | "name": "safeTransferFrom", 837 | "outputs": [], 838 | "stateMutability": "nonpayable", 839 | "type": "function" 840 | }, 841 | { 842 | "inputs": [ 843 | { 844 | "internalType": "address", 845 | "name": "_collateralToken", 846 | "type": "address" 847 | }, 848 | { 849 | "internalType": "bytes32", 850 | "name": "", 851 | "type": "bytes32" 852 | }, 853 | { 854 | "internalType": "bytes32", 855 | "name": "_conditionId", 856 | "type": "bytes32" 857 | }, 858 | { 859 | "internalType": "uint256[]", 860 | "name": "", 861 | "type": "uint256[]" 862 | }, 863 | { 864 | "internalType": "uint256", 865 | "name": "_amount", 866 | "type": "uint256" 867 | } 868 | ], 869 | "name": "splitPosition", 870 | "outputs": [], 871 | "stateMutability": "nonpayable", 872 | "type": "function" 873 | }, 874 | { 875 | "inputs": [ 876 | { 877 | "internalType": "bytes32", 878 | "name": "_conditionId", 879 | "type": "bytes32" 880 | }, 881 | { 882 | "internalType": "uint256", 883 | "name": "_amount", 884 | "type": "uint256" 885 | } 886 | ], 887 | "name": "splitPosition", 888 | "outputs": [], 889 | "stateMutability": "nonpayable", 890 | "type": "function" 891 | }, 892 | { 893 | "inputs": [], 894 | "name": "vault", 895 | "outputs": [ 896 | { 897 | "internalType": "address", 898 | "name": "", 899 | "type": "address" 900 | } 901 | ], 902 | "stateMutability": "view", 903 | "type": "function" 904 | }, 905 | { 906 | "inputs": [], 907 | "name": "wcol", 908 | "outputs": [ 909 | { 910 | "internalType": "contract WrappedCollateral", 911 | "name": "", 912 | "type": "address" 913 | } 914 | ], 915 | "stateMutability": "view", 916 | "type": "function" 917 | } 918 | ] 919 | -------------------------------------------------------------------------------- /src/abi/UmaCtfAdapter.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_ctf", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "_finder", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "inputs": [], 20 | "name": "Flagged", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [], 25 | "name": "Initialized", 26 | "type": "error" 27 | }, 28 | { 29 | "inputs": [], 30 | "name": "InvalidAncillaryData", 31 | "type": "error" 32 | }, 33 | { 34 | "inputs": [], 35 | "name": "InvalidOOPrice", 36 | "type": "error" 37 | }, 38 | { 39 | "inputs": [], 40 | "name": "InvalidPayouts", 41 | "type": "error" 42 | }, 43 | { 44 | "inputs": [], 45 | "name": "NotAdmin", 46 | "type": "error" 47 | }, 48 | { 49 | "inputs": [], 50 | "name": "NotFlagged", 51 | "type": "error" 52 | }, 53 | { 54 | "inputs": [], 55 | "name": "NotInitialized", 56 | "type": "error" 57 | }, 58 | { 59 | "inputs": [], 60 | "name": "NotOptimisticOracle", 61 | "type": "error" 62 | }, 63 | { 64 | "inputs": [], 65 | "name": "NotReadyToResolve", 66 | "type": "error" 67 | }, 68 | { 69 | "inputs": [], 70 | "name": "Paused", 71 | "type": "error" 72 | }, 73 | { 74 | "inputs": [], 75 | "name": "PriceNotAvailable", 76 | "type": "error" 77 | }, 78 | { 79 | "inputs": [], 80 | "name": "Resolved", 81 | "type": "error" 82 | }, 83 | { 84 | "inputs": [], 85 | "name": "SafetyPeriodNotPassed", 86 | "type": "error" 87 | }, 88 | { 89 | "inputs": [], 90 | "name": "UnsupportedToken", 91 | "type": "error" 92 | }, 93 | { 94 | "anonymous": false, 95 | "inputs": [ 96 | { 97 | "indexed": true, 98 | "internalType": "bytes32", 99 | "name": "questionID", 100 | "type": "bytes32" 101 | }, 102 | { 103 | "indexed": true, 104 | "internalType": "address", 105 | "name": "owner", 106 | "type": "address" 107 | }, 108 | { 109 | "indexed": false, 110 | "internalType": "bytes", 111 | "name": "update", 112 | "type": "bytes" 113 | } 114 | ], 115 | "name": "AncillaryDataUpdated", 116 | "type": "event" 117 | }, 118 | { 119 | "anonymous": false, 120 | "inputs": [ 121 | { 122 | "indexed": true, 123 | "internalType": "address", 124 | "name": "admin", 125 | "type": "address" 126 | }, 127 | { 128 | "indexed": true, 129 | "internalType": "address", 130 | "name": "newAdminAddress", 131 | "type": "address" 132 | } 133 | ], 134 | "name": "NewAdmin", 135 | "type": "event" 136 | }, 137 | { 138 | "anonymous": false, 139 | "inputs": [ 140 | { 141 | "indexed": true, 142 | "internalType": "bytes32", 143 | "name": "questionID", 144 | "type": "bytes32" 145 | }, 146 | { 147 | "indexed": false, 148 | "internalType": "uint256[]", 149 | "name": "payouts", 150 | "type": "uint256[]" 151 | } 152 | ], 153 | "name": "QuestionEmergencyResolved", 154 | "type": "event" 155 | }, 156 | { 157 | "anonymous": false, 158 | "inputs": [ 159 | { 160 | "indexed": true, 161 | "internalType": "bytes32", 162 | "name": "questionID", 163 | "type": "bytes32" 164 | } 165 | ], 166 | "name": "QuestionFlagged", 167 | "type": "event" 168 | }, 169 | { 170 | "anonymous": false, 171 | "inputs": [ 172 | { 173 | "indexed": true, 174 | "internalType": "bytes32", 175 | "name": "questionID", 176 | "type": "bytes32" 177 | }, 178 | { 179 | "indexed": true, 180 | "internalType": "uint256", 181 | "name": "requestTimestamp", 182 | "type": "uint256" 183 | }, 184 | { 185 | "indexed": true, 186 | "internalType": "address", 187 | "name": "creator", 188 | "type": "address" 189 | }, 190 | { 191 | "indexed": false, 192 | "internalType": "bytes", 193 | "name": "ancillaryData", 194 | "type": "bytes" 195 | }, 196 | { 197 | "indexed": false, 198 | "internalType": "address", 199 | "name": "rewardToken", 200 | "type": "address" 201 | }, 202 | { 203 | "indexed": false, 204 | "internalType": "uint256", 205 | "name": "reward", 206 | "type": "uint256" 207 | }, 208 | { 209 | "indexed": false, 210 | "internalType": "uint256", 211 | "name": "proposalBond", 212 | "type": "uint256" 213 | } 214 | ], 215 | "name": "QuestionInitialized", 216 | "type": "event" 217 | }, 218 | { 219 | "anonymous": false, 220 | "inputs": [ 221 | { 222 | "indexed": true, 223 | "internalType": "bytes32", 224 | "name": "questionID", 225 | "type": "bytes32" 226 | } 227 | ], 228 | "name": "QuestionPaused", 229 | "type": "event" 230 | }, 231 | { 232 | "anonymous": false, 233 | "inputs": [ 234 | { 235 | "indexed": true, 236 | "internalType": "bytes32", 237 | "name": "questionID", 238 | "type": "bytes32" 239 | } 240 | ], 241 | "name": "QuestionReset", 242 | "type": "event" 243 | }, 244 | { 245 | "anonymous": false, 246 | "inputs": [ 247 | { 248 | "indexed": true, 249 | "internalType": "bytes32", 250 | "name": "questionID", 251 | "type": "bytes32" 252 | }, 253 | { 254 | "indexed": true, 255 | "internalType": "int256", 256 | "name": "settledPrice", 257 | "type": "int256" 258 | }, 259 | { 260 | "indexed": false, 261 | "internalType": "uint256[]", 262 | "name": "payouts", 263 | "type": "uint256[]" 264 | } 265 | ], 266 | "name": "QuestionResolved", 267 | "type": "event" 268 | }, 269 | { 270 | "anonymous": false, 271 | "inputs": [ 272 | { 273 | "indexed": true, 274 | "internalType": "bytes32", 275 | "name": "questionID", 276 | "type": "bytes32" 277 | } 278 | ], 279 | "name": "QuestionUnpaused", 280 | "type": "event" 281 | }, 282 | { 283 | "anonymous": false, 284 | "inputs": [ 285 | { 286 | "indexed": true, 287 | "internalType": "address", 288 | "name": "admin", 289 | "type": "address" 290 | }, 291 | { 292 | "indexed": true, 293 | "internalType": "address", 294 | "name": "removedAdmin", 295 | "type": "address" 296 | } 297 | ], 298 | "name": "RemovedAdmin", 299 | "type": "event" 300 | }, 301 | { 302 | "inputs": [ 303 | { 304 | "internalType": "address", 305 | "name": "admin", 306 | "type": "address" 307 | } 308 | ], 309 | "name": "addAdmin", 310 | "outputs": [], 311 | "stateMutability": "nonpayable", 312 | "type": "function" 313 | }, 314 | { 315 | "inputs": [ 316 | { 317 | "internalType": "address", 318 | "name": "", 319 | "type": "address" 320 | } 321 | ], 322 | "name": "admins", 323 | "outputs": [ 324 | { 325 | "internalType": "uint256", 326 | "name": "", 327 | "type": "uint256" 328 | } 329 | ], 330 | "stateMutability": "view", 331 | "type": "function" 332 | }, 333 | { 334 | "inputs": [], 335 | "name": "collateralWhitelist", 336 | "outputs": [ 337 | { 338 | "internalType": "contract IAddressWhitelist", 339 | "name": "", 340 | "type": "address" 341 | } 342 | ], 343 | "stateMutability": "view", 344 | "type": "function" 345 | }, 346 | { 347 | "inputs": [], 348 | "name": "ctf", 349 | "outputs": [ 350 | { 351 | "internalType": "contract IConditionalTokens", 352 | "name": "", 353 | "type": "address" 354 | } 355 | ], 356 | "stateMutability": "view", 357 | "type": "function" 358 | }, 359 | { 360 | "inputs": [ 361 | { 362 | "internalType": "bytes32", 363 | "name": "questionID", 364 | "type": "bytes32" 365 | }, 366 | { 367 | "internalType": "uint256[]", 368 | "name": "payouts", 369 | "type": "uint256[]" 370 | } 371 | ], 372 | "name": "emergencyResolve", 373 | "outputs": [], 374 | "stateMutability": "nonpayable", 375 | "type": "function" 376 | }, 377 | { 378 | "inputs": [], 379 | "name": "emergencySafetyPeriod", 380 | "outputs": [ 381 | { 382 | "internalType": "uint256", 383 | "name": "", 384 | "type": "uint256" 385 | } 386 | ], 387 | "stateMutability": "view", 388 | "type": "function" 389 | }, 390 | { 391 | "inputs": [ 392 | { 393 | "internalType": "bytes32", 394 | "name": "questionID", 395 | "type": "bytes32" 396 | } 397 | ], 398 | "name": "flag", 399 | "outputs": [], 400 | "stateMutability": "nonpayable", 401 | "type": "function" 402 | }, 403 | { 404 | "inputs": [ 405 | { 406 | "internalType": "bytes32", 407 | "name": "questionID", 408 | "type": "bytes32" 409 | } 410 | ], 411 | "name": "getExpectedPayouts", 412 | "outputs": [ 413 | { 414 | "internalType": "uint256[]", 415 | "name": "", 416 | "type": "uint256[]" 417 | } 418 | ], 419 | "stateMutability": "view", 420 | "type": "function" 421 | }, 422 | { 423 | "inputs": [ 424 | { 425 | "internalType": "bytes32", 426 | "name": "questionID", 427 | "type": "bytes32" 428 | }, 429 | { 430 | "internalType": "address", 431 | "name": "owner", 432 | "type": "address" 433 | } 434 | ], 435 | "name": "getLatestUpdate", 436 | "outputs": [ 437 | { 438 | "components": [ 439 | { 440 | "internalType": "uint256", 441 | "name": "timestamp", 442 | "type": "uint256" 443 | }, 444 | { 445 | "internalType": "bytes", 446 | "name": "update", 447 | "type": "bytes" 448 | } 449 | ], 450 | "internalType": "struct BulletinBoard.AncillaryDataUpdate", 451 | "name": "", 452 | "type": "tuple" 453 | } 454 | ], 455 | "stateMutability": "view", 456 | "type": "function" 457 | }, 458 | { 459 | "inputs": [ 460 | { 461 | "internalType": "bytes32", 462 | "name": "questionID", 463 | "type": "bytes32" 464 | } 465 | ], 466 | "name": "getQuestion", 467 | "outputs": [ 468 | { 469 | "components": [ 470 | { 471 | "internalType": "uint256", 472 | "name": "requestTimestamp", 473 | "type": "uint256" 474 | }, 475 | { 476 | "internalType": "uint256", 477 | "name": "reward", 478 | "type": "uint256" 479 | }, 480 | { 481 | "internalType": "uint256", 482 | "name": "proposalBond", 483 | "type": "uint256" 484 | }, 485 | { 486 | "internalType": "uint256", 487 | "name": "emergencyResolutionTimestamp", 488 | "type": "uint256" 489 | }, 490 | { 491 | "internalType": "bool", 492 | "name": "resolved", 493 | "type": "bool" 494 | }, 495 | { 496 | "internalType": "bool", 497 | "name": "paused", 498 | "type": "bool" 499 | }, 500 | { 501 | "internalType": "bool", 502 | "name": "reset", 503 | "type": "bool" 504 | }, 505 | { 506 | "internalType": "address", 507 | "name": "rewardToken", 508 | "type": "address" 509 | }, 510 | { 511 | "internalType": "address", 512 | "name": "creator", 513 | "type": "address" 514 | }, 515 | { 516 | "internalType": "bytes", 517 | "name": "ancillaryData", 518 | "type": "bytes" 519 | } 520 | ], 521 | "internalType": "struct QuestionData", 522 | "name": "", 523 | "type": "tuple" 524 | } 525 | ], 526 | "stateMutability": "view", 527 | "type": "function" 528 | }, 529 | { 530 | "inputs": [ 531 | { 532 | "internalType": "bytes32", 533 | "name": "questionID", 534 | "type": "bytes32" 535 | }, 536 | { 537 | "internalType": "address", 538 | "name": "owner", 539 | "type": "address" 540 | } 541 | ], 542 | "name": "getUpdates", 543 | "outputs": [ 544 | { 545 | "components": [ 546 | { 547 | "internalType": "uint256", 548 | "name": "timestamp", 549 | "type": "uint256" 550 | }, 551 | { 552 | "internalType": "bytes", 553 | "name": "update", 554 | "type": "bytes" 555 | } 556 | ], 557 | "internalType": "struct BulletinBoard.AncillaryDataUpdate[]", 558 | "name": "", 559 | "type": "tuple[]" 560 | } 561 | ], 562 | "stateMutability": "view", 563 | "type": "function" 564 | }, 565 | { 566 | "inputs": [ 567 | { 568 | "internalType": "bytes", 569 | "name": "ancillaryData", 570 | "type": "bytes" 571 | }, 572 | { 573 | "internalType": "address", 574 | "name": "rewardToken", 575 | "type": "address" 576 | }, 577 | { 578 | "internalType": "uint256", 579 | "name": "reward", 580 | "type": "uint256" 581 | }, 582 | { 583 | "internalType": "uint256", 584 | "name": "proposalBond", 585 | "type": "uint256" 586 | } 587 | ], 588 | "name": "initialize", 589 | "outputs": [ 590 | { 591 | "internalType": "bytes32", 592 | "name": "questionID", 593 | "type": "bytes32" 594 | } 595 | ], 596 | "stateMutability": "nonpayable", 597 | "type": "function" 598 | }, 599 | { 600 | "inputs": [ 601 | { 602 | "internalType": "address", 603 | "name": "addr", 604 | "type": "address" 605 | } 606 | ], 607 | "name": "isAdmin", 608 | "outputs": [ 609 | { 610 | "internalType": "bool", 611 | "name": "", 612 | "type": "bool" 613 | } 614 | ], 615 | "stateMutability": "view", 616 | "type": "function" 617 | }, 618 | { 619 | "inputs": [ 620 | { 621 | "internalType": "bytes32", 622 | "name": "questionID", 623 | "type": "bytes32" 624 | } 625 | ], 626 | "name": "isFlagged", 627 | "outputs": [ 628 | { 629 | "internalType": "bool", 630 | "name": "", 631 | "type": "bool" 632 | } 633 | ], 634 | "stateMutability": "view", 635 | "type": "function" 636 | }, 637 | { 638 | "inputs": [ 639 | { 640 | "internalType": "bytes32", 641 | "name": "questionID", 642 | "type": "bytes32" 643 | } 644 | ], 645 | "name": "isInitialized", 646 | "outputs": [ 647 | { 648 | "internalType": "bool", 649 | "name": "", 650 | "type": "bool" 651 | } 652 | ], 653 | "stateMutability": "view", 654 | "type": "function" 655 | }, 656 | { 657 | "inputs": [], 658 | "name": "maxAncillaryData", 659 | "outputs": [ 660 | { 661 | "internalType": "uint256", 662 | "name": "", 663 | "type": "uint256" 664 | } 665 | ], 666 | "stateMutability": "view", 667 | "type": "function" 668 | }, 669 | { 670 | "inputs": [], 671 | "name": "optimisticOracle", 672 | "outputs": [ 673 | { 674 | "internalType": "contract IOptimisticOracleV2", 675 | "name": "", 676 | "type": "address" 677 | } 678 | ], 679 | "stateMutability": "view", 680 | "type": "function" 681 | }, 682 | { 683 | "inputs": [ 684 | { 685 | "internalType": "bytes32", 686 | "name": "questionID", 687 | "type": "bytes32" 688 | } 689 | ], 690 | "name": "pause", 691 | "outputs": [], 692 | "stateMutability": "nonpayable", 693 | "type": "function" 694 | }, 695 | { 696 | "inputs": [ 697 | { 698 | "internalType": "bytes32", 699 | "name": "questionID", 700 | "type": "bytes32" 701 | }, 702 | { 703 | "internalType": "bytes", 704 | "name": "update", 705 | "type": "bytes" 706 | } 707 | ], 708 | "name": "postUpdate", 709 | "outputs": [], 710 | "stateMutability": "nonpayable", 711 | "type": "function" 712 | }, 713 | { 714 | "inputs": [ 715 | { 716 | "internalType": "bytes32", 717 | "name": "", 718 | "type": "bytes32" 719 | }, 720 | { 721 | "internalType": "uint256", 722 | "name": "", 723 | "type": "uint256" 724 | }, 725 | { 726 | "internalType": "bytes", 727 | "name": "ancillaryData", 728 | "type": "bytes" 729 | }, 730 | { 731 | "internalType": "uint256", 732 | "name": "", 733 | "type": "uint256" 734 | } 735 | ], 736 | "name": "priceDisputed", 737 | "outputs": [], 738 | "stateMutability": "nonpayable", 739 | "type": "function" 740 | }, 741 | { 742 | "inputs": [ 743 | { 744 | "internalType": "bytes32", 745 | "name": "", 746 | "type": "bytes32" 747 | } 748 | ], 749 | "name": "questions", 750 | "outputs": [ 751 | { 752 | "internalType": "uint256", 753 | "name": "requestTimestamp", 754 | "type": "uint256" 755 | }, 756 | { 757 | "internalType": "uint256", 758 | "name": "reward", 759 | "type": "uint256" 760 | }, 761 | { 762 | "internalType": "uint256", 763 | "name": "proposalBond", 764 | "type": "uint256" 765 | }, 766 | { 767 | "internalType": "uint256", 768 | "name": "emergencyResolutionTimestamp", 769 | "type": "uint256" 770 | }, 771 | { 772 | "internalType": "bool", 773 | "name": "resolved", 774 | "type": "bool" 775 | }, 776 | { 777 | "internalType": "bool", 778 | "name": "paused", 779 | "type": "bool" 780 | }, 781 | { 782 | "internalType": "bool", 783 | "name": "reset", 784 | "type": "bool" 785 | }, 786 | { 787 | "internalType": "address", 788 | "name": "rewardToken", 789 | "type": "address" 790 | }, 791 | { 792 | "internalType": "address", 793 | "name": "creator", 794 | "type": "address" 795 | }, 796 | { 797 | "internalType": "bytes", 798 | "name": "ancillaryData", 799 | "type": "bytes" 800 | } 801 | ], 802 | "stateMutability": "view", 803 | "type": "function" 804 | }, 805 | { 806 | "inputs": [ 807 | { 808 | "internalType": "bytes32", 809 | "name": "questionID", 810 | "type": "bytes32" 811 | } 812 | ], 813 | "name": "ready", 814 | "outputs": [ 815 | { 816 | "internalType": "bool", 817 | "name": "", 818 | "type": "bool" 819 | } 820 | ], 821 | "stateMutability": "view", 822 | "type": "function" 823 | }, 824 | { 825 | "inputs": [ 826 | { 827 | "internalType": "address", 828 | "name": "admin", 829 | "type": "address" 830 | } 831 | ], 832 | "name": "removeAdmin", 833 | "outputs": [], 834 | "stateMutability": "nonpayable", 835 | "type": "function" 836 | }, 837 | { 838 | "inputs": [], 839 | "name": "renounceAdmin", 840 | "outputs": [], 841 | "stateMutability": "nonpayable", 842 | "type": "function" 843 | }, 844 | { 845 | "inputs": [ 846 | { 847 | "internalType": "bytes32", 848 | "name": "questionID", 849 | "type": "bytes32" 850 | } 851 | ], 852 | "name": "reset", 853 | "outputs": [], 854 | "stateMutability": "nonpayable", 855 | "type": "function" 856 | }, 857 | { 858 | "inputs": [ 859 | { 860 | "internalType": "bytes32", 861 | "name": "questionID", 862 | "type": "bytes32" 863 | } 864 | ], 865 | "name": "resolve", 866 | "outputs": [], 867 | "stateMutability": "nonpayable", 868 | "type": "function" 869 | }, 870 | { 871 | "inputs": [ 872 | { 873 | "internalType": "bytes32", 874 | "name": "questionID", 875 | "type": "bytes32" 876 | } 877 | ], 878 | "name": "unpause", 879 | "outputs": [], 880 | "stateMutability": "nonpayable", 881 | "type": "function" 882 | }, 883 | { 884 | "inputs": [ 885 | { 886 | "internalType": "bytes32", 887 | "name": "", 888 | "type": "bytes32" 889 | }, 890 | { 891 | "internalType": "uint256", 892 | "name": "", 893 | "type": "uint256" 894 | } 895 | ], 896 | "name": "updates", 897 | "outputs": [ 898 | { 899 | "internalType": "uint256", 900 | "name": "timestamp", 901 | "type": "uint256" 902 | }, 903 | { 904 | "internalType": "bytes", 905 | "name": "update", 906 | "type": "bytes" 907 | } 908 | ], 909 | "stateMutability": "view", 910 | "type": "function" 911 | }, 912 | { 913 | "inputs": [], 914 | "name": "yesOrNoIdentifier", 915 | "outputs": [ 916 | { 917 | "internalType": "bytes32", 918 | "name": "", 919 | "type": "bytes32" 920 | } 921 | ], 922 | "stateMutability": "view", 923 | "type": "function" 924 | } 925 | ] -------------------------------------------------------------------------------- /src/abi/NegRiskUmaCtfAdapter.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_ctf", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "_finder", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "inputs": [], 20 | "name": "Flagged", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [], 25 | "name": "Initialized", 26 | "type": "error" 27 | }, 28 | { 29 | "inputs": [], 30 | "name": "InvalidAncillaryData", 31 | "type": "error" 32 | }, 33 | { 34 | "inputs": [], 35 | "name": "InvalidOOPrice", 36 | "type": "error" 37 | }, 38 | { 39 | "inputs": [], 40 | "name": "InvalidPayouts", 41 | "type": "error" 42 | }, 43 | { 44 | "inputs": [], 45 | "name": "NotAdmin", 46 | "type": "error" 47 | }, 48 | { 49 | "inputs": [], 50 | "name": "NotFlagged", 51 | "type": "error" 52 | }, 53 | { 54 | "inputs": [], 55 | "name": "NotInitialized", 56 | "type": "error" 57 | }, 58 | { 59 | "inputs": [], 60 | "name": "NotOptimisticOracle", 61 | "type": "error" 62 | }, 63 | { 64 | "inputs": [], 65 | "name": "NotReadyToResolve", 66 | "type": "error" 67 | }, 68 | { 69 | "inputs": [], 70 | "name": "Paused", 71 | "type": "error" 72 | }, 73 | { 74 | "inputs": [], 75 | "name": "PriceNotAvailable", 76 | "type": "error" 77 | }, 78 | { 79 | "inputs": [], 80 | "name": "Resolved", 81 | "type": "error" 82 | }, 83 | { 84 | "inputs": [], 85 | "name": "SafetyPeriodNotPassed", 86 | "type": "error" 87 | }, 88 | { 89 | "inputs": [], 90 | "name": "SafetyPeriodPassed", 91 | "type": "error" 92 | }, 93 | { 94 | "inputs": [], 95 | "name": "UnsupportedToken", 96 | "type": "error" 97 | }, 98 | { 99 | "anonymous": false, 100 | "inputs": [ 101 | { 102 | "indexed": true, 103 | "internalType": "bytes32", 104 | "name": "questionID", 105 | "type": "bytes32" 106 | }, 107 | { 108 | "indexed": true, 109 | "internalType": "address", 110 | "name": "owner", 111 | "type": "address" 112 | }, 113 | { 114 | "indexed": false, 115 | "internalType": "bytes", 116 | "name": "update", 117 | "type": "bytes" 118 | } 119 | ], 120 | "name": "AncillaryDataUpdated", 121 | "type": "event" 122 | }, 123 | { 124 | "anonymous": false, 125 | "inputs": [ 126 | { 127 | "indexed": true, 128 | "internalType": "address", 129 | "name": "admin", 130 | "type": "address" 131 | }, 132 | { 133 | "indexed": true, 134 | "internalType": "address", 135 | "name": "newAdminAddress", 136 | "type": "address" 137 | } 138 | ], 139 | "name": "NewAdmin", 140 | "type": "event" 141 | }, 142 | { 143 | "anonymous": false, 144 | "inputs": [ 145 | { 146 | "indexed": true, 147 | "internalType": "bytes32", 148 | "name": "questionID", 149 | "type": "bytes32" 150 | }, 151 | { 152 | "indexed": false, 153 | "internalType": "uint256[]", 154 | "name": "payouts", 155 | "type": "uint256[]" 156 | } 157 | ], 158 | "name": "QuestionEmergencyResolved", 159 | "type": "event" 160 | }, 161 | { 162 | "anonymous": false, 163 | "inputs": [ 164 | { 165 | "indexed": true, 166 | "internalType": "bytes32", 167 | "name": "questionID", 168 | "type": "bytes32" 169 | } 170 | ], 171 | "name": "QuestionFlagged", 172 | "type": "event" 173 | }, 174 | { 175 | "anonymous": false, 176 | "inputs": [ 177 | { 178 | "indexed": true, 179 | "internalType": "bytes32", 180 | "name": "questionID", 181 | "type": "bytes32" 182 | }, 183 | { 184 | "indexed": true, 185 | "internalType": "uint256", 186 | "name": "requestTimestamp", 187 | "type": "uint256" 188 | }, 189 | { 190 | "indexed": true, 191 | "internalType": "address", 192 | "name": "creator", 193 | "type": "address" 194 | }, 195 | { 196 | "indexed": false, 197 | "internalType": "bytes", 198 | "name": "ancillaryData", 199 | "type": "bytes" 200 | }, 201 | { 202 | "indexed": false, 203 | "internalType": "address", 204 | "name": "rewardToken", 205 | "type": "address" 206 | }, 207 | { 208 | "indexed": false, 209 | "internalType": "uint256", 210 | "name": "reward", 211 | "type": "uint256" 212 | }, 213 | { 214 | "indexed": false, 215 | "internalType": "uint256", 216 | "name": "proposalBond", 217 | "type": "uint256" 218 | } 219 | ], 220 | "name": "QuestionInitialized", 221 | "type": "event" 222 | }, 223 | { 224 | "anonymous": false, 225 | "inputs": [ 226 | { 227 | "indexed": true, 228 | "internalType": "bytes32", 229 | "name": "questionID", 230 | "type": "bytes32" 231 | } 232 | ], 233 | "name": "QuestionPaused", 234 | "type": "event" 235 | }, 236 | { 237 | "anonymous": false, 238 | "inputs": [ 239 | { 240 | "indexed": true, 241 | "internalType": "bytes32", 242 | "name": "questionID", 243 | "type": "bytes32" 244 | } 245 | ], 246 | "name": "QuestionReset", 247 | "type": "event" 248 | }, 249 | { 250 | "anonymous": false, 251 | "inputs": [ 252 | { 253 | "indexed": true, 254 | "internalType": "bytes32", 255 | "name": "questionID", 256 | "type": "bytes32" 257 | }, 258 | { 259 | "indexed": true, 260 | "internalType": "int256", 261 | "name": "settledPrice", 262 | "type": "int256" 263 | }, 264 | { 265 | "indexed": false, 266 | "internalType": "uint256[]", 267 | "name": "payouts", 268 | "type": "uint256[]" 269 | } 270 | ], 271 | "name": "QuestionResolved", 272 | "type": "event" 273 | }, 274 | { 275 | "anonymous": false, 276 | "inputs": [ 277 | { 278 | "indexed": true, 279 | "internalType": "bytes32", 280 | "name": "questionID", 281 | "type": "bytes32" 282 | } 283 | ], 284 | "name": "QuestionUnflagged", 285 | "type": "event" 286 | }, 287 | { 288 | "anonymous": false, 289 | "inputs": [ 290 | { 291 | "indexed": true, 292 | "internalType": "bytes32", 293 | "name": "questionID", 294 | "type": "bytes32" 295 | } 296 | ], 297 | "name": "QuestionUnpaused", 298 | "type": "event" 299 | }, 300 | { 301 | "anonymous": false, 302 | "inputs": [ 303 | { 304 | "indexed": true, 305 | "internalType": "address", 306 | "name": "admin", 307 | "type": "address" 308 | }, 309 | { 310 | "indexed": true, 311 | "internalType": "address", 312 | "name": "removedAdmin", 313 | "type": "address" 314 | } 315 | ], 316 | "name": "RemovedAdmin", 317 | "type": "event" 318 | }, 319 | { 320 | "inputs": [], 321 | "name": "EMERGENCY_SAFETY_PERIOD", 322 | "outputs": [ 323 | { 324 | "internalType": "uint256", 325 | "name": "", 326 | "type": "uint256" 327 | } 328 | ], 329 | "stateMutability": "view", 330 | "type": "function" 331 | }, 332 | { 333 | "inputs": [], 334 | "name": "MAX_ANCILLARY_DATA", 335 | "outputs": [ 336 | { 337 | "internalType": "uint256", 338 | "name": "", 339 | "type": "uint256" 340 | } 341 | ], 342 | "stateMutability": "view", 343 | "type": "function" 344 | }, 345 | { 346 | "inputs": [], 347 | "name": "YES_OR_NO_IDENTIFIER", 348 | "outputs": [ 349 | { 350 | "internalType": "bytes32", 351 | "name": "", 352 | "type": "bytes32" 353 | } 354 | ], 355 | "stateMutability": "view", 356 | "type": "function" 357 | }, 358 | { 359 | "inputs": [ 360 | { 361 | "internalType": "address", 362 | "name": "admin", 363 | "type": "address" 364 | } 365 | ], 366 | "name": "addAdmin", 367 | "outputs": [], 368 | "stateMutability": "nonpayable", 369 | "type": "function" 370 | }, 371 | { 372 | "inputs": [ 373 | { 374 | "internalType": "address", 375 | "name": "", 376 | "type": "address" 377 | } 378 | ], 379 | "name": "admins", 380 | "outputs": [ 381 | { 382 | "internalType": "uint256", 383 | "name": "", 384 | "type": "uint256" 385 | } 386 | ], 387 | "stateMutability": "view", 388 | "type": "function" 389 | }, 390 | { 391 | "inputs": [], 392 | "name": "collateralWhitelist", 393 | "outputs": [ 394 | { 395 | "internalType": "contract IAddressWhitelist", 396 | "name": "", 397 | "type": "address" 398 | } 399 | ], 400 | "stateMutability": "view", 401 | "type": "function" 402 | }, 403 | { 404 | "inputs": [], 405 | "name": "ctf", 406 | "outputs": [ 407 | { 408 | "internalType": "contract IConditionalTokens", 409 | "name": "", 410 | "type": "address" 411 | } 412 | ], 413 | "stateMutability": "view", 414 | "type": "function" 415 | }, 416 | { 417 | "inputs": [ 418 | { 419 | "internalType": "bytes32", 420 | "name": "questionID", 421 | "type": "bytes32" 422 | }, 423 | { 424 | "internalType": "uint256[]", 425 | "name": "payouts", 426 | "type": "uint256[]" 427 | } 428 | ], 429 | "name": "emergencyResolve", 430 | "outputs": [], 431 | "stateMutability": "nonpayable", 432 | "type": "function" 433 | }, 434 | { 435 | "inputs": [ 436 | { 437 | "internalType": "bytes32", 438 | "name": "questionID", 439 | "type": "bytes32" 440 | } 441 | ], 442 | "name": "flag", 443 | "outputs": [], 444 | "stateMutability": "nonpayable", 445 | "type": "function" 446 | }, 447 | { 448 | "inputs": [ 449 | { 450 | "internalType": "bytes32", 451 | "name": "questionID", 452 | "type": "bytes32" 453 | } 454 | ], 455 | "name": "getExpectedPayouts", 456 | "outputs": [ 457 | { 458 | "internalType": "uint256[]", 459 | "name": "", 460 | "type": "uint256[]" 461 | } 462 | ], 463 | "stateMutability": "view", 464 | "type": "function" 465 | }, 466 | { 467 | "inputs": [ 468 | { 469 | "internalType": "bytes32", 470 | "name": "questionID", 471 | "type": "bytes32" 472 | }, 473 | { 474 | "internalType": "address", 475 | "name": "owner", 476 | "type": "address" 477 | } 478 | ], 479 | "name": "getLatestUpdate", 480 | "outputs": [ 481 | { 482 | "components": [ 483 | { 484 | "internalType": "uint256", 485 | "name": "timestamp", 486 | "type": "uint256" 487 | }, 488 | { 489 | "internalType": "bytes", 490 | "name": "update", 491 | "type": "bytes" 492 | } 493 | ], 494 | "internalType": "struct AncillaryDataUpdate", 495 | "name": "", 496 | "type": "tuple" 497 | } 498 | ], 499 | "stateMutability": "view", 500 | "type": "function" 501 | }, 502 | { 503 | "inputs": [ 504 | { 505 | "internalType": "bytes32", 506 | "name": "questionID", 507 | "type": "bytes32" 508 | } 509 | ], 510 | "name": "getQuestion", 511 | "outputs": [ 512 | { 513 | "components": [ 514 | { 515 | "internalType": "uint256", 516 | "name": "requestTimestamp", 517 | "type": "uint256" 518 | }, 519 | { 520 | "internalType": "uint256", 521 | "name": "reward", 522 | "type": "uint256" 523 | }, 524 | { 525 | "internalType": "uint256", 526 | "name": "proposalBond", 527 | "type": "uint256" 528 | }, 529 | { 530 | "internalType": "uint256", 531 | "name": "liveness", 532 | "type": "uint256" 533 | }, 534 | { 535 | "internalType": "uint256", 536 | "name": "emergencyResolutionTimestamp", 537 | "type": "uint256" 538 | }, 539 | { 540 | "internalType": "bool", 541 | "name": "resolved", 542 | "type": "bool" 543 | }, 544 | { 545 | "internalType": "bool", 546 | "name": "paused", 547 | "type": "bool" 548 | }, 549 | { 550 | "internalType": "bool", 551 | "name": "reset", 552 | "type": "bool" 553 | }, 554 | { 555 | "internalType": "bool", 556 | "name": "refund", 557 | "type": "bool" 558 | }, 559 | { 560 | "internalType": "address", 561 | "name": "rewardToken", 562 | "type": "address" 563 | }, 564 | { 565 | "internalType": "address", 566 | "name": "creator", 567 | "type": "address" 568 | }, 569 | { 570 | "internalType": "bytes", 571 | "name": "ancillaryData", 572 | "type": "bytes" 573 | } 574 | ], 575 | "internalType": "struct QuestionData", 576 | "name": "", 577 | "type": "tuple" 578 | } 579 | ], 580 | "stateMutability": "view", 581 | "type": "function" 582 | }, 583 | { 584 | "inputs": [ 585 | { 586 | "internalType": "bytes32", 587 | "name": "questionID", 588 | "type": "bytes32" 589 | }, 590 | { 591 | "internalType": "address", 592 | "name": "owner", 593 | "type": "address" 594 | } 595 | ], 596 | "name": "getUpdates", 597 | "outputs": [ 598 | { 599 | "components": [ 600 | { 601 | "internalType": "uint256", 602 | "name": "timestamp", 603 | "type": "uint256" 604 | }, 605 | { 606 | "internalType": "bytes", 607 | "name": "update", 608 | "type": "bytes" 609 | } 610 | ], 611 | "internalType": "struct AncillaryDataUpdate[]", 612 | "name": "", 613 | "type": "tuple[]" 614 | } 615 | ], 616 | "stateMutability": "view", 617 | "type": "function" 618 | }, 619 | { 620 | "inputs": [ 621 | { 622 | "internalType": "bytes", 623 | "name": "ancillaryData", 624 | "type": "bytes" 625 | }, 626 | { 627 | "internalType": "address", 628 | "name": "rewardToken", 629 | "type": "address" 630 | }, 631 | { 632 | "internalType": "uint256", 633 | "name": "reward", 634 | "type": "uint256" 635 | }, 636 | { 637 | "internalType": "uint256", 638 | "name": "proposalBond", 639 | "type": "uint256" 640 | }, 641 | { 642 | "internalType": "uint256", 643 | "name": "liveness", 644 | "type": "uint256" 645 | } 646 | ], 647 | "name": "initialize", 648 | "outputs": [ 649 | { 650 | "internalType": "bytes32", 651 | "name": "questionID", 652 | "type": "bytes32" 653 | } 654 | ], 655 | "stateMutability": "nonpayable", 656 | "type": "function" 657 | }, 658 | { 659 | "inputs": [ 660 | { 661 | "internalType": "address", 662 | "name": "addr", 663 | "type": "address" 664 | } 665 | ], 666 | "name": "isAdmin", 667 | "outputs": [ 668 | { 669 | "internalType": "bool", 670 | "name": "", 671 | "type": "bool" 672 | } 673 | ], 674 | "stateMutability": "view", 675 | "type": "function" 676 | }, 677 | { 678 | "inputs": [ 679 | { 680 | "internalType": "bytes32", 681 | "name": "questionID", 682 | "type": "bytes32" 683 | } 684 | ], 685 | "name": "isFlagged", 686 | "outputs": [ 687 | { 688 | "internalType": "bool", 689 | "name": "", 690 | "type": "bool" 691 | } 692 | ], 693 | "stateMutability": "view", 694 | "type": "function" 695 | }, 696 | { 697 | "inputs": [ 698 | { 699 | "internalType": "bytes32", 700 | "name": "questionID", 701 | "type": "bytes32" 702 | } 703 | ], 704 | "name": "isInitialized", 705 | "outputs": [ 706 | { 707 | "internalType": "bool", 708 | "name": "", 709 | "type": "bool" 710 | } 711 | ], 712 | "stateMutability": "view", 713 | "type": "function" 714 | }, 715 | { 716 | "inputs": [], 717 | "name": "optimisticOracle", 718 | "outputs": [ 719 | { 720 | "internalType": "contract IOptimisticOracleV2", 721 | "name": "", 722 | "type": "address" 723 | } 724 | ], 725 | "stateMutability": "view", 726 | "type": "function" 727 | }, 728 | { 729 | "inputs": [ 730 | { 731 | "internalType": "bytes32", 732 | "name": "questionID", 733 | "type": "bytes32" 734 | } 735 | ], 736 | "name": "pause", 737 | "outputs": [], 738 | "stateMutability": "nonpayable", 739 | "type": "function" 740 | }, 741 | { 742 | "inputs": [ 743 | { 744 | "internalType": "bytes32", 745 | "name": "questionID", 746 | "type": "bytes32" 747 | }, 748 | { 749 | "internalType": "bytes", 750 | "name": "update", 751 | "type": "bytes" 752 | } 753 | ], 754 | "name": "postUpdate", 755 | "outputs": [], 756 | "stateMutability": "nonpayable", 757 | "type": "function" 758 | }, 759 | { 760 | "inputs": [ 761 | { 762 | "internalType": "bytes32", 763 | "name": "", 764 | "type": "bytes32" 765 | }, 766 | { 767 | "internalType": "uint256", 768 | "name": "", 769 | "type": "uint256" 770 | }, 771 | { 772 | "internalType": "bytes", 773 | "name": "ancillaryData", 774 | "type": "bytes" 775 | }, 776 | { 777 | "internalType": "uint256", 778 | "name": "", 779 | "type": "uint256" 780 | } 781 | ], 782 | "name": "priceDisputed", 783 | "outputs": [], 784 | "stateMutability": "nonpayable", 785 | "type": "function" 786 | }, 787 | { 788 | "inputs": [ 789 | { 790 | "internalType": "bytes32", 791 | "name": "", 792 | "type": "bytes32" 793 | } 794 | ], 795 | "name": "questions", 796 | "outputs": [ 797 | { 798 | "internalType": "uint256", 799 | "name": "requestTimestamp", 800 | "type": "uint256" 801 | }, 802 | { 803 | "internalType": "uint256", 804 | "name": "reward", 805 | "type": "uint256" 806 | }, 807 | { 808 | "internalType": "uint256", 809 | "name": "proposalBond", 810 | "type": "uint256" 811 | }, 812 | { 813 | "internalType": "uint256", 814 | "name": "liveness", 815 | "type": "uint256" 816 | }, 817 | { 818 | "internalType": "uint256", 819 | "name": "emergencyResolutionTimestamp", 820 | "type": "uint256" 821 | }, 822 | { 823 | "internalType": "bool", 824 | "name": "resolved", 825 | "type": "bool" 826 | }, 827 | { 828 | "internalType": "bool", 829 | "name": "paused", 830 | "type": "bool" 831 | }, 832 | { 833 | "internalType": "bool", 834 | "name": "reset", 835 | "type": "bool" 836 | }, 837 | { 838 | "internalType": "bool", 839 | "name": "refund", 840 | "type": "bool" 841 | }, 842 | { 843 | "internalType": "address", 844 | "name": "rewardToken", 845 | "type": "address" 846 | }, 847 | { 848 | "internalType": "address", 849 | "name": "creator", 850 | "type": "address" 851 | }, 852 | { 853 | "internalType": "bytes", 854 | "name": "ancillaryData", 855 | "type": "bytes" 856 | } 857 | ], 858 | "stateMutability": "view", 859 | "type": "function" 860 | }, 861 | { 862 | "inputs": [ 863 | { 864 | "internalType": "bytes32", 865 | "name": "questionID", 866 | "type": "bytes32" 867 | } 868 | ], 869 | "name": "ready", 870 | "outputs": [ 871 | { 872 | "internalType": "bool", 873 | "name": "", 874 | "type": "bool" 875 | } 876 | ], 877 | "stateMutability": "view", 878 | "type": "function" 879 | }, 880 | { 881 | "inputs": [ 882 | { 883 | "internalType": "address", 884 | "name": "admin", 885 | "type": "address" 886 | } 887 | ], 888 | "name": "removeAdmin", 889 | "outputs": [], 890 | "stateMutability": "nonpayable", 891 | "type": "function" 892 | }, 893 | { 894 | "inputs": [], 895 | "name": "renounceAdmin", 896 | "outputs": [], 897 | "stateMutability": "nonpayable", 898 | "type": "function" 899 | }, 900 | { 901 | "inputs": [ 902 | { 903 | "internalType": "bytes32", 904 | "name": "questionID", 905 | "type": "bytes32" 906 | } 907 | ], 908 | "name": "reset", 909 | "outputs": [], 910 | "stateMutability": "nonpayable", 911 | "type": "function" 912 | }, 913 | { 914 | "inputs": [ 915 | { 916 | "internalType": "bytes32", 917 | "name": "questionID", 918 | "type": "bytes32" 919 | } 920 | ], 921 | "name": "resolve", 922 | "outputs": [], 923 | "stateMutability": "nonpayable", 924 | "type": "function" 925 | }, 926 | { 927 | "inputs": [ 928 | { 929 | "internalType": "bytes32", 930 | "name": "questionID", 931 | "type": "bytes32" 932 | } 933 | ], 934 | "name": "unflag", 935 | "outputs": [], 936 | "stateMutability": "nonpayable", 937 | "type": "function" 938 | }, 939 | { 940 | "inputs": [ 941 | { 942 | "internalType": "bytes32", 943 | "name": "questionID", 944 | "type": "bytes32" 945 | } 946 | ], 947 | "name": "unpause", 948 | "outputs": [], 949 | "stateMutability": "nonpayable", 950 | "type": "function" 951 | }, 952 | { 953 | "inputs": [ 954 | { 955 | "internalType": "bytes32", 956 | "name": "", 957 | "type": "bytes32" 958 | }, 959 | { 960 | "internalType": "uint256", 961 | "name": "", 962 | "type": "uint256" 963 | } 964 | ], 965 | "name": "updates", 966 | "outputs": [ 967 | { 968 | "internalType": "uint256", 969 | "name": "timestamp", 970 | "type": "uint256" 971 | }, 972 | { 973 | "internalType": "bytes", 974 | "name": "update", 975 | "type": "bytes" 976 | } 977 | ], 978 | "stateMutability": "view", 979 | "type": "function" 980 | } 981 | ] --------------------------------------------------------------------------------