Open vm06007 opened 3 weeks ago
As a result now your basic example simply won't work
@jatZama can you take a look?
Hi @vm06007 !
The issue you're experiencing arises because Remix does not respect the dependency versions specified in the package.json
file. When you use the fhevm-contracts
package in Remix, it defaults to using the latest version of fhevm, which is 0.5.0, regardless of the version declared in package.json
. fhevm-contracts
has not been updated and is still using fhevm
0.4.0.
If you want to use fhevm-contracts
with fhEVM 0.4.0, we advise you to use our hardhat template which is still on 0.4.0.
Since we just released fhEVM 0.5.0, and will do many updates in the coming days, I'd suggest you continue on 0.4.0 in the meantime, using hardhat template.
Hi @vm06007 ! The issue you're experiencing arises because Remix does not respect the dependency versions specified in the
package.json
file. When you use thefhevm-contracts
package in Remix, it defaults to using the latest version of fhevm, which is 0.5.0, regardless of the version declared inpackage.json
.fhevm-contracts
has not been updated and is still usingfhevm
0.4.0.If you want to use
fhevm-contracts
with fhEVM 0.4.0, we advise you to use our hardhat template which is still on 0.4.0.Since we just released fhEVM 0.5.0, and will do many updates in the coming days, I'd suggest you continue on 0.4.0 in the meantime, using hardhat template.
I don't control which package.json
is used for https://remix.zama.ai/ I'm hoping ZAMA team can fix it so anyone can open Zama Remix and try out all examples or at least play with Zama Network accordingly to all tutorials and updates that just keep coming.
We will fix everything related to Remix and fhevm-contracts so they will be compatible with new fhevm release next week, this was a major release compared to previous ones since we revamped the whole stack. Thank you for your understanding.
Thanks! Looking forward to stable library version
If it is urgent and you really need to use Remix instead of hardhat, meanwhile I found a temporary fix: Change first import line :
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity ^0.8.20;
import "fhevm@0.4.0/lib/TFHE.sol";
import "fhevm-contracts/contracts/token/ERC20/EncryptedERC20.sol";
contract MyERC20 is EncryptedERC20 {
constructor() EncryptedERC20("MyToken", "MYTOKEN") {
_mint(1000000, msg.sender);
}
}
Remove .deps/
folder then save file, this will download both fhevm@0.4.0/
and fhevm/
folders inside .deps/npm/
directory.
Now remove fhevm/
and rename the fhevm@0.4.0/
folder to fhevm/
.
Finally remove the @0.4.0 from first import in Solidity, now you should be able to compile the ERC20 contract in Remix.
If it is urgent and you really need to use Remix instead of hardhat, meanwhile I found a temporary fix: Change first import line :
// SPDX-License-Identifier: BSD-3-Clause-Clear pragma solidity ^0.8.20; import "fhevm@0.4.0/lib/TFHE.sol"; import "fhevm-contracts/contracts/token/ERC20/EncryptedERC20.sol"; contract MyERC20 is EncryptedERC20 { constructor() EncryptedERC20("MyToken", "MYTOKEN") { _mint(1000000, msg.sender); } }
Remove
.deps/
folder then save file, this will download bothfhevm@0.4.0/
andfhevm/
folders inside.deps/npm/
directory. Now removefhevm/
and rename thefhevm@0.4.0/
folder tofhevm/
. Finally remove the @0.4.0 from first import in Solidity, now you should be able to compile the ERC20 contract in Remix.
Or as was suggested can also just do "Clone Workspace" from https://github.com/zama-ai/fhevm-hardhat-template
And then it also simply works (just need to specify github username/email that comes a bit inconvenient)
AH yes good catch, this is way simpler. I did not know it was possible to create a new workspace from an existing Git repo.
https://github.com/zama-ai/fhevm-contracts/blob/7bfbfda98541d02e9c4ccc8c74354eb00e9ea178/contracts/token/ERC20/EncryptedERC20.sol#L68
This no longer works with fhevm/lib/TFHE.sol function signature seems to be different and does not work with example in Zama Remix as well