Mirat Can Bayrak
Mirat Can Bayrak

Reputation: 651

How to divide complex smart contract into pieces

I'm an experienced Python developer but a newbie on Solidity. I'm developing a smart contract which is a game as a side project. My problem is complexity. My smart contract has lots of variables and methods and this is making development and maintenance hard. I want to divide it into pieces but I can not imagine how must it be done. Are there any suggestions or examples about that?

Upvotes: 0

Views: 625

Answers (1)

jhonny
jhonny

Reputation: 858

Like a lot of things in programming it depends in your needs, maybe you can abstract the logic to a library, maybe you can make use of inheritance to make your code cleaner, maybe you can have one master contract that delegates the logic to other contracts (like some proxy), one pattern that let you do something like that is the diamond pattern, there are a few implementation of this pattern, but probably you only need a code refactor or something like storage pattern

Upvotes: 3

Related Questions