Skip to content

Commit 52a89a4

Browse files
authored
Merge pull request czbag#9 from Birzha76/main
New modules added
2 parents 22d35f3 + 475e276 commit 52a89a4

File tree

10 files changed

+289
-15
lines changed

10 files changed

+289
-15
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,5 @@ pyproject.toml
167167
__pycache__/
168168
*/__pycache__/
169169
.idea/
170-
accounts.txt
170+
accounts.txt
171+
logging.log

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,19 @@ python main.py
6565

6666
19. RubyScore Vote
6767

68-
20. Create Gnosis Safe
68+
20. SecondLive Sign In
6969

70-
21. Deploy any contract
70+
21. Owlto Daily CheckIn
7171

72-
22. Custom routes - actions to be performed sequentially or randomly
72+
22. Create Gnosis Safe
7373

74-
23. Check gas before starting the module, if gas > specified, the software will wait for
74+
23. Deploy any contract
7575

76-
24. Logging via logger module
76+
24. Custom routes - actions to be performed sequentially or randomly
77+
78+
25. Check gas before starting the module, if gas > specified, the software will wait for
79+
80+
26. Logging via logger module
7781

7882
---
7983
<h2>⚙️ Settings</h2>

config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@
8787
with open("data/abi/nft-origins/abi.json", "r") as file:
8888
NFT_ORIGINS_ABI = json.load(file)
8989

90+
with open("data/abi/secondlive/abi.json", "r") as file:
91+
SECONDLIVE_ABI = json.load(file)
92+
93+
with open("data/abi/owlto/abi.json", "r") as file:
94+
OWLTO_ABI = json.load(file)
95+
9096
ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"
9197

