1

Actually im wondering if in order to use a mapping from a 3d party contract in an other contract, can i devlare the mapping in the interface and use it like Mycontract.mapping() and view/modifiy it , or do i have to make getters/setters to view/modify the contracts mappings? Also, the visibility should be external or public?

1 Answer 1

0

No, that is not possible.

If you would like to modify a mapping declared in another contract, you will have to inherit that contract, so you inherit the mapping (if it is not private).

Otherwise, the 3rd party contract needs to have getters and setters methods for you to be able to read and update the mapping. In this case, it doesn't matter if it's external or public. But if it's external it means that the contract that declares it cannot call it with an internal call. If it's public anybody can call it, whether from inside of the contract itself or from another contract. If the intention of the contract that declares this mapping is that it should only be called externally, then it should be declared external.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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