Skip to content

Commit

Permalink
FE Release 2024-05-15 (#2642)
Browse files Browse the repository at this point in the history
* Update bl

* chore: lint bl

* RFQ: support multiple rebalance methods (#2556)

* WIP: refactor GetRebalanceMethod()

* Feat: implement more robust rebalance method handling

* Feat: move method validation to getRebalance() func

* Feat: manual impl for String() on RebalanceMethod

* Fix: tests

* Feat: add rebalance method clauses to TestGetRebalance

* Feat: use rebalance.Method to choose executor

* Cleanup: lint

* [goreleaser]

* [goreleaser]

* RFQ: drop requests for unsupported chains (#2563)

* Feat: check for unsupported chain in inventory manager

* Cleanup: lint

* [goreleaser]

* Fix: check for nil base fee

* [goreleaser]

* Feat: fee pricer gets gas price from SuggestGasPrice()

* [goreleaser]

* Fix: tests

* lint, add err around clientSuggestGasPrice

* Fix: tests

---------

Co-authored-by: aureliusbtc <82057759+aureliusbtc@users.noreply.github.com>

* RFQ: add decimals cache (#2502)

* Feat: add decimalsCache, refactor decimal fetching

* Cleanup: comments

* Fix: build

* Fix: use concurrent map

* CCTP: use chain listener instead of scribe (#2592)

* WIP: replace scribe with chain listener

* Fix: build

* Fix: tests

* Fix: rfq build

* Cleanup: remove unused enum

* Cleanup: revert test change

* Cleanup: comments

* Cleanup: lint

* Fix: build

* Fix: test

* docs(contracts-communication): move natspec from interfaces (#2595)

* docs: SynapseExecutionServiceV1

* docs: SynapseGasOracleV1

* docs: Interchain app templates

* docs: InterchainClientV1

* docs: InterchainDB

* docs: interchain modules

* docs: MessageBus

* style: make interfaces easier to read

* chore: fix linter warnings

* Publish

 - contracts-communication@1.5.4

* fix(sdk-rouder): remove cache hydration (#2597)

* fix: disable hydration

* chore: don't log quotes in the integration test

* Publish

 - @synapsecns/rest-api@1.0.63
 - @synapsecns/sdk-router@0.5.1
 - @synapsecns/synapse-interface@0.22.4
 - @synapsecns/widget@0.1.17

* update bl

* Revert "update bl"

This reverts commit ab56c7a.

* update bl

* feat(webhook): add webhook  (#2538)

* add models and endpoint, lacking logic

* just stuff

* just stuff

* made general db interface

* cleanup

* trying to test

* trying to test

* trying ot fix test

* remove interface{} from gorm models, start tests, rework db interface

* add signature

* secret

* look away for now

* finish db test

* finish tests

* add auth

* remove debugging log

* comments and nits

* lint

* appsecret and appid

* resolve comments

* swagger, lint

* feat(synapse-interface): maintenance aggregator using PAUSED_CHAINS (#2345)

* Aggregate maintenance events for banners and warning message

* Dynamically render countdown progress bars based on PAUSED_CHAIN

* Dynamically rendering banners

* Slightly organize

* ChainPause type applied to enforce maintenance event structure, pass in component messages as a prop

* Working with multiple events

* Add dev comments to MaintenanceBanner; refactor

* Add dev comments for MaintenanceWarningMessage; refactor

* Dev comments

* Organize components

* isChainIncluded util

* Clean

* Add ability to specify paused chains by from/to side (#2346)

* Allow indefinite maintenance components by setting end date to null

* Banners to show indefinitely as well

* Add props to disable banner / warning / countdown

* Implement disable warning

* Implement disable countdown, bridge pause still working

* Example

* Clean

* Update naming on Bridge page

* Update comment for isChainIncluded

* Create maintenance events reading from pausedChains.json

* Remove custom margins to allow Bridge parent gap styling to handle spacing

* Require all props to be defined

* Add Swap to maintenance warning messages

* Update useMaintenanceCountdownProgresses to allow distinction between Swap and Bridge pauses

* Move MaintenanceBanners into LandingPageWrapper so banner appears on all pages

* Add ability to specify whether to pause bridge / swap with maintenance event in json

* Clean

* Unused code

* Update dev comments

* Update pause start/end time name for legibility

* Create type guard to check for paused bridge module

* usePausedBridgeModules

* usePausedBridgeModules to filter out SDK quotes

* Initialize paused routes to handle specific route pauses instead of grouping with chain pauses

* Update paused route structure

* Filter for valid quotes based on paused routes

* Create a Set with paused bridge module names to improve time complexity

* Allow for all bridge modules to be paused with ALL

* Add ability to pause bridge modules for all chains, if chainId is left undefined

* Move json files to /v1/ version control folder

* Compare quotes against paused bridge modules more cleanly

* Paused bridge modules json control working

* Fix pausedChains json

* Create examples folder for pause jsons

* Retrigger build

* Fix banner flashing after clearing

* Add padding to banner Close button

* Update text sizing on progress bar

* Update prop naming to prevent confusion on start/end

* Clear chain pauses to ready PR

* Change json file naming to be more readable

* Use inputWarningMessage prop name to indicate warning placement

* Pause Doge activity using Maintenance, to replace prior Chain pause mechanism

* Doge chain paused chain prop values

* Remove paused from/to chainId constants

* Publish

 - @synapsecns/synapse-interface@0.21.0

* Exempt gh pages (#2541)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Deploy: `FastBridge` to Scroll (#2525)

* chore: add Base to `.env.example`

* chore: add Scroll config

* chore: bump devops dependency

* chore: yarn

* feat: deploy `FastBridge` on scroll

* Publish

 - FastBridge@0.2.1

* fix: update `forge-std` to 1.8.1, remove `ds-test`, use `solhint` for linting (#2545)

* chore: forge-std  v1.8.1, remove ds-test dep

* chore: remove ds-test from remappings

* refactor: state mutability

* chore: add solhint

* chore: yarn

* fix: unused imports

* fix: max line length

* Publish

 - contracts-communication@1.3.1
 - FastBridge@0.2.2
 - @synapsecns/solidity-devops@0.3.3

* chore: remove submodules from `contracts-rfq` (#2547)

* build: install OZ as npm module

* chore: update remappings

* refactor: fix compiler warnings in test contract

* chore: remove forge-std submodule

* chore: remove `openzeppelin-contracts` submodule

* fix: restore padding in `.gitmodules`

* Publish

 - FastBridge@0.2.3

* gogenerate

* Revert "gogenerate"

This reverts commit b40e602.

* im dumb

* generate

* tidy

* update swagger doc

* [goreleaser]

* [goreleaser]

---------

Co-authored-by: shampoobera <shampoo@berachain.com>
Co-authored-by: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com>
Co-authored-by: bigboydiamonds <bigboydiamonds@users.noreply.github.com>
Co-authored-by: trajan0x <83933037+trajan0x@users.noreply.github.com>
Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
Co-authored-by: χ² <88190723+ChiTimesChi@users.noreply.github.com>
Co-authored-by: ChiTimesChi <ChiTimesChi@users.noreply.github.com>

* rfq api cache (#2562)

* cache api result [goreleaser]

* clean up

* clean up 2

---------

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* add trace to sync (#2601)

* trace more

* cleanup

* allow use of mustache templates

---------

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* remove iconfig file (#2602)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* feat(contracts-communication): remove batching (#2599)

* feat: scaffold InterchainDB interface changes

* feat: scaffold Module interface changes

* feat: update InterchainEntry

* test: update DB tests

* test: update Client tests

* refactor: ModuleBatch -> ModuleEntry

* feat: remove `entryIndex` from InterchainTx

* feat: scaffold Client interface changes

* feat: start updating the Module

* test: update integration tests

* cleanup: remove BatchingV1

* feat: update InterchainDB

* cleanup: remove entryIndex from apps

* cleanup: remove entryIndex from Client events

* feat: update ClientV1

* cleanup: remove entryIndex from DB

* test: update SynapseModule tests

* cleanup: ClientV1

* cleanup: DB

* cleanup: Module

* cleanup: remove batch lib

* docs: smol fixes

* Publish

 - contracts-communication@1.6.0

* optional screener for cctp relayer (#2600)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Sin/testnet 9 (#2567)

* fix: remove `ExecutionFees` references

* New set of deployments

* Adjust config files to the latest changes

* adding spectral coingecko ids for pricing (#2596)

* feat(widget): suppress console errors (#2594)

* Allow widget to suppress Synapse console errors

* feat(sdk-router): router cache error log (#2591)

* Improve RouterCache error logging

* Add common error string to target at Consumer level

* Add common string to all console errors

* feat(widget): error logs (#2593)

* Add common base string to allow hiding Widget related errors outputted in Consumer app

* Convert logs into errors if firing in catch statement

* Update README

* Optional prop

* Switch catch log to error

* Re-trigger action

* Remove line

* Publish

 - @synapsecns/rest-api@1.0.64
 - @synapsecns/sdk-router@0.6.0
 - @synapsecns/synapse-interface@0.22.5
 - @synapsecns/widget@0.2.0

* fix(contracts-communication): interchain module ignore nonces (#2604)

* feat: remove dbNonce from Module interface

* cleanup: update Module interface references

* refactor: lint

* Publish

 - contracts-communication@1.6.1

* feat(synapse-interface): bridge gas handler (#2437)

* Initial gas data slice state

* Async thunk fetchGasData

* Add gas data reducers

* useFetchGasDataOnInterval added to Bridge Listener

* Explicitly declare fetching gas data in gwei

* Calculate max bridgeable amount

* On max balance factoring in gas cost

* Add comment

* Differentiate max balance vs max bridgeable balance

* Add error toaster for when max balance less than bridge fee

* refactor; calculateGasFeeInGwei()

* Move to util

* Fix lint error

* Fetch gas when fromChainId on bridge card changes

* Use exact token balance when calculate max bridgeable amount

* Conditions for showing max button

* showMaxOption to determine display

* Disable max button if gas fees more than gas balance

* Clean jsx

* AvailableBalance component to track subscript detail in bridge origin input

* Return raw and formatted gas cost in calculateGasCost

* Update comments

* Fix imports based on name cange

* Use parsed

* calculateMaxBridgeableGas

* Clean

* refactor: clean InputContainer

* Replace onMaxBalance() with onMaxBridgeableBalance()`

* Allow undefined object when destructuring

* Display when token balance is trace balance

* Typing

* showGasReserved

* Update avail balance text and color when gas cost greater than balance

* Detect when input value is less than required estimated gas

* onAvailableBalance applied

* Make opacity greater when Max button disabled

* Fix calculations for when gas input is enough to cover gas

* Clean

* Add hover tooltip for warning gas states

* Use tooltip to describe gas status

* Update tooltip text

* Add buffer to calculate gas cost, use 1.5x

* AvailableBalance component to replace label in AmountInput

* Display trace balances in AvailableBalance

* Fix naming

* Add HoverTooltip to Available Balance

* Add conditions for displaying gas error based on input

* Use full parsed balance when making comparisons for gas checks

* Show gas reserved in Available Balance

* hasOnlyZeroes to return true if string contains only zeroes and periods

* Display estimated gas cost in tool tip

* Remove Available Balance elements from AmountInput, migrated to AvailableBalance

* Display trace amount for input when displaying how much is reserved for gas

* Fetch estimated gas limit based on real bridge quote using max gas balance

* Fetching accurate gasLimit

* Fix Trace balance

* Set gasLimit to 0 if not valid bridge data avail

* ...

* Fix when gas covered msg appears

* Available Balance

* Clean available balance flow

* useGasEstimator hook to encapsulate logic to clean InputContainer

* Fix prop issue

* Remove duplicate HoverTooltip

* Move HoverTooltip to shared component folder

* Update gas fetch for wagmi v2, up limit to 1.7

* Estimated gas bridge quote fetched on load

* Update var naming

* Improve Available Balance flow

* Display estimated bridgeable balance on hover

* Show gas estimate when estimated gas cost available

* Do not show negative bridgable balance

* Separate out bridge gas limit calculations into smaller functions

* Wrap async functions with try catch

* Implement updated gas estimation flow

* Move gas estimate logic to useGasEstimator

* Move async sdk fetch functions to useGasEstimator file

* Remove unused vars

* Shorten est gas cost

* Improve code legibility in AvailableBalance

* Assign conditions to vars to reduce clutter

* Reset gas price data when fromChainId changes

* Reset fetched gas limit when fromChainId changes

* Clean

* Fix old import

* Fix max button placement

* Add loading state for useGasEstimator

* Remove available balance states for gas est

* Remove unused props

* Clean gas token detection in PortfolioTokenAsset

* Simplify onMaxBalance()

* Clean constants in InputContainer

* Clean token detail destructuring

* Include gas estimate when updating input from Portfolio token selection

* Fire error toaster if gas fees exceed balance

* Render error toaster when firing onMaxBalance callback instead of a side effect

* Clean useGasEstimator

* Ensure available balance does not show if wallet not connected, set default value if balances not loaded

* Replicate onMax behavior in Portfolio

* Use fetched gas

* Improve error handling in gas estimator

* ...

* Remove tooltip on AvailableBalance

* Remove balance prefill from Portfolio Token selection

* Update available balance in input based on max bridgeable gas toke

* Destructure estimateGasLimit callback from useGasEstimator to retrigger fetching gas estimate

* Refetch gas ata in estimateGasLimit callback

* Display total vs bridgeable balance on hover in Portfolio gas token when gas data available

* Update balance shown on hover

* Clean

* Simplify useFetchGasDataOnInterval

* Prevent unnecessary fetches, fix chain update old gas issue

* Fetch estimated bridgeable max gas amount onClick token max input, fill input once amount fetched

* Clean

* onMaxBalance will use default balanceif fetched bridgeable balance estimate returns null

* Show dust gas amounts on hover in Portfolio

* Clean

* Available balance including gas estimates moved to within Input to synchronize data

* Move gasLimit to global store to share data between Bridge components

* Display max bridgeable balance on hover in Portfolio, add onMaxBalance onClick Portfolio asset

* Portfolio and Input available balance onClick behave the same

* Fetch gas prices to provide most accurate gas cost

* Remove hover on AvailableBalance

* Fix Token Selector width

* Remove onClick Portfolio Token Balance, allow Token selection from Portfolio only without Balance input update

* Cursor default on Portfolio Token Balance

* Show available/max buttons when bridge valid selections

* Swap input to have available balance

* Clean

* Basic MaxButton onClick and hidden when loading gas data

* Show MaxButton when input is not full balance or bridgeable balance

* Implement Max button and placement in Bridge/Swap

* Hide MaxButton until connected

* Hide MaxButton conditions

* Show Max when all input selections are made

* Remove click states for AvailableBalance on Bridge/Swap

* Style Input / Max

* Max mobile size

* Fe/format amount (#2598)

* formatAmount util function, use rounded shortened values in Bridge/Swap Input

* Update Bridge/Swap page with parsed / formatted balances

* Clean imports

* Clean imports

* Swap Max spacing

* Improve html element composition

* Prevent layout shift in Swap UI

* Publish

 - @synapsecns/synapse-interface@0.23.0

* add "and" (#2608)

* fix(contracts-communication): default settings for Guard service (#2605)

* test: should ignore optimistic period w/o guard

* test: app should have empty config be default

* test: should allow setting zero optimistic period

* fix: ignore optimistic period without a guard

* fix: use GUARD_DISABLED flag by default

* fix: don't revert on zero optimistic period

* test: different optimistic periods for integration tests

* fix: use default guard for PingPongApp

* refactor: fix linter warnings

* Publish

 - contracts-communication@1.6.2
 - @synapsecns/synapse-interface@0.23.1

* Fix: put blocking call to Start() in new goroutine (#2614)

* feat(contracts-communication): default values for modules/required respones (#2612)

* feat: scaffold defaultModule in Client

* test: expected behavior for setting default module

* feat: setting default Module in Client

* refactor: Client views test

* test: appConfig with zero modules/responses

* feat: module config defaults

* cleanup: remove `ZeroRequiredResponses` error

* refactor: prep for 0 and 1 module tests

* test: ClientV1 + app with 1 module

* test: ClientV1 + app with 0 modules

* Publish

 - contracts-communication@1.7.0

* RFQ: rebalance edge cases & refactoring (#2613)

* Fix: filter rebalance origin / dest on rebalance method

* Cleanup: move getRebalance() into rebalance.go

* Cleanup: add helpers to getRebalance()

* Cleanup: comments

* Feat: remove Rebalance() call upon deposit claimed

* Feat: getRebalance() takes in dest chain id

* Cleanup: comments

* Feat: extra check that we don't exceed origin maintenance

* Feat: add new test case for mismatched methods but existing rebalance

* Feat: break down TestGetRebalance into sub tests

* Cleanup: lint

* [goreleaser]

* [goreleaser]

* refactor: move opinionated stuff into SynapseModule (#2617)

* Publish

 - contracts-communication@1.7.1

* Document Modules (#2611)



Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* cleanup (#2618)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* fix tests (#2620)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* RFQ API: replace `otelresty` with `otelhhtp` package (#2606)

* Feat: replace otelresty usage with otelhttp pkg

* [goreleaser]

* make coverage aggregator public (#2621)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Publish

 - @synapsecns/coverage-aggregator@1.0.5

* publish aggregator fix (#2622)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Publish

 - @synapsecns/coverage-aggregator@1.0.6

* fix(solidity-devops): update forge-std to 1.8.2 (#2619)

* build: update `forge-std` to 1.8.2

* chore: yarn

* Publish

 - contracts-communication@1.7.2
 - FastBridge@0.2.5
 - @synapsecns/solidity-devops@0.3.5

* feat(docs): auto deploy vercel to prod (only vercel) (#2627)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* fix(ci): fixes bug in #2627, deploys go to prod (#2628)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* docs(contributing) add a guide on adding js packages (#2629)

* docs(contributing) add a guide on adding js packages

* Update CONTRIBUTING.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* revert coderabbit fix (#2630)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* prod release fix (#2631)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Publish

 - @synapsecns/bridge-docs@0.1.0

* add grafana dashboard and fix broken link (#2634)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* add scroll (#2635)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Submitter: bump MaxResultsPerChain (#2633)

* Feat: bump MaxResultsPerChain

* [goreleaser]

* fast bridge regen (#2636)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* omnirpc doc fixes (#2637)

* swagger

* embed swagger ui

* generic lint fixer

---------

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* fix typo (#2638)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Update bl

* Add SPECTRAL token support (#2640)

* Publish

 - @synapsecns/synapse-interface@0.23.2
 - @synapsecns/widget@0.2.1

* feat(synapse-interface): Adds Scroll via RFQ (#2526)

* Adds Scroll via RFQ

* Adds NewTag

* Adds RFQ logic into the generateMaps script

* Adds announcement banner

* Linting

* Adjusts order

* API call for quotes

* Updates bridgeMap for live Scroll quotes

* For reusing NewTag

* Adjust dates

* Publish

 - @synapsecns/synapse-interface@0.24.0

* feat(widget): maintenance (#2616)

* Fetch pause data and store JSON object in client browser

* Refetch only if last fetch was more than 24 hours ago

* Read chain + module pause from local storage

* Maintenance components rendering based off of fetched pause data

* Pause Bridge button based on Maintenance status

* Filter quotes based on paused modules

* Use user defined styling or defaults

* Style Progress Bar

* Refactor getSynapsePauseData

* Clean

* Fix bridge quote filter

* Adjust text size for maintenance

* Add comments + clean

* Update comment

* Refresh data every hour

* Clean

* Add key to warning messages

* Fix render issues, start move event countdown component directly to Widget to resolve hooks issue

* Resolve hooks render issue with localized component

* Progress bar renders when not isabled

* Clean and simplify Maintenance components

* getMaintenanceData

* Organize back into useMaintenance hook

* Clean / organize

* Use prod urls

* Organizational updates

* Fetch pause data every render, set fetching status flag

* Rm timestamp key

---------

Co-authored-by: abtestingalpha <abtestingalpha@gmail.com>

* Publish

 - @synapsecns/widget@0.3.0

* RFQ API: add GET /ack endpoint (#2643)

* WIP: add relay ack cache and GetRelayAck endpoint

* Feat: register AckRoute

* Feat: add ackMux

* Feat: add GetRelayAck test

* Feat: add GetRelayAck to UnauthenticatedClient

* Feat: relayer fetches ack before updating to CommittedPending

* [goreleaser]

* Feat: move GET /ack to PUT /ack

* WIP: generalize AuthMiddleware()

* Fix: working refactor for auth

* Feat: add PutAckRequest and parse in auth middleware

* Feat: impl PUT /ack request with json req body

* Feat: bump default timeout from 5 to 10

* Feat: add swagger comments

* Cleanup: pass API client into quoter

* Feat: return RelayerAddress in PutRelayAckResponse

* Cleanup: add clarifying comment

* [goreleaser]

* Cleanup: lint

* [goreleaser]

* Cleanup: add tracing

* [goreleaser]

* Config: bump relay ack timeout to 30 seconds

* [goreleaser]

* Feat: lower submitter retry interval (#2645)

* update bl

* Adjusts banner date (#2647)

* Publish

 - @synapsecns/synapse-interface@0.24.1

* Add SPEC token pricing to the manual cache (#2646)

* adding spectral coingecko ids for pricing

* adding spec token to cache

* Update bl

* fix(screener): fix screener http 502 (#2650)


Co-authored-by: trajan0x <83933037+trajan0x@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* update bl

* update bl

---------

Co-authored-by: aureliusbtc <82057759+aureliusbtc@users.noreply.github.com>
Co-authored-by: ChiTimesChi <88190723+ChiTimesChi@users.noreply.github.com>
Co-authored-by: dwasse <wassermandaniel8@gmail.com>
Co-authored-by: ChiTimesChi <ChiTimesChi@users.noreply.github.com>
Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
Co-authored-by: vro <168573323+golangisfun123@users.noreply.github.com>
Co-authored-by: shampoobera <shampoo@berachain.com>
Co-authored-by: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com>
Co-authored-by: bigboydiamonds <bigboydiamonds@users.noreply.github.com>
Co-authored-by: trajan0x <83933037+trajan0x@users.noreply.github.com>
Co-authored-by: Moses <103143573+Defi-Moses@users.noreply.github.com>
Co-authored-by: Simon <ak.simonm@gmail.com>
Co-authored-by: aureliusbtc <aureliusbtc@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: abtestingalpha <abtestingalpha@users.noreply.github.com>
  • Loading branch information
16 people authored May 31, 2024
1 parent 908320f commit 34d1258
Show file tree
Hide file tree
Showing 375 changed files with 19,422 additions and 8,704 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
key: docker-release-${{ runner.os }}-${{ matrix.package }}

- uses: dorny/paths-filter@v2
- uses: dorny/paths-filter@v3
name: check if any changes warrant a new build of goreleaser-cgo-cross-compiler
id: changes
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lerna.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
types: [closed]
paths:
- 'packages/**'
- 'docs/**'
branches:
- master

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/solidity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
fetch-depth: 0
# if any of these packages use submodules in the future, please uncomment this line
# submodules: 'recursive'
- uses: dorny/paths-filter@v2
- uses: dorny/paths-filter@v3
id: filter_solidity
with:
# make sure to update run-goreleaser when adding a new package here
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/ui-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
paths:
- 'packages/explorer-ui/**'
- 'packages/docs/**'
- 'docs/bridge/**'
- 'packages/synapse-interface/**'
jobs:
changes:
Expand All @@ -21,14 +21,14 @@ jobs:
fetch-depth: 0
# if any of these packages use submodules in the future, please uncomment this line
# submodules: 'recursive'
- uses: dorny/paths-filter@v2
- uses: dorny/paths-filter@v3
id: filter_ui
with:
# make sure to update run-goreleaser when adding a new package here
# also add to the get-project-id step
filters: |
explorer-ui: 'packages/explorer-ui/**'
docs: 'packages/docs/**'
docs: 'docs/bridge/**'
synapse-interface: 'packages/synapse-interface/**'
- id: length
run: |
Expand All @@ -47,6 +47,8 @@ jobs:
matrix:
package: ${{ fromJson(needs.changes.outputs.packages) }}
env:
# TODO: this appears to work even if package is not in packages/[package]
# (see the addition of docs for details). It's possible workign directory can be removd.
WORKING_DIRECTORY: 'packages/${{matrix.package}}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
VERCEL_TOKEN: '${{ secrets.VERCEL_TOKEN }}'
Expand Down Expand Up @@ -77,16 +79,22 @@ jobs:
echo "VERCEL_PROJECT_ID=$TARGET_ID" >> $GITHUB_ENV
- name: Install Vercel CLI
run: npm install --global vercel@32.5.3
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy to Vercel (Output Preview/Inspect Links)
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) != github.ref }}
id: deploy
run: |
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
vercel build --token=${{ secrets.VERCEL_TOKEN }}
export DEPLOY_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
echo "DEPLOY_URL=$DEPLOY_URL" >> $GITHUB_ENV
echo "::set-output name=url::$DEPLOY_URL"
- name: Deploy to Vercel (Output Prod)
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}
run: |
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
vercel build --token=${{ secrets.VERCEL_TOKEN }} --prod
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --prod
- name: Update PR Description
if: ${{ github.event_name == 'pull_request' && format('refs/heads/{0}', github.event.repository.default_branch) != github.ref }}
uses: actions/github-script@v3
Expand Down
14 changes: 9 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.workingDirectories": [
{ "directory": "packages/contracts", "changeProcessCWD": true }
{
"directory": "packages/contracts",
"changeProcessCWD": true
}
],
"eslint.nodePath": "./node_modules/eslint/bin/",
"eslint.format.enable": true,
"editorconfig.generateAuto": false,
"files.trimTrailingWhitespace": true,
"solidity.packageDefaultDependenciesContractsDirectory": "contracts",
"solidity.packageDefaultDependenciesDirectory": "lib",
"solidity.compileUsingRemoteVersion": "v0.8.17",
"solidity.formatter": "prettier"
}
"solidity.compileUsingRemoteVersion": "v0.8.17+commit.8df45f5f",
"solidity.formatter": "prettier",
"solidity.defaultCompiler": "remote"
}
1 change: 1 addition & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ignore: |
**/node_modules/**
**/charts/**
**/swagger.yaml
**/openapi.yaml
rules:
document-start:
Expand Down
3 changes: 1 addition & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ ethergo/ @trajan0x
make/ @trajan0x

packages/contracts-core/ @ChiTimesChi @trajan0x
packages/contracts-rfq @ChiTimesChi @mikeyrf
packages/docs/ @trajan0x
packages/contracts-rfq @ChiTimesChi
packages/sdk-router/ @aureliusbtc @ChiTimesChi @trajan0x
packages/explorer-ui/ @trajan0x @bigboydiamonds @abtestingalpha
packages/rest-api/ @trajan0x @Defi-Moses
Expand Down
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ Contributions should roughly follow the [uber style guide](https://github.com/ub

<!-- todo: more-->

## Adding a new JS/TS Package

If you need to make a new JS/TS package, here are the steps to follow:

- If adding under `packages/*`, no need to do anything further.
- Otherwise, make sure you add the package to:
- `.github/workflows/lerna.yml` under paths. This will make sure that the package is built and tested in CI.
- `workspaces.packages` in packages.json. This will make sure that the package is built and tested locally.
- `lerna.json` under `packages` and `version` fields. This will make sure that the package is versioned correctly.
- If the package is a library that you'd like to publish, simply set the `private` field in `package.json` to `false` and the `publishConfig` access to public.
- If the package is a UI, please see [here](./.github/workflows/ui-preview.md) for instructions on configuring vercel. Make sure to update the paths there as well.

## Linting

Linting for go is used using [golangci-lint](https://golangci-lint.run/) at the latest released version. Please upgrade or install using your package manager. and run `make lint` from your desired module.
Expand Down
1 change: 1 addition & 0 deletions agents/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ require (
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/deepmap/oapi-codegen v1.8.2 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions agents/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b h1:oy54yVy300Db264NfQCJubZHpJOl+SoT6udALQdFbSI=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b/go.mod h1:/RJwPD5L4xWgCbqQ1L5cB12ndgfKKT54n9cZFf+8pus=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
github.com/friendsofgo/graphiql v0.2.2 h1:ccnuxpjgIkB+Lr9YB2ZouiZm7wvciSfqwpa9ugWzmn0=
Expand Down
2 changes: 1 addition & 1 deletion charts/screener/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.4
version: 0.2.5

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
2 changes: 1 addition & 1 deletion charts/screener/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
{{ toYaml .Values.files | indent 2 }}
{{ tpl (toYaml .Values.files) . | indent 2 }}
{{- end }}
1 change: 1 addition & 0 deletions committee/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ require (
github.com/fatih/structtag v1.2.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions committee/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b h1:oy54yVy300Db264NfQCJubZHpJOl+SoT6udALQdFbSI=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b/go.mod h1:/RJwPD5L4xWgCbqQ1L5cB12ndgfKKT54n9cZFf+8pus=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg=
github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag=
Expand Down
2 changes: 2 additions & 0 deletions contrib/promexporter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b h1:oy54yVy300Db264NfQCJubZHpJOl+SoT6udALQdFbSI=
github.com/flowchartsman/swaggerui v0.0.0-20221017034628-909ed4f3701b/go.mod h1:/RJwPD5L4xWgCbqQ1L5cB12ndgfKKT54n9cZFf+8pus=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
Expand Down
1 change: 1 addition & 0 deletions contrib/promexporter/internal/gql/explorer/models.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions contrib/screener-api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ package client

import (
"context"
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"strings"
"time"

"github.com/dubonzi/otelresty"
"github.com/go-resty/resty/v2"
"github.com/google/uuid"
Expand All @@ -14,6 +21,7 @@ import (
// ScreenerClient is an interface for the Screener API.
type ScreenerClient interface {
ScreenAddress(ctx context.Context, ruleset, address string) (blocked bool, err error)
BlacklistAddress(ctx context.Context, appsecret string, appid string, body BlackListBody) (string, error)
}

type clientImpl struct {
Expand All @@ -37,6 +45,7 @@ type blockedResponse struct {
Blocked bool `json:"risk"`
}

// ScreenAddress checks if an address is blocked by the screener.
func (c clientImpl) ScreenAddress(ctx context.Context, ruleset, address string) (bool, error) {
var blockedRes blockedResponse
resp, err := c.rClient.R().
Expand All @@ -54,6 +63,73 @@ func (c clientImpl) ScreenAddress(ctx context.Context, ruleset, address string)
return blockedRes.Blocked, nil
}

// BlackListBody is the json payload that represents a blacklisted address.
type BlackListBody struct {
Type string `json:"type"`
ID string `json:"id"`
Data string `json:"data"`
Address string `json:"address"`
Network string `json:"network"`
Tag string `json:"tag"`
Remark string `json:"remark"`
}

type blacklistResponse struct {
Status string `json:"status"`
Error string `json:"error"`
}

func (c clientImpl) BlacklistAddress(ctx context.Context, appsecret string, appid string, body BlackListBody) (string, error) {
var blacklistRes blacklistResponse

nonce := strings.ReplaceAll(uuid.New().String(), "-", "")[:32]
timestamp := fmt.Sprintf("%d", time.Now().Unix())
queryString := ""

bodyBz, err := json.Marshal(body)
if err != nil {
return "", fmt.Errorf("error marshaling body: %w", err)
}

message := fmt.Sprintf("%s%s%s%s%s%s%s",
appid, timestamp, nonce, "POST", "/api/data/sync/", queryString, string(bodyBz))

signature := GenerateSignature(appsecret, message)

resp, err := c.rClient.R().
SetContext(ctx).
SetHeader("Content-Type", "application/json").
SetHeader("AppID", appid).
SetHeader("Timestamp", timestamp).
SetHeader("Nonce", nonce).
SetHeader("QueryString", queryString).
SetHeader("Signature", signature).
SetBody(body).
SetResult(&blacklistRes).
Post("/api/data/sync/")

if err != nil {
return resp.Status(), fmt.Errorf("error from server: %s: %w", resp.String(), err)
}

if resp.IsError() {
return resp.Status(), fmt.Errorf("error from server: %s", resp.String())
}

return blacklistRes.Status, nil
}

// GenerateSignature generates a signature for the request.
func GenerateSignature(
secret,
message string,
) string {
key := []byte(secret)
h := hmac.New(sha256.New, key)
h.Write([]byte(message))
return hex.EncodeToString(h.Sum(nil))
}

// NewNoOpClient creates a new no-op client for the Screener API.
// it returns false for every address.
func NewNoOpClient() (ScreenerClient, error) {
Expand All @@ -66,4 +142,8 @@ func (n noOpClient) ScreenAddress(_ context.Context, _, _ string) (bool, error)
return false, nil
}

func (n noOpClient) BlacklistAddress(_ context.Context, _ string, _ string, _ BlackListBody) (string, error) {
return "", nil
}

var _ ScreenerClient = noOpClient{}
4 changes: 4 additions & 0 deletions contrib/screener-api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import "time"

// Config is the configuration for the screener.
type Config struct {
// AppSecret is the app secret
AppSecret string `yaml:"app-secret"`
// AppID is the app id
AppID string `yaml:"app-id"`
// TRMKey is the api key for trmlabs
TRMKey string `yaml:"trm-key"`
// Rules of [caller_type]->risk_type
Expand Down
27 changes: 26 additions & 1 deletion contrib/screener-api/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,29 @@ package db
import (
"context"
"errors"
"github.com/synapsecns/sanguine/contrib/screener-api/trmlabs"
"time"

"github.com/synapsecns/sanguine/contrib/screener-api/trmlabs"
)

// BlacklistedAddressWriterDB provides methods to write blacklisted addresses to the database.
type BlacklistedAddressWriterDB interface {
PutBlacklistedAddress(ctx context.Context, body BlacklistedAddress) error
DeleteBlacklistedAddress(ctx context.Context, id string) error
UpdateBlacklistedAddress(ctx context.Context, id string, body BlacklistedAddress) error
}

// BlacklistedAddressReaderDB provides methods to read blacklisted addresses from the database.
type BlacklistedAddressReaderDB interface {
GetBlacklistedAddress(ctx context.Context, address string) (*BlacklistedAddress, error)
}

// BlacklistedAddressDB is the interface for reading and writing blacklisted addresses to the database.
type BlacklistedAddressDB interface {
BlacklistedAddressWriterDB
BlacklistedAddressReaderDB
}

// RuleWriterDB is the interface for writing rules to the database.
type RuleWriterDB interface {
PutAddressIndicators(ctx context.Context, address string, riskIndicator []trmlabs.AddressRiskIndicator) error
Expand All @@ -24,5 +43,11 @@ type RuleDB interface {
RuleReaderDB
}

// DB is the general database interface for the screener-api.
type DB interface {
BlacklistedAddressDB
RuleDB
}

// ErrNoAddressNotCached is returned when an address is not cached.
var ErrNoAddressNotCached = errors.New("address not cached")
Loading

0 comments on commit 34d1258

Please sign in to comment.