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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions typescript/solver/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
PRIVATE_KEY=
MNEMONIC=
COMPACT_API_KEY=
19 changes: 12 additions & 7 deletions typescript/solver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ const main = () => {
const multiProvider = getMultiProvider();

// TODO: implement a way to choose different listeners and fillers
const ecoListener = solvers["eco"].listener.create();
const ecoFiller = solvers["eco"].filler.create(multiProvider);
// const ecoListener = solvers["eco"].listener.create();
// const ecoFiller = solvers["eco"].filler.create(multiProvider);

ecoListener(ecoFiller);
// ecoListener(ecoFiller);

const hyperlane7683Listener = solvers["hyperlane7683"].listener.create();
const hyperlane7683Filler =
solvers["hyperlane7683"].filler.create(multiProvider);
// const hyperlane7683Listener = solvers["hyperlane7683"].listener.create();
// const hyperlane7683Filler =
// solvers["hyperlane7683"].filler.create(multiProvider);

hyperlane7683Listener(hyperlane7683Filler);
// hyperlane7683Listener(hyperlane7683Filler);

const compactListener = solvers["compact"].listener.create();
const compactFiller = solvers["compact"].filler.create(multiProvider);

compactListener(compactFiller);
};

main();
32 changes: 32 additions & 0 deletions typescript/solver/solvers/compact/config/allowBlockLists.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {
AllowBlockLists,
AllowBlockListsSchema,
} from "../../../config/types.js";

// Example config
// [
// {
// senderAddress: "*",
// destinationDomain: ["1"],
// recipientAddress: "*"
// },
// {
// senderAddress: ["0xca7f632e91B592178D83A70B404f398c0a51581F"],
// destinationDomain: ["42220", "43114"],
// recipientAddress: "*"
// },
// {
// senderAddress: "*",
// destinationDomain: ["42161", "420"],
// recipientAddress: ["0xca7f632e91B592178D83A70B404f398c0a51581F"]
// }
// ]

const allowBlockLists: AllowBlockLists = {
allowList: [],
blockList: [],
};

AllowBlockListsSchema.parse(allowBlockLists);

export default allowBlockLists;
6 changes: 6 additions & 0 deletions typescript/solver/solvers/compact/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import allowBlockLists from "./allowBlockLists.js";
import metadata from "./metadata.js";

const COMPACT_API_KEY = process.env.COMPACT_API_KEY;

export { allowBlockLists, metadata, COMPACT_API_KEY };
23 changes: 23 additions & 0 deletions typescript/solver/solvers/compact/config/metadata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { type CompactMetadata, CompactMetadataSchema } from "../types.js";

const metadata: CompactMetadata = {
protocolName: "The Compact",
arbiters: [
{
address: "0x088470910056221862d18fF2e65ffaeC96ec6dA4",
chainName: "ethereum"
},
{
address: "0x57F0638d4fba79DB978c4eE1B73d469ea21014b2",
chainName: "optimism"
},
{
address: "0x43b60b47764B6460c96349A1B414214BBa7F22c9",
chainName: "base"
}
]
};

CompactMetadataSchema.parse(metadata);

export default metadata;
299 changes: 299 additions & 0 deletions typescript/solver/solvers/compact/contracts/HyperlaneArbiter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_mailbox", "type": "address" },
{ "internalType": "address", "name": "_theCompact", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "_hook",
"type": "address"
}
],
"name": "HookSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint8",
"name": "version",
"type": "uint8"
}
],
"name": "Initialized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "_ism",
"type": "address"
}
],
"name": "IsmSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [],
"name": "PACKAGE_VERSION",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "domains",
"outputs": [{ "internalType": "uint32[]", "name": "", "type": "uint32[]" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint32", "name": "_domain", "type": "uint32" },
{ "internalType": "bytes32", "name": "_router", "type": "bytes32" }
],
"name": "enrollRemoteRouter",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint32[]", "name": "_domains", "type": "uint32[]" },
{ "internalType": "bytes32[]", "name": "_addresses", "type": "bytes32[]" }
],
"name": "enrollRemoteRouters",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint32", "name": "claimChain", "type": "uint32" },
{
"components": [
{ "internalType": "address", "name": "arbiter", "type": "address" },
{ "internalType": "address", "name": "sponsor", "type": "address" },
{ "internalType": "uint256", "name": "nonce", "type": "uint256" },
{ "internalType": "uint256", "name": "expires", "type": "uint256" },
{ "internalType": "uint256", "name": "id", "type": "uint256" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"internalType": "struct Compact",
"name": "compact",
"type": "tuple"
},
{
"components": [
{ "internalType": "uint256", "name": "fee", "type": "uint256" },
{ "internalType": "uint32", "name": "chainId", "type": "uint32" },
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "address", "name": "recipient", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"internalType": "struct Intent",
"name": "intent",
"type": "tuple"
},
{
"internalType": "bytes",
"name": "allocatorSignature",
"type": "bytes"
},
{ "internalType": "bytes", "name": "sponsorSignature", "type": "bytes" }
],
"name": "fill",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "getCompactWitnessTypestring",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint32", "name": "_origin", "type": "uint32" },
{ "internalType": "bytes32", "name": "_sender", "type": "bytes32" },
{ "internalType": "bytes", "name": "_message", "type": "bytes" }
],
"name": "handle",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{ "internalType": "uint256", "name": "fee", "type": "uint256" },
{ "internalType": "uint32", "name": "chainId", "type": "uint32" },
{ "internalType": "address", "name": "token", "type": "address" },
{ "internalType": "address", "name": "recipient", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"internalType": "struct Intent",
"name": "intent",
"type": "tuple"
}
],
"name": "hash",
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "hook",
"outputs": [
{
"internalType": "contract IPostDispatchHook",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "interchainSecurityModule",
"outputs": [
{
"internalType": "contract IInterchainSecurityModule",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "localDomain",
"outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "mailbox",
"outputs": [
{ "internalType": "contract IMailbox", "name": "", "type": "address" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint32", "name": "_domain", "type": "uint32" }
],
"name": "routers",
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_hook", "type": "address" }
],
"name": "setHook",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_module", "type": "address" }
],
"name": "setInterchainSecurityModule",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "theCompact",
"outputs": [
{ "internalType": "contract TheCompact", "name": "", "type": "address" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "newOwner", "type": "address" }
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint32", "name": "_domain", "type": "uint32" }
],
"name": "unenrollRemoteRouter",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint32[]", "name": "_domains", "type": "uint32[]" }
],
"name": "unenrollRemoteRouters",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
Loading