Skip to content

Commit 54549fa

Browse files
update decimals string
1 parent 8d345e3 commit 54549fa

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

src/concrete/receipt/ERC20PriceOracleReceipt.sol

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Math
1111
} from "rain.math.fixedpoint/lib/LibFixedPointDecimalArithmeticOpenZeppelin.sol";
1212
import {FIXED_POINT_ONE} from "rain.math.fixedpoint/lib/FixedPointDecimalConstants.sol";
13+
import {StringsUpgradeable as Strings} from "openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol";
1314

1415
/// @dev The default symbol for the reference asset.
1516
string constant DEFAULT_REFERENCE_ASSET_SYMBOL = "USD";
@@ -43,9 +44,25 @@ contract ERC20PriceOracleReceipt is Receipt {
4344
string memory receiptSVGURIPhrase =
4445
bytes(receiptSVGURI).length > 0 ? string.concat("\"image\":\"", receiptSVGURI, "\",") : "";
4546

47+
string memory idString = LibFixedPointDecimalFormat.fixedPointToDecimalString(id);
48+
49+
string memory nameString = string.concat(
50+
"Receipt for ",
51+
brandNamePhrase,
52+
"lock at ",
53+
idString,
54+
" ",
55+
_referenceAssetSymbol(),
56+
" per ",
57+
_vaultAssetSymbol(),
58+
"."
59+
);
60+
4661
bytes memory json = bytes(
4762
string.concat(
48-
"{\"decimals\":18,\"description\":\"1 of these receipts can be burned alongside 1 ",
63+
"{\"decimals\":",
64+
Strings.toString(_vaultDecimals()),
65+
",\"description\":\"1 of these receipts can be burned alongside 1 ",
4966
_vaultShareSymbol(),
5067
" to redeem ",
5168
LibFixedPointDecimalFormat.fixedPointToDecimalString(
@@ -57,15 +74,9 @@ contract ERC20PriceOracleReceipt is Receipt {
5774
redeemURLPhrase,
5875
"\",",
5976
receiptSVGURIPhrase,
60-
"\"name\":\"Receipt for ",
61-
brandNamePhrase,
62-
"lock at ",
63-
LibFixedPointDecimalFormat.fixedPointToDecimalString(id),
64-
" ",
65-
_referenceAssetSymbol(),
66-
" per ",
67-
_vaultAssetSymbol(),
68-
".\"}"
77+
"\"name\":\"",
78+
nameString,
79+
"\"}"
6980
)
7081
);
7182

0 commit comments

Comments
 (0)