Skip to content
21 changes: 21 additions & 0 deletions test/src/concrete/FlareFtsoWords.pointers.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ contract FlareFtsoWordsPointersTest is Test {
assertEq(uint8(SUB_PARSER_PARSE_META[0]), PARSE_META_BUILD_DEPTH, "parse meta depth byte");
}

function testAuthoringMetaV2Content() external pure {
bytes memory authoringMetaBytes = LibFlareFtsoSubParser.authoringMetaV2();
AuthoringMetaV2[] memory authoringMeta = abi.decode(authoringMetaBytes, (AuthoringMetaV2[]));
assertEq(authoringMeta.length, 3);
assertEq(authoringMeta[0].word, bytes32("ftso-current-price-usd"));
assertEq(
authoringMeta[0].description,
"Returns the current USD price of the given token according to the FTSO. Accepts 2 inputs, the symbol string used by the FTSO and the timeout in seconds. The price is rounded down if it does not fit in a Rainlang number. The timeout will be used to determine if the price is stale and revert if it is."
);
assertEq(authoringMeta[1].word, bytes32("ftso-current-price-pair"));
assertEq(
authoringMeta[1].description,
"Returns the current price of the given token pair according to the FTSO. Accepts 3 inputs, the symbol string used by the FTSO for the base token, the symbol string used by the FTSO for the quote token and the timeout in seconds. The price is rounded down if it does not fit in a Rainlang number. The timeout will be used to determine if the price is stale and revert if it is. Note that the pair price is derived from two separate FTSO prices mechanically and is not provided directly by the FTSO."
);
assertEq(authoringMeta[2].word, bytes32("sflr-exchange-rate"));
assertEq(
authoringMeta[2].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."
);
}

function testOpcodePointersLength() external {
FlareFtsoWords flareFtsoWords = new FlareFtsoWords();
assertEq(flareFtsoWords.buildOpcodeFunctionPointers().length, OPCODE_FUNCTION_POINTERS_LENGTH * 2);
Expand Down
Loading