dfinity / ICRC

Repository to ICRC proposals
Apache License 2.0
31 stars 5 forks source link

list approval ICRC #103

Open bogwar opened 2 months ago

bogwar commented 2 months ago

This is a draft for a standard to list existing allowances

sea-snake commented 2 months ago

One last comment, not sure what the correct method name should be.

On ICRC-37 we have icrc37_get_token_approvals and icrc37_get_collection_approvals (since we have approvals either per token or the whole collection). That would mean that the method name in ICRC-103 along those lines would be icrc103_get_approvals.

Where there's two differences:

bogwar commented 2 months ago

One last comment, not sure what the correct method name should be.

On ICRC-37 we have icrc37_get_token_approvals and icrc37_get_collection_approvals (since we have approvals either per token or the whole collection). That would mean that the method name in ICRC-103 along those lines would be icrc103_get_approvals.

Where there's two differences:

  • "approvals" instead of "allowances", which makes sense since the ICRC-2 allowance method returns the allowance (nat) while this ICRC-103 returns (a list of) the whole approval that includes the allowance among other details like from/to and expiry.
  • "get" instead of "list", this is a nitpick, no idea which one of the two would be most consistent across existing ICRC standards, probably requires checking existing ICRC standards in depth to pick one or the other.

For NFTs, approvals is appropriate because there is no partial transfer so you list outstanding approvals. For fungible tokens allowance seems more suitable because you don't list the original approvals but rather whatever is left to be transferred because some partial transfer_from may have occurred... so that's more of an allowance. I don't have strong feelings about get or list so I'm happy to go with get for consistency. WDYT?

sea-snake commented 2 months ago

For NFTs, approvals is appropriate because there is no partial transfer so you list outstanding approvals. For fungible tokens allowance seems more suitable because you don't list the original approvals but rather whatever is left to be transferred because some partial transfer_from may have occurred... so that's more of an allowance. I don't have strong feelings about get or list so I'm happy to go with get for consistency. WDYT?

Makes completely sense, also in ICRC-2 there's the allowance method while in ICRC-37 there's the is approved method. So to keep it consistent along those lines, allowances is indeed the better option.

Just double checked most ICRC standards, can't find any method at first glance that use "list" in the method name, so let's go with "get".