-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor reallocateTo action getter
- Loading branch information
Showing
4 changed files
with
34 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/dma-library/src/operations/morphoblue/helpers/reallocate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Network } from '@deploy-configurations/types/network' | ||
import { actions } from '@dma-library/actions' | ||
|
||
/** | ||
* Creates a reallocate action for the MorphoBlue protocol. | ||
* | ||
* @param network - The network on which the action is being executed. | ||
* @param reallocateData - An array of strings containing data for reallocation. | ||
* | ||
* If the reallocateData array is empty, the action will be marked as skipped. | ||
* This allows for conditional execution based on the presence of reallocation data. | ||
* | ||
* @returns The reallocate action object, which may be skipped if no data is provided. | ||
*/ | ||
export function getReallocateToAction(network: Network, reallocateData: string[]) { | ||
const reallocateAction = actions.morphoblue.reallocate(network, { | ||
data: reallocateData, | ||
}) | ||
if (reallocateData.length === 0) { | ||
reallocateAction.skipped = true | ||
} | ||
return reallocateAction | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters