Skip to content

Commit

Permalink
improve: exclusivity types (#1321)
Browse files Browse the repository at this point in the history
* chore: types change

Signed-off-by: james-a-morris <[email protected]>

* nit: reintroduce comment

Signed-off-by: james-a-morris <[email protected]>

* nit: new changes

Signed-off-by: james-a-morris <[email protected]>

* Apply suggestions from code review

---------

Signed-off-by: james-a-morris <[email protected]>
Co-authored-by: Paul <[email protected]>
  • Loading branch information
james-a-morris and pxrl authored Dec 11, 2024
1 parent e882a69 commit 1e2a32d
Showing 1 changed file with 64 additions and 55 deletions.
119 changes: 64 additions & 55 deletions api/_types/exclusivity.types.ts
Original file line number Diff line number Diff line change
@@ -1,56 +1,65 @@
export type RelayerFillLimit = {
originChainId: number;
inputToken: string;
destinationChainId: number;
outputToken: string;
minOutputAmount?: number;
maxOutputAmount?: number;
minExclusivityPeriod?: number;
minProfitThreshold?: number;
balanceMultiplier?: number;
msgFill?: boolean;
};
import { boolean, Infer, object, optional } from "superstruct";
import { positiveFloatStr, positiveIntStr, validAddress } from "../_utils";

// Example config.
export const RelayerConfigUpdate: RelayerFillLimit[] = [
{
originChainId: 1,
inputToken: "",
destinationChainId: 42161,
outputToken: "",
minExclusivityPeriod: 20,
minProfitThreshold: 0.0003,
balanceMultiplier: 0.6,
maxOutputAmount: 2500,
},
{
originChainId: 10,
inputToken: "",
destinationChainId: 42161,
outputToken: "",
minExclusivityPeriod: 5,
minProfitThreshold: 0.0003,
balanceMultiplier: 0.6,
maxOutputAmount: 2500,
},
{
originChainId: 137,
inputToken: "",
destinationChainId: 42161,
outputToken: "",
minExclusivityPeriod: 5,
minProfitThreshold: 0.0003,
balanceMultiplier: 0.6,
maxOutputAmount: 2500,
},
{
originChainId: 324,
inputToken: "",
destinationChainId: 42161,
outputToken: "",
minExclusivityPeriod: 5,
minProfitThreshold: 0.0003,
balanceMultiplier: 0.6,
maxOutputAmount: 2500,
},
];
export const RelayerFillLimitSchema = object({
originChainId: positiveIntStr(),
destinationChainId: positiveIntStr(),
inputToken: validAddress(),
outputToken: validAddress(),
minOutputAmount: positiveIntStr(),
maxOutputAmount: positiveIntStr(),
minProfitThreshold: positiveFloatStr(),
minExclusivityPeriod: optional(positiveIntStr()),
balanceMultiplier: optional(positiveFloatStr()),
msgFill: optional(boolean()),
});

export type RelayerFillLimit = Infer<typeof RelayerFillLimitSchema>;

// // Example config.
// export const RelayerConfigUpdate: RelayerFillLimit[] = [
// {
// originChainId: "1",
// inputToken: "",
// destinationChainId: "42161",
// outputToken: "",
// minExclusivityPeriod: "20",
// minProfitThreshold: "0.0003",
// balanceMultiplier: "0.6",
// minOutputAmount: "1",
// maxOutputAmount: "250",
// },
// {
// originChainId: "10",
// inputToken: "",
// destinationChainId: "42161",
// outputToken: "",
// minExclusivityPeriod: "5",
// minProfitThreshold: "0.0003",
// balanceMultiplier: "0.6",
// minOutputAmount: "251",
// maxOutputAmount: "500",
// },
// {
// originChainId: "137",
// inputToken: "",
// destinationChainId: "42161",
// outputToken: "",
// minExclusivityPeriod: "5",
// minProfitThreshold: "0.0003",
// balanceMultiplier: "0.6",
// minOutputAmount: "501",
// maxOutputAmount: "1000",
// },
// {
// originChainId: "324",
// inputToken: "",
// destinationChainId: "42161",
// outputToken: "",
// minExclusivityPeriod: "5",
// minProfitThreshold: "0.0003",
// balanceMultiplier: "0.6",
// minOutputAmount: "1001",
// maxOutputAmount: "2500",
// },
// ];

0 comments on commit 1e2a32d

Please sign in to comment.