diff --git a/meta/FlareFtsoSubParserAuthoringMeta.rain.meta b/meta/FlareFtsoSubParserAuthoringMeta.rain.meta index fdbf3f5..1e05529 100644 Binary files a/meta/FlareFtsoSubParserAuthoringMeta.rain.meta and b/meta/FlareFtsoSubParserAuthoringMeta.rain.meta differ diff --git a/meta/FlareFtsoWords.rain.meta b/meta/FlareFtsoWords.rain.meta index b32bea5..842ebc2 100644 Binary files a/meta/FlareFtsoWords.rain.meta and b/meta/FlareFtsoWords.rain.meta differ diff --git a/src/generated/FlareFtsoWords.pointers.sol b/src/generated/FlareFtsoWords.pointers.sol index 6f6a67f..2843616 100644 --- a/src/generated/FlareFtsoWords.pointers.sol +++ b/src/generated/FlareFtsoWords.pointers.sol @@ -10,10 +10,10 @@ pragma solidity ^0.8.25; // file needs the contract to exist so that it can be compiled. /// @dev Hash of the known bytecode. -bytes32 constant BYTECODE_HASH = bytes32(0x69ffc4160d6551b77f501f51e6e53d7825dcd7318519779f877261ebd37b7da0); +bytes32 constant BYTECODE_HASH = bytes32(0x358d8e811b035af26e4cf1bd71f901057474799487777603aaa6ac620842bcf0); /// @dev The hash of the meta that describes the contract. -bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0x4ccb316fd35a2abbee0016f38926a4c95b6270b229c85a9acf8a3a52b36bfedc); +bytes32 constant DESCRIBED_BY_META_HASH = bytes32(0x1bff202a0cc8b25b7f81cf3d1b9e7b81c465a2d82c9082a7fdf3f87c6e7e8dbe); /// @dev The parse meta that is used to lookup word definitions. /// The structure of the parse meta is: diff --git a/src/interface/IDineroFlrEth.sol b/src/interface/IDineroFlrEth.sol index 159a1ff..c8c9fbf 100644 --- a/src/interface/IDineroFlrEth.sol +++ b/src/interface/IDineroFlrEth.sol @@ -5,9 +5,9 @@ pragma solidity ^0.8.25; interface IDineroFlrEth { //slither-disable-start naming-convention //forge-lint: disable-next-line(mixed-case-function) - function LSTPerToken() external view returns (uint256 ethAmount); + function LSTPerToken() external view returns (uint256 ethPerFlreth18); //slither-disable-end //forge-lint: disable-next-line(mixed-case-function) - function tokensPerLST() external view returns (uint256 tokenAmount); + function tokensPerLST() external view returns (uint256 flrethPerEth18); } diff --git a/src/lib/op/LibOpFtsoCurrentPricePair.sol b/src/lib/op/LibOpFtsoCurrentPricePair.sol index 9fa3214..2a6a3ee 100644 --- a/src/lib/op/LibOpFtsoCurrentPricePair.sol +++ b/src/lib/op/LibOpFtsoCurrentPricePair.sol @@ -50,8 +50,9 @@ library LibOpFtsoCurrentPricePair { function run(OperandV2 operand, StackItem[] memory inputs) internal view returns (StackItem[] memory) { uint256 symbolA; assembly ("memory-safe") { - // Truncating from 3 inputs to 2, so we can forward directly to the - // `ftsoCurrentPriceUsd` opcode. + // Advance the pointer past the length slot so the virtual 2-element + // array starts at inputs[1]=symbolB. Save symbolA so it can be + // restored for the second fetch. inputs := add(inputs, 0x20) symbolA := mload(inputs) mstore(inputs, 2) @@ -60,8 +61,11 @@ library LibOpFtsoCurrentPricePair { // above, which exposes [symbolB, timeout] as a 2-element inputs array. StackItem[] memory denominatorOutputs = LibOpFtsoCurrentPriceUsd.run(operand, inputs); assembly ("memory-safe") { + // Replace symbolB with symbolA so the second fetch uses symbolA. mstore(add(inputs, 0x20), symbolA) } + // symbolA is now at inputs[0]; the second fetch resolves the + // numerator price. StackItem[] memory numeratorOutputs = LibOpFtsoCurrentPriceUsd.run(operand, inputs); Float numeratorPrice; diff --git a/src/lib/parse/LibFlareFtsoSubParser.sol b/src/lib/parse/LibFlareFtsoSubParser.sol index 73f83bf..55aaca2 100644 --- a/src/lib/parse/LibFlareFtsoSubParser.sol +++ b/src/lib/parse/LibFlareFtsoSubParser.sol @@ -29,7 +29,7 @@ library LibFlareFtsoSubParser { ); meta[SUB_PARSER_WORD_SFLR_EXCHANGE_RATE] = AuthoringMetaV2( "sflr-exchange-rate", - "Returns the current sFLR per FLR exchange rate self-reported by the Sceptre staked FLR contract, i.e. how many sFLR shares correspond to 1 FLR. A value less than 1 means 1 FLR yields fewer than 1 sFLR share. Accepts 0 inputs." + "Returns the current sFLR-per-FLR exchange rate as a Rain Float, self-reported by the Sceptre staked FLR contract. Accepts 0 inputs. The value is the number of sFLR shares equivalent to 1 FLR of pooled liquidity, so a value less than 1 means 1 FLR yields fewer than 1 sFLR share (e.g. ~0.877 means 1 FLR buys 0.877 sFLR). To convert in the FLR-per-sFLR direction, take the reciprocal." ); return abi.encode(meta); } diff --git a/test/src/concrete/FlareFtsoWords.pointers.t.sol b/test/src/concrete/FlareFtsoWords.pointers.t.sol index 7b1654e..ab204ad 100644 --- a/test/src/concrete/FlareFtsoWords.pointers.t.sol +++ b/test/src/concrete/FlareFtsoWords.pointers.t.sol @@ -75,7 +75,7 @@ contract FlareFtsoWordsPointersTest is Test { ); assertEq( m[SUB_PARSER_WORD_SFLR_EXCHANGE_RATE].description, - "Returns the current sFLR per FLR exchange rate self-reported by the Sceptre staked FLR contract, i.e. how many sFLR shares correspond to 1 FLR. A value less than 1 means 1 FLR yields fewer than 1 sFLR share. Accepts 0 inputs." + "Returns the current sFLR-per-FLR exchange rate as a Rain Float, self-reported by the Sceptre staked FLR contract. Accepts 0 inputs. The value is the number of sFLR shares equivalent to 1 FLR of pooled liquidity, so a value less than 1 means 1 FLR yields fewer than 1 sFLR share (e.g. ~0.877 means 1 FLR buys 0.877 sFLR). To convert in the FLR-per-sFLR direction, take the reciprocal." ); }