Пример #1
0
    def insert_push_integer(self, i):
        """

        :param i:
        :return:
        """
        if i == 0:
            return self.insert1(VMOp.PUSH0)
        elif i == -1:
            return self.insert1(VMOp.PUSHM1)
        elif i > 0 and i <= 16:
            out = 0x50 + i
            return self.insert1(out)

        bigint = BigInteger(i)
        outdata = bigint.ToByteArray()

        return self.insert_push_data(outdata)
Пример #2
0
    def update_push_integer(self, vmtoken, i):
        """

        :param vmtoken:
        :param i:
        :return:
        """
        if i == 0:
            return self.update1(vmtoken, VMOp.PUSH0)
        elif i == -1:
            return self.insert1(vmtoken, VMOp.PUSHM1)
        elif i > 0 and i <= 16:
            out = 0x50 + i
            return self.update1(vmtoken, out)

        bigint = BigInteger(i)
        outdata = bigint.ToByteArray()

        return self.update_push_data(vmtoken, outdata)
Пример #3
0
    def convert_push_integer(self, i, py_token=None):
        """

        :param i:
        :param py_token:
        :return:
        """
        if i == 0:
            return self.convert1(VMOp.PUSH0, py_token=py_token)
        elif i == -1:
            return self.convert1(VMOp.PUSHM1, py_token=py_token)
        elif i > 0 and i <= 16:
            out = 0x50 + i
            return self.convert1(out, py_token=py_token)

        bigint = BigInteger(i)

        outdata = bigint.ToByteArray()

        return self.convert_push_data(outdata, py_token=py_token)