예제 #1
0
    def msg_deployed(self, message):
        self.contract.state = 'ACTIVE'
        self.contract.deployed_at = datetime.datetime.now()
        self.contract.save()
        self.next_check = timezone.now() + datetime.timedelta(
            seconds=self.check_interval)
        self.save()
        self.tron_contract.address = message['address']
        self.tron_contract.save()
        if self.contract.user.email:
            network = self.contract.network.name
            network_name = MAIL_NETWORK[network]
            send_mail(
                tron_deploy_subject,
                tron_deploy_text.format(
                    contract_type_name=self.contract.get_all_details_model()[
                        self.contract.contract_type]['name'],
                    network_name=network_name), DEFAULT_FROM_EMAIL,
                [self.contract.user.email])
            if not 'MAINNET' in self.contract.network.name:
                send_testnet_gift_emails.delay(self.contract.user.profile.id)
            else:
                send_promo_mainnet.delay(self.contract.user.email)

        take_off_blocking(self.contract.network.name)
        msg = self.bot_message
        transaction.on_commit(lambda: send_message_to_subs.delay(msg, True))
예제 #2
0
    def initialized(self, message):
        print("eos crowdsale initialized msg", flush=True)
        eos_contract_token = EOSContract()
        token_address = NETWORKS[self.contract.network.name]['token_address']
        eos_contract_token.address = token_address
        eos_contract_token.contract = self.contract
        eos_contract_token.save()
        self.eos_contract_token = eos_contract_token
        self.save()
        self.contract.state = 'ACTIVE'
        self.contract.deployed_at = datetime.datetime.now()
        self.contract.save()
        if self.contract.user.email:
            network_name = MAIL_NETWORK[self.contract.network.name]
            send_mail(eos_ico_subject,
                      eos_ico_message.format(network_name=network_name),
                      DEFAULT_FROM_EMAIL, [self.contract.user.email])
            if not 'MAINNET' in self.contract.network.name:
                send_testnet_gift_emails.delay(self.contract.user.profile.id)
            else:
                send_promo_mainnet.delay(self.contract.user.email)

        msg = self.bot_message
        transaction.on_commit(lambda: send_message_to_subs.delay(msg, True))
        take_off_blocking(self.contract.network.name, self.contract.id)
예제 #3
0
    def msg_deployed(self, message, eth_contract_attr_name='eth_contract'):
        self.contract.state = 'ACTIVE'
        self.contract.deployed_at = datetime.datetime.now()
        self.contract.save()
        self.tron_contract.address = message['address']
        self.tron_contract.save()
        take_off_blocking(self.contract.network.name)
        if self.contract.user.email:
            if not 'MAINNET' in self.contract.network.name:
                send_testnet_gift_emails.delay(self.contract.user.profile.id)
            else:
                send_promo_mainnet.delay(self.contract.user.email)

        if self.verification:
            send_verification_mail(
                network=self.contract.network.name,
                addresses=(hex2tronwif(self.tron_contract.address), ),
                compiler=self.tron_contract.compiler_version,
                files={'airdrop.sol': self.tron_contract.source_code},
            )
            self.verification_date_payment = datetime.datetime.now().date()
            self.verification_status = 'IN_PROCESS'
            self.save()
        msg = self.bot_message
        transaction.on_commit(lambda: send_message_to_subs.delay(msg, True))
