def genesis_coin_id_for_genesis_coin_checker(
    genesis_coin_checker: Program, ) -> Optional[bytes32]:
    """
    Given a `genesis_coin_checker` program, pull out the genesis coin id.
    """
    r = genesis_coin_checker.uncurry()
    if r is None:
        return r
    f, args = r
    if f != MOD:
        return None
    return args.first().as_atom()
Пример #2
0
def uncurry_cc(puzzle: Program) -> Optional[Tuple[Program, Program, Program]]:
    """
    Take a puzzle and return `None` if it's not a `CC_MOD` cc, or
    a triple of `mod_hash, genesis_coin_checker, inner_puzzle` if it is.
    """
    r = puzzle.uncurry()
    if r is None:
        return r
    inner_f, args = r
    if not is_cc_mod(inner_f):
        return None

    mod_hash, genesis_coin_checker, inner_puzzle = list(args.as_iter())
    return mod_hash, genesis_coin_checker, inner_puzzle
Пример #3
0
def check_is_cc_puzzle(puzzle: Program):
    r = puzzle.uncurry()
    if r is None:
        return False
    inner_f, args = r
    return is_cc_mod(inner_f)