def execute(cls, stack: MichelsonStack, stdout: List[str], context: AbstractContext): key, src = cast(Tuple[MichelsonType, Union[SetType, MapType, BigMapType]], stack.pop2()) src.assert_type_in(MapType, BigMapType, SetType) res = BoolType.from_value(src.contains(key)) stack.push(res) stdout.append(format_stdout(cls.prim, [key, src], [res])) return cls()
def execute(cls, stack: 'MichelsonStack', stdout: List[str], context: AbstractContext): points = cast(ListType, stack.pop1()) points.assert_type_equal( ListType.create_type(args=[ PairType.create_type(args=[BLS12_381_G1Type, BLS12_381_G2Type]) ])) prod = FQ12.one() for pair in points: g1, g2 = tuple( iter(pair)) # type: BLS12_381_G1Type, BLS12_381_G2Type prod = prod * bls12_381.pairing(g2.to_point(), g1.to_point()) res = BoolType.from_value(FQ12.one() == prod) stack.push(res) stdout.append(format_stdout(cls.prim, [points], [res])) return cls()