-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into feature/PRO-305-int…
…egration-of-stargate-for-bridging
- Loading branch information
Showing
113 changed files
with
7,184 additions
and
1,597 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Check if package version is updated | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
start: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Check if version has been updated | ||
id: check | ||
uses: EndBug/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
file-name: ./package.json | ||
- name: Log when changed | ||
if: steps.check.outputs.changed == 'true' | ||
run: 'echo "Yayy!! Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"' | ||
- name: Log when unchanged | ||
if: steps.check.outputs.changed == 'false' | ||
run: echo "No version change :/ Please update version in package.json!" && exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,12 +19,12 @@ jobs: | |
mkdir -p ~/.ssh | ||
ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | ||
ssh-add - <<< "${{ secrets.SSH_KEY_DOCS }}" | ||
ssh-add - <<< "${{ secrets.SSH_MACHINE_KEY_DOCS }}" | ||
- name: Setup git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "ETHERspot" | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "EtherspotBOT" | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
name: Static code analyzer | ||
name: CodeQL scan | ||
|
||
on: | ||
push: | ||
branches: [ master, develop ] | ||
branches: [master] | ||
pull_request: | ||
branches: [ master, develop ] | ||
branches: [master] | ||
|
||
jobs: | ||
njsscan: | ||
analyze: | ||
runs-on: ubuntu-latest | ||
name: Run static code analyzer | ||
|
||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v2 | ||
- name: nodejsscan scan | ||
id: njsscan | ||
uses: ajinabraham/njsscan-action@master | ||
with: | ||
args: 'src --sarif --output results.sarif || true' | ||
- name: Upload njsscan report | ||
uses: github/codeql-action/upload-sarif@v1 | ||
with: | ||
sarif_file: results.sarif | ||
- name: Checkout repository | ||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@807578363a7869ca324a79039e6db9c843e0e100 | ||
with: | ||
queries: security-and-quality | ||
languages: javascript | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@807578363a7869ca324a79039e6db9c843e0e100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run lint | ||
npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { BigNumber, Wallet, constants, ethers } from 'ethers'; | ||
import { EnvNames, NetworkNames, Sdk } from '../../src'; | ||
import { logger } from './common'; | ||
|
||
async function main(): Promise<void> { | ||
const wallet = Wallet.createRandom(); | ||
const sdk = new Sdk(wallet, { | ||
env: EnvNames.MainNets, | ||
networkName: NetworkNames.Matic, | ||
}); | ||
|
||
await sdk.computeContractAccount(); | ||
const exchangeSupportedAssets = await sdk.getExchangeSupportedAssets({ page: 1, limit: 100 }); | ||
logger.log('found exchange supported assets', exchangeSupportedAssets.items.length); | ||
|
||
// NOTE: use ethers.constants.AddressZero for ETH | ||
const fromTokenAddress = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'; // USDC | ||
const toTokenAddress = constants.AddressZero; // ETH | ||
const fromAmount = ethers.utils.parseUnits('5', 6); // 5 USDC | ||
|
||
const offers = await sdk.getExchangeOffers({ | ||
fromTokenAddress, | ||
toTokenAddress, | ||
fromAmount: BigNumber.from(fromAmount), | ||
}); | ||
console.log('offers: ', offers); | ||
const offer = offers[0]; // Selected the first offer that we got | ||
console.log( | ||
'selected exchange offers', | ||
offer, | ||
offer.transactions, | ||
); | ||
await sdk.clearGatewayBatch(); | ||
await sdk.batchExecuteAccountTransaction(offer.transactions[0]); | ||
await sdk.batchExecuteAccountTransaction(offer.transactions[1]); | ||
const estimation = await sdk.estimateGatewayBatch({ feeToken: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' }); // pay gas using USDC | ||
console.log('estimate: ', estimation); | ||
await sdk.submitGatewayBatch(); | ||
|
||
} | ||
|
||
main() | ||
.catch(logger.error) | ||
.finally(() => process.exit()); |
Oops, something went wrong.