Skip to content
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

Closed

Conversation

PatricioHenderson
Copy link
Contributor

What's new?

Create new records of tasks, so can handle all historic tasks configs

src/Task.ts Outdated
Comment on lines 466 to 485
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
Copy link
Member

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

src/Task.ts Outdated Show resolved Hide resolved
export function loadOrCreateTaskConfig(task: Task, block: ethereum.Block): TaskConfig {
const taskConfigId = task.taskConfig

let taskConfig = TaskConfig.load(taskConfigId!)

if (taskConfig === null) {
Copy link
Member

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
Copy link
Member

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

@facuspagnuolo
Copy link
Member

Parking this PR for now until we have more frontend resources to make a use of it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants