ERC 721 contract triggering functions on a polygon contract

Hello,

We have 5 Ethereum Contracts working together (1x ERC 721 + 4x custom libraries).

Now we want to move some of the libraries to Polygon in order to decrease some of the cost. The ERC721 has to stay on Ethereum.

The ERC721 will have to trigger functions on the Polygon Libraries and receive values from it.

Question: Is here someone who has experience in this and can give some advice on how this can be pulled off?

Many Thanks

That's technically just 1 single contract in terms of storage space (i.e., the contract and the libraries share the same storage space).

And if all of these libraries are internally linked to that contract (which is mostly the case, unless you implement any external functions in them), then it is 1 single contract also in terms of its byte-code being deployed at a single address.

A library which implements only internal functions is not deployed as a separate independent contract. Instead, the internal functions of that library are added directly to the contract which uses them, and these internal functions become part of that contract's byte-code when deployed.

Here is a very good blog post explaining the difference between libraries with internal functions and libraries with external functions.

Thank you for your reply barakman.

I quite sure that its 5 separate contracts, since i deploy each of them manually and set the library adresses on the others so the communication works.

btw : its so many contracts because we exceed the deployable contract size if we dont split it up

cheers

So it is indeed 5 contracts deployed at 5 different addresses.

But they all share the same storage space, since the contract interacts with these libraries via delegate-calls, similarly to how a Proxy contract interacts with its associated remote contract (aka Logic contract or Implementation contract).


Other than that, it is not really clear what kind of help you're hoping for:

You'll probably need to share some more details, such as the related code, as well as the actual problem that you're experiencing.

I would be surprised if theyd share the same storage space, since we split it up due to size issues (and solved the problem by splitting it up)

Please correct me if i am wrong

Storage size and byte-code size are unrelated to each other, and independent of each other.

They are two completely different properties, whose only "common" aspect is the "size" term.

ok. thank you very much for this information

So yes - you are wrong BOTH in the assumption that the contract and the libraries do not share the same storage space, AND in the assumption that splitting the byte-code deployment into several pieces means splitting the storage space in the same way.

thank you! lets now keep this thread focused on my initial question

Of course; feel free to do so by referring to the second half in this comment of mine above.