Skip to content

Commit

Permalink
fix: read me
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed May 14, 2024
1 parent 5850cb6 commit cf15572
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 6 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

# Structure

![alt text](setup.png)
![alt text](image.png)

## [Role Manager](https://github.com/yearn/yearn-stb/blob/seperate/src/RoleManager.sol)

- Yearn governed contract to handle vault deployments and configuration

## [L1 Deployer](https://github.com/yearn/yearn-stb/blob/master/src/L1Deployer.sol)

Expand All @@ -28,11 +32,6 @@

- Allows for a Rollup Admin to update is EScrow Manager or L2 Deployer

- Holds all data for deployed vaults and escrows
- Uses 0 for the default vaults or the rollup specific ID for any custom vaults.

- Holds the Role Manager position for all vaults.


## [L2 Deployer](https://github.com/yearn/yearn-stb/blob/master/src/L2Deployer.sol)

Expand Down
Binary file added image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed setup.png
Binary file not shown.
67 changes: 67 additions & 0 deletions test/RoleManager.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.8.18;

import {Setup, console, L1YearnEscrow, IPolygonZkEVMBridge, IVault, L1Deployer, ERC20} from "./utils/Setup.sol";
import {IPolygonRollupManager, IPolygonRollupContract} from "../src/interfaces/Polygon/IPolygonRollupManager.sol";

contract RoleManagerTest is Setup {
function setUp() public virtual override {
super.setUp();
}

function test_newDefaultVault() public {
assertEq(roleManager.getVault(address(asset)), address(0));

vm.expectRevert("!allowed");
roleManager.newDefaultVault(address(asset));

vm.prank(governator);
address vault = roleManager.newDefaultVault(address(asset));

assertNeq(vault, address(0));
assertEq(roleManager.getVault(address(asset)), vault);

assertEq(IVault(vault).accountant(), address(accountant));
assertNeq(roleManager.getDebtAllocator(vault), address(0));
assertTrue(roleManager.isVaultsRoleManager(vault));
}

function test_updateGovernator() public {
assertEq(
roleManager.getPositionHolder(roleManager.GOVERNATOR()),
governator
);
assertEq(
roleManager.getPositionHolder(roleManager.PENDING_GOVERNATOR()),
address(0)
);
bytes32 GOVERNATOR = roleManager.GOVERNATOR();
bytes32 PENDING_GOV = roleManager.PENDING_GOVERNATOR();

vm.expectRevert("!allowed");
roleManager.setPositionHolder(GOVERNATOR, czar);

vm.expectRevert("!two step flow");
vm.prank(governator);
roleManager.setPositionHolder(GOVERNATOR, czar);

vm.prank(governator);
roleManager.setPositionHolder(PENDING_GOV, czar);

assertEq(roleManager.getPositionHolder(GOVERNATOR), governator);
assertEq(roleManager.getPositionHolder(PENDING_GOV), czar);

vm.expectRevert("!allowed");
vm.prank(governator);
roleManager.acceptGovernator();

vm.prank(czar);
roleManager.acceptGovernator();

assertEq(roleManager.getPositionHolder(roleManager.GOVERNATOR()), czar);
assertEq(
roleManager.getPositionHolder(roleManager.PENDING_GOVERNATOR()),
address(0)
);
}
}

0 comments on commit cf15572

Please sign in to comment.