Importing Smart Contracts

Hi,

very new to all this contract stuff so please be patient.

what i want to do is import all the accounts from a contract that was deployed via an old developer and has since left us high and dry.

into my new contract. with their respective balances.

is this possible?

Did a little more reading and found an article on using an interface defining origin contract methods.

Then adding a method taking original contract address.

Then calling methods on interface

Is this the correct approach?

Fetching each user balance onchain is not the best way. I suggest to choose an offchain approach instead.

So i have 2 ideas

  1. Some kind of metamask swap
  2. Offchain api and web3 code to do swaps.

Either way there is gas involved. And probably a 1:1 account use interaction

What do u think. Suggestion welcome

Using an off chain method is not advisable and that would be based on snapshot of the balances at that time, if people make transfers later on that information is unknown to the new contract.

The best option would be a convert function in your new contract, allowing people to exchange the old coins (assuming you are talking about an etc token) for the new coins. That way the old tokens are now transferred to your contract or a burn address and won’t cause any future issues.

As you would allow the users to perform this action themselves the gas costs would be payed by them.

yes @CryptoWorld. these are ERC20 Tokens