Overview
AncillaryDataLib provides utility functions for working with ancillary data in the UMA CTF Adapter. It handles the encoding of initializer addresses and their appending to ancillary data using UTF-8 format.
Source: src/libraries/AncillaryDataLib.sol
Functions
_appendAncillaryData
initializer(address): The initializer address to appendancillaryData(bytes): The existing ancillary data
- (bytes): The ancillary data with the initializer address appended
,initializer: followed by the UTF-8 encoded initializer address.
_toUtf8BytesAddress
addr(address): The address to encode
- (bytes): UTF-8 encoded representation of the address
- Returns the address in all lowercase characters without the leading
0xprefix - Based on UMA Protocol’s AncillaryDataLib implementation
- Uses gas-optimized hex encoding
_toUtf8Bytes32Bottom
bytesIn(bytes32): The bytes32 value to convert
- (bytes32): Hex-encoded representation
_toUtf8BytesAddress. It uses nibble interleaving and hex encoding techniques for optimal gas efficiency.
Source Reference:
Based on the implementation from Ethereum Solidity Gitter discussion
Usage Example
Constants
INITIALIZER_PREFIX:",initializer:"- Prefix used when appending initializer addresses