mirror of
https://github.com/alexgo-io/peggedassets-server.git
synced 2026-01-12 16:53:14 +08:00
change AWS account
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) =>
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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)]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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: (
|
||||
|
||||
Reference in New Issue
Block a user