-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
2,055 additions
and
2,003 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const IERC20 = artifacts.require("IERC20"); | ||
|
||
const toUSDC = (num) => web3.utils.toWei(num.toString(), "mwei") | ||
const fromUSDC = (num) => web3.utils.fromWei(num.toString(), "mwei") | ||
|
||
module.exports = async function (callback) { | ||
try { | ||
const usdcAddress = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" | ||
const unlockedAccount = "0xc647F8f745a59B74A26d76Da7dcCc8BadF649C32" | ||
// Accounts given to us by ganache | ||
const accounts = await web3.eth.getAccounts() | ||
const usdc = new web3.eth.Contract(IERC20.abi, usdcAddress) | ||
// Fetch unlocked account and first development account usdc balances | ||
const balanceUnlocked = await usdc.methods.balanceOf(unlockedAccount).call() | ||
const balanceDev = await usdc.methods.balanceOf(accounts[0]).call() | ||
console.log(`Unlocked account usdc balance before transfer ${fromUSDC(balanceUnlocked)}`) | ||
console.log(`First dev account usdc balance before transfer ${fromUSDC(balanceDev)}`) | ||
// Transfer unlocked accounts usdc balance to the first development account | ||
await usdc.methods.transfer(accounts[0], balanceUnlocked).send({from: unlockedAccount}) | ||
// Fetch new development usdc balance | ||
const newBalanceDev = await usdc.methods.balanceOf(accounts[0]).call() | ||
const newBalanceUnlocked = await usdc.methods.balanceOf(unlockedAccount).call() | ||
console.log(`Unlocked account usdc balance after transfer ${fromUSDC(newBalanceUnlocked)}`) | ||
console.log(`First dev account usdc balance after transfer ${fromUSDC(newBalanceDev)}`) | ||
} | ||
catch (error) { | ||
console.log(error) | ||
} | ||
callback() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.App { | ||
text-align: center; | ||
} | ||
|
||
.App-logo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.App-header { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
color: white; | ||
} | ||
|
||
.App-link { | ||
color: #61dafb; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} |
Oops, something went wrong.