1.1.45 • Published 3 years ago

@reflexer-finance/geb-console v1.1.45

Weekly downloads
117
License
MIT
Repository
-
Last release
3 years ago

geb-console

Install

npm install -g @reflexer-finance/geb-console@latest

Use

To start the console run the command:

geb-console

# Default network is kovan, to start it on mainnet run
geb-console mainnet

# To preload a private key, pass an env variable PK
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:

// Fetch some system variables
// Hint: use TAB autocomplete to see what's available
🗿 > globalDebt = await geb.contracts.safeEngine.globalDebt()

// Print the BigNumber as string (45 decimals RAD)
🗿 > globalDebt.toString()
'600058105670389218985501651609537665157840485958'

// We expose the objects `ethers` and `provider` from the ether.js library
🗿 > amount = ethers.utils.parseEther('1')

🗿 > await provider.getBalance("0x7eb8caf136Ba45DD16483188cbe8b615f6251ca7")
BigNumber { _hex: '0x1496cdb253dea8a31690', _isBigNumber: true }

// Hint: use the underscore to refer to the previous command result
🗿 > _.toString()
'97229163269988743845520'

// Pass a string, number or Bignumber to this function display a converted readable amount
🗿 > parseWad(_)
'97229.16326998874384552'

// Hint: use the `info` function to see the prototype of a function
🗿 > info(geb.contracts.liquidationEngine.liquidateSAFE)
'function (collateralType, safe)'

// Contract interaction e.g: Manually liquidate a safe
🗿 > geb.contracts.liquidationEngine.liquidateSAFE(ETH_A, '0xc6a789e33b40b13144e21816b853744562686131')
{
  to: '0x84334811e26fc70cC5a68BB2878b0F18E278C397',
  data: '0x4c28be574554482d41000000000000000000000000000000000000000000000000000000000000000000000000000000c6a789e33b40b13144e21816b853744562686131',
  value: undefined
}

// Sign transaction with metamask!
🗿 > metamask(tx)
Open you browser at http://localhost:8084

// Deploy a proxy (geb account)
🗿 > metamask(geb.deployProxy())
// Confirm transaction and wait for the tx to be mined...

// Get the newly created proxy object
🗿 > proxy = await geb.getProxyAction("<Your address>")

// Open a safe with 1 ETH collateral and 100 RAI debt
🗿 > tx = proxy.openLockETHAndGenerateDebt(wad(1), ETH_A, wad(100))
🗿 > metamask(tx)

// Hint: use the `.editor` command to paste a multiline command
// Hint: access all contract of the GEB system under `geb.contracts.<contract name>`
// Hint: See geb.js full docs at https://docs.reflexer.finance/geb-js/getting-started

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:

// Make transactions with the default wallet funded with 10k ETH
🗿 > wallet.address
'0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
🗿 > await  wallet.sendTransaction({value: wad(10), to: "0x1234..."})

// Impersonate any account
🗿 > b1 = await getImpersonatingSigner("0xb1adced...")
await b1.sendTransaction({...})
🗿 > stopImpersonate("0xb1adced...")

// Mine blocks
🗿 > await mine()
🗿 > await mine(3600) // Add seconds to the next block's timestamp
1.1.45

3 years ago

1.1.44

3 years ago

1.1.43

3 years ago

1.1.30

4 years ago

1.1.34

3 years ago

1.1.33

4 years ago

1.1.32

4 years ago

1.1.31

4 years ago

1.1.38

3 years ago

1.1.37

3 years ago

1.1.36

3 years ago

1.1.35

3 years ago

1.1.39

3 years ago

1.1.41

3 years ago

1.1.40

3 years ago

1.1.42

3 years ago

1.1.29

4 years ago

1.1.28

4 years ago

1.1.27

4 years ago

1.1.26

4 years ago

1.1.25

4 years ago

1.1.23

4 years ago

1.1.24

4 years ago

1.1.22

4 years ago

1.1.21

4 years ago

1.1.20

4 years ago

1.1.19

4 years ago

1.1.18

4 years ago

1.1.17

4 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.2

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.4.11

4 years ago

0.4.10

4 years ago

1.0.0

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.9

4 years ago

0.4.8

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.12

5 years ago

0.3.11

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.2

5 years ago

0.3.3

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.28

5 years ago

0.0.27

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.22

5 years ago

0.0.23

5 years ago

0.0.24

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.15

5 years ago

0.0.17

5 years ago

0.0.18

5 years ago

0.0.19

5 years ago

0.0.14

5 years ago

0.0.12

5 years ago

0.0.13

5 years ago

0.0.10

5 years ago

0.0.11

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.5

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.4

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago