Skip to content

Commit

Permalink
Merge pull request #1 from AstarNetwork/astar-stg
Browse files Browse the repository at this point in the history
Astar stg
  • Loading branch information
DenSmolonski authored Sep 5, 2024
2 parents 131c2b2 + 44ea803 commit 08737d1
Show file tree
Hide file tree
Showing 470 changed files with 11,894 additions and 13,392 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@ inputs:

runs:
using: 'composite'

steps:
- name: Set environment variables
shell: bash
run: |
if [ "${{ inputs.prod }}" = "true" ]; then
echo "NEXT_PUBLIC_INFURA_TOKEN=${{ fromJSON(inputs.secrets).NEXT_PUBLIC_INFURA_TOKEN }}" >> $GITHUB_ENV
echo "NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN=${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN }}" >> $GITHUB_ENV
else
echo "NEXT_PUBLIC_INFURA_TOKEN=${{ fromJSON(inputs.secrets).NEXT_PUBLIC_INFURA_TOKEN_DEVSTAGING }}" >> $GITHUB_ENV
echo "NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN=${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN_DEVSTAGING }}" >> $GITHUB_ENV
fi
- name: Build
shell: bash
run: yarn build
Expand All @@ -31,8 +43,6 @@ runs:
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID }}
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LATEST_AUTH: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LATEST_AUTH }}
NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LIVE_AUTH: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_GOOGLE_TAG_MANAGER_LIVE_AUTH }}
NEXT_PUBLIC_INFURA_TOKEN: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_INFURA_TOKEN }}
NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_APPS_INFURA_TOKEN }}
NEXT_PUBLIC_SENTRY_DSN: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SENTRY_DSN }}
NEXT_PUBLIC_TENDERLY_ORG_NAME: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_ORG_NAME }}
NEXT_PUBLIC_TENDERLY_PROJECT_NAME: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_PROJECT_NAME }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: ./.github/workflows/build
with:
secrets: ${{ toJSON(secrets) }}
prod: ${{ github.ref == 'refs/heads/main' }}
if: startsWith(github.ref, 'refs/heads/main')

- uses: ./.github/workflows/build-storybook

Expand All @@ -53,14 +53,14 @@ jobs:

# Staging
- name: Deploy to the staging S3
if: github.ref == 'refs/heads/main'
if: startsWith(github.ref, 'refs/heads/main')
env:
BUCKET: s3://${{ secrets.AWS_STAGING_BUCKET_NAME }}/current
run: bash ./scripts/github/s3_upload.sh

# Dev
- name: Deploy to the dev S3
if: github.ref == 'refs/heads/dev'
if: startsWith(github.ref, 'refs/heads/dev')
env:
BUCKET: s3://${{ secrets.AWS_DEVELOPMENT_BUCKET_NAME }}
run: bash ./scripts/github/s3_upload.sh
Expand Down
29 changes: 6 additions & 23 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ jobs:
id-token: write

runs-on: ubuntu-latest

name: Deploy release

env:
ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}

steps:
- uses: actions/checkout@v4

Expand All @@ -36,36 +39,16 @@ jobs:
aws-region: ${{ secrets.AWS_REGION }}

# Script to upload release files
- name: 'Upload release build files for production'
- name: Upload release build files for production
env:
BUCKET: s3://${{ secrets.AWS_STAGING_BUCKET_NAME }}/releases/${{ github.event.release.tag_name }}
CHECKSUM_FILE: ${{ env.ARCHIVE_NAME }}-sha256-checksum.txt
run: bash ./scripts/github/s3_upload.sh

# Script to prepare production deployments
- run: bash ./scripts/github/prepare_production_deployment.sh
- name: Prepare deployment
run: bash ./scripts/github/prepare_production_deployment.sh
env:
PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }}
PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }}
VERSION_TAG: ${{ github.event.release.tag_name }}

