0

Python code:

from web3 import Web3
import json
web = "http://10.0.141.114:8545"
web3 = Web3(Web3.HTTPProvider(web))

abi=json.loads('[ { "constant": false, "inputs": [ { "name": "_cad_number", "type": "uint256" }, { "name": "_num", "type": "uint256" } ], "name": "create_pledge", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x113a5bac" }, { "constant": false, "inputs": [ { "name": "_cad_number", "type": "uint256" } ], "name": "deposit_payment", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x151915b4" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "balances", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x27e235e3" }, { "constant": false, "inputs": [ { "name": "_owneraddress", "type": "address" }, { "name": "_property_cost", "type": "uint256" }, { "name": "_location", "type": "string" }, { "name": "_square_property", "type": "uint256" }, { "name": "_housing_status", "type": "bool" } ], "name": "create_property", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x2c42731a" }, { "constant": false, "inputs": [ { "name": "_value", "type": "uint256" } ], "name": "withdraw", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function", "signature": "0x2e1a7d4d" }, { "constant": false, "inputs": [ { "name": "_CadNumber", "type": "uint256" }, { "name": "access_transfer", "type": "bool" } ], "name": "transfer_money", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x9b84b9eb" }, { "constant": false, "inputs": [ { "name": "_value", "type": "uint256" } ], "name": "deposit", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function", "signature": "0xb6b55f25" }, { "constant": true, "inputs": [ { "name": "_cancel", "type": "bool" } ], "name": "cancel_transfer", "outputs": [ { "name": "", "type": "bool", "value": false } ], "payable": false, "stateMutability": "pure", "type": "function", "signature": "0xbd21da5e" }, { "constant": false, "inputs": [ { "name": "_cad_number", "type": "uint256" } ], "name": "check_pledge", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xc75a92e8" }, { "constant": false, "inputs": [ { "name": "_CadNumber", "type": "uint256" }, { "name": "access_gift", "type": "bool" } ], "name": "gift", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xd674d252" }, { "constant": true, "inputs": [ { "name": "_CadNumber", "type": "uint256" } ], "name": "list_property", "outputs": [ { "name": "", "type": "address", "value": "0x0000000000000000000000000000000000000000" }, { "name": "", "type": "uint256", "value": "0" }, { "name": "", "type": "string", "value": "" }, { "name": "", "type": "uint256", "value": "0" }, { "name": "", "type": "bool", "value": false }, { "name": "", "type": "uint256", "value": "0" }, { "name": "", "type": "uint256", "value": "0" }, { "name": "", "type": "bool", "value": false }, { "name": "", "type": "bool", "value": false } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xde6c1239" } ]')
address=web3.toChecksumAddress("0x023F0EB0522887E06A21B0945Ff4657A45C3FDC9")
Property= web3.eth.contract(abi=abi, address=address)
transfer=Property.functions.transfer_money(256,True)
transfer.transact()

Solidity Code:

function transfer_money(uint256 _CadNumber) public{
        InfoProperty storage Property_Info = propertys[_CadNumber];
        InfoSales storage Transfer_Money = sales[Property_Info.cad_number];

        if (Property_Info.selling != true) revert();
        if (Property_Info.pledge != false) revert();
        if (Property_Info.owneraddress == msg.sender) revert();
        if (balances[msg.sender] < Property_Info.property_cost) revert();

        balances[msg.sender] -= Property_Info.property_cost;
        Transfer_Money.buyer = msg.sender;
        access = true;
        balances[Transfer_Money.owneraddress] += Property_Info.property_cost;
        prop_id = _CadNumber;
    }

enter image description here

  • Comments are not for extended discussion; this conversation has been moved to chat. – eth Dec 5 '19 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.