9298
BRIDGE_CONTRACTS = {
@@ -149,3 +155,7 @@
149155
L2TELEGRAPH_NFT_CONTRACT = "0xdc60fd9d2a4ccf97f292969580874de69e6c326e"
150156

151157
NFT_ORIGINS_CONTRACT = "0x74670A3998d9d6622E32D0847fF5977c37E0eC91"
158+
159+
SECONDLIVE_CONTRACT = "0xAC1f9Fadc33cC0799Cf7e3051E5f6b28C98966EE"
160+
161+
OWLTO_CONTRACT = "0xE6FEcA764B7548127672C189D303eb956c3Ba372"

data/abi/owlto/abi.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[
2+
{
3+
"constant": false,
4+
"inputs": [
5+
{
6+
"internalType": "uint256",
7+
"name": "date",
8+
"type": "uint256"
9+
}
10+
],
11+
"name": "checkIn",
12+
"outputs": [],
13+
"payable": false,
14+
"stateMutability": "nonpayable",
15+
"type": "function"
16+
},
17+
{
18+
"constant": true,
19+
"inputs": [
20+
{
21+
"internalType": "address",
22+
"name": "",
23+
"type": "address"
24+
},
25+
{
26+
"internalType": "uint256",
27+
"name": "",
28+
"type": "uint256"
29+
}
30+
],
31+
"name": "checkInData",
32+
"outputs": [
33+
{
34+
"internalType": "bool",
35+
"name": "",
36+
"type": "bool"
37+
}
38+
],
39+
"payable": false,
40+
"stateMutability": "view",
41+
"type": "function"
42+
}
43+
]

data/abi/secondlive/abi.json

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
[
2+
{
3+
"anonymous": false,
4+
"inputs": [
5+
{
6+
"indexed": true,
7+
"internalType": "address",
8+
"name": "previousOwner",
9+
"type": "address"
10+
},
11+
{
12+
"indexed": true,
13+
"internalType": "address",
14+
"name": "newOwner",
15+
"type": "address"
16+
}
17+
],
18+
"name": "OwnershipTransferred",
19+
"type": "event"
20+
},
21+
{
22+
"anonymous": false,
23+
"inputs": [
24+
{
25+
"indexed": true,
26+
"internalType": "address",
27+
"name": "operator",
28+
"type": "address"
29+
},
30+
{
31+
"indexed": true,
32+
"internalType": "uint256",
33+
"name": "date",
34+
"type": "uint256"
35+
}
36+
],
37+
"name": "eveSignIn",
38+
"type": "event"
39+
},
40+
{
41+
"inputs": [
42+
{
43+
"internalType": "address",
44+
"name": "",
45+
"type": "address"
46+
},
47+
{
48+
"internalType": "uint256",
49+
"name": "",
50+
"type": "uint256"
51+
}
52+
],
53+
"name": "_signIn",
54+
"outputs": [
55+
{
56+
"internalType": "bool",
57+
"name": "",
58+
"type": "bool"
59+
}
60+
],
61+
"stateMutability": "view",
62+
"type": "function"
63+
},
64+
{
65+
"inputs": [],
66+
"name": "initialize",
67+
"outputs": [],
68+
"stateMutability": "nonpayable",
69+
"type": "function"
70+
},
71+
{
72+
"inputs": [],
73+
"name": "owner",
74+
"outputs": [
75+
{
76+
"internalType": "address",
77+
"name": "",
78+
"type": "address"
79+
}
80+
],
81+
"stateMutability": "view",
82+
"type": "function"
83+
},
84+
{
85+
"inputs": [],
86+
"name": "renounceOwnership",
87+
"outputs": [],
88+
"stateMutability": "nonpayable",
89+
"type": "function"
90+
},
91+
{
92+
"inputs": [
93+
{
94+
"internalType": "uint256",
95+
"name": "date",
96+
"type": "uint256"
97+
}
98+
],
99+
"name": "signIn",
100+
"outputs": [],
101+
"stateMutability": "nonpayable",
102+
"type": "function"
103+
},
104+
{
105+
"inputs": [
106+
{
107+
"internalType": "address",
108+
"name": "newOwner",
109+
"type": "address"
110+
}
111+
],
112+
"name": "transferOwnership",
113+
"outputs": [],
114+
"stateMutability": "nonpayable",
115+
"type": "function"
116+
}
117+
]

main.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,17 @@ def get_module():
5252
Choice("24) Mint NFT on NFTS2ME", mint_nft),
5353
Choice("25) Mint Scroll Origins NFT", nft_origins),
5454
Choice("26) Dmail send email", send_mail),
55-
Choice("27) Create gnosis safe", create_safe),
56-
Choice("28) Deploy contract", deploy_contract),
57-
Choice("29) Swap tokens to ETH", swap_tokens),
58-
Choice("30) Use MultiSwap", swap_multiswap),
59-
Choice("31) Use MultiBridge", multibridge),
60-
Choice("32) Use custom routes", custom_routes),
61-
Choice("33) Make transfer", make_transfer),
62-
Choice("34) Check transaction count", "tx_checker"),
63-
Choice("35) Exit", "exit"),
55+
Choice("27) SecondLive Sign In", secondlive_signin),
56+
Choice("28) Owlto CheckIn", owlto_checkin),
57+
Choice("29) Create gnosis safe", create_safe),
58+
Choice("30) Deploy contract", deploy_contract),
59+
Choice("31) Swap tokens to ETH", swap_tokens),
60+
Choice("32) Use MultiSwap", swap_multiswap),
61+
Choice("33) Use MultiBridge", multibridge),
62+
Choice("34) Use custom routes", custom_routes),
63+
Choice("35) Make transfer", make_transfer),
64+
Choice("36) Check transaction count", "tx_checker"),
65+
Choice("37) Exit", "exit"),
6466
],
6567
qmark="⚙️ ",
6668
pointer="✅ "

modules/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from .safe import GnosisSafe
2121
from .l2telegraph import L2Telegraph
2222
from .nftorigins import NftOrigins
23+
from .secondlive import SecondLive
24+
from .owlto import Owlto
2325
from .deploy import Deployer
2426
from .swap_tokens import SwapTokens
2527
from .multiswap import Multiswap

