Skip to content

Commit

Permalink
Merge pull request #823 from divaprotocol/add-liquidity-entity-in-sub…
Browse files Browse the repository at this point in the history
…graph

Add `Liquidity` entity in subgraph and `takerTokenFeeFilledAmount` field
  • Loading branch information
Walodja1987 authored Jul 3, 2024
2 parents c094db1 + af9c0c1 commit a4941b0
Show file tree
Hide file tree
Showing 33 changed files with 11,815 additions and 18,402 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ assignees: ""
3. App crashes (see screenshot)
-->

## Screenshots / Sreen recording
## Screenshots / Screen recording

<!-- Screenshots and/or screen recordings really go a long way to explain
something and help us to tackle the issue. (We use loom for this https://www.loom.com/) -->
43 changes: 22 additions & 21 deletions .github/workflows/deploy-infrastructure-and-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ on:
- 'packages/diva-infrastructure/**'
- '.github/workflows/deploy-infrastructure-and-website.yml'

name: Deploy Infrastructure
name: Deploy Infrastructure and Website

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Configure AW0S credentials
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -23,41 +24,41 @@ jobs:
- name: Checkout current branch
uses: actions/checkout@v3

- uses: actions/setup-node@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: '18'
cache: 'yarn'

- name: Cache Modules
id: cache-modules
- name: Cache Node Modules and Turbo Cache
uses: actions/cache@v2
with:
path: |
**/node_modules
node_modules
key: ${{ hashFiles('**/yarn.lock', '**/package.json', 'yarn.lock') }}

- name: Cache Turbo Cache
id: build-turbo
uses: actions/cache@v2
with:
path: .turbo
key: ${{ hashFiles('packages/**/*') }}
**/.yarn/cache
.turbo
key: ${{ runner.os }}-yarn-turbo-${{ hashFiles('**/yarn.lock', '**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-turbo-
- name: Install dependencies
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn
run: yarn install --frozen-lockfile

- name: Build
- name: Verify Node.js and Yarn Versions
run: |
node -v
yarn -v
- name: Build Infrastructure and App
run: yarn turbo run build --filter=@diva/infrastructure --filter=@diva/app --cache-dir="./.turbo"
env:
CI: false
REACT_APP_INFURA_KEY: ${{ secrets.REACT_APP_INFURA_KEY }}

- name: Deploy Infra
- name: Deploy Infrastructure
run: yarn turbo run deploy --scope="@diva/infrastructure"

- name: sync to s3 and invalidate cache
- name: Sync to S3 and Invalidate CloudFront Cache
run: |
aws s3 sync packages/diva-app/build s3://app.diva.finance
aws cloudfront create-invalidation --distribution-id E2HCWZDF4NN8G6 --paths '/*'
33 changes: 20 additions & 13 deletions .github/workflows/deploy-subgraphs-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,42 @@ on:
- packages/*-subgraph/**/*

name: Deploy production subgraph

jobs:
pr:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: actions/setup-node@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: '18'
cache: 'yarn'

- name: Cache Modules
id: cache-modules
- name: Cache Node Modules and ABIs
uses: actions/cache@v2
with:
path: |
**/node_modules
node_modules
**/.yarn/cache
**/abis
key: ${{ hashFiles('**/yarn.lock', '**/package.json', 'yarn.lock') }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock', '**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn
- name: Authenticate the graph and deploy
run: yarn install --frozen-lockfile

- name: Verify Node.js and Yarn Versions
run: |
node -v
yarn -v
- name: Authenticate with The Graph and Deploy
env:
THEGRAPH_ACCESS_TOKEN: ${{ secrets.THEGRAPH_ACCESS_TOKEN_TEST }}
THEGRAPH_ACCESS_TOKEN: ${{ secrets.THEGRAPH_ACCESS_TOKEN_PROD }}
run: |
yarn graph:auth
yarn turbo run deploy --scope="@diva/*-subgraph"
34 changes: 21 additions & 13 deletions .github/workflows/deploy-subgraphs-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ on:
pull_request:
paths:
- packages/*-subgraph/**/*

name: Deploy Staging subgraph

jobs:
pr:
runs-on: ubuntu-latest
Expand All @@ -12,27 +14,33 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: actions/setup-node@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: '18'
cache: 'yarn'

- name: Cache Modules
id: cache-modules
- name: Cache Node Modules
uses: actions/cache@v2
with:
path: |
**/node_modules
node_modules
key: ${{ hashFiles('**/yarn.lock', '**/package.json', 'yarn.lock') }}
**/.yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock', '**/package.json', 'yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn
- name: Authenticate the graph and deploy
env:
run: yarn install --frozen-lockfile

- name: Verify Node.js and Yarn Versions
run: |
node -v
yarn -v
- name: Authenticate with The Graph and Deploy
env:
THEGRAPH_ACCESS_TOKEN: ${{ secrets.THEGRAPH_ACCESS_TOKEN_TEST }}
run: |
yarn graph:auth
# yarn turbo run deploy-staging --scope="@diva/*-subgraph"


yarn turbo run deploy-staging --scope="@diva/*-subgraph"
15 changes: 14 additions & 1 deletion .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: '18'

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Check Node.js and Yarn versions
run: |
node -v
yarn -v
- name: Install dependencies
run: yarn
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.14
18.17.0
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"packageManager": "[email protected]",
"resolutions": {
"//": "See https://github.com/facebook/create-react-app/issues/11773",
"react-error-overlay": "6.0.9"
"**/concat-stream": "^1.6.2",
"react-error-overlay": "^6.0.11"
}
}
1 change: 1 addition & 0 deletions packages/diva-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@mui/material": "^5.1.0",
"@mui/styles": "^5.1.0",
"@mui/x-data-grid": "^5.2.1",
"@mui/x-date-pickers": "^7.3.2",
"@reduxjs/toolkit": "^1.6.1",
"@synthetixio/synpress": "^1.1.1",
"@testing-library/jest-dom": "^5.14.1",
Expand Down
54 changes: 28 additions & 26 deletions packages/diva-app/src/component/ApproveActionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export async function _checkConditions(
offerCreateContingentPool,
signature
)

// Confirm that the offer is fillable
// 0: INVALID, 1: CANCELLED, 2: FILLED, 3: EXPIRED, 4: FILLABLE
if (relevantStateParams.offerInfo.status === 0) {
Expand Down Expand Up @@ -180,31 +179,34 @@ export const ApproveActionButtons = ({
}
: null
const [mobile, setMobile] = useState(false)
useEffect(() => {
if (
diva != undefined &&
divaDomain != undefined &&
formik != undefined &&
formik.values != undefined &&
account != null
) {
_checkConditions(
diva,
divaDomain,
formik.values.jsonToExport, // offerCreationStats,
CREATE_POOL_TYPE,
formik.values.signature,
account,
parseUnits(formik.values.yourShare.toString(), decimal)
).then((res) => {
if (!res.success) {
setErrorMessage(res.message)
} else {
setErrorMessage('All good')
}
})
}
}, [formik != undefined && formik.values, account, diva, divaDomain])

// @todo Commented out this useEffect because it was causing problems in Create step 3 for some reason.
// It looked like this function was running although we didn't create an offer and hence formik.values.jsonToExport was undefined
// useEffect(() => {
// if (
// diva != undefined &&
// divaDomain != undefined &&
// formik != undefined &&
// formik.values != undefined &&
// account != null
// ) {
// _checkConditions(
// diva,
// divaDomain,
// formik.values.jsonToExport, // offerCreationStats,
// CREATE_POOL_TYPE,
// formik.values.signature,
// account,
// parseUnits(formik.values.yourShare.toString(), decimal)
// ).then((res) => {
// if (!res.success) {
// setErrorMessage(res.message)
// } else {
// setErrorMessage('All good')
// }
// })
// }
// }, [formik != undefined && formik.values, account, diva, divaDomain])
useEffect(() => {
if (window.innerWidth < 768) {
setMobile(true)
Expand Down
Loading

0 comments on commit a4941b0

Please sign in to comment.