geb-console
Install
npm install -g @reflexer-finance/geb-console@latest
Use
To start the console run the command:
geb-console
geb-console mainnet
PK=0xabc123... geb-console
Once loaded you should see:
Start geb-console on Kovan...
Context objects:
- geb - ethers
- gebAdmin - now()
- contracts - provider
- BigNumber - info(func)
- ETH_A - WAD
- RAD - RAY
- metamask(<txRequest>) - wad(<BN|number|string>)
- ray(<BN|number|string>) - rad(<BN|number|string>)
- parseWad(<BN>) - parseRay(<BN>)
- parseRad(<BN>) - WAD
🗿 >
A few examples of what you can do in the JS console:
🗿 > globalDebt = await geb.contracts.safeEngine.globalDebt()
🗿 > globalDebt.toString()
'600058105670389218985501651609537665157840485958'
🗿 > amount = ethers.utils.parseEther('1')
🗿 > await provider.getBalance("0x7eb8caf136Ba45DD16483188cbe8b615f6251ca7")
BigNumber { _hex: '0x1496cdb253dea8a31690', _isBigNumber: true }
🗿 > _.toString()
'97229163269988743845520'
🗿 > parseWad(_)
'97229.16326998874384552'
🗿 > info(geb.contracts.liquidationEngine.liquidateSAFE)
'function (collateralType, safe)'
🗿 > geb.contracts.liquidationEngine.liquidateSAFE(ETH_A, '0xc6a789e33b40b13144e21816b853744562686131')
{
to: '0x84334811e26fc70cC5a68BB2878b0F18E278C397',
data: '0x4c28be574554482d41000000000000000000000000000000000000000000000000000000000000000000000000000000c6a789e33b40b13144e21816b853744562686131',
value: undefined
}
🗿 > metamask(tx)
Open you browser at http:
🗿 > metamask(geb.deployProxy())
🗿 > proxy = await geb.getProxyAction("<Your address>")
🗿 > tx = proxy.openLockETHAndGenerateDebt(wad(1), ETH_A, wad(100))
🗿 > metamask(tx)
Mainnet fork
Run
geb-console mainnet-fork
This will start a Hardhat mainnet fork at the current block.
It exposes an RPC endpoint on port 8545 that can be used to deploy contracts.
You can then use the console:
🗿 > wallet.address
'0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
🗿 > await wallet.sendTransaction({value: wad(10), to: "0x1234..."})
🗿 > b1 = await getImpersonatingSigner("0xb1adced...")
await b1.sendTransaction({...})
🗿 > stopImpersonate("0xb1adced...")
🗿 > await mine()
🗿 > await mine(3600)