@requestnetwork/smart-contracts 0.28.1-next.1614 → 0.28.1-next.1616

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.
Files changed (50) hide show
  1. package/dist/hardhat.config.d.ts +69 -0
  2. package/dist/hardhat.config.d.ts.map +1 -0
  3. package/dist/hardhat.config.js +131 -0
  4. package/dist/hardhat.config.js.map +1 -0
  5. package/dist/scripts/1_deploy-request-storage.d.ts +3 -0
  6. package/dist/scripts/1_deploy-request-storage.d.ts.map +1 -0
  7. package/dist/scripts/1_deploy-request-storage.js +37 -0
  8. package/dist/scripts/1_deploy-request-storage.js.map +1 -0
  9. package/dist/scripts/2_deploy-main-payments.d.ts +4 -0
  10. package/dist/scripts/2_deploy-main-payments.d.ts.map +1 -0
  11. package/dist/scripts/2_deploy-main-payments.js +85 -0
  12. package/dist/scripts/2_deploy-main-payments.js.map +1 -0
  13. package/dist/scripts/3_deploy_chainlink_contract.d.ts +4 -0
  14. package/dist/scripts/3_deploy_chainlink_contract.d.ts.map +1 -0
  15. package/dist/scripts/3_deploy_chainlink_contract.js +68 -0
  16. package/dist/scripts/3_deploy_chainlink_contract.js.map +1 -0
  17. package/dist/scripts/4_deploy-escrow-deployment.d.ts +4 -0
  18. package/dist/scripts/4_deploy-escrow-deployment.d.ts.map +1 -0
  19. package/dist/scripts/4_deploy-escrow-deployment.js +30 -0
  20. package/dist/scripts/4_deploy-escrow-deployment.js.map +1 -0
  21. package/dist/scripts/conversion-proxy.d.ts +11 -0
  22. package/dist/scripts/conversion-proxy.d.ts.map +1 -0
  23. package/dist/scripts/conversion-proxy.js +61 -0
  24. package/dist/scripts/conversion-proxy.js.map +1 -0
  25. package/dist/scripts/deploy-one.d.ts +30 -0
  26. package/dist/scripts/deploy-one.d.ts.map +1 -0
  27. package/dist/scripts/deploy-one.js +109 -0
  28. package/dist/scripts/deploy-one.js.map +1 -0
  29. package/dist/scripts/deploy-payments.d.ts +18 -0
  30. package/dist/scripts/deploy-payments.d.ts.map +1 -0
  31. package/dist/scripts/deploy-payments.js +232 -0
  32. package/dist/scripts/deploy-payments.js.map +1 -0
  33. package/dist/scripts/erc20-swap-to-conversion.d.ts +10 -0
  34. package/dist/scripts/erc20-swap-to-conversion.d.ts.map +1 -0
  35. package/dist/scripts/erc20-swap-to-conversion.js +80 -0
  36. package/dist/scripts/erc20-swap-to-conversion.js.map +1 -0
  37. package/dist/scripts/eth-conversion-proxy.d.ts +7 -0
  38. package/dist/scripts/eth-conversion-proxy.d.ts.map +1 -0
  39. package/dist/scripts/eth-conversion-proxy.js +32 -0
  40. package/dist/scripts/eth-conversion-proxy.js.map +1 -0
  41. package/dist/scripts/prepare-payments.d.ts +4 -0
  42. package/dist/scripts/prepare-payments.d.ts.map +1 -0
  43. package/dist/scripts/prepare-payments.js +31 -0
  44. package/dist/scripts/prepare-payments.js.map +1 -0
  45. package/dist/scripts/utils.d.ts +6 -0
  46. package/dist/scripts/utils.d.ts.map +1 -0
  47. package/dist/scripts/utils.js +23 -0
  48. package/dist/scripts/utils.js.map +1 -0
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. package/package.json +9 -5
@@ -0,0 +1,69 @@
1
+ import '@typechain/hardhat';
2
+ import '@nomiclabs/hardhat-waffle';
3
+ import '@nomiclabs/hardhat-ganache';
4
+ import '@nomiclabs/hardhat-etherscan';
5
+ import '@nomiclabs/hardhat-ethers';
6
+ declare const _default: {
7
+ solidity: string;
8
+ paths: {
9
+ sources: string;
10
+ tests: string;
11
+ artifacts: string;
12
+ };
13
+ networks: {
14
+ private: {
15
+ url: string;
16
+ accounts: undefined;
17
+ };
18
+ mainnet: {
19
+ url: string;
20
+ chainId: number;
21
+ accounts: string[] | undefined;
22
+ };
23
+ rinkeby: {
24
+ url: string;
25
+ chainId: number;
26
+ accounts: string[] | undefined;
27
+ };
28
+ matic: {
29
+ url: string;
30
+ chainId: number;
31
+ accounts: string[] | undefined;
32
+ };
33
+ celo: {
34
+ url: string;
35
+ chainId: number;
36
+ accounts: string[] | undefined;
37
+ };
38
+ bsctest: {
39
+ url: string;
40
+ chainId: number;
41
+ accounts: string[] | undefined;
42
+ };
43
+ bsc: {
44
+ url: string;
45
+ chainId: number;
46
+ accounts: string[] | undefined;
47
+ };
48
+ xdai: {
49
+ url: string;
50
+ chainId: number;
51
+ accounts: string[] | undefined;
52
+ };
53
+ fantom: {
54
+ url: string;
55
+ chainId: number;
56
+ accounts: string[] | undefined;
57
+ };
58
+ };
59
+ etherscan: {
60
+ apiKey: string | undefined;
61
+ };
62
+ typechain: {
63
+ outDir: string;
64
+ target: string;
65
+ alwaysGenerateOverloads: boolean;
66
+ };
67
+ };
68
+ export default _default;
69
+ //# sourceMappingURL=hardhat.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardhat.config.d.ts","sourceRoot":"","sources":["../hardhat.config.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2BAA2B,CAAC;AACnC,OAAO,4BAA4B,CAAC;AACpC,OAAO,8BAA8B,CAAC;AACtC,OAAO,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBnC,wBA8DE"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ require("@typechain/hardhat");
5
+ require("@nomiclabs/hardhat-waffle");
6
+ require("@nomiclabs/hardhat-ganache");
7
+ require("@nomiclabs/hardhat-etherscan");
8
+ require("@nomiclabs/hardhat-ethers");
9
+ const config_1 = require("hardhat/config");
10
+ const dotenv_1 = require("dotenv");
11
+ const _1_deploy_request_storage_1 = require("./scripts/1_deploy-request-storage");
12
+ const _2_deploy_main_payments_1 = require("./scripts/2_deploy-main-payments");
13
+ const _3_deploy_chainlink_contract_1 = require("./scripts/3_deploy_chainlink_contract");
14
+ const deploy_payments_1 = require("./scripts/deploy-payments");
15
+ const prepare_payments_1 = require("./scripts/prepare-payments");
16
+ const _4_deploy_escrow_deployment_1 = require("./scripts/4_deploy-escrow-deployment");
17
+ (0, dotenv_1.config)();
18
+ const accounts = process.env.DEPLOYMENT_PRIVATE_KEY
19
+ ? [process.env.DEPLOYMENT_PRIVATE_KEY]
20
+ : process.env.ADMIN_PRIVATE_KEY
21
+ ? [process.env.ADMIN_PRIVATE_KEY]
22
+ : undefined;
23
+ if (accounts && process.env.ADMIN_PRIVATE_KEY) {
24
+ accounts.push(process.env.ADMIN_PRIVATE_KEY);
25
+ }
26
+ exports.default = {
27
+ solidity: '0.8.4',
28
+ paths: {
29
+ sources: 'src/contracts',
30
+ tests: 'test/contracts',
31
+ artifacts: 'build',
32
+ },
33
+ networks: {
34
+ private: {
35
+ url: 'http://127.0.0.1:8545',
36
+ accounts: undefined,
37
+ },
38
+ mainnet: {
39
+ url: process.env.WEB3_PROVIDER_URL || 'https://mainnet.infura.io/v3/YOUR_API_KEY',
40
+ chainId: 1,
41
+ accounts,
42
+ },
43
+ rinkeby: {
44
+ url: process.env.WEB3_PROVIDER_URL || 'https://rinkeby.infura.io/v3/YOUR_API_KEY',
45
+ chainId: 4,
46
+ accounts,
47
+ },
48
+ matic: {
49
+ url: process.env.WEB3_PROVIDER_URL || 'https://polygon-rpc.com',
50
+ chainId: 137,
51
+ accounts,
52
+ },
53
+ celo: {
54
+ url: process.env.WEB3_PROVIDER_URL || 'https://forno.celo.org',
55
+ chainId: 42220,
56
+ accounts,
57
+ },
58
+ bsctest: {
59
+ url: process.env.WEB3_PROVIDER_URL || 'https://data-seed-prebsc-1-s1.binance.org:8545',
60
+ chainId: 97,
61
+ accounts,
62
+ },
63
+ bsc: {
64
+ url: process.env.WEB3_PROVIDER_URL || 'https://bsc-dataseed1.binance.org',
65
+ chainId: 56,
66
+ accounts,
67
+ },
68
+ xdai: {
69
+ url: process.env.WEB3_PROVIDER_URL || 'https://rpc.xdaichain.com/',
70
+ chainId: 100,
71
+ accounts,
72
+ },
73
+ fantom: {
74
+ url: process.env.WEB3_PROVIDER_URL || 'https://rpcapi.fantom.network',
75
+ chainId: 250,
76
+ accounts,
77
+ },
78
+ },
79
+ etherscan: {
80
+ // Can be overridden according to the network (set-explorer-api-key)
81
+ apiKey: process.env.ETHERSCAN_API_KEY,
82
+ },
83
+ typechain: {
84
+ outDir: 'src/types',
85
+ target: 'ethers-v5',
86
+ alwaysGenerateOverloads: false, // should overloads with full signatures like deposit(uint256) be generated always, even if there are no overloads?
87
+ },
88
+ };
89
+ // Override the default API key for non-Etherscan explorers
90
+ const setExplorerApiKey = (hre) => {
91
+ switch (hre.network.name) {
92
+ case 'bsc':
93
+ case 'bsctestnet': {
94
+ hre.config.etherscan.apiKey = process.env.BSCSCAN_API_KEY;
95
+ return;
96
+ }
97
+ case 'matic':
98
+ case 'mumbai': {
99
+ hre.config.etherscan.apiKey = process.env.POLYGONSCAN_API_KEY;
100
+ return;
101
+ }
102
+ case 'fantom': {
103
+ hre.config.etherscan.apiKey = process.env.FTMSCAN_API_KEY;
104
+ return;
105
+ }
106
+ }
107
+ };
108
+ // FIXME: use deployAllPaymentContracts instead to test with the same deployments
109
+ (0, config_1.task)('deploy-local-env', 'Deploy a local environment').setAction((args, hre) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
110
+ args.force = true;
111
+ yield (0, _1_deploy_request_storage_1.default)(args, hre);
112
+ yield (0, _2_deploy_main_payments_1.default)(args, hre);
113
+ yield (0, _3_deploy_chainlink_contract_1.default)(args, hre);
114
+ yield (0, _4_deploy_escrow_deployment_1.deployEscrow)(hre);
115
+ console.log('All contracts (re)deployed locally');
116
+ }));
117
+ (0, config_1.task)('deploy-live-payments', 'Deploy payment contracts on a live network. Make sure to update all artifacts before running.')
118
+ .addFlag('dryRun', 'to prevent any deployment')
119
+ .addFlag('force', 'to force re-deployment')
120
+ .setAction((args, hre) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
121
+ var _a, _b;
122
+ args.force = (_a = args.force) !== null && _a !== void 0 ? _a : false;
123
+ args.dryRun = (_b = args.dryRun) !== null && _b !== void 0 ? _b : false;
124
+ args.simulate = args.dryRun;
125
+ setExplorerApiKey(hre);
126
+ yield (0, deploy_payments_1.deployAllPaymentContracts)(args, hre);
127
+ }));
128
+ (0, config_1.task)('prepare-live-payments', 'Run ERC20 approval transactions for Swap Conversion, with the second signer (FIXME with missing tasks).').setAction((_args, hre) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
129
+ yield (0, prepare_payments_1.preparePayments)(hre);
130
+ }));
131
+ //# sourceMappingURL=hardhat.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardhat.config.js","sourceRoot":"","sources":["../hardhat.config.ts"],"names":[],"mappings":";;;AAAA,8BAA4B;AAC5B,qCAAmC;AACnC,sCAAoC;AACpC,wCAAsC;AACtC,qCAAmC;AACnC,2CAAsC;AACtC,mCAAgC;AAChC,kFAA+D;AAC/D,8EAA6D;AAC7D,wFAAqE;AACrE,+DAAsE;AACtE,iEAA6D;AAC7D,sFAAoE;AAIpE,IAAA,eAAM,GAAE,CAAC;AAET,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB;IACjD,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACtC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC/B,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QACjC,CAAC,CAAC,SAAS,CAAC;AAEd,IAAI,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;IAC7C,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;CAC9C;AAED,kBAAe;IACb,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE;QACL,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,gBAAgB;QAC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,QAAQ,EAAE,2BAA2B,CAAC;KAC9C,OAAO,CAAC,OAAO,EAAE,wBAAwB,CAAC;KAC1C,SAAS,CAAC,CAAO,IAAI,EAAE,GAAG,EAAE,EAAE;;IAC7B,IAAI,CAAC,KAAK,GAAG,MAAA,IAAI,CAAC,KAAK,mCAAI,KAAK,CAAC;IACjC,IAAI,CAAC,MAAM,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,KAAK,CAAC;IACnC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5B,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACvB,MAAM,IAAA,2CAAyB,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC,CAAA,CAAC,CAAC;AAEL,IAAA,aAAI,EACF,uBAAuB,EACvB,yGAAyG,CAC1G,CAAC,SAAS,CAAC,CAAO,KAAK,EAAE,GAAG,EAAE,EAAE;IAC/B,MAAM,IAAA,kCAAe,EAAC,GAAG,CAAC,CAAC;AAC7B,CAAC,CAAA,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { HardhatRuntimeEnvironment } from 'hardhat/types';
2
+ export default function deploy(_args: any, hre: HardhatRuntimeEnvironment): Promise<void>;
3
+ //# sourceMappingURL=1_deploy-request-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1_deploy-request-storage.d.ts","sourceRoot":"","sources":["../../scripts/1_deploy-request-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAK1D,wBAA8B,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,yBAAyB,iBAuC9E"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const addressBurnerContract = '0xfCb4393e7fAef06fAb01c00d67c1895545AfF3b8';
5
+ // Deploys, set up the contracts
6
+ function deploy(_args, hre) {
7
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
8
+ try {
9
+ const [deployer, recipient] = yield hre.ethers.getSigners();
10
+ // Not used, only useful to keep the same addresses as with Truffle
11
+ const uselessInstance = yield (yield hre.ethers.getContractFactory('TestERC20')).deploy('100');
12
+ yield uselessInstance.transfer(recipient.address, 10);
13
+ // Deploy the contract RequestHashStorage
14
+ const RequestHashStorage__factory = yield hre.ethers.getContractFactory('RequestHashStorage', deployer);
15
+ const RequestHashStorage = yield RequestHashStorage__factory.deploy();
16
+ console.log('RequestHashStorage Contract deployed: ' + RequestHashStorage.address);
17
+ // Deploy the contract RequestOpenHashSubmitter
18
+ const RequestOpenHashSubmitter__factory = yield hre.ethers.getContractFactory('RequestOpenHashSubmitter', deployer);
19
+ const RequestOpenHashSubmitter = yield RequestOpenHashSubmitter__factory.deploy(RequestHashStorage.address, addressBurnerContract);
20
+ console.log('RequestOpenHashSubmitter Contract deployed: ' + RequestOpenHashSubmitter.address);
21
+ // Whitelist the requestSubmitter in requestHashDeclaration
22
+ yield RequestHashStorage.addWhitelisted(RequestOpenHashSubmitter.address);
23
+ console.log('requestSubmitter Whitelisted in requestHashDeclaration');
24
+ // ----------------------------------
25
+ console.log('Contracts deployed');
26
+ console.log(`
27
+ RequestHashStorage: ${RequestHashStorage.address}
28
+ RequestOpenHashSubmitter: ${RequestOpenHashSubmitter.address}
29
+ `);
30
+ }
31
+ catch (e) {
32
+ console.error(e);
33
+ }
34
+ });
35
+ }
36
+ exports.default = deploy;
37
+ //# sourceMappingURL=1_deploy-request-storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1_deploy-request-storage.js","sourceRoot":"","sources":["../../scripts/1_deploy-request-storage.ts"],"names":[],"mappings":";;;AAEA,MAAM,qBAAqB,GAAG,4CAA4C,CAAC;AAE3E,gCAAgC;AAChC,SAA8B,MAAM,CAAC,KAAU,EAAE,GAA8B;;QAC7E,IAAI;YACF,MAAM,CAAC,QAAQ,EAAE,SAAS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,CAAC,CAAC;SAClB;IACH,CAAC;CAAA;AAvCD,yBAuCC"}
@@ -0,0 +1,4 @@
1
+ import '@nomiclabs/hardhat-ethers';
2
+ import { HardhatRuntimeEnvironment } from 'hardhat/types';
3
+ export default function deploy(args: any, hre: HardhatRuntimeEnvironment): Promise<void>;
4
+ //# sourceMappingURL=2_deploy-main-payments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"2_deploy-main-payments.d.ts","sourceRoot":"","sources":["../../scripts/2_deploy-main-payments.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAK1D,wBAA8B,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,yBAAyB,iBAyG7E"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ require("@nomiclabs/hardhat-ethers");
5
+ const deploy_one_1 = require("../scripts/deploy-one");
6
+ // Deploys, set up the contracts
7
+ function deploy(args, hre) {
8
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
9
+ try {
10
+ const [deployer] = yield hre.ethers.getSigners();
11
+ console.log(`Deploying with the account: ${deployer.address} on the network ${hre.network.name} (${hre.network.config.chainId})`);
12
+ const erc20Factory = yield hre.ethers.getContractFactory('TestERC20');
13
+ // Deploy the ERC20 contract
14
+ const testERC20Instance = yield erc20Factory.deploy('1000000000000000000000000000000');
15
+ // Deploy ERC20 proxy contract
16
+ const instanceRequestERC20Proxy = yield (yield hre.ethers.getContractFactory('ERC20Proxy')).deploy();
17
+ console.log('ERC20Proxy Contract deployed: ' + instanceRequestERC20Proxy.address);
18
+ // create some events for test purpose
19
+ yield testERC20Instance.approve(instanceRequestERC20Proxy.address, 110);
20
+ yield instanceRequestERC20Proxy.transferFromWithReference(testERC20Instance.address, '0x6330A553Fc93768F612722BB8c2eC78aC90B3bbc', 100, '0x7157f6ce9085a520');
21
+ yield instanceRequestERC20Proxy.transferFromWithReference(testERC20Instance.address, '0x5AEDA56215b167893e80B4fE645BA6d5Bab767DE', 10, '0xdeea051f2e9120e0');
22
+ // Deploy ETH proxy contract
23
+ const { address: EthereumProxyAddress } = yield (0, deploy_one_1.deployOne)(args, hre, 'EthereumProxy');
24
+ console.log('EthereumProxy Contract deployed: ' + EthereumProxyAddress);
25
+ // Deploy ERC20 Fee proxy contract
26
+ const { address: ERC20FeeProxyAddress } = yield (0, deploy_one_1.deployOne)(args, hre, 'ERC20FeeProxy');
27
+ console.log('ERC20FeeProxy Contract deployed: ' + ERC20FeeProxyAddress);
28
+ // Deploy the BadERC20 contract
29
+ const { address: BadERC20Address } = yield (0, deploy_one_1.deployOne)(args, hre, 'BadERC20', {
30
+ constructorArguments: [1000, 'BadERC20', 'BAD', 8],
31
+ });
32
+ console.log('BadERC20 Contract deployed: ' + BadERC20Address);
33
+ // Deploy test ERC20 contracts
34
+ const { address: ERC20TrueAddress } = yield (0, deploy_one_1.deployOne)(args, hre, 'ERC20True');
35
+ console.log('ERC20True Contract deployed: ' + ERC20TrueAddress);
36
+ const { address: ERC20FalseAddress } = yield (0, deploy_one_1.deployOne)(args, hre, 'ERC20False');
37
+ console.log('ERC20False Contract deployed: ' + ERC20FalseAddress);
38
+ const { address: ERC20NoReturnAddress } = yield (0, deploy_one_1.deployOne)(args, hre, 'ERC20NoReturn');
39
+ console.log('ERC20NoReturn Contract deployed: ' + ERC20NoReturnAddress);
40
+ const ERC20Revert = yield (yield hre.ethers.getContractFactory('ERC20Revert', deployer)).deploy();
41
+ console.log('ERC20Revert Contract deployed: ' + ERC20Revert.address);
42
+ // Swap-to-pay related contracts
43
+ // Payment erc20: ALPHA
44
+ const erc20AlphaInstance = yield erc20Factory.deploy('1000000000000000000000000000000');
45
+ // Mock a swap router
46
+ const { address: FakeSwapRouterAddress } = yield (0, deploy_one_1.deployOne)(args, hre, 'FakeSwapRouter');
47
+ // 1 ERC20 = 2 ALPHA
48
+ yield erc20AlphaInstance.transfer(FakeSwapRouterAddress, '20000000000000000000000000000');
49
+ yield testERC20Instance.transfer(FakeSwapRouterAddress, '10000000000000000000000000000');
50
+ // SwapToPay
51
+ const { address: ERC20SwapToPayAddress } = yield (0, deploy_one_1.deployOne)(args, hre, 'ERC20SwapToPay', {
52
+ constructorArguments: [FakeSwapRouterAddress, ERC20FeeProxyAddress],
53
+ });
54
+ // FIXME SwapToPay deployed without approbation for router and proxy
55
+ console.log('SwapToPay Contract deployed: ' + ERC20SwapToPayAddress);
56
+ // FIXME useless transaction to keep the same contract addresses
57
+ yield testERC20Instance.transfer(deployer.address, '1');
58
+ // Deploy ETH fee proxy contract
59
+ const { address: EthereumFeeProxyAddress } = yield (0, deploy_one_1.deployOne)(args, hre, 'EthereumFeeProxy');
60
+ console.log('EthereumFeeProxy Contract deployed: ' + EthereumFeeProxyAddress);
61
+ // ----------------------------------
62
+ console.log('Contracts deployed');
63
+ console.log(`
64
+ TestERC20: ${testERC20Instance.address}
65
+ ERC20Proxy: ${instanceRequestERC20Proxy.address}
66
+ EthereumProxy: ${EthereumProxyAddress}
67
+ EthereumFeeProxy: ${EthereumFeeProxyAddress}
68
+ ERC20FeeProxy: ${ERC20FeeProxyAddress}
69
+ BadERC20: ${BadERC20Address}
70
+ ERC20True: ${ERC20TrueAddress}
71
+ ERC20False: ${ERC20FalseAddress}
72
+ ERC20NoReturn: ${ERC20NoReturnAddress}
73
+ ERC20Revert: ${ERC20Revert.address}
74
+ ERC20Alpha: ${erc20AlphaInstance.address}
75
+ FakeSwapRouter: ${FakeSwapRouterAddress}
76
+ SwapToPay: ${ERC20SwapToPayAddress}
77
+ `);
78
+ }
79
+ catch (e) {
80
+ console.error(e);
81
+ }
82
+ });
83
+ }
84
+ exports.default = deploy;
85
+ //# sourceMappingURL=2_deploy-main-payments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"2_deploy-main-payments.js","sourceRoot":"","sources":["../../scrip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AAO;kCACjC,oBAAoB;kCACpB,uBAAuB;kCACvB,oBAAoB;kCACpB,eAAe;kCACf,gBAAgB;kCAChB,iBAAiB;kCACjB,oBAAoB;kCACpB,WAAW,CAAC,OAAO;kCACnB,kBAAkB,CAAC,OAAO;kCAC1B,qBAAqB;kCACrB,qBAAqB;OAChD,CAAC,CAAC;SACN;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClB;IACH,CAAC;CAAA;AAzGD,yBAyGC"}
@@ -0,0 +1,4 @@
1
+ import '@nomiclabs/hardhat-ethers';
2
+ import { HardhatRuntimeEnvironment } from 'hardhat/types';
3
+ export default function deploy(args: any, hre: HardhatRuntimeEnvironment): Promise<void>;
4
+ //# sourceMappingURL=3_deploy_chainlink_contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3_deploy_chainlink_contract.d.ts","sourceRoot":"","sources":["../../scripts/3_deploy_chainlink_contract.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAK1D,wBAA8B,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,yBAAyB,iBAkG7E"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ require("@nomiclabs/hardhat-ethers");
5
+ const currency_1 = require("@requestnetwork/currency");
6
+ const conversion_proxy_1 = require("./conversion-proxy");
7
+ const erc20_swap_to_conversion_1 = require("./erc20-swap-to-conversion");
8
+ const deploy_one_1 = require("./deploy-one");
9
+ function deploy(args, hre) {
10
+ var _a, _b, _c;
11
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
12
+ const [deployer] = yield hre.ethers.getSigners();
13
+ const { address: AggDAI_USD_address } = yield (0, deploy_one_1.deployOne)(args, hre, 'AggregatorMock', {
14
+ constructorArguments: [101000000, 8, 60],
15
+ });
16
+ const { address: AggETH_USD_address } = yield (0, deploy_one_1.deployOne)(args, hre, 'AggregatorMock', {
17
+ constructorArguments: [50000000000, 8, 60],
18
+ });
19
+ const { address: AggEUR_USD_address } = yield (0, deploy_one_1.deployOne)(args, hre, 'AggregatorMock', {
20
+ constructorArguments: [120000000, 8, 60],
21
+ });
22
+ const { address: AggUSDT_ETH_address } = yield (0, deploy_one_1.deployOne)(args, hre, 'AggregatorMock', {
23
+ constructorArguments: [2000000000000000, 18, 60],
24
+ });
25
+ const { address: USDT_fake_address } = yield (0, deploy_one_1.deployOne)(args, hre, 'UsdtFake');
26
+ const currencyManager = currency_1.CurrencyManager.getDefault();
27
+ // all these addresses are for test purposes
28
+ const ETH_hash = currencyManager.fromSymbol('ETH').hash;
29
+ const USD_hash = currencyManager.fromSymbol('USD').hash;
30
+ const EUR_hash = currencyManager.fromSymbol('EUR').hash;
31
+ // Cf. ERC20Alpha in TestERC20.sol
32
+ // FIXME: should try to retrieve information from artifacts instead
33
+ const DAI_address = '0x38cF23C52Bb4B13F051Aec09580a2dE845a7FA35';
34
+ const USDT_address = USDT_fake_address;
35
+ console.log(`USDT address: ${USDT_address}`);
36
+ const conversionPathInstance = yield (yield hre.ethers.getContractFactory('ChainlinkConversionPath', deployer)).deploy();
37
+ // all these aggregators are for test purposes
38
+ yield conversionPathInstance.updateAggregatorsList([DAI_address, EUR_hash, ETH_hash, USDT_address], [USD_hash, USD_hash, USD_hash, ETH_hash], [AggDAI_USD_address, AggEUR_USD_address, AggETH_USD_address, AggUSDT_ETH_address]);
39
+ console.log('AggregatorsList updated.');
40
+ // erc20SwapConversion
41
+ const erc20ConversionAddress = (_a = (yield (0, conversion_proxy_1.deployERC20ConversionProxy)(Object.assign(Object.assign({}, args), { chainlinkConversionPathAddress: conversionPathInstance.address, erc20FeeProxyAddress: '0x75c35C980C0d37ef46DF04d31A140b65503c0eEd' }), hre))) === null || _a === void 0 ? void 0 : _a.address;
42
+ const localSwapRouterAddress = '0x4E72770760c011647D4873f60A3CF6cDeA896CD8';
43
+ const { address: erc20SwapConversionAddress, instance: erc20SwapConversion, } = yield (0, erc20_swap_to_conversion_1.deploySwapConversion)(Object.assign(Object.assign({}, args), { conversionProxyAddress: erc20ConversionAddress, swapProxyAddress: localSwapRouterAddress }), hre);
44
+ if (!erc20SwapConversion) {
45
+ console.error('Deployment for erc20SwapConversion failed.');
46
+ return;
47
+ }
48
+ yield erc20SwapConversion.approvePaymentProxyToSpend(
49
+ // FIXME: should try to retrieve information from artifacts instead
50
+ '0x38cF23C52Bb4B13F051Aec09580a2dE845a7FA35');
51
+ // FIXME: should try to retrieve information from artifacts instead
52
+ yield erc20SwapConversion.approveRouterToSpend('0x9FBDa871d559710256a2502A2517b794B482Db40');
53
+ // EthConversion
54
+ const ethConversionProxyAddress = (_c = (_b = (yield (0, conversion_proxy_1.deployETHConversionProxy)(Object.assign(Object.assign({}, args), { chainlinkConversionPathAddress: conversionPathInstance.address, ethFeeProxyAddress: '0x3d49d1eF2adE060a33c6E6Aa213513A7EE9a6241', nativeTokenHash: ETH_hash }), hre))) === null || _b === void 0 ? void 0 : _b.address) !== null && _c !== void 0 ? _c : '(missing)';
55
+ // ----------------------------------
56
+ console.log('Contracts deployed');
57
+ console.log(`
58
+ (fake) USDT: ${USDT_address}
59
+ AggDAI_USD: ${AggDAI_USD_address}
60
+ ChainlinkConversionPath: ${conversionPathInstance.address}
61
+ Erc20ConversionProxy: ${erc20ConversionAddress}
62
+ Erc20SwapConversionProxy: ${erc20SwapConversionAddress}
63
+ EthConversionProxy: ${ethConversionProxyAddress}
64
+ `);
65
+ });
66
+ }
67
+ exports.default = deploy;
68
+ //# sourceMappingURL=3_deploy_chainlink_contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3_deploy_chainlink_contract.js","sourceRoot":"","sources":["../../scripts/3_deploy_chainlink_contract.ts"],"names":[],"mappings":";;;AAAA,qCAAmC;AACnC,uDAA2D;AAE3D,yD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B,EAAE;YACxB,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;YAC5D,OAAO;SACR;QACD,MAAM,mBAAmB,CAAC,0BAA0B;QAClD,mEAAmE;QACnE,4CAA4C,CAC7C,CAAC;QACF,mEAAmE;QACnE,MAAM,mBAAmB,CAAC,oBAAoB,CAAC,4CAA4C,CAAC,CAAC;QAE7F,gBAAgB;QAChB,MAAM,yBAAyB,GAC7B,MAAA,MAAA,CACE,MAAM,IAAA,2CAAwB,kCAEvB,IAAI,KACP,8BAA8B,EAAE,sBAAsB,CAAC,OAAO,EAC9D,kBAAkB,EAAE,4CAA4C,EAChE,eAAe,EAAE,QAAQ,KAE3B,GAAG,CACJ,CACF,0CAAE,OAAO,mCAAI,WAAW,CAAC;QAC5B,qCAAqC;QACrC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC;gCACkB,YAAY;gCACZ,kBAAkB;gCAClB,sBAAsB,CAAC,OAAO;gCAC9B,sBAAsB;gCACtB,0BAA0B;gCAC1B,yBAAyB;KACpD,CAAC,CAAC;;CACN;AAlGD,yBAkGC"}
@@ -0,0 +1,4 @@
1
+ import '@nomiclabs/hardhat-ethers';
2
+ import { HardhatRuntimeEnvironment } from 'hardhat/types';
3
+ export declare function deployEscrow(hre: HardhatRuntimeEnvironment): Promise<void>;
4
+ //# sourceMappingURL=4_deploy-escrow-deployment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"4_deploy-escrow-deployment.d.ts","sourceRoot":"","sources":["../../scripts/4_deploy-escrow-deployment.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAEnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAK1D,wBAAsB,YAAY,CAAC,GAAG,EAAE,yBAAyB,iBA0BhE"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deployEscrow = void 0;
4
+ const tslib_1 = require("tslib");
5
+ require("@nomiclabs/hardhat-ethers");
6
+ // Deploys, set up the contracts
7
+ function deployEscrow(hre) {
8
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
9
+ const erc20FeeProxyAddress = "0x75c35C980C0d37ef46DF04d31A140b65503c0eEd";
10
+ let deployer;
11
+ let erc20EscrowToPayAddress;
12
+ try {
13
+ [deployer] = yield hre.ethers.getSigners();
14
+ const erc20EscrowToPay = yield (yield hre.ethers.getContractFactory('ERC20EscrowToPay', deployer)).deploy(erc20FeeProxyAddress);
15
+ // Deploy Escrow contract
16
+ erc20EscrowToPayAddress = erc20EscrowToPay.address;
17
+ console.log(`ERC20EscrowToPay Contract deployed: ${erc20EscrowToPayAddress}`);
18
+ // ----------------------------------
19
+ console.log(`
20
+ Contracts deployed'
21
+ ERC20EscrowToPay ${erc20EscrowToPayAddress}
22
+ `);
23
+ }
24
+ catch (e) {
25
+ console.error(e);
26
+ }
27
+ });
28
+ }
29
+ exports.deployEscrow = deployEscrow;
30
+ //# sourceMappingURL=4_deploy-escrow-deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"4_deploy-escrow-deployment.js","sourceRoot":"","sources":["../../scripts/4_deploy-escrow-deployment.ts"],"names":[],"mappings":";;;;AAAA,qCAAmC;AAMnC,gCAAgC;AAChC,SAAsB,YAAY,CAAC,GAA8B;;QAC/D,MAAM,oBAAoB,GAAG,4CAA4C,CAAC;QAC1E,IAAI,QAAgB,CAAC;QACrB,IAAI,uBAA+B,CAAC;QACpC,IAAI;YACF,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YAE3C,MAAM,gBAAgB,GAAG,MAAM,CAC7B,MAAM,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAClE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;YAC/B,0BAA0B;YAG1B,uBAAuB,GAAG,gBAAgB,CAAC,OAAO,CAAC;YAEnD,OAAO,CAAC,GAAG,CAAC,wCAAwC,uBAAuB,EAAE,CAAC,CAAC;YAE/E,qCAAqC;YACrC,OAAO,CAAC,GAAG,CAAC;;oCAEoB,uBAAuB;KACtD,CAAC,CAAC;SAEJ;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAClB;IACH,CAAC;CAAA;AA1BD,oCA0BC"}
@@ -0,0 +1,11 @@
1
+ import { HardhatRuntimeEnvironment } from 'hardhat/types';
2
+ import { DeploymentResult } from './deploy-one';
3
+ export declare function deployERC20ConversionProxy(args: {
4
+ chainlinkConversionPathAddress?: string;
5
+ erc20FeeProxyAddress?: string;
6
+ }, hre: HardhatRuntimeEnvironment): Promise<DeploymentResult | undefined>;
7
+ export declare function deployETHConversionProxy(args: {
8
+ chainlinkConversionPathAddress?: string;
9
+ ethFeeProxyAddress?: string;
10
+ }, hre: HardhatRuntimeEnvironment): Promise<DeploymentResult<import("ethers").Contract> | undefined>;
11
+ //# sourceMappingURL=conversion-proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversion-proxy.d.ts","sourceRoot":"","sources":["../../scripts/conversion-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAK1D,OAAO,EAAE,gBAAgB,EAAa,MAAM,cAAc,CAAC;AAI3D,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE;IAAE,8BAA8B,CAAC,EAAE,MAAM,CAAC;IAAC,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAAE,EAChF,GAAG,EAAE,yBAAyB,GAC7B,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAoBvC;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE;IACJ,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,EACD,GAAG,EAAE,yBAAyB,oEAsC/B"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deployETHConversionProxy = exports.deployERC20ConversionProxy = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const lib_1 = require("../src/lib");
6
+ const deploy_one_1 = require("./deploy-one");
7
+ const currency_1 = require("@requestnetwork/currency");
8
+ const types_1 = require("@requestnetwork/types");
9
+ function deployERC20ConversionProxy(args, hre) {
10
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
11
+ const contractName = 'Erc20ConversionProxy';
12
+ if (!args.chainlinkConversionPathAddress) {
13
+ // FIXME: should try to retrieve information from artifacts instead
14
+ console.error(`Missing ChainlinkConversionPath on ${hre.network.name}, cannot deploy ${contractName}.`);
15
+ return undefined;
16
+ }
17
+ if (!args.erc20FeeProxyAddress) {
18
+ // FIXME: should try to retrieve information from artifacts instead
19
+ console.error(`Missing ERC20FeeProxy on ${hre.network.name}, cannot deploy ${contractName}.`);
20
+ return undefined;
21
+ }
22
+ return (0, deploy_one_1.deployOne)(args, hre, contractName, {
23
+ constructorArguments: [args.erc20FeeProxyAddress, args.chainlinkConversionPathAddress],
24
+ artifact: lib_1.erc20ConversionProxy,
25
+ });
26
+ });
27
+ }
28
+ exports.deployERC20ConversionProxy = deployERC20ConversionProxy;
29
+ function deployETHConversionProxy(args, hre) {
30
+ var _a;
31
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
32
+ const contractName = 'EthConversionProxy';
33
+ if (!args.chainlinkConversionPathAddress) {
34
+ // FIXME: should try to retrieve information from artifacts instead
35
+ console.error(`Missing ChainlinkConversionPath on ${hre.network.name}, cannot deploy ${contractName}.`);
36
+ return;
37
+ }
38
+ if (!args.ethFeeProxyAddress) {
39
+ // FIXME: should try to retrieve information from artifacts instead
40
+ console.error(`Missing ETHFeeProxy on ${hre.network.name}, cannot deploy ${contractName}.`);
41
+ return;
42
+ }
43
+ // The private native token hash is the same as on mainnet
44
+ const nativeTokenNetwork = hre.network.name === 'private' ? 'mainnet' : hre.network.name;
45
+ const nativeTokenHash = (_a = currency_1.CurrencyManager.getDefault().getNativeCurrency(types_1.RequestLogicTypes.CURRENCY.ETH, nativeTokenNetwork)) === null || _a === void 0 ? void 0 : _a.hash;
46
+ if (!nativeTokenHash) {
47
+ console.error(`Cannot guess native token hash on ${hre.network.name}, cannot deploy ${contractName}.`);
48
+ return;
49
+ }
50
+ return (0, deploy_one_1.deployOne)(args, hre, contractName, {
51
+ constructorArguments: [
52
+ args.ethFeeProxyAddress,
53
+ args.chainlinkConversionPathAddress,
54
+ nativeTokenHash,
55
+ ],
56
+ artifact: lib_1.ethConversionArtifact,
57
+ });
58
+ });
59
+ }
60
+ exports.deployETHConversionProxy = deployETHConversionProxy;
61
+ //# sourceMappingURL=conversion-proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversion-proxy.js","sourceRoot":"","sources":["../../scripts/conversion-proxy.ts"],"names":[],"mappings":";;;;AACA,oCAGoB;AACpB,6CAA2D;AAC3D,uDAA2D;AAC3D,iDAA0D;AAE1D,SAAsB,0BAA0B,CAC9C,IAAgF,EAChF,GAA8B;;QAE9B,MAAM,YAAY,GAAG,sBAAsB,CAAC;QAE5C,IAAI,CAAC,IAAI,CAAC,8BAA8B,EAAE;YACxC,mEAAmE;YACnE,OAAO,CAAC,KAAK,CACX,sCAAsC,GAAG,CAAC,OAAO,CAAC,IAAI,mBAAmB,YAAY,GAAG,CACzF,CAAC;YACF,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC9B,mEAAmE;YACnE,OAAO,CAAC,KAAK,CAAC,4BAA4B,GAAG,CAAC,OAAO,CAAC,IAAI,mBAAmB,YAAY,GAAG,CAAC,CAAC;YAC9F,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,IAAA,sBAAS,EAAC,IAAI,EAAE,GAAG,EAAE,YA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AAQ,EAAE,2BAAqB;SAChC,CAAC,CAAC;;CACJ;AA3CD,4DA2CC"}
@@ -0,0 +1,30 @@
1
+ import '@nomiclabs/hardhat-ethers';
2
+ import { HardhatRuntimeEnvironment } from 'hardhat/types';
3
+ import { Contract } from 'ethers';
4
+ import { ContractArtifact } from '../src/lib';
5
+ export interface DeploymentResult<TContract extends Contract | unknown = Contract> {
6
+ address: string;
7
+ contractName: string;
8
+ instance: TContract;
9
+ constructorArguments: any[];
10
+ type: 'simulated' | 'deployed' | 'attached' | 'skipped';
11
+ verificationPromise?: Promise<boolean>;
12
+ }
13
+ /**
14
+ * Deploys contracts if they are not known by artifacts on the network.
15
+ * Publishes the source when the deployment is made.
16
+ * @options
17
+ * - options.verify: set false to prevent verification on live networks
18
+ * - options.nonceCondition: only proceeds with the deployment if the nonce matches
19
+ * @returns a deployment result with address =
20
+ * - The address if the contract is deployed or attached
21
+ * - 'simulated' if args.simulate === true (no deployment/)
22
+ * - 'skipped' if the nonce condition is not met
23
+ */
24
+ export declare function deployOne<TContract extends Contract>(args: any, hre: HardhatRuntimeEnvironment, contractName: string, options?: {
25
+ constructorArguments?: any[];
26
+ artifact?: ContractArtifact<Contract>;
27
+ verify?: boolean;
28
+ nonceCondition?: number;
29
+ }): Promise<DeploymentResult<TContract>>;
30
+ //# sourceMappingURL=deploy-one.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-one.d.ts","sourceRoot":"","sources":["../../scripts/deploy-one.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,gBAAgB,CAAC,SAAS,SAAS,QAAQ,GAAG,OAAO,GAAG,QAAQ;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,oBAAoB,EAAE,GAAG,EAAE,CAAC;IAC5B,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IACxD,mBAAmB,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CACxC;AAkBD;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAAC,SAAS,SAAS,QAAQ,EACxD,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,yBAAyB,EAC9B,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE;IACR,oBAAoB,CAAC,EAAE,GAAG,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACA,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAwFtC"}