diff --git a/Jenkinsfile b/Jenkinsfile index 03e9a40c6..d980e7838 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,6 +22,16 @@ def pipeline = new org.js.AppPipeline(steps: this, ipfsHashChatIDProd: '', noIndex: true, // ipfsHashChatID: '-1001375555544', - secretScannerExclusion: 'Jenkinsfile-UCAN|.*env.json\$|.*env-stage.json\$' + secretScannerExclusion: 'Jenkinsfile-UCAN|.*env.json\$|.*env-stage.json\$', + k8sPrDeploy: true, + vaultPrPath: "argocd-cc/src/charts/adar/web/environments/tachi/", + vaultUser: "adar-rw", + vaultCredId: "adarVaultCreds", + valuesDestPath: "argocd-cc/src/charts/adar/web/", + devValuesPath: "dev/dev/", + initialSecretName: "adar-adar-web-eso-base", + initialNameSpace: "adar-dev-web", + targetNameSpace: "adar-${env.CHANGE_ID}-web", + targetSecretName: "adar-${env.CHANGE_ID}-adar-pr-adar-web-eso-base" ) pipeline.runPipeline() diff --git a/public/env.json b/public/env.json index 7b8b32132..4bb532d04 100644 --- a/public/env.json +++ b/public/env.json @@ -1,80 +1,80 @@ { - "BASE_API_URL": "", - "API_KEYS": { - "moonpay": "pk_test_4ASGxHKGpLPE6sdQq1V3QjtpUFSpWLk", - "nftStorage": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweDBmMzgwOTMyQTNDODM3ZDNiN2JEYzBBNTc0NmNkMDlBRGIyNUZGMzQiLCJpc3MiOiJuZnQtc3RvcmFnZSIsImlhdCI6MTY0MjU4OTQ2ODA4MSwibmFtZSI6Im5mdC1zdG9yYWdlLWRldiJ9.hkvzea9ltcriXXHKoYd3F2Iu1Y8X5H-zunAQboC_3vw", - "etherscan": "YBR7IWEBEXFICT8M7GRV77NBX4AXJ9T53H", - "googleApi": "AIzaSyAzj7JxB-j8pJixtt6JSqLPhG0y02CGYOU", - "googleClientId": "498393666682-9eeiioee0a2sgb1671e9qir645f9n6cv.apps.googleusercontent.com", - "walletconnect": "feeab08b50e0d407f4eb875d69e162e8" - }, - "FEATURE_FLAGS": { - "moonpay": false, - "x1ex": false, - "charts": false, - "soraCard": false, - "orderBook": false, - "adarSwapEnabled": false - }, - "FAUCET_URL": "https://faucet.dev.sora2.tachi.soramitsu.co.jp/", - "DEFAULT_NETWORKS": [ - { - "chain": "SORA-test Testnet #1", - "name": "SORA", - "address": "wss://ws.framenode-1.r0.tst.sora2.soramitsu.co.jp", - "location": "FR" + "BASE_API_URL": "", + "API_KEYS": { + "moonpay": "pk_test_4ASGxHKGpLPE6sdQq1V3QjtpUFSpWLk", + "nftStorage": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweDBmMzgwOTMyQTNDODM3ZDNiN2JEYzBBNTc0NmNkMDlBRGIyNUZGMzQiLCJpc3MiOiJuZnQtc3RvcmFnZSIsImlhdCI6MTY0MjU4OTQ2ODA4MSwibmFtZSI6Im5mdC1zdG9yYWdlLWRldiJ9.hkvzea9ltcriXXHKoYd3F2Iu1Y8X5H-zunAQboC_3vw", + "etherscan": "YBR7IWEBEXFICT8M7GRV77NBX4AXJ9T53H", + "googleApi": "AIzaSyAzj7JxB-j8pJixtt6JSqLPhG0y02CGYOU", + "googleClientId": "498393666682-9eeiioee0a2sgb1671e9qir645f9n6cv.apps.googleusercontent.com", + "walletconnect": "feeab08b50e0d407f4eb875d69e162e8" }, - { - "chain": "SORA-dev Testnet #2", - "name": "SORA", - "address": "wss://ws.framenode-2.r0.dev.sora2.soramitsu.co.jp", - "location": "SG" + "FEATURE_FLAGS": { + "moonpay": false, + "x1ex": false, + "charts": false, + "soraCard": false, + "orderBook": false, + "adarSwapEnabled": false }, - { - "chain": "SORA-dev Testnet #3", - "name": "SORA", - "address": "wss://ws.framenode-3.r0.dev.sora2.soramitsu.co.jp" - }, - { - "chain": "SORA-dev Liberland", - "name": "SORA", - "address": "wss://ws.framenode-1.lib1.dev.sora2.soramitsu.co.jp" - } - ], - "SUBQUERY_ENDPOINT": "https://api.subquery.network/sq/sora-xor/sora-test", - "SUBSQUID_ENDPOINT": "", - "NETWORK_TYPE": "Dev", - "CHAIN_GENESIS_HASH": "", - "EVM_NETWORKS_IDS": [97, 1001], - "SUB_NETWORKS": { - "Rococo": [ + "FAUCET_URL": "https://faucet.dev.sora2.tachi.soramitsu.co.jp/", + "DEFAULT_NETWORKS": [ { - "chain": "Rococo Dev Testnet", - "name": "Soramitsu", - "address": "wss://ws.relaychain-node-1.r1.dev.sora2.soramitsu.co.jp" - } - ], - "RococoSora": [ + "chain": "SORA-test Testnet #1", + "name": "SORA", + "address": "wss://ws.framenode-1.r0.tst.sora2.soramitsu.co.jp", + "location": "FR" + }, { - "chain": "SORA Rococo Parachain Dev Testnet", - "name": "Soramitsu", - "address": "wss://ws.parachain-collator-1.c1.dev.sora2.soramitsu.co.jp" + "chain": "SORA-dev Testnet #2", + "name": "SORA", + "address": "wss://ws.framenode-2.r0.dev.sora2.soramitsu.co.jp", + "location": "SG" + }, + { + "chain": "SORA-dev Testnet #3", + "name": "SORA", + "address": "wss://ws.framenode-3.r0.dev.sora2.soramitsu.co.jp" + }, + { + "chain": "SORA-dev Liberland", + "name": "SORA", + "address": "wss://ws.framenode-1.lib1.dev.sora2.soramitsu.co.jp" } ], - "Liberland": [ - { - "chain": "Liberland Dev Testnet", - "name": "Soramitsu", - "address": "wss://ws.liberland-node-1.lib1.dev.sora2.soramitsu.co.jp" + "SUBQUERY_ENDPOINT": "https://api.subquery.network/sq/sora-xor/sora-test", + "SUBSQUID_ENDPOINT": "", + "NETWORK_TYPE": "Dev", + "CHAIN_GENESIS_HASH": "", + "EVM_NETWORKS_IDS": [97, 1001], + "SUB_NETWORKS": { + "Rococo": [ + { + "chain": "Rococo Dev Testnet", + "name": "Soramitsu", + "address": "wss://ws.relaychain-node-1.r1.dev.sora2.soramitsu.co.jp" + } + ], + "RococoSora": [ + { + "chain": "SORA Rococo Parachain Dev Testnet", + "name": "Soramitsu", + "address": "wss://ws.parachain-collator-1.c1.dev.sora2.soramitsu.co.jp" + } + ], + "Liberland": [ + { + "chain": "Liberland Dev Testnet", + "name": "Soramitsu", + "address": "wss://ws.liberland-node-1.lib1.dev.sora2.soramitsu.co.jp" + } + ] + }, + "ETH_BRIDGE": { + "evmNetwork": 11155111, + "address": { + "XOR": "0x7F62CCd5566c64cfb785f73B3c19653D93e5414c", + "VAL": "0xe2C58207Cc6dF5565044eccffdf7aeb2DAe89647", + "OTHER": "0x401c6A23a44f72151D90878DF0aa86E77fBde0e2" } - ] - }, - "ETH_BRIDGE": { - "evmNetwork": 11155111, - "address": { - "XOR": "0x7F62CCd5566c64cfb785f73B3c19653D93e5414c", - "VAL": "0xe2C58207Cc6dF5565044eccffdf7aeb2DAe89647", - "OTHER": "0x401c6A23a44f72151D90878DF0aa86E77fBde0e2" } } -} diff --git a/src/abi/ethereum/other/BRIDGE_WRAPPER.json b/src/abi/ethereum/other/BRIDGE_WRAPPER.json new file mode 100644 index 000000000..4db736d2e --- /dev/null +++ b/src/abi/ethereum/other/BRIDGE_WRAPPER.json @@ -0,0 +1,409 @@ +{ + "abi": [ + { + "constant": false, + "inputs": [ + { + "internalType": "address", + "name": "bridgeAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "initialAdmin", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "AdminAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "AdminDoesNotExist", + "type": "error" + }, + { + "inputs": [], + "name": "ArrayLengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "BridgeTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "BridgeZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "CannotRemoveLastAdmin", + "type": "error" + }, + { + "inputs": [], + "name": "DistributedAmountMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAdminAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidDistributionAmount", + "type": "error" + }, + { + "inputs": [], + "name": "NotAdmin", + "type": "error" + }, + { + "inputs": [], + "name": "RecipientZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [], + "name": "SendEtherFailed", + "type": "error" + }, + { + "inputs": [], + "name": "WalletTransferFailed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isAdded", + "type": "bool" + } + ], + "name": "AdminUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "recipients", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "AssetsDistributed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + } + ], + "name": "AssetsReceived", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "admin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "admins", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "bridgeContract", + "outputs": [ + { + "internalType": "contract IBridge", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "getBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "sidechainId", + "type": "bytes32" + } + ], + "name": "getSidechainTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "getSidechainTokenId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "encodedData", + "type": "bytes" + }, + { + "internalType": "address[]", + "name": "recipients", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "receiveAndDistribute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "recipients", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "receiveFromWalletAndDistribute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "admin", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "sweep", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ] +} \ No newline at end of file diff --git a/src/consts/evm.ts b/src/consts/evm.ts index 207ccba8d..09699b675 100644 --- a/src/consts/evm.ts +++ b/src/consts/evm.ts @@ -2,6 +2,7 @@ import { EvmNetworkId } from '@sora-substrate/util/build/bridgeProxy/evm/consts' import INTERNAL_ABI from '@/abi/ethereum/internal/MASTER.json'; import BRIDGE_ABI from '@/abi/ethereum/other/BRIDGE.json'; +import BRIDGE_WRAPPER_ABI from '@/abi/ethereum/other/BRIDGE_WRAPPER.json'; import ERC20_ABI from '@/abi/ethereum/other/ERC20.json'; import type { NetworkData } from '@/types/bridge'; @@ -16,6 +17,7 @@ export enum KnownEthBridgeAsset { VAL = 'VAL', XOR = 'XOR', Other = 'OTHER', + MultiSendBridge = 'BRIDGE_WRAPPER', } export enum SmartContractType { @@ -28,6 +30,7 @@ export const SmartContracts = { [KnownEthBridgeAsset.XOR]: INTERNAL_ABI, [KnownEthBridgeAsset.VAL]: INTERNAL_ABI, [KnownEthBridgeAsset.Other]: BRIDGE_ABI, + [KnownEthBridgeAsset.MultiSendBridge]: BRIDGE_WRAPPER_ABI, }, [SmartContractType.ERC20]: ERC20_ABI, }; diff --git a/src/modules/ADAR/components/RouteAssets/Stages/Done.vue b/src/modules/ADAR/components/RouteAssets/Stages/Done.vue index 84a0a0637..eca6afba3 100644 --- a/src/modules/ADAR/components/RouteAssets/Stages/Done.vue +++ b/src/modules/ADAR/components/RouteAssets/Stages/Done.vue @@ -103,6 +103,7 @@ import { jsPDF as JsPDF } from 'jspdf'; import autoTable, { RowInput } from 'jspdf-autotable'; import { Component, Mixins } from 'vue-property-decorator'; +import NetworkFormatterMixin from '@/components/mixins/NetworkFormatterMixin'; import TranslationMixin from '@/components/mixins/TranslationMixin'; import Spinner from '@/modules/ADAR/components/App/shared/InlineSpinner.vue'; import { AdarComponents } from '@/modules/ADAR/consts'; @@ -131,7 +132,7 @@ import type { HistoryItem } from '@sora-substrate/util'; Spinner, }, }) -export default class RoutingCompleted extends Mixins(TranslationMixin) { +export default class RoutingCompleted extends Mixins(TranslationMixin, NetworkFormatterMixin) { @getter.routeAssets.inputToken inputToken!: Asset; @getter.routeAssets.incompletedRecipients private incompletedRecipients!: Array; @getter.routeAssets.recipients private recipients!: Array; @@ -143,16 +144,20 @@ export default class RoutingCompleted extends Mixins(TranslationMixin) { @getter.routeAssets.maxInputAmount maxInputAmount!: MaxInputAmountInfo; @getter.routeAssets.txHistoryData txHistoryData!: HistoryItem; @getter.routeAssets.batchTxStatus batchTxStatus!: SwapTransferBatchStatus; + @getter.routeAssets.externalTotalAmount externalTotalAmount!: string; @getter.routeAssets.recipientsGroupedByToken recipientsGroupedByToken!: ( asset?: Asset | AccountAsset ) => SummaryAssetRecipientsInfo[]; + @getter.routeAssets.isExternalTransaction isExternalTransaction!: boolean; + showFailedTransactionsDialog = false; showFinishRoutingDialog = false; showSelectReportFormatDialog = false; get finalAmount() { if (this.batchTxStatus === SwapTransferBatchStatus.FAILED) return '0'; + if (this.isExternalTransaction) return this.externalTotalAmount; return this.txHistoryData?.amount; } @@ -227,6 +232,10 @@ export default class RoutingCompleted extends Mixins(TranslationMixin) { // this.t('adar.routeAssets.status'), ]; + get networkName(): string { + return this.formatNetworkShortName(!this.isExternalTransaction); + } + getReportData(isCsv = false) { return this.recipients.map((recipient, idx) => { const usd = recipient.usd.dp(2); @@ -256,6 +265,7 @@ export default class RoutingCompleted extends Mixins(TranslationMixin) { // `Sender wallet - ${from}\n` + `${this.t('adar.routeAssets.stages.done.report.datetime')} - ${datetime?.toUTCString()}\n` + `${this.t('adar.routeAssets.stages.done.report.timestampUTC')} - ${datetime?.getTime()}\n` + + `${this.networkName}\n` + this.headers.join(',') + `,${this.t('adar.routeAssets.stages.done.report.transactionId')},${this.t( 'adar.routeAssets.stages.done.report.blockNumber' @@ -284,10 +294,11 @@ export default class RoutingCompleted extends Mixins(TranslationMixin) { doc.text(`${this.t('adar.routeAssets.stages.done.report.senderWallet')} - ${from}`, 5, 20); doc.text(`${this.t('adar.routeAssets.stages.done.report.datetime')} - ${datetime?.toUTCString()}`, 5, 25); doc.text(`${this.t('adar.routeAssets.stages.done.report.timestampUTC')} - ${datetime?.getTime()}`, 5, 30); + doc.text(`${this.networkName}`, 5, 35); autoTable(doc, { head: [this.headers], body: this.getReportData() as RowInput[], - startY: 35, + startY: 40, rowPageBreak: 'avoid', margin: { top: 5, left: 5, right: 5, bottom: 5 }, styles: { diff --git a/src/modules/ADAR/components/RouteAssets/Stages/ProcessTemplate.vue b/src/modules/ADAR/components/RouteAssets/Stages/ProcessTemplate.vue index 5d6021e8b..37add28b8 100644 --- a/src/modules/ADAR/components/RouteAssets/Stages/ProcessTemplate.vue +++ b/src/modules/ADAR/components/RouteAssets/Stages/ProcessTemplate.vue @@ -106,8 +106,51 @@ +
+ + + + +
+ + {{ t('changeAccountText') }} + + + {{ t('disconnectWalletText') }} + +
+
+ {{ t('connectWalletText') }} + + + {{ t('rewards.action.connectExternalWallet') }} + + + {{ t('changeNetworkText') }} + + +
diff --git a/src/modules/ADAR/components/RouteAssets/Stages/RoutingBridge.vue b/src/modules/ADAR/components/RouteAssets/Stages/RoutingBridge.vue new file mode 100644 index 000000000..7979d609d --- /dev/null +++ b/src/modules/ADAR/components/RouteAssets/Stages/RoutingBridge.vue @@ -0,0 +1,833 @@ + + + + + + + diff --git a/src/modules/ADAR/components/RouteAssets/Stages/TransactionOverview.vue b/src/modules/ADAR/components/RouteAssets/Stages/TransactionOverview.vue index 938a72578..e509ad364 100644 --- a/src/modules/ADAR/components/RouteAssets/Stages/TransactionOverview.vue +++ b/src/modules/ADAR/components/RouteAssets/Stages/TransactionOverview.vue @@ -102,6 +102,18 @@ + + + + + +