Open Ro5s opened 5 years ago
Realizing that these issue descriptions are pretty terrible. If any bnty-seekers stumble by here, hope you tolerate this kind of salad and such
Hi Ross, I've read some of your medium articles and really like the work you're doing. I agree that the bill of sale contract needs to have an abort() function but I think there needs to be a way to prevent a buyer from taking back the money after receiving their goods/service. I think there needs to be an additional state that flips who gets to call the abort function.
So the buyer can call abort anytime before the product has shipped and only the seller may call it after the product has shipped. So I think there would be 4 states: 'initialized', 'shipped', 'received', 'cancelled'.
Then your abort function can look something like this:
function abort() external { require((state == 'initialized' && msg.sender == buyer) || (state == 'shipped' && msg.sender == seller)); state = 'cancelled'; buyer.transfer(address(this).balance); emit Aborted(); }
Let me know your thoughts. Regards.
P.S. Have you ever looked into Kleros for on-chain dispute resolution?
HI @PeterMPhillips,
Thank you kindly for reviewing my code (& for your nice comments, to boot)! 🙌
So, to add this fix, I would basically need to associate emits (e.g., 'initialized' when recordContract function called.....)?
I am on the road, but really look forward to testing this out! Thanks again
(Also, I have not looked into Kleros, will check that out as well)
Exactly. When recordContract() is called, set state = 'initialized';
When confirmReceipt() is called, set state = 'received';
You would also need a function for the seller to call when the product is shipped: function confirmShipped(){ require(msg.sender == seller); state = 'shipped'; emit Shipped(now); }
event Shipped(uint timestamp);
Oh, btw @PeterMPhillips, feel free to claim this bounty for BRLN (commemorative curioso from EthBerlin event..): https://explorer.bounties.network/bounty/2239
Something like this: /// Abort the promise and reclaim the ether collateral. /// Can only be called by the promisor before /// the contract is locked. function abort() public onlyPromisor inState(State.Created) { emit Aborted(); state = State.Inactive; promisor.transfer(address(this).balance); }