[Ethereum] ERC-20 tokens and freezing accounts

contract-developmenterc-20solidity

For the compliance reasons I need to implement account freeze functionality in ab ERC-20 token. Initially, issued tokens are not transferable until the address holder goes through Know Your Customer process. When the process is complete, a centralized system, having the key of the owner account, informs the smart contract that tokens in this address become transferable.

What would be the best data structure to do this? Assuming there will be 1000-2000 token holders are there any scalability issues in smart contracts regarding this area.

Best Answer

It sounds like you could use a simple mapping, eg when you got the KYC notification you'd set kyced_customers[customer_address] = true. Then when they try to send funds you do a single read from that mapping for that address. The gas cost of reading a mapping is the same regardless of the number of things in the mapping, as is the approximate computation cost, so this should scale up fine.

Related Topic