function proposeAsset(string _data, uint _husbandAllocation, uint _wifeAllocation) external onlySpouse isSigned isNotDivorced { require(isSameString(_data, ""), "No asset data provided!"); require(_husbandAllocation >= 0, "Husband allocation invalid!"); require(_wifeAllocation >= 0, "Wife allocation invalid!"); require((_husbandAllocation + _wifeAllocation) == 100, "Total allocation must be equal to 100%!"); // Add new asset Asset memory newAsset = Asset({ data: _data, husbandAllocation: _husbandAllocation, wifeAllocation: _wifeAllocation, added: false, removed: false }); uint newAssetId = assets.push(newAsset); emit AssetProposed(now, _data, msg.sender); // Map to a storage object (otherwise mappings could not be accessed) Asset storage asset = assets[newAssetId - 1]; // Instantly approve it by the sender asset.hasApprovedAdd[msg.sender] = true; emit AssetAddApproved(now, _data, msg.sender); }
0.4.19