-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path20240101010102_insert_val.sql
More file actions
86 lines (82 loc) · 1.94 KB
/
20240101010102_insert_val.sql
File metadata and controls
86 lines (82 loc) · 1.94 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
INSERT INTO
networks (id, chain_id)
VALUES
('ethereum', 1);
-- The protocol (i.e aave_v3)
INSERT INTO
protocols (id, name, kind)
VALUES
('aave_v3', 'Aave V3', 'lending');
-------------- ethereum --------------
WITH
inserted_protocol AS (
INSERT INTO
protocols_details (
protocol_id,
network_id,
deployed_block,
deployed_at
)
VALUES
('aave_v3', 'ethereum', 16291127, '2023-01-27') RETURNING id
)
INSERT INTO
protocols_contracts (protocol_details_id, name, address)
SELECT
id,
name,
address
FROM
inserted_protocol,
(
VALUES
(
'Pool',
'0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2'
),
(
'PoolAddressesProvider',
'0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e'
),
(
'UiPoolDataProviderV3',
'0x3F78BBD206e4D3c504Eb854232EdA7e47E9Fd8FC'
)
) AS contracts (name, address);
--- uniswap
INSERT INTO
protocols (id, name, kind)
VALUES
('uniswap_v3', 'Uniswap V3', 'dex');
-------------- ethereum --------------
WITH
inserted_protocol AS (
INSERT INTO
protocols_details (
protocol_id,
network_id,
deployed_block,
deployed_at
)
VALUES
('uniswap_v3', 'ethereum', null, null) RETURNING id
)
INSERT INTO
protocols_contracts (protocol_details_id, name, address)
SELECT
id,
name,
address
FROM
inserted_protocol,
(
VALUES
(
'UniswapV3Factory',
'0x1F98431c8aD98523631AE4a59f267346ea31F984'
),
(
'QuoterV2',
'0x61fFE014bA17989E743c5F6cB21bF9697530B21e'
)
) AS contracts (name, address);