Jump to content

Dorin Marian Iancu

Members
  • Content Count

    4
  • Joined

  • Last visited

  • Days Won

    1

Dorin Marian Iancu last won the day on January 26

Dorin Marian Iancu had the most liked content!

Community Reputation

1 Neutral

About Dorin Marian Iancu

  • Rank
    Novice
  1. You can use the self.get_block_timestamp() api function, which gives you the time as a unix timestamp. You can then calculate the date and time from it.
  2. The blockchain itself doesn't have that information, so you would need something like an Oracle. A chainlink smart contract is in the works, so we should have something like that in the near future. Still, keep in mind you have to trust a third party, so the results might either be approximate or wrong altogether.
  3. You should be able to do something like this: let one_hundred_ten_percent = your_big_uint + your_big_uint / BigUint::from(10u32); Keep in mind though that because of how integer division works, you can end up with unexpected values.
  4. 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.
×
×
  • Create New...