예제 #4
0
    def initialized(self, message):
        if self.contract.state != 'WAITING_FOR_DEPLOYMENT':
            return
        take_off_blocking(self.contract.network.name)
        if message['contractId'] != self.eth_contract_crowdsale.id:
            print('ignored', flush=True)
            return
        self.contract.state = 'ACTIVE'
        self.contract.deployed_at = datetime.datetime.now()
        self.contract.save()
        if self.eth_contract_token.original_contract.contract_type == 5:
            self.eth_contract_token.original_contract.state = 'UNDER_CROWDSALE'
            self.eth_contract_token.original_contract.save()
        network_link = NETWORKS[self.contract.network.name]['link_address']
        network_name = MAIL_NETWORK[self.contract.network.name]
        if self.contract.user.email:
            send_mail(
                ico_subject,
                ico_text.format(
                    link1=network_link.format(
                        address=self.eth_contract_token.address, ),
                    link2=network_link.format(
                        address=self.eth_contract_crowdsale.address),
                    network_name=network_name), DEFAULT_FROM_EMAIL,
                [self.contract.user.email])
            if not 'MAINNET' in self.contract.network.name:
                send_testnet_gift_emails.delay(self.contract.user.profile.id)
            else:
                send_promo_mainnet.delay(self.contract.user.email)

        if self.verification:
            send_verification_mail(
                network=self.contract.network.name,
                addresses=(
                    self.eth_contract_token.address,
                    self.eth_contract_crowdsale.address,
                ),
                compiler=self.eth_contract_token.compiler_version,
                files={
                    'token.sol': self.eth_contract_token.source_code,
                    'ico.sol': self.eth_contract_crowdsale.source_code,
                },
            )
            self.verification_date_payment = datetime.datetime.now().date()
            self.verification_status = 'IN_PROCESS'
            self.save()
        msg = self.bot_message
        transaction.on_commit(lambda: send_message_to_subs.delay(msg, True))
예제 #5
0
    def tokenCreated(self, message):
        self.contract.state = 'ACTIVE'
        self.contract.deployed_at = datetime.datetime.now()
        self.contract.save()
        if self.contract.user.email:
            network_name = MAIL_NETWORK[self.contract.network.name]
            send_mail(
                eos_contract_subject,
                eos_contract_message.format(token_name=self.token_short_name,
                                            network_name=network_name),
                DEFAULT_FROM_EMAIL, [self.contract.user.email])
            if not 'MAINNET' in self.contract.network.name:
                send_testnet_gift_emails.delay(self.contract.user.profile.id)
            else:
                send_promo_mainnet.delay(self.contract.user.email)

        msg = self.bot_message
        transaction.on_commit(lambda: send_message_to_subs.delay(msg, True))
        take_off_blocking(self.contract.network.name, self.contract.id)
예제 #6
0
    def msg_deployed(self, message):
        take_off_blocking(self.contract.network.name)
        network = self.contract.network.name
        network_name = MAIL_NETWORK[network]
        self.contract.state = 'ACTIVE'
        self.contract.deployed_at = datetime.datetime.now()
        self.contract.save()
        if self.contract.user.email:
            send_mail(
                eos_airdrop_subject,
                eos_airdrop_message.format(network_name=network_name,
                                           hash=self.eos_contract.tx_hash),
                DEFAULT_FROM_EMAIL, [self.contract.user.email])
            if not 'MAINNET' in self.contract.network.name:
                send_testnet_gift_emails.delay(self.contract.user.profile.id)
            else:
                send_promo_mainnet.delay(self.contract.user.email)

        msg = self.bot_message
        transaction.on_commit(lambda: send_message_to_subs.delay(msg, True))
        self.save()
예제 #7
0
    def msg_deployed(self, message):
        take_off_blocking(self.contract.network.name)
        self.eth_contract.address = message['address']
        self.eth_contract.save()
        self.contract.state = 'WAITING_FOR_APPROVE'
        self.contract.deployed_at = datetime.datetime.now()
        self.contract.save()
        email = self.email if self.email else self.contract.user.email
        print('email', email, flush=True)
        try:
            send_mail(protector_deployed_subject, protector_deployed_text,
                      DEFAULT_FROM_EMAIL, [email])
            if not 'MAINNET' in self.contract.network.name:
                send_testnet_gift_emails.delay(self.contract.user.profile.id)
            else:
                send_promo_mainnet.delay(self.contract.user.email)

        except Exception as err:
            print('deployed mail failed', str(err), flush=True)
        msg = self.bot_message
        transaction.on_commit(lambda: send_message_to_subs.delay(msg, True))
예제 #8
0
    def initialized(self, message):
        if self.contract.state not in ('WAITING_FOR_DEPLOYMENT', 'ENDED'):
            return

        take_off_blocking(self.contract.network.name)

        self.contract.state = 'ACTIVE' if self.future_minting else 'ENDED'
        self.contract.deployed_at = datetime.datetime.now()
        self.contract.save()
        if self.contract.user.email:
            send_mail(
                common_subject,
                neo_token_text.format(addr=Crypto.ToAddress(
                    UInt160.ParseString(self.neo_contract.address)), ),
                DEFAULT_FROM_EMAIL, [self.contract.user.email])
            if not 'MAINNET' in self.contract.network.name:
                send_testnet_gift_emails.delay(self.contract.user.profile.id)
            else:
                send_promo_mainnet.delay(self.contract.user.email)

        msg = self.bot_message
        transaction.on_commit(lambda: send_message_to_subs.delay(msg, True))
