-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tasks: Track historic list of tasks configs #43
Tasks: Track historic list of tasks configs #43
Conversation
src/Task.ts
Outdated
if (taskConfig.gasLimits) clonedTaskConfig.gasLimits = taskConfig.gasLimits | ||
if (taskConfig.timeLock) clonedTaskConfig.timeLock = taskConfig.timeLock | ||
if (taskConfig.connector) clonedTaskConfig.connector = taskConfig.connector | ||
if (taskConfig.recipient) clonedTaskConfig.recipient = taskConfig.recipient | ||
if (taskConfig.defaultTokenThreshold) clonedTaskConfig.defaultTokenThreshold = taskConfig.defaultTokenThreshold | ||
if (taskConfig.defaultVolumeLimit) clonedTaskConfig.defaultVolumeLimit = taskConfig.defaultVolumeLimit | ||
if (taskConfig.defaultTokenOut) clonedTaskConfig.defaultTokenOut = taskConfig.defaultTokenOut | ||
if (taskConfig.defaultMaxSlippage) clonedTaskConfig.defaultMaxSlippage = taskConfig.defaultMaxSlippage | ||
if (taskConfig.defaultDestinationChain) | ||
clonedTaskConfig.defaultDestinationChain = taskConfig.defaultDestinationChain | ||
if (taskConfig.defaultMaxBridgeFee) clonedTaskConfig.defaultMaxBridgeFee = taskConfig.defaultMaxBridgeFee | ||
if (taskConfig.customTokenThresholds._id) | ||
clonedTaskConfig.customTokenThresholds._id = taskConfig.customTokenThresholds._id | ||
if (taskConfig.customVolumeLimits._id) clonedTaskConfig.customVolumeLimits._id = taskConfig.customVolumeLimits._id | ||
if (taskConfig.customTokenOuts._id) clonedTaskConfig.customTokenOuts._id = taskConfig.customTokenOuts._id | ||
if (taskConfig.customMaxSlippages._id) clonedTaskConfig.customMaxSlippages._id = taskConfig.customMaxSlippages._id | ||
if (taskConfig.customDestinationChains._id) | ||
clonedTaskConfig.customDestinationChains._id = taskConfig.customDestinationChains._id | ||
if (taskConfig.customMaxBridgeFees._id) | ||
clonedTaskConfig.customMaxBridgeFees._id = taskConfig.customMaxBridgeFees._id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to do the if
thing? Can't we simply assign what ever it is stored there?
Also not sure what _id
means
export function loadOrCreateTaskConfig(task: Task, block: ethereum.Block): TaskConfig { | ||
const taskConfigId = task.taskConfig | ||
|
||
let taskConfig = TaskConfig.load(taskConfigId!) | ||
|
||
if (taskConfig === null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be if (task.taskConfig === null)
Otherwise you are might try to load an entity with a null ID right above
clonedTaskConfig.customMaxBridgeFees._id = taskConfig.customMaxBridgeFees._id | ||
clonedTaskConfig.save() | ||
task.taskConfig = clonedTaskConfig.id | ||
taskConfig = clonedTaskConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to save task
as well
Parking this PR for now until we have more frontend resources to make a use of it |
What's new?
Create new records of tasks, so can handle all historic tasks configs