diff --git a/cache/solidity-files-cache.json b/cache/solidity-files-cache.json index 3c00b046..ed7c3b78 100644 --- a/cache/solidity-files-cache.json +++ b/cache/solidity-files-cache.json @@ -6607,8 +6607,8 @@ } }, "src/other/contango/ContangoWand.sol": { - "lastModificationDate": 1677603976743, - "contentHash": "b410c3dbd14924d2a3cdfb96ab9c9989", + "lastModificationDate": 1677605001004, + "contentHash": "61c7561599ce636f8e1490bc5061af1d", "sourceName": "src/other/contango/ContangoWand.sol", "solcConfig": { "settings": { @@ -9796,8 +9796,8 @@ } }, "src/test/other/contango/ContangoWand.t.sol": { - "lastModificationDate": 1677604705969, - "contentHash": "f296e340cac233ca73e104027cd8b6a3", + "lastModificationDate": 1677605131493, + "contentHash": "6a6d1060eb6289364ab6c03f0a87878a", "sourceName": "src/test/other/contango/ContangoWand.t.sol", "solcConfig": { "settings": { @@ -9828,6 +9828,8 @@ } }, "imports": [ + "lib/ERC3156/contracts/interfaces/IERC3156FlashBorrower.sol", + "lib/ERC3156/contracts/interfaces/IERC3156FlashLender.sol", "lib/dss-interfaces/src/dss/DaiAbstract.sol", "lib/forge-std/lib/ds-test/src/test.sol", "lib/forge-std/src/Base.sol", @@ -9860,6 +9862,7 @@ "lib/yieldspace-tv/src/interfaces/IPool.sol", "lib/yieldspace-tv/src/interfaces/IPoolOracle.sol", "src/Cauldron.sol", + "src/Join.sol", "src/Ladle.sol", "src/LadleStorage.sol", "src/Router.sol", @@ -9870,6 +9873,7 @@ "src/interfaces/IERC5095.sol", "src/interfaces/IFYToken.sol", "src/interfaces/IJoin.sol", + "src/interfaces/IJoinFactory.sol", "src/interfaces/ILadle.sol", "src/interfaces/ILadleGov.sol", "src/interfaces/IOracle.sol", diff --git a/src/other/contango/ContangoWand.sol b/src/other/contango/ContangoWand.sol index bb3b2b29..7e28616c 100644 --- a/src/other/contango/ContangoWand.sol +++ b/src/other/contango/ContangoWand.sol @@ -205,7 +205,7 @@ contract ContangoWand is AccessControl { /// @notice Add join to the Ladle. /// @dev These will often be used to hold fyToken, so it doesn't seem possible to put boundaries. However, it seems low risk. Famous last words. - function addJoin(bytes6 assetId, address join) external auth { - contangoLadle.addJoin(assetId, IJoin(join)); + function addJoin(bytes6 assetId, IJoin join) external auth { + contangoLadle.addJoin(assetId, join); } } diff --git a/src/test/other/contango/ContangoWand.t.sol b/src/test/other/contango/ContangoWand.t.sol index f4a9547c..9cd4c6ba 100644 --- a/src/test/other/contango/ContangoWand.t.sol +++ b/src/test/other/contango/ContangoWand.t.sol @@ -6,6 +6,7 @@ import "../../utils/TestConstants.sol"; import "../../utils/Mocks.sol"; import "../../../Cauldron.sol"; +import "../../../Join.sol"; import "../../../other/contango/ContangoLadle.sol"; import "../../../other/contango/ContangoWand.sol"; @@ -70,6 +71,8 @@ contract ContangoWandTest is Test, TestConstants { wand.grantRole(wand.addIntegration.selector, address(this)); AccessControl(address(contangoLadle)).grantRole(ILadle.addToken.selector, address(wand)); wand.grantRole(wand.addToken.selector, address(this)); + AccessControl(address(contangoLadle)).grantRole(ILadle.addJoin.selector, address(wand)); + wand.grantRole(wand.addJoin.selector, address(this)); vm.stopPrank(); } @@ -410,4 +413,20 @@ contract ContangoWandTest is Test, TestConstants { assertTrue(contangoLadle.tokens(0xad1983745D6c739537fEaB5bed45795f47A940b3), "yield integration"); } + + function testAddJoin_Auth() public { + vm.prank(bob); + vm.expectRevert("Access denied"); + wand.addJoin(FYUSDT2306, IJoin(address(0))); + } + + function testAddJoin() public { + wand.addAsset(USDT); + + IJoin join = new Join(contangoCauldron.assets(USDT)); + + wand.addJoin(USDT, join); + + assertEq(address(contangoLadle.joins(USDT)), address(join), "pool"); + } }