예제 #9
0
    def msg_deployed(self, message):
        print('msg_deployed method of the ico contract')
        if self.contract.state != 'WAITING_FOR_DEPLOYMENT':
            take_off_blocking(self.contract.network.name)
            return
        if self.ride_contract.id == message['contractId']:
            self.contract.state = 'ACTIVE'
            self.contract.deployed_at = datetime.datetime.now()
            self.ride_contract.address = message['address']
            self.ride_contract.save()
            self.contract.save()
            take_off_blocking(self.contract.network.name)
            msg = self.bot_message
            transaction.on_commit(
                lambda: send_message_to_subs.delay(msg, True))
            if self.contract.user.email:
                network_link = NETWORKS[
                    self.contract.network.name]['link_address']
                network_asset = NETWORKS[
                    self.contract.network.name]['link_asset']
                network_name = MAIL_NETWORK[self.contract.network.name]
                send_mail(
                    waves_sto_subject,
                    waves_sto_text.format(
                        link1=network_asset.format(asset=self.asset_id, ),
                        link2=network_link.format(
                            address=self.ride_contract.address),
                        network_name=network_name), DEFAULT_FROM_EMAIL,
                    [self.contract.user.email])
                if not 'MAINNET' in self.contract.network.name:
                    send_testnet_gift_emails.delay(
                        self.contract.user.profile.id)
                else:
                    send_promo_mainnet.delay(self.contract.user.email)

            return
예제 #10
0
 def msg_deployed(self, message, eth_contract_attr_name='eth_contract'):
     network_link = NETWORKS[self.contract.network.name]['link_address']
     network = self.contract.network.name
     network_name = MAIL_NETWORK[network]
     take_off_blocking(self.contract.network.name)
     eth_contract = getattr(self, eth_contract_attr_name)
     eth_contract.address = message['address']
     eth_contract.save()
     self.contract.state = 'ACTIVE'
     self.contract.deployed_at = datetime.datetime.now()
     self.contract.save()
     msg = self.bot_message
     transaction.on_commit(lambda: send_message_to_subs.delay(msg, True))
     if self.contract.user.email:
         if self.contract.contract_type == 11:
             send_mail(
                 eos_account_subject,
                 eos_account_message.format(
                     link=network_link.format(address=self.account_name),
                     network_name=network_name), DEFAULT_FROM_EMAIL,
                 [self.contract.user.email])
         elif self.contract.contract_type == 10:
             send_mail(
                 eos_contract_subject,
                 eos_contract_message.format(
                     token_name=self.token_short_name,
                     network_name=network_name), DEFAULT_FROM_EMAIL,
                 [self.contract.user.email])
         elif self.contract.contract_type == 20:
             pass
         else:
             network_id = self.contract.network.id
             types_info = AVAILABLE_CONTRACT_TYPES[network_id]
             for type_info in types_info:
                 if type_info['contract_type'] == self.contract.contract_type and \
                         type_info['contract_name'] == 'Token' and \
                         network_id in NETWORK_TYPES['mainnet']:
                     send_mail(
                         common_subject,
                         sale_message.format(
                             contract_type_name=self.contract.
                             get_all_details_model()[
                                 self.contract.contract_type]['name'],
                             link=network_link.format(
                                 address=eth_contract.address),
                             network_name=network_name,
                         ), DEFAULT_FROM_EMAIL, [self.contract.user.email])
                     break
             else:
                 send_mail(
                     common_subject,
                     common_text.format(
                         contract_type_name=self.contract.
                         get_all_details_model()[
                             self.contract.contract_type]['name'],
                         link=network_link.format(
                             address=eth_contract.address),
                         network_name=network_name,
                     ), DEFAULT_FROM_EMAIL, [self.contract.user.email])
         if not 'MAINNET' in self.contract.network.name:
             send_testnet_gift_emails.delay(self.contract.user.profile.id)
         else:
             send_promo_mainnet.delay(self.contract.user.email)