I have made a contract(say MYNFT contract) which is upgradeable. Now I have a proxy contract and implementation contract (MYNFT contract). In Implementation, an user can mint a NFT if the user wires required amount of dummytoken(ERC20 token) to MYNFT contract. (I have used Chainlink Token (erc20) as dummy token (available on polygon Mumbai testnet) for my example project).

The minting code works in the following way:

  • I check whether the user has enough balance on chainlink token contract.
  • If yes, the user then needs to approve MYNFT Contract to take out necessary amount of erc20 token.This is something which the user has to do by visiting the Chainlink token address on polygon Mumbai testnet and approving MYNFT contract address with necessary amount of chainlink token needed for minting.
  • Once approved, another function call happens which takes the allowance(post users appoval) and wires the chainlink tokens to MYNFT contract from user's account.
  • once done, the user is allocated a NFT.

Now the question is the following:

  • For MYNFT contract to make a transfer call from users account to self account, it needs to have matic/ether, else execution would fail. Where should the ether be stored now given it is upgradeable?
  • Should it be in proxy? Also, for proxy to delegate the call where is it getting the gas from? It needs to have some matic/ether correct for it to make endless number of calls for all users which come and mint token.
  • Should it be in implementation given that implementation functions are invoked in the end?
  • should I also add a receive(){} function in MYNFT contract or is there any other way to make the implementation contract accept some amount of ether in case, i need to have some ether available in implementation to make the transfer call to chainlink contract.

I hope I was able to explain the problem statement clearly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.