Skip to content

Commit c854eca

Browse files
pxrlmrice32nicholaspai
authored
feat: Remove all "USS" references in contracts (#7) (#414)
* improve: Mark functions that are soon to be deprecated post USS deployment (#3) Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: nicholaspai <npai.nyc@gmail.com> * feat: Remove all "USS" references in contracts (#7) --------- Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: nicholaspai <npai.nyc@gmail.com> Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com>
1 parent 2145065 commit c854eca

17 files changed

+358
-354
lines changed

contracts/MerkleLib.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.0;
33

44
import "./interfaces/SpokePoolInterface.sol";
5-
import "./interfaces/USSSpokePoolInterface.sol";
5+
import "./interfaces/V3SpokePoolInterface.sol";
66
import "./interfaces/HubPoolInterface.sol";
77

88
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
@@ -42,9 +42,9 @@ library MerkleLib {
4242
return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));
4343
}
4444

45-
function verifyUSSRelayerRefund(
45+
function verifyV3RelayerRefund(
4646
bytes32 root,
47-
USSSpokePoolInterface.USSRelayerRefundLeaf memory refund,
47+
V3SpokePoolInterface.V3RelayerRefundLeaf memory refund,
4848
bytes32[] memory proof
4949
) internal pure returns (bool) {
5050
return MerkleProof.verify(proof, root, keccak256(abi.encode(refund)));
@@ -66,9 +66,9 @@ library MerkleLib {
6666
return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));
6767
}
6868

