-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplit-seller-poc.py
More file actions
67 lines (58 loc) · 1.77 KB
/
split-seller-poc.py
File metadata and controls
67 lines (58 loc) · 1.77 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from src.api.clob import ClobAPI
import os
from dotenv import load_dotenv
from web3 import Web3
from src.wallet_manager_v2 import WalletManager
from src.wallet import Wallet # Import the Wallet class directly
from src.constants import USDC_ADDRESS, CTF_ADDRESS, CHAIN_ID
import asyncio
from src.utils.contract_abis import (
get_usdc_abi,
get_factory_abi,
get_enable_trading_abi,
get_ctf_abi,
get_erc20_approve_abi,
get_erc1155_approval_abi,
)
from safe_eth.eth import EthereumClient, TxSpeed
from safe_eth.safe import Safe
from src.constants import (
POLYGON_RPC_URL,
USDC_ADDRESS,
FACTORY_ADDRESS,
SPENDER_ADDRESSES,
CTF_ADDRESS,
MULTI_SEND_ADDRESS,
CHAIN_ID,
MIN_GAS_LIMIT,
MAX_GAS_LIMIT,
)
# Load environment variables
load_dotenv()
# Get the main wallet and proxy wallet addresses
MAIN_WALLET_PRIVATE_KEY = os.getenv("POLYGON_PRIVATE_KEY")
PROXY_WALLET_ADDRESS = os.getenv("POLYGON_PROXY_WALLET_ADDRESS")
wallet_manager = WalletManager()
# Create a Wallet object for the main wallet
main_wallet = Wallet(
address=wallet_manager.w3.eth.account.from_key(MAIN_WALLET_PRIVATE_KEY).address,
private_key=MAIN_WALLET_PRIVATE_KEY,
proxy_address=PROXY_WALLET_ADDRESS
)
print("setting wallet allowance...")
asyncio.run(wallet_manager.set_wallet_allowances(wallet=main_wallet))
# Create an instance of ClobAPI
clob_api = ClobAPI(
base_url="https://clob.polymarket.com",
private_key=MAIN_WALLET_PRIVATE_KEY,
proxy_address=PROXY_WALLET_ADDRESS
)
async def main():
order_hash = await clob_api.place_order(
asset_id=106502016969046937974758355420390684163100926155029166159441000067476621763798,
is_buy=False,
size=5.0,
price=0.99
)
print(f"Order hash: {order_hash}")
asyncio.run(main())