PatrickAlphaC / rwa-creator

127 stars 56 forks source link

Constant RWA_CONTRACT on sellTslaAndSendUsdc.js is not known before deploying #12

Open sheinix opened 3 months ago

sheinix commented 3 months ago

Hi @PatrickAlphaC great tutorial as always!

One thing I noticed and can't get my head around is that to deploy dTSLA we need to provide the js code in the constructor, but the redeem js code contains the contract address that we get after deploying.

Seems like a 🐔 and 🥚 problem.

Would any of these two options fix the issue? 🤔

  1. Either set an update function to set the updated reedem code js code after deploy, or pass it as a variable on the sendRedeemRequest function.
  2. Deploy with create2 so we can know which address is going to be deployed beforehand so it can containt the correct RWA contract address?
PatrickAlphaC commented 3 months ago

Sure! So I should have updated this repo as such, but basically you deploy your contract, and then call like setRedeemSource so that your redeem code is updated.

You're right! This should be fixed.

sheinix commented 3 months ago

i'll open a pr, but cannot push new branches