Skip to content

Commit 98c5cb0

Browse files
committed
curation: use token utils for transfers
1 parent bc54608 commit 98c5cb0

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

contracts/curation/Curation.sol

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import "@openzeppelin/contracts/proxy/Clones.sol";
88

99
import "../bancor/BancorFormula.sol";
1010
import "../upgrades/GraphUpgradeable.sol";
11+
import "../utils/TokenUtils.sol";
1112

1213
import "./CurationStorage.sol";
1314
import "./ICuration.sol";
@@ -242,18 +243,12 @@ contract Curation is CurationV1Storage, GraphUpgradeable {
242243
_updateRewards(_subgraphDeploymentID);
243244

244245
// Transfer tokens from the curator to this contract
245-
// This needs to happen after _updateRewards snapshot as that function
246+
// Burn the curation tax
247+
// NOTE: This needs to happen after _updateRewards snapshot as that function
246248
// is using balanceOf(curation)
247-
IGraphToken graphToken = graphToken();
248-
require(
249-
graphToken.transferFrom(curator, address(this), _tokensIn),
250-
"Cannot transfer tokens to deposit"
251-
);
252-
253-
// Burn withdrawal fees
254-
if (curationTax > 0) {
255-
graphToken.burn(curationTax);
256-
}
249+
IGraphToken _graphToken = graphToken();
250+
TokenUtils.pullTokens(_graphToken, curator, _tokensIn);
251+
TokenUtils.burnTokens(_graphToken, curationTax);
257252

258253
// Update curation pool
259254
curationPool.tokens = curationPool.tokens.add(_tokensIn.sub(curationTax));
@@ -306,7 +301,7 @@ contract Curation is CurationV1Storage, GraphUpgradeable {
306301
}
307302

308303
// Return the tokens to the curator
309-
require(graphToken().transfer(curator, tokensOut), "Error sending curator tokens");
304+
TokenUtils.pushTokens(graphToken(), curator, tokensOut);
310305

311306
emit Burned(curator, _subgraphDeploymentID, tokensOut, _signalIn);
312307

0 commit comments

Comments
 (0)