Skip to content

Commit 5bdc078

Browse files
authored
Merge pull request #864 from graphprotocol/pcv/require-epoch-for-collect
feat: remove asset holder allowlist, with additional fixes
2 parents 1570a49 + afe7f9f commit 5bdc078

27 files changed

+470
-187
lines changed
Binary file not shown.

config/graph.arbitrum-goerli.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ contracts:
123123
- fn: "setSlasher"
124124
slasher: "${{DisputeManager.address}}"
125125
allowed: true
126-
- fn: "setAssetHolder"
127-
assetHolder: "${{AllocationExchange.address}}"
128-
allowed: true
129126
- fn: "syncAllContracts"
130127
RewardsManager:
131128
proxy: true

config/graph.arbitrum-localhost.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ contracts:
123123
- fn: "setSlasher"
124124
slasher: "${{DisputeManager.address}}"
125125
allowed: true
126-
- fn: "setAssetHolder"
127-
assetHolder: "${{AllocationExchange.address}}"
128-
allowed: true
129126
- fn: "syncAllContracts"
130127
RewardsManager:
131128
proxy: true

config/graph.arbitrum-one.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ contracts:
123123
- fn: "setSlasher"
124124
slasher: "${{DisputeManager.address}}"
125125
allowed: true
126-
- fn: "setAssetHolder"
127-
assetHolder: "${{AllocationExchange.address}}"
128-
allowed: true
129126
- fn: "syncAllContracts"
130127
RewardsManager:
131128
proxy: true

config/graph.goerli.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ contracts:
126126
- fn: "setSlasher"
127127
slasher: "${{DisputeManager.address}}"
128128
allowed: true
129-
- fn: "setAssetHolder"
130-
assetHolder: "${{AllocationExchange.address}}"
131-
allowed: true
132129
- fn: "syncAllContracts"
133130
RewardsManager:
134131
proxy: true

config/graph.localhost.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,6 @@ contracts:
131131
- fn: "setSlasher"
132132
slasher: "${{DisputeManager.address}}"
133133
allowed: true
134-
- fn: "setAssetHolder"
135-
assetHolder: "${{AllocationExchange.address}}"
136-
allowed: true
137134
- fn: "syncAllContracts"
138135
RewardsManager:
139136
proxy: true

config/graph.mainnet.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ contracts:
126126
- fn: "setSlasher"
127127
slasher: "${{DisputeManager.address}}"
128128
allowed: true
129-
- fn: "setAssetHolder"
130-
assetHolder: "${{AllocationExchange.address}}"
131-
allowed: true
132129
- fn: "syncAllContracts"
133130
RewardsManager:
134131
proxy: true

contracts/l2/curation/IL2Curation.sol

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,17 @@ interface IL2Curation {
2929
external
3030
view
3131
returns (uint256);
32+
33+
/**
34+
* @notice Calculate the amount of tokens that would be recovered if minting signal with
35+
* the input tokens and then burning it. This can be used to compute rounding error.
36+
* This function does not account for curation tax.
37+
* @param _subgraphDeploymentID Subgraph deployment for which to mint signal
38+
* @param _tokensIn Amount of tokens used to mint signal
39+
* @return Amount of tokens that would be recovered after minting and burning signal
40+
*/
41+
function tokensToSignalToTokensNoTax(bytes32 _subgraphDeploymentID, uint256 _tokensIn)
42+
external
43+
view
44+
returns (uint256);
3245
}

contracts/l2/curation/L2Curation.sol

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,28 @@ contract L2Curation is CurationV2Storage, GraphUpgradeable, IL2Curation {
421421
return _tokensToSignal(_subgraphDeploymentID, _tokensIn);
422422
}
423423

424+
/**
425+
* @notice Calculate the amount of tokens that would be recovered if minting signal with
426+
* the input tokens and then burning it. This can be used to compute rounding error.
427+
* This function does not account for curation tax.
428+
* @param _subgraphDeploymentID Subgraph deployment for which to mint signal
429+
* @param _tokensIn Amount of tokens used to mint signal
430+
* @return Amount of tokens that would be recovered after minting and burning signal
431+
*/
432+
function tokensToSignalToTokensNoTax(bytes32 _subgraphDeploymentID, uint256 _tokensIn)
433+
external
434+
view
435+
override
436+
returns (uint256)
437+
{
438+
require(_tokensIn != 0, "Can't calculate with 0 tokens");
439+
uint256 signal = _tokensToSignal(_subgraphDeploymentID, _tokensIn);
440+
CurationPool memory curationPool = pools[_subgraphDeploymentID];
441+
uint256 poolSignalAfter = getCurationPoolSignal(_subgraphDeploymentID).add(signal);
442+
uint256 poolTokensAfter = curationPool.tokens.add(_tokensIn);
443+
return poolTokensAfter.mul(signal).div(poolSignalAfter);
444+
}
445+
424446
/**
425447
* @notice Calculate number of tokens to get when burning signal from a curation pool.
426448
* @param _subgraphDeploymentID Subgraph deployment for which to burn signal

contracts/l2/discovery/IL2GNS.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,11 @@ interface IL2GNS is ICallhookReceiver {
4646
* @return L2 subgraph ID
4747
*/
4848
function getAliasedL2SubgraphID(uint256 _l1SubgraphID) external pure returns (uint256);
49+
50+
/**
51+
* @notice Return the unaliased L1 subgraph ID from a transferred L2 subgraph ID
52+
* @param _l2SubgraphID L2 subgraph ID
53+
* @return L1subgraph ID
54+
*/
55+
function getUnaliasedL1SubgraphID(uint256 _l2SubgraphID) external pure returns (uint256);
4956
}

0 commit comments

Comments
 (0)