Jump to content

How can I pass a date or string argument to a function

Recommended Posts

I'm assuming you mean sending it as argument to an already deployed smart contract, using erdpy.

There is no built-in "date" type in either C or Rust smart contracts. You will have to use unix timestamp as a u64.

As for string, you'll have to hex-encode the bytes. There are plenty of tools online that do this, I personally use https://www.rapidtables.com/convert/number/ascii-to-hex.html

Make sure you add a "0x" in front and use "None" as delimiter.

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...