Azure-Samples / Azure-Samples/blockchain

Bug report in simple-marketplace smart contract

Open
#281 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
837
Forks
681
PR merge metrics
No merged PRs in 30d

Description

* AcceptOffer does not satisfy its specifications.
https://github.com/Azure-Samples/blockchain/blob/1b712d6d05cca8da17bdd1894de8c3d25905685d/blockchain-workbench/application-and-smart-contract-samples/simple-marketplace/ethereum/SimpleMarketplace.sol#L65-L73

As documented by its following specification, AcceptOffer is only available when at OfferPlaced state.
https://github.com/Azure-Samples/blockchain/blob/1b712d6d05cca8da17bdd1894de8c3d25905685d/blockchain-workbench/application-and-smart-contract-samples/simple-marketplace/ethereum/SimpleMarketplace.json#L139-L163

* Bug repair.
We can fix such bug by adding statements:
```solidity
function AcceptOffer() public
{
// Fix
if ( State != StateType.OfferPlaced ){
revert();
}
...
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.