Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ ETH_WALLET_ADDRESS=
ETH_WALLET_PRIVATE_KEY=
ETH_GATEWAY_URL=
ETH_API_KEY=
ETH_SWAP_CONTRACT_ADDRESS=
ETH_SWAP_TOKEN_ADDRESS=
BSC_WALLET_ADDRESS=
BSC_WALLET_PRIVATE_KEY=
BSC_GATEWAY_URL=
BSC_SWAP_CONTRACT_ADDRESS=
BSC_SWAP_TOKEN_ADDRESS=
LETTER_USER=
LETTER_AUTH=
LETTER_URL=
Expand Down
43 changes: 28 additions & 15 deletions infrastructure/bicep/dfx-api.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ param ethWalletPrivateKey string
param ethGatewayUrl string
@secure()
param ethApiKey string
param ethSwapContractAddress string
param ethSwapTokenAddress string

param bscWalletAddress string
@secure()
param bscWalletPrivateKey string
param bscGatewayUrl string
param bscSwapContractAddress string
param bscSwapTokenAddress string

param nodeServicePlanSkuName string
param nodeServicePlanSkuTier string
Expand Down Expand Up @@ -113,7 +117,6 @@ param paymentUrl string
@secure()
param lockApiKey string


// --- VARIABLES --- //
var compName = 'dfx'
var apiName = 'api'
Expand All @@ -134,7 +137,6 @@ var apiServicePlanName = 'plan-${compName}-${apiName}-${env}'
var apiAppName = 'app-${compName}-${apiName}-${env}'
var appInsightsName = 'appi-${compName}-${apiName}-${env}'


var nodeProps = [
{
name: 'nodes-input-${env}'
Expand Down Expand Up @@ -246,7 +248,6 @@ resource virtualNet 'Microsoft.Network/virtualNetworks@2020-11-01' = {
}
}


// Storage Account
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' = {
name: storageAccountName
Expand All @@ -267,7 +268,6 @@ resource dbBackupContainer 'Microsoft.Storage/storageAccounts/blobServices/conta
name: '${storageAccount.name}/default/${dbBackupContainerName}'
}


// SQL Database
resource sqlServer 'Microsoft.Sql/servers@2021-02-01-preview' = {
name: sqlServerName
Expand All @@ -279,11 +279,11 @@ resource sqlServer 'Microsoft.Sql/servers@2021-02-01-preview' = {
}

resource sqlVNetRule 'Microsoft.Sql/servers/virtualNetworkRules@2021-02-01-preview' = {
parent: sqlServer
name: 'apiVNetRule'
properties: {
virtualNetworkSubnetId: virtualNet.properties.subnets[0].id
}
parent: sqlServer
name: 'apiVNetRule'
properties: {
virtualNetworkSubnetId: virtualNet.properties.subnets[0].id
}
}

resource sqlAllRule 'Microsoft.Sql/servers/firewallRules@2021-02-01-preview' = if (dbAllowAllIps) {
Expand Down Expand Up @@ -326,14 +326,13 @@ resource sqlDbLtrPolicy 'Microsoft.Sql/servers/databases/backupLongTermRetention
}
}