# Update the GitHub release with a checksummed archive
- name: Upload archive
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ARCHIVE_NAME }}.tar.gz
asset_name: ${{ env.ARCHIVE_NAME }}.tar.gz
asset_content_type: application/gzip
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload checksum
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ARCHIVE_NAME }}-sha256-checksum.txt
asset_name: ${{ env.ARCHIVE_NAME }}-sha256-checksum.txt
asset_content_type: text/plain
env:
GITHUB_TOKEN: ${{ github.token }}
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ Here's the list of all the environment variables:
| `NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION` | FCM vapid key on production
| `NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING` | FCM `initializeApp` options on staging
| `NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING` | FCM vapid key on staging
| `NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_PRODUCTION` | Web3Auth and Google credentials (production)
| `NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING` | Web3Auth and Google credentials (staging)
| `NEXT_PUBLIC_SPINDL_SDK_KEY` | [Spindl](http://spindl.xyz) SDK key

If you don't provide some of the variables, the corresponding features will be disabled in the UI.
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default defineConfig({
mochaFile: 'reports/junit-[hash].xml',
},
retries: {
runMode: 2,
runMode: 3,
openMode: 0,
},
e2e: {
Expand Down
7 changes: 5 additions & 2 deletions cypress/e2e/happypath/recovery_hp_1.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import * as owner from '../pages/owners.pages'
import * as recovery from '../pages/recovery.pages'
import * as tx from '../pages/transactions.page'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'

let recoverySafes = []
//
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Recovery happy path tests 1', () => {
before(async () => {
recoverySafes = await getSafes(CATEGORIES.recovery)
Expand All @@ -20,8 +23,8 @@ describe('Recovery happy path tests 1', () => {

// Check that recovery can be setup and removed
it('Recovery setup happy path 1', () => {
wallet.connectSigner(signer)
owner.waitForConnectionStatus()
cy.reload()
recovery.clearRecoverers()
recovery.clickOnSetupRecoveryBtn()
recovery.clickOnSetupRecoveryModalBtn()
Expand Down
9 changes: 5 additions & 4 deletions cypress/e2e/happypath/sendfunds_connected_wallet.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { createEthersAdapter, createSigners } from '../../support/api/utils_ethe
import { createSafes } from '../../support/api/utils_protocolkit'
import { contracts, abi_qtrust, abi_nft_pc2 } from '../../support/api/contracts'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'

const safeBalanceEth = 305220000000000000n
const qtrustBanance = 93000000000000000025n
const transferAmount = '1'

const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

const tokenAmount2 = '0.00001'
const netwrok = 'sepolia'
Expand Down Expand Up @@ -81,6 +81,7 @@ describe('Send funds with connected signer happy path tests', { defaultCommandTi

function executeTransactionFlow(fromSafe, toSafe) {
return cy.visit(constants.balanceNftsUrl + fromSafe).then(() => {
wallet.connectSigner(signer)
nfts.selectNFTs(1)
nfts.sendNFT()
nfts.typeRecipientAddress(toSafe)
Expand Down Expand Up @@ -112,6 +113,7 @@ describe('Send funds with connected signer happy path tests', { defaultCommandTi
const targetSafe = safesData.SEP_FUNDS_SAFE_12.substring(4)
function executeTransactionFlow(fromSafe, toSafe, tokenAmount) {
visit(constants.BALANCE_URL + fromSafe)
wallet.connectSigner(signer)
assets.clickOnSendBtn(0)
loadsafe.inputOwnerAddress(0, toSafe)
assets.checkSelectedToken(constants.tokenAbbreviation.sep)
Expand Down Expand Up @@ -155,7 +157,6 @@ describe('Send funds with connected signer happy path tests', { defaultCommandTi
const safeTx = await apiKit.getTransaction(safeTxHashofExistingTx)
await protocolKitOwner2_S3.executeTransaction(safeTx)
main.verifyNonceChange(network_pref + targetSafe, currentNonce + 1)
main.checkTokenBalance(network_pref + targetSafe, constants.tokenAbbreviation.eth, safeBalanceEth)
})
})

Expand All @@ -166,6 +167,7 @@ describe('Send funds with connected signer happy path tests', { defaultCommandTi

function executeTransactionFlow(fromSafe, toSafe) {
visit(constants.BALANCE_URL + fromSafe)
wallet.connectSigner(signer)
assets.selectTokenList(assets.tokenListOptions.allTokens)
assets.clickOnSendBtn(1)
loadsafe.inputOwnerAddress(0, toSafe)
Expand All @@ -188,7 +190,6 @@ describe('Send funds with connected signer happy path tests', { defaultCommandTi

await tx.wait()
main.verifyNonceChange(network_pref + originatingSafe, currentNonce + 1)
main.checkTokenBalance(network_pref + originatingSafe, constants.tokenAbbreviation.qtrust, qtrustBanance)
})
})
})
71 changes: 40 additions & 31 deletions cypress/e2e/happypath/sendfunds_queue_1.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import SafeApiKit from '@safe-global/api-kit'
import { createEthersAdapter, createSigners } from '../../support/api/utils_ether'
import { createSafes } from '../../support/api/utils_protocolkit'
import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
import * as wallet from '../../support/utils/wallet.js'

const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const receiver = walletCredentials.OWNER_2_WALLET_ADDRESS
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

const tokenAmount = '0.0001'
const netwrok = 'sepolia'
Expand Down Expand Up @@ -46,6 +48,7 @@ function visit(url) {

function executeTransactionFlow(fromSafe) {
visit(constants.transactionQueueUrl + fromSafe)
wallet.connectSigner(signer)
assets.clickOnConfirmBtn(0)
tx.executeFlow_1()
cy.wait(5000)
Expand Down Expand Up @@ -78,41 +81,46 @@ describe('Send funds from queue happy path tests 1', () => {
protocolKitOwner2_S3 = safes[3]
})

it('Verify confirmation and execution of native token queued tx by second signer with connected wallet', () => {
cy.wrap(null)
.then(() => {
return main.fetchCurrentNonce(network_pref + existingSafeAddress1)
})
.then(async (currentNonce) => {
const amount = ethers.parseUnits(tokenAmount, unit_eth).toString()
const safeTransactionData = {
to: receiver,
data: '0x',
value: amount.toString(),
}

const safeTransaction = await protocolKitOwnerS1.createTransaction({ transactions: [safeTransactionData] })
const safeTxHash = await protocolKitOwnerS1.getTransactionHash(safeTransaction)
const senderSignature = await protocolKitOwnerS1.signHash(safeTxHash)
const safeAddress = existingSafeAddress1

await apiKit.proposeTransaction({
safeAddress,
safeTransactionData: safeTransaction.data,
safeTxHash,
senderAddress: await owner1Signer.getAddress(),
senderSignature: senderSignature.data,
it(
'Verify confirmation and execution of native token queued tx by second signer with connected wallet',
{ defaultCommandTimeout: 300000 },
() => {
cy.wrap(null)
.then(() => {
return main.fetchCurrentNonce(network_pref + existingSafeAddress1)
})

executeTransactionFlow(safeAddress)
cy.wait(5000)
main.verifyNonceChange(network_pref + safeAddress, currentNonce + 1)
})
})
.then(async (currentNonce) => {
const amount = ethers.parseUnits(tokenAmount, unit_eth).toString()
const safeTransactionData = {
to: receiver,
data: '0x',
value: amount.toString(),
}

const safeTransaction = await protocolKitOwnerS1.createTransaction({ transactions: [safeTransactionData] })
const safeTxHash = await protocolKitOwnerS1.getTransactionHash(safeTransaction)
const senderSignature = await protocolKitOwnerS1.signHash(safeTxHash)
const safeAddress = existingSafeAddress1

await apiKit.proposeTransaction({
safeAddress,
safeTransactionData: safeTransaction.data,
safeTxHash,
senderAddress: await owner1Signer.getAddress(),
senderSignature: senderSignature.data,
})

executeTransactionFlow(safeAddress)
cy.wait(5000)
main.verifyNonceChange(network_pref + safeAddress, currentNonce + 1)
})
},
)

it.skip('Verify confirmation and execution of native token queued tx by second signer with relayer', () => {
function executeTransactionFlow(fromSafe) {
visit(constants.transactionQueueUrl + fromSafe)
wallet.connectSigner(signer)
assets.clickOnConfirmBtn(0)
tx.executeFlow_2()
cy.wait(5000)
Expand Down Expand Up @@ -148,9 +156,10 @@ describe('Send funds from queue happy path tests 1', () => {
})
})

it('Verify 1 signer can execute a tx confirmed by 2 signers', () => {
it('Verify 1 signer can execute a tx confirmed by 2 signers', { defaultCommandTimeout: 300000 }, () => {
function executeTransaction(fromSafe) {
visit(constants.transactionQueueUrl + fromSafe)
wallet.connectSigner(signer)
assets.clickOnExecuteBtn(0)
tx.executeFlow_3()
cy.wait(5000)
Expand Down
Loading

0 comments on commit 08737d1

Please sign in to comment.