polkamarkets-js 1.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openzeppelin/unknown-1337.json +2056 -0
- package/CONTRIBUTING.md +36 -0
- package/README.md +24 -25
- package/_book/README.md +590 -0
- package/_book/core.md +50 -0
- package/_book/gitbook/fonts/fontawesome/FontAwesome.otf +0 -0
- package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.eot +0 -0
- package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.svg +685 -0
- package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.ttf +0 -0
- package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff +0 -0
- package/_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 +0 -0
- package/_book/gitbook/gitbook-plugin-fontsettings/fontsettings.js +240 -0
- package/_book/gitbook/gitbook-plugin-fontsettings/website.css +291 -0
- package/_book/gitbook/gitbook-plugin-highlight/ebook.css +135 -0
- package/_book/gitbook/gitbook-plugin-highlight/website.css +434 -0
- package/_book/gitbook/gitbook-plugin-lunr/lunr.min.js +7 -0
- package/_book/gitbook/gitbook-plugin-lunr/search-lunr.js +59 -0
- package/_book/gitbook/gitbook-plugin-search/lunr.min.js +7 -0
- package/_book/gitbook/gitbook-plugin-search/search-engine.js +50 -0
- package/_book/gitbook/gitbook-plugin-search/search.css +35 -0
- package/_book/gitbook/gitbook-plugin-search/search.js +213 -0
- package/_book/gitbook/gitbook-plugin-sharing/buttons.js +90 -0
- package/_book/gitbook/gitbook.js +4 -0
- package/_book/gitbook/images/apple-touch-icon-precomposed-152.png +0 -0
- package/_book/gitbook/images/favicon.ico +0 -0
- package/_book/gitbook/style.css +9 -0
- package/_book/gitbook/theme.js +4 -0
- package/_book/index.html +705 -0
- package/_book/intro.md +32 -0
- package/_book/search_index.json +1 -0
- package/book.json +8 -0
- package/build/contracts/AccessControl.json +1 -0
- package/build/contracts/AccessControlEnumerable.json +1 -0
- package/build/contracts/Achievements.json +1 -0
- package/build/contracts/Address.json +1 -0
- package/build/contracts/BalanceHolder.json +1 -0
- package/build/contracts/BalanceHolder_ERC20.json +1 -0
- package/build/contracts/CeilDiv.json +1 -0
- package/build/contracts/Clones.json +1 -0
- package/build/contracts/Context.json +1 -0
- package/build/contracts/Counters.json +1 -0
- package/build/contracts/ERC165.json +1 -0
- package/build/contracts/ERC20.json +1 -0
- package/build/contracts/ERC20Burnable.json +1 -0
- package/build/contracts/ERC20Pausable.json +1 -0
- package/build/contracts/ERC20PresetMinterPauser.json +1 -0
- package/build/contracts/ERC721.json +1 -0
- package/build/contracts/EnumerableMap.json +1 -0
- package/build/contracts/EnumerableSet.json +1 -0
- package/build/contracts/FantasyERC20.json +1 -0
- package/build/contracts/IAccessControl.json +1 -0
- package/build/contracts/IAccessControlEnumerable.json +1 -0
- package/build/contracts/IBalanceHolder_ERC20.json +1 -0
- package/build/contracts/IERC165.json +1 -0
- package/build/contracts/IERC20.json +1 -0
- package/build/contracts/IERC20Metadata.json +1 -0
- package/build/contracts/IERC20Permit.json +1 -0
- package/build/contracts/IERC721.json +1 -0
- package/build/contracts/IERC721Enumerable.json +1 -0
- package/build/contracts/IERC721Metadata.json +1 -0
- package/build/contracts/IERC721Receiver.json +1 -0
- package/build/contracts/IFantasyERC20.json +1 -0
- package/build/contracts/IPredictionMarketV3.json +1 -0
- package/build/contracts/IPredictionMarketV3Factory.json +1 -0
- package/build/contracts/IPredictionMarketV3Manager.json +1 -0
- package/build/contracts/IRealityETH_ERC20.json +1 -0
- package/build/contracts/IRealityETH_IERC20.json +1 -0
- package/build/contracts/IWETH.json +1 -0
- package/build/contracts/LandFactory.json +1 -0
- package/build/contracts/Math.json +1 -0
- package/build/contracts/Migrations.json +1 -0
- package/build/contracts/Ownable.json +1 -0
- package/build/contracts/Pausable.json +1 -0
- package/build/contracts/PredictionMarket.json +1 -0
- package/build/contracts/PredictionMarketV2.json +1 -0
- package/build/contracts/PredictionMarketV3.json +1 -0
- package/build/contracts/PredictionMarketV3Controller.json +1 -0
- package/build/contracts/PredictionMarketV3Factory.json +1 -0
- package/build/contracts/PredictionMarketV3Manager.json +1 -0
- package/build/contracts/PredictionMarketV3Querier.json +1 -0
- package/build/contracts/RealitioERC20.json +1 -0
- package/build/contracts/RealitioForeignArbitrationProxyWithAppeals.json +1 -0
- package/build/contracts/RealitioHomeArbitrationProxy.json +1 -0
- package/build/contracts/RealitioSafeMath256.json +1 -0
- package/build/contracts/RealitioSafeMath32.json +1 -0
- package/build/contracts/RealityETH_ERC20_Factory.json +1 -0
- package/build/contracts/RealityETH_ERC20_v3_0.json +1 -0
- package/build/contracts/ReentrancyGuard.json +1 -0
- package/build/contracts/SafeERC20.json +1 -0
- package/build/contracts/SafeMath.json +1 -0
- package/build/contracts/Strings.json +1 -0
- package/build/contracts/Voting.json +1 -0
- package/build/contracts/WETH9.json +1 -0
- package/build/contracts/test.json +1 -0
- package/cleanContracts.js +22 -0
- package/contracts/FantasyERC20.sol +81 -0
- package/contracts/IFantasyERC20.sol +20 -0
- package/contracts/IPredictionMarketV3.sol +207 -0
- package/contracts/IPredictionMarketV3Factory.sol +10 -0
- package/contracts/IPredictionMarketV3Manager.sol +12 -0
- package/contracts/IRealityETH_ERC20.sol +64 -0
- package/contracts/LandFactory.sol +248 -0
- package/contracts/Migrations.sol +24 -0
- package/contracts/PredictionMarketV3.sol +1332 -0
- package/contracts/PredictionMarketV3Controller.sol +87 -0
- package/contracts/PredictionMarketV3Factory.sol +205 -0
- package/contracts/PredictionMarketV3Manager.sol +45 -0
- package/contracts/PredictionMarketV3Querier.sol +79 -0
- package/contracts/RealityETH_ERC20_Factory.sol +54 -0
- package/contracts/Voting.sol +153 -0
- package/contracts/WETH9.sol +62 -0
- package/help.txt +8 -0
- package/index.js +3 -0
- package/migrations/10_deploy_weth.js +5 -0
- package/migrations/11_deploy_full_flow.js +99 -0
- package/migrations/12_deploy_pm_v3_querier.js +7 -0
- package/migrations/13_deploy_pm_v3_factory.js +14 -0
- package/migrations/1_initial_migration.js +5 -0
- package/migrations/2_deploy_erc20.js +10 -0
- package/migrations/3_deploy_realitio.js +11 -0
- package/migrations/4_deploy_pm.js +20 -0
- package/migrations/5_seed_markets.js +51 -0
- package/migrations/6_deploy_achievements.js +5 -0
- package/migrations/7_deploy_voting.js +14 -0
- package/migrations/8_deploy_pm_v2.js +20 -0
- package/migrations/9_seed_markets_v2.js +68 -0
- package/package.json +106 -13
- package/src/Application.js +421 -0
- package/src/interfaces/index.js +19 -0
- package/src/models/AchievementsContract.js +217 -0
- package/src/models/ArbitrationContract.js +69 -0
- package/src/models/ArbitrationProxyContract.js +32 -0
- package/src/models/ERC20Contract.js +156 -0
- package/src/models/FantasyERC20Contract.js +92 -0
- package/src/models/IContract.js +1002 -0
- package/src/models/PolkamarketsSmartAccount.js +100 -0
- package/src/models/PredictionMarketContract.js +562 -0
- package/src/models/PredictionMarketV2Contract.js +830 -0
- package/src/models/PredictionMarketV3Contract.js +233 -0
- package/src/models/PredictionMarketV3ControllerContract.js +102 -0
- package/src/models/PredictionMarketV3FactoryContract.js +96 -0
- package/src/models/PredictionMarketV3ManagerContract.js +111 -0
- package/src/models/PredictionMarketV3QuerierContract.js +24 -0
- package/src/models/RealitioERC20Contract.js +286 -0
- package/src/models/VotingContract.js +182 -0
- package/src/models/WETH9Contract.js +92 -0
- package/src/models/index.js +33 -0
- package/src/utils/Account.js +40 -0
- package/src/utils/Contract.js +120 -0
- package/src/utils/Numbers.js +94 -0
- package/tests/fantasyERC20Contract.js +225 -0
- package/tests/index.js +10 -0
- package/tests/predictionMarketContract.js +466 -0
- package/tests/predictionMarketV2Contract.js +1042 -0
- package/tests/predictionMarketV3Contract.js +1079 -0
- package/tests/predictionMarketV3ControllerContract.js +613 -0
- package/tests/predictionMarketV3FactoryContract.js +469 -0
- package/tests/predictionMarketV3ManagerContract.js +610 -0
- package/tests/utils.js +16 -0
- package/tests/votingContract.js +490 -0
- package/tooling/docs/jsdoc.json +6 -0
- package/truffle-config.js +134 -0
- package/polkamarkets.js +0 -436
package/help.txt
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const PredictionMarketV3 = artifacts.require("PredictionMarketV3");
|
|
2
|
+
const PredictionMarketV3Manager = artifacts.require("PredictionMarketV3Manager");
|
|
3
|
+
const ERC20PresetMinterPauser = artifacts.require("ERC20PresetMinterPauser");
|
|
4
|
+
const RealityETH_ERC20_v3_0 = artifacts.require("RealityETH_ERC20_v3_0");
|
|
5
|
+
const FantasyERC20 = artifacts.require("FantasyERC20");
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
TOKEN,
|
|
9
|
+
REALITIO_ADDRESS,
|
|
10
|
+
LOCK_AMOUNT,
|
|
11
|
+
WETH,
|
|
12
|
+
PM3_ADDRESS,
|
|
13
|
+
ERC20_USER,
|
|
14
|
+
PM3_MANAGER_ADDRESS,
|
|
15
|
+
LAND_TOKEN
|
|
16
|
+
} = process.env;
|
|
17
|
+
|
|
18
|
+
module.exports = async function(deployer) {
|
|
19
|
+
|
|
20
|
+
let ERC20;
|
|
21
|
+
// Comment block if you want to use an existing token
|
|
22
|
+
await deployer.deploy(ERC20PresetMinterPauser, "PM3 Token", "PM3TOKEN");
|
|
23
|
+
ERC20 = await ERC20PresetMinterPauser.deployed();
|
|
24
|
+
await ERC20.mint(ERC20_USER, '1000000000000000000000');
|
|
25
|
+
TOKEN = ERC20.address;
|
|
26
|
+
|
|
27
|
+
ERC20 = await ERC20PresetMinterPauser.at(TOKEN);
|
|
28
|
+
|
|
29
|
+
// Comment block if you want to use existing realitio
|
|
30
|
+
await deployer.deploy(RealityETH_ERC20_v3_0);
|
|
31
|
+
const realitio = await RealityETH_ERC20_v3_0.deployed(RealityETH_ERC20_v3_0);
|
|
32
|
+
await realitio.setToken(TOKEN);
|
|
33
|
+
REALITIO_ADDRESS = realitio.address;
|
|
34
|
+
|
|
35
|
+
let PM3;
|
|
36
|
+
// Comment block if you want to use existing PM3
|
|
37
|
+
await deployer.deploy(
|
|
38
|
+
PredictionMarketV3,
|
|
39
|
+
WETH, // weth
|
|
40
|
+
);
|
|
41
|
+
PM3 = await PredictionMarketV3.deployed(PredictionMarketV3);
|
|
42
|
+
PM3_ADDRESS = PM3.address;
|
|
43
|
+
|
|
44
|
+
PM3 = await PredictionMarketV3.at(PM3_ADDRESS);
|
|
45
|
+
|
|
46
|
+
let PM3Manager;
|
|
47
|
+
// Comment block if you want to use existing PM3Manager
|
|
48
|
+
await deployer.deploy(
|
|
49
|
+
PredictionMarketV3Manager,
|
|
50
|
+
PM3_ADDRESS,
|
|
51
|
+
TOKEN,
|
|
52
|
+
LOCK_AMOUNT,
|
|
53
|
+
REALITIO_ADDRESS
|
|
54
|
+
);
|
|
55
|
+
PM3Manager = await PredictionMarketV3Manager.deployed(PredictionMarketV3Manager);
|
|
56
|
+
PM3_MANAGER_ADDRESS = PM3Manager.address;
|
|
57
|
+
|
|
58
|
+
PM3Manager = await PredictionMarketV3Manager.at(PM3_MANAGER_ADDRESS);
|
|
59
|
+
|
|
60
|
+
// Comment block if approve was already performed
|
|
61
|
+
await ERC20.approve(PM3_MANAGER_ADDRESS, '1000000000000000000000');
|
|
62
|
+
|
|
63
|
+
let LandERC20;
|
|
64
|
+
// Comment block if you want to use a land already created
|
|
65
|
+
await PM3Manager.createLand(
|
|
66
|
+
'PM3 Land Token',
|
|
67
|
+
'LAND',
|
|
68
|
+
'1000000000000000000',
|
|
69
|
+
TOKEN
|
|
70
|
+
)
|
|
71
|
+
LAND_TOKEN = await PM3Manager.landTokens(0);
|
|
72
|
+
|
|
73
|
+
LandERC20 = await FantasyERC20.at(LAND_TOKEN);
|
|
74
|
+
|
|
75
|
+
// Comment block if approve was already performed
|
|
76
|
+
await LandERC20.approve(PM3_ADDRESS, '1000000000000000000000');
|
|
77
|
+
|
|
78
|
+
// Comment block if market was already created
|
|
79
|
+
const land = await PM3Manager.lands(LAND_TOKEN);
|
|
80
|
+
const landRealitio = land.realitio;
|
|
81
|
+
await PM3.mintAndCreateMarket(
|
|
82
|
+
{
|
|
83
|
+
value: '1000000000000000000',
|
|
84
|
+
closesAt: 1735689600,
|
|
85
|
+
outcomes: 2,
|
|
86
|
+
token: LAND_TOKEN,
|
|
87
|
+
distribution: [50000000,50000000],
|
|
88
|
+
question: 'Will this market be created?;This is a test market.␟"Yes","No"␟Test;Testing;https://google.pt/␟',
|
|
89
|
+
image: "",
|
|
90
|
+
arbitrator: '0x000000000000000000000000000000000000dead',
|
|
91
|
+
fee: 0,
|
|
92
|
+
treasuryFee: 0,
|
|
93
|
+
treasury: '0x000000000000000000000000000000000000dead',
|
|
94
|
+
realitio: landRealitio,
|
|
95
|
+
realitioTimeout: 300,
|
|
96
|
+
manager: PM3_MANAGER_ADDRESS,
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const PredictionMarketV3Factory = artifacts.require("PredictionMarketV3Factory");
|
|
2
|
+
|
|
3
|
+
const { TOKEN, PM3_ADDRESS, REALITIO_ADDRESS } = process.env;
|
|
4
|
+
|
|
5
|
+
module.exports = async function(deployer) {
|
|
6
|
+
await deployer.deploy(
|
|
7
|
+
PredictionMarketV3Factory,
|
|
8
|
+
TOKEN,
|
|
9
|
+
'1000000000000000000',
|
|
10
|
+
PM3_ADDRESS,
|
|
11
|
+
REALITIO_ADDRESS,
|
|
12
|
+
{ gas: 10000000 }
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const PredictionMarket = artifacts.require("PredictionMarket");
|
|
2
|
+
const ERC20PresetMinterPauser = artifacts.require("ERC20PresetMinterPauser");
|
|
3
|
+
const ERC20_USER = process.env.ERC20_USER;
|
|
4
|
+
|
|
5
|
+
module.exports = async function(deployer, network, accounts) {
|
|
6
|
+
// NOTE: USE THIS ONLY FOR DEV PURPOSES!!
|
|
7
|
+
await deployer.deploy(ERC20PresetMinterPauser, "Test Token", "TEST");
|
|
8
|
+
const token = await ERC20PresetMinterPauser.deployed();
|
|
9
|
+
await token.mint(ERC20_USER, '100000000000000000000000000');
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const RealityETH_ERC20_v3_0 = artifacts.require("RealityETH_ERC20_v3_0");
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
TOKEN
|
|
5
|
+
} = process.env;
|
|
6
|
+
|
|
7
|
+
module.exports = async function (deployer) {
|
|
8
|
+
await deployer.deploy(RealityETH_ERC20_v3_0);
|
|
9
|
+
const realitio = await RealityETH_ERC20_v3_0.deployed(RealityETH_ERC20_v3_0);
|
|
10
|
+
await realitio.setToken(TOKEN);
|
|
11
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const PredictionMarket = artifacts.require("PredictionMarket");
|
|
2
|
+
const {
|
|
3
|
+
FEE,
|
|
4
|
+
TOKEN,
|
|
5
|
+
REQUIRED_BALANCE,
|
|
6
|
+
REALITIO_ADDRESS,
|
|
7
|
+
REALITIO_TIMEOUT,
|
|
8
|
+
} = process.env;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
module.exports = async function(deployer) {
|
|
12
|
+
await deployer.deploy(
|
|
13
|
+
PredictionMarket,
|
|
14
|
+
FEE, // fee
|
|
15
|
+
TOKEN, // token
|
|
16
|
+
REQUIRED_BALANCE, // requiredBalance
|
|
17
|
+
REALITIO_ADDRESS, // realitioAddress
|
|
18
|
+
REALITIO_TIMEOUT, // realitioTimeout,
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const PredictionMarket = artifacts.require("PredictionMarket");
|
|
2
|
+
const realitioLib = require('@reality.eth/reality-eth-lib/formatters/question');
|
|
3
|
+
const web3 = require('web3');
|
|
4
|
+
|
|
5
|
+
module.exports = async function(deployer) {
|
|
6
|
+
const predictionMarket = await PredictionMarket.deployed();
|
|
7
|
+
|
|
8
|
+
const markets = [
|
|
9
|
+
{
|
|
10
|
+
name: 'Will Bitcoin price be above $100,000 by January 1st 2024?',
|
|
11
|
+
outcomes: ['Yes', 'No'],
|
|
12
|
+
category: 'Crypto;Bitcoin',
|
|
13
|
+
image: 'QmXUiapNZUbxfWpNYMtbT8Xpyk4EdF6gKWa7cw8SBX5gm9',
|
|
14
|
+
closesAt: 1704067200,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'Will PSG win the champions league?',
|
|
18
|
+
outcomes: ['Yes', 'No'],
|
|
19
|
+
category: 'Sports;Football',
|
|
20
|
+
image: 'QmVbL7tKGeJUcv7KCMYSmz961JdzeMnVAoicnMqNSjyReh',
|
|
21
|
+
closesAt: 1704067200,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'Will Ethereum price be above $10,000 by January 1st 2024?',
|
|
25
|
+
outcomes: ['Yes', 'No'],
|
|
26
|
+
category: 'Crypto;Ethereum',
|
|
27
|
+
image: 'QmQMWVzqkXrizpiLFqGLvx6ruWzTWUGiUpP2r26jVtDoqT',
|
|
28
|
+
closesAt: 1704067200,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Hello world',
|
|
32
|
+
outcomes: ['Yes', 'No'],
|
|
33
|
+
category: 'Foo;Bar',
|
|
34
|
+
image: 'QmRufywuLNzd7xVUwRzp3wBFnFUJ1EmzVH1R5Hq9xMWfkX',
|
|
35
|
+
closesAt: new Date().getTime() + 300, // expiring 5 minutes after creation
|
|
36
|
+
},
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
for (const market of markets) {
|
|
40
|
+
const question = realitioLib.encodeText('single-select', market.name, market.outcomes, market.category);
|
|
41
|
+
|
|
42
|
+
await predictionMarket.createMarket(
|
|
43
|
+
question,
|
|
44
|
+
market.image,
|
|
45
|
+
market.closesAt,
|
|
46
|
+
'0x000000000000000000000000000000000000dead',
|
|
47
|
+
2,
|
|
48
|
+
{ value: '10000000000000000' }
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const PredictionMarketV2 = artifacts.require("PredictionMarketV2");
|
|
2
|
+
const {
|
|
3
|
+
TOKEN,
|
|
4
|
+
REQUIRED_BALANCE,
|
|
5
|
+
REALITIO_ADDRESS,
|
|
6
|
+
REALITIO_TIMEOUT,
|
|
7
|
+
WETH,
|
|
8
|
+
} = process.env;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
module.exports = async function(deployer) {
|
|
12
|
+
await deployer.deploy(
|
|
13
|
+
PredictionMarketV2,
|
|
14
|
+
TOKEN, // token
|
|
15
|
+
REQUIRED_BALANCE, // requiredBalance
|
|
16
|
+
REALITIO_ADDRESS, // realitioAddress
|
|
17
|
+
REALITIO_TIMEOUT, // realitioTimeout,
|
|
18
|
+
WETH, // weth
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const PredictionMarketV2 = artifacts.require("PredictionMarketV2");
|
|
2
|
+
const realitioLib = require('@reality.eth/reality-eth-lib/formatters/question');
|
|
3
|
+
const web3 = require('web3');
|
|
4
|
+
|
|
5
|
+
module.exports = async function(deployer) {
|
|
6
|
+
const predictionMarket = await PredictionMarketV2.deployed();
|
|
7
|
+
|
|
8
|
+
const markets = [
|
|
9
|
+
{
|
|
10
|
+
name: 'Will Bitcoin price be above $100,000 by January 1st 2024?',
|
|
11
|
+
outcomes: ['Yes', 'No'],
|
|
12
|
+
category: 'Crypto;Bitcoin',
|
|
13
|
+
image: 'QmXUiapNZUbxfWpNYMtbT8Xpyk4EdF6gKWa7cw8SBX5gm9',
|
|
14
|
+
closesAt: 1704067200,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'Market with 3 outcomes',
|
|
18
|
+
outcomes: ['Outcome A', 'Outcome B', 'Outcome C'],
|
|
19
|
+
category: 'Other;Misc',
|
|
20
|
+
image: 'QmdRGv8odwsnafpz49ZayQNhmJzJTaT2kjXrrm6aBMJ1Qw',
|
|
21
|
+
closesAt: 1704067200,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'Market with 4 outcomes',
|
|
25
|
+
outcomes: ['Outcome A', 'Outcome B', 'Outcome C', 'Outcome D'],
|
|
26
|
+
category: 'Other;Misc',
|
|
27
|
+
image: 'QmdRGv8odwsnafpz49ZayQNhmJzJTaT2kjXrrm6aBMJ1Qw',
|
|
28
|
+
closesAt: 1704067200,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Market with 3 outcomes uneven',
|
|
32
|
+
outcomes: ['Outcome A', 'Outcome B', 'Outcome C'],
|
|
33
|
+
category: 'Other;Misc',
|
|
34
|
+
image: 'QmdRGv8odwsnafpz49ZayQNhmJzJTaT2kjXrrm6aBMJ1Qw',
|
|
35
|
+
closesAt: 1704067200,
|
|
36
|
+
distribution: [300000000, 975000000, 1300000000],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Market with 10 outcomes',
|
|
40
|
+
outcomes: ['Outcome A', 'Outcome B', 'Outcome C', 'Outcome D', 'Outcome E', 'Outcome F', 'Outcome G', 'Outcome H', 'Outcome I', 'Outcome J'],
|
|
41
|
+
category: 'Other;Misc',
|
|
42
|
+
image: 'QmdRGv8odwsnafpz49ZayQNhmJzJTaT2kjXrrm6aBMJ1Qw',
|
|
43
|
+
closesAt: 1704067200,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Market with 32 outcomes',
|
|
47
|
+
outcomes: ['Outcome A', 'Outcome B', 'Outcome C', 'Outcome D', 'Outcome E', 'Outcome F', 'Outcome G', 'Outcome H', 'Outcome I', 'Outcome J', 'Outcome K', 'Outcome L', 'Outcome M', 'Outcome N', 'Outcome O', 'Outcome P', 'Outcome Q', 'Outcome R', 'Outcome S', 'Outcome T', 'Outcome U', 'Outcome V', 'Outcome W', 'Outcome X', 'Outcome Y', 'Outcome Z', 'Outcome AA', 'Outcome BB', 'Outcome CC', 'Outcome DD', 'Outcome EE', 'Outcome FF'],
|
|
48
|
+
category: 'Other;Misc',
|
|
49
|
+
image: 'QmdRGv8odwsnafpz49ZayQNhmJzJTaT2kjXrrm6aBMJ1Qw',
|
|
50
|
+
closesAt: 1704067200,
|
|
51
|
+
},
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
for (const market of markets) {
|
|
55
|
+
const question = realitioLib.encodeText('single-select', market.name, market.outcomes, market.category);
|
|
56
|
+
|
|
57
|
+
await predictionMarket.createMarket({
|
|
58
|
+
value: '10000000000000000000',
|
|
59
|
+
closesAt: market.closesAt,
|
|
60
|
+
outcomes: market.outcomes.length,
|
|
61
|
+
token: '0x7895b8d634709dd810e384df27a8c989c907fc4a',
|
|
62
|
+
distribution: market.distribution || [],
|
|
63
|
+
question,
|
|
64
|
+
image: market.image,
|
|
65
|
+
arbitrator: '0x000000000000000000000000000000000000dead',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,108 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
"name": "polkamarkets-js",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"test": "test"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/Polkamarkets/polkamarkets-js.git"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "npm run compile && ./node_modules/.bin/mocha ./tests/index.js --timeout 3000000 --require babel-core/register --require babel-polyfill --exit",
|
|
15
|
+
"index": "babel-node ./index.js --presets es2015,stage-2",
|
|
16
|
+
"build": "npm run compile && babel ./src --out-dir lib --copy-files -d ./build",
|
|
17
|
+
"compile": "truffle compile",
|
|
18
|
+
"postcompile": "node ./cleanContracts.js",
|
|
19
|
+
"docs:api": "jsdoc2md --configure tooling/docs/jsdoc.json --files src/**/*.js > docs/README.md",
|
|
20
|
+
"docs:prepare": "gitbook install",
|
|
21
|
+
"docs:build": "npm run docs:prepare && npm run docs:api && gitbook build",
|
|
22
|
+
"docs:serve": "npm run docs:prepare && npm run docs:api && gitbook serve",
|
|
23
|
+
"docs:clean": "rimraf _book",
|
|
24
|
+
"install": "( [ ! -d ./build ] && [ ! -f ./built ] && echo \"\" > ./built && npm install . && npm run build ) || echo \"Already built\""
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@metamask/safe-event-emitter": "^2.0.0",
|
|
28
|
+
"@metamask/utils": "^8.2.1",
|
|
29
|
+
"@openzeppelin/contracts": "^4.8.2",
|
|
30
|
+
"@openzeppelin/contracts-upgradeable": "^4.8.2",
|
|
31
|
+
"@openzeppelin/truffle-upgrades": "^1.7.0",
|
|
32
|
+
"@particle-network/aa": "^1.2.0",
|
|
33
|
+
"@reality.eth/reality-eth-lib": "^3.2.10",
|
|
34
|
+
"axios": "^0.24.0",
|
|
35
|
+
"babel-cli": "^6.26.0",
|
|
36
|
+
"babel-plugin-transform-runtime": "^6.23.0",
|
|
37
|
+
"babel-preset-env": "^1.6.1",
|
|
38
|
+
"babel-preset-stage-2": "^6.24.1",
|
|
39
|
+
"chai": "^4.2.0",
|
|
40
|
+
"dotenv": "^8.2.0",
|
|
41
|
+
"ethers": "^5.6.9",
|
|
42
|
+
"html-to-text": "9.0.5",
|
|
43
|
+
"left-pad": "^1.3.0",
|
|
44
|
+
"lodash": "^4.17.10",
|
|
45
|
+
"mocha": "^5.1.1",
|
|
46
|
+
"moment": "^2.21.0",
|
|
47
|
+
"node-gyp": "^9.4.0",
|
|
48
|
+
"permissionless": "0.1.30",
|
|
49
|
+
"superstruct": "^1.0.3",
|
|
50
|
+
"thirdweb": "^5.64.3",
|
|
51
|
+
"viem": "^2.13.3",
|
|
52
|
+
"web3": "1.9.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@truffle/hdwallet-provider": "^1.4.0",
|
|
56
|
+
"babel-plugin-transform-runtime": "^6.23.0",
|
|
57
|
+
"babel-preset-env": "^1.6.1",
|
|
58
|
+
"babel-preset-es2015": "^6.24.1",
|
|
59
|
+
"babel-register": "^6.26.0",
|
|
60
|
+
"gitbook-cli": "^2.3.2",
|
|
61
|
+
"jsdoc-babel": "^0.5.0",
|
|
62
|
+
"jsdoc-md": "^8.0.0",
|
|
63
|
+
"jsdoc-to-markdown": "^6.0.1",
|
|
64
|
+
"prettier": "^2.3.2",
|
|
65
|
+
"prettier-plugin-solidity": "^1.0.0-beta.14",
|
|
66
|
+
"should": "^7.1.0",
|
|
67
|
+
"solc": "^0.6.0",
|
|
68
|
+
"supertest": "^1.0.0",
|
|
69
|
+
"truffle-contract-size": "^2.0.1",
|
|
70
|
+
"truffle-plugin-verify": "^0.5.15"
|
|
71
|
+
},
|
|
72
|
+
"babel": {
|
|
73
|
+
"presets": [
|
|
74
|
+
"env",
|
|
75
|
+
"es2015",
|
|
76
|
+
"stage-2"
|
|
77
|
+
],
|
|
78
|
+
"plugins": [
|
|
79
|
+
"transform-runtime"
|
|
80
|
+
],
|
|
81
|
+
"sourceMaps": true,
|
|
82
|
+
"retainLines": true
|
|
83
|
+
},
|
|
84
|
+
"author": "",
|
|
85
|
+
"license": "ISC",
|
|
86
|
+
"prettier": {
|
|
87
|
+
"overrides": [
|
|
88
|
+
{
|
|
89
|
+
"files": "*.sol",
|
|
90
|
+
"options": {
|
|
91
|
+
"printWidth": 120,
|
|
92
|
+
"tabWidth": 2,
|
|
93
|
+
"useTabs": false,
|
|
94
|
+
"singleQuote": false,
|
|
95
|
+
"bracketSpacing": false,
|
|
96
|
+
"explicitTypes": "always"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"resolutions": {
|
|
102
|
+
"babel-loader": "8.1.0",
|
|
103
|
+
"webpack": "4.44.2",
|
|
104
|
+
"styled-components": "^5",
|
|
105
|
+
"html-to-text": "^7.1.1",
|
|
106
|
+
"marked": "3.0.8"
|
|
107
|
+
}
|
|
15
108
|
}
|