Skip to content

Commit

Permalink
refator: format comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ryosevenf committed Oct 30, 2023
1 parent b770a35 commit 03b2563
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/types/oneinch-fusion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// @see
// https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/limit-order/types.ts#L29-L41
// https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/limit-order/eip712/order-typed-data-builder.ts#L23-L37
/**
* @dev 1inch fusion order struct types
* @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/limit-order/types.ts#L29-L41
* @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/limit-order/eip712/order-typed-data-builder.ts#L34
*/
export type OneinchFusionOrder = {
salt: string;
makerAsset: string;
Expand Down
12 changes: 8 additions & 4 deletions src/visualizer/oneinch-fusion/getAuctionTime.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// The bit constants refers to fusion-sdk code.
// @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/auction-salt/parser/constants.ts
/**
* @dev 1inch fusion auction salt mask constants
* @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/auction-salt/parser/constants.ts
*/
const START_TIME_MASK = BigInt(
"0xFFFFFFFF00000000000000000000000000000000000000000000000000000000"
);
Expand All @@ -9,8 +11,10 @@ const DURATION_MASK = BigInt(
const START_TIME_SHIFT = BigInt(224);
const DURATION_SHIFT = BigInt(200);

// get the auction start and end time from the salt
// @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/auction-salt/parser/parser.ts#L15-L27
/**
* @dev get the auction start and end time from the salt
* @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/auction-salt/parser/parser.ts#L15-L27
*/
export const getAuctionTime = (salt: string): { startTime: number; endTime: number } => {
const startTime = getAuctionStartTime(salt);
const duration = getAuctionDuration(salt);
Expand Down
10 changes: 8 additions & 2 deletions src/visualizer/oneinch-fusion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ import { getAuctionTime } from "./getAuctionTime";

const { NATIVE } = ASSET_TYPE;

// @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/constants.ts#L50
/**
* @dev 1inch fusion verifying contract address
* @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/constants.ts#L50
*/
export const ONEINCH_FUSION_VERIFYING_CONTRACT =
"0x1111111254eeb25477b68fb85ed929f73a960582";

// @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/constants.ts#L6-L15
/**
* @dev 1inch fusion supported chains
* @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/constants.ts#L6-L15
*/
export const ONEINCH_FUSION_SUPPORTED_CHAINS = [
1, //Ethereum
137, //Polygon
Expand Down
7 changes: 4 additions & 3 deletions test/visualizer/oneinch-fusion/data.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { oneinchFusionTypes } from "../../../src/types";

// Test data refers to fusion-sdk code.
// @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/fusion-order/fusion-order.spec.ts#L12-L61

/**
* @dev test data for 1inch fusion successful order
* @see https://github.com/1inch/fusion-sdk/blob/4b76e9c232276742f879f3495e452dfc667b5a3a/src/fusion-order/fusion-order.spec.ts#L12-L61
*/
const oneinchFusionOrder: oneinchFusionTypes.OneinchFusionOrder = {
salt: "45118768841948961586167738353692277076075522015101619148498725069326976558864",
makerAsset: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
Expand Down

0 comments on commit 03b2563

Please sign in to comment.