Skip to content

Commit

Permalink
AddJoin
Browse files Browse the repository at this point in the history
  • Loading branch information
ultrasecreth committed Feb 28, 2023
1 parent f87c7d4 commit f6e2b2b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
12 changes: 8 additions & 4 deletions cache/solidity-files-cache.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/other/contango/ContangoWand.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
19 changes: 19 additions & 0 deletions src/test/other/contango/ContangoWand.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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");
}
}

0 comments on commit f6e2b2b

Please sign in to comment.