-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: smart contract setTokenVerified calls through ethers #272
Conversation
…nor changes on the config files.
This pull request has been linked to Shortcut Story #927: Use the ethers library instead of web3js for the serverless contract calls. |
…ingly, customize prisma logs, update the config files to match the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. Related to #266. I would request @jsonsivar to eyeball these.
contracts/hardhat.config.ts
Outdated
apiKey: { | ||
polygonMumbai: POLYGONSCAN_KEY, | ||
}, | ||
// apiKey: ETHERSCAN_API_KEY ? ETHERSCAN_API_KEY : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can set this for both networks? (same from one previous pr 🤔)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the previous pr. But since this is going to be merged after, I'll update it here too
@@ -37,6 37,8 @@ export const submitBuildInfo = async ( | |||
domain: buildInfo.domain, | |||
}, | |||
}); | |||
console.log(buildRecord); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe leftover
serverless/src/libs/nfa-contract.ts
Outdated
if ( | ||
process.env.PRIVATE_KEY === undefined || | ||
process.env.JSON_RPC === undefined || | ||
process.env.CONTRACT_ADDRESS === undefined | ||
) { | ||
throw Error('Private key or the JSON RPC environment variable not set.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good split this in different conditions and throw different error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
…ate hardhat config.
serverless/scripts/deploy.sh
Outdated
/bin/bash ./scripts/prepare-node-modules-lambda-layer.sh | ||
|
||
echo "${bold}Deploying to AWS lambda${normal}" | ||
yarn sls deploy --stage dev --verbose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we parameterize the --stage so we can cal it with dev or prd in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added support for the flag
serverless/serverless.yaml
Outdated
timestamp: true | ||
ipfsHash: true | ||
tokenId: true | ||
environment: # TODO They won't be loaded from the shell environment, need to find a way to pass them from the deployment script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry, we should just save the values in AWS Parameter Store and then point to them from the next lines.
Serverless Update:
-> The ethers library migration is completed. This was the only major remaining task. Now, handlers can submit transactions to networks in order to verify each token (both build and mint handlers do this)
Possible future enhancements:
-> I have made some minor changes to the Prisma config file and helper library. With the new changes we should see only error and warning logs from Prisma Client (doesn't seem to work though, I still see queries). Would be cool to look into it during the cleaning phase.
-> Right now, the gas cost is comfortably hard-coded. I don't think we are ever going to need more than what I have set currently, but we also need to take the network status into account. It would be cool to look into how we can set the gas costs and priority fees automatically based on the current network status.
-> Overall not an important task but we might want to load the ABI from our contracts directory with the latest deployments. The serverless side currently has it's own copy of the ABI. In the end, it is always going to need that copy because it's packed into the libs layer and uploaded to aws. Also considering the fact that we do deployments to goerli, main-net, and mumbai, it's going to be tricky to decide which one to use. I think the current implementation handles the job very well and I don't think we should change it. But wanted to mention just in case somebody else has a different idea.