I can't declare a stand-alone struct in its own file, what gives?
[Ethereum] How to you share a struct definition between contracts in separate files
contract-developmentcontract-invocationgo-ethereumsolidity
contract-developmentcontract-invocationgo-ethereumsolidity
I can't declare a stand-alone struct in its own file, what gives?
Best Answer
You can with a library! Here's an example:
Two important things to keep in mind: 1) the library gets deployed to the chain and then is referenced by its address, and 2) the library acts as a true pass-through, meaning msg.sender (and related values) refer to the original caller.
More info and details here: http://solidity.readthedocs.io/en/develop/contracts.html#libraries