Developers Forum for XinFin XDC Network

Haedarah Ali
Haedarah Ali

Posted on • Updated on

Some function calls aren't getting executed correctly

Greetings,

I have deployed and verified 3 contracts on xdc apothem testnet. The contracts are: an implementation contract, a proxy that points to the above implementation initially, and a Factory that is responsible for creating instances of the implementation.

The implementation contract is an ERC-20 contract with custom logic.
In the factory contract, there is an ownable function create(address,uint8,string,string). Once called, it should deploy an instance of the implementation, and return the address of that newly-created contract.

When I am trying to call create(address,uint8,string,string) from the Factory, I am getting an error which implies that the uint8 value that is getting passed as an argument, is being read as a value of the transaction, as shown in the below snapshots.

What could be the reason of this? Thanks for your time!

Image description

Image description

Discussion (8)

Collapse
gzliudan profile image
Daniel Liu • Edited on

You are using solidity v0.8.26 which is not supported by xdc chain at current time. Please use v0.8.23 instead, and feel free to call me if you still face problem.

Collapse
haedarah_ali profile image
Haedarah Ali Author • Edited on

Thanks for the reply.
I tried to adjust the compiler version, but the contract isn't getting verified on the new settings.

Settings on Remix:
The deployed code
Initiating the verification:
Explorer-slide1
Specifying the exact same settings in order to verify:
Explorer-slide2
Pasting the flattened code:
Explorer-slide3

Still, the contract isn't getting verified :((
What can I do better?

Collapse
gzliudan profile image
Daniel Liu

Could you please share your codes on GitHub ? Then I can study your issue.

Thread Thread
haedarah_ali profile image
Haedarah Ali Author
Thread Thread
gzliudan profile image
Daniel Liu • Edited on

Please set version to v0.8.23 in solidity files correctly. I found you are still using higher versions, such as:

pragma solidity ^0.8.20;
pragma solidity ^0.8.26;
Enter fullscreen mode Exit fullscreen mode

Please change them to:

pragma solidity 0.8.23;
Enter fullscreen mode Exit fullscreen mode

Then compile and deploy your contracts again.

Thread Thread
Sloan, the sloth mascot
Comment deleted
haedarah_ali profile image
Haedarah Ali Author

I have added a directory that includes the codes that I am actually deploying and using for verification:
( github.com/Haedarah/xdc-lite-versi... )

I shared the separated codes earlier because it is easier to deal with them.

Collapse
haedarah_ali profile image
Haedarah Ali Author

[solution]

  • Been able deploy and verify contracts via hardhat (been using Foundry before, and there were some problems regarding gas estimation and verification).
  • Used https://abapi.blocksscan.io/api as the explorer API for Apothem testnet. (Found it in this article)