neu-fi / regen-bingo

Monorepo for both backend and contract developments of Regen Bingo!
https://regen.bingo
2 stars 1 forks source link

Parameterize hardcoded texts in the SVG #66

Closed hantuzun closed 1 year ago

hantuzun commented 1 year ago

The text below is hardcoded now:

Donating 0.05 ETH · Gitcoin Alpha Round · 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 · January 31, 2023

Generate the text from the following parameters:

Donating should be changed to Donated when the game ends.

First, these parameters should be added to the constructor. Deployment scripts must be updated as well. Then, these parameters must be passed to RegenBingoMetadata and finally to RegenBingoSVG.

koybasimuhittin commented 1 year ago

Should we use an other contract for translating timestamp into the date (considering the leap years and other things it is a huge code)? I can write something like that. If we should use, would it be consume gas? There will be only view functions but I've just learned that calling view functions from another contract consumes gas. If that is true we can simply pass a string of the draw date to the constructor.

hantuzun commented 1 year ago

View functions don't consume gas. If a view function calls another contract's view function, that can't consume gas. Only non-view functions are run by the network, therefore require the gas. The view functions are computed by the nodes and results are returned back to the callee.

Ideally, we better use another deployed contract for converting timestamp to human readable dates.

hantuzun commented 1 year ago

Here's what I suggest:

We would need to add the interface for this function, and we should deploy the contract to Goerli once.

This is another alternative: https://github.com/RollaProject/solidity-datetime#getmonth

I prefer the following format: January 31, 2023 23:59 UTC. It's way more humanized than 2023-01-31 23:59 UTC.

koybasimuhittin commented 1 year ago

Deployed to this address on goerli - 0x85CC560EfebA375959B0FBA451cF4eBD1c8E6FA6

hantuzun commented 1 year ago

Closed with PR https://github.com/neu-fi/regen-bingo/pull/71 by @koybasimuhittin