Zondax / filecoin-solidity

Filecoin Solidity API Library
Apache License 2.0
94 stars 43 forks source link

constructors for types #319

Open snissn opened 1 year ago

snissn commented 1 year ago

We have many custom types in this repo, and not a lot of constructors for how a user of this library constructs custom types from "plain" solidity types. Both the common types file as the higher priority and API specific types that are based on builtin solidity types + common types in the library, it would be really nice to have an interface for constructing these types. This will prevent confusion and repetition of code as any developer who integrates the filecoin-solidity library into their codebase will need to construct these custom types.

Example:

from CommonTypes.sol, how does an end user construct a bigInt from a u256? what about a cid from a string?

in MarketTypes.sol how does an end user construct a DealProposal from the composite types?

We have built constructors for the FilAddress type, and having util / constructors for the rest will be really really helpful for end users

:link: zboto Link

ainhoa-a commented 1 year ago

Hi @snissn for which custom types you recommend to have a constructor?

ainhoa-a commented 1 year ago

@rllola raúl suggests to focus on common types only.