-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test getWrapped1155DeployBytecode dynamic names #4
Conversation
- Replace Wrapped1155 bytecode for adapt dynamic names with diferent length. - Rename `src` to `contract` for truffle compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a side note unrelated to the changes: I'm not super familiar with the project, but I don't quite understand why the deployed bytecode needs to write EVM codes (instead of letting Solidity generate a constructor for example). Is this just a gas optimization?
Otherwise, changes look good.
edit: Ah I see now, its because we are using a minimal proxy implementation for the ERC20 wrapper.
- Rename `tokenNameOffset` to `tokenNameLength`. - Replace `bytes` type to `bytes31` and `uint8` for `tokenName` and `tokenLength`. - Add `Deposit` event. See #4 (comment)
Revert `tokenName` bytes31 to type bytes to be able to slice calldata `data` on override methods `onERC1155Received` and `onERC1155BatchReceived`.
Add dynamic tokenName, symbol, and decimals into the `getWrapped1155DeployBytecode` method as `bytes calldata` `data` parameters to allow use them in `onERC1155Received` and `onERC1155BatchReceived` 1155 methods. This will allow to pass as bytes the encoded bytecode for the `tokenName` and `tokenSymbol` as push bytes32 and `tokenDecimals` as push bytes on the EVM: To call methods with `bytes calldata` parameters it is required to calculate the values on the client using the following steps: - `tokenName`: bytes32, string in hexadecimal and the zero paddings and the length of the string in hexadecimal. eg: for "WrappedERC-1155" is "0x577261707065644552432d31313535000000000000000000000000000000001e". - `tokenSymbol`: bytes32, the string in hexadecimal, zero paddings, and the length of the string in hex. eg: for "WMT" is "0x574d540000000000000000000000000000000000000000000000000000000006". - `tokenDecimal`: bytes, the number in hexadecimal. eg: 18 as 0x12.
Add 1155-to-20-helper repository to generate the bytecode ERC-20 metadas on tests.
- Remove the `abi.decode` receiver addresses and use `operator` as default receiver address on `onERC1155Received` and `onERC1155BatchReceived`. - Remove comments from `getWrapped1155DeployBytecode`.
- Add bytecode especification. - Add More-Minimal Proxy bytecode. - Include references.
- Add token `bytes calldata data` support on batch methods `onERC1155BatchReceived` and `batchUnwrap` with requirement of data.length should be module of 65 with the same size of `ids` and `tokenIds` arrays. - Add SafeMath for add, mul, and div operators. - Add @openzeppelin/contracts `v3.4.0` dependency.
src
tocontract
for truffle compile.Resolves #3