!! This plugin is not ready for 3rd party production use yet. If you want to use it you must really understand the code !! PRs to make it production ready and more eyes on this code are most welcome!
This is a plugin for pretix. This plugin supports both Ethereum and DAI.
It started with ligi suggesting pretix for Ethereum Magicians.
Then it was used for Ethereum Magicians in Paris (shout out to boris for making this possible) - but accepting ETH or DAI was a fully manual process there.
Afterwards boris put up some funds for a gitcoin bounty to make a plugin that automates this process. And nanexcool increased the funds and added the requirement for DAI.
The initial version was developed by vic-en but he vanished from the project after cashing in the bounty money and left the plugin in a non-working state.
Then the idea came up to use this plugin for DevCon5 and the plugin was forked to this repo and ligi, david sanders, piper meriam, rami, Pedro Gomes, and Jamie Pitts brought it to a state where it is usable for DevCon5 (still a lot of work to be done to make this a good plugin). Currently, it is semi-automatic. But it now has ERC-681 and Web3Modal support. If you want to dig a bit into the problems that emerged short before the launch you can have a look at this issue
- A panel was added in the web admin interface to upload a list of addresses to be associated with each ticket order.
- During the checkout process, an address is chosen for each order from the list of remaining addresses created by the address upload process.
- A payment confirmation management command was added that confirms pending
payments based on the address assigned to them during checkout. See the
confirm_payments
section below for details.
- Clone this repository, e.g. to
local/pretix-eth-payment-plugin
. - Create and activate a virtual environment.
- Execute
pip install -e .[dev]
within thepretix-eth-payment-plugin
repo directory. - Setup a local database by running
make devmigrate
. - Fire up a local dev server by running
make devserver
. - Visit http://localhost:8000/control/login in a browser windows and enter
username
admin@localhost
and passwordadmin
to log in. - Enter "Admin mode" by clicking the "Admin mode" text in the upper-right corner of the admin interface to create a test organization and event.
- Use the plugin from this repository for your events by enabling it in the 'Plugins' tab in the event's settings tab. Note that you must enable the plugin both in the "Plugins" tab as well as in the plugin's settings (found in the "Payment" tab).
This plugin includes a django management command that can be used to automatically confirm orders from the Ethereum address associated with each order. By default, this command will perform a dry run which only displays payment records that would be modified and why but without actually modifying them. Here's an example invocation of this command:
python -mpretix confirm_payments \
--event-slug=devcon-5 \
--token-address=0x6b175474e89094c44da98b954eedeac495271d0f \ # dai address
--web3-provider-uri=https://mainnet.infura.io/v3/<project-id> \
--no-dry-run
Above, the confirm_payments
command uses the --event-slug
argument to
determine the list of unconfirmed payments to check (those associated with that
event). It then inspects the address that was associated with each order (at
the time the ticket was reserved) to determine if sufficient payments were made
for the order. It may check for an ethereum payment or some kind of token
payment depending on what was chosen during the checkout process. Token
payments will be checked using the given token address provided via the
--token-address
CLI flag. The --no-dry-run
flag directs the command to
update order statuses based on the checks that are performed. Without this
flag, the command will only display how records would be modified. All
interactions with the blockchain are performed via web3.py and the node
identified by the web3 provider URI given in by the --web3-provider-uri
CLI
flag. For more information on the format of web3 provider URIs, see
here.
For more details about the confirm_payments
command and its options, the
command may be invoked with --help
:
python -mpretix confirm_payments --help
Copyright 2019 Victor (https://github.com/vic-en)
Released under the terms of the Apache License 2.0