Skip to content

Commit b2d5c7d

Browse files
authored
update initialization of contracts to not have multiple initializer modifiers (#64)
1 parent dce538f commit b2d5c7d

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

contracts/bun.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/src/HyperliquidNobleDollar.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ contract NobleDollar is BaseNobleDollar {
3030

3131
constructor(address mailbox_) BaseNobleDollar(mailbox_) {}
3232

33-
function initialize(address hook_, address ism_, uint32 tokenId_) public initializer {
33+
function initialize(address hook_, address ism_, uint32 tokenId_) public {
3434
super.initialize(hook_, ism_);
3535

3636
// According to the Hyperliquid documentation, this is how you derive the

contracts/src/NobleDollar.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ contract NobleDollar is HypERC20, UUPSUpgradeable {
8989
_disableInitializers();
9090
}
9191

92-
function initialize(address hook_, address ism_) public virtual initializer {
92+
function initialize(address hook_, address ism_) public virtual {
9393
super.initialize("Noble Dollar", "USDN", hook_, ism_, msg.sender);
9494

9595
_getUSDNStorage().index = IndexingMath.EXP_SCALED_ONE;

contracts/test/NobleDollar.t.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ contract NobleDollarTest is Test {
4444
address constant USER1 = 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045;
4545
address constant USER2 = 0xF2f1ACbe0BA726fEE8d75f3E32900526874740BB;
4646
uint32 constant TOKENID = 377;
47-
address OWNER;
47+
address owner;
4848

4949
function setUp() public {
5050
vm.createSelectFork("mainnet");
5151

52-
OWNER = vm.addr(5);
52+
owner = vm.addr(5);
5353
NobleDollar implementation = new NobleDollar(MAILBOX);
5454

5555
// deploy the proxy
@@ -69,8 +69,8 @@ contract NobleDollarTest is Test {
6969
bytes32[] memory routers = new bytes32[](1);
7070
routers[0] = 0x726f757465725f61707000000000000000000000000000010000000000000000;
7171
usdn.enrollRemoteRouters(domains, routers);
72-
// Give ownership to OWNER to test bridge claim and upgrades
73-
usdn.transferOwnership(OWNER);
72+
// Give ownership to owner to test bridge claim and upgrades
73+
usdn.transferOwnership(owner);
7474
}
7575

7676
function test() public {
@@ -579,7 +579,7 @@ contract NobleDollarTest is Test {
579579

580580
// Verify post-claim state
581581
assertEq(usdn.balanceOf(bridgeAddress), 1e12, "Bridge balance should still be the original");
582-
assertEq(usdn.balanceOf(OWNER), 1e12, "Owner should have received the yield tokens");
582+
assertEq(usdn.balanceOf(owner), 1e12, "Owner should have received the yield tokens");
583583
assertEq(usdn.balanceOf(address(usdn)), 0, "Contract balance should be zero after full claim");
584584
assertEq(usdn.yield(bridgeAddress), 0, "Bridge should have no claimable yield after claiming");
585585
assertEq(usdn.principalOf(bridgeAddress), 5e11, "Bridge principal should now be halved");
@@ -597,7 +597,7 @@ contract NobleDollarTest is Test {
597597
usdn.upgradeToAndCall(address(newImplementation), "");
598598

599599
// upgrade from owner account should succeed
600-
vm.prank(OWNER);
600+
vm.prank(owner);
601601
usdn.upgradeToAndCall(address(newImplementation), "");
602602
NobleDollarV2 upgraded = NobleDollarV2(address(usdn));
603603

0 commit comments

Comments
 (0)