I work with the StateMachine library, and I need to transition from state to another where the stateValue
of the State
is exactly the same. The problem is that when I try to do the transition, I get an error that the user has insufficient funds pointing at the thread token. I presume that the stateValue
of a State
already includes the thread token, but it is added one more time or something like that. In summary, I have this (simplified):
{-# INLINABLE transition #-}
transition :: ContractParam -> State ContractDatum -> ContractRedeemer -> Maybe (TxConstraints Void Void, State ContractDatum)
transition cParam cState cRedeemer =
...
-- This is simply what I need to transition to
Just(mempty, State ("some updated datum") (stateValue cState))
...
To summarize, I need to keep the same stateValue
into the next state but get insufficient funds error, so I presume I need something like (stateValue cState) - threadToken
except the threadToken is not of type Value and I can not figure out, how to convert the thread token to Value
or how to remove the thread token from stateValue so that I don't get the insufficient funds error.
Edit: The code snippet should work as is, but there was a bug. The newest plutus versions work.