Skip to content

Commit

Permalink
Merge pull request #27 from catalystdao/jsanmi/main-v0.2.0
Browse files Browse the repository at this point in the history
feat: Upgrade main to v0.2.0
  • Loading branch information
jsanmigimeno committed Jul 25, 2024
2 parents 3cc2afb + 303bbf0 commit 7b4e838
Show file tree
Hide file tree
Showing 40 changed files with 5,370 additions and 3,410 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ UNDERWRITER_PORT=3100
REDIS_PORT=6379
RELAYER_HOST=127.0.0.1
RELAYER_PORT=3000

MAX_LOG_SIZE="500m"
MAX_LOG_FILES="5"
7 changes: 5 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
push:
branches:
- 'main'
- 'testnet'
tags:
- 'v*'
pull_request:
branches:
- 'main'
- 'testnet'

jobs:
build:
Expand All @@ -31,8 +33,9 @@ jobs:
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
-
name: Login to Docker Hub
uses: docker/login-action@v3
Expand Down
33 changes: 29 additions & 4 deletions config.example.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Global Underwriter configuration
global:
privateKey: '' # The privateKey of the account that will be submitting the underwrites
# ! The 'privateKey' of the account that will be submitting the underwrites is by default
# ! loaded from the environment variable 'UNDERWRITER_PRIVATE_KEY'. Alternatively, the privateKey
# ! may be specified here (not recommended).
# privateKey: ''
# ! Optionally, custom privateKey loaders may be implemented and specified (NOTE: the 'env'
# ! loader is used if no privateKey configuration is specified):
# privateKey:
# loader: 'env' # The privateKey loader name (must match the implementation on src/config/privateKeyLoaders/<loader>.ts).
# customLoaderConfig: '' # Custom loader configs may be specified.

logLevel: 'info'

monitor:
Expand Down Expand Up @@ -33,13 +42,26 @@ global:
0.05 # Extra buffer allowed on top of the calculated required funds for
# performing an underwrite.

maxUnderwriteAllowed: '10000000000000000000' # Maximum tokens to risk on a single underwrite
minUnderwriteReward: '100000000000' # Minimum acceptable token reward for an underwrite
maxUnderwriteAllowed: 500 # Maximum underwrite value (EXCLUDING THE COLLATERAL).
# In the 'pricingDenomination' specified on the Relayer.
minUnderwriteReward: 0.5 # Minimum underwrite reward desired.
# In the 'pricingDenomination' specified on the Relayer.
relativeMinUnderwriteReward: 0.1 # Minimum relative underwrite reward desired (w.r.t. the
# underwrite amount plus the tx cost).
profitabilityFactor: 1.0 # Profitiability evaluation adjustment factor. A larger
# factor implies a larger profitability guarantee.

lowTokenBalanceWarning: '1000000000000000000' # Token balance below which a 'low balance' warning is emitted.
tokenBalanceUpdateInterval:
50 # Number of transactions after which to update the
# Underwriter token balance from the rpc.

relayDeliveryCosts: # Average swap delivery costs for underwritten swaps. Used to estimate underwrites profitability
gasUsage: '21000' # The gas used.
# gasObserved: '21000' # The gas observed by the escrow contract.
# fee: '0' # The fee taken on transaction submission (relevant for L2 chains.)
# value: '0' # The value sent to the escrow as payment (e.g. to execute the return 'ack' cross-chain message).

# ! The following setting is here for illustrative purposes, but it MUST ALWAYS be applied on
# ! a per-chain basis as it is CRITICAL to prevent the underwriter from being stolen from.
# minMaxGasDelivery: 200000
Expand Down Expand Up @@ -103,6 +125,7 @@ chains:
# The tokens that are to be undewritten
tokens:
- name: 'WETH'
tokenId: "ethereum"
address: '0x4200000000000000000000000000000000000006'
allowanceBuffer:
'10000000000000000000' # Amount by which to 'buffer' the token approvals
Expand All @@ -123,6 +146,7 @@ chains:
minMaxGasDelivery: 200000
tokens:
- name: 'WETH'
tokenId: "ethereum"
address: '0x4300000000000000000000000000000000000004'
allowanceBuffer: '10000000000000000000'

Expand All @@ -133,6 +157,7 @@ chains:
minMaxGasDelivery: 200000
tokens:
- name: 'WETH'
tokenId: "ethereum"
address: '0x4200000000000000000000000000000000000006'
allowanceBuffer: '10000000000000000000'

Expand Down Expand Up @@ -180,4 +205,4 @@ endpoints:
- name: 'Volatile'
address: '0x0000000003b8C9BFeB9351933CFC301Eea92073F'
- name: 'Amplified'
address: '0x000000004aBe0D620b25b8B06B0712BDcff21899'
address: '0x000000004aBe0D620b25b8B06B0712BDcff21899'
7 changes: 6 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:

underwriter:
image: ghcr.io/catalystdao/catalyst-underwriter:latest
image: ghcr.io/catalystdao/catalyst-underwriter:testnet
build:
context: .
dockerfile: dockerfile.underwriter
Expand All @@ -16,6 +16,11 @@ services:
restart: unless-stopped
networks:
- generalised-relayer_default
logging:
driver: 'local'
options:
max-size: ${MAX_LOG_SIZE:-500m}
max-file: ${MAX_LOG_FILES:-5}

networks:
generalised-relayer_default:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "catalyst-underwriter",
"version": "0.1.1",
"version": "0.2.0",
"description": "The Catalyst Underwriter",
"main": "dist/index.js",
"author": "Cata Labs, Inc.",
Expand Down Expand Up @@ -35,6 +35,7 @@
"pino": "^8.16.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"viem": "^2.16.2",
"ws": "^8.16.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 7b4e838

Please sign in to comment.