This file is a merged representation of the entire codebase, combined into a single document by Repomix. The content has been processed where content has been compressed (code blocks are separated by ⋮---- delimiter). # File Summary ## Purpose This file contains a packed representation of the entire repository's contents. It is designed to be easily consumable by AI systems for analysis, code review, or other automated processes. ## File Format The content is organized as follows: 1. This summary section 2. Repository information 3. Directory structure 4. Repository files (if enabled) 5. Multiple file entries, each consisting of: a. A header with the file path (## File: path/to/file) b. The full contents of the file in a code block ## Usage Guidelines - This file should be treated as read-only. Any changes should be made to the original repository files, not this packed version. - When processing this file, use the file path to distinguish between different files in the repository. - Be aware that this file may contain sensitive information. Handle it with the same level of security as you would the original repository. ## Notes - Some files may have been excluded based on .gitignore rules and Repomix's configuration - Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files - Files matching patterns in .gitignore are excluded - Files matching default ignore patterns are excluded - Content has been compressed - code blocks are separated by ⋮---- delimiter - Files are sorted by Git change count (files with more changes are at the bottom) # Directory Structure ``` .github/ ISSUE_TEMPLATE/ BUG_REPORT.yaml FEATURE_IMPROVEMENT.yaml workflows/ pre-commit.yaml test.yaml trufflehog.yml CODEOWNERS PULL_REQUEST_TEMPLATE.md network-scripts/ deploy.sh deployer.Dockerfile flight-node-start.sh genesis-generator.sh sidecar-start.sh off-chain/ abis/ FlightDelays.abi.json cmd/ benchmark/ main.go flights-api/ main.go node/ main.go internal/ contracts/ flightDelays.go flights/ store_test.go store.go types.go utils/ util.go .dockerignore Dockerfile go.mod script/ mocks/ MockERC20.sol SymbioticRewardsConstantsHelper.sol utils/ BN254G2.sol sort_errors.py sort_imports.py my-relay-deploy.toml MyRelayDeploy.sol snapshots/ gas.txt sizes.txt src/ symbiotic/ Driver.sol KeyRegistry.sol Settlement.sol VotingPowers.sol FlightDelays.sol test/ mock/ FlightDelaysMocks.sol SettlementMock.sol FlightDelays.t.sol ui/ public/ alpha-air.png beta-wings.png gamma-connect.png logo.png src/ abi/ ERC20.json FlightDelays.json Rewards.json Slasher.json Vault.json api/ flights.ts components/ BuyerPage.tsx ProviderPage.tsx constants/ airlines.ts utils/ format.ts hash.ts App.tsx config.ts main.tsx styles.css types.ts wallet.tsx .dockerignore .env.docker .env.example Dockerfile index.html package.json tsconfig.json tsconfig.tsbuildinfo vite.config.ts .gitignore .gitmodules .pre-commit-config.yaml .prettierignore .prettierrc CONTRIBUTING.md foundry.lock foundry.toml generate_network.sh package.json pnpm-workspace.yaml README.md remappings.txt ``` # Files ## File: .github/ISSUE_TEMPLATE/BUG_REPORT.yaml ````yaml name: Bug report description: File a bug report to help us improve the code title: "[Bug]: " labels: ["bug"] body: - type: markdown attributes: value: | Please check that the bug is not already being tracked. - type: textarea attributes: label: Describe the bug description: Provide a clear and concise description of what the bug is and which contracts it affects. validations: required: true - type: textarea attributes: label: Expected Behavior description: Provide a clear and concise description of the desired fix. validations: required: true - type: textarea attributes: label: To Reproduce description: If you have written tests to showcase the bug, what can we run to reproduce the issue? placeholder: "git checkout / forge test --isolate --mt " - type: textarea attributes: label: Additional context description: If there is any additional context needed like a dependency or integrating contract that is affected please describe it below. ```` ## File: .github/ISSUE_TEMPLATE/FEATURE_IMPROVEMENT.yaml ````yaml name: Feature Improvement description: Suggest an improvement. labels: ["triage"] body: - type: markdown attributes: value: | Please ensure that the feature has not already been requested. - type: dropdown attributes: label: Component description: Which area of code does your idea improve? multiple: true options: - Gas Optimization - General design optimization (improving efficiency, cleanliness, or developer experience) - Testing - Documentation - type: textarea attributes: label: Describe the suggested feature and problem it solves. description: Provide a clear and concise description of what feature you would like to see, and what problems it solves. validations: required: true - type: textarea attributes: label: Describe the desired implementation. description: If possible, provide a suggested architecture change or implementation. - type: textarea attributes: label: Describe alternatives. description: If possible, describe the alternatives you've considered, or describe the current functionality and how it may be sub-optimal. - type: textarea attributes: label: Additional context. description: Please list any additional dependencies or integrating contacts that are affected. ```` ## File: .github/workflows/pre-commit.yaml ````yaml # checks that pre-commit hooks pass before allowing to merge a PR name: pre-commit on: pull_request: branches: [main, master, staging, dev, feat/**, fix/**] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: FOUNDRY_PROFILE: ${{ github.event_name == 'push' && 'ci' || 'pr' }} ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }} jobs: pre-commit: runs-on: ubuntu-latest timeout-minutes: 45 steps: - uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: submodules: recursive - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: "3.11" - name: Install Foundry uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0 with: version: stable - name: Enable pnpm run: corepack enable - name: Install dependencies run: pnpm install --frozen-lockfile - name: Install pre-commit run: python -m pip install --upgrade pip pre-commit - name: Run pre-commit run: pre-commit run --all-files --color always --show-diff-on-failure env: SKIP: forge-snapshots ```` ## File: .github/workflows/test.yaml ````yaml name: test on: pull_request: branches: [main, master, staging, dev, feat/**, fix/**] push: branches: [main, master, staging, dev] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: FOUNDRY_PROFILE: ${{ github.event_name == 'push' && 'ci' || 'pr' }} ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }} jobs: forge-test: name: Foundry project runs-on: ubuntu-latest timeout-minutes: 45 steps: - uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: submodules: recursive - name: Install Foundry uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0 with: version: stable - name: Enable pnpm run: corepack enable - name: Install dependencies run: pnpm install --frozen-lockfile - name: Run Forge fmt check run: forge fmt --check - name: Run Forge tests run: forge test --isolate ```` ## File: .github/workflows/trufflehog.yml ````yaml name: TruffleHog on: pull_request: types: [opened, synchronize, reopened] permissions: contents: read pull-requests: write id-token: write issues: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: scan: runs-on: ubuntu-latest timeout-minutes: 15 steps: - uses: bullfrogsec/bullfrog@1831f79cce8ad602eef14d2163873f27081ebfb3 # v0.8.4 - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 - name: TruffleHog OSS id: trufflehog uses: trufflesecurity/trufflehog@0f58ae7c5036094a1e3e750d18772af92821b503 # v3.90.5 with: path: . base: ${{ github.event.pull_request.base.sha }} head: ${{ github.event.pull_request.head.sha }} extra_args: --results=verified,unknown ```` ## File: .github/CODEOWNERS ```` * @symbioticfi/contracts * @symbioticfi/relay ```` ## File: .github/PULL_REQUEST_TEMPLATE.md ````markdown # Pull Request ## Description Please include a summary of the change and which feature was implemented or which issue was fixed. Also, include relevant motivation and context. List any dependencies that are required for this change. Fixes # (issue) ### How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. # Checklist: - [ ] 100% test and branch coverage - [ ] check slither or other analyzer for severe issues - [ ] fuzz and invariant tests (when applicable) --- ### Considerations - I have followed the [contributing guidelines](../CONTRIBUTING.md). - My code follows the style guidelines of this project and I have run `forge fmt` and prettier to ensure the code style is valid - I have performed a self-review of my own code - I have commented my code, particularly in hard-to-understand areas - I have made corresponding changes to the documentation - I have added tests that prove my fix is effective or that my feature works - New and existing unit tests pass locally with my changes ### Additional context Add any other context about the pull request here. ```` ## File: network-scripts/deploy.sh ````bash #!/bin/sh set -e ANVIL_RPC_URL=${ANVIL_RPC_URL:-http://anvil:8545} MULTICALL_ADDRESS=0x05f32b3cc3888453ff71b01135b34ff8e41263f2 MULTICALL_BALANCE_HEX=0xde0b6b3a7640000 # 1 ether echo "Waiting for anvil to be ready..." until cast client --rpc-url "$ANVIL_RPC_URL" > /dev/null 2>&1; do sleep 1; done echo "Deploying Multicall3 contracts..." cast rpc --rpc-url "$ANVIL_RPC_URL" anvil_setBalance "$MULTICALL_ADDRESS" "$MULTICALL_BALANCE_HEX" cast rpc --rpc-url "$ANVIL_RPC_URL" anvil_setNonce "$MULTICALL_ADDRESS" 0x0 cast publish 0xf90f538085174876e800830f42408080b90f00608060405234801561001057600080fd5b50610ee0806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e1461025a578063bce38bd714610275578063c3077fa914610288578063ee82ac5e1461029b57600080fd5b80634d2301cc146101ec57806372425d9d1461022157806382ad56cb1461023457806386d516e81461024757600080fd5b80633408e470116100c65780633408e47014610191578063399542e9146101a45780633e64a696146101c657806342cbb15c146101d957600080fd5b80630f28c97d146100f8578063174dea711461011a578063252dba421461013a57806327e86d6e1461015b575b600080fd5b34801561010457600080fd5b50425b6040519081526020015b60405180910390f35b61012d610128366004610a85565b6102ba565b6040516101119190610bbe565b61014d610148366004610a85565b6104ef565b604051610111929190610bd8565b34801561016757600080fd5b50437fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0140610107565b34801561019d57600080fd5b5046610107565b6101b76101b2366004610c60565b610690565b60405161011193929190610cba565b3480156101d257600080fd5b5048610107565b3480156101e557600080fd5b5043610107565b3480156101f857600080fd5b50610107610207366004610ce2565b73ffffffffffffffffffffffffffffffffffffffff163190565b34801561022d57600080fd5b5044610107565b61012d610242366004610a85565b6106ab565b34801561025357600080fd5b5045610107565b34801561026657600080fd5b50604051418152602001610111565b61012d610283366004610c60565b61085a565b6101b7610296366004610a85565b610a1a565b3480156102a757600080fd5b506101076102b6366004610d18565b4090565b60606000828067ffffffffffffffff8111156102d8576102d8610d31565b60405190808252806020026020018201604052801561031e57816020015b6040805180820190915260008152606060208201528152602001906001900390816102f65790505b5092503660005b8281101561047757600085828151811061034157610341610d60565b6020026020010151905087878381811061035d5761035d610d60565b905060200281019061036f9190610d8f565b6040810135958601959093506103886020850185610ce2565b73ffffffffffffffffffffffffffffffffffffffff16816103ac6060870187610dcd565b6040516103ba929190610e32565b60006040518083038185875af1925050503d80600081146103f7576040519150601f19603f3d011682016040523d82523d6000602084013e6103fc565b606091505b50602080850191909152901515808452908501351761046d577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b5050600101610325565b508234146104e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4d756c746963616c6c333a2076616c7565206d69736d6174636800000000000060448201526064015b60405180910390fd5b50505092915050565b436060828067ffffffffffffffff81111561050c5761050c610d31565b60405190808252806020026020018201604052801561053f57816020015b606081526020019060019003908161052a5790505b5091503660005b8281101561068657600087878381811061056257610562610d60565b90506020028101906105749190610e42565b92506105836020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff166105a66020850185610dcd565b6040516105b4929190610e32565b6000604051808303816000865af19150503d80600081146105f1576040519150601f19603f3d011682016040523d82523d6000602084013e6105f6565b606091505b5086848151811061060957610609610d60565b602090810291909101015290508061067d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060448201526064016104dd565b50600101610546565b5050509250929050565b43804060606106a086868661085a565b905093509350939050565b6060818067ffffffffffffffff8111156106c7576106c7610d31565b60405190808252806020026020018201604052801561070d57816020015b6040805180820190915260008152606060208201528152602001906001900390816106e55790505b5091503660005b828110156104e657600084828151811061073057610730610d60565b6020026020010151905086868381811061074c5761074c610d60565b905060200281019061075e9190610e76565b925061076d6020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff166107906040850185610dcd565b60405161079e929190610e32565b6000604051808303816000865af19150503d80600081146107db576040519150601f19603f3d011682016040523d82523d6000602084013e6107e0565b606091505b506020808401919091529015158083529084013517610851577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b50600101610714565b6060818067ffffffffffffffff81111561087657610876610d31565b6040519080825280602002602001820160405280156108bc57816020015b6040805180820190915260008152606060208201528152602001906001900390816108945790505b5091503660005b82811015610a105760008482815181106108df576108df610d60565b602002602001015190508686838181106108fb576108fb610d60565b905060200281019061090d9190610e42565b925061091c6020840184610ce2565b73ffffffffffffffffffffffffffffffffffffffff1661093f6020850185610dcd565b60405161094d929190610e32565b6000604051808303816000865af19150503d806000811461098a576040519150601f19603f3d011682016040523d82523d6000602084013e61098f565b606091505b506020830152151581528715610a07578051610a07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060448201526064016104dd565b506001016108c3565b5050509392505050565b6000806060610a2b60018686610690565b919790965090945092505050565b60008083601f840112610a4b57600080fd5b50813567ffffffffffffffff811115610a6357600080fd5b6020830191508360208260051b8501011115610a7e57600080fd5b9250929050565b60008060208385031215610a9857600080fd5b823567ffffffffffffffff811115610aaf57600080fd5b610abb85828601610a39565b90969095509350505050565b6000815180845260005b81811015610aed57602081850181015186830182015201610ad1565b81811115610aff576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600082825180855260208086019550808260051b84010181860160005b84811015610bb1578583037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001895281518051151584528401516040858501819052610b9d81860183610ac7565b9a86019a9450505090830190600101610b4f565b5090979650505050505050565b602081526000610bd16020830184610b32565b9392505050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610c52577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0888703018452610c40868351610ac7565b95509284019290840190600101610c06565b509398975050505050505050565b600080600060408486031215610c7557600080fd5b83358015158114610c8557600080fd5b9250602084013567ffffffffffffffff811115610ca157600080fd5b610cad86828701610a39565b9497909650939450505050565b838152826020820152606060408201526000610cd96060830184610b32565b95945050505050565b600060208284031215610cf457600080fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610bd157600080fd5b600060208284031215610d2a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81833603018112610dc357600080fd5b9190910192915050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610e0257600080fd5b83018035915067ffffffffffffffff821115610e1d57600080fd5b602001915036819003821315610a7e57600080fd5b8183823760009101908152919050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112610dc357600080fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa1833603018112610dc357600080fdfea2646970667358221220bb2b5c71a328032f97c676ae39a1ec2148d3e5d6f73d95e9b17910152d61f16264736f6c634300080c00331ca0edce47092c0f398cebf3ffc267f05c8e7076e3b89445e0fe50f6332273d4569ba01b0b9d000e19b24c5869b0fc3b22b0d6fa47cd63316875cbbd577d76e6fde086 --rpc-url "$ANVIL_RPC_URL" echo "Deploying contracts..." ./node_modules/@symbioticfi/relay-contracts/script/relay-deploy.sh script/MyRelayDeploy.sol script/my-relay-deploy.toml --broadcast --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 -vvvvv echo 'Waiting for deployment completion...' until [ -f /deploy-data/deployment-completed.json ]; do sleep 2; done echo "Setting interval mining..." cast rpc --rpc-url "$ANVIL_RPC_URL" evm_setIntervalMining 1 echo "Mine a single block to finalize the deployment..." cast rpc --rpc-url "$ANVIL_RPC_URL" evm_mine echo "Deployment completed successfully!" # Create deployment completion marker echo "$(date): Deployment completed successfully" > /deploy-data/deployment-complete.marker echo "Deployment completion marker created" ```` ## File: network-scripts/deployer.Dockerfile ````dockerfile FROM ghcr.io/foundry-rs/foundry:v1.4.4 USER root # Install Python (needed by relay deployment helper scripts) together with tomli fallback. RUN set -eux; \ if command -v apt-get >/dev/null 2>&1; then \ apt-get update; \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ python3 \ python3-venv \ python3-pip; \ rm -rf /var/lib/apt/lists/*; \ elif command -v apk >/dev/null 2>&1; then \ apk add --no-cache \ python3 \ py3-virtualenv \ py3-pip; \ else \ echo "Unable to determine package manager for Python installation." >&2; \ exit 1; \ fi; \ python3 -m pip install --no-cache-dir tomli; \ python3 --version USER foundry ```` ## File: network-scripts/flight-node-start.sh ````bash #!/bin/sh FLIGHT_DELAYS_ADDRESS=0xA4b0f5eb09891c1538494c4989Eea0203b1153b1 exec /app/flight-node --relay-api-url "$1" --evm-rpc-url http://anvil:8545 --flight-delays-address "$FLIGHT_DELAYS_ADDRESS" --flights-api-url http://flights-api:8085 --private-key "$2" --log-level info ```` ## File: network-scripts/genesis-generator.sh ````bash #!/bin/sh echo 'Waiting for deployment completion...' until [ -f /deploy-data/deployment-complete.marker ]; do sleep 2; done DRIVER_ADDRESS=0x43C27243F96591892976FFf886511807B65a33d5 MAX_RETRIES=50 RETRY_DELAY=2 attempt=1 while [ $attempt -le $MAX_RETRIES ]; do echo "Attempt $attempt of $MAX_RETRIES: Generating network genesis..." if /app/relay_utils network \ --chains http://anvil:8545 \ --driver.address "$DRIVER_ADDRESS" \ --driver.chainid 31337 \ generate-genesis \ --commit \ --secret-keys 31337:0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80; then echo 'Genesis generation completed successfully!' # Create genesis completion marker echo "$(date): Genesis generation completed successfully" > /deploy-data/genesis-complete.marker echo "Genesis completion marker created" echo "Waiting few seconds before exiting..." sleep 5 exit 0 else echo "Genesis generation failed on attempt $attempt" if [ $attempt -lt $MAX_RETRIES ]; then echo "Waiting $RETRY_DELAY seconds before retry..." sleep $RETRY_DELAY else echo "All $MAX_RETRIES attempts failed. Exiting with error." exit 1 fi attempt=$((attempt + 1)) fi done ```` ## File: network-scripts/sidecar-start.sh ````bash #!/bin/sh DRIVER_ADDRESS=0x43C27243F96591892976FFf886511807B65a33d5 cat > /tmp/sidecar.yaml << EOFCONFIG # Logging log: level: "debug" mode: "pretty" # API Server Configuration api: listen: ":8080" # Metrics Configuration metrics: pprof: true # Driver Contract driver: chain-id: 31337 address: "$DRIVER_ADDRESS" # P2P Configuration p2p: listen: "/ip4/0.0.0.0/tcp/8880" bootnodes: - /dns4/relay-sidecar-1/tcp/8880/p2p/16Uiu2HAmFUiPYAJ7bE88Q8d7Kznrw5ifrje2e5QFyt7uFPk2G3iR dht-mode: "server" mdns: true # EVM Configuration evm: chains: - "http://anvil:8545" max-calls: 30 EOFCONFIG exec /app/relay_sidecar --config /tmp/sidecar.yaml --secret-keys "$1" --storage-dir "$2" ```` ## File: off-chain/abis/FlightDelays.abi.json ````json [ { "type": "constructor", "inputs": [ { "name": "vaultConfigurator", "type": "address", "internalType": "address" }, { "name": "operatorVaultOptInService", "type": "address", "internalType": "address" }, { "name": "operatorNetworkOptInService", "type": "address", "internalType": "address" }, { "name": "defaultStakerRewardsFactory", "type": "address", "internalType": "address" }, { "name": "operatorRegistry", "type": "address", "internalType": "address" } ], "stateMutability": "nonpayable" }, { "type": "function", "name": "DEFAULT_STAKER_REWARDS_FACTORY", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "NETWORK", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "OPERATOR_NETWORK_OPT_IN_SERVICE", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "OPERATOR_VAULT_OPT_IN_SERVICE", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "SUBNETWORK", "inputs": [], "outputs": [ { "name": "", "type": "bytes32", "internalType": "bytes32" } ], "stateMutability": "view" }, { "type": "function", "name": "SUBNETWORK_IDENTIFIER", "inputs": [], "outputs": [ { "name": "", "type": "uint96", "internalType": "uint96" } ], "stateMutability": "view" }, { "type": "function", "name": "VAULT_CONFIGURATOR", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "airlines", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" } ], "outputs": [ { "name": "vault", "type": "address", "internalType": "address" }, { "name": "rewards", "type": "address", "internalType": "address" }, { "name": "covered", "type": "uint256", "internalType": "uint256" }, { "name": "lastFlightId", "type": "bytes32", "internalType": "bytes32" } ], "stateMutability": "view" }, { "type": "function", "name": "buyInsurance", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "claimInsurance", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "collateral", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "createFlight", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" }, { "name": "scheduledTimestamp", "type": "uint48", "internalType": "uint48" }, { "name": "epoch", "type": "uint48", "internalType": "uint48" }, { "name": "proof", "type": "bytes", "internalType": "bytes" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "delayFlight", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" }, { "name": "epoch", "type": "uint48", "internalType": "uint48" }, { "name": "proof", "type": "bytes", "internalType": "bytes" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "delayWindow", "inputs": [], "outputs": [ { "name": "", "type": "uint48", "internalType": "uint48" } ], "stateMutability": "view" }, { "type": "function", "name": "departFlight", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" }, { "name": "epoch", "type": "uint48", "internalType": "uint48" }, { "name": "proof", "type": "bytes", "internalType": "bytes" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "flights", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" } ], "outputs": [ { "name": "timestamp", "type": "uint48", "internalType": "uint48" }, { "name": "status", "type": "uint8", "internalType": "enum FlightDelays.FlightStatus" }, { "name": "policiesSold", "type": "uint128", "internalType": "uint128" }, { "name": "previousFlightId", "type": "bytes32", "internalType": "bytes32" } ], "stateMutability": "view" }, { "type": "function", "name": "initialize", "inputs": [ { "name": "initParams", "type": "tuple", "internalType": "struct FlightDelays.InitParams", "components": [ { "name": "votingPowers", "type": "address", "internalType": "address" }, { "name": "settlement", "type": "address", "internalType": "address" }, { "name": "collateral", "type": "address", "internalType": "address" }, { "name": "vaultEpochDuration", "type": "uint48", "internalType": "uint48" }, { "name": "messageExpiry", "type": "uint32", "internalType": "uint32" }, { "name": "policyWindow", "type": "uint48", "internalType": "uint48" }, { "name": "delayWindow", "type": "uint48", "internalType": "uint48" }, { "name": "policyPremium", "type": "uint256", "internalType": "uint256" }, { "name": "policyPayout", "type": "uint256", "internalType": "uint256" } ] } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "messageExpiry", "inputs": [], "outputs": [ { "name": "", "type": "uint32", "internalType": "uint32" } ], "stateMutability": "view" }, { "type": "function", "name": "policies", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" }, { "name": "buyer", "type": "address", "internalType": "address" } ], "outputs": [ { "name": "policyStatus", "type": "uint8", "internalType": "enum FlightDelays.PolicyStatus" } ], "stateMutability": "view" }, { "type": "function", "name": "policyPayout", "inputs": [], "outputs": [ { "name": "", "type": "uint256", "internalType": "uint256" } ], "stateMutability": "view" }, { "type": "function", "name": "policyPremium", "inputs": [], "outputs": [ { "name": "", "type": "uint256", "internalType": "uint256" } ], "stateMutability": "view" }, { "type": "function", "name": "policyWindow", "inputs": [], "outputs": [ { "name": "", "type": "uint48", "internalType": "uint48" } ], "stateMutability": "view" }, { "type": "function", "name": "settlement", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "staticDelegateCall", "inputs": [ { "name": "target", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "vaultEpochDuration", "inputs": [], "outputs": [ { "name": "", "type": "uint48", "internalType": "uint48" } ], "stateMutability": "view" }, { "type": "function", "name": "votingPowers", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "event", "name": "AirlineVaultDeployed", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "vault", "type": "address", "indexed": false, "internalType": "address" }, { "name": "rewards", "type": "address", "indexed": false, "internalType": "address" } ], "anonymous": false }, { "type": "event", "name": "FlightCreated", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "scheduledTimestamp", "type": "uint48", "indexed": false, "internalType": "uint48" } ], "anonymous": false }, { "type": "event", "name": "FlightDelayed", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" } ], "anonymous": false }, { "type": "event", "name": "FlightDeparted", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" } ], "anonymous": false }, { "type": "event", "name": "InitSubnetwork", "inputs": [ { "name": "network", "type": "address", "indexed": false, "internalType": "address" }, { "name": "subnetworkId", "type": "uint96", "indexed": false, "internalType": "uint96" } ], "anonymous": false }, { "type": "event", "name": "Initialized", "inputs": [ { "name": "version", "type": "uint64", "indexed": false, "internalType": "uint64" } ], "anonymous": false }, { "type": "event", "name": "InsuranceClaimed", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "buyer", "type": "address", "indexed": true, "internalType": "address" }, { "name": "payout", "type": "uint256", "indexed": false, "internalType": "uint256" } ], "anonymous": false }, { "type": "event", "name": "InsurancePurchased", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "buyer", "type": "address", "indexed": true, "internalType": "address" }, { "name": "premium", "type": "uint256", "indexed": false, "internalType": "uint256" } ], "anonymous": false }, { "type": "error", "name": "BuyWindowClosed", "inputs": [] }, { "type": "error", "name": "FlightAlreadyExists", "inputs": [] }, { "type": "error", "name": "FlightNotDelayable", "inputs": [] }, { "type": "error", "name": "FlightNotDelayed", "inputs": [] }, { "type": "error", "name": "FlightNotScheduled", "inputs": [] }, { "type": "error", "name": "InsufficientCoverage", "inputs": [] }, { "type": "error", "name": "InvalidEpoch", "inputs": [] }, { "type": "error", "name": "InvalidFlight", "inputs": [] }, { "type": "error", "name": "InvalidInitialization", "inputs": [] }, { "type": "error", "name": "InvalidMessageSignature", "inputs": [] }, { "type": "error", "name": "InvalidPolicy", "inputs": [] }, { "type": "error", "name": "InvalidTimestamp", "inputs": [] }, { "type": "error", "name": "NetworkManager_InvalidNetwork", "inputs": [] }, { "type": "error", "name": "NotInitializing", "inputs": [] }, { "type": "error", "name": "PolicyAlreadyPurchased", "inputs": [] }, { "type": "error", "name": "PolicyNotFound", "inputs": [] }, { "type": "error", "name": "PreviousFlightIncomplete", "inputs": [] }, { "type": "error", "name": "SafeERC20FailedOperation", "inputs": [ { "name": "token", "type": "address", "internalType": "address" } ] } ] ```` ## File: off-chain/cmd/benchmark/main.go ````go package main ⋮---- import ( "bytes" "context" "crypto/rand" "fmt" "log/slog" "math/big" "os" "os/exec" "strings" "time" "github.com/samber/lo" "sum/internal/utils" "github.com/ethereum/go-ethereum/common" "github.com/go-errors/errors" v1 "github.com/symbioticfi/relay/api/client/v1" "golang.org/x/sync/errgroup" ) ⋮---- "bytes" "context" "crypto/rand" "fmt" "log/slog" "math/big" "os" "os/exec" "strings" "time" ⋮---- "github.com/samber/lo" ⋮---- "sum/internal/utils" ⋮---- "github.com/ethereum/go-ethereum/common" "github.com/go-errors/errors" v1 "github.com/symbioticfi/relay/api/client/v1" "golang.org/x/sync/errgroup" ⋮---- type processes []process ⋮---- type process struct { args []string cmd *exec.Cmd stdOut *bytes.Buffer stdErr *bytes.Buffer apiAddr string relayClient *v1.SymbioticClient runSeparately bool } ⋮---- const ( operatorsCount = 3 numberOfSignRequests = 1000 sizeOfMessageBytes = 320 ) ⋮---- func main() ⋮---- func run(ctx context.Context) error ⋮---- func sendRequestAndWait(ctx context.Context, prs processes, nRequests int) *errors.Error ⋮---- func runProcesses(ctx context.Context, runSeparately bool) (processes, error) ⋮---- var prs processes ⋮---- func (prs processes) waitServerStarted(ctx context.Context) ⋮---- var startedCound int ⋮---- func (prs processes) stopProcesses() ⋮---- // Send an interrupt signal for a graceful shutdown, that is equivalent to pressing Ctrl+C. ⋮---- // If signaling fails, you can resort to killing the process forcefully. ⋮---- func (prs processes) sendMessageToAllRelays(ctx context.Context, epoch uint64) (string, error) ⋮---- var requestID string ⋮---- func sendSignMessageRequest(ctx context.Context, pr process, message []byte, epoch uint64) (string, error) ⋮---- func randomMessage(n int) []byte ⋮---- func (prs processes) printErrLogs() ```` ## File: off-chain/cmd/flights-api/main.go ````go package main ⋮---- import ( "context" "encoding/json" "errors" "fmt" "log/slog" "math/rand" "net/http" "os" "os/signal" "strconv" "strings" "sync" "syscall" "time" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "github.com/spf13/cobra" "sum/internal/flights" ) ⋮---- "context" "encoding/json" "errors" "fmt" "log/slog" "math/rand" "net/http" "os" "os/signal" "strconv" "strings" "sync" "syscall" "time" ⋮---- "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "github.com/spf13/cobra" ⋮---- "sum/internal/flights" ⋮---- type config struct { listenAddr string } ⋮---- var cfg config ⋮---- var rootCmd = &cobra.Command{ Use: "flights-api", Short: "Mock flights API backing the flight delay protocol", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) defer cancel() store := flights.NewStore(seedAirlines(), seedFlights()) generator := newFlightGenerator(store) generator.start(ctx) srv := newFlightServer(store) httpServer := &http.Server{ Addr: cfg.listenAddr, Handler: srv.routes(), ReadHeaderTimeout: 5 * time.Second, ReadTimeout: 10 * time.Second, WriteTimeout: 10 * time.Second, } done := make(chan struct{}) go func() { <-ctx.Done() shutdownCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() if err := httpServer.Shutdown(shutdownCtx); err != nil { slog.Error("Failed to shut down flights API", "error", err) } close(done) }() slog.Info("Flights API listening", "addr", cfg.listenAddr) err := httpServer.ListenAndServe() if err != nil && !errors.Is(err, http.ErrServerClosed) { return err } <-done return nil }, } ⋮---- func main() ⋮---- type flightServer struct { store *flights.Store } ⋮---- func newFlightServer(store *flights.Store) *flightServer ⋮---- func (s *flightServer) routes() http.Handler ⋮---- func (s *flightServer) handleListAirlines(w http.ResponseWriter, r *http.Request) ⋮---- type createAirlineRequest struct { AirlineID string `json:"airlineId"` Name string `json:"name"` Code string `json:"code"` } ⋮---- func (s *flightServer) handleCreateAirline(w http.ResponseWriter, r *http.Request) ⋮---- var body createAirlineRequest ⋮---- func (s *flightServer) handleListFlights(w http.ResponseWriter, r *http.Request) ⋮---- type createFlightRequest struct { FlightID string `json:"flightId"` DepartureTimestamp int64 `json:"departureTimestamp"` } ⋮---- func (s *flightServer) handleCreateFlight(w http.ResponseWriter, r *http.Request) ⋮---- var body createFlightRequest ⋮---- func (s *flightServer) handleUpdateStatus(status flights.Status) http.HandlerFunc ⋮---- func writeJSON(w http.ResponseWriter, status int, payload any) ⋮---- func respondError(w http.ResponseWriter, status int, message string) ⋮---- func mapStoreError(err error) (int, string) ⋮---- func seedAirlines() []flights.Airline ⋮---- func seedFlights() []flights.Flight ⋮---- type flightGenerator struct { store *flights.Store rand *rand.Rand counters map[string]int createInterval time.Duration updateInterval time.Duration mu sync.Mutex } ⋮---- func newFlightGenerator(store *flights.Store) *flightGenerator ⋮---- func (g *flightGenerator) start(ctx context.Context) ⋮---- func (g *flightGenerator) bootstrapCounters() ⋮---- func (g *flightGenerator) maybeCreateFlights() ⋮---- func (g *flightGenerator) advanceFlights() ⋮---- func (g *flightGenerator) updateStatus(airlineID, flightID string, status flights.Status) ⋮---- func (g *flightGenerator) nextFlightID(airlineID string) string ⋮---- func parseFlightNumber(id string) int ⋮---- func corsMiddleware(next http.Handler) http.Handler ```` ## File: off-chain/cmd/node/main.go ````go package main ⋮---- import ( "context" "crypto/ecdsa" "encoding/json" "errors" "fmt" "log/slog" "math/big" "net/http" "net/url" "os" "os/signal" "sort" "strings" "syscall" "time" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" "github.com/spf13/cobra" v1 "github.com/symbioticfi/relay/api/client/v1" "sum/internal/contracts" "sum/internal/flights" "sum/internal/utils" ) ⋮---- "context" "crypto/ecdsa" "encoding/json" "errors" "fmt" "log/slog" "math/big" "net/http" "net/url" "os" "os/signal" "sort" "strings" "syscall" "time" ⋮---- "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" "github.com/spf13/cobra" v1 "github.com/symbioticfi/relay/api/client/v1" ⋮---- "sum/internal/contracts" "sum/internal/flights" "sum/internal/utils" ⋮---- const ( keyTag = 15 maxUint48 = (1 << 48) - 1 ⋮---- type config struct { relayAPIURL string evmRPCURL string contractAddress string flightsAPIURL string privateKeyHex string pollInterval time.Duration proofPollInterval time.Duration logLevel string } ⋮---- var cfg config ⋮---- var rootCmd = &cobra.Command{ Use: "flight-node", Short: "Flight delay oracle node", SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { switch strings.ToLower(cfg.logLevel) { case "debug": slog.SetLogLoggerLevel(slog.LevelDebug) case "warn": slog.SetLogLoggerLevel(slog.LevelWarn) case "error": slog.SetLogLoggerLevel(slog.LevelError) default: slog.SetLogLoggerLevel(slog.LevelInfo) } ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) defer cancel() conn, err := utils.GetGRPCConnection(cfg.relayAPIURL) if err != nil { return fmt.Errorf("create relay client: %w", err) } defer conn.Close() relayClient := v1.NewSymbioticClient(conn) evmClient, err := ethclient.DialContext(ctx, cfg.evmRPCURL) if err != nil { return fmt.Errorf("dial evm rpc: %w", err) } defer evmClient.Close() chainID, err := evmClient.ChainID(ctx) if err != nil { return fmt.Errorf("fetch chain id: %w", err) } contractAddr := common.HexToAddress(cfg.contractAddress) flightDelays, err := contracts.NewFlightDelays(contractAddr, evmClient) if err != nil { return fmt.Errorf("bind flight delays: %w", err) } flightsClient := newFlightsAPIClient(cfg.flightsAPIURL) privKey, err := crypto.HexToECDSA(strings.TrimPrefix(cfg.privateKeyHex, "0x")) if err != nil { return fmt.Errorf("parse private key: %w", err) } node := &flightNode{ relayClient: relayClient, ethClient: evmClient, contract: flightDelays, chainID: chainID, privateKey: privKey, flightsAPI: flightsClient, pending: make(map[string]*pendingAction), } if err := node.syncFlights(ctx); err != nil { slog.Warn("initial sync failed", "error", err) } pollTicker := time.NewTicker(cfg.pollInterval) defer pollTicker.Stop() proofTicker := time.NewTicker(cfg.proofPollInterval) defer proofTicker.Stop() for { select { case <-pollTicker.C: if err := node.syncFlights(ctx); err != nil { slog.Warn("sync flights failed", "error", err) } case <-proofTicker.C: if err := node.fetchProofs(ctx); err != nil { slog.Warn("fetch proofs failed", "error", err) } if err := node.submitReadyActions(ctx); err != nil { slog.Warn("submit actions failed", "error", err) } case <-ctx.Done(): slog.Info("shutting down flight node") return nil } } }, } ⋮---- func main() ⋮---- var ( bytes32Type = mustABIType("bytes32") ⋮---- func mustABIType(name string) abi.Type ⋮---- type actionType string ⋮---- type flightStatus uint8 ⋮---- const ( actionCreate actionType = "CREATE" actionDelay actionType = "DELAY" actionDepart actionType = "DEPART" statusNone flightStatus = 0 statusScheduled flightStatus = 1 statusDelayed flightStatus = 2 statusDeparted flightStatus = 3 ) ⋮---- type pendingAction struct { Key string Airline flights.Airline Flight flights.Flight AirlineHash common.Hash FlightHash common.Hash PreviousFlightHash common.Hash Type actionType Epoch uint64 RequestID string Proof []byte Submitted bool TargetStatus flightStatus TxHash common.Hash CreatedAt time.Time } ⋮---- type flightNode struct { relayClient *v1.SymbioticClient ethClient *ethclient.Client contract *contracts.FlightDelays chainID *big.Int privateKey *ecdsa.PrivateKey flightsAPI *flightsAPIClient pending map[string]*pendingAction } ⋮---- func (n *flightNode) syncFlights(ctx context.Context) error ⋮---- func (n *flightNode) evaluateAirlineFlights(ctx context.Context, airline flights.Airline, flightsForAirline []flights.Flight) error ⋮---- var prev common.Hash ⋮---- func (n *flightNode) evaluateFlight(ctx context.Context, airline flights.Airline, flight flights.Flight, airlineHash common.Hash, previousFlightHash common.Hash) error ⋮---- func determineAction(apiStatus flights.Status, onChain flightStatus) (actionType, bool) ⋮---- func (n *flightNode) enqueueAction(ctx context.Context, key string, action actionType, airline flights.Airline, flight flights.Flight, airlineHash, flightHash, previousFlightHash common.Hash) error ⋮---- func (n *flightNode) requestSignature(ctx context.Context, payload []byte) (uint64, string, error) ⋮---- var suggestedEpoch uint64 ⋮---- func (n *flightNode) fetchProofs(ctx context.Context) error ⋮---- func (n *flightNode) submitReadyActions(ctx context.Context) error ⋮---- func (n *flightNode) submitAction(ctx context.Context, action *pendingAction) error ⋮---- var txHash common.Hash ⋮---- func (n *flightNode) canSubmitCreate(ctx context.Context, action *pendingAction) (bool, error) ⋮---- func (n *flightNode) clearSatisfiedPending(airlineHash, flightHash common.Hash, status flightStatus) ⋮---- func targetStatusFor(action actionType) flightStatus ⋮---- func buildMessagePayload(action actionType, airlineHash, flightHash, previousFlightHash common.Hash, departure uint64) ([]byte, error) ⋮---- var inner []byte var err error ⋮---- func hashIdentifier(id string) common.Hash ⋮---- func actionKey(airlineHash, flightHash common.Hash, action actionType) string ⋮---- type flightsAPIClient struct { baseURL string httpClient *http.Client } ⋮---- func newFlightsAPIClient(baseURL string) *flightsAPIClient ⋮---- func (c *flightsAPIClient) ListAirlines(ctx context.Context) ([]flights.Airline, error) ⋮---- var body struct { Airlines []flights.Airline `json:"airlines"` } ⋮---- func (c *flightsAPIClient) ListFlights(ctx context.Context, airlineID string) ([]flights.Flight, error) ⋮---- var body struct { Flights []flights.Flight `json:"flights"` } ```` ## File: off-chain/internal/contracts/flightDelays.go ````go // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. ⋮---- package contracts ⋮---- import ( "errors" "math/big" "strings" ethereum "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" ) ⋮---- "errors" "math/big" "strings" ⋮---- ethereum "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" ⋮---- // Reference imports to suppress errors if they are not otherwise used. var ( _ = errors.New _ = big.NewInt _ = strings.NewReader _ = ethereum.NotFound _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = event.NewSubscription _ = abi.ConvertType ) ⋮---- // FlightDelaysInitParams is an auto generated low-level Go binding around an user-defined struct. type FlightDelaysInitParams struct { VotingPowers common.Address Settlement common.Address Collateral common.Address VaultEpochDuration *big.Int MessageExpiry uint32 PolicyWindow *big.Int DelayWindow *big.Int PolicyPremium *big.Int PolicyPayout *big.Int } ⋮---- // FlightDelaysMetaData contains all meta data concerning the FlightDelays contract. var FlightDelaysMetaData = &bind.MetaData{ ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"vaultConfigurator\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"operatorVaultOptInService\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"operatorNetworkOptInService\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"defaultStakerRewardsFactory\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"operatorRegistry\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"DEFAULT_STAKER_REWARDS_FACTORY\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"NETWORK\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"OPERATOR_NETWORK_OPT_IN_SERVICE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"OPERATOR_VAULT_OPT_IN_SERVICE\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"SUBNETWORK\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"SUBNETWORK_IDENTIFIER\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"VAULT_CONFIGURATOR\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"airlines\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"vault\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"rewards\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"covered\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"lastFlightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"buyInsurance\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"claimInsurance\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"collateral\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"createFlight\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"scheduledTimestamp\",\"type\":\"uint48\",\"internalType\":\"uint48\"},{\"name\":\"previousFlightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"epoch\",\"type\":\"uint48\",\"internalType\":\"uint48\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"delayFlight\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"epoch\",\"type\":\"uint48\",\"internalType\":\"uint48\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"delayWindow\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint48\",\"internalType\":\"uint48\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"departFlight\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"epoch\",\"type\":\"uint48\",\"internalType\":\"uint48\"},{\"name\":\"proof\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"flights\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"timestamp\",\"type\":\"uint48\",\"internalType\":\"uint48\"},{\"name\":\"status\",\"type\":\"uint8\",\"internalType\":\"enumFlightDelays.FlightStatus\"},{\"name\":\"policiesSold\",\"type\":\"uint128\",\"internalType\":\"uint128\"},{\"name\":\"previousFlightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"initParams\",\"type\":\"tuple\",\"internalType\":\"structFlightDelays.InitParams\",\"components\":[{\"name\":\"votingPowers\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"settlement\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"collateral\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"vaultEpochDuration\",\"type\":\"uint48\",\"internalType\":\"uint48\"},{\"name\":\"messageExpiry\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"policyWindow\",\"type\":\"uint48\",\"internalType\":\"uint48\"},{\"name\":\"delayWindow\",\"type\":\"uint48\",\"internalType\":\"uint48\"},{\"name\":\"policyPremium\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"policyPayout\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"messageExpiry\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"policies\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"buyer\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"policyStatus\",\"type\":\"uint8\",\"internalType\":\"enumFlightDelays.PolicyStatus\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"policyPayout\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"policyPremium\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"policyWindow\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint48\",\"internalType\":\"uint48\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"settlement\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"staticDelegateCall\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"vaultEpochDuration\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint48\",\"internalType\":\"uint48\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"votingPowers\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"AirlineVaultDeployed\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"vault\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"rewards\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FlightCreated\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"scheduledTimestamp\",\"type\":\"uint48\",\"indexed\":false,\"internalType\":\"uint48\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FlightDelayed\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FlightDeparted\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"InitSubnetwork\",\"inputs\":[{\"name\":\"network\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"subnetworkId\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"InsuranceClaimed\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"buyer\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"payout\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"InsurancePurchased\",\"inputs\":[{\"name\":\"airlineId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"flightId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"buyer\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"premium\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"BuyWindowClosed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FlightAlreadyExists\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FlightNotDelayable\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FlightNotDelayed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FlightNotScheduled\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InsufficientCoverage\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidEpoch\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidFlight\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidInitialization\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidMessageSignature\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidPolicy\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidTimestamp\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NetworkManager_InvalidNetwork\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotInitializing\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"PolicyAlreadyPurchased\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"PolicyNotFound\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"PreviousFlightIncomplete\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SafeERC20FailedOperation\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}]}]", } ⋮---- // FlightDelaysABI is the input ABI used to generate the binding from. // Deprecated: Use FlightDelaysMetaData.ABI instead. var FlightDelaysABI = FlightDelaysMetaData.ABI ⋮---- // FlightDelays is an auto generated Go binding around an Ethereum contract. type FlightDelays struct { FlightDelaysCaller // Read-only binding to the contract FlightDelaysTransactor // Write-only binding to the contract FlightDelaysFilterer // Log filterer for contract events } ⋮---- FlightDelaysCaller // Read-only binding to the contract FlightDelaysTransactor // Write-only binding to the contract FlightDelaysFilterer // Log filterer for contract events ⋮---- // FlightDelaysCaller is an auto generated read-only Go binding around an Ethereum contract. type FlightDelaysCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } ⋮---- contract *bind.BoundContract // Generic contract wrapper for the low level calls ⋮---- // FlightDelaysTransactor is an auto generated write-only Go binding around an Ethereum contract. type FlightDelaysTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } ⋮---- // FlightDelaysFilterer is an auto generated log filtering Go binding around an Ethereum contract events. type FlightDelaysFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } ⋮---- // FlightDelaysSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. type FlightDelaysSession struct { Contract *FlightDelays // Generic contract binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } ⋮---- Contract *FlightDelays // Generic contract binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session ⋮---- // FlightDelaysCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. type FlightDelaysCallerSession struct { Contract *FlightDelaysCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } ⋮---- Contract *FlightDelaysCaller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session ⋮---- // FlightDelaysTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. type FlightDelaysTransactorSession struct { Contract *FlightDelaysTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } ⋮---- Contract *FlightDelaysTransactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session ⋮---- // FlightDelaysRaw is an auto generated low-level Go binding around an Ethereum contract. type FlightDelaysRaw struct { Contract *FlightDelays // Generic contract binding to access the raw methods on } ⋮---- Contract *FlightDelays // Generic contract binding to access the raw methods on ⋮---- // FlightDelaysCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. type FlightDelaysCallerRaw struct { Contract *FlightDelaysCaller // Generic read-only contract binding to access the raw methods on } ⋮---- Contract *FlightDelaysCaller // Generic read-only contract binding to access the raw methods on ⋮---- // FlightDelaysTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. type FlightDelaysTransactorRaw struct { Contract *FlightDelaysTransactor // Generic write-only contract binding to access the raw methods on } ⋮---- Contract *FlightDelaysTransactor // Generic write-only contract binding to access the raw methods on ⋮---- // NewFlightDelays creates a new instance of FlightDelays, bound to a specific deployed contract. func NewFlightDelays(address common.Address, backend bind.ContractBackend) (*FlightDelays, error) ⋮---- // NewFlightDelaysCaller creates a new read-only instance of FlightDelays, bound to a specific deployed contract. func NewFlightDelaysCaller(address common.Address, caller bind.ContractCaller) (*FlightDelaysCaller, error) ⋮---- // NewFlightDelaysTransactor creates a new write-only instance of FlightDelays, bound to a specific deployed contract. func NewFlightDelaysTransactor(address common.Address, transactor bind.ContractTransactor) (*FlightDelaysTransactor, error) ⋮---- // NewFlightDelaysFilterer creates a new log filterer instance of FlightDelays, bound to a specific deployed contract. func NewFlightDelaysFilterer(address common.Address, filterer bind.ContractFilterer) (*FlightDelaysFilterer, error) ⋮---- // bindFlightDelays binds a generic wrapper to an already deployed contract. func bindFlightDelays(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) ⋮---- // Call invokes the (constant) contract method with params as input values and // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. func (_FlightDelays *FlightDelaysRaw) Call(opts *bind.CallOpts, result *[]interface ⋮---- // Transfer initiates a plain transaction to move funds to the contract, calling // its default method if one is available. func (_FlightDelays *FlightDelaysRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) ⋮---- // Transact invokes the (paid) contract method with params as input values. func (_FlightDelays *FlightDelaysRaw) Transact(opts *bind.TransactOpts, method string, params ...interface ⋮---- // DEFAULTSTAKERREWARDSFACTORY is a free data retrieval call binding the contract method 0x360d7094. // // Solidity: function DEFAULT_STAKER_REWARDS_FACTORY() view returns(address) func (_FlightDelays *FlightDelaysCaller) DEFAULTSTAKERREWARDSFACTORY(opts *bind.CallOpts) (common.Address, error) ⋮---- var out []interface{} ⋮---- // NETWORK is a free data retrieval call binding the contract method 0x8759e6d1. ⋮---- // Solidity: function NETWORK() view returns(address) func (_FlightDelays *FlightDelaysCaller) NETWORK(opts *bind.CallOpts) (common.Address, error) ⋮---- // OPERATORNETWORKOPTINSERVICE is a free data retrieval call binding the contract method 0x1a80e500. ⋮---- // Solidity: function OPERATOR_NETWORK_OPT_IN_SERVICE() view returns(address) func (_FlightDelays *FlightDelaysCaller) OPERATORNETWORKOPTINSERVICE(opts *bind.CallOpts) (common.Address, error) ⋮---- // OPERATORVAULTOPTINSERVICE is a free data retrieval call binding the contract method 0x128e5d82. ⋮---- // Solidity: function OPERATOR_VAULT_OPT_IN_SERVICE() view returns(address) func (_FlightDelays *FlightDelaysCaller) OPERATORVAULTOPTINSERVICE(opts *bind.CallOpts) (common.Address, error) ⋮---- // SUBNETWORK is a free data retrieval call binding the contract method 0x773e6b54. ⋮---- // Solidity: function SUBNETWORK() view returns(bytes32) func (_FlightDelays *FlightDelaysCaller) SUBNETWORK(opts *bind.CallOpts) ([32]byte, error) ⋮---- // SUBNETWORKIDENTIFIER is a free data retrieval call binding the contract method 0xabacb807. ⋮---- // Solidity: function SUBNETWORK_IDENTIFIER() view returns(uint96) func (_FlightDelays *FlightDelaysCaller) SUBNETWORKIDENTIFIER(opts *bind.CallOpts) (*big.Int, error) ⋮---- // VAULTCONFIGURATOR is a free data retrieval call binding the contract method 0xb25bc0c0. ⋮---- // Solidity: function VAULT_CONFIGURATOR() view returns(address) func (_FlightDelays *FlightDelaysCaller) VAULTCONFIGURATOR(opts *bind.CallOpts) (common.Address, error) ⋮---- // Airlines is a free data retrieval call binding the contract method 0x116a272b. ⋮---- // Solidity: function airlines(bytes32 airlineId) view returns(address vault, address rewards, uint256 covered, bytes32 lastFlightId) func (_FlightDelays *FlightDelaysCaller) Airlines(opts *bind.CallOpts, airlineId [32]byte) (struct ⋮---- // Collateral is a free data retrieval call binding the contract method 0xd8dfeb45. ⋮---- // Solidity: function collateral() view returns(address) func (_FlightDelays *FlightDelaysCaller) Collateral(opts *bind.CallOpts) (common.Address, error) ⋮---- // DelayWindow is a free data retrieval call binding the contract method 0x9e4f4b76. ⋮---- // Solidity: function delayWindow() view returns(uint48) func (_FlightDelays *FlightDelaysCaller) DelayWindow(opts *bind.CallOpts) (*big.Int, error) ⋮---- // Flights is a free data retrieval call binding the contract method 0x45e8026d. ⋮---- // Solidity: function flights(bytes32 airlineId, bytes32 flightId) view returns(uint48 timestamp, uint8 status, uint128 policiesSold, bytes32 previousFlightId) func (_FlightDelays *FlightDelaysCaller) Flights(opts *bind.CallOpts, airlineId [32]byte, flightId [32]byte) (struct ⋮---- // MessageExpiry is a free data retrieval call binding the contract method 0x5c96f9b5. ⋮---- // Solidity: function messageExpiry() view returns(uint32) func (_FlightDelays *FlightDelaysCaller) MessageExpiry(opts *bind.CallOpts) (uint32, error) ⋮---- // Policies is a free data retrieval call binding the contract method 0x73714bcd. ⋮---- // Solidity: function policies(bytes32 airlineId, bytes32 flightId, address buyer) view returns(uint8 policyStatus) func (_FlightDelays *FlightDelaysCaller) Policies(opts *bind.CallOpts, airlineId [32]byte, flightId [32]byte, buyer common.Address) (uint8, error) ⋮---- // PolicyPayout is a free data retrieval call binding the contract method 0x365ca41e. ⋮---- // Solidity: function policyPayout() view returns(uint256) func (_FlightDelays *FlightDelaysCaller) PolicyPayout(opts *bind.CallOpts) (*big.Int, error) ⋮---- // PolicyPremium is a free data retrieval call binding the contract method 0x22b6fefe. ⋮---- // Solidity: function policyPremium() view returns(uint256) func (_FlightDelays *FlightDelaysCaller) PolicyPremium(opts *bind.CallOpts) (*big.Int, error) ⋮---- // PolicyWindow is a free data retrieval call binding the contract method 0x0da1f7ca. ⋮---- // Solidity: function policyWindow() view returns(uint48) func (_FlightDelays *FlightDelaysCaller) PolicyWindow(opts *bind.CallOpts) (*big.Int, error) ⋮---- // Settlement is a free data retrieval call binding the contract method 0x51160630. ⋮---- // Solidity: function settlement() view returns(address) func (_FlightDelays *FlightDelaysCaller) Settlement(opts *bind.CallOpts) (common.Address, error) ⋮---- // VaultEpochDuration is a free data retrieval call binding the contract method 0xee1b2207. ⋮---- // Solidity: function vaultEpochDuration() view returns(uint48) func (_FlightDelays *FlightDelaysCaller) VaultEpochDuration(opts *bind.CallOpts) (*big.Int, error) ⋮---- // VotingPowers is a free data retrieval call binding the contract method 0xc00f50eb. ⋮---- // Solidity: function votingPowers() view returns(address) func (_FlightDelays *FlightDelaysCaller) VotingPowers(opts *bind.CallOpts) (common.Address, error) ⋮---- // BuyInsurance is a paid mutator transaction binding the contract method 0xb8f37ab2. ⋮---- // Solidity: function buyInsurance(bytes32 airlineId, bytes32 flightId) returns() func (_FlightDelays *FlightDelaysTransactor) BuyInsurance(opts *bind.TransactOpts, airlineId [32]byte, flightId [32]byte) (*types.Transaction, error) ⋮---- // ClaimInsurance is a paid mutator transaction binding the contract method 0x147dbcf1. ⋮---- // Solidity: function claimInsurance(bytes32 airlineId, bytes32 flightId) returns() func (_FlightDelays *FlightDelaysTransactor) ClaimInsurance(opts *bind.TransactOpts, airlineId [32]byte, flightId [32]byte) (*types.Transaction, error) ⋮---- // CreateFlight is a paid mutator transaction binding the contract method 0xd97650b0. ⋮---- // Solidity: function createFlight(bytes32 airlineId, bytes32 flightId, uint48 scheduledTimestamp, bytes32 previousFlightId, uint48 epoch, bytes proof) returns() func (_FlightDelays *FlightDelaysTransactor) CreateFlight(opts *bind.TransactOpts, airlineId [32]byte, flightId [32]byte, scheduledTimestamp *big.Int, previousFlightId [32]byte, epoch *big.Int, proof []byte) (*types.Transaction, error) ⋮---- // DelayFlight is a paid mutator transaction binding the contract method 0x43bfd533. ⋮---- // Solidity: function delayFlight(bytes32 airlineId, bytes32 flightId, uint48 epoch, bytes proof) returns() func (_FlightDelays *FlightDelaysTransactor) DelayFlight(opts *bind.TransactOpts, airlineId [32]byte, flightId [32]byte, epoch *big.Int, proof []byte) (*types.Transaction, error) ⋮---- // DepartFlight is a paid mutator transaction binding the contract method 0x13f8a494. ⋮---- // Solidity: function departFlight(bytes32 airlineId, bytes32 flightId, uint48 epoch, bytes proof) returns() func (_FlightDelays *FlightDelaysTransactor) DepartFlight(opts *bind.TransactOpts, airlineId [32]byte, flightId [32]byte, epoch *big.Int, proof []byte) (*types.Transaction, error) ⋮---- // Initialize is a paid mutator transaction binding the contract method 0x08251708. ⋮---- // Solidity: function initialize((address,address,address,uint48,uint32,uint48,uint48,uint256,uint256) initParams) returns() func (_FlightDelays *FlightDelaysTransactor) Initialize(opts *bind.TransactOpts, initParams FlightDelaysInitParams) (*types.Transaction, error) ⋮---- // StaticDelegateCall is a paid mutator transaction binding the contract method 0x9f86fd85. ⋮---- // Solidity: function staticDelegateCall(address target, bytes data) returns() func (_FlightDelays *FlightDelaysTransactor) StaticDelegateCall(opts *bind.TransactOpts, target common.Address, data []byte) (*types.Transaction, error) ⋮---- // FlightDelaysAirlineVaultDeployedIterator is returned from FilterAirlineVaultDeployed and is used to iterate over the raw logs and unpacked data for AirlineVaultDeployed events raised by the FlightDelays contract. type FlightDelaysAirlineVaultDeployedIterator struct { Event *FlightDelaysAirlineVaultDeployed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } ⋮---- Event *FlightDelaysAirlineVaultDeployed // Event containing the contract specifics and raw log ⋮---- contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data ⋮---- logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration ⋮---- // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. func (it *FlightDelaysAirlineVaultDeployedIterator) Next() bool ⋮---- // If the iterator failed, stop iterating ⋮---- // If the iterator completed, deliver directly whatever's available ⋮---- // Iterator still in progress, wait for either a data or an error event ⋮---- // Error returns any retrieval or parsing error occurred during filtering. func (it *FlightDelaysAirlineVaultDeployedIterator) Error() error ⋮---- // Close terminates the iteration process, releasing any pending underlying // resources. func (it *FlightDelaysAirlineVaultDeployedIterator) Close() error ⋮---- // FlightDelaysAirlineVaultDeployed represents a AirlineVaultDeployed event raised by the FlightDelays contract. type FlightDelaysAirlineVaultDeployed struct { AirlineId [32]byte Vault common.Address Rewards common.Address Raw types.Log // Blockchain specific contextual infos } ⋮---- Raw types.Log // Blockchain specific contextual infos ⋮---- // FilterAirlineVaultDeployed is a free log retrieval operation binding the contract event 0x6cb291016784959f890661d07225a645792785a83baeb2592251dcc9e4e7bf34. ⋮---- // Solidity: event AirlineVaultDeployed(bytes32 indexed airlineId, address vault, address rewards) func (_FlightDelays *FlightDelaysFilterer) FilterAirlineVaultDeployed(opts *bind.FilterOpts, airlineId [][32]byte) (*FlightDelaysAirlineVaultDeployedIterator, error) ⋮---- var airlineIdRule []interface{} ⋮---- // WatchAirlineVaultDeployed is a free log subscription operation binding the contract event 0x6cb291016784959f890661d07225a645792785a83baeb2592251dcc9e4e7bf34. ⋮---- func (_FlightDelays *FlightDelaysFilterer) WatchAirlineVaultDeployed(opts *bind.WatchOpts, sink chan<- *FlightDelaysAirlineVaultDeployed, airlineId [][32]byte) (event.Subscription, error) ⋮---- // New log arrived, parse the event and forward to the user ⋮---- // ParseAirlineVaultDeployed is a log parse operation binding the contract event 0x6cb291016784959f890661d07225a645792785a83baeb2592251dcc9e4e7bf34. ⋮---- func (_FlightDelays *FlightDelaysFilterer) ParseAirlineVaultDeployed(log types.Log) (*FlightDelaysAirlineVaultDeployed, error) ⋮---- // FlightDelaysFlightCreatedIterator is returned from FilterFlightCreated and is used to iterate over the raw logs and unpacked data for FlightCreated events raised by the FlightDelays contract. type FlightDelaysFlightCreatedIterator struct { Event *FlightDelaysFlightCreated // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } ⋮---- Event *FlightDelaysFlightCreated // Event containing the contract specifics and raw log ⋮---- // FlightDelaysFlightCreated represents a FlightCreated event raised by the FlightDelays contract. type FlightDelaysFlightCreated struct { AirlineId [32]byte FlightId [32]byte ScheduledTimestamp *big.Int Raw types.Log // Blockchain specific contextual infos } ⋮---- Raw types.Log // Blockchain specific contextual infos ⋮---- // FilterFlightCreated is a free log retrieval operation binding the contract event 0x1e735cf33b66ed3dc00862d938ae4f8f7dbbda9493652fc483c3607ce23c0070. ⋮---- // Solidity: event FlightCreated(bytes32 indexed airlineId, bytes32 indexed flightId, uint48 scheduledTimestamp) func (_FlightDelays *FlightDelaysFilterer) FilterFlightCreated(opts *bind.FilterOpts, airlineId [][32]byte, flightId [][32]byte) (*FlightDelaysFlightCreatedIterator, error) ⋮---- var flightIdRule []interface{} ⋮---- // WatchFlightCreated is a free log subscription operation binding the contract event 0x1e735cf33b66ed3dc00862d938ae4f8f7dbbda9493652fc483c3607ce23c0070. ⋮---- func (_FlightDelays *FlightDelaysFilterer) WatchFlightCreated(opts *bind.WatchOpts, sink chan<- *FlightDelaysFlightCreated, airlineId [][32]byte, flightId [][32]byte) (event.Subscription, error) ⋮---- // ParseFlightCreated is a log parse operation binding the contract event 0x1e735cf33b66ed3dc00862d938ae4f8f7dbbda9493652fc483c3607ce23c0070. ⋮---- func (_FlightDelays *FlightDelaysFilterer) ParseFlightCreated(log types.Log) (*FlightDelaysFlightCreated, error) ⋮---- // FlightDelaysFlightDelayedIterator is returned from FilterFlightDelayed and is used to iterate over the raw logs and unpacked data for FlightDelayed events raised by the FlightDelays contract. type FlightDelaysFlightDelayedIterator struct { Event *FlightDelaysFlightDelayed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } ⋮---- Event *FlightDelaysFlightDelayed // Event containing the contract specifics and raw log ⋮---- // FlightDelaysFlightDelayed represents a FlightDelayed event raised by the FlightDelays contract. type FlightDelaysFlightDelayed struct { AirlineId [32]byte FlightId [32]byte Raw types.Log // Blockchain specific contextual infos } ⋮---- // FilterFlightDelayed is a free log retrieval operation binding the contract event 0x8e8076a6235494b484b7cd7000b0bb95229118813ebf3437799a65912956d478. ⋮---- // Solidity: event FlightDelayed(bytes32 indexed airlineId, bytes32 indexed flightId) func (_FlightDelays *FlightDelaysFilterer) FilterFlightDelayed(opts *bind.FilterOpts, airlineId [][32]byte, flightId [][32]byte) (*FlightDelaysFlightDelayedIterator, error) ⋮---- // WatchFlightDelayed is a free log subscription operation binding the contract event 0x8e8076a6235494b484b7cd7000b0bb95229118813ebf3437799a65912956d478. ⋮---- func (_FlightDelays *FlightDelaysFilterer) WatchFlightDelayed(opts *bind.WatchOpts, sink chan<- *FlightDelaysFlightDelayed, airlineId [][32]byte, flightId [][32]byte) (event.Subscription, error) ⋮---- // ParseFlightDelayed is a log parse operation binding the contract event 0x8e8076a6235494b484b7cd7000b0bb95229118813ebf3437799a65912956d478. ⋮---- func (_FlightDelays *FlightDelaysFilterer) ParseFlightDelayed(log types.Log) (*FlightDelaysFlightDelayed, error) ⋮---- // FlightDelaysFlightDepartedIterator is returned from FilterFlightDeparted and is used to iterate over the raw logs and unpacked data for FlightDeparted events raised by the FlightDelays contract. type FlightDelaysFlightDepartedIterator struct { Event *FlightDelaysFlightDeparted // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } ⋮---- Event *FlightDelaysFlightDeparted // Event containing the contract specifics and raw log ⋮---- // FlightDelaysFlightDeparted represents a FlightDeparted event raised by the FlightDelays contract. type FlightDelaysFlightDeparted struct { AirlineId [32]byte FlightId [32]byte Raw types.Log // Blockchain specific contextual infos } ⋮---- // FilterFlightDeparted is a free log retrieval operation binding the contract event 0x2894e01f1028238685425dd73fa9ec9fea4ea16dfd68e0fc5ff8985cd6e1a183. ⋮---- // Solidity: event FlightDeparted(bytes32 indexed airlineId, bytes32 indexed flightId) func (_FlightDelays *FlightDelaysFilterer) FilterFlightDeparted(opts *bind.FilterOpts, airlineId [][32]byte, flightId [][32]byte) (*FlightDelaysFlightDepartedIterator, error) ⋮---- // WatchFlightDeparted is a free log subscription operation binding the contract event 0x2894e01f1028238685425dd73fa9ec9fea4ea16dfd68e0fc5ff8985cd6e1a183. ⋮---- func (_FlightDelays *FlightDelaysFilterer) WatchFlightDeparted(opts *bind.WatchOpts, sink chan<- *FlightDelaysFlightDeparted, airlineId [][32]byte, flightId [][32]byte) (event.Subscription, error) ⋮---- // ParseFlightDeparted is a log parse operation binding the contract event 0x2894e01f1028238685425dd73fa9ec9fea4ea16dfd68e0fc5ff8985cd6e1a183. ⋮---- func (_FlightDelays *FlightDelaysFilterer) ParseFlightDeparted(log types.Log) (*FlightDelaysFlightDeparted, error) ⋮---- // FlightDelaysInitSubnetworkIterator is returned from FilterInitSubnetwork and is used to iterate over the raw logs and unpacked data for InitSubnetwork events raised by the FlightDelays contract. type FlightDelaysInitSubnetworkIterator struct { Event *FlightDelaysInitSubnetwork // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } ⋮---- Event *FlightDelaysInitSubnetwork // Event containing the contract specifics and raw log ⋮---- // FlightDelaysInitSubnetwork represents a InitSubnetwork event raised by the FlightDelays contract. type FlightDelaysInitSubnetwork struct { Network common.Address SubnetworkId *big.Int Raw types.Log // Blockchain specific contextual infos } ⋮---- Raw types.Log // Blockchain specific contextual infos ⋮---- // FilterInitSubnetwork is a free log retrieval operation binding the contract event 0x469c2e982e7d76d34cf5d1e72abee29749bb9971942c180e9023cea09f5f8e83. ⋮---- // Solidity: event InitSubnetwork(address network, uint96 subnetworkId) func (_FlightDelays *FlightDelaysFilterer) FilterInitSubnetwork(opts *bind.FilterOpts) (*FlightDelaysInitSubnetworkIterator, error) ⋮---- // WatchInitSubnetwork is a free log subscription operation binding the contract event 0x469c2e982e7d76d34cf5d1e72abee29749bb9971942c180e9023cea09f5f8e83. ⋮---- func (_FlightDelays *FlightDelaysFilterer) WatchInitSubnetwork(opts *bind.WatchOpts, sink chan<- *FlightDelaysInitSubnetwork) (event.Subscription, error) ⋮---- // ParseInitSubnetwork is a log parse operation binding the contract event 0x469c2e982e7d76d34cf5d1e72abee29749bb9971942c180e9023cea09f5f8e83. ⋮---- func (_FlightDelays *FlightDelaysFilterer) ParseInitSubnetwork(log types.Log) (*FlightDelaysInitSubnetwork, error) ⋮---- // FlightDelaysInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the FlightDelays contract. type FlightDelaysInitializedIterator struct { Event *FlightDelaysInitialized // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } ⋮---- Event *FlightDelaysInitialized // Event containing the contract specifics and raw log ⋮---- // FlightDelaysInitialized represents a Initialized event raised by the FlightDelays contract. type FlightDelaysInitialized struct { Version uint64 Raw types.Log // Blockchain specific contextual infos } ⋮---- Raw types.Log // Blockchain specific contextual infos ⋮---- // FilterInitialized is a free log retrieval operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. ⋮---- // Solidity: event Initialized(uint64 version) func (_FlightDelays *FlightDelaysFilterer) FilterInitialized(opts *bind.FilterOpts) (*FlightDelaysInitializedIterator, error) ⋮---- // WatchInitialized is a free log subscription operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. ⋮---- func (_FlightDelays *FlightDelaysFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *FlightDelaysInitialized) (event.Subscription, error) ⋮---- // ParseInitialized is a log parse operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. ⋮---- func (_FlightDelays *FlightDelaysFilterer) ParseInitialized(log types.Log) (*FlightDelaysInitialized, error) ⋮---- // FlightDelaysInsuranceClaimedIterator is returned from FilterInsuranceClaimed and is used to iterate over the raw logs and unpacked data for InsuranceClaimed events raised by the FlightDelays contract. type FlightDelaysInsuranceClaimedIterator struct { Event *FlightDelaysInsuranceClaimed // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } ⋮---- Event *FlightDelaysInsuranceClaimed // Event containing the contract specifics and raw log ⋮---- // FlightDelaysInsuranceClaimed represents a InsuranceClaimed event raised by the FlightDelays contract. type FlightDelaysInsuranceClaimed struct { AirlineId [32]byte FlightId [32]byte Buyer common.Address Payout *big.Int Raw types.Log // Blockchain specific contextual infos } ⋮---- // FilterInsuranceClaimed is a free log retrieval operation binding the contract event 0x57e4f7b973a879494a4ada5b47e55405e342f437cf7280d04008aac8dde6a588. ⋮---- // Solidity: event InsuranceClaimed(bytes32 indexed airlineId, bytes32 indexed flightId, address indexed buyer, uint256 payout) func (_FlightDelays *FlightDelaysFilterer) FilterInsuranceClaimed(opts *bind.FilterOpts, airlineId [][32]byte, flightId [][32]byte, buyer []common.Address) (*FlightDelaysInsuranceClaimedIterator, error) ⋮---- var buyerRule []interface{} ⋮---- // WatchInsuranceClaimed is a free log subscription operation binding the contract event 0x57e4f7b973a879494a4ada5b47e55405e342f437cf7280d04008aac8dde6a588. ⋮---- func (_FlightDelays *FlightDelaysFilterer) WatchInsuranceClaimed(opts *bind.WatchOpts, sink chan<- *FlightDelaysInsuranceClaimed, airlineId [][32]byte, flightId [][32]byte, buyer []common.Address) (event.Subscription, error) ⋮---- // ParseInsuranceClaimed is a log parse operation binding the contract event 0x57e4f7b973a879494a4ada5b47e55405e342f437cf7280d04008aac8dde6a588. ⋮---- func (_FlightDelays *FlightDelaysFilterer) ParseInsuranceClaimed(log types.Log) (*FlightDelaysInsuranceClaimed, error) ⋮---- // FlightDelaysInsurancePurchasedIterator is returned from FilterInsurancePurchased and is used to iterate over the raw logs and unpacked data for InsurancePurchased events raised by the FlightDelays contract. type FlightDelaysInsurancePurchasedIterator struct { Event *FlightDelaysInsurancePurchased // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data logs chan types.Log // Log channel receiving the found contract events sub ethereum.Subscription // Subscription for errors, completion and termination done bool // Whether the subscription completed delivering logs fail error // Occurred error to stop iteration } ⋮---- Event *FlightDelaysInsurancePurchased // Event containing the contract specifics and raw log ⋮---- // FlightDelaysInsurancePurchased represents a InsurancePurchased event raised by the FlightDelays contract. type FlightDelaysInsurancePurchased struct { AirlineId [32]byte FlightId [32]byte Buyer common.Address Premium *big.Int Raw types.Log // Blockchain specific contextual infos } ⋮---- // FilterInsurancePurchased is a free log retrieval operation binding the contract event 0xb5741046414a47afe0df7618cfbff25d005a117a6e9aa4dde31c6c8ffb6ab4d5. ⋮---- // Solidity: event InsurancePurchased(bytes32 indexed airlineId, bytes32 indexed flightId, address indexed buyer, uint256 premium) func (_FlightDelays *FlightDelaysFilterer) FilterInsurancePurchased(opts *bind.FilterOpts, airlineId [][32]byte, flightId [][32]byte, buyer []common.Address) (*FlightDelaysInsurancePurchasedIterator, error) ⋮---- // WatchInsurancePurchased is a free log subscription operation binding the contract event 0xb5741046414a47afe0df7618cfbff25d005a117a6e9aa4dde31c6c8ffb6ab4d5. ⋮---- func (_FlightDelays *FlightDelaysFilterer) WatchInsurancePurchased(opts *bind.WatchOpts, sink chan<- *FlightDelaysInsurancePurchased, airlineId [][32]byte, flightId [][32]byte, buyer []common.Address) (event.Subscription, error) ⋮---- // ParseInsurancePurchased is a log parse operation binding the contract event 0xb5741046414a47afe0df7618cfbff25d005a117a6e9aa4dde31c6c8ffb6ab4d5. ⋮---- func (_FlightDelays *FlightDelaysFilterer) ParseInsurancePurchased(log types.Log) (*FlightDelaysInsurancePurchased, error) ```` ## File: off-chain/internal/flights/store_test.go ````go package flights ⋮---- import ( "testing" "time" ) ⋮---- "testing" "time" ⋮---- func TestUpdateStatusAllowsDelayedToDeparted(t *testing.T) ⋮---- func TestUpdateStatusRejectsInvalidTransitions(t *testing.T) ```` ## File: off-chain/internal/flights/store.go ````go package flights ⋮---- import ( "sort" "strings" "sync" "time" ) ⋮---- "sort" "strings" "sync" "time" ⋮---- // Store keeps airlines and flights in memory for the mock API. type Store struct { mu sync.RWMutex airlines map[string]Airline flights map[string]map[string]*Flight // airlineID -> flightID -> Flight } ⋮---- flights map[string]map[string]*Flight // airlineID -> flightID -> Flight ⋮---- // NewStore creates an in-memory store seeded with the provided airlines and flights. func NewStore(initialAirlines []Airline, initialFlights []Flight) *Store ⋮---- // ListAirlines returns airlines sorted alphabetically by code then name. func (s *Store) ListAirlines() []Airline ⋮---- // AddAirline registers a new airline. func (s *Store) AddAirline(airline Airline) error ⋮---- // ListFlights returns flights for the given airline sorted by departure. func (s *Store) ListFlights(airlineID string) ([]Flight, error) ⋮---- // GetFlight returns a specific flight copy. func (s *Store) GetFlight(airlineID, flightID string) (Flight, error) ⋮---- // CreateFlight registers a new flight for an airline. func (s *Store) CreateFlight(airlineID string, flight Flight) (Flight, error) ⋮---- func (s *Store) createFlightLocked(airlineID string, flight Flight) error ⋮---- // UpdateStatus updates the status for a flight with basic validation. func (s *Store) UpdateStatus(airlineID, flightID string, status Status) (Flight, error) ⋮---- func isValidTransition(from, to Status) bool ```` ## File: off-chain/internal/flights/types.go ````go package flights ⋮---- import "errors" ⋮---- // Status describes the lifecycle state of a flight tracked by the mock API. type Status string ⋮---- const ( StatusScheduled Status = "SCHEDULED" StatusDelayed Status = "DELAYED" StatusDeparted Status = "DEPARTED" ) ⋮---- // Airline represents a carrier that can have flights scheduled on-chain. type Airline struct { AirlineID string `json:"airlineId"` Name string `json:"name"` Code string `json:"code"` } ⋮---- // Flight is a single tracked flight instance owned by an airline. type Flight struct { AirlineID string `json:"airlineId"` FlightID string `json:"flightId"` DepartureTimestamp int64 `json:"departureTimestamp"` Status Status `json:"status"` UpdatedAt int64 `json:"updatedAt"` } ⋮---- var ( ErrAirlineExists = errors.New("airline already exists") ⋮---- // validStatus reports whether the provided status is recognised by the API. func validStatus(status Status) bool ```` ## File: off-chain/internal/utils/util.go ````go package utils ⋮---- import ( "time" grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/grpc-ecosystem/go-grpc-middleware/retry" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ) ⋮---- "time" ⋮---- grpcmiddleware "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/grpc-ecosystem/go-grpc-middleware/retry" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ⋮---- func GetGRPCConnection(address string) (*grpc.ClientConn, error) ```` ## File: off-chain/.dockerignore ```` # Git files .git .gitignore # Docker files Dockerfile .dockerignore # Documentation README.md *.md # IDE files .vscode/ .idea/ *.swp *.swo # OS files .DS_Store Thumbs.db # Logs *.log # Temporary files *.tmp *.temp # Test files *_test.go test/ # Build artifacts bin/ dist/ # Coverage files *.out coverage.txt # Go specific vendor/ ```` ## File: off-chain/Dockerfile ```` # Multi-stage build for the off-chain Go application # Build stage FROM golang:1.24.5-alpine AS builder # Install build dependencies RUN apk add --no-cache git ca-certificates tzdata # Set working directory WORKDIR /app # Copy go mod files COPY go.mod go.sum ./ # Download dependencies RUN go mod download # Copy source code COPY . . # Build the binaries with optimizations for production RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ -ldflags="-w -s" \ -o /app/flight-node \ ./cmd/node RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ -ldflags="-w -s" \ -o /app/flights-api \ ./cmd/flights-api # Runtime stage FROM alpine:3.19 # Install runtime dependencies RUN apk add --no-cache ca-certificates tzdata # Set working directory WORKDIR /app # Copy binaries from builder stage COPY --from=builder /app/flight-node . COPY --from=builder /app/flights-api . # Expose port if needed (adjust based on your application) # EXPOSE 8080 # Set the entrypoint ENTRYPOINT ["/app/flight-node"] # Default command (can be overridden) CMD ["--help"] ```` ## File: off-chain/go.mod ```` module sum go 1.24.5 require ( github.com/ethereum/go-ethereum v1.16.3 github.com/go-chi/chi/v5 v5.2.3 github.com/go-errors/errors v1.5.1 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/samber/lo v1.51.0 github.com/spf13/cobra v1.10.1 github.com/symbioticfi/relay v0.2.1-0.20250929084906-8a36673e5ad5 golang.org/x/sync v0.17.0 google.golang.org/grpc v1.75.1 ) require ( github.com/Microsoft/go-winio v0.6.2 // indirect github.com/bits-and-blooms/bitset v1.24.0 // indirect github.com/consensys/gnark-crypto v0.19.0 // indirect github.com/crate-crypto/go-eth-kzg v1.4.0 // indirect github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect github.com/deckarep/golang-set/v2 v2.8.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect github.com/ethereum/c-kzg-4844/v2 v2.1.1 // indirect github.com/ethereum/go-verkle v0.2.2 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/holiman/uint256 v1.3.2 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/rogpeppe/go-internal v1.13.1 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/supranational/blst v0.3.15 // indirect github.com/tklauser/go-sysconf v0.3.15 // indirect github.com/tklauser/numcpus v0.10.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect golang.org/x/crypto v0.42.0 // indirect golang.org/x/net v0.44.0 // indirect golang.org/x/sys v0.36.0 // indirect golang.org/x/text v0.29.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 // indirect google.golang.org/protobuf v1.36.9 // indirect ) ```` ## File: script/mocks/MockERC20.sol ```` // SPDX-License-Identifier: MIT ⋮---- import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; ⋮---- contract MockERC20 is ERC20 { ⋮---- function mint(address to, uint256 amount) public { ```` ## File: script/mocks/SymbioticRewardsConstantsHelper.sol ```` // SPDX-License-Identifier: MIT ⋮---- import {SymbioticRewardsConstants} from "@symbioticfi/rewards/test/integration/SymbioticRewardsConstants.sol"; ⋮---- contract SymbioticRewardsConstantsHelper { function defaultStakerRewardsFactory() public returns (address) { ```` ## File: script/utils/BN254G2.sol ```` /** * @title Elliptic curve operations on twist points for alt_bn128 * @author Mustafa Al-Bassam (mus@musalbas.com) * @dev Homepage: https://github.com/musalbas/solidity-BN256G2 */ ⋮---- // WARNING: this code is used ONLY for testing purposes, DO NOT USE IN PRODUCTION ⋮---- /** * @notice Add two twist points * @param pt1xx Coefficient 1 of x on point 1 * @param pt1xy Coefficient 2 of x on point 1 * @param pt1yx Coefficient 1 of y on point 1 * @param pt1yy Coefficient 2 of y on point 1 * @param pt2xx Coefficient 1 of x on point 2 * @param pt2xy Coefficient 2 of x on point 2 * @param pt2yx Coefficient 1 of y on point 2 * @param pt2yy Coefficient 2 of y on point 2 * @return (pt3xx, pt3xy, pt3yx, pt3yy) */ function ECTwistAdd( ⋮---- /** * @notice Multiply a twist point by a scalar * @param s Scalar to multiply by * @param pt1xx Coefficient 1 of x * @param pt1xy Coefficient 2 of x * @param pt1yx Coefficient 1 of y * @param pt1yy Coefficient 2 of y * @return (pt2xx, pt2xy, pt2yx, pt2yy) */ function ECTwistMul(uint256 s, uint256 pt1xx, uint256 pt1xy, uint256 pt1yx, uint256 pt1yy) ⋮---- /** * @notice Get the field modulus * @return The field modulus */ function GetFieldModulus() internal pure returns (uint256) { ⋮---- function submod(uint256 a, uint256 b, uint256 n) internal pure returns (uint256) { ⋮---- function _FQ2Mul(uint256 xx, uint256 xy, uint256 yx, uint256 yy) internal pure returns (uint256, uint256) { ⋮---- function _FQ2Muc(uint256 xx, uint256 xy, uint256 c) internal pure returns (uint256, uint256) { ⋮---- function _FQ2Add(uint256 xx, uint256 xy, uint256 yx, uint256 yy) internal pure returns (uint256, uint256) { ⋮---- function _FQ2Sub(uint256 xx, uint256 xy, uint256 yx, uint256 yy) internal pure returns (uint256 rx, uint256 ry) { ⋮---- function _FQ2Div(uint256 xx, uint256 xy, uint256 yx, uint256 yy) internal view returns (uint256, uint256) { ⋮---- function _FQ2Inv(uint256 x, uint256 y) internal view returns (uint256, uint256) { ⋮---- function _isOnCurve(uint256 xx, uint256 xy, uint256 yx, uint256 yy) internal pure returns (bool) { ⋮---- function _modInv(uint256 a, uint256 n) internal view returns (uint256 result) { ⋮---- function _fromJacobian(uint256 pt1xx, uint256 pt1xy, uint256 pt1yx, uint256 pt1yy, uint256 pt1zx, uint256 pt1zy) ⋮---- function _ECTwistAddJacobian(_ECTwistAddJacobianArgs memory $) internal pure returns (uint256[6] memory pt3) { ⋮---- ($.pt2yx, $.pt2yy) = _FQ2Mul($.pt2yx, $.pt2yy, $.pt1zx, $.pt1zy); // U1 = y2 * z1 (pt3[PTYX], pt3[PTYY]) = _FQ2Mul($.pt1yx, $.pt1yy, $.pt2zx, $.pt2zy); // U2 = y1 * z2 ($.pt2xx, $.pt2xy) = _FQ2Mul($.pt2xx, $.pt2xy, $.pt1zx, $.pt1zy); // V1 = x2 * z1 (pt3[PTZX], pt3[PTZY]) = _FQ2Mul($.pt1xx, $.pt1xy, $.pt2zx, $.pt2zy); // V2 = x1 * z2 ⋮---- ($.pt2zx, $.pt2zy) = _FQ2Mul($.pt1zx, $.pt1zy, $.pt2zx, $.pt2zy); // W = z1 * z2 ($.pt1xx, $.pt1xy) = _FQ2Sub($.pt2yx, $.pt2yy, pt3[PTYX], pt3[PTYY]); // U = U1 - U2 ($.pt1yx, $.pt1yy) = _FQ2Sub($.pt2xx, $.pt2xy, pt3[PTZX], pt3[PTZY]); // V = V1 - V2 ($.pt1zx, $.pt1zy) = _FQ2Mul($.pt1yx, $.pt1yy, $.pt1yx, $.pt1yy); // V_squared = V * V ($.pt2yx, $.pt2yy) = _FQ2Mul($.pt1zx, $.pt1zy, pt3[PTZX], pt3[PTZY]); // V_squared_times_V2 = V_squared * V2 ($.pt1zx, $.pt1zy) = _FQ2Mul($.pt1zx, $.pt1zy, $.pt1yx, $.pt1yy); // V_cubed = V * V_squared (pt3[PTZX], pt3[PTZY]) = _FQ2Mul($.pt1zx, $.pt1zy, $.pt2zx, $.pt2zy); // newz = V_cubed * W ($.pt2xx, $.pt2xy) = _FQ2Mul($.pt1xx, $.pt1xy, $.pt1xx, $.pt1xy); // U * U ($.pt2xx, $.pt2xy) = _FQ2Mul($.pt2xx, $.pt2xy, $.pt2zx, $.pt2zy); // U * U * W ($.pt2xx, $.pt2xy) = _FQ2Sub($.pt2xx, $.pt2xy, $.pt1zx, $.pt1zy); // U * U * W - V_cubed ($.pt2zx, $.pt2zy) = _FQ2Muc($.pt2yx, $.pt2yy, 2); // 2 * V_squared_times_V2 ($.pt2xx, $.pt2xy) = _FQ2Sub($.pt2xx, $.pt2xy, $.pt2zx, $.pt2zy); // A = U * U * W - V_cubed - 2 * V_squared_times_V2 (pt3[PTXX], pt3[PTXY]) = _FQ2Mul($.pt1yx, $.pt1yy, $.pt2xx, $.pt2xy); // newx = V * A ($.pt1yx, $.pt1yy) = _FQ2Sub($.pt2yx, $.pt2yy, $.pt2xx, $.pt2xy); // V_squared_times_V2 - A ($.pt1yx, $.pt1yy) = _FQ2Mul($.pt1xx, $.pt1xy, $.pt1yx, $.pt1yy); // U * (V_squared_times_V2 - A) ($.pt1xx, $.pt1xy) = _FQ2Mul($.pt1zx, $.pt1zy, pt3[PTYX], pt3[PTYY]); // V_cubed * U2 (pt3[PTYX], pt3[PTYY]) = _FQ2Sub($.pt1yx, $.pt1yy, $.pt1xx, $.pt1xy); // newy = U * (V_squared_times_V2 - A) - V_cubed * U2 ⋮---- function _ECTwistDoubleJacobian( ⋮---- (pt2xx, pt2xy) = _FQ2Muc(pt1xx, pt1xy, 3); // 3 * x (pt2xx, pt2xy) = _FQ2Mul(pt2xx, pt2xy, pt1xx, pt1xy); // W = 3 * x * x (pt1zx, pt1zy) = _FQ2Mul(pt1yx, pt1yy, pt1zx, pt1zy); // S = y * z (pt2yx, pt2yy) = _FQ2Mul(pt1xx, pt1xy, pt1yx, pt1yy); // x * y (pt2yx, pt2yy) = _FQ2Mul(pt2yx, pt2yy, pt1zx, pt1zy); // B = x * y * S (pt1xx, pt1xy) = _FQ2Mul(pt2xx, pt2xy, pt2xx, pt2xy); // W * W (pt2zx, pt2zy) = _FQ2Muc(pt2yx, pt2yy, 8); // 8 * B (pt1xx, pt1xy) = _FQ2Sub(pt1xx, pt1xy, pt2zx, pt2zy); // H = W * W - 8 * B (pt2zx, pt2zy) = _FQ2Mul(pt1zx, pt1zy, pt1zx, pt1zy); // S_squared = S * S (pt2yx, pt2yy) = _FQ2Muc(pt2yx, pt2yy, 4); // 4 * B (pt2yx, pt2yy) = _FQ2Sub(pt2yx, pt2yy, pt1xx, pt1xy); // 4 * B - H (pt2yx, pt2yy) = _FQ2Mul(pt2yx, pt2yy, pt2xx, pt2xy); // W * (4 * B - H) (pt2xx, pt2xy) = _FQ2Muc(pt1yx, pt1yy, 8); // 8 * y (pt2xx, pt2xy) = _FQ2Mul(pt2xx, pt2xy, pt1yx, pt1yy); // 8 * y * y (pt2xx, pt2xy) = _FQ2Mul(pt2xx, pt2xy, pt2zx, pt2zy); // 8 * y * y * S_squared (pt2yx, pt2yy) = _FQ2Sub(pt2yx, pt2yy, pt2xx, pt2xy); // newy = W * (4 * B - H) - 8 * y * y * S_squared (pt2xx, pt2xy) = _FQ2Muc(pt1xx, pt1xy, 2); // 2 * H (pt2xx, pt2xy) = _FQ2Mul(pt2xx, pt2xy, pt1zx, pt1zy); // newx = 2 * H * S (pt2zx, pt2zy) = _FQ2Mul(pt1zx, pt1zy, pt2zx, pt2zy); // S * S_squared (pt2zx, pt2zy) = _FQ2Muc(pt2zx, pt2zy, 8); // newz = 8 * S * S_squared ⋮---- function _ECTwistMulJacobian( ```` ## File: script/utils/sort_errors.py ````python #!/usr/bin/env python3 ⋮---- def _error_sort_key(error_line: str) -> str ⋮---- signature = error_line.strip()[len("error ") :] name = signature.split("(", 1)[0].strip() ⋮---- def _extract_entries(block_text: str) -> List[Tuple[int, int, str, int]] ⋮---- entries: List[Tuple[int, int, str, int]] = [] offset = 0 entry_start: Optional[int] = None last_content_end: Optional[int] = None current_error: Optional[str] = None ⋮---- def finalize() -> None ⋮---- entry_start = None last_content_end = None current_error = None ⋮---- newline_idx = block_text.find("\n", offset) ⋮---- line_end = len(block_text) ⋮---- line_end = newline_idx + 1 line = block_text[offset:line_end] stripped = line.strip() ⋮---- last_content_end = line_end offset = line_end ⋮---- entry_start = offset ⋮---- current_error = line.strip() ⋮---- def _sort_error_block(text: str) -> Tuple[str, bool] ⋮---- marker = "/* ERRORS */" search_pos = 0 changed = False ⋮---- marker_idx = text.find(marker, search_pos) ⋮---- block_start = text.find("\n", marker_idx) ⋮---- cursor = block_start first_block_idx: Optional[int] = None last_block_idx = block_start ⋮---- newline_idx = text.find("\n", cursor) ⋮---- line_end = len(text) ⋮---- line = text[cursor:line_end] ⋮---- cursor = line_end ⋮---- first_block_idx = cursor last_block_idx = line_end ⋮---- search_pos = cursor ⋮---- block_text = text[first_block_idx:last_block_idx] entries = _extract_entries(block_text) ⋮---- search_pos = last_block_idx ⋮---- prefix = block_text[:entries[0][0]] suffix = block_text[entries[-1][1]:] sorted_entries = sorted(entries, key=lambda item: (item[2], item[3])) sorted_chunks = [block_text[start:end].rstrip("\n") for start, end, _, _ in sorted_entries] ⋮---- new_block = prefix + "\n\n".join(sorted_chunks) ⋮---- stripped_suffix = suffix.lstrip("\n") ⋮---- text = text[:first_block_idx] + new_block + text[last_block_idx:] changed = True search_pos = first_block_idx + len(new_block) ⋮---- def sort_errors_in_file(path: Path) ⋮---- original = path.read_text(encoding="utf-8") ⋮---- def iter_solidity_files(targets: Iterable[Path]) -> Iterable[Path] ⋮---- def resolve_targets(path_args: Iterable[str]) -> List[Path] ⋮---- defaults = [Path(name) for name in ("src", "examples") if Path(name).exists()] ⋮---- def sort_from_stdin() -> None ⋮---- errors = sys.stdin.read() sorted_errors = sorted(x.strip() for x in errors.splitlines()) ⋮---- def main() -> int ⋮---- parser = argparse.ArgumentParser( ⋮---- args = parser.parse_args() ⋮---- targets = resolve_targets(args.paths) ```` ## File: script/utils/sort_imports.py ````python #!/usr/bin/env python3 ⋮---- FROM_IMPORT_RE = re.compile(r'from\s+["\']([^"\']+)["\']', re.IGNORECASE | re.MULTILINE) DIRECT_IMPORT_RE = re.compile(r'import\s+["\']([^"\']+)["\']', re.IGNORECASE | re.MULTILINE) WHITESPACE_RE = re.compile(r"\s+") ⋮---- @dataclass class ImportEntry ⋮---- start: int end: int text: str path: str order: int ⋮---- def extract_path(import_text: str) -> str ⋮---- match = FROM_IMPORT_RE.search(import_text) ⋮---- match = DIRECT_IMPORT_RE.search(import_text) ⋮---- def collect_import_entries(lines: Sequence[str]) -> List[ImportEntry] ⋮---- entries: List[ImportEntry] = [] index = 0 ⋮---- stripped = lines[index].lstrip() ⋮---- start = index statement_lines = [lines[index].rstrip()] ⋮---- end = index text = "\n".join(statement_lines) path = extract_path(text) ⋮---- def normalize_import_text(import_text: str) -> str ⋮---- """Flatten whitespace so multi-line imports sort identically to single-line ones.""" compact = WHITESPACE_RE.sub(" ", import_text.strip()) compact = compact.replace("{ ", "{").replace(" }", "}") compact = compact.replace("( ", "(").replace(" )", ")") ⋮---- def classify_import(path: str) -> str ⋮---- normalized = path.lstrip("./") lower = normalized.lower() ⋮---- library = normalized.split("/", 1)[0] ⋮---- def build_sorted_block(entries: Sequence[ImportEntry]) -> List[str] ⋮---- grouped: Dict[str, List[ImportEntry]] = defaultdict(list) ⋮---- ordered_groups: List[List[ImportEntry]] = [] ⋮---- external_groups = sorted( ⋮---- block_text = "\n\n".join("\n".join(entry.text for entry in group) for group in ordered_groups) ⋮---- def sort_imports_in_file(path: Path) -> None ⋮---- original_text = path.read_text(encoding="utf-8") has_trailing_newline = original_text.endswith("\n") lines = original_text.splitlines() ⋮---- entries = collect_import_entries(lines) ⋮---- block_start = entries[0].start block_end = entries[-1].end covered_indexes = set() ⋮---- new_block_lines = build_sorted_block(entries) new_lines = lines[:block_start] + new_block_lines + lines[block_end + 1 :] new_text = "\n".join(new_lines) ⋮---- def iter_solidity_files(targets: Iterable[Path]) -> Iterable[Path] ⋮---- def resolve_targets(path_args: Iterable[str]) -> List[Path] ⋮---- defaults = [Path(name) for name in ("src", "examples") if Path(name).exists()] ⋮---- def main() -> int ⋮---- parser = argparse.ArgumentParser( ⋮---- args = parser.parse_args() ⋮---- targets = resolve_targets(args.paths) ```` ## File: script/my-relay-deploy.toml ````toml [31337] endpoint_url = "http://anvil:8545" [1234567890] endpoint_url = "" keyRegistry = 31337 votingPowerProvider = [31337] settlement = [31337] valSetDriver = 31337 ```` ## File: script/MyRelayDeploy.sol ```` // SPDX-License-Identifier: MIT ⋮---- import {Vm, VmSafe} from "forge-std/Vm.sol"; ⋮---- import {VotingPowers} from "../src/symbiotic/VotingPowers.sol"; import {FlightDelays} from "../src/FlightDelays.sol"; import {KeyRegistry} from "../src/symbiotic/KeyRegistry.sol"; import {Driver} from "../src/symbiotic/Driver.sol"; import {Settlement} from "../src/symbiotic/Settlement.sol"; import {MockERC20} from "./mocks/MockERC20.sol"; import {BN254G2} from "./utils/BN254G2.sol"; import {SymbioticRewardsConstantsHelper} from "./mocks/SymbioticRewardsConstantsHelper.sol"; ⋮---- import {RelayDeploy} from "@symbioticfi/relay-contracts/script/RelayDeploy.sol"; ⋮---- import {BN254} from "@symbioticfi/relay-contracts/src/libraries/utils/BN254.sol"; import {KeyTags} from "@symbioticfi/relay-contracts/src/libraries/utils/KeyTags.sol"; import {KeyEcdsaSecp256k1} from "@symbioticfi/relay-contracts/src/libraries/keys/KeyEcdsaSecp256k1.sol"; import {KeyBlsBn254} from "@symbioticfi/relay-contracts/src/libraries/keys/KeyBlsBn254.sol"; import { SigVerifierBlsBn254Simple } from "@symbioticfi/relay-contracts/src/modules/settlement/sig-verifiers/SigVerifierBlsBn254Simple.sol"; import { SigVerifierBlsBn254ZK } from "@symbioticfi/relay-contracts/src/modules/settlement/sig-verifiers/SigVerifierBlsBn254ZK.sol"; import { IVotingPowerProvider } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/IVotingPowerProvider.sol"; import { IOpNetVaultAutoDeploy } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IOpNetVaultAutoDeploy.sol"; import {INetworkManager} from "@symbioticfi/relay-contracts/src/interfaces/modules/base/INetworkManager.sol"; import {IOzEIP712} from "@symbioticfi/relay-contracts/src/interfaces/modules/base/IOzEIP712.sol"; import {IOzOwnable} from "@symbioticfi/relay-contracts/src/interfaces/modules/common/permissions/IOzOwnable.sol"; import { IKeyRegistry, KEY_TYPE_BLS_BN254, KEY_TYPE_ECDSA_SECP256K1 } from "@symbioticfi/relay-contracts/src/interfaces/modules/key-registry/IKeyRegistry.sol"; import { IBaseSlashing } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IBaseSlashing.sol"; import { IBaseRewards } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IBaseRewards.sol"; import {IValSetDriver} from "@symbioticfi/relay-contracts/src/interfaces/modules/valset-driver/IValSetDriver.sol"; import {IEpochManager} from "@symbioticfi/relay-contracts/src/interfaces/modules/valset-driver/IEpochManager.sol"; import {ISettlement} from "@symbioticfi/relay-contracts/src/interfaces/modules/settlement/ISettlement.sol"; ⋮---- import {Network, INetwork} from "@symbioticfi/network/src/Network.sol"; ⋮---- import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IVault} from "@symbioticfi/core/src/interfaces/vault/IVault.sol"; import {INetworkMiddlewareService} from "@symbioticfi/core/src/interfaces/service/INetworkMiddlewareService.sol"; import {Logs} from "@symbioticfi/core/script/utils/Logs.sol"; import {SymbioticCoreConstants} from "@symbioticfi/core/test/integration/SymbioticCoreConstants.sol"; ⋮---- contract MyRelayDeploy is RelayDeploy { ⋮---- // Configurable constants ⋮---- uint48 internal constant SLASHING_WINDOW = 1 days; // 1 day uint208 internal constant MAX_VALIDATORS_COUNT = 1000; // 1000 validators uint256 internal constant MAX_VOTING_POWER = 2 ** 247; // no max limit uint256 internal constant MIN_INCLUSION_VOTING_POWER = 0; // include anyone uint248 internal constant QUORUM_THRESHOLD = (uint248(1e18) * 2) / 3 + 1; // 2/3 + 1 uint8 internal constant REQUIRED_KEY_TAG = 15; // 15 is the default key tag (BLS-BN254/15) ⋮---- uint8 internal constant REQUIRED_KEY_TAG_ECDSA = 16; // 16 is the default key tag for ecdsa keys (ECDSA-SECP256K1/0) ⋮---- // CREATE3 salts ⋮---- function getDeployerAddress() internal returns (address deployer) { ⋮---- function getStakingToken() internal withoutBroadcast returns (address) { ⋮---- function getInsuranceToken() internal withoutBroadcast returns (address) { ⋮---- function getDefaultStakerRewardsFactory() internal withoutBroadcast returns (address) { ⋮---- function getNetwork() internal withoutBroadcast returns (address) { ⋮---- function _keyRegistryParams() internal override returns (address implementation, bytes memory initData) { ⋮---- function _votingPowerProviderParams() internal override returns (address implementation, bytes memory initData) { ⋮---- function _settlementParams() internal override returns (address implementation, bytes memory initData) { ⋮---- function _valSetDriverParams() internal override returns (address implementation, bytes memory initData) { ⋮---- function runDeployKeyRegistry() public override { ⋮---- function runDeployVotingPowerProvider() public override { ⋮---- function runDeploySettlement() public override { ⋮---- function runDeployValSetDriver() public override { ⋮---- function configureOperatorKeys(uint256 index) public { ⋮---- // Register BLS-BN254 key with tag 11, not related to header key tag ⋮---- // Register ECDSA key ⋮---- function registerOperator(uint256 index, uint256 stakeAmount) public { ⋮---- function fundOperators() public { ⋮---- function getOperator(uint256 index) public returns (VmSafe.Wallet memory operator) { // deterministic operator private key ⋮---- function getBLSKeys(uint256 privateKey) public returns (BN254.G1Point memory, BN254.G2Point memory) { ⋮---- function printOperatorsInfo() public { ```` ## File: snapshots/gas.txt ```` No files changed, compilation skipped Ran 10 tests for test/FlightDelays.t.sol:FlightDelaysTest [PASS] testBuyInsuranceAndRecordPolicy() (gas: 1193983) [PASS] testCannotBuyAfterWindowCloses() (gas: 1069590) [PASS] testCannotBuyBeforePolicyWindowOpens() (gas: 1069193) [PASS] testCannotBuyInsuranceWithoutFlight() (gas: 32987) [PASS] testCannotBuyOnceFlightDelayed() (gas: 1111461) [PASS] testCompleteFlightDistributesRewards() (gas: 1507642) [PASS] testCreateFlightRequiresSequentialOrdering() (gas: 944838) [PASS] testDelayFlightAndClaim() (gas: 1436930) [PASS] testDelayRequiresEarlierFlightsProcessed() (gas: 1276496) [PASS] testFlightsMustBeCreatedWithNonDecreasingTimestamp() (gas: 1042914) Suite result: ok. 10 passed; 0 failed; 0 skipped; finished in 4.51ms (9.57ms CPU time) ╭-----------------------------------------------+-----------------+-------+--------+-------+---------╮ | script/mocks/MockERC20.sol:MockERC20 Contract | | | | | | +====================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-----------------------------------------------+-----------------+-------+--------+-------+---------| | 557307 | 3103 | | | | | |-----------------------------------------------+-----------------+-------+--------+-------+---------| | | | | | | | |-----------------------------------------------+-----------------+-------+--------+-------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-----------------------------------------------+-----------------+-------+--------+-------+---------| | approve | 46678 | 46678 | 46678 | 46678 | 10 | |-----------------------------------------------+-----------------+-------+--------+-------+---------| | balanceOf | 2559 | 2559 | 2559 | 2559 | 2 | |-----------------------------------------------+-----------------+-------+--------+-------+---------| | mint | 34227 | 34227 | 34227 | 34227 | 7 | |-----------------------------------------------+-----------------+-------+--------+-------+---------| | transfer | 51625 | 51625 | 51625 | 51625 | 7 | ╰-----------------------------------------------+-----------------+-------+--------+-------+---------╯ ╭--------------------------------------------+-----------------+--------+--------+--------+---------╮ | src/FlightDelays.sol:FlightDelays Contract | | | | | | +===================================================================================================+ | Deployment Cost | Deployment Size | | | | | |--------------------------------------------+-----------------+--------+--------+--------+---------| | 0 | 11085 | | | | | |--------------------------------------------+-----------------+--------+--------+--------+---------| | | | | | | | |--------------------------------------------+-----------------+--------+--------+--------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |--------------------------------------------+-----------------+--------+--------+--------+---------| | airlines | 8959 | 8959 | 8959 | 8959 | 1 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | buyInsurance | 24759 | 72448 | 27489 | 134327 | 7 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | claimInsurance | 52798 | 52798 | 52798 | 52798 | 1 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | createFlight | 40183 | 596529 | 893204 | 893204 | 14 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | delayFlight | 42441 | 73528 | 50150 | 151373 | 4 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | delayWindow | 2407 | 2407 | 2407 | 2407 | 1 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | departFlight | 51356 | 202741 | 202741 | 354126 | 2 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | flights | 4959 | 4959 | 4959 | 4959 | 2 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | initialize | 238659 | 238659 | 238659 | 238659 | 10 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | policies | 2809 | 2809 | 2809 | 2809 | 2 | |--------------------------------------------+-----------------+--------+--------+--------+---------| | policyWindow | 2364 | 2364 | 2364 | 2364 | 1 | ╰--------------------------------------------+-----------------+--------+--------+--------+---------╯ ╭------------------------------------------------------+-----------------+------+--------+------+---------╮ | test/mock/FlightDelaysMocks.sol:MockRewards Contract | | | | | | +=========================================================================================================+ | Deployment Cost | Deployment Size | | | | | |------------------------------------------------------+-----------------+------+--------+------+---------| | 0 | 1188 | | | | | |------------------------------------------------------+-----------------+------+--------+------+---------| | | | | | | | |------------------------------------------------------+-----------------+------+--------+------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |------------------------------------------------------+-----------------+------+--------+------+---------| | lastAmount | 2316 | 2316 | 2316 | 2316 | 1 | |------------------------------------------------------+-----------------+------+--------+------+---------| | lastSnapshot | 2395 | 2395 | 2395 | 2395 | 1 | |------------------------------------------------------+-----------------+------+--------+------+---------| | lastToken | 2325 | 2325 | 2325 | 2325 | 1 | ╰------------------------------------------------------+-----------------+------+--------+------+---------╯ ╭-------------------------------------------------------------+-----------------+------+--------+------+---------╮ | test/mock/FlightDelaysMocks.sol:MockRewardsFactory Contract | | | | | | +================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-------------------------------------------------------------+-----------------+------+--------+------+---------| | 372083 | 1505 | | | | | |-------------------------------------------------------------+-----------------+------+--------+------+---------| | | | | | | | |-------------------------------------------------------------+-----------------+------+--------+------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-------------------------------------------------------------+-----------------+------+--------+------+---------| | lastRewards | 2323 | 2323 | 2323 | 2323 | 1 | ╰-------------------------------------------------------------+-----------------+------+--------+------+---------╯ ╭------------------------------------------------------+-----------------+------+--------+------+---------╮ | test/mock/FlightDelaysMocks.sol:MockSlasher Contract | | | | | | +=========================================================================================================+ | Deployment Cost | Deployment Size | | | | | |------------------------------------------------------+-----------------+------+--------+------+---------| | 0 | 1019 | | | | | |------------------------------------------------------+-----------------+------+--------+------+---------| | | | | | | | |------------------------------------------------------+-----------------+------+--------+------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |------------------------------------------------------+-----------------+------+--------+------+---------| | slashableStake | 3369 | 3369 | 3369 | 3369 | 3 | ╰------------------------------------------------------+-----------------+------+--------+------+---------╯ ╭----------------------------------------------------+-----------------+-------+--------+-------+---------╮ | test/mock/FlightDelaysMocks.sol:MockVault Contract | | | | | | +=========================================================================================================+ | Deployment Cost | Deployment Size | | | | | |----------------------------------------------------+-----------------+-------+--------+-------+---------| | 0 | 1005 | | | | | |----------------------------------------------------+-----------------+-------+--------+-------+---------| | | | | | | | |----------------------------------------------------+-----------------+-------+--------+-------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |----------------------------------------------------+-----------------+-------+--------+-------+---------| | activeStake | 2312 | 2312 | 2312 | 2312 | 3 | |----------------------------------------------------+-----------------+-------+--------+-------+---------| | setActiveStake | 26530 | 26530 | 26530 | 26530 | 7 | |----------------------------------------------------+-----------------+-------+--------+-------+---------| | slasher | 2325 | 2325 | 2325 | 2325 | 3 | ╰----------------------------------------------------+-----------------+-------+--------+-------+---------╯ ╭----------------------------------------------------------------+-----------------+------+--------+------+---------╮ | test/mock/FlightDelaysMocks.sol:MockVaultConfigurator Contract | | | | | | +===================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |----------------------------------------------------------------+-----------------+------+--------+------+---------| | 714096 | 3227 | | | | | |----------------------------------------------------------------+-----------------+------+--------+------+---------| | | | | | | | |----------------------------------------------------------------+-----------------+------+--------+------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |----------------------------------------------------------------+-----------------+------+--------+------+---------| | lastVault | 2302 | 2302 | 2302 | 2302 | 7 | ╰----------------------------------------------------------------+-----------------+------+--------+------+---------╯ ╭-----------------------------------------------------------+-----------------+-------+--------+-------+---------╮ | test/mock/FlightDelaysMocks.sol:VotingPowersMock Contract | | | | | | +================================================================================================================+ | Deployment Cost | Deployment Size | | | | | |-----------------------------------------------------------+-----------------+-------+--------+-------+---------| | 739953 | 3350 | | | | | |-----------------------------------------------------------+-----------------+-------+--------+-------+---------| | | | | | | | |-----------------------------------------------------------+-----------------+-------+--------+-------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |-----------------------------------------------------------+-----------------+-------+--------+-------+---------| | NETWORK | 334 | 334 | 334 | 334 | 10 | |-----------------------------------------------------------+-----------------+-------+--------+-------+---------| | SUBNETWORK_IDENTIFIER | 271 | 271 | 271 | 271 | 10 | |-----------------------------------------------------------+-----------------+-------+--------+-------+---------| | setFlightDelays | 44000 | 44000 | 44000 | 44000 | 10 | ╰-----------------------------------------------------------+-----------------+-------+--------+-------+---------╯ ╭------------------------------------------------------+-----------------+------+--------+------+---------╮ | test/mock/SettlementMock.sol:SettlementMock Contract | | | | | | +=========================================================================================================+ | Deployment Cost | Deployment Size | | | | | |------------------------------------------------------+-----------------+------+--------+------+---------| | 226020 | 827 | | | | | |------------------------------------------------------+-----------------+------+--------+------+---------| | | | | | | | |------------------------------------------------------+-----------------+------+--------+------+---------| | Function Name | Min | Avg | Median | Max | # Calls | |------------------------------------------------------+-----------------+------+--------+------+---------| | getCaptureTimestampFromValSetHeaderAt | 372 | 372 | 372 | 372 | 20 | |------------------------------------------------------+-----------------+------+--------+------+---------| | getQuorumThresholdFromValSetHeaderAt | 308 | 308 | 308 | 308 | 20 | |------------------------------------------------------+-----------------+------+--------+------+---------| | getRequiredKeyTagFromValSetHeaderAt | 438 | 438 | 438 | 438 | 20 | |------------------------------------------------------+-----------------+------+--------+------+---------| | verifyQuorumSigAt | 1249 | 1249 | 1249 | 1249 | 20 | ╰------------------------------------------------------+-----------------+------+--------+------+---------╯ Ran 1 test suite in 8.51ms (4.51ms CPU time): 10 tests passed, 0 failed, 0 skipped (10 total tests) ```` ## File: snapshots/sizes.txt ```` No files changed, compilation skipped ╭--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------╮ | Contract | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) | +====================================================================================================================================================================================+ | Address | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | BN254 | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | BN254G2 | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | BaseRewardsLogic | 1,606 | 1,658 | 22,970 | 47,494 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | BaseSlashingLogic | 4,387 | 4,439 | 20,189 | 44,713 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Bytes | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Checkpoints (node_modules/@openzeppelin/contracts/utils/structs/Checkpoints.sol) | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Checkpoints (node_modules/@symbioticfi/core/src/contracts/libraries/Checkpoints.sol) | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Checkpoints (node_modules/@symbioticfi/relay-contracts/src/libraries/structs/Checkpoints.sol) | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Create2 | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | CreateXWrapper | 2,764 | 2,792 | 21,812 | 46,360 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Driver | 17,519 | 17,547 | 7,057 | 31,605 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | ECDSA | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | ERC1967Proxy | 122 | 934 | 24,454 | 48,218 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | ERC1967Utils | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | ERC4626Math | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Errors | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | ExtraDataStorageHelper | 123 | 173 | 24,453 | 48,979 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | FeeOnTransferToken | 1,785 | 3,197 | 22,791 | 45,955 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | FlightDelays | 10,617 | 10,925 | 13,959 | 38,227 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | InputNormalizer | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | KeyBlsBn254 | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | KeyEcdsaSecp256k1 | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | KeyRegistry (node_modules/@symbioticfi/relay-contracts/src/modules/key-registry/KeyRegistry.sol) | 14,998 | 15,026 | 9,578 | 34,126 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | KeyRegistry (src/symbiotic/KeyRegistry.sol) | 15,267 | 15,295 | 9,309 | 33,857 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | KeyTags | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Logs | 4,290 | 4,342 | 20,286 | 44,810 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Math | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | MessageHashUtils | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | MockERC20 | 1,821 | 2,911 | 22,755 | 46,241 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | MockRewards | 1,030 | 1,156 | 23,546 | 47,996 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | MockRewardsFactory | 1,477 | 1,505 | 23,099 | 47,647 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | MockSlasher | 849 | 987 | 23,727 | 48,165 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | MockVault | 747 | 941 | 23,829 | 48,211 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | MockVaultConfigurator | 3,064 | 3,195 | 21,512 | 45,957 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Network | 12,358 | 12,550 | 12,218 | 36,602 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | OpNetVaultAutoDeployLogic | 5,693 | 5,745 | 18,883 | 43,407 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | OperatorRegistryMock | 57 | 83 | 24,519 | 49,069 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | OptInServiceMock | 199 | 225 | 24,377 | 48,927 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Panic | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | PersistentSet | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | ProxyAdmin | 977 | 1,213 | 23,599 | 47,939 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SafeCast | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SafeERC20 | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Settlement (src/symbiotic/Settlement.sol) | 11,798 | 11,826 | 12,778 | 37,326 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SettlementMock | 799 | 827 | 23,777 | 48,325 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SigBlsBn254 | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SigEcdsaSecp256k1 | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SigVerifierBlsBn254Simple | 4,946 | 4,974 | 19,630 | 44,178 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SigVerifierBlsBn254ZK | 2,694 | 3,774 | 21,882 | 45,378 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SignatureChecker | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SignedMath | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Simulation | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | StorageSlot | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Strings | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Subnetwork | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SymbioticCoreBytecode | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SymbioticCoreConstants | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SymbioticRewardsConstants | 44 | 94 | 24,532 | 49,058 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SymbioticRewardsConstantsHelper | 348 | 376 | 24,228 | 48,776 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | SymbioticUtils | 80 | 109 | 24,496 | 49,043 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | TimelockControllerUpgradeable | 7,690 | 7,718 | 16,886 | 41,434 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | Token | 1,723 | 3,065 | 22,853 | 46,087 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | TransparentUpgradeableProxy | 1,073 | 3,445 | 23,503 | 45,707 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | VotingPowerProviderLogic | 15,628 | 15,680 | 8,948 | 33,472 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | VotingPowers | 17,135 | 17,343 | 7,441 | 31,809 | |--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------| | VotingPowersMock | 3,065 | 3,286 | 21,511 | 45,866 | ╰--------------------------------------------------------------------------------------------------+------------------+-------------------+--------------------+---------------------╯ ```` ## File: src/symbiotic/Driver.sol ```` // SPDX-License-Identifier: MIT ⋮---- import {OzAccessControl} from "@symbioticfi/relay-contracts/src/modules/common/permissions/OzAccessControl.sol"; import {ValSetDriver} from "@symbioticfi/relay-contracts/src/modules/valset-driver/ValSetDriver.sol"; ⋮---- contract Driver is ValSetDriver, OzAccessControl { function initialize(ValSetDriverInitParams memory valSetDriverInitParams, address defaultAdmin) ```` ## File: src/symbiotic/KeyRegistry.sol ```` // SPDX-License-Identifier: MIT ⋮---- import { KeyRegistry as SymbioticKeyRegistry } from "@symbioticfi/relay-contracts/src/modules/key-registry/KeyRegistry.sol"; ⋮---- contract KeyRegistry is SymbioticKeyRegistry { function initialize(KeyRegistryInitParams memory keyRegistryInitParams) public virtual initializer { ```` ## File: src/symbiotic/Settlement.sol ```` // SPDX-License-Identifier: MIT ⋮---- import {OzAccessControl} from "@symbioticfi/relay-contracts/src/modules/common/permissions/OzAccessControl.sol"; import {Settlement as SymbioticSettlement} from "@symbioticfi/relay-contracts/src/modules/settlement/Settlement.sol"; ⋮---- contract Settlement is SymbioticSettlement, OzAccessControl { function initialize(SettlementInitParams memory settlementInitParams, address defaultAdmin) ```` ## File: src/symbiotic/VotingPowers.sol ```` // SPDX-License-Identifier: MIT ⋮---- import {BaseRewards} from "@symbioticfi/relay-contracts/src/modules/voting-power/extensions/BaseRewards.sol"; import {BaseSlashing} from "@symbioticfi/relay-contracts/src/modules/voting-power/extensions/BaseSlashing.sol"; import { EqualStakeVPCalc } from "@symbioticfi/relay-contracts/src/modules/voting-power/common/voting-power-calc/EqualStakeVPCalc.sol"; import { IBaseRewards } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IBaseRewards.sol"; import { IBaseSlashing } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IBaseSlashing.sol"; import { IOpNetVaultAutoDeploy } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IOpNetVaultAutoDeploy.sol"; import {IOzOwnable} from "@symbioticfi/relay-contracts/src/interfaces/modules/common/permissions/IOzOwnable.sol"; import {ISetMaxNetworkLimitHook} from "@symbioticfi/network/src/interfaces/ISetMaxNetworkLimitHook.sol"; import {IVault} from "@symbioticfi/core/src/interfaces/vault/IVault.sol"; import { IVotingPowerProvider } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/IVotingPowerProvider.sol"; import { OpNetVaultAutoDeploy } from "@symbioticfi/relay-contracts/src/modules/voting-power/extensions/OpNetVaultAutoDeploy.sol"; import {OzOwnable} from "@symbioticfi/relay-contracts/src/modules/common/permissions/OzOwnable.sol"; import {VotingPowerProvider} from "@symbioticfi/relay-contracts/src/modules/voting-power/VotingPowerProvider.sol"; ⋮---- contract VotingPowers is ⋮---- function initialize( ⋮---- function _registerOperatorImpl(address operator) internal override(OpNetVaultAutoDeploy, VotingPowerProvider) { ⋮---- function _unregisterOperatorVaultImpl(address operator, address vault) ⋮---- /// @dev To simplify protocol management, FlightDelays contract need to deploy new Vaults for airlines automatically. /// Due to Network's contract implementation allowing to set max network limit only to its middleware, it is done via VotingPowers contract, /// because it already contains extensions for rewards and slashing so a good choice to be a "middleware". function setMaxNetworkLimit(address vault) public { ⋮---- function setFlightDelays(address flightDelays_) public checkPermission { ```` ## File: src/FlightDelays.sol ```` // SPDX-License-Identifier: MIT ⋮---- import {VotingPowers} from "./symbiotic/VotingPowers.sol"; ⋮---- import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { TimelockControllerUpgradeable } from "@openzeppelin/contracts-upgradeable/governance/TimelockControllerUpgradeable.sol"; ⋮---- import {IBaseDelegator} from "@symbioticfi/core/src/interfaces/delegator/IBaseDelegator.sol"; import { IBaseRewards } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IBaseRewards.sol"; import {IBaseSlasher} from "@symbioticfi/core/src/interfaces/slasher/IBaseSlasher.sol"; import { IBaseSlashing } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IBaseSlashing.sol"; import { IDefaultStakerRewardsFactory } from "@symbioticfi/rewards/src/interfaces/defaultStakerRewards/IDefaultStakerRewardsFactory.sol"; import { IDefaultStakerRewards } from "@symbioticfi/rewards/src/interfaces/defaultStakerRewards/IDefaultStakerRewards.sol"; import {INetworkManager} from "@symbioticfi/relay-contracts/src/interfaces/modules/base/INetworkManager.sol"; import { IOperatorNetworkSpecificDelegator } from "@symbioticfi/core/src/interfaces/delegator/IOperatorNetworkSpecificDelegator.sol"; import {IOperatorRegistry} from "@symbioticfi/core/src/interfaces/IOperatorRegistry.sol"; import {IOptInService} from "@symbioticfi/core/src/interfaces/service/IOptInService.sol"; import {ISettlement} from "@symbioticfi/relay-contracts/src/interfaces/modules/settlement/ISettlement.sol"; import {ISlasher} from "@symbioticfi/core/src/interfaces/slasher/ISlasher.sol"; import {IVaultConfigurator} from "@symbioticfi/core/src/interfaces/IVaultConfigurator.sol"; import {IVault} from "@symbioticfi/core/src/interfaces/vault/IVault.sol"; import { IVotingPowerProvider } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/IVotingPowerProvider.sol"; import {NetworkManager} from "@symbioticfi/relay-contracts/src/modules/base/NetworkManager.sol"; import {Subnetwork} from "@symbioticfi/core/src/contracts/libraries/Subnetwork.sol"; ⋮---- contract FlightDelays is NetworkManager { ⋮---- event AirlineVaultDeployed(bytes32 indexed airlineId, address vault, address rewards); event FlightCreated(bytes32 indexed airlineId, bytes32 indexed flightId, uint48 scheduledTimestamp); event FlightDelayed(bytes32 indexed airlineId, bytes32 indexed flightId); event FlightDeparted(bytes32 indexed airlineId, bytes32 indexed flightId); event InsurancePurchased( ⋮---- event InsuranceClaimed(bytes32 indexed airlineId, bytes32 indexed flightId, address indexed buyer, uint256 payout); ⋮---- function initialize(InitParams calldata initParams) external initializer { ⋮---- function createFlight( ⋮---- function delayFlight(bytes32 airlineId, bytes32 flightId, uint48 epoch, bytes calldata proof) external { ⋮---- function departFlight(bytes32 airlineId, bytes32 flightId, uint48 epoch, bytes calldata proof) external { ⋮---- function buyInsurance(bytes32 airlineId, bytes32 flightId) external { ⋮---- function claimInsurance(bytes32 airlineId, bytes32 flightId) external { ⋮---- function _deployAirline(bytes32 airlineId) internal { ⋮---- function _verifyFlightMessage(bytes memory payload, uint48 epoch, bytes calldata proof) internal view { ```` ## File: test/mock/FlightDelaysMocks.sol ```` // SPDX-License-Identifier: MIT ⋮---- import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; ⋮---- import {IVaultConfigurator} from "@symbioticfi/core/src/interfaces/IVaultConfigurator.sol"; import {IVault} from "@symbioticfi/core/src/interfaces/vault/IVault.sol"; import { IDefaultStakerRewards } from "@symbioticfi/rewards/src/interfaces/defaultStakerRewards/IDefaultStakerRewards.sol"; import { IBaseSlashing } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IBaseSlashing.sol"; import { IBaseRewards } from "@symbioticfi/relay-contracts/src/interfaces/modules/voting-power/extensions/IBaseRewards.sol"; import {INetworkManager} from "@symbioticfi/relay-contracts/src/interfaces/modules/base/INetworkManager.sol"; ⋮---- contract MockVault { ⋮---- function setSlasher(address slasher_) external { ⋮---- function setActiveStake(uint256 amount) external { ⋮---- function activeStake() external view returns (uint256) { ⋮---- function onSlash(uint256 amount) external returns (uint256) { ⋮---- contract MockSlasher { ⋮---- function slash(bytes32, address, uint256 amount, uint48, bytes calldata) external returns (uint256) { ⋮---- function slashableStake(bytes32, address, uint48, bytes calldata) external view returns (uint256) { ⋮---- contract MockVaultConfigurator { ⋮---- function create(IVaultConfigurator.InitParams calldata params) ⋮---- contract MockRewardsFactory { ⋮---- function create(IDefaultStakerRewards.InitParams calldata params) external returns (address) { ⋮---- contract MockRewards { ⋮---- function distributeRewards(address network, address token, uint256 amount, bytes calldata data) external { ⋮---- contract OperatorRegistryMock { function registerOperator() external {} ⋮---- contract OptInServiceMock { ⋮---- function optIn(address where) external { ⋮---- contract VotingPowersMock is IBaseSlashing, IBaseRewards, INetworkManager { ⋮---- function setSuccess(bool success) external { ⋮---- function getSlasher() external pure returns (address) { ⋮---- function setSlasher(address) external override {} ⋮---- function slashVault(uint48 timestamp, address vault, address operator, uint256 amount, bytes memory) ⋮---- function executeSlashVault(address, uint256 slashIndex, bytes memory) ⋮---- function getRewarder() external view returns (address) { ⋮---- function setRewarder(address rewarder_) external override { ⋮---- function distributeStakerRewards(address stakerRewards, address token, uint256 amount, bytes memory data) ⋮---- function distributeOperatorRewards(address, address, uint256, bytes32) external pure override { // no-op for tests ⋮---- function NETWORK() external view override returns (address) { ⋮---- function SUBNETWORK_IDENTIFIER() external view override returns (uint96) { ⋮---- function SUBNETWORK() external view override returns (bytes32) { ⋮---- function setFlightDelays(address fd) external { ⋮---- function setMaxNetworkLimit(address) external view { ```` ## File: test/mock/SettlementMock.sol ```` // SPDX-License-Identifier: MIT ⋮---- contract SettlementMock { function getRequiredKeyTagFromValSetHeaderAt(uint48) public pure returns (uint8) { ⋮---- function getQuorumThresholdFromValSetHeaderAt(uint48) public pure returns (uint256) { ⋮---- function getCaptureTimestampFromValSetHeaderAt(uint48) public pure returns (uint48) { ⋮---- function getLastCommittedHeaderEpoch() public pure returns (uint48) { ⋮---- function verifyQuorumSigAt(bytes calldata, uint8, uint256, bytes calldata, uint48, bytes calldata) ⋮---- function verifyQuorumSig(bytes calldata, uint8, uint256, bytes calldata) public pure returns (bool) { ```` ## File: test/FlightDelays.t.sol ```` // SPDX-License-Identifier: MIT ⋮---- import {Test} from "forge-std/Test.sol"; ⋮---- import {FlightDelays} from "../src/FlightDelays.sol"; import {SettlementMock} from "./mock/SettlementMock.sol"; import { MockVaultConfigurator, MockRewardsFactory, MockVault, MockRewards, OperatorRegistryMock, OptInServiceMock, VotingPowersMock } from "./mock/FlightDelaysMocks.sol"; import {MockERC20} from "../script/mocks/MockERC20.sol"; ⋮---- contract FlightDelaysTest is Test { ⋮---- function setUp() public { ⋮---- function testBuyInsuranceAndRecordPolicy() public { ⋮---- function testDelayFlightAndClaim() public { ⋮---- function testCompleteFlightDistributesRewards() public { ⋮---- function testDelayRequiresEarlierFlightsProcessed() public { ⋮---- function testFlightsMustBeCreatedWithNonDecreasingTimestamp() public { ⋮---- function testCreateFlightRequiresSequentialOrdering() public { ⋮---- function testCannotBuyInsuranceWithoutFlight() public { ⋮---- function testCannotBuyBeforePolicyWindowOpens() public { ⋮---- function testCannotBuyAfterWindowCloses() public { ⋮---- function testCannotBuyOnceFlightDelayed() public { ⋮---- function _createFlight() internal { ⋮---- function _fundLatestVault(uint256 amount) internal { ```` ## File: ui/src/abi/ERC20.json ````json [ { "type": "function", "name": "name", "stateMutability": "view", "inputs": [], "outputs": [{ "name": "", "type": "string" }] }, { "type": "function", "name": "symbol", "stateMutability": "view", "inputs": [], "outputs": [{ "name": "", "type": "string" }] }, { "type": "function", "name": "decimals", "stateMutability": "view", "inputs": [], "outputs": [{ "name": "", "type": "uint8" }] }, { "type": "function", "name": "balanceOf", "stateMutability": "view", "inputs": [{ "name": "account", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "type": "function", "name": "allowance", "stateMutability": "view", "inputs": [ { "name": "owner", "type": "address" }, { "name": "spender", "type": "address" } ], "outputs": [{ "name": "", "type": "uint256" }] }, { "type": "function", "name": "approve", "stateMutability": "nonpayable", "inputs": [ { "name": "spender", "type": "address" }, { "name": "amount", "type": "uint256" } ], "outputs": [{ "name": "", "type": "bool" }] } ] ```` ## File: ui/src/abi/FlightDelays.json ````json [ { "type": "constructor", "inputs": [ { "name": "vaultConfigurator", "type": "address", "internalType": "address" }, { "name": "operatorVaultOptInService", "type": "address", "internalType": "address" }, { "name": "operatorNetworkOptInService", "type": "address", "internalType": "address" }, { "name": "defaultStakerRewardsFactory", "type": "address", "internalType": "address" }, { "name": "operatorRegistry", "type": "address", "internalType": "address" } ], "stateMutability": "nonpayable" }, { "type": "function", "name": "DEFAULT_STAKER_REWARDS_FACTORY", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "NETWORK", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "OPERATOR_NETWORK_OPT_IN_SERVICE", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "OPERATOR_VAULT_OPT_IN_SERVICE", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "SUBNETWORK", "inputs": [], "outputs": [ { "name": "", "type": "bytes32", "internalType": "bytes32" } ], "stateMutability": "view" }, { "type": "function", "name": "SUBNETWORK_IDENTIFIER", "inputs": [], "outputs": [ { "name": "", "type": "uint96", "internalType": "uint96" } ], "stateMutability": "view" }, { "type": "function", "name": "VAULT_CONFIGURATOR", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "airlines", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" } ], "outputs": [ { "name": "vault", "type": "address", "internalType": "address" }, { "name": "rewards", "type": "address", "internalType": "address" }, { "name": "covered", "type": "uint256", "internalType": "uint256" }, { "name": "lastFlightId", "type": "bytes32", "internalType": "bytes32" } ], "stateMutability": "view" }, { "type": "function", "name": "buyInsurance", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "claimInsurance", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "collateral", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "createFlight", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" }, { "name": "scheduledTimestamp", "type": "uint48", "internalType": "uint48" }, { "name": "epoch", "type": "uint48", "internalType": "uint48" }, { "name": "proof", "type": "bytes", "internalType": "bytes" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "delayFlight", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" }, { "name": "epoch", "type": "uint48", "internalType": "uint48" }, { "name": "proof", "type": "bytes", "internalType": "bytes" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "delayWindow", "inputs": [], "outputs": [ { "name": "", "type": "uint48", "internalType": "uint48" } ], "stateMutability": "view" }, { "type": "function", "name": "departFlight", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" }, { "name": "epoch", "type": "uint48", "internalType": "uint48" }, { "name": "proof", "type": "bytes", "internalType": "bytes" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "flights", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" } ], "outputs": [ { "name": "timestamp", "type": "uint48", "internalType": "uint48" }, { "name": "status", "type": "uint8", "internalType": "enum FlightDelays.FlightStatus" }, { "name": "policiesSold", "type": "uint128", "internalType": "uint128" }, { "name": "previousFlightId", "type": "bytes32", "internalType": "bytes32" } ], "stateMutability": "view" }, { "type": "function", "name": "initialize", "inputs": [ { "name": "initParams", "type": "tuple", "internalType": "struct FlightDelays.InitParams", "components": [ { "name": "votingPowers", "type": "address", "internalType": "address" }, { "name": "settlement", "type": "address", "internalType": "address" }, { "name": "collateral", "type": "address", "internalType": "address" }, { "name": "vaultEpochDuration", "type": "uint48", "internalType": "uint48" }, { "name": "messageExpiry", "type": "uint32", "internalType": "uint32" }, { "name": "policyWindow", "type": "uint48", "internalType": "uint48" }, { "name": "delayWindow", "type": "uint48", "internalType": "uint48" }, { "name": "policyPremium", "type": "uint256", "internalType": "uint256" }, { "name": "policyPayout", "type": "uint256", "internalType": "uint256" } ] } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "messageExpiry", "inputs": [], "outputs": [ { "name": "", "type": "uint32", "internalType": "uint32" } ], "stateMutability": "view" }, { "type": "function", "name": "policies", "inputs": [ { "name": "airlineId", "type": "bytes32", "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "internalType": "bytes32" }, { "name": "buyer", "type": "address", "internalType": "address" } ], "outputs": [ { "name": "policyStatus", "type": "uint8", "internalType": "enum FlightDelays.PolicyStatus" } ], "stateMutability": "view" }, { "type": "function", "name": "policyPayout", "inputs": [], "outputs": [ { "name": "", "type": "uint256", "internalType": "uint256" } ], "stateMutability": "view" }, { "type": "function", "name": "policyPremium", "inputs": [], "outputs": [ { "name": "", "type": "uint256", "internalType": "uint256" } ], "stateMutability": "view" }, { "type": "function", "name": "policyWindow", "inputs": [], "outputs": [ { "name": "", "type": "uint48", "internalType": "uint48" } ], "stateMutability": "view" }, { "type": "function", "name": "settlement", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "function", "name": "staticDelegateCall", "inputs": [ { "name": "target", "type": "address", "internalType": "address" }, { "name": "data", "type": "bytes", "internalType": "bytes" } ], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "vaultEpochDuration", "inputs": [], "outputs": [ { "name": "", "type": "uint48", "internalType": "uint48" } ], "stateMutability": "view" }, { "type": "function", "name": "votingPowers", "inputs": [], "outputs": [ { "name": "", "type": "address", "internalType": "address" } ], "stateMutability": "view" }, { "type": "event", "name": "AirlineVaultDeployed", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "vault", "type": "address", "indexed": false, "internalType": "address" }, { "name": "rewards", "type": "address", "indexed": false, "internalType": "address" } ], "anonymous": false }, { "type": "event", "name": "FlightCreated", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "scheduledTimestamp", "type": "uint48", "indexed": false, "internalType": "uint48" } ], "anonymous": false }, { "type": "event", "name": "FlightDelayed", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" } ], "anonymous": false }, { "type": "event", "name": "FlightDeparted", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" } ], "anonymous": false }, { "type": "event", "name": "InitSubnetwork", "inputs": [ { "name": "network", "type": "address", "indexed": false, "internalType": "address" }, { "name": "subnetworkId", "type": "uint96", "indexed": false, "internalType": "uint96" } ], "anonymous": false }, { "type": "event", "name": "Initialized", "inputs": [ { "name": "version", "type": "uint64", "indexed": false, "internalType": "uint64" } ], "anonymous": false }, { "type": "event", "name": "InsuranceClaimed", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "buyer", "type": "address", "indexed": true, "internalType": "address" }, { "name": "payout", "type": "uint256", "indexed": false, "internalType": "uint256" } ], "anonymous": false }, { "type": "event", "name": "InsurancePurchased", "inputs": [ { "name": "airlineId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "flightId", "type": "bytes32", "indexed": true, "internalType": "bytes32" }, { "name": "buyer", "type": "address", "indexed": true, "internalType": "address" }, { "name": "premium", "type": "uint256", "indexed": false, "internalType": "uint256" } ], "anonymous": false }, { "type": "error", "name": "BuyWindowClosed", "inputs": [] }, { "type": "error", "name": "FlightAlreadyExists", "inputs": [] }, { "type": "error", "name": "FlightNotDelayable", "inputs": [] }, { "type": "error", "name": "FlightNotDelayed", "inputs": [] }, { "type": "error", "name": "FlightNotScheduled", "inputs": [] }, { "type": "error", "name": "InsufficientCoverage", "inputs": [] }, { "type": "error", "name": "InvalidEpoch", "inputs": [] }, { "type": "error", "name": "InvalidFlight", "inputs": [] }, { "type": "error", "name": "InvalidInitialization", "inputs": [] }, { "type": "error", "name": "InvalidMessageSignature", "inputs": [] }, { "type": "error", "name": "InvalidPolicy", "inputs": [] }, { "type": "error", "name": "InvalidTimestamp", "inputs": [] }, { "type": "error", "name": "NetworkManager_InvalidNetwork", "inputs": [] }, { "type": "error", "name": "NotInitializing", "inputs": [] }, { "type": "error", "name": "PolicyAlreadyPurchased", "inputs": [] }, { "type": "error", "name": "PolicyNotFound", "inputs": [] }, { "type": "error", "name": "PreviousFlightIncomplete", "inputs": [] }, { "type": "error", "name": "SafeERC20FailedOperation", "inputs": [ { "name": "token", "type": "address", "internalType": "address" } ] } ] ```` ## File: ui/src/abi/Rewards.json ````json [ { "type": "function", "name": "claimable", "stateMutability": "view", "inputs": [ { "name": "token", "type": "address" }, { "name": "account", "type": "address" }, { "name": "data", "type": "bytes" } ], "outputs": [{ "name": "", "type": "uint256" }] }, { "type": "function", "name": "claimRewards", "stateMutability": "nonpayable", "inputs": [ { "name": "recipient", "type": "address" }, { "name": "token", "type": "address" }, { "name": "data", "type": "bytes" } ], "outputs": [] } ] ```` ## File: ui/src/abi/Slasher.json ````json [ { "type": "function", "name": "slashableStake", "stateMutability": "view", "inputs": [ { "name": "network", "type": "bytes32" }, { "name": "operator", "type": "address" }, { "name": "captureTimestamp", "type": "uint48" }, { "name": "hints", "type": "bytes" } ], "outputs": [{ "name": "", "type": "uint256" }] } ] ```` ## File: ui/src/abi/Vault.json ````json [ { "type": "function", "name": "deposit", "stateMutability": "nonpayable", "inputs": [ { "name": "onBehalfOf", "type": "address" }, { "name": "amount", "type": "uint256" } ], "outputs": [ { "name": "depositedAmount", "type": "uint256" }, { "name": "mintedShares", "type": "uint256" } ] }, { "type": "function", "name": "withdraw", "stateMutability": "nonpayable", "inputs": [ { "name": "claimer", "type": "address" }, { "name": "amount", "type": "uint256" } ], "outputs": [ { "name": "burnedShares", "type": "uint256" }, { "name": "mintedShares", "type": "uint256" } ] }, { "type": "function", "name": "activeBalanceOf", "stateMutability": "view", "inputs": [{ "name": "account", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "type": "function", "name": "slasher", "stateMutability": "view", "inputs": [], "outputs": [{ "name": "", "type": "address" }] } ] ```` ## File: ui/src/api/flights.ts ````typescript import type { AirlineDTO, AirlineWithFlights, FlightDTO } from "../types"; ⋮---- async function getJSON(url: string): Promise ⋮---- function normalizeBase(url: string) ⋮---- export async function fetchAirlinesWithFlights(baseUrl: string): Promise ```` ## File: ui/src/components/BuyerPage.tsx ````typescript import type { ReactNode } from "react"; ⋮---- import { airlineImages } from "../constants/airlines"; import type { ChainFlightData, FlattenedFlight, PolicyMap, ProtocolInfo } from "../types"; import { formatTimestamp } from "../utils/format"; import { flightKey } from "../utils/hash"; ⋮----