// API App Service
resource appServicePlan 'Microsoft.Web/serverfarms@2018-02-01' = {
name: apiServicePlanName
location: location
kind: 'linux'
properties: {
reserved: true
reserved: true
}
sku: {
name: 'P1v2'
Expand All @@ -350,7 +349,7 @@ resource apiAppService 'Microsoft.Web/sites@2018-11-01' = {
serverFarmId: appServicePlan.id
httpsOnly: true
virtualNetworkSubnetId: virtualNet.properties.subnets[0].id

siteConfig: {
alwaysOn: true
linuxFxVersion: 'NODE|14-lts'
Expand All @@ -359,7 +358,7 @@ resource apiAppService 'Microsoft.Web/sites@2018-11-01' = {
logsDirectorySizeLimit: 100
vnetRouteAllEnabled: true
scmIpSecurityRestrictionsUseMain: true

appSettings: [
{
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
Expand Down Expand Up @@ -534,6 +533,14 @@ resource apiAppService 'Microsoft.Web/sites@2018-11-01' = {
name: 'ETH_API_KEY'
value: ethApiKey
}
{
name: 'ETH_SWAP_CONTRACT_ADDRESS'
value: ethSwapContractAddress
}
{
name: 'ETH_SWAP_TOKEN_ADDRESS'
value: ethSwapTokenAddress
}
{
name: 'BSC_WALLET_ADDRESS'
value: bscWalletAddress
Expand All @@ -546,6 +553,14 @@ resource apiAppService 'Microsoft.Web/sites@2018-11-01' = {
name: 'BSC_GATEWAY_URL'
value: bscGatewayUrl
}
{
name: 'BSC_SWAP_CONTRACT_ADDRESS'
value: bscSwapContractAddress
}
{
name: 'BSC_SWAP_TOKEN_ADDRESS'
value: bscSwapTokenAddress
}
{
name: 'BTC_COLLECTOR_ADDRESS'
value: btcCollectorAddress
Expand Down Expand Up @@ -679,7 +694,6 @@ resource appInsights 'microsoft.insights/components@2020-02-02-preview' = {
}
}


// DeFi Nodes
module nodes 'defi-node.bicep' = [for node in nodeProps: {
name: node.name
Expand All @@ -699,7 +713,6 @@ module nodes 'defi-node.bicep' = [for node in nodeProps: {
}
}]


// BTC Node
resource vmNsg 'Microsoft.Network/networkSecurityGroups@2020-11-01' = {
name: vmNsgName
Expand Down
12 changes: 12 additions & 0 deletions infrastructure/bicep/parameters/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
"ethApiKey": {
"value": "xxx"
},
"ethSwapContractAddress": {
"value": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
},
"ethSwapTokenAddress": {
"value": "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6"
},
"bscWalletAddress": {
"value": "xxx"
},
Expand All @@ -95,6 +101,12 @@
"bscGatewayUrl": {
"value": "https://data-seed-prebsc-1-s1.binance.org:8545"
},
"bscSwapContractAddress": {
"value": "0xD99D1c33F9fC3444f8101754aBC46c52416550D1"
},
"bscSwapTokenAddress": {
"value": "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"
},
"btcCollectorAddress": {
"value": "xxx"
},
Expand Down
12 changes: 12 additions & 0 deletions infrastructure/bicep/parameters/loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
"ethApiKey": {
"value": "xxx"
},
"ethSwapContractAddress": {
"value": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
},
"ethSwapTokenAddress": {
"value": "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6"
},
"bscWalletAddress": {
"value": "xxx"
},
Expand All @@ -95,6 +101,12 @@
"bscGatewayUrl": {
"value": "https://data-seed-prebsc-1-s1.binance.org:8545"
},
"bscSwapContractAddress": {
"value": "0xD99D1c33F9fC3444f8101754aBC46c52416550D1"
},
"bscSwapTokenAddress": {
"value": "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd"
},
"btcCollectorAddress": {
"value": "xxx"
},
Expand Down
12 changes: 12 additions & 0 deletions infrastructure/bicep/parameters/prd.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
"ethApiKey": {
"value": "xxx"
},
"ethSwapContractAddress": {
"value": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
},
"ethSwapTokenAddress": {
"value": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
},
"bscWalletAddress": {
"value": "xxx"
},
Expand All @@ -95,6 +101,12 @@
"bscGatewayUrl": {
"value": "https://bsc-dataseed.binance.org"
},
"bscSwapContractAddress": {
"value": "0x10ED43C718714eb63d5aA57B78B54704E256024E"
},
"bscSwapTokenAddress": {
"value": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
},
"btcCollectorAddress": {
"value": "xxx"
},
Expand Down
13 changes: 13 additions & 0 deletions migration/1665408086368-assetChainId.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { MigrationInterface, QueryRunner } = require("typeorm");

module.exports = class assetChainId1665408086368 {
name = 'assetChainId1665408086368'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "asset" ALTER COLUMN "chainId" nvarchar(255)`);
}

async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "asset" ALTER COLUMN "chainId" int`);
}
}
13 changes: 13 additions & 0 deletions migration/1665486331833-notificationModule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { MigrationInterface, QueryRunner } = require("typeorm");

module.exports = class notificationModule1665486331833 {
name = 'notificationModule1665486331833'

async up(queryRunner) {
await queryRunner.query(`CREATE TABLE "notification" ("id" int NOT NULL IDENTITY(1,1), "updated" datetime2 NOT NULL CONSTRAINT "DF_e3d9266f1a6d4cf00832ae607c3" DEFAULT getdate(), "created" datetime2 NOT NULL CONSTRAINT "DF_af7e45ec51e6aff202fbb030ecd" DEFAULT getdate(), "type" nvarchar(256) NOT NULL, "context" nvarchar(256) NOT NULL, "correlationId" nvarchar(MAX) NOT NULL, "sendDate" datetime2 NOT NULL, "suppressRecurring" bit NOT NULL CONSTRAINT "DF_830adad2aae5ed9e956909141fb" DEFAULT 0, "debounce" float, CONSTRAINT "PK_705b6c7cdf9b2c2ff7ac7872cb7" PRIMARY KEY ("id"))`);
}

async down(queryRunner) {
await queryRunner.query(`DROP TABLE "notification"`);
}
}
17 changes: 17 additions & 0 deletions migration/1665740859063-amountInColsBankTxReturn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { MigrationInterface, QueryRunner } = require("typeorm");

module.exports = class amountInColsBankTxReturn1665740859063 {
name = 'amountInColsBankTxReturn1665740859063'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "dbo"."bank_tx_return" ADD "amountInChf" float`);
await queryRunner.query(`ALTER TABLE "dbo"."bank_tx_return" ADD "amountInEur" float`);
await queryRunner.query(`ALTER TABLE "dbo"."bank_tx_return" ADD "amountInUsd" float`);
}

async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "dbo"."bank_tx_return" DROP COLUMN "amountInUsd"`);
await queryRunner.query(`ALTER TABLE "dbo"."bank_tx_return" DROP COLUMN "amountInEur"`);
await queryRunner.query(`ALTER TABLE "dbo"."bank_tx_return" DROP COLUMN "amountInChf"`);
}
}
Loading