def __init__(self, context: ExecutionContext): super(ContractInterface, self).__init__(context=context) self.entrypoints = self.program.parameter.list_entrypoints() for entrypoint, ty in self.entrypoints.items(): attr = ContractEntrypoint(context=context, entrypoint=entrypoint) attr.__doc__ = generate_pydoc(ty, entrypoint) setattr(self, entrypoint, attr)
def storage(_ctx, action: str, path: Optional[str]) -> None: contract = get_contract(path) if action == 'schema': logger.info(generate_pydoc(type(contract.storage.data), title='storage')) elif action == 'default': logger.info(pformat(contract.storage.dummy())) else: raise Exception('Action must be either `schema` or `default`')
def __init__(self, context: ExecutionContext, data: MichelsonType, path='', title=None) -> None: super().__init__(context=context) self.data = data self.path = path self.__doc__ = generate_pydoc(type(self.data), title=title)
def __init__(self, context: ExecutionContext): super().__init__(context=context) self._logger = logging.getLogger(__name__) self.entrypoints = self.program.parameter.list_entrypoints() for entrypoint, ty in self.entrypoints.items(): if entrypoint == 'token_metadata': continue attr = ContractEntrypoint(context=context, entrypoint=entrypoint) attr.__doc__ = generate_pydoc(ty, entrypoint) setattr(self, entrypoint, attr)
def __init__(self, context: ExecutionContext, name: str, parameter: Optional[Dict[str, Any]], return_type: Dict[str, Any], code: List[Any]): super(OffChainView, self).__init__(context=context) self.name = name self.param_expr = parameter or {'prim': 'unit'} self.rtype_expr = return_type self.code_expr = code self.__doc__ = generate_pydoc(MichelsonType.match(self.param_expr), title=name)
def storage(self, action, path=None): """ Manage contract storage. :param action: One of `schema`, `default` :param path: Path to the .tz file, or the following uri: <network>:<KT-address> """ contract = get_contract(path) if action == 'schema': print(generate_pydoc(type(contract.storage.data), title='storage')) elif action == 'default': pprint(contract.storage.dummy()) else: assert False, action