-
Notifications
You must be signed in to change notification settings - Fork 25
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 #3 from chainhop-dex/fix-susd
support non standard underlying_coins(uint256) impl
- Loading branch information
Showing
10 changed files
with
89 additions
and
51 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
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,30 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
pragma solidity >=0.8.12; | ||
|
||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
contract CurveTokenAddresses is Ownable { | ||
event PoolTokensSet(address[] pools, address[][] poolTokens); | ||
|
||
// Pool address to *underlying* token addresses. position sensitive. | ||
// This is needed because some of the metapools fail to implement curve's underlying_coins() spec, | ||
// therefore no consistant way to query token addresses by their indices. | ||
mapping(address => address[]) public poolToTokens; | ||
|
||
constructor(address[] memory _pools, address[][] memory _poolTokens) { | ||
_setPoolTokens(_pools, _poolTokens); | ||
} | ||
|
||
function setPoolTokens(address[] calldata _pools, address[][] calldata _poolTokens) external onlyOwner { | ||
_setPoolTokens(_pools, _poolTokens); | ||
} | ||
|
||
function _setPoolTokens(address[] memory _pools, address[][] memory _poolTokens) private { | ||
require(_pools.length == _poolTokens.length, "len mm"); | ||
for (uint256 i = 0; i < _pools.length; i++) { | ||
poolToTokens[_pools[i]] = _poolTokens[i]; | ||
} | ||
emit PoolTokensSet(_pools, _poolTokens); | ||
} | ||
} |
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
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
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
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