Skip to content

Commit

Permalink
[ECO-2776] Revive all stacks to v5 binaries (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
alnoki authored Feb 5, 2025
1 parent fb1ce4e commit f2db7f1
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 70 deletions.
30 changes: 15 additions & 15 deletions src/cloud-formation/deploy-indexer-fallback.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
---
parameters:
BrokerCpu: 1024
BrokerImageVersion: '4.0.2'
BrokerImageVersion: '5.0.0'
BrokerMemory: 2048
DbMaxCapacity: 8
DeployAlb: 'false'
DeployAlbDnsRecord: 'false'
DeployBastionHost: 'false'
DeployBroker: 'false'
DeployContainers: 'false'
DeployDb: 'false'
DeployNlb: 'false'
DeployNlbVpcLink: 'false'
DeployPostgrest: 'false'
DeployProcessor: 'false'
DeployRestApi: 'false'
DeployRestApiDnsRecord: 'false'
DeployStack: 'false'
DeployAlb: 'true'
DeployAlbDnsRecord: 'true'
DeployBastionHost: 'true'
DeployBroker: 'true'
DeployContainers: 'true'
DeployDb: 'true'
DeployNlb: 'true'
DeployNlbVpcLink: 'true'
DeployPostgrest: 'true'
DeployProcessor: 'true'
DeployRestApi: 'true'
DeployRestApiDnsRecord: 'true'
DeployStack: 'true'
DeployWaf: 'false'
EnableWafRulesGeneral: 'false'
EnableWafRulesRestApi: 'false'
EnableWafRulesWebSocket: 'false'
Environment: 'fallback'
Network: 'mainnet'
ProcessorImageVersion: '4.0.2'
ProcessorImageVersion: '5.0.0'
VpcStackName: 'emoji-vpc'
tags: null
template-file-path: 'src/cloud-formation/indexer.cfn.yaml'
Expand Down
30 changes: 15 additions & 15 deletions src/cloud-formation/deploy-indexer-main.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
---
parameters:
BrokerImageVersion: '4.0.2'
DeployAlb: 'false'
DeployAlbDnsRecord: 'false'
DeployBastionHost: 'false'
DeployBroker: 'false'
DeployContainers: 'false'
DeployDb: 'false'
DeployNlb: 'false'
DeployNlbVpcLink: 'false'
DeployPostgrest: 'false'
DeployProcessor: 'false'
DeployRestApi: 'false'
DeployRestApiDnsRecord: 'false'
DeployStack: 'false'
BrokerImageVersion: '5.0.0'
DeployAlb: 'true'
DeployAlbDnsRecord: 'true'
DeployBastionHost: 'true'
DeployBroker: 'true'
DeployContainers: 'true'
DeployDb: 'true'
DeployNlb: 'true'
DeployNlbVpcLink: 'true'
DeployPostgrest: 'true'
DeployProcessor: 'true'
DeployRestApi: 'true'
DeployRestApiDnsRecord: 'true'
DeployStack: 'true'
DeployWaf: 'false'
EnableWafRulesGeneral: 'false'
EnableWafRulesRestApi: 'false'
EnableWafRulesWebSocket: 'false'
Environment: 'main'
Network: 'testnet'
ProcessorHealthCheckStartPeriod: 300
ProcessorImageVersion: '4.0.2'
ProcessorImageVersion: '5.0.0'
VpcStackName: 'emoji-vpc'
tags: null
template-file-path: 'src/cloud-formation/indexer.cfn.yaml'
Expand Down
30 changes: 15 additions & 15 deletions src/cloud-formation/deploy-indexer-production.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
---
parameters:
BrokerCpu: 1024
BrokerImageVersion: '4.0.2'
BrokerImageVersion: '5.0.0'
BrokerMemory: 2048
DbMaxCapacity: 8
DeployAlb: 'false'
DeployAlbDnsRecord: 'false'
DeployBastionHost: 'false'
DeployBroker: 'false'
DeployContainers: 'false'
DeployDb: 'false'
DeployNlb: 'false'
DeployNlbVpcLink: 'false'
DeployPostgrest: 'false'
DeployProcessor: 'false'
DeployRestApi: 'false'
DeployRestApiDnsRecord: 'false'
DeployStack: 'false'
DeployAlb: 'true'
DeployAlbDnsRecord: 'true'
DeployBastionHost: 'true'
DeployBroker: 'true'
DeployContainers: 'true'
DeployDb: 'true'
DeployNlb: 'true'
DeployNlbVpcLink: 'true'
DeployPostgrest: 'true'
DeployProcessor: 'true'
DeployRestApi: 'true'
DeployRestApiDnsRecord: 'true'
DeployStack: 'true'
DeployWaf: 'false'
EnableWafRulesGeneral: 'false'
EnableWafRulesRestApi: 'false'
EnableWafRulesWebSocket: 'false'
Environment: 'production'
Network: 'mainnet'
ProcessorImageVersion: '4.0.2'
ProcessorImageVersion: '5.0.0'
VpcStackName: 'emoji-vpc'
tags: null
template-file-path: 'src/cloud-formation/indexer.cfn.yaml'
Expand Down
28 changes: 16 additions & 12 deletions src/typescript/sdk/src/indexer-v2/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ const toLastSwapFromDatabase = (data: DatabaseStructType["LastSwapData"]): Types

const toArenaMeleeFromDatabase = (data: DatabaseStructType["ArenaMelee"]): Types["ArenaMelee"] => ({
meleeId: BigInt(data.melee_id),
emojicoin0MarketAddress: data.emojicoin_0_market_address,
emojicoin1MarketAddress: data.emojicoin_1_market_address,
emojicoin0MarketAddress: toAccountAddressString(data.emojicoin_0_market_address),
emojicoin1MarketAddress: toAccountAddressString(data.emojicoin_1_market_address),
startTime: postgresTimestampToMicroseconds(data.start_time),
duration: BigInt(data.duration),
maxMatchPercentage: BigInt(data.max_match_percentage),
Expand All @@ -120,7 +120,7 @@ const toArenaMeleeFromDatabase = (data: DatabaseStructType["ArenaMelee"]): Types

const toArenaEnterFromDatabase = (data: DatabaseStructType["ArenaEnter"]): Types["ArenaEnter"] => ({
meleeId: BigInt(data.melee_id),
user: data.user,
user: toAccountAddressString(data.user),
inputAmount: BigInt(data.input_amount),
quoteVolume: BigInt(data.quote_volume),
integratorFee: BigInt(data.integrator_fee),
Expand All @@ -135,7 +135,7 @@ const toArenaEnterFromDatabase = (data: DatabaseStructType["ArenaEnter"]): Types

const toArenaExitFromDatabase = (data: DatabaseStructType["ArenaExit"]): Types["ArenaExit"] => ({
meleeId: BigInt(data.melee_id),
user: data.user,
user: toAccountAddressString(data.user),
tapOutFee: BigInt(data.tap_out_fee),
emojicoin0Proceeds: BigInt(data.emojicoin_0_proceeds),
emojicoin1Proceeds: BigInt(data.emojicoin_1_proceeds),
Expand All @@ -147,7 +147,7 @@ const toArenaExitFromDatabase = (data: DatabaseStructType["ArenaExit"]): Types["

const toArenaSwapFromDatabase = (data: DatabaseStructType["ArenaSwap"]): Types["ArenaSwap"] => ({
meleeId: BigInt(data.melee_id),
user: data.user,
user: toAccountAddressString(data.user),
quoteVolume: BigInt(data.quote_volume),
integratorFee: BigInt(data.integrator_fee),
emojicoin0Proceeds: BigInt(data.emojicoin_0_proceeds),
Expand All @@ -167,7 +167,7 @@ const toArenaVaultBalanceUpdateFromDatabase = (
const toArenaPositionsFromDatabase = (
data: DatabaseStructType["ArenaPositions"]
): Types["ArenaPositions"] => ({
user: data.user,
user: toAccountAddressString(data.user),
meleeId: BigInt(data.melee_id),
open: data.open,
emojicoin0Balance: BigInt(data.emojicoin_0_balance),
Expand All @@ -179,23 +179,27 @@ const toArenaPositionsFromDatabase = (
const toArenaLeaderboardFromDatabase = (
data: DatabaseStructType["ArenaLeaderboard"]
): Types["ArenaLeaderboard"] => ({
user: data.user,
user: toAccountAddressString(data.user),
open: data.open,
emojicoin0Balance: BigInt(data.emojicoin_0_balance),
emojicoin1Balance: BigInt(data.emojicoin_1_balance),
profits: BigInt(data.profits),
losses: BigInt(data.losses),
pnl_percent: data.pnl_percent,
pnl_octas: data.pnl_octas,
pnlPercent: data.pnl_percent,
pnlOctas: data.pnl_octas,
});

const toArenaInfoFromDatabase = (data: DatabaseStructType["ArenaInfo"]): Types["ArenaInfo"] => ({
meleeId: BigInt(data.melee_id),
volume: BigInt(data.volume),
rewardsRemaining: BigInt(data.rewards_remaining),
aptLocked: BigInt(data.apt_locked),
emojicoin0MarketAddress: data.emojicoin_0_market_address,
emojicoin1MarketAddress: data.emojicoin_1_market_address,
emojicoin0MarketAddress: toAccountAddressString(data.emojicoin_0_market_address),
emojicoin0Symbols: data.emojicoin_0_symbols,
emojicoin0MarketID: BigInt(data.emojicoin_0_market_id),
emojicoin1MarketAddress: toAccountAddressString(data.emojicoin_1_market_address),
emojicoin1Symbols: data.emojicoin_1_symbols,
emojicoin1MarketID: BigInt(data.emojicoin_1_market_id),
startTime: postgresTimestampToMicroseconds(data.start_time),
duration: BigInt(data.duration),
maxMatchPercentage: BigInt(data.max_match_percentage),
Expand Down Expand Up @@ -374,7 +378,7 @@ type ChatEventData = {
};

const toChatEventData = (data: DatabaseStructType["ChatEventData"]): ChatEventData => ({
user: data.user,
user: toAccountAddressString(data.user),
message: data.message,
userEmojicoinBalance: BigInt(data.user_emojicoin_balance),
circulatingSupply: BigInt(data.circulating_supply),
Expand Down
4 changes: 4 additions & 0 deletions src/typescript/sdk/src/indexer-v2/types/json-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,11 @@ type ArenaInfoData = {
rewards_remaining: Uint64String;
apt_locked: Uint64String;
emojicoin_0_market_address: string;
emojicoin_0_symbols: SymbolEmoji[];
emojicoin_0_market_id: Uint64String;
emojicoin_1_market_address: string;
emojicoin_1_symbols: SymbolEmoji[];
emojicoin_1_market_id: Uint64String;
start_time: PostgresTimestamp;
duration: Uint64String;
max_match_percentage: Uint64String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ export const floatColumns: Set<AnyColumnName> = new Set([
"available_rewards",
"match_amount",
"emojicoin_0_proceeds",
"emojicoin_1_proceeds",
"emojicoin_0_exchange_rate_base",
"emojicoin_1_exchange_rate_base",
"emojicoin_0_exchange_rate_quote",
"emojicoin_0_market_id",
"emojicoin_1_proceeds",
"emojicoin_1_exchange_rate_base",
"emojicoin_1_exchange_rate_quote",
"emojicoin_1_market_id",
"tap_out_fee",
"new_balance",
"emojicoin_0_balance",
Expand Down
27 changes: 16 additions & 11 deletions src/typescript/sdk/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from "./json-types";
import { type STRUCT_STRINGS } from "../utils";
import { type Flatten } from ".";
import { type SymbolEmoji } from "../emoji_data";

export type AnyNumberString = number | string | bigint;
const strToBigInt = (data: string): bigint => BigInt(data);
Expand Down Expand Up @@ -367,8 +368,8 @@ export type Types = {

ArenaMelee: {
meleeId: bigint;
emojicoin0MarketAddress: string;
emojicoin1MarketAddress: string;
emojicoin0MarketAddress: AccountAddressString;
emojicoin1MarketAddress: AccountAddressString;
startTime: bigint;
duration: bigint;
maxMatchPercentage: bigint;
Expand All @@ -377,7 +378,7 @@ export type Types = {
};

ArenaEnter: {
user: string;
user: AccountAddressString;
meleeId: bigint;
inputAmount: bigint;
quoteVolume: bigint;
Expand All @@ -392,7 +393,7 @@ export type Types = {
};

ArenaExit: {
user: string;
user: AccountAddressString;
meleeId: bigint;
tapOutFee: bigint;
emojicoin0Proceeds: bigint;
Expand All @@ -404,7 +405,7 @@ export type Types = {
};

ArenaSwap: {
user: string;
user: AccountAddressString;
meleeId: bigint;
quoteVolume: bigint;
integratorFee: bigint;
Expand All @@ -421,7 +422,7 @@ export type Types = {
};

ArenaPositions: {
user: string;
user: AccountAddressString;
meleeId: bigint;
open: boolean;
emojicoin0Balance: bigint;
Expand All @@ -438,23 +439,27 @@ export type Types = {
};

ArenaLeaderboard: {
user: string;
user: AccountAddressString;
open: boolean;
emojicoin0Balance: bigint;
emojicoin1Balance: bigint;
profits: bigint;
losses: bigint;
pnl_percent: number;
pnl_octas: number;
pnlPercent: number;
pnlOctas: number;
};

ArenaInfo: {
meleeId: bigint;
volume: bigint;
rewardsRemaining: bigint;
aptLocked: bigint;
emojicoin0MarketAddress: string;
emojicoin1MarketAddress: string;
emojicoin0MarketAddress: AccountAddressString;
emojicoin0Symbols: SymbolEmoji[];
emojicoin0MarketID: bigint;
emojicoin1MarketAddress: AccountAddressString;
emojicoin1Symbols: SymbolEmoji[];
emojicoin1MarketID: bigint;
startTime: bigint;
duration: bigint;
maxMatchPercentage: bigint;
Expand Down

0 comments on commit f2db7f1

Please sign in to comment.