Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/_workflows/pkl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
push:
paths: [ "networks/**" ]
branches: [ "main" ]

jobs:
render:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install pkl
uses: pkl-community/setup-pkl@v0
with:
pkl-version: 0.27.1

- name: Find and process .pkl files
run: |
# Iterate over each directory in TARGET_DIRS
for dir in networks/terminal networks/vault; do
# Find all .pkl files in the given dirs
find "$dir" -name '*.pkl' | while read -r pkl_file; do
json_file="${pkl_file%.pkl}.json"
pkl eval -f json -o "$json_file" "$pkl_file"
git add "$json_file"
done
done

- name: Configure Git
run: | # TODO: replace username and email
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Commit and push changes
run: |
# Check if there are any changes
if [ -n "$(git status --porcelain)" ]; then
git commit -m "chore: generate configs from Pkl"
git push
else
echo "No changes to commit"
fi
4 changes: 4 additions & 0 deletions docs/deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Last updated: November 8, 2024.
| Dummy executor | DummyExecutor | `0x6a9DC7deAbF360ca573a2Db459B96e11e490480c`[↗](https://polygonscan.com/address/0x6a9DC7deAbF360ca573a2Db459B96e11e490480c) | `986948a`[↗](https://github.com/layer-3/dailyclaim/blob/986948aa1cc3b9a45daba3f4efc35738ca9265fa/src/voucher/executors/DummyExecutor.sol) | |
| Points claimer for Leaderboard | ClaimExecutor | `0x0fb43b1CE0016df92e945155a7EADD3C9F2b2830`[↗](https://polygonscan.com/address/0x0fb43b1CE0016df92e945155a7EADD3C9F2b2830) | `cadfd37`[↗](https://github.com/layer-3/dailyclaim/blob/cadfd378c76f3ce777cd59e1d5d261b9c4d6fd1d/src/voucher/executors/ClaimExecutor.sol) | |
| Outside range authorizer | TimeRangeAuthorizer | `0xa6c9B137fddd907d2bCb1CE2bcafFA2075125D6c`[↗](https://polygonscan.com/address/0xa6c9B137fddd907d2bCb1CE2bcafFA2075125D6c) | `dc84b5e`[↗](https://github.com/layer-3/broker-contracts/blob/dc84b5e1a30db420ff3b881a74fca6f4556fbc36/src/vault/TimeRangeAuthorizer.sol) | Time range is set to Nov 14th 00:00:00 - Jan 13th 23:59:59 UTC |
| Test True Authorizer | TrueAuthorize | `0xA4c938682301A0241d37ac702dd9a743ced03202`[↗](https://polygonscan.com/address/0xA4c938682301A0241d37ac702dd9a743ced03202) | `dc84b5e`[↗](https://github.com/layer-3/broker-contracts/blob/dc84b5e1a30db420ff3b881a74fca6f4556fbc36/src/vault/test/MockedAuthorizer.sol) | |
| Test Yellow Vault | LiteVault | `0x65d5579aC0420D05888D226f3276788aFa3864b3`[↗](https://polygonscan.com/address/0x65d5579aC0420D05888D226f3276788aFa3864b3) | `dc84b5e`[↗](https://github.com/layer-3/broker-contracts/blob/dc84b5e1a30db420ff3b881a74fca6f4556fbc36/src/vault/LiteVault.sol) | |

### Base

Expand Down Expand Up @@ -136,6 +138,8 @@ Last updated: December 11, 2024.
| Yellow Vault | LiteVault | `0xb5F3a9dD92270f55e55B7Ac7247639953538A261`[↗](https://scrollscan.com/address/0xb5F3a9dD92270f55e55B7Ac7247639953538A261) | `dc84b5e`[↗](https://github.com/layer-3/broker-contracts/blob/dc84b5e1a30db420ff3b881a74fca6f4556fbc36/src/vault/LiteVault.sol) | |
| Yellow Voucher Router | VoucherRouter | `0x852b6eF2fBF26f25d1096CDd24bD6f5F9D62B301`[↗](https://scrollscan.com/address/0x852b6eF2fBF26f25d1096CDd24bD6f5F9D62B301) | `dc84b5e`[↗](https://github.com/layer-3/broker-contracts/blob/dc84b5e1a30db420ff3b881a74fca6f4556fbc36/src/voucher/VoucherRouter.sol) | |
| Points claimer for Leaderboard | ClaimExecutor | `0x5df971419a39CC846B801b22D56Af59234b86238`[↗](https://scrollscan.com/address/0x5df971419a39CC846B801b22D56Af59234b86238) | `dc84b5e`[↗](https://github.com/layer-3/broker-contracts/blob/dc84b5e1a30db420ff3b881a74fca6f4556fbc36/src/voucher/executors/ClaimExecutor.sol) | |
| Test True Authorizer | TrueAuthorize | `0xA4c938682301A0241d37ac702dd9a743ced03202`[↗](https://scrollscan.com/address/0xA4c938682301A0241d37ac702dd9a743ced03202) | `dc84b5e`[↗](https://github.com/layer-3/broker-contracts/blob/dc84b5e1a30db420ff3b881a74fca6f4556fbc36/src/vault/test/MockedAuthorizer.sol) | |
| Test Yellow Vault | LiteVault | `0x65d5579aC0420D05888D226f3276788aFa3864b3`[↗](https://scrollscan.com/address/0x65d5579aC0420D05888D226f3276788aFa3864b3) | `dc84b5e`[↗](https://github.com/layer-3/broker-contracts/blob/dc84b5e1a30db420ff3b881a74fca6f4556fbc36/src/vault/LiteVault.sol) | |

## Testnet

Expand Down
87 changes: 87 additions & 0 deletions networks/templates/aa.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
module AccountAbstraction

import "./common.pkl"
import "pkl:semver"

config: AccountAbstraction

class AccountAbstraction {
entry_point: common.Address
gas: Gas
smart_wallet: SmartWallet
paymaster: Paymaster
session_key: SessionKey
}

class Gas {
max_priority_fee_per_gas_multiplier: Float(isFinite)
max_fee_per_gas_multiplier: Float(isFinite)
}

class SmartWallet {
type: "simple_account" | "biconomy" | "kernel"
ecdsa_validator: common.Address
logic: common.Address
factory: common.Address
}


class SessionKey {
kernel_version: semver.Version
session_key_validator: common.Address
}

// ================================================
// PAYMASTER TYPES
// ================================================

class Paymaster {
type: "off" | "pimlico_erc20" | "pimlico_verifying" | "biconomy_erc20" | "biconomy_sponsoring"
url: common.HttpUrl
address: common.Address

pimlico_erc20: PimlicoERC20Paymaster
pimlico_verifying: PimlicoVerifyingPaymaster
biconomy_erc20: BiconomyERC20Paymaster
biconomy_sponsoring: BiconomySponsoringPaymaster
}

class PimlicoERC20Paymaster {
max_token_cost: Float(isFinite)
verification_gas_overhead: Float(isFinite)
}

class PimlicoVerifyingPaymaster {
sponsorship_policy_id: String
}

class BiconomyERC20Paymaster {
mode: "ERC20"
calculate_gas_limits: Boolean
token_info: BiconomyTokenInfo
}

class BiconomySponsoringPaymaster {
mode: "SPONSORED"
calculate_gas_limits: Boolean
expiry_duration: Duration(isPositive)
sponsorship_info: BiconomySponsorshipInfo
}

class BiconomyTokenInfo {
fee_token_address: common.Address
}

class BiconomySponsorshipInfo {
webhook_data: Mapping<String, Any>
smart_account_info: BiconomySmartAccountInfo
}

class BiconomySmartAccountInfo {
name: String
version: common.Address
}

output {
value = config
}
20 changes: 20 additions & 0 deletions networks/templates/assets.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Assets

import "./common.pkl"

tokens: Listing<Token>(isDistinctBy((it) -> it.address))

class Token {
address: common.Address
name: String(!isEmpty)
alias: String(!isEmpty && this != name)?
symbol: String(length <= name.length)
decimals: UInt(isBetween(0, 18))
precision: UInt(isBetween(0, 18))
extensions: Extensions?
}

class Extensions {
allow_locking: Boolean
coingecko_api_id: String(!isEmpty)
}
10 changes: 10 additions & 0 deletions networks/templates/blockchain.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Blockchain

import "./common.pkl"

chainId: UInt
blockchainRPC: common.WsUrl
adjudicatorAddress: common.Address
clearingAppAddress: common.Address
escrowAppAddress: common.Address
marginTokenAddress: common.Address
7 changes: 7 additions & 0 deletions networks/templates/common.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module common

typealias Address = String(matches(Regex(#"0x[a-fA-F0-9]{40}"#)))

typealias WsUrl = String(matches(Regex(#"ws(s?)://[^\s]+"#)))
typealias HttpUrl = String(matches(Regex(#"http(s?)://[^\s]+"#)))
typealias Url = WsUrl | HttpUrl
8 changes: 8 additions & 0 deletions networks/templates/mapping.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module AssetMapping

import "./common.pkl"

tokens: Mapping<Ticker, Listing<Ticker>>
markets: Mapping<Ticker, Listing<Ticker>>

typealias Ticker = String(!isEmpty)
18 changes: 18 additions & 0 deletions networks/templates/markets.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module Markets

import "./common.pkl"

markets: Listing<Market>(isDistinctBy((it) -> it.symbol))

class Market {
symbol: String(matches(Regex(#"(spot)://[A-Z]+/[A-Z]+"#)))
quotes: Quotes?
}

class Quotes {
dexs: Boolean
}

output {
value = markets
}
8 changes: 8 additions & 0 deletions networks/templates/nitro.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Nitro

import "./common.pkl"

adjudicatorAddress: common.Address
clearingAppAddress: common.Address
escrowAppAddress: common.Address
marginTokenAddress: common.Address
48 changes: 48 additions & 0 deletions networks/templates/peers.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module Peers

import "./common.pkl"

peers: Listing<Peer>(isDistinctBy((it) -> it.name))

class Peer {
url: common.HttpUrl

name: String(!isEmpty)

finex_url: common.WsUrl

clearport_b_url: common.Url
clearport_a_url: common.Url

description: String(!isEmpty)

available: Boolean
metadata: Metadata
address: common.Address
packages: Listing<Package>(isDistinctBy((it) -> it.name))
}

class Metadata {
coordinates: Coordinates
region: String(!isEmpty)
code: String(length == 2)
country: String(!isEmpty)

logo: common.Url?
sm_logo: common.Url?
}

class Coordinates {
lat: Float(isBetween(-90, 90))
long: Float(isBetween(-180, 180))
}

class Package {
name: String(!isEmpty)
margin: Listing<UInt>(length == 2 && this[0] < this[1])
safety: String(matches(Regex(#"\d+(\.\d+)?"#)))
}

output {
value = peers
}
20 changes: 20 additions & 0 deletions networks/templates/wallet.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Wallet

import "./common.pkl"

paymaster: Mapping<common.Address, common.Address>
litevault: common.Address?
transactions: Transactions

class Transactions {
withdrawal: SponsorshipPolicy
swap: SponsorshipPolicy
lock: SponsorshipPolicy
unlock: SponsorshipPolicy
daily_claim: SponsorshipPolicy
daily_claim_tap_app: SponsorshipPolicy
mint_tap_app: SponsorshipPolicy
base: SponsorshipPolicy
}

typealias SponsorshipPolicy = *"native" | "sponsor" | "with_paymaster"
Loading