From 0c0091c3e4bd752f540d805726a4df78aca59fa9 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 12:14:14 +0000 Subject: [PATCH 01/22] Add remote config generation. --- .../action.yml | 34 + ...amplify-environment-variable-generation.py | 73 ++ .../development.json | 816 ++++++++++++++++++ .../requirements.txt | 5 + .../terraform.tfvars | 20 + .github/actions/aws-terraform/action.yml | 5 +- .github/workflows/symmio_frontend_sdk.yml | 21 + infrastructure/environments/dev/dev.tfvars | 19 - infrastructure/environments/prod/prod.tfvars | 16 +- .../environments/staging/staging.tfvars | 20 +- 10 files changed, 975 insertions(+), 54 deletions(-) create mode 100644 .github/actions/amplify-environment-variable-generation/action.yml create mode 100644 .github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py create mode 100644 .github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/development.json create mode 100644 .github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/requirements.txt create mode 100644 .github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml new file mode 100644 index 0000000..38341cb --- /dev/null +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -0,0 +1,34 @@ +name: Amplify Environment Variable Generation +description: Generates environment variables for Amplify +inputs: + environment: + description: "Name of the environment e.g. dev, staging, prod" + required: true + github_token: + description: "GitHub token" + required: true + +runs: + using: "composite" + steps: + - name: Setup build environment + id: setup + run: | + # Variables + environment="${{ inputs.environment }}" + config_file_name=${{ github.event.inputs.environment == 'dev' && 'development.json' || github.event.inputs.environment }}.json + target_branch=${{ github.event.inputs.environment == 'prod' && 'main' || github.event.inputs.environment }} + + # GitHub setup and clone Perps Hedger Config repo + git config --global credential.helper store + echo "https://x-access-token:${github.event.inputs.github_token}@github.com" > ~/.git-credentials + git clone -b ${target_branch} https://github.com/orbs-network/perps-hedger-config.git + + # Python setup and generate environment variables tfvars file + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + python amplify-environment-variable-generation.py --config ./perps-hedger-config/appconfig/$config_file_name --environment $environment + mv terraform.tfvars ../../../../infrastructure/terraform.tfvars + shell: bash + working-directory: ./.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py new file mode 100644 index 0000000..0f5a79c --- /dev/null +++ b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py @@ -0,0 +1,73 @@ +import argparse +import json + + +def main(): + # Parse arguments + parser = argparse.ArgumentParser() + + parser.add_argument( + "--config", help="Path to the AWS ECS Scaling definition YAML file.", required=True) + parser.add_argument( + "--environment", help="Specify the environment", required=True) + args = parser.parse_args() + + # Parse the config file as JSON + with open(args.config, "r") as file: + config = json.load(file) + # Access symmIdToMultiaccounts from globals + symm_accounts = config['globals']['symmIdToMultiaccounts'] + env_strings = [] + # Iterate and print key + first address + for symm_id, addresses in symm_accounts.items(): + hedger_addresses = addresses + party_b_address = config['perSymmId'][symm_id]['symm']['partyBAddress'] + env_strings.append(generate_templates( + symm_id, hedger_addresses, party_b_address, args.environment)) + write_tfvars_file(env_strings) + + +def generate_templates(symm_id: str, hedger_addresses: list[str], party_b_address: str, environment: str) -> str: + environment = environment + '.' if environment != 'prod' else '' + all_templates = [] + + for hedger_address in hedger_addresses: + templates = [ + f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_HEDGER_URL" = "www.{ + environment}perps-streaming.com/v1/{symm_id}/{hedger_address}/"', + f'"NEXT_PUBLIC_{symm_id}_{ + hedger_address}_MULTIACCOUNT" = "{hedger_address}"', + f'"NEXT_PUBLIC_{symm_id}_{ + hedger_address}_PARTY_B" = "{party_b_address}"' + ] + all_templates.extend(templates) + + return '\n'.join(all_templates) + + +def write_tfvars_file(env_vars_list, output_path="terraform.tfvars"): + """ + Write environment variables to a tfvars file in the correct format. + + Args: + env_vars_list (list): List of environment variable strings + output_path (str): Path to output tfvars file + """ + try: + # Format the content as a Terraform map variable + content = 'amplify_remote_environment_variables = {\n' + content += '\n'.join(f' {var}' for var in env_vars_list) + content += '\n}' + + # Write to file + with open(output_path, 'w') as f: + f.write(content) + + return True + except Exception as e: + print(f"Error writing tfvars file: {str(e)}") + return False + + +if __name__ == "__main__": + main() diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/development.json b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/development.json new file mode 100644 index 0000000..94d5609 --- /dev/null +++ b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/development.json @@ -0,0 +1,816 @@ +{ + "globals": { + "rabbit": { + "maxTimeoutMs": 20000, + "dedupLockTtlMs": 60000 + }, + "privateKeyLocker": { + "lockTtlMs": 300000, + "waitToLockTimeoutMs": 360000 + }, + "infra": { + "remoteConfigPollingIntervalMs": 30000 + }, + "heartbeat": { + "intervalMs": 2000, + "minAllowedUptimeToConsiderHealthySec": 10 + }, + "monitoringService": { + "intervalMs": 120000, + "chainDbSyncLagCheckIntervalMs": 300000, + "gasBalanceCheckIntervalMs": 120000 + }, + "binanceCache": { + "incomeHistoryProcessorIntervalMs": 600000, + "maxBinanceReadOrderCalls": 20, + "getAllOrdersLimit": 500, + "fetchSafetyMarginMs": 3600000, + "binanceOrderUpdateDebounceMs": 100, + "binancePositionUpdateDebounceMs": 20, + "backupSyncIntervalMs": 60000, + "backupSyncLockTtlMs": 60000, + "databaseName": "binance-cache", + "wsEventLockTtlMs": 10000, + "incomeHistoryProcessorEnabled": false, + "notionalAndLeverageBracketsPollIntervalSeconds": 3600, + "depositHandlerEnabled": false, + "depositHandlerBalanceThreshold": 10, + "depositHandlerPollIntervalMs": 300000, + "depositHandlerUsdtUsdcLimitOrderPrice": 0.999 + }, + "instantTrading": { + "databaseName": "instant-trading", + "enabled": true, + "validateApiKey": false, + "validateAccessToken": true, + "logRequests": false, + "instantOpensEnabled": true + }, + "chainDBSync": { + "databaseName": "chain-db-sync", + "wsEventLockTtlMs": 10000, + "backupSyncLockTtlMs": 60000 + }, + "mongodb": { + "connectTimeoutSec": 5, + "persistBatchSize": 1000 + }, + "binance": { + "accountLeverage": 20, + "minBrokerBalance": 500, + "maxBrokerLeverage": 3, + "maxBrokerMarginRatio": 0.4, + "deadlineSpreadMs": 3600000, + "leverages": { + "params": { + "profiles": { + "default": { + "leverage": 4 + } + }, + "symbols": {} + }, + "isEnabled": false + }, + "splitBigOrdersEnabled": false, + "artificialOrderSplitFactor": 0.8, + "capitalControls": { + "perCategory": {}, + "perSymbol": { + "profiles": { + "default": { + "notionalCap": 10000000, + "notionalPercentageCap": 50 + } + }, + "symbols": {} + } + }, + "leveragePerSymbolDisabled": false + }, + "business": { + "profiles": { + "defaultUI": { + "defaultProfile": { + "spreadBPS": 5, + "maxPositionNotionalUSD": 1400000, + "minQuotePrincipalUSD": 20, + "minQuoteNotionalUSD": 20, + "maxLeverage": 25, + "maxQuoteNotionalUSD": 150000, + "minLfPortionOfMm": 0.004, + "maxFundingRate": 200 + }, + "btc": { + "spreadBPS": 5, + "maxPositionNotionalUSD": 2100000, + "minQuotePrincipalUSD": 240, + "minQuoteNotionalUSD": 240, + "maxLeverage": 60, + "maxQuoteNotionalUSD": 1000000, + "minLfPortionOfMm": 0.004, + "maxFundingRate": 200 + }, + "eth": { + "spreadBPS": 5, + "maxPositionNotionalUSD": 2100000, + "minQuotePrincipalUSD": 60, + "minQuoteNotionalUSD": 60, + "maxLeverage": 60, + "maxQuoteNotionalUSD": 1000000, + "minLfPortionOfMm": 0.004, + "maxFundingRate": 200 + }, + "majors": { + "spreadBPS": 5, + "maxPositionNotionalUSD": 1400000, + "minQuotePrincipalUSD": 20, + "minQuoteNotionalUSD": 20, + "maxLeverage": 50, + "maxQuoteNotionalUSD": 1000000, + "minLfPortionOfMm": 0.004, + "maxFundingRate": 200 + }, + "altcoins": { + "spreadBPS": 5, + "maxPositionNotionalUSD": 1400000, + "minQuotePrincipalUSD": 20, + "minQuoteNotionalUSD": 20, + "maxLeverage": 40, + "maxQuoteNotionalUSD": 1000000, + "minLfPortionOfMm": 0.004, + "maxFundingRate": 200 + }, + "shitcoins": { + "spreadBPS": 5, + "maxPositionNotionalUSD": 1400000, + "minQuotePrincipalUSD": 20, + "minQuoteNotionalUSD": 20, + "maxLeverage": 8, + "maxQuoteNotionalUSD": 150000, + "minLfPortionOfMm": 0.004, + "maxFundingRate": 200 + } + } + }, + "symbols": { + "defaultUI": { + "BTCUSDT": "btc", + "ETHUSDT": "eth", + "LTCUSDT": "majors", + "BCHUSDT": "majors", + "ETCUSDT": "majors", + "LINKUSDT": "majors", + "XRPUSDT": "majors", + "EOSUSDT": "majors", + "ADAUSDT": "majors", + "BNBUSDT": "majors", + "DOGEUSDT": "majors", + "TRXUSDT": "altcoins", + "ATOMUSDT": "altcoins", + "VETUSDT": "altcoins", + "MKRUSDT": "altcoins", + "DOTUSDT": "altcoins", + "SOLUSDT": "altcoins", + "UNIUSDT": "altcoins", + "AVAXUSDT": "altcoins", + "FTMUSDT": "altcoins", + "FILUSDT": "altcoins", + "MATICUSDT": "altcoins", + "AXSUSDT": "altcoins", + "SANDUSDT": "altcoins", + "MANAUSDT": "altcoins", + "1000SHIBUSDT": "altcoins", + "MASKUSDT": "altcoins", + "DYDXUSDT": "altcoins", + "GALAUSDT": "altcoins", + "APEUSDT": "altcoins", + "OPUSDT": "altcoins", + "LDOUSDT": "altcoins", + "APTUSDT": "altcoins", + "ARBUSDT": "altcoins", + "SUIUSDT": "altcoins", + "CFXUSDT": "altcoins", + "USDCUSDT": "altcoins", + "NEOUSDT": "altcoins", + "1000BONKUSDT": "altcoins", + "PYTHUSDT": "altcoins", + "ILVUSDT": "altcoins", + "MEMEUSDT": "altcoins", + "BEAMXUSDT": "altcoins", + "USTCUSDT": "altcoins", + "SEIUSDT": "altcoins", + "JTOUSDT": "altcoins", + "TRBUSDT": "altcoins", + "ENJUSDT": "altcoins", + "FLMUSDT": "shitcoins", + "STMXUSDT": "shitcoins", + "LUNA2USDT": "shitcoins", + "JOEUSDT": "shitcoins", + "AMBUSDT": "shitcoins", + "NMRUSDT": "shitcoins", + "BTCDOMUSDT": "shitcoins", + "BLZUSDT": "shitcoins", + "UNFIUSDT": "shitcoins", + "TLMUSDT": "shitcoins", + "BICOUSDT": "shitcoins", + "BNXUSDT": "shitcoins", + "ENAUSDT": "shitcoins", + "REZUSDT": "shitcoins", + "DEFIUSDT": "shitcoins", + "OMNIUSDT": "shitcoins", + "SXPUSDT": "shitcoins", + "1000PEPEUSDT": "shitcoins", + "WLDUSDT": "shitcoins", + "MAVUSDT": "shitcoins", + "ARKUSDT": "shitcoins", + "LOOMUSDT": "shitcoins", + "STORJUSDT": "shitcoins", + "CYBERUSDT": "shitcoins", + "XVGUSDT": "shitcoins", + "OXTUSDT": "shitcoins", + "DODOXUSDT": "shitcoins" + } + } + }, + "intervalScheduler": { + "defaultTimeoutMs": 1800000 + }, + "symmIdToMultiaccounts": { + "56a": [ + "0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3" + ], + "5000a": [ + "0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456" + ], + "42161a": [ + "0x6273242a7E88b3De90822b31648C212215caaFE4", + "0x141269E29a770644C34e05B127AB621511f20109" + ], + "34443a": [ + "0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904" + ], + "8453a": [ + "0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86" + ] + }, + "blockchainExecutor": { + "sendTransactionTimeoutMs": 30000 + }, + "riskEngine": { + "maxOiMultiplier": 3, + "mmRatioAtMaxLeverage": 0.6, + "spareFundsFactor": 0.3, + "spareFundsFactorWarnBuffer": 1.1, + "maxUsageForOiMultiplier": 0.8 + }, + "consistencyProvider": { + "errorSlidingWindowMs": 3600000, + "shouldDebugLog": false + }, + "queueProvider": "Redis" + }, + "perSymmId": { + "56a": { + "positionManager": { + "flagGetAllocationFromDb": true, + "actOnTradeRetryConfig": { + "retries": 3, + "factor": 1.5, + "minTimeout": 300, + "maxTimeout": 3000 + } + }, + "blockchain": { + "maxBlockRangeForGetLogs": 2000, + "maxChainDBBlockDelta": 10, + "consistencyProvider": { + "retryStaleConfig": { + "retries": 3, + "factor": 1.5, + "minTimeout": 300, + "maxTimeout": 3000 + }, + "rpcs": [ + "https://necessary-indulgent-spring.bsc.quiknode.pro/65a1146a15fc6c03bfcc47490b31ec0b7dedd13a/", + "https://lb.drpc.org/ogrpc?network=bsc&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" + ], + "chooseProviderIntervalMs": 60000, + "maxBlockLagAllowedBeforeSwitch": 10, + "shouldUseStaleCheck": true, + "shouldUseErrorCheck": true, + "rpcHealthCheckTimeoutMs": 2000, + "minErrorCountAllowedBeforeSwitch": 10, + "minTotalCallsCountAllowedBeforeSwitch": 20, + "maxErrorRateAllowedBeforeSwitch": 0.2 + } + }, + "chainDBSync": { + "firstSymmBlock": 34345962, + "backupSyncIntervalMs": 20000 + }, + "muon": { + "app": "symmio", + "urls": [ + "https://muon-oracle2.rasa.capital/v1/", + "https://muon-oracle3.rasa.capital/v1/", + "https://muon-oracle4.rasa.capital/v1/" + ] + }, + "symm": { + "symmCoreAddress": "0x9A9F48888600FC9c05f11E03Eab575EBB2Fc2c8f", + "partyBAddress": "0xdF077F5f52bc41A9072F9d0e5fB281770bCD1142" + }, + "monitoringThresholds": { + "minBotGasBalance": 0.1, + "botAddresses": [ + "0xF09928aB8419957d5E9Fd6b8BCA7E42D1ACdBe19", + "0x87Df68F2069D08c908A197e3a707C9BEb0754133", + "0xf35109321eB25e6C50d07fa217277Fb0acF7A576", + "0xA142Ec33458e4A1ffbD5fD45b93aa50Ba51d9Cf5", + "0xE14863eD4a72Efde86BD4F25821515fdeec42a40", + "0x6d1240d96F37A8Cc8aD390558d39A4E3f309bF2A", + "0x33E31cdB83Cd4386C43A22a2896C2C740DFef515" + ] + }, + "riskEngine": { + "maxInitialNotionalUSD": 2000, + "targetHealthFactor": 0.1, + "lowHealthFactorTh": 0.08, + "highHealthFactorTh": 0.2, + "isEmergencyHaltEnabled": false, + "rebalancerIntervalMs": 120000, + "minAllowedMaxFundingRate": 200 + }, + "web3agent": { + "retries": 5, + "partyALockTtlMS": 300000 + }, + "blockchainExecutor": { + "gasPriceGWEI": 6, + "maxGasPriceGWEI": 30, + "gasPriceIncreaseIntervalMS": 2000, + "gasPriceIncreaseMaxRetries": 10, + "gasPriceIncreaseMultiplier": 1.2, + "useLegacyExecutor": false, + "executionTimeoutMS": 180000 + }, + "fundingRate": { + "intervalMs": 180000, + "spreadFactor": 0.2, + "minProfitUSD": 1, + "chargeEnabled": true + }, + "tradeIdFilter": { + "filterEnabled": false, + "tradeIdModuloFilter": 0, + "notionalBelowUSD": 0, + "delayMs": 1000 + }, + "liveEventWatcher": { + "pollingIntervalMs": 2000 + }, + "liquidator": { + "intervalMs": 10000, + "contractAddress": "0xE8cDEa1B566f506b9276585559896260b55Cb7E8", + "retryConfig": { + "retries": 3, + "factor": 1.5, + "minTimeout": 300, + "maxTimeout": 3000 + } + } + }, + "5000a": { + "liquidator": { + "intervalMs": 10000, + "contractAddress": "0x82261Fcb908989dd418cEDCA35359B284D7D86d6", + "retryConfig": { + "retries": 3, + "factor": 1.5, + "minTimeout": 300, + "maxTimeout": 3000 + } + }, + "positionManager": { + "flagGetAllocationFromDb": true, + "actOnTradeRetryConfig": { + "retries": 3, + "factor": 1.5, + "minTimeout": 300, + "maxTimeout": 3000 + } + }, + "blockchain": { + "maxBlockRangeForGetLogs": 2000, + "maxChainDBBlockDelta": 15, + "consistencyProvider": { + "retryStaleConfig": { + "minTimeout": 500, + "maxTimeout": 3000, + "retries": 4, + "factor": 1.5 + }, + "rpcs": [ + "https://blissful-little-cloud.mantle-mainnet.quiknode.pro/3836a9592f294e6980dc9949b98fe0dd689c21d7/", + "https://lb.drpc.org/ogrpc?network=mantle&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" + ], + "chooseProviderIntervalMs": 60000, + "maxBlockLagAllowedBeforeSwitch": 30, + "shouldUseStaleCheck": true, + "shouldUseErrorCheck": true, + "rpcHealthCheckTimeoutMs": 2000, + "minErrorCountAllowedBeforeSwitch": 10, + "minTotalCallsCountAllowedBeforeSwitch": 20, + "maxErrorRateAllowedBeforeSwitch": 0.2 + } + }, + "chainDBSync": { + "firstSymmBlock": 61972154, + "backupSyncIntervalMs": 20000 + }, + "muon": { + "app": "symmio", + "urls": [ + "https://muon-oracle2.rasa.capital/v1/", + "https://muon-oracle3.rasa.capital/v1/", + "https://muon-oracle4.rasa.capital/v1/" + ] + }, + "symm": { + "symmCoreAddress": "0x2Ecc7da3Cc98d341F987C85c3D9FC198570838B5", + "partyBAddress": "0xF9e39B4B30E26c18d2a725c0397Ed5A925efE46B" + }, + "monitoringThresholds": { + "minBotGasBalance": 50, + "botAddresses": [ + "0xF09928aB8419957d5E9Fd6b8BCA7E42D1ACdBe19", + "0x87Df68F2069D08c908A197e3a707C9BEb0754133", + "0xf35109321eB25e6C50d07fa217277Fb0acF7A576", + "0xA142Ec33458e4A1ffbD5fD45b93aa50Ba51d9Cf5", + "0xE14863eD4a72Efde86BD4F25821515fdeec42a40", + "0x6d1240d96F37A8Cc8aD390558d39A4E3f309bF2A", + "0x33E31cdB83Cd4386C43A22a2896C2C740DFef515" + ] + }, + "riskEngine": { + "maxInitialNotionalUSD": 2000, + "targetHealthFactor": 0.1, + "lowHealthFactorTh": 0.08, + "highHealthFactorTh": 0.2, + "isEmergencyHaltEnabled": false, + "rebalancerIntervalMs": 120000, + "minAllowedMaxFundingRate": 200 + }, + "web3agent": { + "retries": 5, + "partyALockTtlMS": 300000 + }, + "blockchainExecutor": { + "gasPriceGWEI": 0.02, + "maxGasPriceGWEI": 0.1, + "gasPriceIncreaseMultiplier": 1.2, + "gasPriceIncreaseIntervalMS": 2000, + "gasPriceIncreaseMaxRetries": 10, + "useLegacyExecutor": false, + "executionTimeoutMS": 180000 + }, + "fundingRate": { + "intervalMs": 180000, + "spreadFactor": 0.2, + "minProfitUSD": 1, + "chargeEnabled": true + }, + "tradeIdFilter": { + "filterEnabled": false, + "tradeIdModuloFilter": 0, + "notionalBelowUSD": 0, + "delayMs": 1000 + }, + "liveEventWatcher": { + "pollingIntervalMs": 2000 + } + }, + "42161a": { + "liquidator": { + "intervalMs": 10000, + "contractAddress": "0x7ECBEB26Cf76ca8680c851336B97D4BE8521918C", + "retryConfig": { + "maxTimeout": 3000, + "minTimeout": 300, + "retries": 3, + "factor": 1.5 + } + }, + "positionManager": { + "flagGetAllocationFromDb": true, + "actOnTradeRetryConfig": { + "maxTimeout": 3000, + "minTimeout": 300, + "retries": 3, + "factor": 1.5 + } + }, + "blockchain": { + "maxBlockRangeForGetLogs": 10000, + "maxChainDBBlockDelta": 160, + "consistencyProvider": { + "retryStaleConfig": { + "maxTimeout": 3000, + "minTimeout": 300, + "retries": 3, + "factor": 1.5 + }, + "rpcs": [ + "https://bold-fittest-arrow.arbitrum-mainnet.quiknode.pro/edb712c03f3e57e9035025db47842bf1971061ca", + "https://lb.drpc.org/ogrpc?network=arbitrum&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" + ], + "chooseProviderIntervalMs": 60000, + "maxBlockLagAllowedBeforeSwitch": 60, + "shouldUseStaleCheck": true, + "shouldUseErrorCheck": true, + "rpcHealthCheckTimeoutMs": 3000, + "minErrorCountAllowedBeforeSwitch": 10, + "minTotalCallsCountAllowedBeforeSwitch": 20, + "maxErrorRateAllowedBeforeSwitch": 0.2 + } + }, + "chainDBSync": { + "firstSymmBlock": 210771536, + "backupSyncIntervalMs": 20000 + }, + "muon": { + "app": "symmio", + "urls": [ + "https://muon-oracle2.rasa.capital/v1/", + "https://muon-oracle3.rasa.capital/v1/", + "https://muon-oracle4.rasa.capital/v1/" + ] + }, + "symm": { + "symmCoreAddress": "0x8F06459f184553e5d04F07F868720BDaCAB39395", + "partyBAddress": "0xdB91D232E93969130272De309d3d914547604426" + }, + "monitoringThresholds": { + "minBotGasBalance": 0.017, + "botAddresses": [ + "0xF09928aB8419957d5E9Fd6b8BCA7E42D1ACdBe19", + "0x87Df68F2069D08c908A197e3a707C9BEb0754133", + "0xf35109321eB25e6C50d07fa217277Fb0acF7A576", + "0xA142Ec33458e4A1ffbD5fD45b93aa50Ba51d9Cf5", + "0xE14863eD4a72Efde86BD4F25821515fdeec42a40", + "0x6d1240d96F37A8Cc8aD390558d39A4E3f309bF2A", + "0x33E31cdB83Cd4386C43A22a2896C2C740DFef515" + ] + }, + "riskEngine": { + "maxInitialNotionalUSD": 2000, + "targetHealthFactor": 0.1, + "lowHealthFactorTh": 0.08, + "highHealthFactorTh": 0.2, + "isEmergencyHaltEnabled": false, + "rebalancerIntervalMs": 120000, + "minAllowedMaxFundingRate": 200 + }, + "web3agent": { + "retries": 5, + "partyALockTtlMS": 300000 + }, + "blockchainExecutor": { + "gasPriceGWEI": 0.01, + "maxGasPriceGWEI": 0.05, + "gasPriceIncreaseMultiplier": 1.2, + "gasPriceIncreaseIntervalMS": 2000, + "gasPriceIncreaseMaxRetries": 10, + "useLegacyExecutor": false, + "executionTimeoutMS": 180000 + }, + "fundingRate": { + "intervalMs": 180000, + "spreadFactor": 0.2, + "minProfitUSD": 1, + "chargeEnabled": true + }, + "tradeIdFilter": { + "filterEnabled": false, + "tradeIdModuloFilter": 0, + "notionalBelowUSD": 0, + "delayMs": 1000 + }, + "liveEventWatcher": { + "pollingIntervalMs": 2000 + } + }, + "34443a": { + "liquidator": { + "intervalMs": 10000, + "contractAddress": "0x0000000000000000000000000000000000000000", + "retryConfig": { + "maxTimeout": 3000, + "minTimeout": 300, + "retries": 3, + "factor": 1.5 + } + }, + "positionManager": { + "flagGetAllocationFromDb": true, + "actOnTradeRetryConfig": { + "maxTimeout": 3000, + "minTimeout": 300, + "retries": 3, + "factor": 1.5 + } + }, + "blockchain": { + "maxBlockRangeForGetLogs": 2000, + "maxChainDBBlockDelta": 15, + "consistencyProvider": { + "retryStaleConfig": { + "minTimeout": 500, + "maxTimeout": 3000, + "retries": 4, + "factor": 1.5 + }, + "rpcs": [ + "https://lb.drpc.org/ogrpc?network=mode&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" + ], + "chooseProviderIntervalMs": 60000, + "maxBlockLagAllowedBeforeSwitch": 30, + "shouldUseStaleCheck": true, + "shouldUseErrorCheck": true, + "rpcHealthCheckTimeoutMs": 2000, + "minErrorCountAllowedBeforeSwitch": 10, + "minTotalCallsCountAllowedBeforeSwitch": 20, + "maxErrorRateAllowedBeforeSwitch": 0.2 + } + }, + "chainDBSync": { + "firstSymmBlock": 61972154, + "backupSyncIntervalMs": 20000 + }, + "muon": { + "app": "symmio", + "urls": [ + "https://muon-oracle2.rasa.capital/v1/", + "https://muon-oracle3.rasa.capital/v1/", + "https://muon-oracle4.rasa.capital/v1/" + ] + }, + "symm": { + "symmCoreAddress": "0x3d17f073cCb9c3764F105550B0BCF9550477D266", + "partyBAddress": "0x78E76Ac7fEc050cA785c19fFADDF57137b890543" + }, + "monitoringThresholds": { + "minBotGasBalance": 50, + "botAddresses": [ + "0xF09928aB8419957d5E9Fd6b8BCA7E42D1ACdBe19", + "0x87Df68F2069D08c908A197e3a707C9BEb0754133", + "0xf35109321eB25e6C50d07fa217277Fb0acF7A576", + "0xA142Ec33458e4A1ffbD5fD45b93aa50Ba51d9Cf5", + "0xE14863eD4a72Efde86BD4F25821515fdeec42a40", + "0x6d1240d96F37A8Cc8aD390558d39A4E3f309bF2A", + "0x33E31cdB83Cd4386C43A22a2896C2C740DFef515" + ] + }, + "riskEngine": { + "maxInitialNotionalUSD": 2000, + "targetHealthFactor": 0.1, + "lowHealthFactorTh": 0.08, + "highHealthFactorTh": 0.2, + "isEmergencyHaltEnabled": false, + "rebalancerIntervalMs": 120000, + "minAllowedMaxFundingRate": 200 + }, + "web3agent": { + "retries": 5, + "partyALockTtlMS": 300000 + }, + "blockchainExecutor": { + "gasPriceGWEI": 0.01, + "maxGasPriceGWEI": 0.05, + "gasPriceIncreaseMultiplier": 1.2, + "gasPriceIncreaseIntervalMS": 2000, + "gasPriceIncreaseMaxRetries": 10, + "useLegacyExecutor": false, + "executionTimeoutMS": 180000 + }, + "fundingRate": { + "intervalMs": 180000, + "spreadFactor": 0.2, + "minProfitUSD": 1, + "chargeEnabled": true + }, + "tradeIdFilter": { + "filterEnabled": false, + "tradeIdModuloFilter": 0, + "notionalBelowUSD": 0, + "delayMs": 1000 + }, + "liveEventWatcher": { + "pollingIntervalMs": 2000 + } + }, + "8453a": { + "positionManager": { + "flagGetAllocationFromDb": true, + "actOnTradeRetryConfig": { + "retries": 10, + "factor": 1.5, + "minTimeout": 300, + "maxTimeout": 3000 + } + }, + "blockchain": { + "maxBlockRangeForGetLogs": 10000, + "maxChainDBBlockDelta": 20, + "consistencyProvider": { + "retryStaleConfig": { + "maxTimeout": 3000, + "minTimeout": 300, + "retries": 3, + "factor": 1.5 + }, + "rpcs": [ + "https://polished-multi-replica.base-mainnet.quiknode.pro/650a8f30f9242935baae0a4a32261221d5d5400c/", + "https://lb.drpc.org/ogrpc?network=base&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" + ], + "chooseProviderIntervalMs": 60000, + "maxBlockLagAllowedBeforeSwitch": 30, + "rpcHealthCheckTimeoutMs": 2000, + "minErrorCountAllowedBeforeSwitch": 30, + "minTotalCallsCountAllowedBeforeSwitch": 20, + "maxErrorRateAllowedBeforeSwitch": 0.2, + "shouldUseStaleCheck": true, + "shouldUseErrorCheck": true + } + }, + "chainDBSync": { + "firstSymmBlock": 8443806, + "backupSyncIntervalMs": 20000 + }, + "muon": { + "app": "symmio", + "urls": [ + "https://muon-oracle2.rasa.capital/v1/", + "https://muon-oracle3.rasa.capital/v1/", + "https://muon-oracle4.rasa.capital/v1/" + ] + }, + "symm": { + "symmCoreAddress": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43", + "partyBAddress": "0xB6e3b44975f2966707a91747F89D2002ff8d62Db" + }, + "monitoringThresholds": { + "minBotGasBalance": 0.01, + "botAddresses": [] + }, + "riskEngine": { + "maxInitialNotionalUSD": 5000, + "targetHealthFactor": 0.1666, + "lowHealthFactorTh": 0.14, + "highHealthFactorTh": 0.2, + "isEmergencyHaltEnabled": false, + "rebalancerIntervalMs": 120000, + "minAllowedMaxFundingRate": 200 + }, + "web3agent": { + "retries": 5, + "partyALockTtlMS": 300000 + }, + "blockchainExecutor": { + "gasPriceGWEI": 0.012, + "maxGasPriceGWEI": 0.2, + "gasPriceIncreaseMultiplier": 1.3, + "gasPriceIncreaseIntervalMS": 4000, + "gasPriceIncreaseMaxRetries": 10, + "useLegacyExecutor": false, + "executionTimeoutMS": 180000 + }, + "fundingRate": { + "intervalMs": 180000, + "spreadFactor": 0.2, + "minProfitUSD": 1, + "chargeEnabled": true + }, + "tradeIdFilter": { + "filterEnabled": true, + "tradeIdModuloFilter": 2, + "notionalBelowUSD": 2000, + "delayMs": 10000 + }, + "liveEventWatcher": { + "pollingIntervalMs": 2000 + }, + "liquidator": { + "intervalMs": 1000, + "contractAddress": "0xeB7bd77D49bb9e86A736dc6350a7A1F90327cA80", + "retryConfig": { + "retries": 3, + "factor": 1.5, + "minTimeout": 300, + "maxTimeout": 3000 + } + } + } + } +} diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/requirements.txt b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/requirements.txt new file mode 100644 index 0000000..1761d65 --- /dev/null +++ b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/requirements.txt @@ -0,0 +1,5 @@ +certifi==2024.12.14 +charset-normalizer==3.4.0 +idna==3.10 +requests==2.32.3 +urllib3==2.2.3 diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars new file mode 100644 index 0000000..ec1608c --- /dev/null +++ b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars @@ -0,0 +1,20 @@ +amplify_remote_environment_variables = { + "NEXT_PUBLIC_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_HEDGER_URL" = "www.dev.perps-streaming.com/v1/56a/0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3/" +"NEXT_PUBLIC_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_MULTIACCOUNT" = "0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3" +"NEXT_PUBLIC_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_PARTY_B" = "0xdF077F5f52bc41A9072F9d0e5fB281770bCD1142" + "NEXT_PUBLIC_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_HEDGER_URL" = "www.dev.perps-streaming.com/v1/5000a/0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456/" +"NEXT_PUBLIC_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_MULTIACCOUNT" = "0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456" +"NEXT_PUBLIC_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_PARTY_B" = "0xF9e39B4B30E26c18d2a725c0397Ed5A925efE46B" + "NEXT_PUBLIC_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_HEDGER_URL" = "www.dev.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/" +"NEXT_PUBLIC_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_MULTIACCOUNT" = "0x6273242a7E88b3De90822b31648C212215caaFE4" +"NEXT_PUBLIC_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_PARTY_B" = "0xdB91D232E93969130272De309d3d914547604426" +"NEXT_PUBLIC_42161a_0x141269E29a770644C34e05B127AB621511f20109_HEDGER_URL" = "www.dev.perps-streaming.com/v1/42161a/0x141269E29a770644C34e05B127AB621511f20109/" +"NEXT_PUBLIC_42161a_0x141269E29a770644C34e05B127AB621511f20109_MULTIACCOUNT" = "0x141269E29a770644C34e05B127AB621511f20109" +"NEXT_PUBLIC_42161a_0x141269E29a770644C34e05B127AB621511f20109_PARTY_B" = "0xdB91D232E93969130272De309d3d914547604426" + "NEXT_PUBLIC_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_HEDGER_URL" = "www.dev.perps-streaming.com/v1/34443a/0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904/" +"NEXT_PUBLIC_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_MULTIACCOUNT" = "0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904" +"NEXT_PUBLIC_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_PARTY_B" = "0x78E76Ac7fEc050cA785c19fFADDF57137b890543" + "NEXT_PUBLIC_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_HEDGER_URL" = "www.dev.perps-streaming.com/v1/8453a/0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86/" +"NEXT_PUBLIC_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_MULTIACCOUNT" = "0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86" +"NEXT_PUBLIC_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_PARTY_B" = "0xB6e3b44975f2966707a91747F89D2002ff8d62Db" +} \ No newline at end of file diff --git a/.github/actions/aws-terraform/action.yml b/.github/actions/aws-terraform/action.yml index 86a7159..722bd3b 100644 --- a/.github/actions/aws-terraform/action.yml +++ b/.github/actions/aws-terraform/action.yml @@ -29,6 +29,9 @@ inputs: amplify_basic_auth_credentials: description: "Basic auth credentials for Amplify" required: true + additional_tfvars_path: + description: "Path to additional tfvars file" + required: false runs: using: "composite" @@ -67,7 +70,7 @@ runs: run: | export TF_VAR_environment=${environment} ${{ github.action_path }}/box.sh "Running Terraform plan" - plan_command="terraform plan -var-file='./environments/${{ inputs.environment }}/${{ inputs.environment }}.tfvars' -var 'region=${{ inputs.aws_deploy_region }}' -var 'amplify_custom_domain=${{inputs.amplify_custom_domain}}' -var 'amplify_basic_auth_credentials=${{inputs.amplify_basic_auth_credentials}}' -input=false -out=plan.out" + plan_command="terraform plan -var-file='./environments/${{ inputs.environment }}/${{ inputs.environment }}.tfvars' $([ -n "${additional_tfvars_path}" ] && echo "-var-file=${additional_tfvars_path}") -var 'region=${{ inputs.aws_deploy_region }}' -var 'amplify_custom_domain=${{inputs.amplify_custom_domain}}' -var 'amplify_basic_auth_credentials=${{inputs.amplify_basic_auth_credentials}}' -input=false -out=plan.out" if [ "${{ github.event_name }}" == "workflow_dispatch" ] || [ "${{ inputs.branch }}" == "develop" ]; then eval $plan_command else diff --git a/.github/workflows/symmio_frontend_sdk.yml b/.github/workflows/symmio_frontend_sdk.yml index 77102ee..98c615d 100644 --- a/.github/workflows/symmio_frontend_sdk.yml +++ b/.github/workflows/symmio_frontend_sdk.yml @@ -37,6 +37,12 @@ jobs: role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME_NONPROD }} role-session-name: terraform-gha + - name: Generate Amplify Environment Variables (Dev) + uses: ./.github/actions/amplify-environment-variable-generation + with: + environments: "dev" + github_token: ${{ secrets.PERPS_HEDGER_CONFIG_GITHUB_TOKEN }} + - name: Run AWS Terraform uses: ./.github/actions/aws-terraform with: @@ -49,6 +55,7 @@ jobs: branch: ${GITHUB_REF##*/} amplify_custom_domain: ${{ secrets.AMPLIFY_CUSTOM_DOMAIN_DEV }} amplify_basic_auth_credentials: ${{ secrets.AMPLIFY_BASIC_AUTH_CREDENTIALS_DEV }} + additional_tfvars_path: "./terraform.tfvars" aws-terraform-staging: name: Run AWS Terraform (Staging) @@ -64,6 +71,12 @@ jobs: role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME_NONPROD }} role-session-name: terraform-gha + - name: Generate Amplify Environment Variables (Dev) + uses: ./.github/actions/amplify-environment-variable-generation + with: + environments: "staging" + github_token: ${{ secrets.PERPS_HEDGER_CONFIG_GITHUB_TOKEN }} + - name: Run AWS Terraform uses: ./.github/actions/aws-terraform with: @@ -76,6 +89,7 @@ jobs: branch: ${GITHUB_REF##*/} amplify_custom_domain: ${{ secrets.AMPLIFY_CUSTOM_DOMAIN_STAGING }} amplify_basic_auth_credentials: ${{ secrets.AMPLIFY_BASIC_AUTH_CREDENTIALS_STAGING }} + additional_tfvars_path: "./terraform.tfvars" aws-terraform-prod: name: Run AWS Terraform (Prod) @@ -91,6 +105,12 @@ jobs: role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME_NONPROD }} role-session-name: terraform-gha + - name: Generate Amplify Environment Variables (Staging) + uses: ./.github/actions/amplify-environment-variable-generation + with: + environments: "prod" + github_token: ${{ secrets.PERPS_HEDGER_CONFIG_GITHUB_TOKEN }} + - name: Run AWS Terraform uses: ./.github/actions/aws-terraform with: @@ -103,6 +123,7 @@ jobs: branch: ${GITHUB_REF##*/} amplify_custom_domain: ${{ secrets.AMPLIFY_CUSTOM_DOMAIN_PROD }} amplify_basic_auth_credentials: ${{ secrets.AMPLIFY_BASIC_AUTH_CREDENTIALS_PROD }} + additional_tfvars_path: "./terraform.tfvars" check-for-failure: name: Check for failure diff --git a/infrastructure/environments/dev/dev.tfvars b/infrastructure/environments/dev/dev.tfvars index f5ee604..c267086 100644 --- a/infrastructure/environments/dev/dev.tfvars +++ b/infrastructure/environments/dev/dev.tfvars @@ -4,26 +4,7 @@ environment_name = "dev" amplify_environment_variables = { "AMPLIFY_DIFF_DEPLOY" = "false" "AMPLIFY_MONOREPO_APP_ROOT" = "apps/Cloverfield" - "NEXT_PUBLIC_ARBITRUM_HEDGER_URL" = "www.dev.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/" - "NEXT_PUBLIC_ARBITRUM_INSTANT_BASE_URL" = "www.dev.perps-streaming.com/instant/v1/42161a/0xdB91D232E93969130272De309d3d914547604426/" - "NEXT_PUBLIC_ARBITRUM_MULTIACCOUNT" = "0x6273242a7E88b3De90822b31648C212215caaFE4" - "NEXT_PUBLIC_ARBITRUM_PARTY_B" = "0xdB91D232E93969130272De309d3d914547604426" - "NEXT_PUBLIC_BASE_HEDGER_URL" = "www.dev.perps-streaming.com/v1/8453a/0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86/" - "NEXT_PUBLIC_BASE_MULTIACCOUNT" = "0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86" - "NEXT_PUBLIC_BASE_PARTY_B" = "0xB6e3b44975f2966707a91747F89D2002ff8d62Db" - "NEXT_PUBLIC_BSC_HEDGER_URL" = "www.dev.perps-streaming.com/v1/56a/0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3/" - "NEXT_PUBLIC_BSC_INSTANT_BASE_URL" = "www.dev.perps-streaming.com/instant/v1/56a/0xdF077F5f52bc41A9072F9d0e5fB281770bCD1142/" - "NEXT_PUBLIC_BSC_MULTIACCOUNT" = "0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3" - "NEXT_PUBLIC_BSC_PARTY_B" = "0xdF077F5f52bc41A9072F9d0e5fB281770bCD1142" "NEXT_PUBLIC_INFURA_KEY" = "a4bbaca8728a48a19acc9313ae5cc787" - "NEXT_PUBLIC_MANTLE_HEDGER_URL" = "www.dev.perps-streaming.com/v1/5000a/0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456/" - "NEXT_PUBLIC_MANTLE_INSTANT_BASE_URL" = "www.dev.perps-streaming.com/instant/v1/5000a/0xF9e39B4B30E26c18d2a725c0397Ed5A925efE46B/" - "NEXT_PUBLIC_MANTLE_MULTIACCOUNT" = "0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456" - "NEXT_PUBLIC_MANTLE_PARTY_B" = "0xF9e39B4B30E26c18d2a725c0397Ed5A925efE46B" - "NEXT_PUBLIC_MODE_HEDGER_URL" = "www.dev.perps-streaming.com/v1/34443a/0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904/" - "NEXT_PUBLIC_MODE_INSTANT_BASE_URL" = "www.dev.perps-streaming.com/instant/v1/34443a/0x78E76Ac7fEc050cA785c19fFADDF57137b890543/" - "NEXT_PUBLIC_MODE_MULTIACCOUNT" = "0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904" - "NEXT_PUBLIC_MODE_PARTY_B" = "0x78E76Ac7fEc050cA785c19fFADDF57137b890543" "NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID" = "d78971d2807551a41e4caffa9ffa58c0" } # AWS IAM diff --git a/infrastructure/environments/prod/prod.tfvars b/infrastructure/environments/prod/prod.tfvars index ecdebb3..cd04304 100644 --- a/infrastructure/environments/prod/prod.tfvars +++ b/infrastructure/environments/prod/prod.tfvars @@ -1,24 +1,10 @@ +# General environment_name = "prod" # AWS Amplify amplify_environment_variables = { "AMPLIFY_DIFF_DEPLOY" = "false" "AMPLIFY_MONOREPO_APP_ROOT" = "apps/Cloverfield" - "NEXT_PUBLIC_ARBITRUM_HEDGER_URL" = "www.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/" - "NEXT_PUBLIC_ARBITRUM_MULTIACCOUNT" = "0x6273242a7E88b3De90822b31648C212215caaFE4" - "NEXT_PUBLIC_ARBITRUM_PARTY_B" = "0x00c069d68bc7420740460DBC3cc3fFF9b3742421" - "NEXT_PUBLIC_BASE_HEDGER_URL" = "www.perps-streaming.com/v1/8453a/0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86//" - "NEXT_PUBLIC_BASE_MULTIACCOUNT" = "0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86" - "NEXT_PUBLIC_BASE_PARTY_B" = "0x1EcAbF0Eba136920677C9575FAccee36f30592cf" - "NEXT_PUBLIC_BSC_HEDGER_URL" = "www.perps-streaming.com/v1/56a/0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3/" - "NEXT_PUBLIC_BSC_MULTIACCOUNT" = "0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3" - "NEXT_PUBLIC_BSC_PARTY_B" = "0xD5A075C88A4188d666FA1e4051913BE6782982DA" "NEXT_PUBLIC_INFURA_KEY" = "a4bbaca8728a48a19acc9313ae5cc787" - "NEXT_PUBLIC_MANTLE_HEDGER_URL" = "www.perps-streaming.com/v1/5000a/0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456/" - "NEXT_PUBLIC_MANTLE_MULTIACCOUNT" = "0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456f" - "NEXT_PUBLIC_MANTLE_PARTY_B" = "0x614bB1F3e0Ae5A393979468ED89088F05277312c" - "NEXT_PUBLIC_MODE_HEDGER_URL" = "www.perps-streaming.com/v1/34443a/0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904/" - "NEXT_PUBLIC_MODE_MULTIACCOUNT" = "0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904" - "NEXT_PUBLIC_MODE_PARTY_B" = "0x87FC464fa528260F1eeaB94FA20F73FeD8536Eb7" "NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID" = "d78971d2807551a41e4caffa9ffa58c0" } # AWS IAM diff --git a/infrastructure/environments/staging/staging.tfvars b/infrastructure/environments/staging/staging.tfvars index 760289c..1eb0cb4 100644 --- a/infrastructure/environments/staging/staging.tfvars +++ b/infrastructure/environments/staging/staging.tfvars @@ -1,28 +1,10 @@ +# General environment_name = "staging" # AWS Amplify amplify_environment_variables = { "AMPLIFY_DIFF_DEPLOY" = "false" "AMPLIFY_MONOREPO_APP_ROOT" = "apps/Cloverfield" - "NEXT_PUBLIC_ARBITRUM_HEDGER_URL" = "www.staging.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/" - "NEXT_PUBLIC_ARBITRUM_INSTANT_BASE_URL" = "www.staging.perps-streaming.com/instant/v1/42161a/0x141269E29a770644C34e05B127AB621511f20109/" - "NEXT_PUBLIC_ARBITRUM_MULTIACCOUNT" = "0x6273242a7E88b3De90822b31648C212215caaFE4" - "NEXT_PUBLIC_ARBITRUM_PARTY_B" = "0x7D387771f6E23f353a4afCE21af521875C0825D0" - "NEXT_PUBLIC_BASE_HEDGER_URL" = "www.staging.perps-streaming.com/v1/8453a/0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86/" - "NEXT_PUBLIC_BASE_MULTIACCOUNT" = "0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86" - "NEXT_PUBLIC_BASE_PARTY_B" = "0xFC4aC3aF357eBe6d556DCD72453E9B30F6dC6873" - "NEXT_PUBLIC_BSC_HEDGER_URL" = "www.staging.perps-streaming.com/v1/56a/0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3/" - "NEXT_PUBLIC_BSC_INSTANT_BASE_URL" = "www.staging.perps-streaming.com/instant/v1/56a/0xdfeD11fE4af63B059EDBBDf53e9C633B331ed432/" - "NEXT_PUBLIC_BSC_MULTIACCOUNT" = "0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3" - "NEXT_PUBLIC_BSC_PARTY_B" = "0xdfeD11fE4af63B059EDBBDf53e9C633B331ed432" "NEXT_PUBLIC_INFURA_KEY" = "a4bbaca8728a48a19acc9313ae5cc787" - "NEXT_PUBLIC_MANTLE_HEDGER_URL" = "www.staging.perps-streaming.com/v1/5000a/0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456/" - "NEXT_PUBLIC_MANTLE_INSTANT_BASE_URL" = "www.staging.perps-streaming.com/instant/v1/5000a/0x12De0352dd4187AF5797F5147c4179F9624346E2/" - "NEXT_PUBLIC_MANTLE_MULTIACCOUNT" = "0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456" - "NEXT_PUBLIC_MANTLE_PARTY_B" = "0x12De0352dd4187AF5797F5147c4179F9624346E2" - "NEXT_PUBLIC_MODE_HEDGER_URL" = "www.staging.perps-streaming.com/v1/34443a/0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904/" - "NEXT_PUBLIC_MODE_INSTANT_BASE_URL" = "www.staging.perps-streaming.com/instant/v1/34443a/0x3f1913e75A892310EF0C8D519F427ADbCA4373e0/" - "NEXT_PUBLIC_MODE_MULTIACCOUNT" = "0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904" - "NEXT_PUBLIC_MODE_PARTY_B" = "0x3f1913e75A892310EF0C8D519F427ADbCA4373e0" "NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID" = "d78971d2807551a41e4caffa9ffa58c0" } # AWS IAM From c5b2d04453df46a360a1a952c7e4e0ccaebdcfa0 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 12:16:05 +0000 Subject: [PATCH 02/22] Remove terraform.tfvars. --- .../terraform.tfvars | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars deleted file mode 100644 index ec1608c..0000000 --- a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars +++ /dev/null @@ -1,20 +0,0 @@ -amplify_remote_environment_variables = { - "NEXT_PUBLIC_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_HEDGER_URL" = "www.dev.perps-streaming.com/v1/56a/0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3/" -"NEXT_PUBLIC_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_MULTIACCOUNT" = "0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3" -"NEXT_PUBLIC_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_PARTY_B" = "0xdF077F5f52bc41A9072F9d0e5fB281770bCD1142" - "NEXT_PUBLIC_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_HEDGER_URL" = "www.dev.perps-streaming.com/v1/5000a/0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456/" -"NEXT_PUBLIC_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_MULTIACCOUNT" = "0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456" -"NEXT_PUBLIC_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_PARTY_B" = "0xF9e39B4B30E26c18d2a725c0397Ed5A925efE46B" - "NEXT_PUBLIC_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_HEDGER_URL" = "www.dev.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/" -"NEXT_PUBLIC_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_MULTIACCOUNT" = "0x6273242a7E88b3De90822b31648C212215caaFE4" -"NEXT_PUBLIC_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_PARTY_B" = "0xdB91D232E93969130272De309d3d914547604426" -"NEXT_PUBLIC_42161a_0x141269E29a770644C34e05B127AB621511f20109_HEDGER_URL" = "www.dev.perps-streaming.com/v1/42161a/0x141269E29a770644C34e05B127AB621511f20109/" -"NEXT_PUBLIC_42161a_0x141269E29a770644C34e05B127AB621511f20109_MULTIACCOUNT" = "0x141269E29a770644C34e05B127AB621511f20109" -"NEXT_PUBLIC_42161a_0x141269E29a770644C34e05B127AB621511f20109_PARTY_B" = "0xdB91D232E93969130272De309d3d914547604426" - "NEXT_PUBLIC_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_HEDGER_URL" = "www.dev.perps-streaming.com/v1/34443a/0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904/" -"NEXT_PUBLIC_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_MULTIACCOUNT" = "0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904" -"NEXT_PUBLIC_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_PARTY_B" = "0x78E76Ac7fEc050cA785c19fFADDF57137b890543" - "NEXT_PUBLIC_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_HEDGER_URL" = "www.dev.perps-streaming.com/v1/8453a/0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86/" -"NEXT_PUBLIC_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_MULTIACCOUNT" = "0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86" -"NEXT_PUBLIC_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_PARTY_B" = "0xB6e3b44975f2966707a91747F89D2002ff8d62Db" -} \ No newline at end of file From c74c1d8fed172ab5d27112904b144455dc27b0b6 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 12:17:42 +0000 Subject: [PATCH 03/22] Update substituation. --- .../actions/amplify-environment-variable-generation/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index 38341cb..f094c37 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -21,7 +21,7 @@ runs: # GitHub setup and clone Perps Hedger Config repo git config --global credential.helper store - echo "https://x-access-token:${github.event.inputs.github_token}@github.com" > ~/.git-credentials + echo "https://x-access-token:${{github.event.inputs.github_token}}@github.com" > ~/.git-credentials git clone -b ${target_branch} https://github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file From f855f2e04ec937c5692b332116c0396c1ee859a0 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 12:20:18 +0000 Subject: [PATCH 04/22] Update workflow. --- .../amplify-environment-variable-generation/action.yml | 2 +- .github/workflows/symmio_frontend_sdk.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index f094c37..be217df 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -22,7 +22,7 @@ runs: # GitHub setup and clone Perps Hedger Config repo git config --global credential.helper store echo "https://x-access-token:${{github.event.inputs.github_token}}@github.com" > ~/.git-credentials - git clone -b ${target_branch} https://github.com/orbs-network/perps-hedger-config.git + git clone -b ${{target_branch}} https://github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file python -m venv venv diff --git a/.github/workflows/symmio_frontend_sdk.yml b/.github/workflows/symmio_frontend_sdk.yml index 98c615d..b9a7ce6 100644 --- a/.github/workflows/symmio_frontend_sdk.yml +++ b/.github/workflows/symmio_frontend_sdk.yml @@ -40,7 +40,7 @@ jobs: - name: Generate Amplify Environment Variables (Dev) uses: ./.github/actions/amplify-environment-variable-generation with: - environments: "dev" + environment: "dev" github_token: ${{ secrets.PERPS_HEDGER_CONFIG_GITHUB_TOKEN }} - name: Run AWS Terraform @@ -74,7 +74,7 @@ jobs: - name: Generate Amplify Environment Variables (Dev) uses: ./.github/actions/amplify-environment-variable-generation with: - environments: "staging" + environment: "staging" github_token: ${{ secrets.PERPS_HEDGER_CONFIG_GITHUB_TOKEN }} - name: Run AWS Terraform @@ -108,7 +108,7 @@ jobs: - name: Generate Amplify Environment Variables (Staging) uses: ./.github/actions/amplify-environment-variable-generation with: - environments: "prod" + environment: "prod" github_token: ${{ secrets.PERPS_HEDGER_CONFIG_GITHUB_TOKEN }} - name: Run AWS Terraform From 7d3d72e4152d235406a37952ac2bb4512c224cf5 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 12:21:22 +0000 Subject: [PATCH 05/22] Update workflow. --- .../actions/amplify-environment-variable-generation/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index be217df..fe4815e 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -22,7 +22,7 @@ runs: # GitHub setup and clone Perps Hedger Config repo git config --global credential.helper store echo "https://x-access-token:${{github.event.inputs.github_token}}@github.com" > ~/.git-credentials - git clone -b ${{target_branch}} https://github.com/orbs-network/perps-hedger-config.git + git clone -b $target_branch https://github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file python -m venv venv From 932e7fb2991f02dbcfe1fa22d835c1d086dc1e75 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 12:22:49 +0000 Subject: [PATCH 06/22] Update workflow. --- .../amplify-environment-variable-generation/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index fe4815e..ba78a85 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -16,8 +16,8 @@ runs: run: | # Variables environment="${{ inputs.environment }}" - config_file_name=${{ github.event.inputs.environment == 'dev' && 'development.json' || github.event.inputs.environment }}.json - target_branch=${{ github.event.inputs.environment == 'prod' && 'main' || github.event.inputs.environment }} + config_file_name=${{ inputs.environment == 'dev' && 'development.json' || inputs.environment }}.json + target_branch=${{ inputs.environment == 'prod' && 'main' || inputs.environment }} # GitHub setup and clone Perps Hedger Config repo git config --global credential.helper store From 1411f8ed7bbc3920e81a8a1531e618a2f97d3696 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 12:24:54 +0000 Subject: [PATCH 07/22] Update workflow. --- .../actions/amplify-environment-variable-generation/action.yml | 2 +- infrastructure/amplify.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index ba78a85..baaa4cb 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -21,7 +21,7 @@ runs: # GitHub setup and clone Perps Hedger Config repo git config --global credential.helper store - echo "https://x-access-token:${{github.event.inputs.github_token}}@github.com" > ~/.git-credentials + echo "https://x-access-token:${{inputs.github_token}@github.com" > ~/.git-credentials git clone -b $target_branch https://github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file diff --git a/infrastructure/amplify.tf b/infrastructure/amplify.tf index 8ae77b3..7b54dec 100644 --- a/infrastructure/amplify.tf +++ b/infrastructure/amplify.tf @@ -14,7 +14,7 @@ resource "aws_amplify_app" "symmio_frontend_sdk" { target = custom_rule.value.target } } - environment_variables = merge(var.amplify_environment_variables, var.amplify_remote_environment_variables) + environment_variables = merge(var.amplify_remote_environment_variables, var.amplify_environment_variables) iam_service_role_arn = aws_iam_role.symmio_frontend_sdk_role.arn platform = var.amplify_platform } From f6137e85ba56b23287b811204ef461a97b61e97f Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 12:26:48 +0000 Subject: [PATCH 08/22] Update workflow. --- .../actions/amplify-environment-variable-generation/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index baaa4cb..1c94504 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -21,7 +21,7 @@ runs: # GitHub setup and clone Perps Hedger Config repo git config --global credential.helper store - echo "https://x-access-token:${{inputs.github_token}@github.com" > ~/.git-credentials + echo "https://x-access-token:${{inputs.github_token}}@github.com" > ~/.git-credentials git clone -b $target_branch https://github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file From 0330d306f3f9804149c485951b30a71fc5b7d13a Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 12:28:44 +0000 Subject: [PATCH 09/22] Update workflow. --- .../actions/amplify-environment-variable-generation/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index 1c94504..1b39ec1 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -16,7 +16,7 @@ runs: run: | # Variables environment="${{ inputs.environment }}" - config_file_name=${{ inputs.environment == 'dev' && 'development.json' || inputs.environment }}.json + config_file_name=${{ inputs.environment == 'dev' && 'development' || inputs.environment }}.json target_branch=${{ inputs.environment == 'prod' && 'main' || inputs.environment }} # GitHub setup and clone Perps Hedger Config repo From c8affa6afb566be0718948c1ad38e7268a20d3ec Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 13:04:18 +0000 Subject: [PATCH 10/22] Update workflow. --- .../amplify-environment-variable-generation/action.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index 1b39ec1..3e513bc 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -19,10 +19,8 @@ runs: config_file_name=${{ inputs.environment == 'dev' && 'development' || inputs.environment }}.json target_branch=${{ inputs.environment == 'prod' && 'main' || inputs.environment }} - # GitHub setup and clone Perps Hedger Config repo - git config --global credential.helper store - echo "https://x-access-token:${{inputs.github_token}}@github.com" > ~/.git-credentials - git clone -b $target_branch https://github.com/orbs-network/perps-hedger-config.git + # Clone Perps Hedger Config GitHub repo + git clone https://${{inputs.github_token}}@github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file python -m venv venv From 3705caaa73b19a9a3ac72a324fd41be9dff10f95 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 13:07:55 +0000 Subject: [PATCH 11/22] Update workflow. --- .../actions/amplify-environment-variable-generation/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index 3e513bc..78efbbd 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -20,7 +20,7 @@ runs: target_branch=${{ inputs.environment == 'prod' && 'main' || inputs.environment }} # Clone Perps Hedger Config GitHub repo - git clone https://${{inputs.github_token}}@github.com/orbs-network/perps-hedger-config.git + git clone -b $target_branch https://${{inputs.github_token}}@github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file python -m venv venv From ab8412803ce283504432cf8c6f5b1cb607861fd8 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 13:09:24 +0000 Subject: [PATCH 12/22] Update workflow. --- .../amplify-environment-variable-generation/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index 78efbbd..6e37303 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -20,7 +20,7 @@ runs: target_branch=${{ inputs.environment == 'prod' && 'main' || inputs.environment }} # Clone Perps Hedger Config GitHub repo - git clone -b $target_branch https://${{inputs.github_token}}@github.com/orbs-network/perps-hedger-config.git + git clone -b $target_branch https://$GITHUB_TOKEN@github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file python -m venv venv @@ -29,4 +29,6 @@ runs: python amplify-environment-variable-generation.py --config ./perps-hedger-config/appconfig/$config_file_name --environment $environment mv terraform.tfvars ../../../../infrastructure/terraform.tfvars shell: bash + env: + GITHUB_TOKEN: ${{ inputs.github_token }} working-directory: ./.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation From f50f70fc3d202775e8ab43ce74d7c432d7ac03d3 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 13:15:45 +0000 Subject: [PATCH 13/22] Update workflow. --- .../amplify-environment-variable-generation/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index 6e37303..c2f0656 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -20,7 +20,7 @@ runs: target_branch=${{ inputs.environment == 'prod' && 'main' || inputs.environment }} # Clone Perps Hedger Config GitHub repo - git clone -b $target_branch https://$GITHUB_TOKEN@github.com/orbs-network/perps-hedger-config.git + git clone -b $target_branch https://${{ inputs.github_token }}@github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file python -m venv venv @@ -29,6 +29,4 @@ runs: python amplify-environment-variable-generation.py --config ./perps-hedger-config/appconfig/$config_file_name --environment $environment mv terraform.tfvars ../../../../infrastructure/terraform.tfvars shell: bash - env: - GITHUB_TOKEN: ${{ inputs.github_token }} working-directory: ./.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation From 4b8e4f24eb12a4990435ae3454ff56a037cfe421 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 13:18:00 +0000 Subject: [PATCH 14/22] Update workflow. --- .../actions/amplify-environment-variable-generation/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index c2f0656..44d9a9b 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -20,7 +20,7 @@ runs: target_branch=${{ inputs.environment == 'prod' && 'main' || inputs.environment }} # Clone Perps Hedger Config GitHub repo - git clone -b $target_branch https://${{ inputs.github_token }}@github.com/orbs-network/perps-hedger-config.git + git clone -b $target_branch https://oauth2:${{ inputs.github_token }}@github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file python -m venv venv From a54d5f27b2da12b7770fd3ffe05083253828ba30 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 14:59:22 +0000 Subject: [PATCH 15/22] Update workflow. --- .../actions/amplify-environment-variable-generation/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/amplify-environment-variable-generation/action.yml b/.github/actions/amplify-environment-variable-generation/action.yml index 44d9a9b..c2f0656 100644 --- a/.github/actions/amplify-environment-variable-generation/action.yml +++ b/.github/actions/amplify-environment-variable-generation/action.yml @@ -20,7 +20,7 @@ runs: target_branch=${{ inputs.environment == 'prod' && 'main' || inputs.environment }} # Clone Perps Hedger Config GitHub repo - git clone -b $target_branch https://oauth2:${{ inputs.github_token }}@github.com/orbs-network/perps-hedger-config.git + git clone -b $target_branch https://${{ inputs.github_token }}@github.com/orbs-network/perps-hedger-config.git # Python setup and generate environment variables tfvars file python -m venv venv From 3a871676934644f8a2daa27016840147b7e30206 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 15:03:07 +0000 Subject: [PATCH 16/22] Remove linting. --- .../amplify-environment-variable-generation.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py index 0f5a79c..bd7b9bd 100644 --- a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py +++ b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py @@ -33,12 +33,9 @@ def generate_templates(symm_id: str, hedger_addresses: list[str], party_b_addres for hedger_address in hedger_addresses: templates = [ - f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_HEDGER_URL" = "www.{ - environment}perps-streaming.com/v1/{symm_id}/{hedger_address}/"', - f'"NEXT_PUBLIC_{symm_id}_{ - hedger_address}_MULTIACCOUNT" = "{hedger_address}"', - f'"NEXT_PUBLIC_{symm_id}_{ - hedger_address}_PARTY_B" = "{party_b_address}"' + f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_HEDGER_URL" = "www.{environment}perps-streaming.com/v1/{symm_id}/{hedger_address}/"', + f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_MULTIACCOUNT" = "{hedger_address}"', + f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_PARTY_B" = "{party_b_address}"' ] all_templates.extend(templates) From b7a5f6b426c87fc97d5dbbd5dc7073a40f971eba Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 15:05:50 +0000 Subject: [PATCH 17/22] Update workflow. --- .github/actions/aws-terraform/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/aws-terraform/action.yml b/.github/actions/aws-terraform/action.yml index 722bd3b..2633023 100644 --- a/.github/actions/aws-terraform/action.yml +++ b/.github/actions/aws-terraform/action.yml @@ -70,7 +70,7 @@ runs: run: | export TF_VAR_environment=${environment} ${{ github.action_path }}/box.sh "Running Terraform plan" - plan_command="terraform plan -var-file='./environments/${{ inputs.environment }}/${{ inputs.environment }}.tfvars' $([ -n "${additional_tfvars_path}" ] && echo "-var-file=${additional_tfvars_path}") -var 'region=${{ inputs.aws_deploy_region }}' -var 'amplify_custom_domain=${{inputs.amplify_custom_domain}}' -var 'amplify_basic_auth_credentials=${{inputs.amplify_basic_auth_credentials}}' -input=false -out=plan.out" + plan_command="terraform plan -var-file='./environments/${{ inputs.environment }}/${{ inputs.environment }}.tfvars' $([ -n "${input.additional_tfvars_path}" ] && echo "-var-file=${input.additional_tfvars_path}") -var 'region=${{ inputs.aws_deploy_region }}' -var 'amplify_custom_domain=${{inputs.amplify_custom_domain}}' -var 'amplify_basic_auth_credentials=${{inputs.amplify_basic_auth_credentials}}' -input=false -out=plan.out" if [ "${{ github.event_name }}" == "workflow_dispatch" ] || [ "${{ inputs.branch }}" == "develop" ]; then eval $plan_command else From 13c7519eeb0ec0187433fc003cae75a0e1e144fe Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 15:07:19 +0000 Subject: [PATCH 18/22] Update workflow. --- .github/actions/aws-terraform/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/aws-terraform/action.yml b/.github/actions/aws-terraform/action.yml index 2633023..8c01a9a 100644 --- a/.github/actions/aws-terraform/action.yml +++ b/.github/actions/aws-terraform/action.yml @@ -70,7 +70,7 @@ runs: run: | export TF_VAR_environment=${environment} ${{ github.action_path }}/box.sh "Running Terraform plan" - plan_command="terraform plan -var-file='./environments/${{ inputs.environment }}/${{ inputs.environment }}.tfvars' $([ -n "${input.additional_tfvars_path}" ] && echo "-var-file=${input.additional_tfvars_path}") -var 'region=${{ inputs.aws_deploy_region }}' -var 'amplify_custom_domain=${{inputs.amplify_custom_domain}}' -var 'amplify_basic_auth_credentials=${{inputs.amplify_basic_auth_credentials}}' -input=false -out=plan.out" + plan_command="terraform plan -var-file='./environments/${{ inputs.environment }}/${{ inputs.environment }}.tfvars' $([ -n "${{input.additional_tfvars_path}}" ] && echo "-var-file=${{input.additional_tfvars_path}}") -var 'region=${{ inputs.aws_deploy_region }}' -var 'amplify_custom_domain=${{inputs.amplify_custom_domain}}' -var 'amplify_basic_auth_credentials=${{inputs.amplify_basic_auth_credentials}}' -input=false -out=plan.out" if [ "${{ github.event_name }}" == "workflow_dispatch" ] || [ "${{ inputs.branch }}" == "develop" ]; then eval $plan_command else From 840ddd745a89165c205047326ead5e658a4f2c69 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 15:08:14 +0000 Subject: [PATCH 19/22] Update workflow. --- .github/actions/aws-terraform/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/aws-terraform/action.yml b/.github/actions/aws-terraform/action.yml index 8c01a9a..f3e0710 100644 --- a/.github/actions/aws-terraform/action.yml +++ b/.github/actions/aws-terraform/action.yml @@ -70,7 +70,7 @@ runs: run: | export TF_VAR_environment=${environment} ${{ github.action_path }}/box.sh "Running Terraform plan" - plan_command="terraform plan -var-file='./environments/${{ inputs.environment }}/${{ inputs.environment }}.tfvars' $([ -n "${{input.additional_tfvars_path}}" ] && echo "-var-file=${{input.additional_tfvars_path}}") -var 'region=${{ inputs.aws_deploy_region }}' -var 'amplify_custom_domain=${{inputs.amplify_custom_domain}}' -var 'amplify_basic_auth_credentials=${{inputs.amplify_basic_auth_credentials}}' -input=false -out=plan.out" + plan_command="terraform plan -var-file='./environments/${{ inputs.environment }}/${{ inputs.environment }}.tfvars' $([ -n "${{inputs.additional_tfvars_path}}" ] && echo "-var-file=${{inputs.additional_tfvars_path}}") -var 'region=${{ inputs.aws_deploy_region }}' -var 'amplify_custom_domain=${{inputs.amplify_custom_domain}}' -var 'amplify_basic_auth_credentials=${{inputs.amplify_basic_auth_credentials}}' -input=false -out=plan.out" if [ "${{ github.event_name }}" == "workflow_dispatch" ] || [ "${{ inputs.branch }}" == "develop" ]; then eval $plan_command else From ee6b1f99e36c5bd05cd0d99043c24dcd42dd9bb4 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Wed, 18 Dec 2024 16:53:55 +0000 Subject: [PATCH 20/22] Update ENV naming. --- .../amplify-environment-variable-generation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py index bd7b9bd..b9dc2c0 100644 --- a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py +++ b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py @@ -33,9 +33,9 @@ def generate_templates(symm_id: str, hedger_addresses: list[str], party_b_addres for hedger_address in hedger_addresses: templates = [ - f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_HEDGER_URL" = "www.{environment}perps-streaming.com/v1/{symm_id}/{hedger_address}/"', - f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_MULTIACCOUNT" = "{hedger_address}"', - f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_PARTY_B" = "{party_b_address}"' + f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_HEDGER_URL" = "www.{environment}perps-streaming.com/v1/{symm_id}/{hedger_address}/"', + f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_MULTIACCOUNT" = "{hedger_address}"', + f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_PARTY_B" = "{party_b_address}"' ] all_templates.extend(templates) From 96771f905577e8d034fba369e02ef1cf9eea2b38 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Thu, 19 Dec 2024 10:23:26 +0000 Subject: [PATCH 21/22] Add symm_core_address. --- ...amplify-environment-variable-generation.py | 8 +- .../development.json | 816 ------------------ .../terraform.tfvars | 20 + 3 files changed, 25 insertions(+), 819 deletions(-) delete mode 100644 .github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/development.json create mode 100644 .github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py index b9dc2c0..ff7ff88 100644 --- a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py +++ b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py @@ -22,12 +22,13 @@ def main(): for symm_id, addresses in symm_accounts.items(): hedger_addresses = addresses party_b_address = config['perSymmId'][symm_id]['symm']['partyBAddress'] + symm_core_address = config['perSymmId'][symm_id]['symm']['symmCoreAddress'] env_strings.append(generate_templates( - symm_id, hedger_addresses, party_b_address, args.environment)) + symm_id, hedger_addresses, party_b_address, symm_core_address, args.environment)) write_tfvars_file(env_strings) -def generate_templates(symm_id: str, hedger_addresses: list[str], party_b_address: str, environment: str) -> str: +def generate_templates(symm_id: str, hedger_addresses: list[str], party_b_address: str, symm_core_address: str, environment: str) -> str: environment = environment + '.' if environment != 'prod' else '' all_templates = [] @@ -35,7 +36,8 @@ def generate_templates(symm_id: str, hedger_addresses: list[str], party_b_addres templates = [ f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_HEDGER_URL" = "www.{environment}perps-streaming.com/v1/{symm_id}/{hedger_address}/"', f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_MULTIACCOUNT" = "{hedger_address}"', - f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_PARTY_B" = "{party_b_address}"' + f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_PARTY_B" = "{party_b_address}"' + f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_DIAMOND_ADDRESS" = "{symm_core_address}"' ] all_templates.extend(templates) diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/development.json b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/development.json deleted file mode 100644 index 94d5609..0000000 --- a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/development.json +++ /dev/null @@ -1,816 +0,0 @@ -{ - "globals": { - "rabbit": { - "maxTimeoutMs": 20000, - "dedupLockTtlMs": 60000 - }, - "privateKeyLocker": { - "lockTtlMs": 300000, - "waitToLockTimeoutMs": 360000 - }, - "infra": { - "remoteConfigPollingIntervalMs": 30000 - }, - "heartbeat": { - "intervalMs": 2000, - "minAllowedUptimeToConsiderHealthySec": 10 - }, - "monitoringService": { - "intervalMs": 120000, - "chainDbSyncLagCheckIntervalMs": 300000, - "gasBalanceCheckIntervalMs": 120000 - }, - "binanceCache": { - "incomeHistoryProcessorIntervalMs": 600000, - "maxBinanceReadOrderCalls": 20, - "getAllOrdersLimit": 500, - "fetchSafetyMarginMs": 3600000, - "binanceOrderUpdateDebounceMs": 100, - "binancePositionUpdateDebounceMs": 20, - "backupSyncIntervalMs": 60000, - "backupSyncLockTtlMs": 60000, - "databaseName": "binance-cache", - "wsEventLockTtlMs": 10000, - "incomeHistoryProcessorEnabled": false, - "notionalAndLeverageBracketsPollIntervalSeconds": 3600, - "depositHandlerEnabled": false, - "depositHandlerBalanceThreshold": 10, - "depositHandlerPollIntervalMs": 300000, - "depositHandlerUsdtUsdcLimitOrderPrice": 0.999 - }, - "instantTrading": { - "databaseName": "instant-trading", - "enabled": true, - "validateApiKey": false, - "validateAccessToken": true, - "logRequests": false, - "instantOpensEnabled": true - }, - "chainDBSync": { - "databaseName": "chain-db-sync", - "wsEventLockTtlMs": 10000, - "backupSyncLockTtlMs": 60000 - }, - "mongodb": { - "connectTimeoutSec": 5, - "persistBatchSize": 1000 - }, - "binance": { - "accountLeverage": 20, - "minBrokerBalance": 500, - "maxBrokerLeverage": 3, - "maxBrokerMarginRatio": 0.4, - "deadlineSpreadMs": 3600000, - "leverages": { - "params": { - "profiles": { - "default": { - "leverage": 4 - } - }, - "symbols": {} - }, - "isEnabled": false - }, - "splitBigOrdersEnabled": false, - "artificialOrderSplitFactor": 0.8, - "capitalControls": { - "perCategory": {}, - "perSymbol": { - "profiles": { - "default": { - "notionalCap": 10000000, - "notionalPercentageCap": 50 - } - }, - "symbols": {} - } - }, - "leveragePerSymbolDisabled": false - }, - "business": { - "profiles": { - "defaultUI": { - "defaultProfile": { - "spreadBPS": 5, - "maxPositionNotionalUSD": 1400000, - "minQuotePrincipalUSD": 20, - "minQuoteNotionalUSD": 20, - "maxLeverage": 25, - "maxQuoteNotionalUSD": 150000, - "minLfPortionOfMm": 0.004, - "maxFundingRate": 200 - }, - "btc": { - "spreadBPS": 5, - "maxPositionNotionalUSD": 2100000, - "minQuotePrincipalUSD": 240, - "minQuoteNotionalUSD": 240, - "maxLeverage": 60, - "maxQuoteNotionalUSD": 1000000, - "minLfPortionOfMm": 0.004, - "maxFundingRate": 200 - }, - "eth": { - "spreadBPS": 5, - "maxPositionNotionalUSD": 2100000, - "minQuotePrincipalUSD": 60, - "minQuoteNotionalUSD": 60, - "maxLeverage": 60, - "maxQuoteNotionalUSD": 1000000, - "minLfPortionOfMm": 0.004, - "maxFundingRate": 200 - }, - "majors": { - "spreadBPS": 5, - "maxPositionNotionalUSD": 1400000, - "minQuotePrincipalUSD": 20, - "minQuoteNotionalUSD": 20, - "maxLeverage": 50, - "maxQuoteNotionalUSD": 1000000, - "minLfPortionOfMm": 0.004, - "maxFundingRate": 200 - }, - "altcoins": { - "spreadBPS": 5, - "maxPositionNotionalUSD": 1400000, - "minQuotePrincipalUSD": 20, - "minQuoteNotionalUSD": 20, - "maxLeverage": 40, - "maxQuoteNotionalUSD": 1000000, - "minLfPortionOfMm": 0.004, - "maxFundingRate": 200 - }, - "shitcoins": { - "spreadBPS": 5, - "maxPositionNotionalUSD": 1400000, - "minQuotePrincipalUSD": 20, - "minQuoteNotionalUSD": 20, - "maxLeverage": 8, - "maxQuoteNotionalUSD": 150000, - "minLfPortionOfMm": 0.004, - "maxFundingRate": 200 - } - } - }, - "symbols": { - "defaultUI": { - "BTCUSDT": "btc", - "ETHUSDT": "eth", - "LTCUSDT": "majors", - "BCHUSDT": "majors", - "ETCUSDT": "majors", - "LINKUSDT": "majors", - "XRPUSDT": "majors", - "EOSUSDT": "majors", - "ADAUSDT": "majors", - "BNBUSDT": "majors", - "DOGEUSDT": "majors", - "TRXUSDT": "altcoins", - "ATOMUSDT": "altcoins", - "VETUSDT": "altcoins", - "MKRUSDT": "altcoins", - "DOTUSDT": "altcoins", - "SOLUSDT": "altcoins", - "UNIUSDT": "altcoins", - "AVAXUSDT": "altcoins", - "FTMUSDT": "altcoins", - "FILUSDT": "altcoins", - "MATICUSDT": "altcoins", - "AXSUSDT": "altcoins", - "SANDUSDT": "altcoins", - "MANAUSDT": "altcoins", - "1000SHIBUSDT": "altcoins", - "MASKUSDT": "altcoins", - "DYDXUSDT": "altcoins", - "GALAUSDT": "altcoins", - "APEUSDT": "altcoins", - "OPUSDT": "altcoins", - "LDOUSDT": "altcoins", - "APTUSDT": "altcoins", - "ARBUSDT": "altcoins", - "SUIUSDT": "altcoins", - "CFXUSDT": "altcoins", - "USDCUSDT": "altcoins", - "NEOUSDT": "altcoins", - "1000BONKUSDT": "altcoins", - "PYTHUSDT": "altcoins", - "ILVUSDT": "altcoins", - "MEMEUSDT": "altcoins", - "BEAMXUSDT": "altcoins", - "USTCUSDT": "altcoins", - "SEIUSDT": "altcoins", - "JTOUSDT": "altcoins", - "TRBUSDT": "altcoins", - "ENJUSDT": "altcoins", - "FLMUSDT": "shitcoins", - "STMXUSDT": "shitcoins", - "LUNA2USDT": "shitcoins", - "JOEUSDT": "shitcoins", - "AMBUSDT": "shitcoins", - "NMRUSDT": "shitcoins", - "BTCDOMUSDT": "shitcoins", - "BLZUSDT": "shitcoins", - "UNFIUSDT": "shitcoins", - "TLMUSDT": "shitcoins", - "BICOUSDT": "shitcoins", - "BNXUSDT": "shitcoins", - "ENAUSDT": "shitcoins", - "REZUSDT": "shitcoins", - "DEFIUSDT": "shitcoins", - "OMNIUSDT": "shitcoins", - "SXPUSDT": "shitcoins", - "1000PEPEUSDT": "shitcoins", - "WLDUSDT": "shitcoins", - "MAVUSDT": "shitcoins", - "ARKUSDT": "shitcoins", - "LOOMUSDT": "shitcoins", - "STORJUSDT": "shitcoins", - "CYBERUSDT": "shitcoins", - "XVGUSDT": "shitcoins", - "OXTUSDT": "shitcoins", - "DODOXUSDT": "shitcoins" - } - } - }, - "intervalScheduler": { - "defaultTimeoutMs": 1800000 - }, - "symmIdToMultiaccounts": { - "56a": [ - "0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3" - ], - "5000a": [ - "0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456" - ], - "42161a": [ - "0x6273242a7E88b3De90822b31648C212215caaFE4", - "0x141269E29a770644C34e05B127AB621511f20109" - ], - "34443a": [ - "0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904" - ], - "8453a": [ - "0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86" - ] - }, - "blockchainExecutor": { - "sendTransactionTimeoutMs": 30000 - }, - "riskEngine": { - "maxOiMultiplier": 3, - "mmRatioAtMaxLeverage": 0.6, - "spareFundsFactor": 0.3, - "spareFundsFactorWarnBuffer": 1.1, - "maxUsageForOiMultiplier": 0.8 - }, - "consistencyProvider": { - "errorSlidingWindowMs": 3600000, - "shouldDebugLog": false - }, - "queueProvider": "Redis" - }, - "perSymmId": { - "56a": { - "positionManager": { - "flagGetAllocationFromDb": true, - "actOnTradeRetryConfig": { - "retries": 3, - "factor": 1.5, - "minTimeout": 300, - "maxTimeout": 3000 - } - }, - "blockchain": { - "maxBlockRangeForGetLogs": 2000, - "maxChainDBBlockDelta": 10, - "consistencyProvider": { - "retryStaleConfig": { - "retries": 3, - "factor": 1.5, - "minTimeout": 300, - "maxTimeout": 3000 - }, - "rpcs": [ - "https://necessary-indulgent-spring.bsc.quiknode.pro/65a1146a15fc6c03bfcc47490b31ec0b7dedd13a/", - "https://lb.drpc.org/ogrpc?network=bsc&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" - ], - "chooseProviderIntervalMs": 60000, - "maxBlockLagAllowedBeforeSwitch": 10, - "shouldUseStaleCheck": true, - "shouldUseErrorCheck": true, - "rpcHealthCheckTimeoutMs": 2000, - "minErrorCountAllowedBeforeSwitch": 10, - "minTotalCallsCountAllowedBeforeSwitch": 20, - "maxErrorRateAllowedBeforeSwitch": 0.2 - } - }, - "chainDBSync": { - "firstSymmBlock": 34345962, - "backupSyncIntervalMs": 20000 - }, - "muon": { - "app": "symmio", - "urls": [ - "https://muon-oracle2.rasa.capital/v1/", - "https://muon-oracle3.rasa.capital/v1/", - "https://muon-oracle4.rasa.capital/v1/" - ] - }, - "symm": { - "symmCoreAddress": "0x9A9F48888600FC9c05f11E03Eab575EBB2Fc2c8f", - "partyBAddress": "0xdF077F5f52bc41A9072F9d0e5fB281770bCD1142" - }, - "monitoringThresholds": { - "minBotGasBalance": 0.1, - "botAddresses": [ - "0xF09928aB8419957d5E9Fd6b8BCA7E42D1ACdBe19", - "0x87Df68F2069D08c908A197e3a707C9BEb0754133", - "0xf35109321eB25e6C50d07fa217277Fb0acF7A576", - "0xA142Ec33458e4A1ffbD5fD45b93aa50Ba51d9Cf5", - "0xE14863eD4a72Efde86BD4F25821515fdeec42a40", - "0x6d1240d96F37A8Cc8aD390558d39A4E3f309bF2A", - "0x33E31cdB83Cd4386C43A22a2896C2C740DFef515" - ] - }, - "riskEngine": { - "maxInitialNotionalUSD": 2000, - "targetHealthFactor": 0.1, - "lowHealthFactorTh": 0.08, - "highHealthFactorTh": 0.2, - "isEmergencyHaltEnabled": false, - "rebalancerIntervalMs": 120000, - "minAllowedMaxFundingRate": 200 - }, - "web3agent": { - "retries": 5, - "partyALockTtlMS": 300000 - }, - "blockchainExecutor": { - "gasPriceGWEI": 6, - "maxGasPriceGWEI": 30, - "gasPriceIncreaseIntervalMS": 2000, - "gasPriceIncreaseMaxRetries": 10, - "gasPriceIncreaseMultiplier": 1.2, - "useLegacyExecutor": false, - "executionTimeoutMS": 180000 - }, - "fundingRate": { - "intervalMs": 180000, - "spreadFactor": 0.2, - "minProfitUSD": 1, - "chargeEnabled": true - }, - "tradeIdFilter": { - "filterEnabled": false, - "tradeIdModuloFilter": 0, - "notionalBelowUSD": 0, - "delayMs": 1000 - }, - "liveEventWatcher": { - "pollingIntervalMs": 2000 - }, - "liquidator": { - "intervalMs": 10000, - "contractAddress": "0xE8cDEa1B566f506b9276585559896260b55Cb7E8", - "retryConfig": { - "retries": 3, - "factor": 1.5, - "minTimeout": 300, - "maxTimeout": 3000 - } - } - }, - "5000a": { - "liquidator": { - "intervalMs": 10000, - "contractAddress": "0x82261Fcb908989dd418cEDCA35359B284D7D86d6", - "retryConfig": { - "retries": 3, - "factor": 1.5, - "minTimeout": 300, - "maxTimeout": 3000 - } - }, - "positionManager": { - "flagGetAllocationFromDb": true, - "actOnTradeRetryConfig": { - "retries": 3, - "factor": 1.5, - "minTimeout": 300, - "maxTimeout": 3000 - } - }, - "blockchain": { - "maxBlockRangeForGetLogs": 2000, - "maxChainDBBlockDelta": 15, - "consistencyProvider": { - "retryStaleConfig": { - "minTimeout": 500, - "maxTimeout": 3000, - "retries": 4, - "factor": 1.5 - }, - "rpcs": [ - "https://blissful-little-cloud.mantle-mainnet.quiknode.pro/3836a9592f294e6980dc9949b98fe0dd689c21d7/", - "https://lb.drpc.org/ogrpc?network=mantle&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" - ], - "chooseProviderIntervalMs": 60000, - "maxBlockLagAllowedBeforeSwitch": 30, - "shouldUseStaleCheck": true, - "shouldUseErrorCheck": true, - "rpcHealthCheckTimeoutMs": 2000, - "minErrorCountAllowedBeforeSwitch": 10, - "minTotalCallsCountAllowedBeforeSwitch": 20, - "maxErrorRateAllowedBeforeSwitch": 0.2 - } - }, - "chainDBSync": { - "firstSymmBlock": 61972154, - "backupSyncIntervalMs": 20000 - }, - "muon": { - "app": "symmio", - "urls": [ - "https://muon-oracle2.rasa.capital/v1/", - "https://muon-oracle3.rasa.capital/v1/", - "https://muon-oracle4.rasa.capital/v1/" - ] - }, - "symm": { - "symmCoreAddress": "0x2Ecc7da3Cc98d341F987C85c3D9FC198570838B5", - "partyBAddress": "0xF9e39B4B30E26c18d2a725c0397Ed5A925efE46B" - }, - "monitoringThresholds": { - "minBotGasBalance": 50, - "botAddresses": [ - "0xF09928aB8419957d5E9Fd6b8BCA7E42D1ACdBe19", - "0x87Df68F2069D08c908A197e3a707C9BEb0754133", - "0xf35109321eB25e6C50d07fa217277Fb0acF7A576", - "0xA142Ec33458e4A1ffbD5fD45b93aa50Ba51d9Cf5", - "0xE14863eD4a72Efde86BD4F25821515fdeec42a40", - "0x6d1240d96F37A8Cc8aD390558d39A4E3f309bF2A", - "0x33E31cdB83Cd4386C43A22a2896C2C740DFef515" - ] - }, - "riskEngine": { - "maxInitialNotionalUSD": 2000, - "targetHealthFactor": 0.1, - "lowHealthFactorTh": 0.08, - "highHealthFactorTh": 0.2, - "isEmergencyHaltEnabled": false, - "rebalancerIntervalMs": 120000, - "minAllowedMaxFundingRate": 200 - }, - "web3agent": { - "retries": 5, - "partyALockTtlMS": 300000 - }, - "blockchainExecutor": { - "gasPriceGWEI": 0.02, - "maxGasPriceGWEI": 0.1, - "gasPriceIncreaseMultiplier": 1.2, - "gasPriceIncreaseIntervalMS": 2000, - "gasPriceIncreaseMaxRetries": 10, - "useLegacyExecutor": false, - "executionTimeoutMS": 180000 - }, - "fundingRate": { - "intervalMs": 180000, - "spreadFactor": 0.2, - "minProfitUSD": 1, - "chargeEnabled": true - }, - "tradeIdFilter": { - "filterEnabled": false, - "tradeIdModuloFilter": 0, - "notionalBelowUSD": 0, - "delayMs": 1000 - }, - "liveEventWatcher": { - "pollingIntervalMs": 2000 - } - }, - "42161a": { - "liquidator": { - "intervalMs": 10000, - "contractAddress": "0x7ECBEB26Cf76ca8680c851336B97D4BE8521918C", - "retryConfig": { - "maxTimeout": 3000, - "minTimeout": 300, - "retries": 3, - "factor": 1.5 - } - }, - "positionManager": { - "flagGetAllocationFromDb": true, - "actOnTradeRetryConfig": { - "maxTimeout": 3000, - "minTimeout": 300, - "retries": 3, - "factor": 1.5 - } - }, - "blockchain": { - "maxBlockRangeForGetLogs": 10000, - "maxChainDBBlockDelta": 160, - "consistencyProvider": { - "retryStaleConfig": { - "maxTimeout": 3000, - "minTimeout": 300, - "retries": 3, - "factor": 1.5 - }, - "rpcs": [ - "https://bold-fittest-arrow.arbitrum-mainnet.quiknode.pro/edb712c03f3e57e9035025db47842bf1971061ca", - "https://lb.drpc.org/ogrpc?network=arbitrum&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" - ], - "chooseProviderIntervalMs": 60000, - "maxBlockLagAllowedBeforeSwitch": 60, - "shouldUseStaleCheck": true, - "shouldUseErrorCheck": true, - "rpcHealthCheckTimeoutMs": 3000, - "minErrorCountAllowedBeforeSwitch": 10, - "minTotalCallsCountAllowedBeforeSwitch": 20, - "maxErrorRateAllowedBeforeSwitch": 0.2 - } - }, - "chainDBSync": { - "firstSymmBlock": 210771536, - "backupSyncIntervalMs": 20000 - }, - "muon": { - "app": "symmio", - "urls": [ - "https://muon-oracle2.rasa.capital/v1/", - "https://muon-oracle3.rasa.capital/v1/", - "https://muon-oracle4.rasa.capital/v1/" - ] - }, - "symm": { - "symmCoreAddress": "0x8F06459f184553e5d04F07F868720BDaCAB39395", - "partyBAddress": "0xdB91D232E93969130272De309d3d914547604426" - }, - "monitoringThresholds": { - "minBotGasBalance": 0.017, - "botAddresses": [ - "0xF09928aB8419957d5E9Fd6b8BCA7E42D1ACdBe19", - "0x87Df68F2069D08c908A197e3a707C9BEb0754133", - "0xf35109321eB25e6C50d07fa217277Fb0acF7A576", - "0xA142Ec33458e4A1ffbD5fD45b93aa50Ba51d9Cf5", - "0xE14863eD4a72Efde86BD4F25821515fdeec42a40", - "0x6d1240d96F37A8Cc8aD390558d39A4E3f309bF2A", - "0x33E31cdB83Cd4386C43A22a2896C2C740DFef515" - ] - }, - "riskEngine": { - "maxInitialNotionalUSD": 2000, - "targetHealthFactor": 0.1, - "lowHealthFactorTh": 0.08, - "highHealthFactorTh": 0.2, - "isEmergencyHaltEnabled": false, - "rebalancerIntervalMs": 120000, - "minAllowedMaxFundingRate": 200 - }, - "web3agent": { - "retries": 5, - "partyALockTtlMS": 300000 - }, - "blockchainExecutor": { - "gasPriceGWEI": 0.01, - "maxGasPriceGWEI": 0.05, - "gasPriceIncreaseMultiplier": 1.2, - "gasPriceIncreaseIntervalMS": 2000, - "gasPriceIncreaseMaxRetries": 10, - "useLegacyExecutor": false, - "executionTimeoutMS": 180000 - }, - "fundingRate": { - "intervalMs": 180000, - "spreadFactor": 0.2, - "minProfitUSD": 1, - "chargeEnabled": true - }, - "tradeIdFilter": { - "filterEnabled": false, - "tradeIdModuloFilter": 0, - "notionalBelowUSD": 0, - "delayMs": 1000 - }, - "liveEventWatcher": { - "pollingIntervalMs": 2000 - } - }, - "34443a": { - "liquidator": { - "intervalMs": 10000, - "contractAddress": "0x0000000000000000000000000000000000000000", - "retryConfig": { - "maxTimeout": 3000, - "minTimeout": 300, - "retries": 3, - "factor": 1.5 - } - }, - "positionManager": { - "flagGetAllocationFromDb": true, - "actOnTradeRetryConfig": { - "maxTimeout": 3000, - "minTimeout": 300, - "retries": 3, - "factor": 1.5 - } - }, - "blockchain": { - "maxBlockRangeForGetLogs": 2000, - "maxChainDBBlockDelta": 15, - "consistencyProvider": { - "retryStaleConfig": { - "minTimeout": 500, - "maxTimeout": 3000, - "retries": 4, - "factor": 1.5 - }, - "rpcs": [ - "https://lb.drpc.org/ogrpc?network=mode&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" - ], - "chooseProviderIntervalMs": 60000, - "maxBlockLagAllowedBeforeSwitch": 30, - "shouldUseStaleCheck": true, - "shouldUseErrorCheck": true, - "rpcHealthCheckTimeoutMs": 2000, - "minErrorCountAllowedBeforeSwitch": 10, - "minTotalCallsCountAllowedBeforeSwitch": 20, - "maxErrorRateAllowedBeforeSwitch": 0.2 - } - }, - "chainDBSync": { - "firstSymmBlock": 61972154, - "backupSyncIntervalMs": 20000 - }, - "muon": { - "app": "symmio", - "urls": [ - "https://muon-oracle2.rasa.capital/v1/", - "https://muon-oracle3.rasa.capital/v1/", - "https://muon-oracle4.rasa.capital/v1/" - ] - }, - "symm": { - "symmCoreAddress": "0x3d17f073cCb9c3764F105550B0BCF9550477D266", - "partyBAddress": "0x78E76Ac7fEc050cA785c19fFADDF57137b890543" - }, - "monitoringThresholds": { - "minBotGasBalance": 50, - "botAddresses": [ - "0xF09928aB8419957d5E9Fd6b8BCA7E42D1ACdBe19", - "0x87Df68F2069D08c908A197e3a707C9BEb0754133", - "0xf35109321eB25e6C50d07fa217277Fb0acF7A576", - "0xA142Ec33458e4A1ffbD5fD45b93aa50Ba51d9Cf5", - "0xE14863eD4a72Efde86BD4F25821515fdeec42a40", - "0x6d1240d96F37A8Cc8aD390558d39A4E3f309bF2A", - "0x33E31cdB83Cd4386C43A22a2896C2C740DFef515" - ] - }, - "riskEngine": { - "maxInitialNotionalUSD": 2000, - "targetHealthFactor": 0.1, - "lowHealthFactorTh": 0.08, - "highHealthFactorTh": 0.2, - "isEmergencyHaltEnabled": false, - "rebalancerIntervalMs": 120000, - "minAllowedMaxFundingRate": 200 - }, - "web3agent": { - "retries": 5, - "partyALockTtlMS": 300000 - }, - "blockchainExecutor": { - "gasPriceGWEI": 0.01, - "maxGasPriceGWEI": 0.05, - "gasPriceIncreaseMultiplier": 1.2, - "gasPriceIncreaseIntervalMS": 2000, - "gasPriceIncreaseMaxRetries": 10, - "useLegacyExecutor": false, - "executionTimeoutMS": 180000 - }, - "fundingRate": { - "intervalMs": 180000, - "spreadFactor": 0.2, - "minProfitUSD": 1, - "chargeEnabled": true - }, - "tradeIdFilter": { - "filterEnabled": false, - "tradeIdModuloFilter": 0, - "notionalBelowUSD": 0, - "delayMs": 1000 - }, - "liveEventWatcher": { - "pollingIntervalMs": 2000 - } - }, - "8453a": { - "positionManager": { - "flagGetAllocationFromDb": true, - "actOnTradeRetryConfig": { - "retries": 10, - "factor": 1.5, - "minTimeout": 300, - "maxTimeout": 3000 - } - }, - "blockchain": { - "maxBlockRangeForGetLogs": 10000, - "maxChainDBBlockDelta": 20, - "consistencyProvider": { - "retryStaleConfig": { - "maxTimeout": 3000, - "minTimeout": 300, - "retries": 3, - "factor": 1.5 - }, - "rpcs": [ - "https://polished-multi-replica.base-mainnet.quiknode.pro/650a8f30f9242935baae0a4a32261221d5d5400c/", - "https://lb.drpc.org/ogrpc?network=base&dkey=AsLFV4HL9kVAkLCydcvX4XTuNF-XKKkR76E_hkHL9tz4" - ], - "chooseProviderIntervalMs": 60000, - "maxBlockLagAllowedBeforeSwitch": 30, - "rpcHealthCheckTimeoutMs": 2000, - "minErrorCountAllowedBeforeSwitch": 30, - "minTotalCallsCountAllowedBeforeSwitch": 20, - "maxErrorRateAllowedBeforeSwitch": 0.2, - "shouldUseStaleCheck": true, - "shouldUseErrorCheck": true - } - }, - "chainDBSync": { - "firstSymmBlock": 8443806, - "backupSyncIntervalMs": 20000 - }, - "muon": { - "app": "symmio", - "urls": [ - "https://muon-oracle2.rasa.capital/v1/", - "https://muon-oracle3.rasa.capital/v1/", - "https://muon-oracle4.rasa.capital/v1/" - ] - }, - "symm": { - "symmCoreAddress": "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43", - "partyBAddress": "0xB6e3b44975f2966707a91747F89D2002ff8d62Db" - }, - "monitoringThresholds": { - "minBotGasBalance": 0.01, - "botAddresses": [] - }, - "riskEngine": { - "maxInitialNotionalUSD": 5000, - "targetHealthFactor": 0.1666, - "lowHealthFactorTh": 0.14, - "highHealthFactorTh": 0.2, - "isEmergencyHaltEnabled": false, - "rebalancerIntervalMs": 120000, - "minAllowedMaxFundingRate": 200 - }, - "web3agent": { - "retries": 5, - "partyALockTtlMS": 300000 - }, - "blockchainExecutor": { - "gasPriceGWEI": 0.012, - "maxGasPriceGWEI": 0.2, - "gasPriceIncreaseMultiplier": 1.3, - "gasPriceIncreaseIntervalMS": 4000, - "gasPriceIncreaseMaxRetries": 10, - "useLegacyExecutor": false, - "executionTimeoutMS": 180000 - }, - "fundingRate": { - "intervalMs": 180000, - "spreadFactor": 0.2, - "minProfitUSD": 1, - "chargeEnabled": true - }, - "tradeIdFilter": { - "filterEnabled": true, - "tradeIdModuloFilter": 2, - "notionalBelowUSD": 2000, - "delayMs": 10000 - }, - "liveEventWatcher": { - "pollingIntervalMs": 2000 - }, - "liquidator": { - "intervalMs": 1000, - "contractAddress": "0xeB7bd77D49bb9e86A736dc6350a7A1F90327cA80", - "retryConfig": { - "retries": 3, - "factor": 1.5, - "minTimeout": 300, - "maxTimeout": 3000 - } - } - } - } -} diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars new file mode 100644 index 0000000..21d4824 --- /dev/null +++ b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars @@ -0,0 +1,20 @@ +amplify_remote_environment_variables = { + "NEXT_PUBLIC_PERPS_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_HEDGER_URL" = "www.dev.perps-streaming.com/v1/56a/0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3/" +"NEXT_PUBLIC_PERPS_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_MULTIACCOUNT" = "0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3" +"NEXT_PUBLIC_PERPS_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_PARTY_B" = "0xdF077F5f52bc41A9072F9d0e5fB281770bCD1142""NEXT_PUBLIC_PERPS_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_DIAMOND_ADDRESS" = "0x9A9F48888600FC9c05f11E03Eab575EBB2Fc2c8f" + "NEXT_PUBLIC_PERPS_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_HEDGER_URL" = "www.dev.perps-streaming.com/v1/5000a/0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456/" +"NEXT_PUBLIC_PERPS_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_MULTIACCOUNT" = "0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456" +"NEXT_PUBLIC_PERPS_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_PARTY_B" = "0xF9e39B4B30E26c18d2a725c0397Ed5A925efE46B""NEXT_PUBLIC_PERPS_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_DIAMOND_ADDRESS" = "0x2Ecc7da3Cc98d341F987C85c3D9FC198570838B5" + "NEXT_PUBLIC_PERPS_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_HEDGER_URL" = "www.dev.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/" +"NEXT_PUBLIC_PERPS_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_MULTIACCOUNT" = "0x6273242a7E88b3De90822b31648C212215caaFE4" +"NEXT_PUBLIC_PERPS_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_PARTY_B" = "0xdB91D232E93969130272De309d3d914547604426""NEXT_PUBLIC_PERPS_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_DIAMOND_ADDRESS" = "0x8F06459f184553e5d04F07F868720BDaCAB39395" +"NEXT_PUBLIC_PERPS_42161a_0x141269E29a770644C34e05B127AB621511f20109_HEDGER_URL" = "www.dev.perps-streaming.com/v1/42161a/0x141269E29a770644C34e05B127AB621511f20109/" +"NEXT_PUBLIC_PERPS_42161a_0x141269E29a770644C34e05B127AB621511f20109_MULTIACCOUNT" = "0x141269E29a770644C34e05B127AB621511f20109" +"NEXT_PUBLIC_PERPS_42161a_0x141269E29a770644C34e05B127AB621511f20109_PARTY_B" = "0xdB91D232E93969130272De309d3d914547604426""NEXT_PUBLIC_PERPS_42161a_0x141269E29a770644C34e05B127AB621511f20109_DIAMOND_ADDRESS" = "0x8F06459f184553e5d04F07F868720BDaCAB39395" + "NEXT_PUBLIC_PERPS_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_HEDGER_URL" = "www.dev.perps-streaming.com/v1/34443a/0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904/" +"NEXT_PUBLIC_PERPS_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_MULTIACCOUNT" = "0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904" +"NEXT_PUBLIC_PERPS_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_PARTY_B" = "0x78E76Ac7fEc050cA785c19fFADDF57137b890543""NEXT_PUBLIC_PERPS_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_DIAMOND_ADDRESS" = "0x3d17f073cCb9c3764F105550B0BCF9550477D266" + "NEXT_PUBLIC_PERPS_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_HEDGER_URL" = "www.dev.perps-streaming.com/v1/8453a/0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86/" +"NEXT_PUBLIC_PERPS_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_MULTIACCOUNT" = "0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86" +"NEXT_PUBLIC_PERPS_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_PARTY_B" = "0xB6e3b44975f2966707a91747F89D2002ff8d62Db""NEXT_PUBLIC_PERPS_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_DIAMOND_ADDRESS" = "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43" +} \ No newline at end of file From b9c1d17341d45acacbc9513adec18d76c3fdf153 Mon Sep 17 00:00:00 2001 From: Tom Kimber Date: Thu, 19 Dec 2024 10:27:54 +0000 Subject: [PATCH 22/22] Update formatting. --- ...amplify-environment-variable-generation.py | 13 ++++++------ .../terraform.tfvars | 20 ------------------- 2 files changed, 6 insertions(+), 27 deletions(-) delete mode 100644 .github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py index ff7ff88..2e75902 100644 --- a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py +++ b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/amplify-environment-variable-generation.py @@ -23,21 +23,20 @@ def main(): hedger_addresses = addresses party_b_address = config['perSymmId'][symm_id]['symm']['partyBAddress'] symm_core_address = config['perSymmId'][symm_id]['symm']['symmCoreAddress'] - env_strings.append(generate_templates( - symm_id, hedger_addresses, party_b_address, symm_core_address, args.environment)) + env_strings.append(generate_templates(args.environment, symm_id, hedger_addresses, party_b_address, symm_core_address)) write_tfvars_file(env_strings) -def generate_templates(symm_id: str, hedger_addresses: list[str], party_b_address: str, symm_core_address: str, environment: str) -> str: +def generate_templates(environment: str, symm_id: str, hedger_addresses: list[str], party_b_address: str, symm_core_address: str) -> str: environment = environment + '.' if environment != 'prod' else '' all_templates = [] for hedger_address in hedger_addresses: templates = [ - f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_HEDGER_URL" = "www.{environment}perps-streaming.com/v1/{symm_id}/{hedger_address}/"', - f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_MULTIACCOUNT" = "{hedger_address}"', - f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_PARTY_B" = "{party_b_address}"' - f'"NEXT_PUBLIC_PERPS_{symm_id}_{hedger_address}_DIAMOND_ADDRESS" = "{symm_core_address}"' + f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_HEDGER_URL" = "www.{environment}perps-streaming.com/v1/{symm_id}/{hedger_address}/"', + f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_MULTIACCOUNT" = "{hedger_address}"', + f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_PARTY_B" = "{party_b_address}"', + f'"NEXT_PUBLIC_{symm_id}_{hedger_address}_DIAMOND_ADDRESS" = "{symm_core_address}"', ] all_templates.extend(templates) diff --git a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars b/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars deleted file mode 100644 index 21d4824..0000000 --- a/.github/actions/amplify-environment-variable-generation/amplify-environment-variable-generation/terraform.tfvars +++ /dev/null @@ -1,20 +0,0 @@ -amplify_remote_environment_variables = { - "NEXT_PUBLIC_PERPS_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_HEDGER_URL" = "www.dev.perps-streaming.com/v1/56a/0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3/" -"NEXT_PUBLIC_PERPS_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_MULTIACCOUNT" = "0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3" -"NEXT_PUBLIC_PERPS_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_PARTY_B" = "0xdF077F5f52bc41A9072F9d0e5fB281770bCD1142""NEXT_PUBLIC_PERPS_56a_0x650a2D6C263A93cFF5EdD41f836ce832F05A1cF3_DIAMOND_ADDRESS" = "0x9A9F48888600FC9c05f11E03Eab575EBB2Fc2c8f" - "NEXT_PUBLIC_PERPS_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_HEDGER_URL" = "www.dev.perps-streaming.com/v1/5000a/0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456/" -"NEXT_PUBLIC_PERPS_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_MULTIACCOUNT" = "0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456" -"NEXT_PUBLIC_PERPS_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_PARTY_B" = "0xF9e39B4B30E26c18d2a725c0397Ed5A925efE46B""NEXT_PUBLIC_PERPS_5000a_0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456_DIAMOND_ADDRESS" = "0x2Ecc7da3Cc98d341F987C85c3D9FC198570838B5" - "NEXT_PUBLIC_PERPS_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_HEDGER_URL" = "www.dev.perps-streaming.com/v1/42161a/0x6273242a7E88b3De90822b31648C212215caaFE4/" -"NEXT_PUBLIC_PERPS_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_MULTIACCOUNT" = "0x6273242a7E88b3De90822b31648C212215caaFE4" -"NEXT_PUBLIC_PERPS_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_PARTY_B" = "0xdB91D232E93969130272De309d3d914547604426""NEXT_PUBLIC_PERPS_42161a_0x6273242a7E88b3De90822b31648C212215caaFE4_DIAMOND_ADDRESS" = "0x8F06459f184553e5d04F07F868720BDaCAB39395" -"NEXT_PUBLIC_PERPS_42161a_0x141269E29a770644C34e05B127AB621511f20109_HEDGER_URL" = "www.dev.perps-streaming.com/v1/42161a/0x141269E29a770644C34e05B127AB621511f20109/" -"NEXT_PUBLIC_PERPS_42161a_0x141269E29a770644C34e05B127AB621511f20109_MULTIACCOUNT" = "0x141269E29a770644C34e05B127AB621511f20109" -"NEXT_PUBLIC_PERPS_42161a_0x141269E29a770644C34e05B127AB621511f20109_PARTY_B" = "0xdB91D232E93969130272De309d3d914547604426""NEXT_PUBLIC_PERPS_42161a_0x141269E29a770644C34e05B127AB621511f20109_DIAMOND_ADDRESS" = "0x8F06459f184553e5d04F07F868720BDaCAB39395" - "NEXT_PUBLIC_PERPS_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_HEDGER_URL" = "www.dev.perps-streaming.com/v1/34443a/0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904/" -"NEXT_PUBLIC_PERPS_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_MULTIACCOUNT" = "0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904" -"NEXT_PUBLIC_PERPS_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_PARTY_B" = "0x78E76Ac7fEc050cA785c19fFADDF57137b890543""NEXT_PUBLIC_PERPS_34443a_0xC0ff4B56f62f20bA45f4229CC6BAaD986FA2a904_DIAMOND_ADDRESS" = "0x3d17f073cCb9c3764F105550B0BCF9550477D266" - "NEXT_PUBLIC_PERPS_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_HEDGER_URL" = "www.dev.perps-streaming.com/v1/8453a/0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86/" -"NEXT_PUBLIC_PERPS_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_MULTIACCOUNT" = "0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86" -"NEXT_PUBLIC_PERPS_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_PARTY_B" = "0xB6e3b44975f2966707a91747F89D2002ff8d62Db""NEXT_PUBLIC_PERPS_8453a_0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86_DIAMOND_ADDRESS" = "0x91Cf2D8Ed503EC52768999aA6D8DBeA6e52dbe43" -} \ No newline at end of file