Skip to content

Commit c4b39d2

Browse files
committed
fix: rename L2 migration to transfer in Staking
1 parent bc506ba commit c4b39d2

14 files changed

+323
-306
lines changed

contracts/l2/staking/IL2Staking.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { IL2StakingBase } from "./IL2StakingBase.sol";
1010
* @title Interface for the L2 Staking contract
1111
* @notice This is the interface that should be used when interacting with the L2 Staking contract.
1212
* It extends the IStaking interface with the functions that are specific to L2, adding the callhook receiver
13-
* to receive migrated stake and delegation from L1.
13+
* to receive transferred stake and delegation from L1.
1414
* @dev Note that L2Staking doesn't actually inherit this interface. This is because of
1515
* the custom setup of the Staking contract where part of the functionality is implemented
1616
* in a separate contract (StakingExtension) to which calls are delegated through the fallback function.

contracts/l2/staking/IL2StakingBase.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ICallhookReceiver } from "../../gateway/ICallhookReceiver.sol";
1010
* @dev Note it includes only the L2-specific functionality, not the full IStaking interface.
1111
*/
1212
interface IL2StakingBase is ICallhookReceiver {
13-
event MigratedDelegationReturnedToDelegator(
13+
event TransferredDelegationReturnedToDelegator(
1414
address indexed indexer,
1515
address indexed delegator,
1616
uint256 amount

contracts/l2/staking/L2Staking.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ contract L2Staking is Staking, IL2StakingBase {
127127
if (shares == 0) {
128128
// If no shares would be issued (probably a rounding issue or attack), return the tokens to the delegator
129129
graphToken().transfer(_delegationData.delegator, _amount);
130-
emit MigratedDelegationReturnedToDelegator(
130+
emit TransferredDelegationReturnedToDelegator(
131131
_delegationData.indexer,
132132
_delegationData.delegator,
133133
_amount

contracts/staking/IL1GraphTokenLockMigrator.sol renamed to contracts/staking/IL1GraphTokenLockTransferTool.sol

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ pragma solidity >=0.6.12 <0.8.0;
44
pragma abicoder v2;
55

66
/**
7-
* @title Interface for the L1GraphTokenLockMigrator contract
8-
* @dev This interface defines the function to get the migrated wallet address for a given L1 token lock wallet.
9-
* The migrator contract is implemented in the token-distribution repo: https://github.com/graphprotocol/token-distribution/pull/64
10-
* and is only included here to provide support in L1Staking for the migration of stake and delegation
11-
* owned by token lock contracts. See GIP-0046 for details: https://forum.thegraph.com/t/gip-0046-l2-migration-helpers/4023
7+
* @title Interface for the L1GraphTokenLockTransferTool contract
8+
* @dev This interface defines the function to get the L2 wallet address for a given L1 token lock wallet.
9+
* The Transfer Tool contract is implemented in the token-distribution repo: https://github.com/graphprotocol/token-distribution/pull/64
10+
* and is only included here to provide support in L1Staking for the transfer of stake and delegation
11+
* owned by token lock contracts. See GIP-0046 for details: https://forum.thegraph.com/t/4023
1212
*/
13-
interface IL1GraphTokenLockMigrator {
13+
interface IL1GraphTokenLockTransferTool {
1414
/**
1515
* @notice Pulls ETH from an L1 wallet's account to use for L2 ticket gas.
1616
* @dev This function is only callable by the staking contract.
1717
* @param _l1Wallet Address of the L1 token lock wallet
18-
* @param _amount Amount of ETH to pull from the migrator contract
18+
* @param _amount Amount of ETH to pull from the transfer tool contract
1919
*/
2020
function pullETH(address _l1Wallet, uint256 _amount) external;
2121

2222
/**
2323
* @notice Get the L2 token lock wallet address for a given L1 token lock wallet
24-
* @dev In the actual L1GraphTokenLockMigrator contract, this is simply the default getter for a public mapping variable.
24+
* @dev In the actual L1GraphTokenLockTransferTool contract, this is simply the default getter for a public mapping variable.
2525
* @param _l1Wallet Address of the L1 token lock wallet
2626
* @return Address of the L2 token lock wallet if the wallet has an L2 counterpart, or address zero if
2727
* the wallet doesn't have an L2 counterpart (or is not known to be a token lock wallet).
2828
*/
29-
function migratedWalletAddress(address _l1Wallet) external view returns (address);
29+
function l2WalletAddress(address _l1Wallet) external view returns (address);
3030
}

contracts/staking/IL1Staking.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { IL1StakingBase } from "./IL1StakingBase.sol";
99
/**
1010
* @title Interface for the L1 Staking contract
1111
* @notice This is the interface that should be used when interacting with the L1 Staking contract.
12-
* It extends the IStaking interface with the functions that are specific to L1, adding the migration helpers
12+
* It extends the IStaking interface with the functions that are specific to L1, adding the transfer tools
1313
* to send stake and delegation to L2.
1414
* @dev Note that L1Staking doesn't actually inherit this interface. This is because of
1515
* the custom setup of the Staking contract where part of the functionality is implemented

contracts/staking/IL1StakingBase.sol

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,63 @@
33
pragma solidity >=0.6.12 <0.8.0;
44
pragma abicoder v2;
55

6-
import { IL1GraphTokenLockMigrator } from "./IL1GraphTokenLockMigrator.sol";
6+
import { IL1GraphTokenLockTransferTool } from "./IL1GraphTokenLockTransferTool.sol";
77

88
/**
99
* @title Base interface for the L1Staking contract.
10-
* @notice This interface is used to define the migration helpers that are implemented in L1Staking.
10+
* @notice This interface is used to define the transfer tools that are implemented in L1Staking.
1111
* @dev Note it includes only the L1-specific functionality, not the full IStaking interface.
1212
*/
1313
interface IL1StakingBase {
14-
/// @dev Emitted when an indexer migrates their stake to L2.
15-
/// This can happen several times as indexers can migrate partial stake.
16-
event IndexerMigratedToL2(
14+
/// @dev Emitted when an indexer transfers their stake to L2.
15+
/// This can happen several times as indexers can transfer partial stake.
16+
event IndexerStakeTransferredToL2(
1717
address indexed indexer,
1818
address indexed l2Indexer,
19-
uint256 migratedStakeTokens
19+
uint256 transferredStakeTokens
2020
);
2121

22-
/// @dev Emitted when a delegator migrates their delegation to L2
23-
event DelegationMigratedToL2(
22+
/// @dev Emitted when a delegator transfers their delegation to L2
23+
event DelegationTransferredToL2(
2424
address indexed delegator,
2525
address indexed l2Delegator,
2626
address indexed indexer,
2727
address l2Indexer,
28-
uint256 migratedDelegationTokens
28+
uint256 transferredDelegationTokens
2929
);
3030

31-
/// @dev Emitted when the L1GraphTokenLockMigrator is set
32-
event L1GraphTokenLockMigratorSet(address l1GraphTokenLockMigrator);
31+
/// @dev Emitted when the L1GraphTokenLockTransferTool is set
32+
event L1GraphTokenLockTransferToolSet(address l1GraphTokenLockTransferTool);
3333

34-
/// @dev Emitted when a delegator unlocks their tokens ahead of time because the indexer has migrated
35-
event StakeDelegatedUnlockedDueToMigration(address indexed indexer, address indexed delegator);
34+
/// @dev Emitted when a delegator unlocks their tokens ahead of time because the indexer has transferred to L2
35+
event StakeDelegatedUnlockedDueToL2Transfer(address indexed indexer, address indexed delegator);
3636

3737
/**
38-
* @notice Set the L1GraphTokenLockMigrator contract address
38+
* @notice Set the L1GraphTokenLockTransferTool contract address
3939
* @dev This function can only be called by the governor.
40-
* @param _l1GraphTokenLockMigrator Address of the L1GraphTokenLockMigrator contract
40+
* @param _l1GraphTokenLockTransferTool Address of the L1GraphTokenLockTransferTool contract
4141
*/
42-
function setL1GraphTokenLockMigrator(IL1GraphTokenLockMigrator _l1GraphTokenLockMigrator)
43-
external;
42+
function setL1GraphTokenLockTransferTool(
43+
IL1GraphTokenLockTransferTool _l1GraphTokenLockTransferTool
44+
) external;
4445

4546
/**
4647
* @notice Send an indexer's stake to L2.
4748
* @dev This function can only be called by the indexer (not an operator).
4849
* It will validate that the remaining stake is sufficient to cover all the allocated
49-
* stake, so the indexer might have to close some allocations before migrating.
50+
* stake, so the indexer might have to close some allocations before transferring.
5051
* It will also check that the indexer's stake is not locked for withdrawal.
5152
* Since the indexer address might be an L1-only contract, the function takes a beneficiary
5253
* address that will be the indexer's address in L2.
5354
* The caller must provide an amount of ETH to use for the L2 retryable ticket, that
5455
* must be at least `_maxSubmissionCost + _gasPriceBid * _maxGas`.
55-
* @param _l2Beneficiary Address of the indexer in L2. If the indexer has previously migrated stake, this must match the previously-used value.
56-
* @param _amount Amount of stake GRT to migrate to L2
56+
* @param _l2Beneficiary Address of the indexer in L2. If the indexer has previously transferred stake, this must match the previously-used value.
57+
* @param _amount Amount of stake GRT to transfer to L2
5758
* @param _maxGas Max gas to use for the L2 retryable ticket
5859
* @param _gasPriceBid Gas price bid for the L2 retryable ticket
5960
* @param _maxSubmissionCost Max submission cost for the L2 retryable ticket
6061
*/
61-
function migrateStakeToL2(
62+
function transferStakeToL2(
6263
address _l2Beneficiary,
6364
uint256 _amount,
6465
uint256 _maxGas,
@@ -70,20 +71,20 @@ interface IL1StakingBase {
7071
* @notice Send an indexer's stake to L2, from a GraphTokenLockWallet vesting contract.
7172
* @dev This function can only be called by the indexer (not an operator).
7273
* It will validate that the remaining stake is sufficient to cover all the allocated
73-
* stake, so the indexer might have to close some allocations before migrating.
74+
* stake, so the indexer might have to close some allocations before transferring.
7475
* It will also check that the indexer's stake is not locked for withdrawal.
75-
* The L2 beneficiary for the stake will be determined by calling the L1GraphTokenLockMigrator contract,
76-
* so the caller must have previously migrated tokens through that first
77-
* (see GIP-0046 for details: https://forum.thegraph.com/t/gip-0046-l2-migration-helpers/4023).
78-
* The ETH for the L2 gas will be pulled from the L1GraphTokenLockMigrator, so the owner of
76+
* The L2 beneficiary for the stake will be determined by calling the L1GraphTokenLockTransferTool contract,
77+
* so the caller must have previously transferred tokens through that first
78+
* (see GIP-0046 for details: https://forum.thegraph.com/t/4023).
79+
* The ETH for the L2 gas will be pulled from the L1GraphTokenLockTransferTool, so the owner of
7980
* the GraphTokenLockWallet must have previously deposited at least `_maxSubmissionCost + _gasPriceBid * _maxGas`
80-
* ETH into the L1GraphTokenLockMigrator contract (using its depositETH function).
81-
* @param _amount Amount of stake GRT to migrate to L2
81+
* ETH into the L1GraphTokenLockTransferTool contract (using its depositETH function).
82+
* @param _amount Amount of stake GRT to transfer to L2
8283
* @param _maxGas Max gas to use for the L2 retryable ticket
8384
* @param _gasPriceBid Gas price bid for the L2 retryable ticket
8485
* @param _maxSubmissionCost Max submission cost for the L2 retryable ticket
8586
*/
86-
function migrateLockedStakeToL2(
87+
function transferLockedStakeToL2(
8788
uint256 _amount,
8889
uint256 _maxGas,
8990
uint256 _gasPriceBid,
@@ -93,19 +94,19 @@ interface IL1StakingBase {
9394
/**
9495
* @notice Send a delegator's delegated tokens to L2
9596
* @dev This function can only be called by the delegator.
96-
* This function will validate that the indexer has migrated their stake using migrateStakeToL2,
97+
* This function will validate that the indexer has transferred their stake using transferStakeToL2,
9798
* and that the delegation is not locked for undelegation.
9899
* Since the delegator's address might be an L1-only contract, the function takes a beneficiary
99100
* address that will be the delegator's address in L2.
100101
* The caller must provide an amount of ETH to use for the L2 retryable ticket, that
101102
* must be at least `_maxSubmissionCost + _gasPriceBid * _maxGas`.
102-
* @param _indexer Address of the indexer (in L1, before migrating)
103+
* @param _indexer Address of the indexer (in L1, before transferring to L2)
103104
* @param _l2Beneficiary Address of the delegator in L2
104105
* @param _maxGas Max gas to use for the L2 retryable ticket
105106
* @param _gasPriceBid Gas price bid for the L2 retryable ticket
106107
* @param _maxSubmissionCost Max submission cost for the L2 retryable ticket
107108
*/
108-
function migrateDelegationToL2(
109+
function transferDelegationToL2(
109110
address _indexer,
110111
address _l2Beneficiary,
111112
uint256 _maxGas,
@@ -116,34 +117,34 @@ interface IL1StakingBase {
116117
/**
117118
* @notice Send a delegator's delegated tokens to L2, for a GraphTokenLockWallet vesting contract
118119
* @dev This function can only be called by the delegator.
119-
* This function will validate that the indexer has migrated their stake using migrateStakeToL2,
120+
* This function will validate that the indexer has transferred their stake using transferStakeToL2,
120121
* and that the delegation is not locked for undelegation.
121-
* The L2 beneficiary for the delegation will be determined by calling the L1GraphTokenLockMigrator contract,
122-
* so the caller must have previously migrated tokens through that first
123-
* (see GIP-0046 for details: https://forum.thegraph.com/t/gip-0046-l2-migration-helpers/4023).
124-
* The ETH for the L2 gas will be pulled from the L1GraphTokenLockMigrator, so the owner of
122+
* The L2 beneficiary for the delegation will be determined by calling the L1GraphTokenLockTransferTool contract,
123+
* so the caller must have previously transferred tokens through that first
124+
* (see GIP-0046 for details: https://forum.thegraph.com/t/4023).
125+
* The ETH for the L2 gas will be pulled from the L1GraphTokenLockTransferTool, so the owner of
125126
* the GraphTokenLockWallet must have previously deposited at least `_maxSubmissionCost + _gasPriceBid * _maxGas`
126-
* ETH into the L1GraphTokenLockMigrator contract (using its depositETH function).
127-
* @param _indexer Address of the indexer (in L1, before migrating)
127+
* ETH into the L1GraphTokenLockTransferTool contract (using its depositETH function).
128+
* @param _indexer Address of the indexer (in L1, before transferring to L2)
128129
* @param _maxGas Max gas to use for the L2 retryable ticket
129130
* @param _gasPriceBid Gas price bid for the L2 retryable ticket
130131
* @param _maxSubmissionCost Max submission cost for the L2 retryable ticket
131132
*/
132-
function migrateLockedDelegationToL2(
133+
function transferLockedDelegationToL2(
133134
address _indexer,
134135
uint256 _maxGas,
135136
uint256 _gasPriceBid,
136137
uint256 _maxSubmissionCost
137138
) external;
138139

139140
/**
140-
* @notice Unlock a delegator's delegated tokens, if the indexer has migrated
141+
* @notice Unlock a delegator's delegated tokens, if the indexer has transferred to L2
141142
* @dev This function can only be called by the delegator.
142-
* This function will validate that the indexer has migrated their stake using migrateStakeToL2,
143+
* This function will validate that the indexer has transferred their stake using transferStakeToL2,
143144
* and that the indexer has no remaining stake in L1.
144145
* The tokens must previously be locked for undelegation by calling `undelegate()`,
145146
* and can be withdrawn with `withdrawDelegated()` immediately after calling this.
146-
* @param _indexer Address of the indexer (in L1, before migrating)
147+
* @param _indexer Address of the indexer (in L1, before transferring to L2)
147148
*/
148-
function unlockDelegationToMigratedIndexer(address _indexer) external;
149+
function unlockDelegationToTransferredIndexer(address _indexer) external;
149150
}

0 commit comments

Comments
 (0)