Replies: 4 comments 1 reply
-
What you are describing is essentially "double satisfaction", a common weakness in contracts on cardano: In short: The contract is run for each input BUT you need to add logic to ensure that there is not one output that satisfies multiple inputs. This can be done in two canonical ways
|
Beta Was this translation helpful? Give feedback.
-
Can we satisfy 1. by modifying the own_spent_utxo example? proof of concept: original own_spent f(x):
count of contract utxos spent f(fx)
|
Beta Was this translation helpful? Give feedback.
-
Yes you can use the loop. However the ref is always unique. It is essentially what output you are spending with this specific invocation of the contract. You need to extract the address of the validator and loop through all inputs to find anything spent from the validator address |
Beta Was this translation helpful? Give feedback.
-
Hopefully this covers it:)
|
Beta Was this translation helpful? Give feedback.
-
When designing a validator I wanted to check how the contract operates - if I have a constraint which makes sure that X ADA is being sent to Y address then the contract will be valid and it will allow you to do something like withdraw a utxo containing a token at the contract address - Do I also need to implement contract logic which ensures only 1 token UTXO is being withdraw from the contract address? Or will the validator logic apply to EACH utxo spent - ie) for every utxo withdrawn it will need to a have X ADA sent to Y address ?
Beta Was this translation helpful? Give feedback.
All reactions