-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from ethstorage/ownable2step
Use Ownable2Step instead of Ownable
- Loading branch information
Showing
2 changed files
with
34 additions
and
2 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
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,32 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.28; | ||
|
||
import "./TestDecentralizedKV.sol"; | ||
import "forge-std/Test.sol"; | ||
|
||
contract DecentralizedKVTest is Test { | ||
uint256 constant MAX_KV_SIZE = 17; | ||
uint256 constant STORAGE_COST = 10000000; | ||
uint256 constant SHARD_SIZE_BITS = 19; | ||
uint256 constant PREPAID_AMOUNT = 2 * STORAGE_COST; | ||
TestDecentralizedKV decentralizedKV; | ||
|
||
function setUp() public { | ||
decentralizedKV = new TestDecentralizedKV(MAX_KV_SIZE, 0, STORAGE_COST, 340282366367469178095360967382638002176); | ||
decentralizedKV.initialize(vm.addr(1)); | ||
} | ||
|
||
function testTransferOwnership() public { | ||
vm.expectRevert(); | ||
vm.prank(address(vm.addr(2))); | ||
decentralizedKV.transferOwnership(vm.addr(2)); | ||
|
||
vm.prank(address(vm.addr(1))); | ||
decentralizedKV.transferOwnership(vm.addr(2)); | ||
assertEq(decentralizedKV.owner(), vm.addr(1)); | ||
|
||
vm.prank(address(vm.addr(2))); | ||
decentralizedKV.acceptOwnership(); | ||
assertEq(decentralizedKV.owner(), vm.addr(2)); | ||
} | ||
} |