Enforcing Custom Transfer Logic in Move Modules

I’m developing a custom coin module for the Sui blockchain using the standard sui::coin How can I guarantee that all transfers of this particular coin type must utilize a specific transfer function that I’ve defined? This function will incorporate custom logic for elements like fees and restrictions (e.g., KYC compliance). I’m aware of the that you can use the coin DenyCap and DenyList to kind of enforce a requirement for KYC only transfers, but it still doesn’t seem like arbitrary programmability on coin transfers is possible using the standard sui coin.

The core issue is how to enforce the use of my custom transfer function while preventing users from circumventing it via standard Sui framework functions like sui::transfer::transfer. I want to make sure my custom logic is strictly adhered to.

Could anyone offer guidance or code examples on how to structure this module to enforce the use of my custom transfer function within the Sui ecosystem?

2 Likes

It is not possible to restrict native transfers of Coin’s beyond what is supported in the native DenyList functionality–Coins are (by design) unrestricted. For custom transfer logic like what you suggest, we recommend closed loop tokens Closed-Loop Token | Sui Documentation, which allow the issuer to set arbitrary restrictions on transfers and conversion to/from open loop coins.

1 Like