Skip to content

Latest commit

 

History

History
4 lines (4 loc) · 1.28 KB

design_pattern_decisions.md

File metadata and controls

4 lines (4 loc) · 1.28 KB

Design-patter decisions

  • Inheritance: My VerifiablePhoneNumbers contract inherits from OpenZeppelin's Ownable as a simple way of establishing access control over some key operational parameters. Moreover, I factored some logic for producing pseudo-random samplings into a RandomUtil library, which is imported by the main contract. This allowed me to keep the main contract exlusively for domain-specific logic, as well as make the non-trivial sampling logic easier to reason about.
  • Access control: As mentioned above, I made use of the Ownable design pattern to allow for restricted configurability of two key operational parameters -- the set of "verifiers" (addresses) and the number of verifiers selected for each verification request. Since the configurable surface area of the contract is minimal, this pattern felt like a good place to start to avoid over-engineering.
  • Oracles: While not a traditional application of the oracle pattern (or any canonical oracle framework), one might argue that the core approach underlying this protocol makes use of a domain-specific form of oracles. Specifically, the "verifiers" selected by the contract perform a combination of on-chain and off-chain actions to support verification of phone numbers -- and inherently "off-chain" concept.