From 4805add080bbb6c4be33245f1f6505640b01c25b Mon Sep 17 00:00:00 2001 From: andytudhope Date: Wed, 29 May 2019 11:34:38 +0200 Subject: [PATCH] Adds withdrawMax view function for use in UI --- contracts/Discover.sol | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/contracts/Discover.sol b/contracts/Discover.sol index 43d0b46..c3cbdcb 100644 --- a/contracts/Discover.sol +++ b/contracts/Discover.sol @@ -96,6 +96,17 @@ contract Discover is ApproveAndCallFallBack, BancorFormula { _downvote(msg.sender, _id, _amount); } + /** + * @dev Developers can withdraw an amount not more than what was available of the + SNT they originally staked minus what they have already received back in downvotes. + * @param _id bytes32 unique identifier. + * @return max SNT that can be withdrawn == available SNT for DApp. + */ + function withdrawMax(bytes32 _id) external view returns(uint) { + Data storage d = _getDAppById(_id); + return d.available; + } + /** * @dev Developers can withdraw an amount not more than what was available of the SNT they originally staked minus what they have already received back in downvotes.