69-
function verifyUSSSlowRelayFulfillment(
69+
function verifyV3SlowRelayFulfillment(
7070
bytes32 root,
71-
USSSpokePoolInterface.USSSlowFill memory slowRelayFulfillment,
71+
V3SpokePoolInterface.V3SlowFill memory slowRelayFulfillment,
7272
bytes32[] memory proof
7373
) internal pure returns (bool) {
7474
return MerkleProof.verify(proof, root, keccak256(abi.encode(slowRelayFulfillment)));

contracts/Polygon_SpokePool.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool, CircleCCTPAdapter
187187
* This might make the L2 -> L1 message fail due to exceeding the L1 calldata limit.
188188
*/
189189

190-
function executeUSSRelayerRefundLeaf(
190+
function executeV3RelayerRefundLeaf(
191191
uint32 rootBundleId,
192-
USSRelayerRefundLeaf calldata relayerRefundLeaf,
192+
V3RelayerRefundLeaf calldata relayerRefundLeaf,
193193
bytes32[] calldata proof
194194
) public payable override {
195195
// AddressLibUpgradeable.isContract isn't a sufficient check because it checks the contract code size of
@@ -200,7 +200,7 @@ contract Polygon_SpokePool is IFxMessageProcessor, SpokePool, CircleCCTPAdapter
200200
// Prevent calling recipient contract functions atomically with executing relayer refund leaves.
201201
_revertIfFunctionCalledAtomically(FILL_LOCK_IDENTIFIER);
202202
_setFunctionLock(EXECUTE_LOCK_IDENTIFIER);
203-
super.executeUSSRelayerRefundLeaf(rootBundleId, relayerRefundLeaf, proof);
203+
super.executeV3RelayerRefundLeaf(rootBundleId, relayerRefundLeaf, proof);
204204
}
205205

206206
/// @custom:audit FOLLOWING FUNCTION TO BE DEPRECATED

contracts/SpokePool.sol

Lines changed: 72 additions & 70 deletions
Large diffs are not rendered by default.

contracts/SwapAndBridge.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//SPDX-License-Identifier: Unlicense
22
pragma solidity ^0.8.0;
33

4-
import "./interfaces/USSSpokePoolInterface.sol";
4+
import "./interfaces/V3SpokePoolInterface.sol";
55
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
66
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
77
import "./Lockable.sol";
@@ -18,7 +18,7 @@ contract SwapAndBridgeBase is Lockable, MultiCaller {
1818
bytes4 public constant TRANSFER_FROM_SELECTOR = IERC20.transferFrom.selector;
1919

2020
// Across SpokePool we'll submit deposits to with acrossInputToken as the input token.
21-
USSSpokePoolInterface public immutable spokePool;
21+
V3SpokePoolInterface public immutable spokePool;
2222

2323
// Exchange address or router where the swapping will happen.
2424
address public immutable exchange;
@@ -64,7 +64,7 @@ contract SwapAndBridgeBase is Lockable, MultiCaller {
6464
* @param _spokePool Address of the SpokePool contract that we'll submit deposits to.
6565
* @param _exchange Address of the exchange where tokens will be swapped.
6666
*/
67-
constructor(USSSpokePoolInterface _spokePool, address _exchange) {
67+
constructor(V3SpokePoolInterface _spokePool, address _exchange) {
6868
spokePool = _spokePool;
6969
exchange = _exchange;
7070
}
@@ -132,7 +132,7 @@ contract SwapAndBridgeBase is Lockable, MultiCaller {
132132

133133
// Deposit the swapped tokens into Across and bridge them using remainder of input params.
134134
_acrossInputToken.safeIncreaseAllowance(address(spokePool), returnAmount);
135-
spokePool.depositUSS(
135+
spokePool.depositV3(
136136
depositData.depositor,
137137
depositData.recipient,
138138
address(_acrossInputToken), // input token
@@ -174,7 +174,7 @@ contract SwapAndBridge is SwapAndBridgeBase {
174174
* @param _acrossInputToken Address of the token that will be bridged via Across as the inputToken.
175175
*/
176176
constructor(
177-
USSSpokePoolInterface _spokePool,
177+
V3SpokePoolInterface _spokePool,
178178
address _exchange,
179179
IERC20 _swapToken,
180180
IERC20 _acrossInputToken
@@ -223,7 +223,7 @@ contract UniversalSwapAndBridge is SwapAndBridgeBase {
223223
* @param _spokePool Address of the SpokePool contract that we'll submit deposits to.
224224
* @param _exchange Address of the exchange where tokens will be swapped.
225225
*/
226-
constructor(USSSpokePoolInterface _spokePool, address _exchange) SwapAndBridgeBase(_spokePool, exchange) {}
226+
constructor(V3SpokePoolInterface _spokePool, address _exchange) SwapAndBridgeBase(_spokePool, exchange) {}
227227

228228
/**
229229
* @notice Swaps tokens on this chain via specified router before submitting Across deposit atomically.

contracts/interfaces/USSSpokePoolInterface.sol renamed to contracts/interfaces/V3SpokePoolInterface.sol

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.0;
33

44
// Contains structs and functions used by SpokePool contracts to facilitate universal settlement.
5-
interface USSSpokePoolInterface {
5+
interface V3SpokePoolInterface {
66
/**************************************
77
* ENUMS *
88
**************************************/
@@ -35,7 +35,7 @@ interface USSSpokePoolInterface {
3535
// This data is hashed with the chainId() and saved by the SpokePool to prevent collisions and protect against
3636
// replay attacks on other chains. If any portion of this data differs, the relay is considered to be
3737
// completely distinct.
38-
struct USSRelayData {
38+
struct V3RelayData {
3939
// The address that made the deposit on the origin chain.
4040
address depositor;
4141
// The recipient address on the destination chain.
@@ -63,13 +63,13 @@ interface USSSpokePoolInterface {
6363
}
6464

6565
// Contains parameters passed in by someone who wants to execute a slow relay leaf.
66-
struct USSSlowFill {
67-
USSRelayData relayData;
66+
struct V3SlowFill {
67+
V3RelayData relayData;
6868
uint256 chainId;
6969
uint256 updatedOutputAmount;
7070
}
7171

72-
struct USSRelayerRefundLeaf {
72+
struct V3RelayerRefundLeaf {
7373
// This is the amount to return to the HubPool. This occurs when there is a PoolRebalanceLeaf netSendAmount that
7474
// is negative. This is just the negative of this value.
7575
uint256 amountToReturn;
@@ -95,19 +95,19 @@ interface USSSpokePoolInterface {
9595
// relay itself but is required to know how to process the relay. For example, "updatedX" fields can be used
9696
// by the relayer to modify fields of the relay with the depositor's permission, and "repaymentChainId" is specified
9797
// by the relayer to determine where to take a relayer refund, but doesn't affect the uniqueness of the relay.
98-
struct USSRelayExecutionParams {
99-
USSRelayData relay;
98+
struct V3RelayExecutionParams {
99+
V3RelayData relay;
100100
bytes32 relayHash;
101101
uint256 updatedOutputAmount;
102102
address updatedRecipient;
103103
bytes updatedMessage;
104104
uint256 repaymentChainId;
105105
}
106106

107-
// Packs together parameters emitted in FilledUSSRelay because there are too many emitted otherwise.
108-
// Similar to USSRelayExecutionParams, these parameters are not used to uniquely identify the deposit being
107+
// Packs together parameters emitted in FilledV3Relay because there are too many emitted otherwise.
108+
// Similar to V3RelayExecutionParams, these parameters are not used to uniquely identify the deposit being
109109
// filled so they don't have to be unpacked by all clients.
110-
struct USSRelayExecutionEventInfo {
110+
struct V3RelayExecutionEventInfo {
111111
address updatedRecipient;
112112
bytes updatedMessage;
113113
uint256 updatedOutputAmount;
@@ -118,7 +118,7 @@ interface USSSpokePoolInterface {
118118
* EVENTS *
119119
**************************************/
120120

121-
event USSFundsDeposited(
121+
event V3FundsDeposited(
122122
address inputToken,
123123
address outputToken,
124124
uint256 inputAmount,
@@ -134,7 +134,7 @@ interface USSSpokePoolInterface {
134134
bytes message
135135
);
136136

137-
event RequestedSpeedUpUSSDeposit(
137+
event RequestedSpeedUpV3Deposit(
138138
uint256 updatedOutputAmount,
139139
uint32 indexed depositId,
140140
address indexed depositor,
@@ -143,7 +143,7 @@ interface USSSpokePoolInterface {
143143
bytes depositorSignature
144144
);
145145

146-
event FilledUSSRelay(
146+
event FilledV3Relay(
147147
address inputToken,
148148
address outputToken,
149149
uint256 inputAmount,
@@ -158,10 +158,10 @@ interface USSSpokePoolInterface {
158158
address depositor,
159159
address recipient,
160160
bytes message,
161-
USSRelayExecutionEventInfo relayExecutionInfo
161+
V3RelayExecutionEventInfo relayExecutionInfo
162162
);
163163

164-
event RequestedUSSSlowFill(
164+
event RequestedV3SlowFill(
165165
address inputToken,
166166
address outputToken,
167167
uint256 inputAmount,
@@ -176,7 +176,7 @@ interface USSSpokePoolInterface {
176176
bytes message
177177
);
178178

179-
event ExecutedUSSRelayerRefundRoot(
179+
event ExecutedV3RelayerRefundRoot(
180180
uint256 amountToReturn,
181181
uint256 indexed chainId,
182182
uint256[] refundAmounts,
@@ -192,7 +192,7 @@ interface USSSpokePoolInterface {
192192
* FUNCTIONS *
193193
**************************************/
194194

195-
function depositUSS(
195+
function depositV3(
196196
address depositor,
197197
address recipient,
198198
address inputToken,
@@ -207,7 +207,7 @@ interface USSSpokePoolInterface {
207207
bytes calldata message
208208
) external payable;
209209

210-
function speedUpUSSDeposit(
210+
function speedUpV3Deposit(
211211
address depositor,
212212
uint32 depositId,
213213
uint256 updatedOutputAmount,
@@ -216,28 +216,28 @@ interface USSSpokePoolInterface {
216216
bytes calldata depositorSignature
217217
) external;
218218

219-
function fillUSSRelay(USSRelayData calldata relayData, uint256 repaymentChainId) external;
219+
function fillV3Relay(V3RelayData calldata relayData, uint256 repaymentChainId) external;
220220

221-
function fillUSSRelayWithUpdatedDeposit(
222-
USSRelayData calldata relayData,
221+
function fillV3RelayWithUpdatedDeposit(
222+
V3RelayData calldata relayData,
223223
uint256 repaymentChainId,
224224
uint256 updatedOutputAmount,
225225
address updatedRecipient,
226226
bytes calldata updatedMessage,
227227
bytes calldata depositorSignature
228228
) external;
229229

230-
function requestUSSSlowFill(USSRelayData calldata relayData) external;
230+
function requestV3SlowFill(V3RelayData calldata relayData) external;
231231

232-
function executeUSSSlowRelayLeaf(
233-
USSSlowFill calldata slowFillLeaf,
232+
function executeV3SlowRelayLeaf(
233+
V3SlowFill calldata slowFillLeaf,
234234
uint32 rootBundleId,
235235
bytes32[] calldata proof
236236
) external;
237237

238-
function executeUSSRelayerRefundLeaf(
238+
function executeV3RelayerRefundLeaf(
239239
uint32 rootBundleId,
240-
USSRelayerRefundLeaf calldata relayerRefundLeaf,
240+
V3RelayerRefundLeaf calldata relayerRefundLeaf,
241241
bytes32[] calldata proof
242242
) external payable;
243243

contracts/test/AcrossMessageHandlerMock.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.0;
33

44
import "../SpokePool.sol";
5-
import "../interfaces/USSSpokePoolInterface.sol";
5+
import "../interfaces/V3SpokePoolInterface.sol";
66

77
contract AcrossMessageHandlerMock is AcrossMessageHandler {
88
function handleAcrossMessage(
@@ -13,7 +13,7 @@ contract AcrossMessageHandlerMock is AcrossMessageHandler {
1313
bytes memory message
1414
) external override {}
1515

16-
function handleUSSAcrossMessage(
16+
function handleV3AcrossMessage(
1717
address tokenSent,
1818
uint256 amount,
1919
address relayer,

contracts/test/MerkleLibTest.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ contract MerkleLibTest {
2929
return MerkleLib.verifyRelayerRefund(root, refund, proof);
3030
}
3131

32-
function verifyUSSRelayerRefund(
32+
function verifyV3RelayerRefund(
3333
bytes32 root,
34-
USSSpokePoolInterface.USSRelayerRefundLeaf memory refund,
34+
V3SpokePoolInterface.V3RelayerRefundLeaf memory refund,
3535
bytes32[] memory proof
3636
) public pure returns (bool) {
37-
return MerkleLib.verifyUSSRelayerRefund(root, refund, proof);
37+
return MerkleLib.verifyV3RelayerRefund(root, refund, proof);
3838
}
3939

4040
function verifySlowRelayFulfillment(
@@ -45,12 +45,12 @@ contract MerkleLibTest {
4545
return MerkleLib.verifySlowRelayFulfillment(root, slowFill, proof);
4646
}
4747

48-
function verifyUSSSlowRelayFulfillment(
48+
function verifyV3SlowRelayFulfillment(
4949
bytes32 root,
50-
USSSpokePoolInterface.USSSlowFill memory slowFill,
50+
V3SpokePoolInterface.V3SlowFill memory slowFill,
5151
bytes32[] memory proof
5252
) public pure returns (bool) {
53-
return MerkleLib.verifyUSSSlowRelayFulfillment(root, slowFill, proof);
53+
return MerkleLib.verifyV3SlowRelayFulfillment(root, slowFill, proof);
5454
}
5555

5656
function isClaimed(uint256 index) public view returns (bool) {

contracts/test/MockCaller.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// SPDX-License-Identifier: BUSL-1.1
22
pragma solidity ^0.8.0;
33

4-
import "../interfaces/USSSpokePoolInterface.sol";
4+
import "../interfaces/V3SpokePoolInterface.sol";
55
import "../interfaces/SpokePoolInterface.sol";
66

77
// Used for calling SpokePool.sol functions from a contract instead of an EOA. Can be used to simulate aggregator
88
// or pooled relayer behavior. Makes all calls from constructor to make sure SpokePool is not relying on checking the
99
// caller's code size which is 0 at construction time.
1010

11-
contract MockUSSCaller {
11+
contract MockV3Caller {
1212
constructor(
1313
address _spokePool,
1414
uint32 rootBundleId,
15-
USSSpokePoolInterface.USSRelayerRefundLeaf memory relayerRefundLeaf,
15+
V3SpokePoolInterface.V3RelayerRefundLeaf memory relayerRefundLeaf,
1616
bytes32[] memory proof
1717
) {
1818
require(_spokePool != address(this), "spokePool not external");
19-
USSSpokePoolInterface(_spokePool).executeUSSRelayerRefundLeaf(rootBundleId, relayerRefundLeaf, proof);
19+
V3SpokePoolInterface(_spokePool).executeV3RelayerRefundLeaf(rootBundleId, relayerRefundLeaf, proof);
2020
}
2121
}
2222

contracts/test/MockSpokePool.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ contract MockSpokePool is SpokePool, OwnableUpgradeable {
4343
_distributeRelayerRefunds(_chainId, amountToReturn, refundAmounts, leafId, l2TokenAddress, refundAddresses);
4444
}
4545

46-
function verifyUpdateUSSDepositMessage(
46+
function verifyUpdateV3DepositMessage(
4747
address depositor,
4848
uint32 depositId,
4949
uint256 originChainId,
@@ -53,7 +53,7 @@ contract MockSpokePool is SpokePool, OwnableUpgradeable {
5353
bytes memory depositorSignature
5454
) public view {
5555
return
56-
_verifyUpdateUSSDepositMessage(
56+
_verifyUpdateV3DepositMessage(
5757
depositor,
5858
depositId,
5959
originChainId,
@@ -64,12 +64,12 @@ contract MockSpokePool is SpokePool, OwnableUpgradeable {
6464
);
6565
}
6666

67-
function fillRelayUSSInternal(
68-
USSRelayExecutionParams memory relayExecution,
67+
function fillRelayV3Internal(
68+
V3RelayExecutionParams memory relayExecution,
6969
address relayer,
7070
bool isSlowFill
7171
) external {
72-
_fillRelayUSS(relayExecution, relayer, isSlowFill);
72+
_fillRelayV3(relayExecution, relayer, isSlowFill);
7373
}
7474

7575
// This function is nonReentrant in order to allow caller to test whether a different function

0 commit comments

Comments
 (0)