change AWS account

This commit is contained in:
Cocoahomology
2022-06-30 04:32:37 -04:00
parent 76d785c8b6
commit d2cdf8afb3
11 changed files with 18 additions and 37 deletions

View File

@@ -15,8 +15,8 @@
"pretest": "npm run prebuild",
"build": "sls package",
"updateAdapters": "cd DefiLlama-Adapters && git pull",
"fillOld": "set AWS_REGION='us-east-1' && set tableName='prod-table' && npx ts-node src/cli/fillOld.ts",
"fillLast": "export AWS_REGION='eu-central-1' && export tableName='prod-table' && npx ts-node src/cli/fillLast.ts"
"fillOld": "set AWS_REGION='eu-central-1' && set tableName='prod-stablecoins-table' && npx ts-node src/cli/fillOld.ts",
"fillLast": "export AWS_REGION='eu-central-1' && export tableName='prod-stablecoins-table' && npx ts-node src/cli/fillLast.ts"
},
"devDependencies": {
"@babel/core": "^7.13.10",

View File

@@ -1,4 +1,4 @@
service: cocoahomology
service: llama-stablecoins
package:
individually: true
@@ -8,7 +8,7 @@ provider:
name: aws
runtime: nodejs14.x
memorySize: 130
region: us-east-1
region: eu-central-1
endpointType: REGIONAL # Set to regional because the api gateway will be behind a cloudfront distribution
stage: dev # Default to dev if no stage is specified
tracing: # Enable X-Ray tracing (debugging)
@@ -70,7 +70,7 @@ custom:
prune:
automatic: true
number: 5 # Number of versions to keep
tableName: prod-table
tableName: prod-stablecoins-table
functions:
fallback:
@@ -130,11 +130,13 @@ functions:
handler: src/triggerStorePegged.default
timeout: 900
events:
- schedule: cron(0 * * * ? *)
- schedule: cron(20 * * * ? *)
storePeggedPrices:
handler: src/storePeggedPrices.default
timeout: 900
memorySize: 1024
events:
- schedule: cron(*/30 * * * ? *)
fetchCoingeckoData:
handler: src/fetchCoingeckoData.default
timeout: 900
@@ -180,27 +182,6 @@ resources:
ResponseType: DEFAULT_5XX
RestApiId:
Ref: 'ApiGatewayRestApi'
# required to enable request path parameter caching in API Gateway
ApiGatewayMethodPeggedchartsChainVarGet:
Properties:
RequestParameters:
method.request.path.chain : false
Integration:
RequestParameters:
integration.request.path.chain: method.request.path.chain
CacheNamespace: ApiGatewayMethodChainVarGetCacheNS
CacheKeyParameters:
- method.request.path.chain
ApiGatewayMethodPeggedPeggedVarGet:
Properties:
RequestParameters:
method.request.path.pegged : false
Integration:
RequestParameters:
integration.request.path.pegged: method.request.path.pegged
CacheNamespace: ApiGatewayMethodPeggedPeggedVarGetCacheNS
CacheKeyParameters:
- method.request.path.pegged
plugins:
- serverless-esbuild

View File

@@ -10,7 +10,7 @@ export const hourlyPrefix = "hourlyTvl";
export const dailyPrefix = "dailyTvl";
export const dynamoPrefix = dailyPrefix;
export const TableName = "prod-table";
export const TableName = "prod-stablecoins-table";
export const maxProtocolId = 300;
export const getDailyTxs = (protocolId: string) =>

View File

@@ -94,7 +94,7 @@ const handler = async (event: any, context: AWSLambda.Context) => {
return;
} else {
await sleep(Math.max(context.getRemainingTimeInMillis() - 10e3, 0)); // Wait until there's 10 seconds left
await invokeLambda(`cocoahomology-dev-fetchCoingeckoData`, {
await invokeLambda(`llama-stablecoins-dev-fetchCoingeckoData`, {
coins: rejected,
depth: depth + 1,
});

View File

@@ -37,7 +37,7 @@ export async function craftProtocolResponse(
) {
let prices = {} as any;
prices = await fetch(
"https://cocoahomology-datasets.s3.amazonaws.com/peggedPrices.json"
"https://llama-stablecoins-data.s3.eu-central-1.amazonaws.com/peggedPrices.json"
)
.then((res: any) => res.json())
.catch(() => {

View File

@@ -14,7 +14,7 @@ export async function craftPeggedChainsResponse() {
const chainMcap = {} as { [chain: string]: number };
let prices = {} as any;
prices = await fetch(
"https://cocoahomology-datasets.s3.amazonaws.com/peggedPrices.json"
"https://llama-stablecoins-data.s3.eu-central-1.amazonaws.com/peggedPrices.json"
)
.then((res: any) => res.json())
.catch(() => {

View File

@@ -53,7 +53,7 @@ export async function craftProtocolsResponse(
let prices = {} as any;
if (getPrices) {
prices = await fetch(
"https://cocoahomology-datasets.s3.amazonaws.com/peggedPrices.json"
"https://llama-stablecoins-data.s3.eu-central-1.amazonaws.com/peggedPrices.json"
)
.then((res: any) => res.json())
.catch(() => {

View File

@@ -12,7 +12,7 @@ const handler = async () => {
coins: coins.slice(i, i + step),
depth: 0,
};
await invokeLambda(`cocoahomology-dev-fetchCoingeckoData`, event);
await invokeLambda(`llama-stablecoins-dev-fetchCoingeckoData`, event);
}
};

View File

@@ -21,7 +21,7 @@ const handler = async () => {
const event = {
peggedIndexes: peggedIndexes.slice(i, i + step),
};
await Promise.all([invokeLambda(`cocoahomology-dev-storePeggedAssets`, event), timeout(10000)]);
await Promise.all([invokeLambda(`llama-stablecoins-dev-storePeggedAssets`, event), timeout(10000)]);
}
};

View File

@@ -1,7 +1,7 @@
import aws from "aws-sdk";
import type { Readable } from "stream";
const datasetBucket = "cocoahomology-datasets";
const datasetBucket = "llama-stablecoins-data";
function next21Minutedate() {
const dt = new Date();

View File

@@ -2,9 +2,9 @@ import AWS from "aws-sdk";
import sleep from "./sleep";
const client = new AWS.DynamoDB.DocumentClient({
region: "us-east-1",
region: "eu-central-1",
});
export const TableName = "prod-table";
export const TableName = "prod-stablecoins-table";
const dynamodb = {
get: (