This repository has been archived by the owner on Mar 17, 2023. It is now read-only.
forked from yearn-integrations/yearn-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
312 lines (295 loc) · 10.4 KB
/
serverless.yml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
service: yearn
plugins:
- serverless-offline
- serverless-domain-manager
- serverless-export-swagger
- serverless-aws-documentation
custom:
defaultStage: dev
currentStage: ${opt:stage, self:custom.defaultStage}
customDomain: ${file(./config/serverless/domain.js):${self:custom.currentStage}}
serverless-offline:
useChildProcesses: true
basePath: ""
swaggerDestinations:
s3BucketName: "yearn.tools"
s3KeyName: "swagger/swagger.json"
acl: public-read
documentation:
api:
info:
version: "1.02"
title: Yearn API
description: Yearn API
tags:
- name: Vaults
description: Vault endpoints
- name: User
description: User endpoints (these APIs are specific to a user account)
- name: Loanscan
description: Loanscan endpoints (not for general consumption)
provider:
name: aws
runtime: nodejs12.x
profile: ${file(./awsProfile.yml):aws_profile}
functions:
# /vaults
vaults:
handler: services/vaults/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /vaults
method: get
cors: true
request:
parameters:
querystrings:
apy: false
documentation:
summary: Gets all vaults from the vault registry
tags:
- Vaults
description: Vaults are pulled from the vault registry (https://etherscan.io/address/0x3ee41c098f9666ed2ea246f4d2558010e59d63a0). Includes controller/strategy info. Updates once an hour.
queryParams:
- name: "apy"
description: "Include vault APY"
type: "boolean"
required: false
vaults-snapshots:
handler: services/vaults/snapshots/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /vaults/snapshots
method: get
cors: true
documentation:
summary: Gets current snapshots of all vaults from the Yearn subgraph
tags:
- Vaults
description: >
Currently the subgraph is indexing 8 out of 11 vaults. More vaults to be added later.
vaults-addresses:
handler: services/vaults/addresses/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /vaults/addresses
method: get
cors: true
documentation:
summary: Gets all vault addresses from the vault registry
tags:
- Vaults
description: >
Vault addresses are pulled from the vault registry (https://etherscan.io/address/0x3ee41c098f9666ed2ea246f4d2558010e59d63a0). Updates once an hour.
vaults-save:
handler: services/vaults/save/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
vaults-apy:
handler: services/vaults/apy/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /vaults/apy
method: get
cors: true
documentation:
summary: Gets APY for all vaults
tags:
- Vaults
description: >
Vault APY is calculated based on the following document: https://hackmd.io/BQChrnqRQ3-HHx-0oZZZug?view
vaults-apy-save:
handler: services/vaults/apy/save/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
events:
- http:
path: /vaults/apy/save
method: get
# /user
user-vaults:
handler: services/user/vaults/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /user/{userAddress}/vaults
method: get
cors: true
request:
parameters:
paths:
userAddress: true
querystrings:
apy: false
statistics: false
transactions: false
showall: false
documentation:
summary: Gets all vaults a user has interacted with
tags:
- User
description: >
Optionally include vault statistics and transactions per user. Valid query param values are "true" and "false"
pathParams:
- name: "userAddress"
description: "User account address. Format: 0x{...}"
queryParams:
- name: "apy"
description: "Include vault APY"
type: "boolean"
required: false
- name: "transactions"
description: "Include user vault transactions"
type: "boolean"
required: false
- name: "showall"
description: "Inclue all vaults (including vaults the user has not interacted with)"
type: "boolean"
required: false
- name: "statistics"
description: "Include user vault statistics (deposits, withdraws, transfers)"
type: "boolean"
required: false
user-vaults-transactions:
handler: services/user/vaults/transactions/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /user/{userAddress}/vaults/transactions
method: get
cors: true
request:
parameters:
paths:
userAddress: true
documentation:
summary: Gets all user transactions per vault (deposits, withdraws, transferIn, transferOut)
tags:
- User
description: >
Includes amount/shares, calculated by tracing the Yearn vault contract methods. Transactions come from the Yearn subgraph.
pathParams:
- name: "userAddress"
description: "User account address. Format: 0x{...}"
user-vaults-statistics:
handler: services/user/vaults/statistics/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /user/{userAddress}/vaults/statistics
method: get
cors: true
request:
parameters:
paths:
userAddress: true
documentation:
summary: Gets vault statistics assocaited with a user. Total earnings, deposits, withdrawals, transfers.
tags:
- User
description: >
Currently earnings include token transfer events (such as zaps). This should be configurable in the future. Statistics come from the Yearn subgraph.
pathParams:
- name: "userAddress"
description: "User account address. Format: 0x{...}"
user-vaults-earnings:
handler: services/user/vault/earnings/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /user/{userAddress}/vaults/earnings
method: get
cors: true
request:
parameters:
paths:
userAddress: true
pathParams:
- name: "userAddress"
description: "User account address. Format: 0x{...}"
# /loanscan
loanscan-link:
handler: services/loanscan/link/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /loanscan/link
method: get
cors: true
documentation:
summary: Gets LINK vault APY
tags:
- Loanscan
description: >
LINK APY actually comes from the aLINK vault. aLINK vault cannot be relied on directly due to use of insurance
loanscan-eth-stable:
handler: services/loanscan/eth-stable/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /loanscan/ethstable
method: get
cors: true
documentation:
summary: Gets stablecoin vault APYs and ETH vault APY
tags:
- Loanscan
description: >
APY for following vaults: ETH, USDC, USDT, TUSD, DAI
loanscan-ycrv:
handler: services/loanscan/ycrv/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /loanscan/ycrv
method: get
cors: true
documentation:
summary: Gets yCrv vault APY aggregated with Curve pool APY
tags:
- Loanscan
description: >
yCrv APY is an aggregate APY. This API combines vault APY with underlying Curve pool APY. Aggregation formula: ((1 + poolApy) * (1 + vaultApy) - 1) * 100;
loanscan-crvbtc:
handler: services/loanscan/crvbtc/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /loanscan/crvbtc
method: get
cors: true
documentation:
summary: Gets crvBTC vault APY aggregated with Curve pool APY
tags:
- Loanscan
description: >
crvBTC APY is an aggregate APY. This API combines vault APY with underlying Curve pool APY. Aggregation formula: ((1 + poolApy) * (1 + vaultApy) - 1) * 100;
loanscan-crvbusd:
handler: services/loanscan/crvbusd/handler.handler
role: arn:aws:iam::698083237070:role/service-role/fetchTokenIds-role-o9i24lq2
timeout: 30
events:
- http:
path: /loanscan/crvbusd
method: get
cors: true
documentation:
summary: Gets crvBUSD vault APY aggregated with Curve pool APY
tags:
- Loanscan
description: >
crvBUSD APY is an aggregate APY. This API combines vault APY with underlying Curve pool APY. Aggregation formula: ((1 + poolApy) * (1 + vaultApy) - 1) * 100;