Building DeFi On Avalanche - The Hype Is Real

Goodnight, sweet prince.
Sure buddy. Heard it all before. Won’t believe it til’ I see it…
Time to grip it and rip it
Hmmm. Might just be the gamechagner we’re looking for…

The Nitty Gritty Details

  • Deploy a local Avalanche Testnet node
  • Deploy a local Avalanche wallet
  • Fund the wallet with AVAX from a faucet
  • Move that AVAX to a Metamask wallet
  • Deploy my ERC-20 token
  • Deploy Pangolin
  • Add liquidity to Pangolin with my ERC-20 token and AVAX
  • Perform a swap between AVAX and my ERC-20 token

Running A Local Avalanche Node

go get -v -d github.com/ava-labs/avalanchego/...
cd $GOPATH/src/github.com/ava-labs/avalanchego
./scripts/build.sh
./build/avalanchego --network-id=local --staking-enabled=false --snow-sample-size=1 --snow-quorum-size=1
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"info.isBootstrapped",
"params": {
"chain":"X"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
{“jsonrpc”:”2.0",”result”:{“isBootstrapped”:true},”id”:1}

Deploy a Local Avalanche Wallet and Faucet and Fund Metamask

git clone https://github.com/ava-labs/avalanche-wallet.git
cd avalanche-wallet
yarn install
yarn serve
git clone https://github.com/ava-labs/avalanche-faucet.git
cd avalanche-faucet
npm install
DROP_SIZE_X=90000000000000
DROP_SIZE_C=900000000000000000000
yarn serve
Network Name: Avalanche Local
New RPC URL: http://localhost:9650/ext/bc/C/rpc
ChainID: 0xa868
Symbol: AVAX
Explorer: N/A

Creating an ERC-20 Token On Avalanche

http://remix.ethereum.org/#optimize=true&runs=200&evmVersion=null&version=soljson-v0.6.6+commit.6c089d02.js
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/presets/ERC20PresetMinterPauser.sol";

Deploying Pangolin on Avalanche

  1. Deploy factory contract.
  2. Deploy router contract.
constructor(address _feeToSetter) public { feeToSetter = _feeToSetter; }
constructor(address _factory, address _WETH) public { factory = _factory; WETH = _WETH; }
bytes32 public constant INIT_CODE_PAIR_HASH = keccak256(abi.encodePacked(type(UniswapV2Pair).creationCode));
constructor(address _factory, address _WAVAX) public {
factory = _factory;
WAVAX = _WAVAX;
}
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts);
100,["0xEA3D75C5734fdB31a463DcF5bBf10354f6077890","0x3644315edf858AB39460921e395C2dbd2b41d31f"],0x34c3a99ACcf0267965BA2Da676ab9E80F9ebF3A4, 1640995200

Let’s Gooooooooooo!

--

--

--

Building Prospero on Avalanche.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Community Update #4

5 Coins to Consider During The Crypto Crash

Lobster Daily #239 – Daily Recap – December 9:

DXB token is a project that plans to include many technologies for decentralized finance

Are Crypto Pump groups profitable for new-comers in 2021?

Ethereum ERCs — What Are They and Which Should You Know?

PulseX Sacrifice Phase

Kawris Coin is Set to Be The Game Changer in The Crypto-payment Industry

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Louis Lapat

Louis Lapat

Building Prospero on Avalanche.

More from Medium

X — The End of Winter

The Rabbit Hole #13🕳:

DeFi 2.0 — Frog Nation, Wizards, and the Future of France 🐸🇫🇷🧙(3,3)

The world of Defi has experienced a shift lately.