-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathget_weth.py
More file actions
31 lines (24 loc) · 877 Bytes
/
get_weth.py
File metadata and controls
31 lines (24 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from brownie import accounts, config, network, interface
url = "https://goerli-optimism.etherscan.io/tx/{}"
def main():
get_weth()
def get_weth():
amount = 4 * 10**18
dev = accounts.add(config["wallets"]["from_key"])
weth = interface.IWETH(
config["networks"][network.show_active()]["WETH-TestnetMintableERC20"]
)
tx = weth.deposit({"from": dev, "value": amount})
print(f"Received {amount} WETH")
print("View your tx here: " + url.format(tx.txid))
return tx.info()
def withdraw_eth():
amount = 10
dev = accounts.add(config["wallets"]["from_key"])
weth = interface.IWETH(
config["networks"][network.show_active()]["WETH-TestnetMintableERC20"]
)
tx = weth.withdraw(amount, {"from": dev})
print(f"Received {amount} ETH")
print("View your tx here: " + url.format(tx.txid))
return tx.info()