Skip to content

Commit

Permalink
fix: subdomain deploy and test
Browse files Browse the repository at this point in the history
  • Loading branch information
pikonha committed Nov 7, 2024
1 parent 176436a commit 99f2965
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 43 deletions.
6 changes: 2 additions & 4 deletions packages/contracts/script/deploy/SubdomainController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ contract SubdomainControllerScript is DeployHelper, ENSHelper {
vm.startBroadcast();

uint256 subdomainPrice = 0.001 ether;
uint256 commitTime = 0;
SubdomainController subdomainController = new SubdomainController(
address(nameWrapper), subdomainPrice, commitTime
);
SubdomainController subdomainController =
new SubdomainController(address(nameWrapper), subdomainPrice);
nameWrapper.setApprovalForAll(address(subdomainController), true);

vm.stopBroadcast();
Expand Down
84 changes: 45 additions & 39 deletions packages/contracts/test/SubdomainController.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ contract SubdomainControllerTest is Test, ENSHelper {
DummyResolver public resolver;

uint256 constant PRICE = 0.1 ether;
uint256 constant COMMIT_TIME = 1 days;

function setUp() public {
nameWrapper = new DummyNameWrapper();
resolver = new DummyResolver();
controller =
new SubdomainController(address(nameWrapper), PRICE, COMMIT_TIME);
controller = new SubdomainController(address(nameWrapper), PRICE);
}

function testRegister() public {
Expand All @@ -115,15 +113,17 @@ contract SubdomainControllerTest is Test, ENSHelper {

vm.deal(address(this), PRICE);
controller.register{value: PRICE}(
name,
owner,
duration,
secret,
address(resolver),
data,
false,
0,
abi.encode("")
RegisterRequest(
name,
owner,
duration,
secret,
address(resolver),
data,
false,
0,
bytes("")
)
);

assertEq(
Expand All @@ -144,15 +144,17 @@ contract SubdomainControllerTest is Test, ENSHelper {
vm.expectRevert("insufficient funds");

controller.register{value: PRICE - 1}(
name,
owner,
duration,
secret,
address(resolver),
data,
false,
0,
abi.encode("")
RegisterRequest(
name,
owner,
duration,
secret,
address(resolver),
data,
false,
0,
bytes("")
)
);
}

Expand All @@ -179,15 +181,17 @@ contract SubdomainControllerTest is Test, ENSHelper {

vm.deal(address(this), PRICE);
controller.register{value: PRICE}(
name,
owner,
duration,
secret,
address(resolver),
data,
false,
0,
abi.encode("")
RegisterRequest(
name,
owner,
duration,
secret,
address(resolver),
data,
false,
0,
bytes("")
)
);
}

Expand Down Expand Up @@ -226,15 +230,17 @@ contract SubdomainControllerTest is Test, ENSHelper {

vm.deal(address(this), PRICE);
controller.register{value: PRICE}(
name,
owner,
duration,
secret,
address(resolver),
data,
false,
0,
abi.encode("")
RegisterRequest(
name,
owner,
duration,
secret,
address(resolver),
data,
false,
0,
bytes("")
)
);

assertEq(
Expand Down

0 comments on commit 99f2965

Please sign in to comment.