I have a question. My contract structure involves 2 user at address A and B respectively:

First A trigger the logging method from the contract with B's address as parameter. This will record a mapping from B to A's address in the contract state.

Then B trigger the demand method from the contract. This will send a demand to A's address with an amount that B wanted A to pay. Then A approve or decline the transaction.

I'm having trouble thinking about how to implement this in Solidity.

  1. What data structure should I use to store the mapping from B to A?
  2. Can another pair, C and D, reuse the same contract? If yes, how and will the cost of running the contract increase due to the state mapping?

Also, is there a way to enforce it in the contract such that A must approve and cannot decline the payment?

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.