-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
position descriptor proxy tests #427
Changes from 4 commits
8b1e603
b2c943b
6e67c90
ba6c3cd
6f05aaf
ccea1c1
4ddacf8
88617c1
a0268c2
76b0100
cce7374
bf6a92b
c109924
ce67772
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"position descriptor initcode hash (without constructor params, as uint256)": "88482580191959945449130293370700011665153263709859488839371600440410373093991", | ||
"positionDescriptor bytecode size": "24110" | ||
"position descriptor initcode hash (without constructor params, as uint256)": "90002686278379416913385532438840669828848441637921711710845035729125835578244", | ||
"positionDescriptor bytecode size": "24138", | ||
"proxy bytecode size": "1488" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,14 +26,27 @@ contract PositionDescriptor is IPositionDescriptor { | |
address private constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; | ||
|
||
address public immutable wrappedNative; | ||
string public nativeCurrencyLabel; | ||
bytes32 public immutable nativeCurrencyLabelBytes; | ||
|
||
IPoolManager public immutable poolManager; | ||
|
||
constructor(IPoolManager _poolManager, address _wrappedNative, string memory _nativeCurrencyLabel) { | ||
constructor(IPoolManager _poolManager, address _wrappedNative, bytes32 _nativeCurrencyLabelBytes) { | ||
poolManager = _poolManager; | ||
wrappedNative = _wrappedNative; | ||
nativeCurrencyLabel = _nativeCurrencyLabel; | ||
nativeCurrencyLabelBytes = _nativeCurrencyLabelBytes; | ||
} | ||
|
||
/// @notice Returns the native currency label as a string | ||
function nativeCurrencyLabel() public view returns (string memory) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would love to see unit tests for this function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. code copied from here btw, but I couldn't find a unit test on the fly there either: |
||
uint256 len = 0; | ||
while (len < 32 && nativeCurrencyLabelBytes[len] != 0) { | ||
len++; | ||
} | ||
bytes memory b = new bytes(len); | ||
for (uint256 i = 0; i < len; i++) { | ||
b[i] = nativeCurrencyLabelBytes[i]; | ||
} | ||
return string(b); | ||
} | ||
|
||
/// @inheritdoc IPositionDescriptor | ||
|
@@ -66,8 +79,8 @@ contract PositionDescriptor is IPositionDescriptor { | |
tokenId: tokenId, | ||
quoteCurrency: quoteCurrency, | ||
baseCurrency: baseCurrency, | ||
quoteCurrencySymbol: SafeCurrencyMetadata.currencySymbol(quoteCurrency, nativeCurrencyLabel), | ||
baseCurrencySymbol: SafeCurrencyMetadata.currencySymbol(baseCurrency, nativeCurrencyLabel), | ||
quoteCurrencySymbol: SafeCurrencyMetadata.currencySymbol(quoteCurrency, nativeCurrencyLabel()), | ||
baseCurrencySymbol: SafeCurrencyMetadata.currencySymbol(baseCurrency, nativeCurrencyLabel()), | ||
quoteCurrencyDecimals: SafeCurrencyMetadata.currencyDecimals(quoteCurrency), | ||
baseCurrencyDecimals: SafeCurrencyMetadata.currencyDecimals(baseCurrency), | ||
flipRatio: _flipRatio, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest making this variable private as we already have a getter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like that