@@ -5,9 +5,12 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
55import { IOFT } from "./interfaces/IOFT.sol " ;
66
77/**
8+ * @title MessengerTypes
9+ * @notice Library containing messenger type constants
810 * @custom:security-contact bugs@across.to
911 */
1012library MessengerTypes {
13+ /** @notice Identifier for OFT (Omni-chain Fungible Token by LayerZero) messenger type */
1114 bytes32 public constant OFT_MESSENGER = bytes32 ("OFT_MESSENGER " );
1215}
1316
@@ -18,20 +21,39 @@ library MessengerTypes {
1821 * @custom:security-contact bugs@across.to
1922 */
2023contract AdapterStore is Ownable {
21- // (messengerType, dstDomainId, srcChainToken) => messenger address
24+ /** @notice Maps messenger type and destination domain to token- messenger pairs */
2225 mapping (bytes32 => mapping (uint256 => mapping (address => address ))) public crossChainMessengers;
2326
27+ /**
28+ * @notice Emitted when a messenger is set for a specific token and destination
29+ * @param messengerType Type of messenger being set
30+ * @param dstDomainId Destination domain ID
31+ * @param srcChainToken Source chain token address
32+ * @param srcChainMessenger Source chain messenger address
33+ */
2434 event MessengerSet (
2535 bytes32 indexed messengerType ,
2636 uint256 indexed dstDomainId ,
2737 address indexed srcChainToken ,
2838 address srcChainMessenger
2939 );
3040
41+ /** @notice Thrown when array lengths don't match in batch operations */
3142 error ArrayLengthMismatch ();
43+
44+ /** @notice Thrown when IOFT messenger's token doesn't match expected token */
3245 error IOFTTokenMismatch ();
46+
47+ /** @notice Thrown when messenger type is not supported */
3348 error NonExistentMessengerType ();
3449
50+ /**
51+ * @notice Sets a messenger for a specific token and destination domain
52+ * @param messengerType Type of messenger to set
53+ * @param dstDomainId Destination domain ID
54+ * @param srcChainToken Source chain token address
55+ * @param srcChainMessenger Source chain messenger address
56+ */
3557 function setMessenger (
3658 bytes32 messengerType ,
3759 uint256 dstDomainId ,
@@ -41,6 +63,13 @@ contract AdapterStore is Ownable {
4163 _setMessenger (messengerType, dstDomainId, srcChainToken, srcChainMessenger);
4264 }
4365
66+ /**
67+ * @notice Sets multiple messengers in a single transaction
68+ * @param messengerTypes Array of messenger types
69+ * @param dstDomainIds Array of destination domain IDs
70+ * @param srcChainTokens Array of source chain token addresses
71+ * @param srcChainMessengers Array of source chain messenger addresses
72+ */
4473 function batchSetMessengers (
4574 bytes32 [] calldata messengerTypes ,
4675 uint256 [] calldata dstDomainIds ,
@@ -60,6 +89,13 @@ contract AdapterStore is Ownable {
6089 }
6190 }
6291
92+ /**
93+ * @notice Internal function to set a messenger with validation
94+ * @param _messengerType Type of messenger to set
95+ * @param _dstDomainId Destination domain ID
96+ * @param _srcChainToken Source chain token address
97+ * @param _srcChainMessenger Source chain messenger address
98+ */
6399 function _setMessenger (
64100 bytes32 _messengerType ,
65101 uint256 _dstDomainId ,
0 commit comments