BridgeStructs.sol 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // contracts/Structs.sol
  2. // SPDX-License-Identifier: Apache 2
  3. pragma solidity ^0.8.0;
  4. contract BridgeStructs {
  5. struct Transfer {
  6. // PayloadID uint8 = 1
  7. uint8 payloadID;
  8. // Amount being transferred (big-endian uint256)
  9. uint256 amount;
  10. // Address of the token. Left-zero-padded if shorter than 32 bytes
  11. bytes32 tokenAddress;
  12. // Chain ID of the token
  13. uint16 tokenChain;
  14. // Address of the recipient. Left-zero-padded if shorter than 32 bytes
  15. bytes32 to;
  16. // Chain ID of the recipient
  17. uint16 toChain;
  18. // Amount of tokens (big-endian uint256) that the user is willing to pay as relayer fee. Must be <= Amount.
  19. uint256 fee;
  20. }
  21. struct AssetMeta {
  22. // PayloadID uint8 = 2
  23. uint8 payloadID;
  24. // Address of the token. Left-zero-padded if shorter than 32 bytes
  25. bytes32 tokenAddress;
  26. // Chain ID of the token
  27. uint16 tokenChain;
  28. // Number of decimals of the token (big-endian uint256)
  29. uint8 decimals;
  30. // Symbol of the token (UTF-8)
  31. bytes32 symbol;
  32. // Name of the token (UTF-8)
  33. bytes32 name;
  34. }
  35. struct RegisterChain {
  36. // Governance Header
  37. // module: "TokenBridge" left-padded
  38. bytes32 module;
  39. // governance action: 1
  40. uint8 action;
  41. // governance paket chain id: this or 0
  42. uint16 chainId;
  43. // Chain ID
  44. uint16 emitterChainID;
  45. // Emitter address. Left-zero-padded if shorter than 32 bytes
  46. bytes32 emitterAddress;
  47. }
  48. struct UpgradeContract {
  49. // Governance Header
  50. // module: "TokenBridge" left-padded
  51. bytes32 module;
  52. // governance action: 2
  53. uint8 action;
  54. // governance paket chain id
  55. uint16 chainId;
  56. // Address of the new contract
  57. bytes32 newContract;
  58. }
  59. }