Skip to content
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

Document Sapphire and Remix #866

Closed
matevz opened this issue Jul 4, 2024 · 6 comments · Fixed by #1003
Closed

Document Sapphire and Remix #866

matevz opened this issue Jul 4, 2024 · 6 comments · Fixed by #1003
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@matevz
Copy link
Member

matevz commented Jul 4, 2024

See what is needed for Remix to work seamlessly with Sapphire. Currently, it only works via "universal" metamask connector. A section on this was written years ago for Emerald. Revamp it for Sapphire and move it out of Emerald into a separate chapter under https://docs.oasis.io/dapp/tools/ ➝ Remix.

OFC you won't be able to debug in Remix much against Sapphire because it won't reveal confidential information.

Don't forget to mention the transactions and queries are unencrypted and unsigned.

Don't forget to pinpoint solc version up to 0.8.24 (see rust-ethereum/evm#277).

Also consider, if the Explorer➝Sourcify➝Remix flow is feasible to interact with a smart contract and worth describing it in this chapter how a (non-tech) user could communicate with the smart contract, e.g. if the maintainer decides to shut down the dApp frontend and the user is stuck with the contract and wants to withdraw his assets back. FYI @lukaw3d built a simpler alternative https://abi-playground.oasis.io/ for this.

@matevz matevz added the documentation Improvements or additions to documentation label Jul 4, 2024
@matevz matevz assigned matevz and unassigned matevz Jul 4, 2024
@lukaw3d
Copy link
Member

lukaw3d commented Sep 27, 2024

Maybe we can edit remix to allow sapphire in walletconnect
image

@lukaw3d
Copy link
Member

lukaw3d commented Oct 2, 2024

Reproducing an already verified contract annoyances:
https://explorer.oasis.io/mainnet/sapphire/address/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3

  • Open in Sourcify
  • View in Remix
  • https://remix.ethereum.org/?#activate=sourcify&call=sourcify//fetchAndSave//0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3//23294
  • UI shows Solidity Compiler: 0.8.26 (probably kept selection from before)
    even though cloned metadata.json specified "version": "0.8.16+commit.07a7930e"
  • Open WrappedROSE at path verified-sources/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3/sources/contracts/WrappedROSE.sol
  • Click compile. The resulting bytecode is different!
  • WrappedROSE imports @openzeppelin/contracts/token/ERC20/ERC20.sol, and verified correct version of this dependency was cloned into verified-sources/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3/sources/@openzeppelin/contracts/token/ERC20/ERC20.sol
    file starts with

    // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

  • But Remix automatically downloaded latest dependency into .deps/npm/@openzeppelin/contracts/token/ERC20/ERC20.sol

    // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
    and compiled using this instead

  • To reproduce the original bytecode, manually switch compiler version 0.8.16. Adjust advanced config to match metadata.json "optimizer": { "enabled": true, "runs": 0 }
  • Remix now marks modern ERC20.sol as incompatible with compiler. Delete .deps/npm/@openzeppelin/contracts and move verified-sources/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3/sources/@openzeppelin/contracts there.
  • Recompile
  • still "The deployed and recompiled bytecode don't match."

🤷

@rube-de rube-de self-assigned this Oct 8, 2024
@rube-de rube-de linked a pull request Oct 24, 2024 that will close this issue
@rube-de
Copy link
Contributor

rube-de commented Oct 28, 2024

Maybe we can edit remix to allow sapphire in walletconnect image

IMHO that's low prio. I never noticed that's possible before 😅 and can't remember a tutorial that used WalletConnect in Remix. I could see to use it to deploy via ledger if you want to do it directly with Ledger live, but you could also deploy with Ledger via MetaMask.

@rube-de
Copy link
Contributor

rube-de commented Oct 30, 2024

Reproducing an already verified contract annoyances: https://explorer.oasis.io/mainnet/sapphire/address/0x8Bc2B030b299964eEfb5e1e0b36991352E56D2D3

Open in Remix from sourcify just opens the default workspace in Remix

opened an issue on their side ethereum/sourcify#1730

@rube-de
Copy link
Contributor

rube-de commented Oct 31, 2024

I think ABI Playground should be separate chapter
opened an issue for this #1012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants