diff --git a/main.py b/main.py index 1d02f47..b1f013f 100755 --- a/main.py +++ b/main.py @@ -12,11 +12,6 @@ from log import setup_custom_logger from watch import ContractWatcher from contract import StickerPackContract -SPACK_CONTRACT = "0x0577215622f43a39F4Bc9640806DFea9b10D2A36" -#SPACK_CONTRACT = "0x8cc272396Be7583c65BEe82CD7b743c69A87287D" # Goerli -with open("./abi.json", "r") as f: - STICKER_PACK_ABI = json.load(f) - HELP_DESCRIPTION='Utility for pinning images from Status Sticker packs.' HELP_EXAMPLE='Example: ./main.py -TODO' @@ -31,6 +26,8 @@ def parse_opts(): help='If all packs should be pinned on start.') parser.add_option('-e', '--events', default=['ContenthashChanged', 'Register'], help='Contract events to watch for.') + parser.add_option('-c', '--contract', default='0x0577215622f43a39F4Bc9640806DFea9b10D2A36', + help='Sticker Pack contract address.') parser.add_option('-I', '--log-level', default='INFO', help='Level of logging.') @@ -50,8 +47,12 @@ def main(): # for talking to IPFS cluster and pinning images ipfs = IpfsPinner(opts.ipfs_addr) + # Read Sticker Pack contract ABI + with open("./abi.json", "r") as f: + contract_abi = json.load(f) + # Get instance of sticker pack contract - contract = StickerPackContract(SPACK_CONTRACT, STICKER_PACK_ABI, w3) + contract = StickerPackContract(opts.contract, contract_abi, w3) if opts.pin_all: LOG.info('Pinning all existing packs...') diff --git a/pack.py b/pack.py index e85261e..ee860e1 100644 --- a/pack.py +++ b/pack.py @@ -36,7 +36,7 @@ class StickerPack: LOG.info('Pinning: %s', self) for chash in self.image_hashes + [self.content_hash]: LOG.debug('Pinning hash: %s', chash) - pinned = self.ipfs.pin(chash) + pinned = ipfs.pin(chash) if pinned: LOG.debug('Successfully pinned: %s', chash) else: