Ejemplo n.º 1
0
 def test_parse_log(self, node: Node):
     with patch.object(Session, "post", side_effect=self.post):
         contract = Contract(
             node, "0x6361d0441973eb4457d2f8092bbbe303db5eb0f981")
         logs = contract.fetch(
             "6d1240e174059991087b43250caa920f559cff16d32863be75f02a1a0d781992"
         )
         logs.to_dict()
Ejemplo n.º 2
0
    # transfer asset from contract
    assert contract.execute("transfer", [node.address, 100 * constant.COIN]).check() is constant.SUCCESS
    assert node.balance(asset=asset_type) == 100 * constant.COIN
    # check contract balance
    assert contract.read("checkBalance") == 9900 * constant.COIN
    # transfer to other address
    assert node.send(AccountFactory.new().address, 1 * constant.COIN, asset_type).check() is constant.SUCCESS
    # check balance
    assert node.balance(asset=asset_type) == 99 * constant.COIN
    # burn
    assert contract.execute("burn", asset_value=98 * constant.COIN, asset_type=asset_type).check() is constant.SUCCESS
    # check balance
    assert node.balance(asset=asset_type) == 1 * constant.COIN

    assert contract.read("voteValues", [88]) == 0
    tx = contract.vote("vote", [88], asset_type=asset_type)
    assert tx.check() is constant.SUCCESS
    # check balance
    assert node.balance(asset=asset_type) == 1 * constant.COIN
    logs = contract.fetch(tx.id)
    # fetch logs
    print(logs)
    assert contract.read("voteValues", [88]) == 1 * constant.COIN