yarn start
(react app frontend)yarn chain
(hardhat backend)yarn deploy
(to compile, deploy, and publish your contracts to the frontend)DEX
and Balloons
.๐ฉโ๐ป Rerunyarn deploy
whenever you want to deploy new contracts to the frontend (runyarn deploy --reset
for a completely fresh deploy if you have made no contract changes).
Balloons.sol
just an example ERC20 contract that mints 1000 to whatever address deploys it. DEX.sol
is what we will build in this tutorial and you can see it starts with a SafeMath library to help us prevent overflows and underflows and also tracks a token (ERC20 interface) that we set in the constructor (on deploy).DEX.sol
:DEX.sol
that is payable and then we can define an amount of tokens that it will transfer to itself:00_deploy_your_conract.js
file. Uncomment the below and add your address:yarn deploy
. The front end should show you you have balloon tokens. We canโt just call init() yet because the DEX contract isnโt allowed to transfer tokens from our account. We need to approve() the DEX contract with the Balloons UI. Copy and paste the DEX address and then set the amount to 5000000000000000000 (5 * 10ยนโธ). You can confirm this worked using the allowance() function. Now we are ready to call init() on the DEX. We will tell it to take (5 *10ยนโธ) of our tokens and we will also send 0.01 ETH with the transaction. You can see the DEX contract's value update and you can check the DEX token balance using the balanceOf function on the Balloons UI.00_deploy_your_conract.js
script try uncommenting the init section so our DEX will start with 3 ETH and 3 Balloons of liquidity:yarn deploy
reset our contract should be initialized as soon as it deploys and we should have equal reserves of ETH and tokens.defaultNetwork
in packages/hardhat/hardhat.config.js
, as well as targetNetwork
in packages/react-app/src/App.jsx
, to your choice of public EVM networksโyarn account
to see if you have a deployer addressyarn generate
to create a mnemonic and save it locally for deploying.yarn account
again to view balances)๐ Runyarn deploy
to deploy to your public network of choice (๐ wherever you can get โฝ๏ธ gas)
Now you are ready to run theyarn verify --network your_network
command to verify your contracts on etherscan ๐ฐ This will be the URL you submit to SpeedRun ๐
yarn build
to package up your frontend.yarn surge
(you could also yarn s3
or maybe even yarn ipfs
?)constants.js
in packages/ract-app/src
.๐ฌ Problems, questions, comments on the stack? Post them to the ๐ scaffold-eth developers chatโ