If you want to only disallow transfers, then you should use a lock that only prohibits withdraw reasons transfer, aka. WithdrawReason::Transfer
. Although, be aware that it is likely that a user can find a way to get around this, as they can tip the block author or pay for transaction fees with the locked funds, so if they happen to collude with a block author, they can effectively trick the system.
It is likely that what you actually want is WithdrawReason::all()
.
And as a side note - I thought I could use a substring(hash(AccountId)) for the lock identifier, is it a good idea create the lock per each account this way?
I wouldn't do that. Each lock is already linked to an account, and the API for adding and removing locks already asks for an account to operate on. So using the account hash as key is duplicate in my opinion (could also have bad performance impact). You should follow the convention within substrate use a uniquee identifier from the pallet as your lock identifier (simply: name of the pallet will do). This will make sure that the locks created by this pallet will not be accidentally removed by another pallet.