- AcceptOffer does not satisfy its specifications.
|
function AcceptOffer() public |
|
{ |
|
if ( msg.sender != InstanceOwner ) |
|
{ |
|
revert(); |
|
} |
|
|
|
State = StateType.Accepted; |
|
} |
As documented by its following specification, AcceptOffer is only available when at OfferPlaced state.
|
{ |
|
"Name": "OfferPlaced", |
|
"DisplayName": "Offer Placed", |
|
"Description": "Offer has been placed for the item", |
|
"PercentComplete": 60, |
|
"Style": "Success", |
|
"Transitions": [ |
|
{ |
|
"AllowedRoles": [ ], |
|
"AllowedInstanceRoles": [ "InstanceOwner" ], |
|
"Description": "Accept the proposed offer for the item", |
|
"Function": "AcceptOffer", |
|
"NextStates": [ "Accepted" ], |
|
"DisplayName": "Accept Offer" |
|
}, |
|
{ |
|
"AllowedRoles": [ ], |
|
"AllowedInstanceRoles": [ "InstanceOwner" ], |
|
"Description": "Reject the proposed offer for the item", |
|
"Function": "Reject", |
|
"NextStates": [ "ItemAvailable" ], |
|
"DisplayName": "Reject" |
|
} |
|
] |
|
}, |
- Bug repair.
We can fix such bug by adding statements:
function AcceptOffer() public
{
// Fix
if ( State != StateType.OfferPlaced ){
revert();
}
...
blockchain/blockchain-workbench/application-and-smart-contract-samples/simple-marketplace/ethereum/SimpleMarketplace.sol
Lines 65 to 73 in 1b712d6
As documented by its following specification, AcceptOffer is only available when at OfferPlaced state.
blockchain/blockchain-workbench/application-and-smart-contract-samples/simple-marketplace/ethereum/SimpleMarketplace.json
Lines 139 to 163 in 1b712d6
We can fix such bug by adding statements: