๐ŸŠ
Token Allocator
Allocator.sol distributes tokens to addresses on a ratio defined by Governor.sol

Branch Info

Author: Austin Griffith Source code: https://github.com/scaffole-eth/scaffold-eth-examples/tree/new-allocator Intended audience: Intermediate Topics: Scaffold-eth, ERC-20 token

๐Ÿƒโ€โ™€๏ธ Quick Start

Token Allocator Example

Allocator.sol to distribute tokens/ETH at a predefined ratio to a number of addresses.
Allows the community to send funds to a neutral token distributor.

๐ŸŠ Deploying an Allocator:

git clone https://github.com/scaffold-eth/scaffold-eth-examples.git new-allocator
โ€‹
cd new-allocator
โ€‹
git checkout new-allocator
โ€‹
yarn install
edit packages/hardhat/scripts/deployAllocator.js to change the Governor address
create a deployer mnemonic:
โ€‹
yarn generate
โ€‹
(Fund this address by running yarn account and sending ETH to it.)
then deploy your allocator:
โ€‹
yarn deployAllocator
โ€‹

๐Ÿƒโ€โ™€๏ธ Longer form ๐Ÿ— scaffold-eth instructions for working with the app/gov:

required: Node plus Yarn and Gitโ€‹
git clone https://github.com/austintgriffith/scaffold-eth.git new-allocator
โ€‹
cd new-allocator
โ€‹
git checkout new-allocator
yarn install
yarn start
If you want to bring up a local chain and work there, edit hardhat.config.js and app.jsxhttps://github.com/austintgriffith/scaffold-eth/tree/simple-nft-example to use localhostinstead ofmainnet`.
in a second terminal window:
cd scaffold-eth
yarn chain
in a third terminal window:
cd scaffold-eth
yarn deploy
App:
๐Ÿ’ผ Edit your deployment script deploy.js in packages/hardhat/scripts
๐Ÿ“ฑ Open http://localhost:3000 to see the app
Contracts:
๐Ÿ” Edit the Allocator contract Allocator.sol in packages/hardhat/contracts
๐Ÿ” Edit the ExampleToken contract ExampleToken.sol in packages/hardhat/contracts
Frontend:
๐Ÿ“ Edit your frontend App.jsx in packages/react-app/src
๐Ÿ“ Edit your frontend Allocations.jsx in packages/react-app/src/views
๐Ÿ“ Edit your frontend Distributions.jsx in packages/react-app/src/views
How To:
Edit your token allocations in the deploy script deploy.js in packages/hardhat/scripts
โ€‹โ€‹
โ€‹
โ€‹
Then redeploy your contracts:
yarn deploy
Your Allocations should be displayed in the frontend: โ€‹
โ€‹
โ€‹
Use the Debug tab to check the ExampleToken balance of the Allocator address: โ€‹
โ€‹
โ€‹
Use the from in the Distributions tab to distribute the token: โ€‹
โ€‹
โ€‹
Distributions can be called by anyone and they will happen at the defined ratio: โ€‹
โ€‹
โ€‹
Use address(0) to distribute ETH: โ€‹
โ€‹
โ€‹
Copy link
On this page
Branch Info
๐Ÿƒโ€โ™€๏ธ Quick Start
Token Allocator Example
๐ŸŠ Deploying an Allocator:
๐Ÿƒโ€โ™€๏ธ Longer form ๐Ÿ— scaffold-eth instructions for working with the app/gov: