0

Imagine an exchange contract to store and handle different accounts for different buyers and sellers, it is possible for a contract to manage and hold different address and its balance for different erc20 tokens?

I know that a common pattern is to use approve, allowance and transferfrom, but this pattern doesnt guarantee a funds availability.

I am wondering if it is possible for a contract to generate different addresses and handle wallets?

1

Each contract has exactly one address - the contract's address. But a contract can create new contracts and they will have new addresses.

So if you want to have multiple "wallets" you can have a factory contract which creates new contracts which act as wallets. They will each have their own address and they can own different amounts of different ERC20 tokens. You just have to code all the required functionality inside the contracts: the functionality to create and handle sub-contracts (wallets) and the functionality for the sub-contracts to handle ERC20 tokens.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.