Skip to content

Commit 73e57c9

Browse files
authored
Merge pull request #32 from euler-xyz/chore-rename_to_eulerAccount
Chore: rename to eulerAccount
2 parents f75bca9 + 987b844 commit 73e57c9

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

docs/interfaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The `IEulerSwap` interface defines the core functionality for executing token sw
4242

4343
- **description**: Returns the address of asset 1.
4444

45-
#### `myAccount() external view returns (address);`
45+
#### `eulerAccount() external view returns (address);`
4646

4747
- **description**: Returns the address of the account managing EulerSwap.
4848

src/EulerSwap.sol

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ contract EulerSwap is IEulerSwap, EVCUtil {
2020
address public immutable vault1;
2121
address public immutable asset0;
2222
address public immutable asset1;
23-
address public immutable myAccount;
23+
address public immutable eulerAccount;
2424
uint112 public immutable debtLimit0;
2525
uint112 public immutable debtLimit1;
2626
uint112 public immutable initialReserve0;
@@ -82,7 +82,7 @@ contract EulerSwap is IEulerSwap, EVCUtil {
8282
vault1 = params.vault1;
8383
asset0 = asset0Addr;
8484
asset1 = asset1Addr;
85-
myAccount = params.myAccount;
85+
eulerAccount = params.eulerAccount;
8686
debtLimit0 = params.debtLimit0;
8787
debtLimit1 = params.debtLimit1;
8888
initialReserve0 = reserve0 = offsetReserve(params.debtLimit0, params.vault0);
@@ -178,8 +178,8 @@ contract EulerSwap is IEulerSwap, EVCUtil {
178178
IAllowanceTransfer(permit2).approve(asset1, vault1, type(uint160).max, type(uint48).max);
179179
}
180180

181-
IEVC(evc).enableCollateral(myAccount, vault0);
182-
IEVC(evc).enableCollateral(myAccount, vault1);
181+
IEVC(evc).enableCollateral(eulerAccount, vault0);
182+
IEVC(evc).enableCollateral(eulerAccount, vault1);
183183
}
184184

185185
/// @inheritdoc IEulerSwap
@@ -198,42 +198,42 @@ contract EulerSwap is IEulerSwap, EVCUtil {
198198

199199
if (balance > 0) {
200200
uint256 avail = amount < balance ? amount : balance;
201-
IEVC(evc).call(vault, myAccount, 0, abi.encodeCall(IERC4626.withdraw, (avail, to, myAccount)));
201+
IEVC(evc).call(vault, eulerAccount, 0, abi.encodeCall(IERC4626.withdraw, (avail, to, eulerAccount)));
202202
amount -= avail;
203203
}
204204

205205
if (amount > 0) {
206-
IEVC(evc).enableController(myAccount, vault);
207-
IEVC(evc).call(vault, myAccount, 0, abi.encodeCall(IBorrowing.borrow, (amount, to)));
206+
IEVC(evc).enableController(eulerAccount, vault);
207+
IEVC(evc).call(vault, eulerAccount, 0, abi.encodeCall(IBorrowing.borrow, (amount, to)));
208208
}
209209
}
210210

211211
function depositAssets(address vault, uint256 amount) internal returns (uint256) {
212-
try IEVault(vault).deposit(amount, myAccount) {}
212+
try IEVault(vault).deposit(amount, eulerAccount) {}
213213
catch (bytes memory reason) {
214214
require(bytes4(reason) == EVKErrors.E_ZeroShares.selector, DepositFailure(reason));
215215
return 0;
216216
}
217217

218-
if (IEVC(evc).isControllerEnabled(myAccount, vault)) {
218+
if (IEVC(evc).isControllerEnabled(eulerAccount, vault)) {
219219
IEVC(evc).call(
220-
vault, myAccount, 0, abi.encodeCall(IBorrowing.repayWithShares, (type(uint256).max, myAccount))
220+
vault, eulerAccount, 0, abi.encodeCall(IBorrowing.repayWithShares, (type(uint256).max, eulerAccount))
221221
);
222222

223223
if (myDebt(vault) == 0) {
224-
IEVC(evc).call(vault, myAccount, 0, abi.encodeCall(IRiskManager.disableController, ()));
224+
IEVC(evc).call(vault, eulerAccount, 0, abi.encodeCall(IRiskManager.disableController, ()));
225225
}
226226
}
227227

228228
return amount;
229229
}
230230

231231
function myDebt(address vault) internal view returns (uint256) {
232-
return IEVault(vault).debtOf(myAccount);
232+
return IEVault(vault).debtOf(eulerAccount);
233233
}
234234

235235
function myBalance(address vault) internal view returns (uint256) {
236-
uint256 shares = IEVault(vault).balanceOf(myAccount);
236+
uint256 shares = IEVault(vault).balanceOf(eulerAccount);
237237
return shares == 0 ? 0 : IEVault(vault).convertToAssets(shares);
238238
}
239239

src/EulerSwapFactory.sol

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ import {EVCUtil} from "ethereum-vault-connector/utils/EVCUtil.sol";
1111
contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
1212
/// @dev An array to store all pools addresses.
1313
address[] public allPools;
14-
/// @dev Mapping between a swap account and deployed pool that is currently set as operator
15-
mapping(address swapAccount => address operator) public swapAccountToPool;
14+
/// @dev Mapping between euler account and deployed pool that is currently set as operator
15+
mapping(address eulerAccount => address operator) public eulerAccountToPool;
1616

1717
event PoolDeployed(
1818
address indexed asset0,
1919
address indexed asset1,
2020
address vault0,
2121
address vault1,
2222
uint256 indexed feeMultiplier,
23-
address swapAccount,
23+
address eulerAccount,
2424
uint256 priceX,
2525
uint256 priceY,
2626
uint256 concentrationX,
@@ -37,7 +37,7 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
3737

3838
/// @notice Deploy a new EulerSwap pool with the given parameters
3939
/// @dev The pool address is deterministically generated using CREATE2 with a salt derived from
40-
/// the swap account address and provided salt parameter. This allows the pool address to be
40+
/// the euler account address and provided salt parameter. This allows the pool address to be
4141
/// predicted before deployment.
4242
/// @param params Core pool parameters including vaults, account, and fee settings
4343
/// @param curveParams Parameters defining the curve shape including prices and concentrations
@@ -47,11 +47,11 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
4747
external
4848
returns (address)
4949
{
50-
require(_msgSender() == params.myAccount, Unauthorized());
50+
require(_msgSender() == params.eulerAccount, Unauthorized());
5151

52-
EulerSwap pool = new EulerSwap{salt: keccak256(abi.encode(params.myAccount, salt))}(params, curveParams);
52+
EulerSwap pool = new EulerSwap{salt: keccak256(abi.encode(params.eulerAccount, salt))}(params, curveParams);
5353

54-
checkSwapAccountOperators(params.myAccount, address(pool));
54+
checkEulerAccountOperators(params.eulerAccount, address(pool));
5555

5656
allPools.push(address(pool));
5757

@@ -63,7 +63,7 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
6363
params.vault0,
6464
params.vault1,
6565
pool.feeMultiplier(),
66-
params.myAccount,
66+
params.eulerAccount,
6767
curveParams.priceX,
6868
curveParams.priceY,
6969
curveParams.concentrationX,
@@ -97,20 +97,20 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil {
9797
return allPoolsList;
9898
}
9999

100-
/// @notice Validates operator authorization for a swap account. First checks if the account has an existing operator
100+
/// @notice Validates operator authorization for euler account. First checks if the account has an existing operator
101101
/// and ensures it is deauthorized. Then verifies the new pool is authorized as an operator. Finally, updates the
102102
/// mapping to track the new pool as the account's operator.
103-
/// @param swapAccount The address of the swap account.
103+
/// @param eulerAccount The address of the euler account.
104104
/// @param newPool The address of the new pool.
105-
function checkSwapAccountOperators(address swapAccount, address newPool) internal {
106-
address operator = swapAccountToPool[swapAccount];
105+
function checkEulerAccountOperators(address eulerAccount, address newPool) internal {
106+
address operator = eulerAccountToPool[eulerAccount];
107107

108108
if (operator != address(0)) {
109-
require(!evc.isAccountOperatorAuthorized(swapAccount, operator), OldOperatorStillInstalled());
109+
require(!evc.isAccountOperatorAuthorized(eulerAccount, operator), OldOperatorStillInstalled());
110110
}
111111

112-
require(evc.isAccountOperatorAuthorized(swapAccount, newPool), OperatorNotInstalled());
112+
require(evc.isAccountOperatorAuthorized(eulerAccount, newPool), OperatorNotInstalled());
113113

114-
swapAccountToPool[swapAccount] = newPool;
114+
eulerAccountToPool[eulerAccount] = newPool;
115115
}
116116
}

src/EulerSwapPeriphery.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ contract EulerSwapPeriphery is IEulerSwapPeriphery {
8989
returns (uint256)
9090
{
9191
require(
92-
IEVC(eulerSwap.EVC()).isAccountOperatorAuthorized(eulerSwap.myAccount(), address(eulerSwap)),
92+
IEVC(eulerSwap.EVC()).isAccountOperatorAuthorized(eulerSwap.eulerAccount(), address(eulerSwap)),
9393
OperatorNotInstalled()
9494
);
9595

src/interfaces/IEulerSwap.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ interface IEulerSwap {
55
struct Params {
66
address vault0;
77
address vault1;
8-
address myAccount;
8+
address eulerAccount;
99
uint112 debtLimit0;
1010
uint112 debtLimit1;
1111
uint256 fee;
@@ -45,7 +45,7 @@ interface IEulerSwap {
4545
function vault1() external view returns (address);
4646
function asset0() external view returns (address);
4747
function asset1() external view returns (address);
48-
function myAccount() external view returns (address);
48+
function eulerAccount() external view returns (address);
4949
function initialReserve0() external view returns (uint112);
5050
function initialReserve1() external view returns (uint112);
5151
function feeMultiplier() external view returns (uint256);

test/EulerSwapFactoryTest.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ contract EulerSwapFactoryTest is EulerSwapTestBase {
4343
vm.prank(holder);
4444
evc.batch(items);
4545

46-
EulerSwap eulerSwap = EulerSwap(eulerSwapFactory.swapAccountToPool(holder));
46+
EulerSwap eulerSwap = EulerSwap(eulerSwapFactory.eulerAccountToPool(holder));
4747

4848
uint256 allPoolsLengthAfter = eulerSwapFactory.allPoolsLength();
4949
assertEq(allPoolsLengthAfter - allPoolsLengthBefore, 1);
@@ -104,7 +104,7 @@ contract EulerSwapFactoryTest is EulerSwapTestBase {
104104
abi.encodePacked(
105105
bytes1(0xff),
106106
factoryAddress,
107-
keccak256(abi.encode(address(poolParams.myAccount), salt)),
107+
keccak256(abi.encode(address(poolParams.eulerAccount), salt)),
108108
keccak256(
109109
abi.encodePacked(type(EulerSwap).creationCode, abi.encode(poolParams, curveParams))
110110
)

test/EulerSwapTestBase.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ contract EulerSwapTestBase is EVaultTestBase {
149149
return IEulerSwap.Params({
150150
vault0: address(eTST),
151151
vault1: address(eTST2),
152-
myAccount: holder,
152+
eulerAccount: holder,
153153
debtLimit0: debtLimitA,
154154
debtLimit1: debtLimitB,
155155
fee: fee

0 commit comments

Comments
 (0)