0
votes

I have created a smart contract template which acts as a submission form for complaints, eg. pothole on 3rd street.

A user will fill out only basic fields in the smart contract, eg Name, Address, etc (just hashes of course) and severity of the issue. On submission, a template smart contract will be called requesting payment if issue is valid for the severity level. Then the body in charge of maintenance can only sign and validate the contract if they pay the amount correlated to the severity level and nothing less.

I have not created the payment processing yet because from my understanding of Ethereum Smart Contracts, it is not possible to directly request money in the smart contract. Is there a workaround I can use to not have to draft hundreds of smart contracts with hard coded amounts?

I wanted to know if there was some way to force the Maintenance party to move a predetermined amount of Ether on their contract signature. This while keeping a single Smart Contract template that does not hold Ether and is also flexible on payment amount but forces a predetermined amount.

Here is a real world example. Susan reports a level 5 issue to maintenance that is advertised as paying $20. Smart contract is created from template for $20. Maintenance sees the issues as valid and accepts the contract and has to pay exactly $20.

1
I could be misunderstanding but I believe that's what payable methods are for? Make them pay to call an acceptIssue() method.foba
I didn't think of it that way. That just might work! I'll research payable methods and report back if its possible. If its a function, I would be able to use a non-hardcoded variable correct?memphis

1 Answers

0
votes

From your example, You Need to make a distributted application and use the web3 Libraray to interact with the smart contract. So in your scenerio Susan report the issue and also provide the total amount to be charged. For more genralize Approach, you can also attach the etereum account address with the payment so when that particular account interact with Smart Contract it will only show the relevant amount to be paid and maintenance will initiate the Transaction through the distributted application.