-
Notifications
You must be signed in to change notification settings - Fork 76
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
Unable to exit Token Type atomically when all tokens are redeemed #196
Comments
Hey Austin - I'll let the tokens team (@IvanR3 ?) comment on the specifics. But to the general point, this would seem to be the right design at the platform level I think... I mean: including a state as an input means "if this tx is valid and the input is currently unspent then please allow this tx to be confirmed and mark this state as spent". Including it as a reference means "if this input is currently unspent then please allow this tx to be confirmed but do NOT mark it as spent". That's logically inconsistent, right? So it feels like this is a Tokens SDK question rather than a core platform question related to how ref states work? eg if you DO need the ability some times to exit something that functions as a ref state maybe the solution is to allow it to be included as a regular state - ie it's a question of how certain types of txs are constructed by the SDK? (cc @roger3cev for info) |
@amoothart |
Let's take a concrete example where redeeming Are you suggesting that the Token SDK or the cordapp should make Thanks for the guidance! |
I was receiving emails about this discussion (since I'm subscribed to this repo), and it only hit me today during my afternoon nap lol
So in summary, you'll have an atomic transaction that consumes your house You can find an example on scheduleable states here. |
Austin, I'm not sure how you were able to exit your Btw, I do agree with you that it should have an
I believe that adding an |
Great proposal @adelrustum! I will give this a try and let you know how it goes. Having to maintain a secondary Rather than exiting a And yes, I added an |
Austin, I'm a bit confused about your approach (I think there a couple of typos):
What I meant in my initial answer is the following:
|
As mentioned above, you can't generally have an exit command because you don't know who else is using the token type. Imagine your business depended on - to some degree - my token definition which I then redeem. You'd be a bit screwed then. Considering token definitions don't take up much space etc. you may as well have them on the ledger. I do not recommend redeeming them. Of course, it's up to you but please don't then come back here saying you can't move tokens because the token definition doesn't exist anymore and therefore your app is broken. Also, the whole point of reference data is that it hangs around forever. It's not ephemeral. Cheers |
Both Fungible Tokens and their corresponding Token Type cannot be redeemed in the same Corda transaction. Trying to do so results in an error where a state cannot be both a references and an input: https://github.com/corda/corda/blob/release/os/4.4/core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt#L644
However this seems like a valid use case when a non-fungible token (eg. a house) is redeemed and the token type has no remaining functional value because there are no tokens remaining. The token type should be closed because the asset would have to be re-issued onto ledger to gain functional value again.
Preferably the token type and the underlying tokens are exited simultaneously but currently the token type has to be done in a second transaction in a non-atomic fashion. The same problem occurs for redeeming fungible tokens which represent fractional ownership of a non-fungible asset.
What is the intent for redeeming token types when all underlying tokens have been redeemed?
Is it safe to "evenutally" exit all token types once their tokens have been redeemed?
The text was updated successfully, but these errors were encountered: