From 321c29b98ce1f1b6495da8e6ca4832a25cd6c154 Mon Sep 17 00:00:00 2001 From: Ariel Barmat Date: Sat, 30 Oct 2021 22:01:36 +0100 Subject: [PATCH] fix: validate nSignalToTokens reverting when subgraph is not published --- contracts/discovery/GNS.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/discovery/GNS.sol b/contracts/discovery/GNS.sol index b5527e685..3fdeaff33 100644 --- a/contracts/discovery/GNS.sol +++ b/contracts/discovery/GNS.sol @@ -540,7 +540,9 @@ contract GNS is GNSV2Storage, GraphUpgradeable, IGNS, Multicall { override returns (uint256, uint256) { - SubgraphData storage subgraphData = _getSubgraphData(_subgraphID); + // Get subgraph or revert if not published + // It does not make sense to convert signal from a disabled or non-existing one + SubgraphData storage subgraphData = _getSubgraphOrRevert(_subgraphID); uint256 vSignal = nSignalToVSignal(_subgraphID, _nSignalIn); uint256 tokensOut = curation().signalToTokens(subgraphData.subgraphDeploymentID, vSignal); return (vSignal, tokensOut);