Skip to content

fassko/nfttallinn2023

Repository files navigation

NFT Tallinn 2023 workshop

Prerequisites

Copy example .env and fill up the needed environment variables

cp .env.example .env

Effective Smart Contract Management

In this workshop, we will go over smart contract code management. Topics we will cover:

  1. Deploy smart contract to the blockchain and verify it

Deploy:

npx hardhat run scripts/deploy.ts --network mumbai

Verify the smart contract and pass the constructor parameters:

npx hardhat verify 0xa4d8fd29c3b3715e4Ade9F89fbd76D57e2839ea7 --network mumbai 'NFT Tallinn 2023' 'NFTTLL23'
  1. Deploy the proxy contract
npx hardhat run scripts/deploy_proxy.ts --network mumbai
  1. Change CONTRACT_ADDRESS in .env file to the proxy address

  2. Get the smart contract implementation

npx hardhat run scripts/current-implementation.ts --network mumbai
  1. Verify the implementation contract
npx hardhat verify --network mumbai 0x69350e1C6702ebb88a47A19f24AaA856A95e85D3
  1. Comment out the getMyTicket function

  2. Upgrade the implementation

npx hardhat run scripts/upgrade.ts --network mumbai
  1. Get the current implementation
npx hardhat run scripts/current-implementation.ts --network mumbai
  1. Verify the current implementation
npx hardhat verify --network mumbai 0x6bfd02B1c1A8C62717Ba1826eaeb6d9F27ECceC2
  1. Upgrade contract to OpenZeppelin defender
  • add contract in OpenZeppelin defender
  • comment out the getParticipantTicket function
  • execute npx hardhat run scripts/propose_upgrade.ts --network mumbai
  • approve and execute proposal in OpenZeppelin Defender
  • get the current implementation npx hardhat run scripts/current-implementation.ts --network mumbai
  • verify the implementation npx hardhat verify 0x69350e1C6702ebb88a47A19f24AaA856A95e85D3 --network mumbai
  1. Use multi signatory wallet

Use a wallet like Safe to avoid the bus factor and avoid a single point of failure. It also allows to collect signatures when upgrading a contract. Let's say you want everyone to vote for mainnet deployment, and only then is an upgrade executed.

About

NFTTallinn 2023 workshop materials

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published