Content pfp
Content
@
0 reply
0 recast
2 reactions

scottrepreneur pfp
scottrepreneur
@scottrepreneur.eth
I'm looking for a simple example of using `L1CrossDomainMessenger` to move tokens/NFTs for a @safe on L1 to the aliased address on the /op-stack. @bountybot 0.125 ETH or equivalent on L2 Success criteria: 1. Safe on L1 with aliased address on L2 2. NFT and/or ERC20 tokens in the aliased address on L2 3. Execute a tx cross-chain via Safe to move the NFT/token to any other address Demo can be on Sepolia and Base/OP Sepolia with a Safe you control. Specifically looking to understand the message required to execute this transfer on the L2 address. Base contracts https://docs.base.org/docs/base-contracts Possibly relevant docs https://docs.optimism.io/connect/resources/glossary#address-aliasing https://docs.optimism.io/builders/app-developers/tutorials/cross-dom-solidity
3 replies
4 recasts
15 reactions

Drew Fisher pfp
Drew Fisher
@drewf.eth
Been a minute since I read those docs, but I think you might need to use the portal contract directly instead of xDM. I assume you want these to happen in separate transactions for clarity?
1 reply
0 recast
1 reaction

scottrepreneur pfp
scottrepreneur
@scottrepreneur.eth
Interesting! Yeah, likely multiple txs for the whole flow. With one tx to execute transferring out of the L2 aliased address.
1 reply
0 recast
0 reaction

Drew Fisher pfp
Drew Fisher
@drewf.eth
Ok I bridged an ERC721 to base, then tried transferring it out of the canonical bridged 721 implementation. Sending a message to it via xDM didn't have permissions to move the token from the aliased address, but transacting directly through the portal did. I'll make a thread with some tx links here.
1 reply
0 recast
1 reaction

Drew Fisher pfp
Drew Fisher
@drewf.eth
I couldn't think of a easy to acquire 721 on mainnet besides a UniV3 position, so that's what I used. To save on gas, I deployed OptimismMintableERC721 for it directly on base, in order to have a destination to bridge the token to. (You can build your own contract for this, with more functionality) https://basescan.org/tx/0x37b662511581a90506f7ea21cd5593195344b599f9472ea7381cda5585b08ba1
1 reply
0 recast
1 reaction

Drew Fisher pfp
Drew Fisher
@drewf.eth
Next, I approved the L1ERC721Bridge to take my NFT, and called bridgeERC721To( univ3_positions_mainnet_addr, just_deployed_univ3_positions_base_addr, my_safe_aliased_addr, tokenId, 5000000gas, 0x) https://etherscan.io/tx/0xb5fb089c405cceefd429e68ca29366ca2c0607837b784bc8e7d1464e061f208e/advanced
1 reply
0 recast
1 reaction

Drew Fisher pfp
Drew Fisher
@drewf.eth
That minted the L2 representation of the NFT to my aliased address on base after the sequencer included it: https://basescan.org/tx/0x331aa06239d6cd005c6d8b1591df13e257b80a36a1e71ab0921c0a1d02378351
1 reply
0 recast
0 reaction

Drew Fisher pfp
Drew Fisher
@drewf.eth
Then, I tried to transfer via the xDM here on mainnet: https://etherscan.io/tx/0x91540abd2961724ac0a172fd63fa3bbbb6d9468e84ee7c32c1c53d871b1e3ae2 But this reverted on L2: https://basescan.org/tx/0xf554618ba98adcabec30c5c839d674c3d1b2ed29f553d922f0c8464f1690d34d
1 reply
0 recast
1 reaction

Drew Fisher pfp
Drew Fisher
@drewf.eth
So then I directly called the Portal with depositTransaction( just_deployed_univ3_positions_base_addr, 0value, 500000gas, false, calldata_for_safeTransferFrom): https://etherscan.io/tx/0x7b24dc6ec788386abb0b8cc8ed29335dc5a73706f713c6680506b57b0a82c4d8 Which shows up as a normal transaction on L2, coming from my safe's aliased address: https://basescan.org/tx/0x984180640a9527c4e48a3f4c399cbeaaa617a7ad9dec30d65f89cc738895a94c
2 replies
0 recast
1 reaction

Drew Fisher pfp
Drew Fisher
@drewf.eth
So that's it! Just call the portal depositTransaction directly, and your alias will execute the transaction on L2. @scottrepreneur.eth LMK if you have any more questions, but I think this answers the ones in your original post and a bit more.
0 reply
0 recast
1 reaction

scottrepreneur pfp
scottrepreneur
@scottrepreneur.eth
Cool! Yes, this is exactly what I'm after. You're under the impression the token wouldn't necessarily have to have been bridged. It could be any token held by the aliased address?
2 replies
0 recast
1 reaction