This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 264
/
swayswap.config.ts
67 lines (62 loc) · 1.77 KB
/
swayswap.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import dotenv from 'dotenv';
import { createConfig, replaceEventOnEnv } from 'swayswap-scripts';
const { NODE_ENV, OUTPUT_ENV } = process.env;
function getEnvName() {
return NODE_ENV === 'test' ? '.env.test' : '.env';
}
dotenv.config({
path: `./docker/${getEnvName()}`,
});
const getDeployOptions = () => ({
gasPrice: Number(process.env.GAS_PRICE || 0),
});
export default createConfig({
types: {
artifacts: './packages/contracts/**/out/debug/**-abi.json',
output: './packages/app/src/types/contracts',
},
contracts: [
{
name: 'VITE_TOKEN_ID1',
path: './packages/contracts/token_contract',
options: () => {
return {
...getDeployOptions(),
};
},
},
{
name: 'VITE_TOKEN_ID2',
path: './packages/contracts/token_contract',
options: () => {
return {
...getDeployOptions(),
};
},
},
{
name: 'VITE_CONTRACT_ID',
path: './packages/contracts/exchange_contract',
options: (contracts) => {
const deployedTokenContract1 = contracts.find((c) => c.name === 'VITE_TOKEN_ID1')!;
const deployedTokenContract2 = contracts.find((c) => c.name === 'VITE_TOKEN_ID2')!;
return {
...getDeployOptions(),
storageSlots: [
{
key: '0x0000000000000000000000000000000000000000000000000000000000000001',
value: deployedTokenContract1.contractId,
},
{
key: '0x0000000000000000000000000000000000000000000000000000000000000002',
value: deployedTokenContract2.contractId,
},
],
};
},
},
],
onSuccess: (event) => {
replaceEventOnEnv(`./packages/app/${OUTPUT_ENV || getEnvName()}`, event);
},
});