generated from Kwenta/foundry-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5fa527
commit f4be9b0
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity 0.8.18; | ||
|
||
import {Auth} from "src/authentication/Auth.sol"; | ||
import {OPTIMISM_GOERLI_PERPS_MARKET_PROXY} from | ||
"script/utils/parameters/OptimismGoerliParameters.sol"; | ||
import {Test} from "lib/forge-std/src/Test.sol"; | ||
|
||
contract AuthenticationTest is Test { | ||
Auth auth; | ||
|
||
function setUp() public { | ||
vm.rollFork(13_006_356); | ||
|
||
auth = new Auth(OPTIMISM_GOERLI_PERPS_MARKET_PROXY); | ||
} | ||
} | ||
|
||
contract CreateAccount is AuthenticationTest { | ||
function test_CreateAccount() public { | ||
uint128 accountId = auth.createAccount(); | ||
assert(accountId != 0); | ||
} | ||
} | ||
|
||
contract AccountOwnership is AuthenticationTest { | ||
address owner = address(0x1); | ||
|
||
function test_AccountOwnership() public { | ||
vm.startPrank(owner); | ||
|
||
uint128 accountId = auth.createAccount(); | ||
|
||
bool isOwner = auth.isCallerAccountOwner(accountId); | ||
assertTrue(isOwner); | ||
|
||
vm.stopPrank(); | ||
} | ||
} | ||
|
||
contract Delegation is AuthenticationTest { | ||
address owner = address(0x1); | ||
address delegate1 = address(0x2); | ||
address delegate2 = address(0x3); | ||
address delegate3 = address(0x4); | ||
uint128 accountId1; | ||
uint128 accountId2; | ||
uint128 accountId3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters