-
Notifications
You must be signed in to change notification settings - Fork 0
Substitution of UTXO transaction ID in the template #4
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
base: omni-main
Are you sure you want to change the base?
Conversation
|
||
let post_actions = self.check_deposit_msg(deposit_msg, mint_amount); | ||
let post_actions = | ||
self.check_deposit_msg(deposit_msg, mint_amount, pending_utxo_info.tx_id.clone()); |
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.
Are you sure that the tx_id
is unique?
As I see it is possible to verify_deposit
with different vout
for same transaction
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.
fixed: 3293a0e
let mut total_gas = 0; | ||
let mut total_amount = 0; | ||
for (index, post_action) in post_actions.iter().enumerate() { | ||
for (index, post_action) in post_actions.iter_mut().enumerate() { |
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.
for (index, post_action) in post_actions.iter_mut().enumerate() { | |
for (index, post_action) in post_actions.iter_mut().enumerate() { | |
post_action.msg = post_action.msg.replace("{{UTXO_TX_ID}}", utxo_storage_key); |
I think the changes can be done with less code.
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.
In general, we can do it this way, it’s really the simplest option. In that case, the replacement will always happen regardless of what is specified in the templates.
I also thought about adding a special template like 'add UTXO', and if such a template exists, then perform the replacement.
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.
I think about something like that:
3145bfa
I’d like to isolate the contracts to which the changes are applied.
In this option, the code is simpler. However, the logic becomes stranger. Templates stop being templates and turn into modifiers.
The first option sounds more logical in the context of templates.
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.
I also thought that it is important to add additional restrictions, but after thinking more on it, I think we can make things simple and just do replace.
There is a low chance to get collision with this naming.
No description provided.