modules/owlto.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from loguru import logger
2+
from datetime import datetime
3+
4+
from config import OWLTO_CONTRACT, OWLTO_ABI
5+
from utils.gas_checker import check_gas
6+
from utils.helpers import retry
7+
from .account import Account
8+
9+
10+
class Owlto(Account):
11+
def __init__(self, account_id: int, private_key: str, recipient: str) -> None:
12+
super().__init__(account_id=account_id, private_key=private_key, chain="scroll", recipient=recipient)
13+
14+
self.contract = self.get_contract(OWLTO_CONTRACT, OWLTO_ABI)
15+
16+
async def get_checkin_status(self):
17+
return await self.contract.functions.checkInData(
18+
self.address,
19+
int(datetime.now().strftime('%Y%m%d'))
20+
).call()
21+
22+
@retry
23+
@check_gas
24+
async def check_in(self):
25+
logger.info(f"[{self.account_id}][{self.address}] OwlTo Daily CheckIn")
26+
27+
checked = await self.get_checkin_status()
28+
if checked:
29+
return logger.info(f"[{self.account_id}][{self.address}] OwlTo Daily CheckIn Already Done")
30+
31+
tx_data = await self.get_tx_data()
32+
33+
transaction = await self.contract.functions.checkIn(
34+
int(datetime.now().strftime('%Y%m%d'))
35+
).build_transaction(tx_data)
36+
37+
signed_txn = await self.sign(transaction)
38+
39+
txn_hash = await self.send_raw_transaction(signed_txn)
40+
41+
await self.wait_until_tx_finished(txn_hash.hex())

modules/secondlive.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from loguru import logger
2+
from datetime import datetime
3+
4+
from config import SECONDLIVE_CONTRACT, SECONDLIVE_ABI
5+
from utils.gas_checker import check_gas
6+
from utils.helpers import retry
7+
from .account import Account
8+
9+
10+
class SecondLive(Account):
11+
def __init__(self, account_id: int, private_key: str, recipient: str) -> None:
12+
super().__init__(account_id=account_id, private_key=private_key, chain="scroll", recipient=recipient)
13+
14+
self.contract = self.get_contract(SECONDLIVE_CONTRACT, SECONDLIVE_ABI)
15+
16+
async def check_sign_in(self):
17+
return await self.contract.functions._signIn(
18+
self.address,
19+
int(datetime.utcnow().strftime("%Y%m%d"))
20+
).call()
21+
22+
@retry
23+
@check_gas
24+
async def sign_in(self):
25+
"""
26+
Daily Sign In
27+
https://secondlive.world/bounty/general
28+
"""
29+
30+
logger.info(f"[{self.account_id}][{self.address}] SecondLive Sign In")
31+
32+
signed = await self.check_sign_in()
33+
if signed:
34+
return logger.info(f"[{self.account_id}][{self.address}] SecondLive already signed today")
35+
36+
tx_data = await self.get_tx_data()
37+
38+
transaction = await self.contract.functions.signIn(int(datetime.utcnow().strftime("%Y%m%d"))).build_transaction(tx_data)
39+
40+
signed_txn = await self.sign(transaction)
41+
42+
txn_hash = await self.send_raw_transaction(signed_txn)
43+
44+
await self.wait_until_tx_finished(txn_hash.hex())

modules_settings.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,5 +705,15 @@ async def nft_origins(account_id, key, recipient):
705705
await nft.mint()
706706

707707

708+
async def secondlive_signin(account_id, key, recipient):
709+
secondlive = SecondLive(account_id, key, recipient)
710+
await secondlive.sign_in()
711+
712+
713+
async def owlto_checkin(account_id, key, recipient):
714+
owlto = Owlto(account_id, key, recipient)
715+
await owlto.check_in()
716+
717+
708718
def get_tx_count():
709719
asyncio.run(check_tx())

0 commit comments

Comments
 (0)