Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion bera_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from config.abi_config import erc_20_abi, honey_abi, bex_abi, bend_abi, bend_borrows_abi, ooga_booga_abi
from config.address_config import bex_swap_address, usdc_address, honey_address, honey_swap_address, \
bex_approve_liquidity_address, weth_address, bend_address, bend_borrows_address, wbear_address, zero_address, \
ooga_booga_address
ooga_booga_address, ooga_booga_address_1


class BeraChainTools(object):
Expand Down Expand Up @@ -367,6 +367,27 @@ def honey_jar_mint(self):
order_hash = self.w3.eth.send_raw_transaction(signed_txn.rawTransaction)
return order_hash.hex()

def honey_jar_mint_NY(self):
allowance_balance = self.honey_contract.functions.allowance(self.account.address, ooga_booga_address_1).call()
if allowance_balance / 1e18 < 4.2:
raise ValueError(
f'需要授权\nplease run : \nbera.approve_token(ooga_booga_address_1, int("0x" + "f" * 64, 16), "{honey_address}")')
has_mint = self.ooga_booga_contract_NY.functions.hasMinted(self.account.address).call()
if has_mint:
return True
signed_txn = self.w3.eth.account.sign_transaction(
dict(
chainId=80085,
nonce=self.get_nonce(),
gasPrice=int(self.w3.eth.gas_price * 50),
gas=234500 + random.randint(1, 10000),
to=self.w3.to_checksum_address(ooga_booga_address_1),
data='0xa6f2ae3a',
),
self.account.key)
order_hash = self.w3.eth.send_raw_transaction(signed_txn.rawTransaction)
return order_hash.hex()

def deploy_contract(self, contract_source_code, solc_version):
"""
部署合约
Expand Down
1 change: 1 addition & 0 deletions config/address_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
bend_borrows_address = w3.to_checksum_address('0xfb618D1e361C362adDE4E148A4Dc85465a0A4A22')
bend_pool_address = w3.to_checksum_address('0x9b7666d47F5D103f3D51d0Dc227BB57f115C6021')
ooga_booga_address = w3.to_checksum_address('0x6553444CaA1d4FA329aa9872008ca70AE6131925')
ooga_booga_address_1 = w3.to_checksum_address('0xDc094eaC7CC01224E798F34543a8F9e9D2559479')