metatx.adoc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. :github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
  2. :xref-ERC2771Context-constructor-address-: xref:metatx.adoc#ERC2771Context-constructor-address-
  3. :xref-ERC2771Context-isTrustedForwarder-address-: xref:metatx.adoc#ERC2771Context-isTrustedForwarder-address-
  4. :xref-ERC2771Context-_msgSender--: xref:metatx.adoc#ERC2771Context-_msgSender--
  5. :xref-ERC2771Context-_msgData--: xref:metatx.adoc#ERC2771Context-_msgData--
  6. :ERC2771Context: pass:normal[xref:metatx.adoc#ERC2771Context[`ERC2771Context`]]
  7. :xref-MinimalForwarder-constructor--: xref:metatx.adoc#MinimalForwarder-constructor--
  8. :xref-MinimalForwarder-getNonce-address-: xref:metatx.adoc#MinimalForwarder-getNonce-address-
  9. :xref-MinimalForwarder-verify-struct-MinimalForwarder-ForwardRequest-bytes-: xref:metatx.adoc#MinimalForwarder-verify-struct-MinimalForwarder-ForwardRequest-bytes-
  10. :xref-MinimalForwarder-execute-struct-MinimalForwarder-ForwardRequest-bytes-: xref:metatx.adoc#MinimalForwarder-execute-struct-MinimalForwarder-ForwardRequest-bytes-
  11. :xref-EIP712-_domainSeparatorV4--: xref:utils.adoc#EIP712-_domainSeparatorV4--
  12. :xref-EIP712-_hashTypedDataV4-bytes32-: xref:utils.adoc#EIP712-_hashTypedDataV4-bytes32-
  13. :xref-EIP712-eip712Domain--: xref:utils.adoc#EIP712-eip712Domain--
  14. :xref-IERC5267-EIP712DomainChanged--: xref:interfaces.adoc#IERC5267-EIP712DomainChanged--
  15. = Meta Transactions
  16. [.readme-notice]
  17. NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/metatx
  18. == Core
  19. :constructor: pass:normal[xref:#ERC2771Context-constructor-address-[`++constructor++`]]
  20. :isTrustedForwarder: pass:normal[xref:#ERC2771Context-isTrustedForwarder-address-[`++isTrustedForwarder++`]]
  21. :_msgSender: pass:normal[xref:#ERC2771Context-_msgSender--[`++_msgSender++`]]
  22. :_msgData: pass:normal[xref:#ERC2771Context-_msgData--[`++_msgData++`]]
  23. [.contract]
  24. [[ERC2771Context]]
  25. === `++ERC2771Context++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.3/contracts/metatx/ERC2771Context.sol[{github-icon},role=heading-link]
  26. [.hljs-theme-light.nopadding]
  27. ```solidity
  28. import "@openzeppelin/contracts/metatx/ERC2771Context.sol";
  29. ```
  30. Context variant with ERC2771 support.
  31. [.contract-index]
  32. .Functions
  33. --
  34. * {xref-ERC2771Context-constructor-address-}[`++constructor(trustedForwarder)++`]
  35. * {xref-ERC2771Context-isTrustedForwarder-address-}[`++isTrustedForwarder(forwarder)++`]
  36. * {xref-ERC2771Context-_msgSender--}[`++_msgSender()++`]
  37. * {xref-ERC2771Context-_msgData--}[`++_msgData()++`]
  38. --
  39. [.contract-item]
  40. [[ERC2771Context-constructor-address-]]
  41. ==== `[.contract-item-name]#++constructor++#++(address trustedForwarder)++` [.item-kind]#internal#
  42. [.contract-item]
  43. [[ERC2771Context-isTrustedForwarder-address-]]
  44. ==== `[.contract-item-name]#++isTrustedForwarder++#++(address forwarder) → bool++` [.item-kind]#public#
  45. [.contract-item]
  46. [[ERC2771Context-_msgSender--]]
  47. ==== `[.contract-item-name]#++_msgSender++#++() → address sender++` [.item-kind]#internal#
  48. [.contract-item]
  49. [[ERC2771Context-_msgData--]]
  50. ==== `[.contract-item-name]#++_msgData++#++() → bytes++` [.item-kind]#internal#
  51. == Utils
  52. :ForwardRequest: pass:normal[xref:#MinimalForwarder-ForwardRequest[`++ForwardRequest++`]]
  53. :constructor: pass:normal[xref:#MinimalForwarder-constructor--[`++constructor++`]]
  54. :getNonce: pass:normal[xref:#MinimalForwarder-getNonce-address-[`++getNonce++`]]
  55. :verify: pass:normal[xref:#MinimalForwarder-verify-struct-MinimalForwarder-ForwardRequest-bytes-[`++verify++`]]
  56. :execute: pass:normal[xref:#MinimalForwarder-execute-struct-MinimalForwarder-ForwardRequest-bytes-[`++execute++`]]
  57. [.contract]
  58. [[MinimalForwarder]]
  59. === `++MinimalForwarder++` link:https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.3/contracts/metatx/MinimalForwarder.sol[{github-icon},role=heading-link]
  60. [.hljs-theme-light.nopadding]
  61. ```solidity
  62. import "@openzeppelin/contracts/metatx/MinimalForwarder.sol";
  63. ```
  64. Simple minimal forwarder to be used together with an ERC2771 compatible contract. See {ERC2771Context}.
  65. MinimalForwarder is mainly meant for testing, as it is missing features to be a good production-ready forwarder. This
  66. contract does not intend to have all the properties that are needed for a sound forwarding system. A fully
  67. functioning forwarding system with good properties requires more complexity. We suggest you look at other projects
  68. such as the GSN which do have the goal of building a system like that.
  69. [.contract-index]
  70. .Functions
  71. --
  72. * {xref-MinimalForwarder-constructor--}[`++constructor()++`]
  73. * {xref-MinimalForwarder-getNonce-address-}[`++getNonce(from)++`]
  74. * {xref-MinimalForwarder-verify-struct-MinimalForwarder-ForwardRequest-bytes-}[`++verify(req, signature)++`]
  75. * {xref-MinimalForwarder-execute-struct-MinimalForwarder-ForwardRequest-bytes-}[`++execute(req, signature)++`]
  76. [.contract-subindex-inherited]
  77. .EIP712
  78. * {xref-EIP712-_domainSeparatorV4--}[`++_domainSeparatorV4()++`]
  79. * {xref-EIP712-_hashTypedDataV4-bytes32-}[`++_hashTypedDataV4(structHash)++`]
  80. * {xref-EIP712-eip712Domain--}[`++eip712Domain()++`]
  81. [.contract-subindex-inherited]
  82. .IERC5267
  83. --
  84. [.contract-index]
  85. .Events
  86. --
  87. [.contract-subindex-inherited]
  88. .EIP712
  89. [.contract-subindex-inherited]
  90. .IERC5267
  91. * {xref-IERC5267-EIP712DomainChanged--}[`++EIP712DomainChanged()++`]
  92. --
  93. [.contract-item]
  94. [[MinimalForwarder-constructor--]]
  95. ==== `[.contract-item-name]#++constructor++#++()++` [.item-kind]#public#
  96. [.contract-item]
  97. [[MinimalForwarder-getNonce-address-]]
  98. ==== `[.contract-item-name]#++getNonce++#++(address from) → uint256++` [.item-kind]#public#
  99. [.contract-item]
  100. [[MinimalForwarder-verify-struct-MinimalForwarder-ForwardRequest-bytes-]]
  101. ==== `[.contract-item-name]#++verify++#++(struct MinimalForwarder.ForwardRequest req, bytes signature) → bool++` [.item-kind]#public#
  102. [.contract-item]
  103. [[MinimalForwarder-execute-struct-MinimalForwarder-ForwardRequest-bytes-]]
  104. ==== `[.contract-item-name]#++execute++#++(struct MinimalForwarder.ForwardRequest req, bytes signature) → bool, bytes++` [.item-kind]#public#