diff --git a/.gitignore b/.gitignore index edac9c99..d29ae381 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ postgraphile/build/ postgraphile/node_modules/ postgraphile/package-lock.json vulcanizedb.log +db/migrations/20*.sql +plugins/*.so diff --git a/.travis.yml b/.travis.yml index b00ed01f..b58d6ee3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ go_import_path: github.com/vulcanize/vulcanizedb before_install: # ginkgo golint dep goose + - echo -e "Host github.com\n\tHostName github.com\n\tUser git\n\tIdentityFile ~/.ssh/id_rsa\n" >> ~/.ssh/config - make installtools - bash ./scripts/install-postgres-10.sh - npm install -g ganache-cli @@ -23,9 +24,8 @@ before_install: before_script: - go get -u github.com/pressly/sup/cmd/sup - sudo -u postgres createdb vulcanize_private - - make version_migrations - make migrate NAME=vulcanize_private - - bash ./pkg/transformers/start_test_chain.sh + - bash ./scripts/start_test_chain.sh - cd postgraphile && yarn script: @@ -38,5 +38,5 @@ notifications: email: false after_script: - - bash ./pkg/transformers/stop_test_chain.sh + - bash ./scripts/stop_test_chain.sh - bash ./bin/deploy.sh diff --git a/Gopkg.lock b/Gopkg.lock index bad46b33..dec88a2e 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -28,6 +28,14 @@ pruneopts = "" revision = "cff30e1d23fc9e800b2b5b4b41ef1817dda07e9f" +[[projects]] + digest = "1:5d47691333460db6ac83ced03c79b4bdb9aff3e322be24affb7855bed8affc6c" + name = "github.com/dave/jennifer" + packages = ["jen"] + pruneopts = "" + revision = "14e399b6b5e8456c66c45c955fc27b568bacb5c9" + version = "v1.3.0" + [[projects]] digest = "1:aaeffbff5bd24654cb4c190ed75d6c7b57b4f5d6741914c1a7a6bb7447e756c5" name = "github.com/deckarep/golang-set" @@ -549,6 +557,7 @@ analyzer-name = "dep" analyzer-version = 1 input-imports = [ + "github.com/dave/jennifer/jen", "github.com/ethereum/go-ethereum", "github.com/ethereum/go-ethereum/accounts/abi", "github.com/ethereum/go-ethereum/accounts/abi/bind", @@ -564,6 +573,7 @@ "github.com/ethereum/go-ethereum/params", "github.com/ethereum/go-ethereum/rpc", "github.com/hashicorp/golang-lru", + "github.com/hpcloud/tail", "github.com/jmoiron/sqlx", "github.com/lib/pq", "github.com/mitchellh/go-homedir", @@ -576,6 +586,7 @@ "golang.org/x/net/context", "golang.org/x/sync/errgroup", "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer", + "gopkg.in/tomb.v1", ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/Makefile b/Makefile index 12ebbf20..ab1413e6 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,6 @@ lint: .PHONY: test test: | $(GINKGO) $(LINT) - go get -t ./... go vet ./... go fmt ./... $(GINKGO) -r --skipPackage=integration_tests,integration @@ -57,13 +56,14 @@ test: | $(GINKGO) $(LINT) integrationtest: | $(GINKGO) $(LINT) go vet ./... go fmt ./... - $(GINKGO) -r pkg/transformers/integration_tests/ integration_test/ + $(GINKGO) -r integration_test/ .PHONY: dep dep: | $(DEP) $(DEP) ensure build: dep + git checkout vendor/github.com/ethereum/go-ethereum/accounts/abi go fmt ./... go build diff --git a/README.md b/README.md index 987235a3..a6add596 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Vulcanize DB is a set of tools that make it easier for developers to write appli ## Dependencies - Go 1.11+ - - Postgres 10 + - Postgres 10.6 - Ethereum Node - [Go Ethereum](https://ethereum.github.io/go-ethereum/downloads/) (1.8.21+) - [Parity 1.8.11+](https://github.com/paritytech/parity/releases) @@ -26,7 +26,7 @@ Using Vulcanize for the first time requires several steps be done in order to al 5. Configuring synced Ethereum node integration 6. Data syncing -## Installation +### Installation In order to fetch the project codebase for local use or modification, install it to your `GOPATH` via: @@ -41,9 +41,11 @@ In order to install packages with `dep`, ensure you are in the project directory After `dep` finishes, dependencies should be installed within your `GOPATH` at the versions specified in `Gopkg.toml`. +Because we are working with a modified version of the go-ethereum accounts/abi package, after running `dep ensure` you will need to run `git checkout vendor/github/ethereum/go-ethereum/accounts/abi` to checkout the modified dependency + Lastly, ensure that `GOPATH` is defined in your shell. If necessary, `GOPATH` can be set in `~/.bashrc` or `~/.bash_profile`, depending upon your system. It can be additionally helpful to add `$GOPATH/bin` to your shell's `$PATH`. -## Setting up the Database +### Setting up the Database 1. Install Postgres 1. Create a superuser for yourself and make sure `psql --list` works without prompting for a password. 1. `createdb vulcanize_public` @@ -55,13 +57,13 @@ Lastly, ensure that `GOPATH` is defined in your shell. If necessary, `GOPATH` ca * See below for configuring additional environments -## Create a migration file +### Create a migration file 1. `make new_migration NAME=add_columnA_to_table1` - This will create a new timestamped migration file in `db/migrations` 1. Write the migration code in the created file, under the respective `goose` pragma - Goose automatically runs each migration in a transaction; don't add `BEGIN` and `COMMIT` statements. -## Configuration +### Configuration - To use a local Ethereum node, copy `environments/public.toml.example` to `environments/public.toml` and update the `ipcPath` and `levelDbPath`. - `ipcPath` should match the local node's IPC filepath: @@ -88,14 +90,14 @@ Lastly, ensure that `GOPATH` is defined in your shell. If necessary, `GOPATH` ca - See `environments/infura.toml` to configure commands to run against infura, if a local node is unavailable. - Copy `environments/local.toml.example` to `environments/local.toml` to configure commands to run against a local node such as [Ganache](https://truffleframework.com/ganache) or [ganache-cli](https://github.com/trufflesuite/ganache-clihttps://github.com/trufflesuite/ganache-cli). -## Start syncing with postgres +### Start syncing with postgres Syncs VulcanizeDB with the configured Ethereum node, populating blocks, transactions, receipts, and logs. This command is useful when you want to maintain a broad cache of what's happening on the blockchain. 1. Start Ethereum node (**if fast syncing your Ethereum node, wait for initial sync to finish**) 1. In a separate terminal start VulcanizeDB: - `./vulcanizedb sync --config --starting-block-number ` -## Alternatively, sync from Geth's underlying LevelDB +### Alternatively, sync from Geth's underlying LevelDB Sync VulcanizeDB from the LevelDB underlying a Geth node. 1. Assure node is not running, and that it has synced to the desired block height. 1. Start vulcanize_db @@ -105,36 +107,12 @@ Sync VulcanizeDB from the LevelDB underlying a Geth node. - `--ending-block-number `/`-e `: block number to sync to - `--all`/`-a`: sync all missing blocks -## Alternatively, sync in "light" mode +### Alternatively, sync in "light" mode Syncs VulcanizeDB with the configured Ethereum node, populating only block headers. This command is useful when you want a minimal baseline from which to track targeted data on the blockchain (e.g. individual smart contract storage values). 1. Start Ethereum node 1. In a separate terminal start VulcanizeDB: - - `./vulcanizedb lightSync --config --starting-block-number ` - -## Continuously sync Maker event logs from light sync -Continuously syncs Maker event logs from the configured Ethereum node based on the populated block headers. -This includes logs related to auctions, multi-collateral dai, and price feeds. -This command requires that the `lightSync` process is also being run so as to be able to sync in real time. - -1. Start Ethereum node (or plan to configure the commands to point to a remote IPC path). -1. In a separate terminal run the lightSync command (see above). -1. In another terminal window run the continuousLogSync command: - - `./vulcanizedb continuousLogSync --config ` - - An option `--transformers` flag may be passed to the command to specific which transformers to execute, this will default to all transformers if the flag is not passed. - - `./vulcanizedb continuousLogSync --config environments/private.toml --transformers="priceFeed"` - - see the `buildTransformerInitializerMap` method in `cmd/continuousLogSync.go` for available transformers - -## Backfill Maker event logs from light sync -Backfills Maker event logs from the configured Ethereum node based on the populated block headers. -This includes logs related to auctions, multi-collateral dai, and price feeds. -This command requires that a light sync (see command above) has previously been run. - -_Since auction/mcd contracts have not yet been deployed, this command will need to be run a local blockchain at the moment. As such, a new environment file will need to be added. See `environments/local.toml.example`._ - -1. Start Ethereum node -1. In a separate terminal run the backfill command: - - `./vulcanizedb backfillMakerLogs --config ` + - `./vulcanizedb lightSync --config --starting-block-number ` ## Start full environment in docker by single command @@ -160,17 +138,27 @@ false If you have full rinkeby chaindata you can move it to `rinkeby_vulcanizedb_geth_data` docker volume to skip long wait of sync. ## Running the Tests +- `createdb vulcanize_private` will create the test db +- `make migrate NAME=vulcanize_private` will run the db migrations - `make test` will run the unit tests and skip the integration tests - `make integrationtest` will run the just the integration tests -- Note: requires Ganache chain setup and seeded with `flip-kick.js` and `frob.js` (in that order) ## Deploying 1. you will need to make sure you have ssh agent running and your ssh key added to it. instructions [here](https://developer.github.com/v3/guides/using-ssh-agent-forwarding/#your-key-must-be-available-to-ssh-agent) 1. `go get -u github.com/pressly/sup/cmd/sup` 1. `sup staging deploy` -## omniWatcher -These commands require a pre-synced (full or light) vulcanizeDB (see above sections) +## Contract Watchers +Contract watchers work with a light or full sync vDB to fetch raw ethereum data and execute a set of transformations over them, persisting the output. + +A watcher is composed of at least a fetcher and a transformer or set of transformers, where a fetcher is an interface for retrieving raw Ethereum data from some source (e.g. eth_jsonrpc, IPFS) +and a transformer is an interface for filtering through that raw Ethereum data to extract, process, and persist data for specific contracts or accounts. + +### omniWatcher +The `omniWatcher` command is a built-in generic contract watcher. It can watch any and all events for a given contract provided the contract's ABI is available. +It also provides some state variable coverage by automating polling of public methods, with some restrictions. + +This command requires a pre-synced (full or light) vulcanizeDB (see above sections) and currently requires the contract ABI be available on etherscan or provided by the user. To watch all events of a contract using a light synced vDB: - Execute `./vulcanizedb omniWatcher --config --contract-address ` @@ -202,3 +190,182 @@ To watch all types of events of the contract but only persist the ones that emit To watch all events of the contract but only poll the specified method with specified argument values (if they are emitted from the watched events): - Execute `./vulcanizedb omniWatcher --config --contract-address --methods --method-args --method-args ` +#### omniWatcher output + +Transformed events and polled method results are committed to Postgres in schemas and tables generated according to the contract abi. + +Schemas are created for each contract using the naming convention `_` +Under this schema, tables are generated for watched events as `_event` and for polled methods as `_method` +The 'method' and 'event' identifiers are tacked onto the end of the table names to prevent collisions between methods and events of the same lowercase name + +Example: + +Running `./vulcanizedb omniWatcher --config --starting-block-number=5197514 --contract-address=0x8dd5fbce2f6a956c3022ba3663759011dd51e73e --events=Transfer --events=Mint --methods=balanceOf` +watches Transfer and Mint events of the TrueUSD contract and polls its balanceOf method using the addresses we find emitted from those events + +It produces and populates a schema with three tables: + +`light_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e.transfer_event` +`light_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e.mint_event` +`light_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e.balanceof_method` + +Column ids and types for these tables are generated based on the event and method argument names and types and method return types, resulting in tables such as: + +Table "light_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e.transfer_event" + +| Column | Type | Collation | Nullable | Default | Storage | Stats target | Description +|:----------:|:---------------------:|:---------:|:--------:|:-------------------------------------------------------------------------------------------:|:--------:|:------------:|:-----------:| +| id | integer | | not null | nextval('light_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e.transfer_event_id_seq'::regclass) | plain | | | +| header_id | integer | | not null | | plain | | | +| token_name | character varying(66) | | not null | | extended | | | +| raw_log | jsonb | | | | extended | | | +| log_idx | integer | | not null | | plain | | | +| tx_idx | integer | | not null | | plain | | | +| from_ | character varying(66) | | not null | | extended | | | +| to_ | character varying(66) | | not null | | extended | | | +| value_ | numeric | | not null | | main | | | + + +Table "light_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e.balanceof_method" + +| Column | Type | Collation | Nullable | Default | Storage | Stats target | Description | +|:----------:|:---------------------:|:---------:|:--------:|:-------------------------------------------------------------------------------------------:|:--------:|:------------:|:-----------:| +| id | integer | | not null | nextval('light_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e.balanceof_method_id_seq'::regclass) | plain | | | +| token_name | character varying(66) | | not null | | extended | | | +| block | integer | | not null | | plain | | | +| who_ | character varying(66) | | not null | | extended | | | +| returned | numeric | | not null | | main | | | + +The addition of '_' after table names is to prevent collisions with reserved Postgres words + +### composeAndExecute +The `composeAndExecute` command is used to compose and execute over an arbitrary set of custom transformers. +This is accomplished by generating a Go pluggin which allows our `vulcanizedb` binary to link to external transformers, so +long as they abide by our standard [interfaces](https://github.com/vulcanize/maker-vulcanizedb/tree/compose_and_execute/libraries/shared/transformer). + +This command requires Go 1.11+ and [Go plugins](https://golang.org/pkg/plugin/) only work on Unix based systems. + +#### Writing custom transformers +Storage Transformers + * [Guide](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/factories/storage/README.md) + * [Example](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/factories/storage/EXAMPLE.md) + +Event Transformers + * Guide + * Example + +#### composeAndExecute configuration +A .toml config file is specified when executing the command: +`./vulcanizedb composeAndExecute --config=./environments/config_name.toml` + +The config provides information for composing a set of transformers: + +```toml +[database] + name = "vulcanize_public" + hostname = "localhost" + user = "vulcanize" + password = "vulcanize" + port = 5432 + +[client] + ipcPath = "http://kovan0.vulcanize.io:8545" + +[exporter] + home = "github.com/vulcanize/vulcanizedb" + clone = false + name = "exampleTransformerExporter" + save = false + transformerNames = [ + "transformer1", + "transformer2", + "transformer3", + "transformer4", + ] + [exporter.transformer1] + path = "path/to/transformer1" + type = "eth_event" + repository = "github.com/account/repo" + migrations = "db/migrations" + [exporter.transformer2] + path = "path/to/transformer2" + type = "eth_event" + repository = "github.com/account/repo" + migrations = "db/migrations" + [exporter.transformer3] + path = "path/to/transformer3" + type = "eth_event" + repository = "github.com/account/repo" + migrations = "db/migrations" + [exporter.transformer4] + path = "path/to/transformer4" + type = "eth_storage" + repository = "github.com/account2/repo2" + migrations = "to/db/migrations" +``` +- `home` is the name of the package you are building the plugin for, in most cases this is github.com/vulcanize/vulcanizedb +- `clone` this signifies whether or not to retrieve plugin transformer packages by `git clone`ing them; by default we attempt to work with transformer packages located in +our `$GOPATH` but setting this to `true` overrides that. This needs to be set to `true` for the configs used in tests in order for them to work with Travis. +- `name` is the name used for the plugin files (.so and .go) +- `save` indicates whether or not the user wants to save the .go file instead of removing it after .so compilation. Sometimes useful for debugging/trouble-shooting purposes. +- `transformerNames` is the list of the names of the transformers we are composing together, so we know how to access their submaps in the exporter map +- `exporter.`s are the sub-mappings containing config info for the transformers + - `repository` is the path for the repository which contains the transformer and its `TransformerInitializer` + - `path` is the relative path from `repository` to the transformer's `TransformerInitializer` directory (initializer package) + - `type` is the type of the transformer; indicating which type of watcher it works with (for now, there are only two options: `eth_event` and `eth_storage`) + - `eth_storage` indicates the transformer works with the [storage watcher](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/watcher/storage_watcher.go) + that fetches state and storage diffs from an ETH node (instead of, for example, from IPFS) + - `eth_event` indicates the transformer works with the [event watcher](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/watcher/event_watcher.go) + that fetches event logs from an ETH node + - `migrations` is the relative path from `repository` to the db migrations directory for the transformer +- Note: If any of the imported transformers need additional config variables those need to be included as well + +This information is used to write and build a Go plugin which exports the configured transformers. +These transformers are loaded onto their specified watchers and executed. + +Transformers of different types can be run together in the same command using a single config file or in separate instances using different config files + +The general structure of a plugin .go file, and what we would see built with the above config is shown below + +```go +package main + +import ( + interface1 "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" + transformer1 "github.com/account/repo/path/to/transformer1" + transformer2 "github.com/account/repo/path/to/transformer2" + transformer3 "github.com/account/repo/path/to/transformer3" + transformer4 "github.com/account2/repo2/path/to/transformer4" +) + +type exporter string + +var Exporter exporter + +func (e exporter) Export() []interface1.TransformerInitializer, []interface1.StorageTransformerInitializer { + return []interface1.TransformerInitializer{ + transformer1.TransformerInitializer, + transformer2.TransformerInitializer, + transformer3.TransformerInitializer, + }, []interface1.StorageTransformerInitializer{ + transformer4.StorageTransformerInitializer, + } +} +``` + +#### Preparing transformer(s) to work as pluggins for composeAndExecute +To plug in an external transformer we need to: + +* Create a [package](https://github.com/vulcanize/mcd_transformers/blob/staging/transformers/bite/initializer/initializer.go) +that exports a variable `TransformerInitializer` or `StorageTransformerInitializer` that are of type [TransformerInitializer](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/transformer/event_transformer.go#L33) +or [StorageTransformerInitializer](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/transformer/storage_transformer.go#L31), respectively +* Design the transformers to work in the context of their [event](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/watcher/event_watcher.go#L83) +or [storage](https://github.com/vulcanize/maker-vulcanizedb/blob/compose_and_execute/libraries/shared/watcher/storage_watcher.go#L53) watchers +* Create db migrations to run against vulcanizeDB so that we can store the transformer output + * Specify migration locations for each transformer in the config with the `exporter.transformer.migrations` fields + * Do not `goose fix` the transformer migrations + +To update a plugin repository with changes to the core vulcanizedb repository, replace the vulcanizedb vendored in the plugin repo (`plugin_repo/vendor/github.com/vulcanize/vulcanizedb`) +with the newly updated version +* The entire vendor lib within the vendored vulcanizedb needs to be deleted (`plugin_repo/vendor/github.com/vulcanize/vulcanizedb/vendor`) +* These complications arise due to this [conflict](https://github.com/golang/go/issues/20481) between `dep` and Go plugins diff --git a/cmd/backfillMakerLogs.go b/cmd/backfillMakerLogs.go deleted file mode 100644 index f6681c78..00000000 --- a/cmd/backfillMakerLogs.go +++ /dev/null @@ -1,62 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package cmd - -import ( - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - "github.com/vulcanize/vulcanizedb/libraries/shared" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -// backfillMakerLogsCmd represents the backfillMakerLogs command -var backfillMakerLogsCmd = &cobra.Command{ - Use: "backfillMakerLogs", - Short: "Backfill Maker event logs", - Long: `Backfills Maker event logs based on previously populated block Header records. -This currently includes logs related to Multi-collateral Dai (frob), Auctions (flip-kick), -and Price Feeds (ETH/USD, MKR/USD, and REP/USD - LogValue). - -vulcanizedb backfillMakerLogs --config environments/local.toml - -This command expects a light sync to have been run, and the presence of header records in the Vulcanize database.`, - Run: func(cmd *cobra.Command, args []string) { - backfillMakerLogs() - }, -} - -func backfillMakerLogs() { - blockChain := getBlockChain() - db, err := postgres.NewDB(databaseConfig, blockChain.Node()) - if err != nil { - log.Fatal("Failed to initialize database.") - } - - watcher := shared.NewEventWatcher(db, blockChain) - - watcher.AddTransformers(transformers.TransformerInitializers()) - err = watcher.Execute(constants.HeaderMissing) - if err != nil { - // TODO Handle watcher error in backfillMakerLogs - } -} - -func init() { - rootCmd.AddCommand(backfillMakerLogsCmd) -} diff --git a/cmd/compose.go b/cmd/compose.go new file mode 100644 index 00000000..e51298ac --- /dev/null +++ b/cmd/compose.go @@ -0,0 +1,173 @@ +// Copyright © 2019 Vulcanize, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package cmd + +import ( + "errors" + "fmt" + + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "github.com/vulcanize/vulcanizedb/pkg/config" + p2 "github.com/vulcanize/vulcanizedb/pkg/plugin" +) + +// composeCmd represents the compose command +var composeCmd = &cobra.Command{ + Use: "compose", + Short: "Composes transformer initializer plugin", + Long: `This command needs a config .toml file of form: + +[database] + name = "vulcanize_public" + hostname = "localhost" + user = "vulcanize" + password = "vulcanize" + port = 5432 + +[client] + ipcPath = "http://kovan0.vulcanize.io:8545" + +[exporter] + home = "github.com/vulcanize/vulcanizedb" + clone = false + name = "exampleTransformerExporter" + save = false + transformerNames = [ + "transformer1", + "transformer2", + "transformer3", + "transformer4", + ] + [exporter.transformer1] + path = "path/to/transformer1" + type = "eth_event" + repository = "github.com/account/repo" + migrations = "db/migrations" + [exporter.transformer2] + path = "path/to/transformer2" + type = "eth_event" + repository = "github.com/account/repo" + migrations = "db/migrations" + [exporter.transformer3] + path = "path/to/transformer3" + type = "eth_event" + repository = "github.com/account/repo" + migrations = "db/migrations" + [exporter.transformer4] + path = "path/to/transformer4" + type = "eth_storage" + repository = "github.com/account2/repo2" + migrations = "to/db/migrations" + + +Note: If any of the plugin transformer need additional +configuration variables include them in the .toml file as well + +This information is used to write and build a go plugin with a transformer +set composed from the transformer imports specified in the config file +This plugin is loaded and the set of transformer initializers is exported +from it and loaded into and executed over by the appropriate watcher. + +The type of watcher that the transformer works with is specified using the +type variable for each transformer in the config. Currently there are watchers +of event data from an eth node (eth_event) and storage data from an eth node +(eth_storage). + +Transformers of different types can be ran together in the same command using a +single config file or in separate command instances using different config files + +Specify config location when executing the command: +./vulcanizedb compose --config=./environments/config_name.toml`, + Run: func(cmd *cobra.Command, args []string) { + compose() + }, +} + +func compose() { + // Build plugin generator config + prepConfig() + + // Generate code to build the plugin according to the config file + log.Info("generating plugin") + generator, err := p2.NewGenerator(genConfig, databaseConfig) + if err != nil { + log.Fatal(err) + } + err = generator.GenerateExporterPlugin() + if err != nil { + log.Debug("generating plugin failed") + log.Fatal(err) + } + // TODO: Embed versioning info in the .so files so we know which version of vulcanizedb to run them with + _, pluginPath, err := genConfig.GetPluginPaths() + if err != nil { + log.Fatal(err) + } + fmt.Printf("Composed plugin %s", pluginPath) + log.Info("plugin .so file output to", pluginPath) +} + +func init() { + rootCmd.AddCommand(composeCmd) +} + +func prepConfig() { + log.Info("configuring plugin") + names := viper.GetStringSlice("exporter.transformerNames") + transformers := make(map[string]config.Transformer) + for _, name := range names { + transformer := viper.GetStringMapString("exporter." + name) + p, ok := transformer["path"] + if !ok || p == "" { + log.Fatal(fmt.Sprintf("%s transformer config is missing `path` value", name)) + } + r, ok := transformer["repository"] + if !ok || r == "" { + log.Fatal(fmt.Sprintf("%s transformer config is missing `repository` value", name)) + } + m, ok := transformer["migrations"] + if !ok || m == "" { + log.Fatal(fmt.Sprintf("%s transformer config is missing `migrations` value", name)) + } + t, ok := transformer["type"] + if !ok { + log.Fatal(fmt.Sprintf("%s transformer config is missing `type` value", name)) + } + transformerType := config.GetTransformerType(t) + if transformerType == config.UnknownTransformerType { + log.Fatal(errors.New(`unknown transformer type in exporter config accepted types are "eth_event", "eth_storage"`)) + } + + transformers[name] = config.Transformer{ + Path: p, + Type: transformerType, + RepositoryPath: r, + MigrationPath: m, + } + } + + genConfig = config.Plugin{ + Transformers: transformers, + FilePath: "$GOPATH/src/github.com/vulcanize/vulcanizedb/plugins", + FileName: viper.GetString("exporter.name"), + Save: viper.GetBool("exporter.save"), + Home: viper.GetString("exporter.home"), + Clone: viper.GetBool("exporter.clone"), + } +} diff --git a/cmd/composeAndExecute.go b/cmd/composeAndExecute.go new file mode 100644 index 00000000..f57b116c --- /dev/null +++ b/cmd/composeAndExecute.go @@ -0,0 +1,179 @@ +// Copyright © 2019 Vulcanize, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package cmd + +import ( + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "github.com/vulcanize/vulcanizedb/libraries/shared/watcher" + "github.com/vulcanize/vulcanizedb/pkg/fs" + p2 "github.com/vulcanize/vulcanizedb/pkg/plugin" + "github.com/vulcanize/vulcanizedb/pkg/plugin/helpers" + "github.com/vulcanize/vulcanizedb/utils" + "os" + "plugin" + syn "sync" +) + +// composeAndExecuteCmd represents the composeAndExecute command +var composeAndExecuteCmd = &cobra.Command{ + Use: "composeAndExecute", + Short: "Composes, loads, and executes transformer initializer plugin", + Long: `This command needs a config .toml file of form: + +[database] + name = "vulcanize_public" + hostname = "localhost" + user = "vulcanize" + password = "vulcanize" + port = 5432 + +[client] + ipcPath = "http://kovan0.vulcanize.io:8545" + +[exporter] + home = "github.com/vulcanize/vulcanizedb" + clone = false + name = "exampleTransformerExporter" + save = false + transformerNames = [ + "transformer1", + "transformer2", + "transformer3", + "transformer4", + ] + [exporter.transformer1] + path = "path/to/transformer1" + type = "eth_event" + repository = "github.com/account/repo" + migrations = "db/migrations" + [exporter.transformer2] + path = "path/to/transformer2" + type = "eth_event" + repository = "github.com/account/repo" + migrations = "db/migrations" + [exporter.transformer3] + path = "path/to/transformer3" + type = "eth_event" + repository = "github.com/account/repo" + migrations = "db/migrations" + [exporter.transformer4] + path = "path/to/transformer4" + type = "eth_storage" + repository = "github.com/account2/repo2" + migrations = "to/db/migrations" + + +Note: If any of the plugin transformer need additional +configuration variables include them in the .toml file as well + +This information is used to write and build a go plugin with a transformer +set composed from the transformer imports specified in the config file +This plugin is loaded and the set of transformer initializers is exported +from it and loaded into and executed over by the appropriate watcher. + +The type of watcher that the transformer works with is specified using the +type variable for each transformer in the config. Currently there are watchers +of event data from an eth node (eth_event) and storage data from an eth node +(eth_storage). + +Transformers of different types can be ran together in the same command using a +single config file or in separate command instances using different config files + +Specify config location when executing the command: +./vulcanizedb composeAndExecute --config=./environments/config_name.toml`, + Run: func(cmd *cobra.Command, args []string) { + composeAndExecute() + }, +} + +func composeAndExecute() { + // Build plugin generator config + prepConfig() + + // Generate code to build the plugin according to the config file + log.Info("generating plugin") + generator, err := p2.NewGenerator(genConfig, databaseConfig) + if err != nil { + log.Fatal(err) + } + err = generator.GenerateExporterPlugin() + if err != nil { + log.Debug("generating plugin failed") + log.Fatal(err) + } + + // Get the plugin path and load the plugin + _, pluginPath, err := genConfig.GetPluginPaths() + if err != nil { + log.Fatal(err) + } + if !genConfig.Save { + defer helpers.ClearFiles(pluginPath) + } + log.Info("linking plugin", pluginPath) + plug, err := plugin.Open(pluginPath) + if err != nil { + log.Debug("linking plugin failed") + log.Fatal(err) + } + + // Load the `Exporter` symbol from the plugin + log.Info("loading transformers from plugin") + symExporter, err := plug.Lookup("Exporter") + if err != nil { + log.Debug("loading Exporter symbol failed") + log.Fatal(err) + } + + // Assert that the symbol is of type Exporter + exporter, ok := symExporter.(Exporter) + if !ok { + log.Debug("plugged-in symbol not of type Exporter") + os.Exit(1) + } + + // Use the Exporters export method to load the TransformerInitializer and StorageTransformerInitializer sets + ethEventInitializers, ethStorageInitializers := exporter.Export() + + // Setup bc and db objects + blockChain := getBlockChain() + db := utils.LoadPostgres(databaseConfig, blockChain.Node()) + + // Execute over transformer sets returned by the exporter + // Use WaitGroup to wait on both goroutines + var wg syn.WaitGroup + if len(ethEventInitializers) > 0 { + ew := watcher.NewEventWatcher(&db, blockChain) + ew.AddTransformers(ethEventInitializers) + wg.Add(1) + go watchEthEvents(&ew, &wg) + } + + if len(ethStorageInitializers) > 0 { + tailer := fs.FileTailer{Path: storageDiffsPath} + sw := watcher.NewStorageWatcher(tailer, &db) + sw.AddTransformers(ethStorageInitializers) + wg.Add(1) + go watchEthStorage(&sw, &wg) + } + wg.Wait() +} + +func init() { + rootCmd.AddCommand(composeAndExecuteCmd) + composeAndExecuteCmd.Flags().BoolVar(&recheckHeadersArg, "recheckHeaders", false, "checks headers that are already checked for each transformer.") +} diff --git a/cmd/continuousLogSync.go b/cmd/continuousLogSync.go deleted file mode 100644 index aa7f9c0f..00000000 --- a/cmd/continuousLogSync.go +++ /dev/null @@ -1,134 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package cmd - -import ( - "fmt" - "time" - - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - - "github.com/vulcanize/vulcanizedb/libraries/shared" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -// continuousLogSyncCmd represents the continuousLogSync command -var continuousLogSyncCmd = &cobra.Command{ - Use: "continuousLogSync", - Short: "Continuously sync logs at the head of the chain", - Long: fmt.Sprintf(`Continously syncs logs based on the configured transformers. - -vulcanizedb continousLogSync --config environments/local.toml - -Available transformers for (optional) selection with --transformers: -%v - -This command expects a light sync to have been run, and the presence of header records in the Vulcanize database.`, - constants.AllTransformerLabels()), - Run: func(cmd *cobra.Command, args []string) { - syncMakerLogs() - }, -} - -var transformerNames []string -var recheckHeadersArg bool - -func syncMakerLogs() { - ticker := time.NewTicker(pollingInterval) - defer ticker.Stop() - - blockChain := getBlockChain() - db, err := postgres.NewDB(databaseConfig, blockChain.Node()) - if err != nil { - log.Fatal("Failed to initialize database.") - } - - initializers := getTransformerInitializers(transformerNames) - - watcher := shared.NewEventWatcher(db, blockChain) - watcher.AddTransformers(initializers) - - for range ticker.C { - if recheckHeadersArg { - err = watcher.Execute(constants.HeaderRecheck) - } else { - err = watcher.Execute(constants.HeaderMissing) - } - if err != nil { - // TODO Handle watcher errors in ContinuousLogSync - } - } -} - -func getTransformerInitializers(transformerNames []string) []shared2.TransformerInitializer { - var initializers []shared2.TransformerInitializer - - if transformerNames[0] == "all" { - initializers = transformers.TransformerInitializers() - } else { - initializerMap := buildTransformerInitializerMap() - for _, transformerName := range transformerNames { - initializers = append(initializers, initializerMap[transformerName]) - } - } - return initializers -} - -func buildTransformerInitializerMap() map[string]shared2.TransformerInitializer { - initializerMap := make(map[string]shared2.TransformerInitializer) - - initializerMap[constants.BiteLabel] = transformers.GetBiteTransformer().NewTransformer - initializerMap[constants.CatFileChopLumpLabel] = transformers.GetCatFileChopLumpTransformer().NewLogNoteTransformer - initializerMap[constants.CatFileFlipLabel] = transformers.GetCatFileFlipTransformer().NewLogNoteTransformer - initializerMap[constants.CatFilePitVowLabel] = transformers.GetCatFilePitVowTransformer().NewLogNoteTransformer - initializerMap[constants.DealLabel] = transformers.GetDealTransformer().NewLogNoteTransformer - initializerMap[constants.DentLabel] = transformers.GetDentTransformer().NewLogNoteTransformer - initializerMap[constants.DripDripLabel] = transformers.GetDripDripTransformer().NewLogNoteTransformer - initializerMap[constants.DripFileIlkLabel] = transformers.GetDripFileIlkTransformer().NewLogNoteTransformer - initializerMap[constants.DripFileRepoLabel] = transformers.GetDripFileRepoTransformer().NewLogNoteTransformer - initializerMap[constants.DripFileVowLabel] = transformers.GetDripFileVowTransformer().NewLogNoteTransformer - initializerMap[constants.FlapKickLabel] = transformers.GetFlapKickTransformer().NewTransformer - initializerMap[constants.FlipKickLabel] = transformers.GetFlipKickTransformer().NewTransformer - initializerMap[constants.FlopKickLabel] = transformers.GetFlopKickTransformer().NewTransformer - initializerMap[constants.FrobLabel] = transformers.GetFrobTransformer().NewTransformer - initializerMap[constants.PitFileDebtCeilingLabel] = transformers.GetPitFileDebtCeilingTransformer().NewLogNoteTransformer - initializerMap[constants.PitFileIlkLabel] = transformers.GetPitFileIlkTransformer().NewLogNoteTransformer - initializerMap[constants.PriceFeedLabel] = transformers.GetPriceFeedTransformer().NewLogNoteTransformer - initializerMap[constants.TendLabel] = transformers.GetTendTransformer().NewLogNoteTransformer - initializerMap[constants.VatFluxLabel] = transformers.GetVatFluxTransformer().NewLogNoteTransformer - initializerMap[constants.VatFoldLabel] = transformers.GetVatFoldTransformer().NewLogNoteTransformer - initializerMap[constants.VatGrabLabel] = transformers.GetVatGrabTransformer().NewLogNoteTransformer - initializerMap[constants.VatHealLabel] = transformers.GetVatHealTransformer().NewLogNoteTransformer - initializerMap[constants.VatInitLabel] = transformers.GetVatInitTransformer().NewLogNoteTransformer - initializerMap[constants.VatMoveLabel] = transformers.GetVatMoveTransformer().NewLogNoteTransformer - initializerMap[constants.VatSlipLabel] = transformers.GetVatSlipTransformer().NewLogNoteTransformer - initializerMap[constants.VatTollLabel] = transformers.GetVatTollTransformer().NewLogNoteTransformer - initializerMap[constants.VatTuneLabel] = transformers.GetVatTuneTransformer().NewLogNoteTransformer - initializerMap[constants.VowFlogLabel] = transformers.GetFlogTransformer().NewLogNoteTransformer - - return initializerMap -} - -func init() { - rootCmd.AddCommand(continuousLogSyncCmd) - continuousLogSyncCmd.Flags().StringSliceVar(&transformerNames, "transformers", []string{"all"}, "transformer names to be run during this command") - continuousLogSyncCmd.Flags().BoolVar(&recheckHeadersArg, "recheckHeaders", false, "checks headers that are already checked for each transformer.") -} diff --git a/cmd/execute.go b/cmd/execute.go new file mode 100644 index 00000000..861ab0ff --- /dev/null +++ b/cmd/execute.go @@ -0,0 +1,170 @@ +// Copyright © 2019 Vulcanize, Inc +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package cmd + +import ( + "fmt" + "os" + "plugin" + syn "sync" + "time" + + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" + "github.com/vulcanize/vulcanizedb/libraries/shared/watcher" + "github.com/vulcanize/vulcanizedb/pkg/fs" + "github.com/vulcanize/vulcanizedb/utils" +) + +// executeCmd represents the execute command +var executeCmd = &cobra.Command{ + Use: "execute", + Short: "executes a precomposed transformer initializer plugin", + Long: `This command needs a config .toml file of form: + +[database] + name = "vulcanize_public" + hostname = "localhost" + user = "vulcanize" + password = "vulcanize" + port = 5432 + +[client] + ipcPath = "http://kovan0.vulcanize.io:8545" + +[exporter] + name = "exampleTransformerExporter" + +Note: If any of the plugin transformer need additional +configuration variables include them in the .toml file as well + +The exporter.name is the name (without extension) of the plugin to be loaded. +The plugin file needs to be located in the /plugins directory and this command assumes +the db migrations remain from when the plugin was composed. Additionally, the plugin +must have been composed by the same version of vulcanizedb or else it will not be compatible. + +Specify config location when executing the command: +./vulcanizedb execute --config=./environments/config_name.toml`, + Run: func(cmd *cobra.Command, args []string) { + execute() + }, +} + +func execute() { + // Build plugin generator config + prepConfig() + + // Get the plugin path and load the plugin + _, pluginPath, err := genConfig.GetPluginPaths() + if err != nil { + log.Fatal(err) + } + + fmt.Printf("Executing plugin %s", pluginPath) + log.Info("linking plugin", pluginPath) + plug, err := plugin.Open(pluginPath) + if err != nil { + log.Debug("linking plugin failed") + log.Fatal(err) + } + + // Load the `Exporter` symbol from the plugin + log.Info("loading transformers from plugin") + symExporter, err := plug.Lookup("Exporter") + if err != nil { + log.Debug("loading Exporter symbol failed") + log.Fatal(err) + } + + // Assert that the symbol is of type Exporter + exporter, ok := symExporter.(Exporter) + if !ok { + log.Debug("plugged-in symbol not of type Exporter") + os.Exit(1) + } + + // Use the Exporters export method to load the TransformerInitializer and StorageTransformerInitializer sets + ethEventInitializers, ethStorageInitializers := exporter.Export() + + // Setup bc and db objects + blockChain := getBlockChain() + db := utils.LoadPostgres(databaseConfig, blockChain.Node()) + + // Execute over transformer sets returned by the exporter + // Use WaitGroup to wait on both goroutines + var wg syn.WaitGroup + if len(ethEventInitializers) > 0 { + ew := watcher.NewEventWatcher(&db, blockChain) + ew.AddTransformers(ethEventInitializers) + wg.Add(1) + go watchEthEvents(&ew, &wg) + } + + if len(ethStorageInitializers) > 0 { + tailer := fs.FileTailer{Path: storageDiffsPath} + sw := watcher.NewStorageWatcher(tailer, &db) + sw.AddTransformers(ethStorageInitializers) + wg.Add(1) + go watchEthStorage(&sw, &wg) + } + wg.Wait() +} + +func init() { + rootCmd.AddCommand(executeCmd) + executeCmd.Flags().BoolVar(&recheckHeadersArg, "recheckHeaders", false, "checks headers that are already checked for each transformer.") +} + +type Exporter interface { + Export() ([]transformer.TransformerInitializer, []transformer.StorageTransformerInitializer) +} + +func watchEthEvents(w *watcher.EventWatcher, wg *syn.WaitGroup) { + defer wg.Done() + // Execute over the TransformerInitializer set using the watcher + log.Info("executing event transformers") + var recheck constants.TransformerExecution + if recheckHeadersArg { + recheck = constants.HeaderRecheck + } else { + recheck = constants.HeaderMissing + } + ticker := time.NewTicker(pollingInterval) + defer ticker.Stop() + for range ticker.C { + err := w.Execute(recheck) + if err != nil { + // TODO Handle watcher errors in execute + } + } +} + +func watchEthStorage(w *watcher.StorageWatcher, wg *syn.WaitGroup) { + defer wg.Done() + // Execute over the TransformerInitializer set using the watcher + log.Info("executing storage transformers") + ticker := time.NewTicker(pollingInterval) + defer ticker.Stop() + for range ticker.C { + err := w.Execute() + if err != nil { + // TODO Handle watcher errors in execute + } + } +} diff --git a/cmd/getSignatures.go b/cmd/getSignatures.go deleted file mode 100644 index a03a2e28..00000000 --- a/cmd/getSignatures.go +++ /dev/null @@ -1,74 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package cmd - -import ( - "fmt" - "github.com/spf13/cobra" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -// getSignaturesCmd represents the getSignatures command -var getSignaturesCmd = &cobra.Command{ - Use: "getSignatures", - Short: "A command to see transformer method and event signatures", - Long: `A convenience command to see method/event signatures for Maker transformers -vulcanizedb getSignatures`, - Run: func(cmd *cobra.Command, args []string) { - getSignatures() - }, -} - -func getSignatures() { - signatures := make(map[string]string) - signatures["BiteSignature"] = constants.GetBiteSignature() - signatures["CatFileChopLumpSignature"] = constants.GetCatFileChopLumpSignature() - signatures["CatFileFlipSignature"] = constants.GetCatFileFlipSignature() - signatures["CatFilePitVowSignature"] = constants.GetCatFilePitVowSignature() - signatures["DealSignature"] = constants.GetDealSignature() - signatures["DentFunctionSignature"] = constants.GetDentFunctionSignature() - signatures["DripDripSignature"] = constants.GetDripDripSignature() - signatures["DripFileIlkSignature"] = constants.GetDripFileIlkSignature() - signatures["DripFileRepoSignature"] = constants.GetDripFileRepoSignature() - signatures["DripFileVowSignature"] = constants.GetDripFileVowSignature() - signatures["FlapKickSignature"] = constants.GetFlapKickSignature() - signatures["FlipKickSignature"] = constants.GetFlipKickSignature() - signatures["FlopKickSignature"] = constants.GetFlopKickSignature() - signatures["FrobSignature"] = constants.GetFrobSignature() - signatures["LogValueSignature"] = constants.GetLogValueSignature() - signatures["PitFileDebtCeilingSignature"] = constants.GetPitFileDebtCeilingSignature() - signatures["PitFileIlkSignature"] = constants.GetPitFileIlkSignature() - signatures["TendFunctionSignature"] = constants.GetTendFunctionSignature() - signatures["VatFluxSignature"] = constants.GetVatFluxSignature() - signatures["VatFoldSignature"] = constants.GetVatFoldSignature() - signatures["VatGrabSignature"] = constants.GetVatGrabSignature() - signatures["VatHealSignature"] = constants.GetVatHealSignature() - signatures["VatInitSignature"] = constants.GetVatInitSignature() - signatures["VatMoveSignature"] = constants.GetVatMoveSignature() - signatures["VatSlipSignature"] = constants.GetVatSlipSignature() - signatures["VatTollSignature"] = constants.GetVatTollSignature() - signatures["VatTuneSignature"] = constants.GetVatTuneSignature() - signatures["VowFlogSignature"] = constants.GetVowFlogSignature() - - for name, sig := range signatures { - fmt.Println(name, ": ", sig) - } -} - -func init() { - rootCmd.AddCommand(getSignaturesCmd) -} diff --git a/cmd/parseStorageDiffs.go b/cmd/parseStorageDiffs.go deleted file mode 100644 index d1aee398..00000000 --- a/cmd/parseStorageDiffs.go +++ /dev/null @@ -1,71 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package cmd - -import ( - "github.com/spf13/cobra" - "github.com/vulcanize/vulcanizedb/libraries/shared" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/fs" - "github.com/vulcanize/vulcanizedb/pkg/transformers" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/storage" - "log" -) - -// parseStorageDiffsCmd represents the parseStorageDiffs command -var parseStorageDiffsCmd = &cobra.Command{ - Use: "parseStorageDiffs", - Short: "Continuously ingest storage diffs from a CSV file", - Long: `Read storage diffs out of a CSV file that is constantly receiving -new rows from an Ethereum node. For example: - -./vulcanizedb parseStorageDiffs --config=environments/staging.toml - -Note that the path to your storage diffs must be configured in your toml -file under storageDiffsPath.`, - Run: func(cmd *cobra.Command, args []string) { - parseStorageDiffs() - }, -} - -func init() { - rootCmd.AddCommand(parseStorageDiffsCmd) -} - -func parseStorageDiffs() { - blockChain := getBlockChain() - db, err := postgres.NewDB(databaseConfig, blockChain.Node()) - if err != nil { - log.Fatal("Failed to initialize database: ", err) - } - - tailer := fs.FileTailer{Path: storageDiffsPath} - - // TODO: configure transformers - watcher := shared.NewStorageWatcher(tailer, db) - watcher.AddTransformers([]storage.TransformerInitializer{ - transformers.GetCatStorageTransformer().NewTransformer, - transformers.GetPitStorageTransformer().NewTransformer, - transformers.GetVatStorageTransformer().NewTransformer, - transformers.GetVowStorageTransformer().NewTransformer, - }) - - err = watcher.Execute() - if err != nil { - log.Fatal(err) - } -} diff --git a/cmd/root.go b/cmd/root.go index 6b72c593..100c424b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -38,12 +38,14 @@ import ( var ( cfgFile string databaseConfig config.Database + genConfig config.Plugin ipc string levelDbPath string startingBlockNumber int64 storageDiffsPath string syncAll bool endingBlockNumber int64 + recheckHeadersArg bool ) const ( @@ -93,6 +95,7 @@ func init() { rootCmd.PersistentFlags().String("client-levelDbPath", "", "location of levelDb chaindata") rootCmd.PersistentFlags().String("datadog-name", "vulcanize-test", "datadog service name") rootCmd.PersistentFlags().String("filesystem-storageDiffsPath", "", "location of storage diffs csv file") + rootCmd.PersistentFlags().String("exporter-name", "exporter", "name of exporter plugin") viper.BindPFlag("database.name", rootCmd.PersistentFlags().Lookup("database-name")) viper.BindPFlag("database.port", rootCmd.PersistentFlags().Lookup("database-port")) @@ -103,6 +106,7 @@ func init() { viper.BindPFlag("client.levelDbPath", rootCmd.PersistentFlags().Lookup("client-levelDbPath")) viper.BindPFlag("datadog.name", rootCmd.PersistentFlags().Lookup("datadog-name")) viper.BindPFlag("filesystem.storageDiffsPath", rootCmd.PersistentFlags().Lookup("filesystem-storageDiffsPath")) + viper.BindPFlag("exporter.fileName", rootCmd.PersistentFlags().Lookup("exporter-name")) } func initConfig() { diff --git a/db/migrations/20171025165407_create_blocks_table.sql b/db/migrations/00001_create_blocks_table.sql similarity index 100% rename from db/migrations/20171025165407_create_blocks_table.sql rename to db/migrations/00001_create_blocks_table.sql diff --git a/db/migrations/20171025230205_add_columns_to_blocks.sql b/db/migrations/00002_add_columns_to_blocks.sql similarity index 100% rename from db/migrations/20171025230205_add_columns_to_blocks.sql rename to db/migrations/00002_add_columns_to_blocks.sql diff --git a/db/migrations/20171027174929_initial_transaction_table.sql b/db/migrations/00003_initial_transaction_table.sql similarity index 100% rename from db/migrations/20171027174929_initial_transaction_table.sql rename to db/migrations/00003_initial_transaction_table.sql diff --git a/db/migrations/20171030203101_add_primary_key_to_blocks.sql b/db/migrations/00004_add_primary_key_to_blocks.sql similarity index 100% rename from db/migrations/20171030203101_add_primary_key_to_blocks.sql rename to db/migrations/00004_add_primary_key_to_blocks.sql diff --git a/db/migrations/20171031153007_add_block_id_to_transactions.sql b/db/migrations/00005_add_block_id_to_transactions.sql similarity index 100% rename from db/migrations/20171031153007_add_block_id_to_transactions.sql rename to db/migrations/00005_add_block_id_to_transactions.sql diff --git a/db/migrations/20171031221128_add_block_index.sql b/db/migrations/00006_add_block_index.sql similarity index 100% rename from db/migrations/20171031221128_add_block_index.sql rename to db/migrations/00006_add_block_index.sql diff --git a/db/migrations/20171102153801_add_blocks_columns.sql b/db/migrations/00007_add_blocks_columns.sql similarity index 100% rename from db/migrations/20171102153801_add_blocks_columns.sql rename to db/migrations/00007_add_blocks_columns.sql diff --git a/db/migrations/20171109210008_add_contracts_table.sql b/db/migrations/00008_add_contracts_table.sql similarity index 100% rename from db/migrations/20171109210008_add_contracts_table.sql rename to db/migrations/00008_add_contracts_table.sql diff --git a/db/migrations/20171109222835_add_from_to_transactions.sql b/db/migrations/00009_add_from_to_transactions.sql similarity index 100% rename from db/migrations/20171109222835_add_from_to_transactions.sql rename to db/migrations/00009_add_from_to_transactions.sql diff --git a/db/migrations/20171204205233_add_abi_to_watched_contracts.sql b/db/migrations/00010_add_abi_to_watched_contracts.sql similarity index 100% rename from db/migrations/20171204205233_add_abi_to_watched_contracts.sql rename to db/migrations/00010_add_abi_to_watched_contracts.sql diff --git a/db/migrations/20171205210118_add_nodes_table.sql b/db/migrations/00011_add_nodes_table.sql similarity index 100% rename from db/migrations/20171205210118_add_nodes_table.sql rename to db/migrations/00011_add_nodes_table.sql diff --git a/db/migrations/20171205215440_add_node_fk_to_blocks.sql b/db/migrations/00012_add_node_fk_to_blocks.sql similarity index 100% rename from db/migrations/20171205215440_add_node_fk_to_blocks.sql rename to db/migrations/00012_add_node_fk_to_blocks.sql diff --git a/db/migrations/20171206221647_add_contract_hash_constraint_to_watched_contracts.sql b/db/migrations/00013_add_contract_hash_constraint_to_watched_contracts.sql similarity index 100% rename from db/migrations/20171206221647_add_contract_hash_constraint_to_watched_contracts.sql rename to db/migrations/00013_add_contract_hash_constraint_to_watched_contracts.sql diff --git a/db/migrations/20171211230553_add_logs_table.sql b/db/migrations/00014_add_logs_table.sql similarity index 100% rename from db/migrations/20171211230553_add_logs_table.sql rename to db/migrations/00014_add_logs_table.sql diff --git a/db/migrations/20171213201926_add_cascade_delete_to_transactions.sql b/db/migrations/00015_add_cascade_delete_to_transactions.sql similarity index 100% rename from db/migrations/20171213201926_add_cascade_delete_to_transactions.sql rename to db/migrations/00015_add_cascade_delete_to_transactions.sql diff --git a/db/migrations/20171214192609_add_cascade_delete_to_blocks.sql b/db/migrations/00016_add_cascade_delete_to_blocks.sql similarity index 100% rename from db/migrations/20171214192609_add_cascade_delete_to_blocks.sql rename to db/migrations/00016_add_cascade_delete_to_blocks.sql diff --git a/db/migrations/20171218170356_add_is_final_to_blocks.sql b/db/migrations/00017_add_is_final_to_blocks.sql similarity index 100% rename from db/migrations/20171218170356_add_is_final_to_blocks.sql rename to db/migrations/00017_add_is_final_to_blocks.sql diff --git a/db/migrations/20171220154505_add_unique_constraint_blocks_node.sql b/db/migrations/00018_add_unique_constraint_blocks_node.sql similarity index 100% rename from db/migrations/20171220154505_add_unique_constraint_blocks_node.sql rename to db/migrations/00018_add_unique_constraint_blocks_node.sql diff --git a/db/migrations/20171220162655_add_block_id_index_on_transactions_table.sql b/db/migrations/00019_add_block_id_index_on_transactions_table.sql similarity index 100% rename from db/migrations/20171220162655_add_block_id_index_on_transactions_table.sql rename to db/migrations/00019_add_block_id_index_on_transactions_table.sql diff --git a/db/migrations/20171220163224_add_node_id_index_on_blocks_table.sql b/db/migrations/00020_add_node_id_index_on_blocks_table.sql similarity index 100% rename from db/migrations/20171220163224_add_node_id_index_on_blocks_table.sql rename to db/migrations/00020_add_node_id_index_on_blocks_table.sql diff --git a/db/migrations/20171220222456_tx_to_index.sql b/db/migrations/00021_tx_to_index.sql similarity index 100% rename from db/migrations/20171220222456_tx_to_index.sql rename to db/migrations/00021_tx_to_index.sql diff --git a/db/migrations/20171220222500_tx_from_index.sql b/db/migrations/00022_tx_from_index.sql similarity index 100% rename from db/migrations/20171220222500_tx_from_index.sql rename to db/migrations/00022_tx_from_index.sql diff --git a/db/migrations/20171227173404_add_miner.sql b/db/migrations/00023_add_miner.sql similarity index 100% rename from db/migrations/20171227173404_add_miner.sql rename to db/migrations/00023_add_miner.sql diff --git a/db/migrations/20171227185710_add_extra_data.sql b/db/migrations/00024_add_extra_data.sql similarity index 100% rename from db/migrations/20171227185710_add_extra_data.sql rename to db/migrations/00024_add_extra_data.sql diff --git a/db/migrations/20171228164704_add_block_reward_uncle_reward.sql b/db/migrations/00025_add_block_reward_uncle_reward.sql similarity index 100% rename from db/migrations/20171228164704_add_block_reward_uncle_reward.sql rename to db/migrations/00025_add_block_reward_uncle_reward.sql diff --git a/db/migrations/20171229000441_add_data_input_to_transactions.sql b/db/migrations/00026_add_data_input_to_transactions.sql similarity index 100% rename from db/migrations/20171229000441_add_data_input_to_transactions.sql rename to db/migrations/00026_add_data_input_to_transactions.sql diff --git a/db/migrations/20171229172818_create_receipts_table.sql b/db/migrations/00027_create_receipts_table.sql similarity index 100% rename from db/migrations/20171229172818_create_receipts_table.sql rename to db/migrations/00027_create_receipts_table.sql diff --git a/db/migrations/20180102233005_add_transaction_id_index_to_receipts.sql b/db/migrations/00028_add_transaction_id_index_to_receipts.sql similarity index 100% rename from db/migrations/20180102233005_add_transaction_id_index_to_receipts.sql rename to db/migrations/00028_add_transaction_id_index_to_receipts.sql diff --git a/db/migrations/20180110203941_add_fields_to_node.sql b/db/migrations/00029_add_fields_to_node.sql similarity index 100% rename from db/migrations/20180110203941_add_fields_to_node.sql rename to db/migrations/00029_add_fields_to_node.sql diff --git a/db/migrations/20180110204835_update_node_index.sql b/db/migrations/00030_update_node_index.sql similarity index 100% rename from db/migrations/20180110204835_update_node_index.sql rename to db/migrations/00030_update_node_index.sql diff --git a/db/migrations/20180115220111_add_log_fk_constraint.sql b/db/migrations/00031_add_log_fk_constraint.sql similarity index 100% rename from db/migrations/20180115220111_add_log_fk_constraint.sql rename to db/migrations/00031_add_log_fk_constraint.sql diff --git a/db/migrations/20180122201903_add_log_filters.sql b/db/migrations/00032_add_log_filters.sql similarity index 100% rename from db/migrations/20180122201903_add_log_filters.sql rename to db/migrations/00032_add_log_filters.sql diff --git a/db/migrations/20180122213613_add_watched_event_logs.sql b/db/migrations/00033_add_watched_event_logs.sql similarity index 100% rename from db/migrations/20180122213613_add_watched_event_logs.sql rename to db/migrations/00033_add_watched_event_logs.sql diff --git a/db/migrations/20180202032433_update_gas_limit_gas_used.sql b/db/migrations/00034_update_gas_limit_gas_used.sql similarity index 100% rename from db/migrations/20180202032433_update_gas_limit_gas_used.sql rename to db/migrations/00034_update_gas_limit_gas_used.sql diff --git a/db/migrations/20180202213423_rename_block_columns.sql b/db/migrations/00035_rename_block_columns.sql similarity index 100% rename from db/migrations/20180202213423_rename_block_columns.sql rename to db/migrations/00035_rename_block_columns.sql diff --git a/db/migrations/20180202220756_update_tx_table_names.sql b/db/migrations/00036_update_tx_table_names.sql similarity index 100% rename from db/migrations/20180202220756_update_tx_table_names.sql rename to db/migrations/00036_update_tx_table_names.sql diff --git a/db/migrations/20180205191315_update_log_filters_to_block_constraint.sql b/db/migrations/00037_update_log_filters_to_block_constraint.sql similarity index 100% rename from db/migrations/20180205191315_update_log_filters_to_block_constraint.sql rename to db/migrations/00037_update_log_filters_to_block_constraint.sql diff --git a/db/migrations/20180305233813_update_eth18_types.sql b/db/migrations/00038_update_eth18_types.sql similarity index 100% rename from db/migrations/20180305233813_update_eth18_types.sql rename to db/migrations/00038_update_eth18_types.sql diff --git a/db/migrations/20180321150314_rename_node_table.sql b/db/migrations/00039_rename_node_table.sql similarity index 100% rename from db/migrations/20180321150314_rename_node_table.sql rename to db/migrations/00039_rename_node_table.sql diff --git a/db/migrations/20180430230941_associate_receipts_with_blocks.sql b/db/migrations/00040_associate_receipts_with_blocks.sql similarity index 100% rename from db/migrations/20180430230941_associate_receipts_with_blocks.sql rename to db/migrations/00040_associate_receipts_with_blocks.sql diff --git a/db/migrations/20180504220928_add_eth_node_fingerprint_to_blocks.sql b/db/migrations/00041_add_eth_node_fingerprint_to_blocks.sql similarity index 100% rename from db/migrations/20180504220928_add_eth_node_fingerprint_to_blocks.sql rename to db/migrations/00041_add_eth_node_fingerprint_to_blocks.sql diff --git a/db/migrations/20180606224502_create_token_supply_table.sql b/db/migrations/00042_create_token_supply_table.sql similarity index 100% rename from db/migrations/20180606224502_create_token_supply_table.sql rename to db/migrations/00042_create_token_supply_table.sql diff --git a/db/migrations/20180716182130_create_headers_table.sql b/db/migrations/00043_create_headers_table.sql similarity index 100% rename from db/migrations/20180716182130_create_headers_table.sql rename to db/migrations/00043_create_headers_table.sql diff --git a/db/migrations/20180724233837_create_checked_headers_table.sql b/db/migrations/00044_create_checked_headers_table.sql similarity index 73% rename from db/migrations/20180724233837_create_checked_headers_table.sql rename to db/migrations/00044_create_checked_headers_table.sql index 4a7069c3..acf0fbdb 100644 --- a/db/migrations/20180724233837_create_checked_headers_table.sql +++ b/db/migrations/00044_create_checked_headers_table.sql @@ -1,8 +1,7 @@ -- +goose Up CREATE TABLE public.checked_headers ( id SERIAL PRIMARY KEY, - header_id INTEGER UNIQUE NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - price_feeds_checked BOOLEAN NOT NULL DEFAULT FALSE + header_id INTEGER UNIQUE NOT NULL REFERENCES headers (id) ON DELETE CASCADE ); -- +goose Down diff --git a/db/migrations/20190219134901_create_queued_storage.sql b/db/migrations/00045_create_queued_storage.sql similarity index 100% rename from db/migrations/20190219134901_create_queued_storage.sql rename to db/migrations/00045_create_queued_storage.sql diff --git a/db/migrations/20180724233838_create_maker_schema.sql b/db/migrations/20180724233838_create_maker_schema.sql deleted file mode 100644 index 2880a0fe..00000000 --- a/db/migrations/20180724233838_create_maker_schema.sql +++ /dev/null @@ -1,6 +0,0 @@ --- +goose Up -CREATE SCHEMA maker; - - --- +goose Down -DROP SCHEMA maker; diff --git a/db/migrations/20180724233839_create_flip_kick.sql b/db/migrations/20180724233839_create_flip_kick.sql deleted file mode 100644 index cb5b9d4d..00000000 --- a/db/migrations/20180724233839_create_flip_kick.sql +++ /dev/null @@ -1,26 +0,0 @@ --- +goose Up -CREATE TABLE maker.flip_kick ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - bid_id NUMERIC NOT NULL, - lot NUMERIC, - bid NUMERIC, - gal TEXT, - "end" TIMESTAMP WITH TIME ZONE, - urn TEXT, - tab NUMERIC, - tx_idx INTEGER NOT NUll, - log_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN flip_kick_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.flip_kick; - -ALTER TABLE public.checked_headers - DROP COLUMN flip_kick_checked; diff --git a/db/migrations/20180809214844_create_ilks.sql b/db/migrations/20180809214844_create_ilks.sql deleted file mode 100644 index 5eec84cf..00000000 --- a/db/migrations/20180809214844_create_ilks.sql +++ /dev/null @@ -1,8 +0,0 @@ --- +goose Up -CREATE TABLE maker.ilks ( - id SERIAL PRIMARY KEY, - ilk TEXT UNIQUE -); - --- +goose Down -DROP TABLE maker.ilks; diff --git a/db/migrations/20180809214845_create_frob.sql b/db/migrations/20180809214845_create_frob.sql deleted file mode 100644 index a1762fd4..00000000 --- a/db/migrations/20180809214845_create_frob.sql +++ /dev/null @@ -1,26 +0,0 @@ --- +goose Up -CREATE TABLE maker.frob ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - urn TEXT, - dink NUMERIC, - dart NUMERIC, - ink NUMERIC, - art NUMERIC, - iart NUMERIC, - log_idx INTEGER NOT NUll, - tx_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN frob_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.frob; - -ALTER TABLE public.checked_headers - DROP COLUMN frob_checked; diff --git a/db/migrations/20180814213505_create_price_feeds_table.sql b/db/migrations/20180814213505_create_price_feeds_table.sql deleted file mode 100644 index 10ea48f2..00000000 --- a/db/migrations/20180814213505_create_price_feeds_table.sql +++ /dev/null @@ -1,16 +0,0 @@ --- +goose Up -CREATE TABLE maker.price_feeds ( - id SERIAL PRIMARY KEY, - block_number BIGINT NOT NULL, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - medianizer_address TEXT, - usd_value NUMERIC, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, medianizer_address, tx_idx, log_idx) -); - - --- +goose Down -DROP TABLE maker.price_feeds; diff --git a/db/migrations/20180815031512_create_tend.sql b/db/migrations/20180815031512_create_tend.sql deleted file mode 100644 index 85df5505..00000000 --- a/db/migrations/20180815031512_create_tend.sql +++ /dev/null @@ -1,24 +0,0 @@ --- +goose Up -CREATE TABLE maker.tend ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - bid_id NUMERIC NOT NULL, - lot NUMERIC, - bid NUMERIC, - guy TEXT, - tic NUMERIC, - log_idx INTEGER NOT NUll, - tx_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN tend_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.tend; - -ALTER TABLE public.checked_headers - DROP COLUMN tend_checked; diff --git a/db/migrations/20180815031513_create_bite.sql b/db/migrations/20180815031513_create_bite.sql deleted file mode 100644 index 7af6f109..00000000 --- a/db/migrations/20180815031513_create_bite.sql +++ /dev/null @@ -1,26 +0,0 @@ --- +goose Up -CREATE TABLE maker.bite ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - urn TEXT, - ink NUMERIC, - art NUMERIC, - iArt NUMERIC, - tab NUMERIC, - nflip NUMERIC, - tx_idx INTEGER NOT NUll, - log_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN bite_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.bite; - -ALTER TABLE public.checked_headers - DROP COLUMN bite_checked; diff --git a/db/migrations/20180820230607_create_dent.sql b/db/migrations/20180820230607_create_dent.sql deleted file mode 100644 index a0179aa4..00000000 --- a/db/migrations/20180820230607_create_dent.sql +++ /dev/null @@ -1,24 +0,0 @@ --- +goose Up -CREATE TABLE maker.dent ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - bid_id NUMERIC NOT NULL, - lot NUMERIC, - bid NUMERIC, - guy BYTEA, - tic NUMERIC, - log_idx INTEGER NOT NUll, - tx_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN dent_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.dent; - -ALTER TABLE public.checked_headers - DROP COLUMN dent_checked; \ No newline at end of file diff --git a/db/migrations/20180831002535_create_pit_file.sql b/db/migrations/20180831002535_create_pit_file.sql deleted file mode 100644 index a1be6c5d..00000000 --- a/db/migrations/20180831002535_create_pit_file.sql +++ /dev/null @@ -1,58 +0,0 @@ --- +goose Up -CREATE TABLE maker.pit_file_ilk ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - what TEXT, - data NUMERIC, - log_idx INTEGER NOT NUll, - tx_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -CREATE TABLE maker.pit_file_stability_fee ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - what TEXT, - data TEXT, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -CREATE TABLE maker.pit_file_debt_ceiling ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - what TEXT, - data NUMERIC, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN pit_file_debt_ceiling_checked BOOLEAN NOT NULL DEFAULT FALSE; - -ALTER TABLE public.checked_headers - ADD COLUMN pit_file_ilk_checked BOOLEAN NOT NULL DEFAULT FALSE; - -ALTER TABLE public.checked_headers - ADD COLUMN pit_file_stability_fee_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.pit_file_ilk; -DROP TABLE maker.pit_file_stability_fee; -DROP TABLE maker.pit_file_debt_ceiling; - -ALTER TABLE public.checked_headers - DROP COLUMN pit_file_debt_ceiling_checked; - -ALTER TABLE public.checked_headers - DROP COLUMN pit_file_ilk_checked; - -ALTER TABLE public.checked_headers - DROP COLUMN pit_file_stability_fee_checked; diff --git a/db/migrations/20180906225956_create_vat_init.sql b/db/migrations/20180906225956_create_vat_init.sql deleted file mode 100644 index 6fef3347..00000000 --- a/db/migrations/20180906225956_create_vat_init.sql +++ /dev/null @@ -1,20 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_init ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - log_idx INTEGER NOT NUll, - tx_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vat_init_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vat_init; - -ALTER TABLE public.checked_headers - DROP COLUMN vat_init_checked; \ No newline at end of file diff --git a/db/migrations/20180910202607_create_drip_file.sql b/db/migrations/20180910202607_create_drip_file.sql deleted file mode 100644 index 9255c407..00000000 --- a/db/migrations/20180910202607_create_drip_file.sql +++ /dev/null @@ -1,58 +0,0 @@ --- +goose Up -CREATE TABLE maker.drip_file_ilk ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - vow TEXT, - tax NUMERIC, - log_idx INTEGER NOT NUll, - tx_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -CREATE TABLE maker.drip_file_repo ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - what TEXT, - data NUMERIC, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -CREATE TABLE maker.drip_file_vow ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - what TEXT, - data TEXT, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN drip_file_ilk_checked BOOLEAN NOT NULL DEFAULT FALSE; - -ALTER TABLE public.checked_headers - ADD COLUMN drip_file_repo_checked BOOLEAN NOT NULL DEFAULT FALSE; - -ALTER TABLE public.checked_headers - ADD COLUMN drip_file_vow_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.drip_file_ilk; -DROP TABLE maker.drip_file_repo; -DROP TABLE maker.drip_file_vow; - -ALTER TABLE public.checked_headers - DROP COLUMN drip_file_ilk_checked; - -ALTER TABLE public.checked_headers - DROP COLUMN drip_file_repo_checked; - -ALTER TABLE public.checked_headers - DROP COLUMN drip_file_vow_checked; diff --git a/db/migrations/20180910233720_create_deal.sql b/db/migrations/20180910233720_create_deal.sql deleted file mode 100644 index 4d8ec2c4..00000000 --- a/db/migrations/20180910233720_create_deal.sql +++ /dev/null @@ -1,20 +0,0 @@ --- +goose Up -CREATE TABLE maker.deal ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - bid_id NUMERIC NOT NULL, - contract_address VARCHAR, - log_idx INTEGER NOT NUll, - tx_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN deal_checked BOOLEAN NOT NULL DEFAULT FALSE; - --- +goose Down -DROP TABLE maker.deal; - -ALTER TABLE public.checked_headers - DROP COLUMN deal_checked; diff --git a/db/migrations/20180911235603_add_price_feed_trigger.sql b/db/migrations/20180911235603_add_price_feed_trigger.sql deleted file mode 100644 index b3bf0d2b..00000000 --- a/db/migrations/20180911235603_add_price_feed_trigger.sql +++ /dev/null @@ -1,21 +0,0 @@ --- +goose Up --- +goose StatementBegin -CREATE OR REPLACE FUNCTION notify_pricefeed() RETURNS trigger AS $$ -BEGIN - PERFORM pg_notify( - CAST('postgraphile:price_feed' AS text), - json_build_object('__node__', json_build_array('price_feeds', NEW.id))::text - ); - RETURN NEW; -END; -$$ LANGUAGE plpgsql; --- +goose StatementEnd - -CREATE TRIGGER notify_pricefeeds - AFTER INSERT ON maker.price_feeds - FOR EACH ROW - EXECUTE PROCEDURE notify_pricefeed(); - - --- +goose Down -DROP TRIGGER notify_pricefeeds ON maker.price_feeds; diff --git a/db/migrations/20180912015839_create_drip_drip.sql b/db/migrations/20180912015839_create_drip_drip.sql deleted file mode 100644 index 241dd088..00000000 --- a/db/migrations/20180912015839_create_drip_drip.sql +++ /dev/null @@ -1,20 +0,0 @@ --- +goose Up -CREATE TABLE maker.drip_drip ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - log_idx INTEGER NOT NUll, - tx_idx INTEGER NOT NUll, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN drip_drip_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.drip_drip; - -ALTER TABLE public.checked_headers - DROP COLUMN drip_drip_checked; diff --git a/db/migrations/20180912171047_create_cat_file.sql b/db/migrations/20180912171047_create_cat_file.sql deleted file mode 100644 index d47dec9b..00000000 --- a/db/migrations/20180912171047_create_cat_file.sql +++ /dev/null @@ -1,59 +0,0 @@ --- +goose Up -CREATE TABLE maker.cat_file_chop_lump ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - what TEXT, - data NUMERIC, - tx_idx INTEGER NOT NUll, - log_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -CREATE TABLE maker.cat_file_flip ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk TEXT, - what TEXT, - flip TEXT, - tx_idx INTEGER NOT NUll, - log_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -CREATE TABLE maker.cat_file_pit_vow ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - what TEXT, - data TEXT, - tx_idx INTEGER NOT NUll, - log_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN cat_file_chop_lump_checked BOOLEAN NOT NULL DEFAULT FALSE; - -ALTER TABLE public.checked_headers - ADD COLUMN cat_file_flip_checked BOOLEAN NOT NULL DEFAULT FALSE; - -ALTER TABLE public.checked_headers - ADD COLUMN cat_file_pit_vow_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.cat_file_chop_lump; -DROP TABLE maker.cat_file_flip; -DROP TABLE maker.cat_file_pit_vow; - -ALTER TABLE public.checked_headers - DROP COLUMN cat_file_chop_lump_checked; - -ALTER TABLE public.checked_headers - DROP COLUMN cat_file_flip_checked; - -ALTER TABLE public.checked_headers - DROP COLUMN cat_file_pit_vow_checked; diff --git a/db/migrations/20180914182849_create_flop_kick.sql b/db/migrations/20180914182849_create_flop_kick.sql deleted file mode 100644 index ff46654c..00000000 --- a/db/migrations/20180914182849_create_flop_kick.sql +++ /dev/null @@ -1,23 +0,0 @@ --- +goose Up -CREATE TABLE maker.flop_kick ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - bid_id NUMERIC NOT NULL, - lot NUMERIC NOT NULL, - bid NUMERIC NOT NULL, - gal TEXT, - "end" TIMESTAMP WITH TIME ZONE, - tx_idx INTEGER NOT NULL, - log_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN flop_kick_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.flop_kick; -ALTER TABLE public.checked_headers - DROP COLUMN flop_kick_checked; diff --git a/db/migrations/20181001142655_create_vat_move.sql b/db/migrations/20181001142655_create_vat_move.sql deleted file mode 100644 index 4f156233..00000000 --- a/db/migrations/20181001142655_create_vat_move.sql +++ /dev/null @@ -1,21 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_move ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - src TEXT NOT NULL, - dst TEXT NOT NULL, - rad NUMERIC NOT NULL, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vat_move_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vat_move; -ALTER TABLE public.checked_headers - DROP COLUMN vat_move_checked; diff --git a/db/migrations/20181002220302_create_vat_fold_table.sql b/db/migrations/20181002220302_create_vat_fold_table.sql deleted file mode 100644 index bd661e21..00000000 --- a/db/migrations/20181002220302_create_vat_fold_table.sql +++ /dev/null @@ -1,21 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_fold ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - urn TEXT, - rate NUMERIC, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vat_fold_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vat_fold; -ALTER TABLE public.checked_headers - DROP COLUMN vat_fold_checked; diff --git a/db/migrations/20181004184028_create_vat_heal.sql b/db/migrations/20181004184028_create_vat_heal.sql deleted file mode 100644 index a5524b4f..00000000 --- a/db/migrations/20181004184028_create_vat_heal.sql +++ /dev/null @@ -1,21 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_heal ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - urn TEXT, - v TEXT, - rad NUMERIC, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vat_heal_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vat_heal; -ALTER TABLE public.checked_headers - DROP COLUMN vat_heal_checked; diff --git a/db/migrations/20181004205815_create_vat_toll.sql b/db/migrations/20181004205815_create_vat_toll.sql deleted file mode 100644 index c838254e..00000000 --- a/db/migrations/20181004205815_create_vat_toll.sql +++ /dev/null @@ -1,21 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_toll ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - urn TEXT, - take NUMERIC, - tx_idx INTEGER NOT NULL, - log_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vat_toll_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vat_toll; -ALTER TABLE public.checked_headers - DROP COLUMN vat_toll_checked; diff --git a/db/migrations/20181004233804_create_vat_tune.sql b/db/migrations/20181004233804_create_vat_tune.sql deleted file mode 100644 index 60cc3b54..00000000 --- a/db/migrations/20181004233804_create_vat_tune.sql +++ /dev/null @@ -1,24 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_tune ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - urn TEXT, - v TEXT, - w TEXT, - dink NUMERIC, - dart NUMERIC, - tx_idx INTEGER NOT NULL, - log_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vat_tune_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vat_tune; -ALTER TABLE public.checked_headers - DROP COLUMN vat_tune_checked; diff --git a/db/migrations/20181008232020_create_vat_grab.sql b/db/migrations/20181008232020_create_vat_grab.sql deleted file mode 100644 index b222aa05..00000000 --- a/db/migrations/20181008232020_create_vat_grab.sql +++ /dev/null @@ -1,24 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_grab ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - urn TEXT, - v TEXT, - w TEXT, - dink NUMERIC, - dart NUMERIC, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vat_grab_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vat_grab; -ALTER TABLE public.checked_headers - DROP COLUMN vat_grab_checked; diff --git a/db/migrations/20181011184449_create_vat_flux_table.sql b/db/migrations/20181011184449_create_vat_flux_table.sql deleted file mode 100644 index 5fe48321..00000000 --- a/db/migrations/20181011184449_create_vat_flux_table.sql +++ /dev/null @@ -1,22 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_flux ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - src TEXT, - dst TEXT, - rad numeric, - tx_idx INTEGER NOT NULL, - log_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vat_flux_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vat_flux; -ALTER TABLE public.checked_headers - DROP COLUMN vat_flux_checked; diff --git a/db/migrations/20181015231509_create_vat_slip.sql b/db/migrations/20181015231509_create_vat_slip.sql deleted file mode 100644 index 3694db52..00000000 --- a/db/migrations/20181015231509_create_vat_slip.sql +++ /dev/null @@ -1,21 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_slip ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - guy TEXT, - rad NUMERIC, - tx_idx INTEGER NOT NULL, - log_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vat_slip_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vat_slip; -ALTER TABLE public.checked_headers - DROP COLUMN vat_slip_checked; diff --git a/db/migrations/20181023141856_create_vow_flog.sql b/db/migrations/20181023141856_create_vow_flog.sql deleted file mode 100644 index af429cca..00000000 --- a/db/migrations/20181023141856_create_vow_flog.sql +++ /dev/null @@ -1,19 +0,0 @@ --- +goose Up -CREATE TABLE maker.vow_flog ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - era INTEGER NOT NULL, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN vow_flog_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.vow_flog; -ALTER TABLE public.checked_headers - DROP COLUMN vow_flog_checked; diff --git a/db/migrations/20181106183140_create_flap_kick.sql b/db/migrations/20181106183140_create_flap_kick.sql deleted file mode 100644 index 71410fe4..00000000 --- a/db/migrations/20181106183140_create_flap_kick.sql +++ /dev/null @@ -1,23 +0,0 @@ --- +goose Up -CREATE TABLE maker.flap_kick ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - bid_id NUMERIC NOT NULL, - lot NUMERIC NOT NULL, - bid NUMERIC NOT NULL, - gal TEXT, - "end" TIMESTAMP WITH TIME ZONE, - tx_idx INTEGER NOT NULL, - log_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN flap_kick_checked BOOLEAN NOT NULL DEFAULT FALSE; - - --- +goose Down -DROP TABLE maker.flap_kick; -ALTER TABLE public.checked_headers - DROP COLUMN flap_kick_checked; diff --git a/db/migrations/20181114200128_drop_pit_file_stability_fee.sql b/db/migrations/20181114200128_drop_pit_file_stability_fee.sql deleted file mode 100644 index 208be543..00000000 --- a/db/migrations/20181114200128_drop_pit_file_stability_fee.sql +++ /dev/null @@ -1,21 +0,0 @@ --- +goose Up -DROP TABLE maker.pit_file_stability_fee; - -ALTER TABLE public.checked_headers - DROP COLUMN pit_file_stability_fee_checked; - - --- +goose Down -CREATE TABLE maker.pit_file_stability_fee ( - id SERIAL PRIMARY KEY, - header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE, - what TEXT, - data TEXT, - log_idx INTEGER NOT NULL, - tx_idx INTEGER NOT NULL, - raw_log JSONB, - UNIQUE (header_id, tx_idx, log_idx) -); - -ALTER TABLE public.checked_headers - ADD COLUMN pit_file_stability_fee_checked BOOLEAN NOT NULL DEFAULT FALSE; diff --git a/db/migrations/20181114200129_create_pit_contract_storage_tables.sql b/db/migrations/20181114200129_create_pit_contract_storage_tables.sql deleted file mode 100644 index a3e54d47..00000000 --- a/db/migrations/20181114200129_create_pit_contract_storage_tables.sql +++ /dev/null @@ -1,52 +0,0 @@ --- +goose Up -CREATE TABLE maker.pit_drip ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - drip TEXT -); - -CREATE TABLE maker.pit_ilk_spot ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - spot NUMERIC NOT NULL -); - -CREATE TABLE maker.pit_ilk_line ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - line NUMERIC NOT NULL -); - -CREATE TABLE maker.pit_line ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - line NUMERIC NOT NULL -); - -CREATE TABLE maker.pit_live ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - live NUMERIC NOT NULL -); - -CREATE TABLE maker.pit_vat ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - vat TEXT -); - --- +goose Down -DROP TABLE maker.pit_drip; -DROP TABLE maker.pit_ilk_spot; -DROP TABLE maker.pit_ilk_line; -DROP TABLE maker.pit_line; -DROP TABLE maker.pit_live; -DROP TABLE maker.pit_vat; \ No newline at end of file diff --git a/db/migrations/20181114200130_change_checked_headers_headers_table_type_int.sql b/db/migrations/20181114200130_change_checked_headers_headers_table_type_int.sql deleted file mode 100644 index af9fa93f..00000000 --- a/db/migrations/20181114200130_change_checked_headers_headers_table_type_int.sql +++ /dev/null @@ -1,175 +0,0 @@ --- +goose Up -ALTER TABLE checked_headers - ALTER price_feeds_checked SET DEFAULT null, - ALTER flip_kick_checked SET DEFAULT null, - ALTER frob_checked SET DEFAULT null, - ALTER tend_checked SET DEFAULT null, - ALTER bite_checked SET DEFAULT null, - ALTER dent_checked SET DEFAULT null, - ALTER pit_file_debt_ceiling_checked SET DEFAULT null, - ALTER pit_file_ilk_checked SET DEFAULT null, - ALTER vat_init_checked SET DEFAULT null, - ALTER drip_file_ilk_checked SET DEFAULT null, - ALTER drip_file_repo_checked SET DEFAULT null, - ALTER drip_file_vow_checked SET DEFAULT null, - ALTER deal_checked SET DEFAULT null, - ALTER drip_drip_checked SET DEFAULT null, - ALTER cat_file_chop_lump_checked SET DEFAULT null, - ALTER cat_file_flip_checked SET DEFAULT null, - ALTER cat_file_pit_vow_checked SET DEFAULT null, - ALTER flop_kick_checked SET DEFAULT null, - ALTER vat_move_checked SET DEFAULT null, - ALTER vat_fold_checked SET DEFAULT null, - ALTER vat_heal_checked SET DEFAULT null, - ALTER vat_toll_checked SET DEFAULT null, - ALTER vat_tune_checked SET DEFAULT null, - ALTER vat_grab_checked SET DEFAULT null, - ALTER vat_flux_checked SET DEFAULT null, - ALTER vat_slip_checked SET DEFAULT null, - ALTER vow_flog_checked SET DEFAULT null, - ALTER flap_kick_checked SET DEFAULT null; - -ALTER TABLE checked_headers - ALTER COLUMN price_feeds_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER price_feeds_checked SET DEFAULT 0, - ALTER COLUMN flip_kick_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER flip_kick_checked SET DEFAULT 0, - ALTER COLUMN frob_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER frob_checked SET DEFAULT 0, - ALTER COLUMN tend_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER tend_checked SET DEFAULT 0, - ALTER COLUMN bite_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER bite_checked SET DEFAULT 0, - ALTER COLUMN dent_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER dent_checked SET DEFAULT 0, - ALTER COLUMN pit_file_debt_ceiling_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER pit_file_debt_ceiling_checked SET DEFAULT 0, - ALTER COLUMN pit_file_ilk_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER pit_file_ilk_checked SET DEFAULT 0, - ALTER COLUMN vat_init_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vat_init_checked SET DEFAULT 0, - ALTER COLUMN drip_file_ilk_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER drip_file_ilk_checked SET DEFAULT 0, - ALTER COLUMN drip_file_repo_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER drip_file_repo_checked SET DEFAULT 0, - ALTER COLUMN drip_file_vow_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER drip_file_vow_checked SET DEFAULT 0, - ALTER COLUMN deal_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER deal_checked SET DEFAULT 0, - ALTER COLUMN drip_drip_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER drip_drip_checked SET DEFAULT 0, - ALTER COLUMN cat_file_chop_lump_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER cat_file_chop_lump_checked SET DEFAULT 0, - ALTER COLUMN cat_file_flip_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER cat_file_flip_checked SET DEFAULT 0, - ALTER COLUMN cat_file_pit_vow_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER cat_file_pit_vow_checked SET DEFAULT 0, - ALTER COLUMN flop_kick_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER flop_kick_checked SET DEFAULT 0, - ALTER COLUMN vat_move_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vat_move_checked SET DEFAULT 0, - ALTER COLUMN vat_fold_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vat_fold_checked SET DEFAULT 0, - ALTER COLUMN vat_heal_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vat_heal_checked SET DEFAULT 0, - ALTER COLUMN vat_toll_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vat_toll_checked SET DEFAULT 0, - ALTER COLUMN vat_tune_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vat_tune_checked SET DEFAULT 0, - ALTER COLUMN vat_grab_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vat_grab_checked SET DEFAULT 0, - ALTER COLUMN vat_flux_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vat_flux_checked SET DEFAULT 0, - ALTER COLUMN vat_slip_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vat_slip_checked SET DEFAULT 0, - ALTER COLUMN vow_flog_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER vow_flog_checked SET DEFAULT 0, - ALTER COLUMN flap_kick_checked TYPE integer USING CASE WHEN false THEN 0 ELSE 1 END, - ALTER flap_kick_checked SET DEFAULT 0; - --- +goose Down -ALTER TABLE checked_headers - ALTER price_feeds_checked drop default, - ALTER COLUMN price_feeds_checked SET DATA TYPE boolean USING CASE WHEN price_feeds_checked = 0 THEN FALSE ELSE TRUE END, - ALTER price_feeds_checked SET DEFAULT FALSE, - ALTER flip_kick_checked drop default, - ALTER COLUMN flip_kick_checked SET DATA TYPE boolean USING CASE WHEN flip_kick_checked = 0 THEN FALSE ELSE TRUE END, - ALTER flip_kick_checked SET DEFAULT FALSE, - ALTER frob_checked drop default, - ALTER COLUMN frob_checked SET DATA TYPE boolean USING CASE WHEN frob_checked = 0 THEN FALSE ELSE TRUE END, - ALTER frob_checked SET DEFAULT FALSE, - ALTER tend_checked drop default, - ALTER COLUMN tend_checked SET DATA TYPE boolean USING CASE WHEN tend_checked = 0 THEN FALSE ELSE TRUE END, - ALTER tend_checked SET DEFAULT FALSE, - ALTER bite_checked drop default, - ALTER COLUMN bite_checked SET DATA TYPE boolean USING CASE WHEN bite_checked = 0 THEN FALSE ELSE TRUE END, - ALTER bite_checked SET DEFAULT FALSE, - ALTER dent_checked drop default, - ALTER COLUMN dent_checked SET DATA TYPE boolean USING CASE WHEN dent_checked = 0 THEN FALSE ELSE TRUE END, - ALTER dent_checked SET DEFAULT FALSE, - ALTER pit_file_debt_ceiling_checked drop default, - ALTER COLUMN pit_file_debt_ceiling_checked SET DATA TYPE boolean USING CASE WHEN pit_file_debt_ceiling_checked = 0 THEN FALSE ELSE TRUE END, - ALTER pit_file_debt_ceiling_checked SET DEFAULT FALSE, - ALTER pit_file_ilk_checked drop default, - ALTER COLUMN pit_file_ilk_checked SET DATA TYPE boolean USING CASE WHEN pit_file_ilk_checked = 0 THEN FALSE ELSE TRUE END, - ALTER pit_file_ilk_checked SET DEFAULT FALSE, - ALTER vat_init_checked drop default, - ALTER COLUMN vat_init_checked SET DATA TYPE boolean USING CASE WHEN vat_init_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vat_init_checked SET DEFAULT FALSE, - ALTER drip_file_ilk_checked drop default, - ALTER COLUMN drip_file_ilk_checked SET DATA TYPE boolean USING CASE WHEN drip_file_ilk_checked = 0 THEN FALSE ELSE TRUE END, - ALTER drip_file_ilk_checked SET DEFAULT FALSE, - ALTER drip_file_repo_checked drop default, - ALTER COLUMN drip_file_repo_checked SET DATA TYPE boolean USING CASE WHEN drip_file_repo_checked = 0 THEN FALSE ELSE TRUE END, - ALTER drip_file_repo_checked SET DEFAULT FALSE, - ALTER drip_file_vow_checked drop default, - ALTER COLUMN drip_file_vow_checked SET DATA TYPE boolean USING CASE WHEN drip_file_vow_checked = 0 THEN FALSE ELSE TRUE END, - ALTER drip_file_vow_checked SET DEFAULT FALSE, - ALTER deal_checked drop default, - ALTER COLUMN deal_checked SET DATA TYPE boolean USING CASE WHEN deal_checked = 0 THEN FALSE ELSE TRUE END, - ALTER deal_checked SET DEFAULT FALSE, - ALTER drip_drip_checked drop default, - ALTER COLUMN drip_drip_checked SET DATA TYPE boolean USING CASE WHEN drip_drip_checked = 0 THEN FALSE ELSE TRUE END, - ALTER drip_drip_checked SET DEFAULT FALSE, - ALTER cat_file_chop_lump_checked drop default, - ALTER COLUMN cat_file_chop_lump_checked SET DATA TYPE boolean USING CASE WHEN cat_file_chop_lump_checked = 0 THEN FALSE ELSE TRUE END, - ALTER cat_file_chop_lump_checked SET DEFAULT FALSE, - ALTER cat_file_flip_checked drop default, - ALTER COLUMN cat_file_flip_checked SET DATA TYPE boolean USING CASE WHEN cat_file_flip_checked = 0 THEN FALSE ELSE TRUE END, - ALTER cat_file_flip_checked SET DEFAULT FALSE, - ALTER cat_file_pit_vow_checked drop default, - ALTER COLUMN cat_file_pit_vow_checked SET DATA TYPE boolean USING CASE WHEN cat_file_pit_vow_checked = 0 THEN FALSE ELSE TRUE END, - ALTER cat_file_pit_vow_checked SET DEFAULT FALSE, - ALTER flop_kick_checked drop default, - ALTER COLUMN flop_kick_checked SET DATA TYPE boolean USING CASE WHEN flop_kick_checked = 0 THEN FALSE ELSE TRUE END, - ALTER flop_kick_checked SET DEFAULT FALSE, - ALTER vat_move_checked drop default, - ALTER COLUMN vat_move_checked SET DATA TYPE boolean USING CASE WHEN vat_move_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vat_move_checked SET DEFAULT FALSE, - ALTER vat_fold_checked drop default, - ALTER COLUMN vat_fold_checked SET DATA TYPE boolean USING CASE WHEN vat_fold_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vat_fold_checked SET DEFAULT FALSE, - ALTER vat_heal_checked drop default, - ALTER COLUMN vat_heal_checked SET DATA TYPE boolean USING CASE WHEN vat_heal_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vat_heal_checked SET DEFAULT FALSE, - ALTER vat_toll_checked drop default, - ALTER COLUMN vat_toll_checked SET DATA TYPE boolean USING CASE WHEN vat_toll_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vat_toll_checked SET DEFAULT FALSE, - ALTER vat_tune_checked drop default, - ALTER COLUMN vat_tune_checked SET DATA TYPE boolean USING CASE WHEN vat_tune_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vat_tune_checked SET DEFAULT FALSE, - ALTER vat_grab_checked drop default, - ALTER COLUMN vat_grab_checked SET DATA TYPE boolean USING CASE WHEN vat_grab_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vat_grab_checked SET DEFAULT FALSE, - ALTER vat_flux_checked drop default, - ALTER COLUMN vat_flux_checked SET DATA TYPE boolean USING CASE WHEN vat_flux_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vat_flux_checked SET DEFAULT FALSE, - ALTER vat_slip_checked drop default, - ALTER COLUMN vat_slip_checked SET DATA TYPE boolean USING CASE WHEN vat_slip_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vat_slip_checked SET DEFAULT FALSE, - ALTER vow_flog_checked drop default, - ALTER COLUMN vow_flog_checked SET DATA TYPE boolean USING CASE WHEN vow_flog_checked = 0 THEN FALSE ELSE TRUE END, - ALTER vow_flog_checked SET DEFAULT FALSE, - ALTER flap_kick_checked drop default, - ALTER COLUMN flap_kick_checked SET DATA TYPE boolean USING CASE WHEN flap_kick_checked = 0 THEN FALSE ELSE TRUE END, - ALTER flap_kick_checked SET DEFAULT FALSE; diff --git a/db/migrations/20181114200131_create_vat_contract_storage_tables.sql b/db/migrations/20181114200131_create_vat_contract_storage_tables.sql deleted file mode 100644 index 9c7f8b0c..00000000 --- a/db/migrations/20181114200131_create_vat_contract_storage_tables.sql +++ /dev/null @@ -1,102 +0,0 @@ --- +goose Up -CREATE TABLE maker.vat_debt ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - debt NUMERIC NOT NULL -); - -CREATE TABLE maker.vat_vice ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - vice NUMERIC NOT NULL -); - -CREATE TABLE maker.vat_ilk_art ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - art NUMERIC NOT NULL -); - -CREATE TABLE maker.vat_ilk_ink ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - ink NUMERIC NOT NULL -); - -CREATE TABLE maker.vat_ilk_rate ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - rate NUMERIC NOT NULL -); - -CREATE TABLE maker.vat_ilk_take ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - take NUMERIC NOT NULL -); - -CREATE TABLE maker.vat_urn_art ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - urn TEXT, - art TEXT -); - -CREATE TABLE maker.vat_urn_ink ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - urn TEXT, - ink NUMERIC NOT NULL -); - -CREATE TABLE maker.vat_gem ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - guy TEXT, - gem NUMERIC NOT NULL -); - -CREATE TABLE maker.vat_dai ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - guy TEXT, - dai NUMERIC NOT NULL -); - -CREATE TABLE maker.vat_sin ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - guy TEXT, - sin NUMERIC NOT NULL -); - --- +goose Down -DROP TABLE maker.vat_debt; -DROP TABLE maker.vat_vice; -DROP TABLE maker.vat_ilk_art; -DROP TABLE maker.vat_ilk_ink; -DROP TABLE maker.vat_ilk_rate; -DROP TABLE maker.vat_ilk_take; -DROP TABLE maker.vat_urn_art; -DROP TABLE maker.vat_urn_ink; -DROP TABLE maker.vat_gem; -DROP TABLE maker.vat_dai; -DROP TABLE maker.vat_sin; diff --git a/db/migrations/20181114200132_create_vow_contract_storage_tables.sql b/db/migrations/20181114200132_create_vow_contract_storage_tables.sql deleted file mode 100644 index 2027a599..00000000 --- a/db/migrations/20181114200132_create_vow_contract_storage_tables.sql +++ /dev/null @@ -1,82 +0,0 @@ --- +goose Up -CREATE TABLE maker.vow_vat ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - vat TEXT -); - -CREATE TABLE maker.vow_cow ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - cow TEXT -); - -CREATE TABLE maker.vow_row ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - row TEXT -); - -CREATE TABLE maker.vow_sin ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - sin numeric -); - -CREATE TABLE maker.vow_woe ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - woe numeric -); - -CREATE TABLE maker.vow_ash ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ash numeric -); - -CREATE TABLE maker.vow_wait ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - wait numeric -); - -CREATE TABLE maker.vow_sump ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - sump numeric -); - -CREATE TABLE maker.vow_bump ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - bump numeric -); - -CREATE TABLE maker.vow_hump ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - hump numeric -); - --- +goose Down -DROP TABLE maker.vow_vat; -DROP TABLE maker.vow_cow; -DROP TABLE maker.vow_row; -DROP TABLE maker.vow_sin; -DROP TABLE maker.vow_woe; -DROP TABLE maker.vow_ash; -DROP TABLE maker.vow_wait; -DROP TABLE maker.vow_sump; -DROP TABLE maker.vow_bump; -DROP TABLE maker.vow_hump; diff --git a/db/migrations/20190215160236_create_cat_storage_tables.sql b/db/migrations/20190215160236_create_cat_storage_tables.sql deleted file mode 100644 index 8fc29e5f..00000000 --- a/db/migrations/20190215160236_create_cat_storage_tables.sql +++ /dev/null @@ -1,106 +0,0 @@ --- +goose Up -CREATE TABLE maker.cat_nflip ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - nflip NUMERIC NOT NULL -); - -CREATE TABLE maker.cat_live ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - live NUMERIC NOT NULL -); - -CREATE TABLE maker.cat_vat ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - vat TEXT -); - -CREATE TABLE maker.cat_pit ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - pit TEXT -); - -CREATE TABLE maker.cat_vow ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - vow TEXT -); - -CREATE TABLE maker.cat_ilk_flip ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - flip TEXT -); - -CREATE TABLE maker.cat_ilk_chop ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - chop NUMERIC NOT NULL -); - -CREATE TABLE maker.cat_ilk_lump ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id), - lump NUMERIC NOT NULL -); - -CREATE TABLE maker.cat_flip_ilk ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - flip NUMERIC NOT NULL, - ilk INTEGER NOT NULL REFERENCES maker.ilks (id) -); - -CREATE TABLE maker.cat_flip_urn ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - flip NUMERIC NOT NULL, - urn TEXT -); - -CREATE TABLE maker.cat_flip_ink ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - flip NUMERIC NOT NULL, - ink NUMERIC NOT NULL -); - -CREATE TABLE maker.cat_flip_tab ( - id SERIAL PRIMARY KEY, - block_number BIGINT, - block_hash TEXT, - flip NUMERIC NOT NULL, - tab NUMERIC NOT NULL -); - - --- +goose Down -DROP TABLE maker.cat_nflip; -DROP TABLE maker.cat_live; -DROP TABLE maker.cat_vat; -DROP TABLE maker.cat_pit; -DROP TABLE maker.cat_vow; -DROP TABLE maker.cat_ilk_flip; -DROP TABLE maker.cat_ilk_chop; -DROP TABLE maker.cat_ilk_lump; -DROP TABLE maker.cat_flip_ilk; -DROP TABLE maker.cat_flip_urn; -DROP TABLE maker.cat_flip_ink; -DROP TABLE maker.cat_flip_tab; \ No newline at end of file diff --git a/db/schema.sql b/db/schema.sql index 8cae77dd..107de4a3 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 10.6 --- Dumped by pg_dump version 10.6 +-- Dumped from database version 10.5 +-- Dumped by pg_dump version 10.4 SET statement_timeout = 0; SET lock_timeout = 0; @@ -15,13 +15,6 @@ SET check_function_bodies = false; SET client_min_messages = warning; SET row_security = off; --- --- Name: maker; Type: SCHEMA; Schema: -; Owner: - --- - -CREATE SCHEMA maker; - - -- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - -- @@ -36,2350 +29,10 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; --- --- Name: notify_pricefeed(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.notify_pricefeed() RETURNS trigger - LANGUAGE plpgsql - AS $$ -BEGIN - PERFORM pg_notify( - CAST('postgraphile:price_feed' AS text), - json_build_object('__node__', json_build_array('price_feeds', NEW.id))::text - ); - RETURN NEW; -END; -$$; - - SET default_tablespace = ''; SET default_with_oids = false; --- --- Name: bite; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.bite ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - urn text, - ink numeric, - art numeric, - iart numeric, - tab numeric, - nflip numeric, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: bite_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.bite_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: bite_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.bite_id_seq OWNED BY maker.bite.id; - - --- --- Name: cat_file_chop_lump; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_file_chop_lump ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - what text, - data numeric, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: cat_file_chop_lump_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_file_chop_lump_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_file_chop_lump_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_file_chop_lump_id_seq OWNED BY maker.cat_file_chop_lump.id; - - --- --- Name: cat_file_flip; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_file_flip ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk text, - what text, - flip text, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: cat_file_flip_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_file_flip_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_file_flip_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_file_flip_id_seq OWNED BY maker.cat_file_flip.id; - - --- --- Name: cat_file_pit_vow; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_file_pit_vow ( - id integer NOT NULL, - header_id integer NOT NULL, - what text, - data text, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: cat_file_pit_vow_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_file_pit_vow_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_file_pit_vow_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_file_pit_vow_id_seq OWNED BY maker.cat_file_pit_vow.id; - - --- --- Name: cat_flip_ilk; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_flip_ilk ( - id integer NOT NULL, - block_number bigint, - block_hash text, - flip numeric NOT NULL, - ilk integer NOT NULL -); - - --- --- Name: cat_flip_ilk_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_flip_ilk_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_flip_ilk_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_flip_ilk_id_seq OWNED BY maker.cat_flip_ilk.id; - - --- --- Name: cat_flip_ink; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_flip_ink ( - id integer NOT NULL, - block_number bigint, - block_hash text, - flip numeric NOT NULL, - ink numeric NOT NULL -); - - --- --- Name: cat_flip_ink_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_flip_ink_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_flip_ink_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_flip_ink_id_seq OWNED BY maker.cat_flip_ink.id; - - --- --- Name: cat_flip_tab; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_flip_tab ( - id integer NOT NULL, - block_number bigint, - block_hash text, - flip numeric NOT NULL, - tab numeric NOT NULL -); - - --- --- Name: cat_flip_tab_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_flip_tab_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_flip_tab_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_flip_tab_id_seq OWNED BY maker.cat_flip_tab.id; - - --- --- Name: cat_flip_urn; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_flip_urn ( - id integer NOT NULL, - block_number bigint, - block_hash text, - flip numeric NOT NULL, - urn text -); - - --- --- Name: cat_flip_urn_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_flip_urn_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_flip_urn_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_flip_urn_id_seq OWNED BY maker.cat_flip_urn.id; - - --- --- Name: cat_ilk_chop; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_ilk_chop ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - chop numeric NOT NULL -); - - --- --- Name: cat_ilk_chop_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_ilk_chop_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_ilk_chop_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_ilk_chop_id_seq OWNED BY maker.cat_ilk_chop.id; - - --- --- Name: cat_ilk_flip; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_ilk_flip ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - flip text -); - - --- --- Name: cat_ilk_flip_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_ilk_flip_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_ilk_flip_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_ilk_flip_id_seq OWNED BY maker.cat_ilk_flip.id; - - --- --- Name: cat_ilk_lump; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_ilk_lump ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - lump numeric NOT NULL -); - - --- --- Name: cat_ilk_lump_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_ilk_lump_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_ilk_lump_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_ilk_lump_id_seq OWNED BY maker.cat_ilk_lump.id; - - --- --- Name: cat_live; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_live ( - id integer NOT NULL, - block_number bigint, - block_hash text, - live numeric NOT NULL -); - - --- --- Name: cat_live_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_live_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_live_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_live_id_seq OWNED BY maker.cat_live.id; - - --- --- Name: cat_nflip; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_nflip ( - id integer NOT NULL, - block_number bigint, - block_hash text, - nflip numeric NOT NULL -); - - --- --- Name: cat_nflip_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_nflip_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_nflip_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_nflip_id_seq OWNED BY maker.cat_nflip.id; - - --- --- Name: cat_pit; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_pit ( - id integer NOT NULL, - block_number bigint, - block_hash text, - pit text -); - - --- --- Name: cat_pit_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_pit_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_pit_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_pit_id_seq OWNED BY maker.cat_pit.id; - - --- --- Name: cat_vat; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_vat ( - id integer NOT NULL, - block_number bigint, - block_hash text, - vat text -); - - --- --- Name: cat_vat_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_vat_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_vat_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_vat_id_seq OWNED BY maker.cat_vat.id; - - --- --- Name: cat_vow; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.cat_vow ( - id integer NOT NULL, - block_number bigint, - block_hash text, - vow text -); - - --- --- Name: cat_vow_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.cat_vow_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: cat_vow_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.cat_vow_id_seq OWNED BY maker.cat_vow.id; - - --- --- Name: deal; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.deal ( - id integer NOT NULL, - header_id integer NOT NULL, - bid_id numeric NOT NULL, - contract_address character varying, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: deal_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.deal_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: deal_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.deal_id_seq OWNED BY maker.deal.id; - - --- --- Name: dent; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.dent ( - id integer NOT NULL, - header_id integer NOT NULL, - bid_id numeric NOT NULL, - lot numeric, - bid numeric, - guy bytea, - tic numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: dent_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.dent_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: dent_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.dent_id_seq OWNED BY maker.dent.id; - - --- --- Name: drip_drip; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.drip_drip ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: drip_drip_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.drip_drip_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: drip_drip_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.drip_drip_id_seq OWNED BY maker.drip_drip.id; - - --- --- Name: drip_file_ilk; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.drip_file_ilk ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - vow text, - tax numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: drip_file_ilk_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.drip_file_ilk_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: drip_file_ilk_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.drip_file_ilk_id_seq OWNED BY maker.drip_file_ilk.id; - - --- --- Name: drip_file_repo; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.drip_file_repo ( - id integer NOT NULL, - header_id integer NOT NULL, - what text, - data numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: drip_file_repo_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.drip_file_repo_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: drip_file_repo_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.drip_file_repo_id_seq OWNED BY maker.drip_file_repo.id; - - --- --- Name: drip_file_vow; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.drip_file_vow ( - id integer NOT NULL, - header_id integer NOT NULL, - what text, - data text, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: drip_file_vow_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.drip_file_vow_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: drip_file_vow_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.drip_file_vow_id_seq OWNED BY maker.drip_file_vow.id; - - --- --- Name: flap_kick; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.flap_kick ( - id integer NOT NULL, - header_id integer NOT NULL, - bid_id numeric NOT NULL, - lot numeric NOT NULL, - bid numeric NOT NULL, - gal text, - "end" timestamp with time zone, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: flap_kick_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.flap_kick_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: flap_kick_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.flap_kick_id_seq OWNED BY maker.flap_kick.id; - - --- --- Name: flip_kick; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.flip_kick ( - id integer NOT NULL, - header_id integer NOT NULL, - bid_id numeric NOT NULL, - lot numeric, - bid numeric, - gal text, - "end" timestamp with time zone, - urn text, - tab numeric, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: flip_kick_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.flip_kick_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: flip_kick_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.flip_kick_id_seq OWNED BY maker.flip_kick.id; - - --- --- Name: flop_kick; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.flop_kick ( - id integer NOT NULL, - header_id integer NOT NULL, - bid_id numeric NOT NULL, - lot numeric NOT NULL, - bid numeric NOT NULL, - gal text, - "end" timestamp with time zone, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: flop_kick_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.flop_kick_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: flop_kick_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.flop_kick_id_seq OWNED BY maker.flop_kick.id; - - --- --- Name: frob; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.frob ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - urn text, - dink numeric, - dart numeric, - ink numeric, - art numeric, - iart numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: frob_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.frob_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: frob_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.frob_id_seq OWNED BY maker.frob.id; - - --- --- Name: ilks; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.ilks ( - id integer NOT NULL, - ilk text -); - - --- --- Name: ilks_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.ilks_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: ilks_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.ilks_id_seq OWNED BY maker.ilks.id; - - --- --- Name: pit_drip; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.pit_drip ( - id integer NOT NULL, - block_number bigint, - block_hash text, - drip text -); - - --- --- Name: pit_drip_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.pit_drip_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pit_drip_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.pit_drip_id_seq OWNED BY maker.pit_drip.id; - - --- --- Name: pit_file_debt_ceiling; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.pit_file_debt_ceiling ( - id integer NOT NULL, - header_id integer NOT NULL, - what text, - data numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: pit_file_debt_ceiling_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.pit_file_debt_ceiling_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pit_file_debt_ceiling_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.pit_file_debt_ceiling_id_seq OWNED BY maker.pit_file_debt_ceiling.id; - - --- --- Name: pit_file_ilk; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.pit_file_ilk ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - what text, - data numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: pit_file_ilk_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.pit_file_ilk_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pit_file_ilk_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.pit_file_ilk_id_seq OWNED BY maker.pit_file_ilk.id; - - --- --- Name: pit_ilk_line; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.pit_ilk_line ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - line numeric NOT NULL -); - - --- --- Name: pit_ilk_line_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.pit_ilk_line_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pit_ilk_line_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.pit_ilk_line_id_seq OWNED BY maker.pit_ilk_line.id; - - --- --- Name: pit_ilk_spot; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.pit_ilk_spot ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - spot numeric NOT NULL -); - - --- --- Name: pit_ilk_spot_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.pit_ilk_spot_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pit_ilk_spot_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.pit_ilk_spot_id_seq OWNED BY maker.pit_ilk_spot.id; - - --- --- Name: pit_line; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.pit_line ( - id integer NOT NULL, - block_number bigint, - block_hash text, - line numeric NOT NULL -); - - --- --- Name: pit_line_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.pit_line_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pit_line_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.pit_line_id_seq OWNED BY maker.pit_line.id; - - --- --- Name: pit_live; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.pit_live ( - id integer NOT NULL, - block_number bigint, - block_hash text, - live numeric NOT NULL -); - - --- --- Name: pit_live_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.pit_live_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pit_live_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.pit_live_id_seq OWNED BY maker.pit_live.id; - - --- --- Name: pit_vat; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.pit_vat ( - id integer NOT NULL, - block_number bigint, - block_hash text, - vat text -); - - --- --- Name: pit_vat_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.pit_vat_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: pit_vat_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.pit_vat_id_seq OWNED BY maker.pit_vat.id; - - --- --- Name: price_feeds; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.price_feeds ( - id integer NOT NULL, - block_number bigint NOT NULL, - header_id integer NOT NULL, - medianizer_address text, - usd_value numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: price_feeds_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.price_feeds_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: price_feeds_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.price_feeds_id_seq OWNED BY maker.price_feeds.id; - - --- --- Name: tend; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.tend ( - id integer NOT NULL, - header_id integer NOT NULL, - bid_id numeric NOT NULL, - lot numeric, - bid numeric, - guy text, - tic numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: tend_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.tend_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: tend_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.tend_id_seq OWNED BY maker.tend.id; - - --- --- Name: vat_dai; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_dai ( - id integer NOT NULL, - block_number bigint, - block_hash text, - guy text, - dai numeric NOT NULL -); - - --- --- Name: vat_dai_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_dai_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_dai_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_dai_id_seq OWNED BY maker.vat_dai.id; - - --- --- Name: vat_debt; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_debt ( - id integer NOT NULL, - block_number bigint, - block_hash text, - debt numeric NOT NULL -); - - --- --- Name: vat_debt_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_debt_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_debt_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_debt_id_seq OWNED BY maker.vat_debt.id; - - --- --- Name: vat_flux; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_flux ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - src text, - dst text, - rad numeric, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vat_flux_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_flux_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_flux_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_flux_id_seq OWNED BY maker.vat_flux.id; - - --- --- Name: vat_fold; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_fold ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - urn text, - rate numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vat_fold_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_fold_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_fold_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_fold_id_seq OWNED BY maker.vat_fold.id; - - --- --- Name: vat_gem; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_gem ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - guy text, - gem numeric NOT NULL -); - - --- --- Name: vat_gem_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_gem_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_gem_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_gem_id_seq OWNED BY maker.vat_gem.id; - - --- --- Name: vat_grab; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_grab ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - urn text, - v text, - w text, - dink numeric, - dart numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vat_grab_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_grab_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_grab_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_grab_id_seq OWNED BY maker.vat_grab.id; - - --- --- Name: vat_heal; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_heal ( - id integer NOT NULL, - header_id integer NOT NULL, - urn text, - v text, - rad numeric, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vat_heal_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_heal_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_heal_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_heal_id_seq OWNED BY maker.vat_heal.id; - - --- --- Name: vat_ilk_art; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_ilk_art ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - art numeric NOT NULL -); - - --- --- Name: vat_ilk_art_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_ilk_art_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_ilk_art_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_ilk_art_id_seq OWNED BY maker.vat_ilk_art.id; - - --- --- Name: vat_ilk_ink; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_ilk_ink ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - ink numeric NOT NULL -); - - --- --- Name: vat_ilk_ink_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_ilk_ink_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_ilk_ink_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_ilk_ink_id_seq OWNED BY maker.vat_ilk_ink.id; - - --- --- Name: vat_ilk_rate; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_ilk_rate ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - rate numeric NOT NULL -); - - --- --- Name: vat_ilk_rate_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_ilk_rate_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_ilk_rate_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_ilk_rate_id_seq OWNED BY maker.vat_ilk_rate.id; - - --- --- Name: vat_ilk_take; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_ilk_take ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - take numeric NOT NULL -); - - --- --- Name: vat_ilk_take_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_ilk_take_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_ilk_take_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_ilk_take_id_seq OWNED BY maker.vat_ilk_take.id; - - --- --- Name: vat_init; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_init ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vat_init_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_init_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_init_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_init_id_seq OWNED BY maker.vat_init.id; - - --- --- Name: vat_move; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_move ( - id integer NOT NULL, - header_id integer NOT NULL, - src text NOT NULL, - dst text NOT NULL, - rad numeric NOT NULL, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vat_move_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_move_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_move_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_move_id_seq OWNED BY maker.vat_move.id; - - --- --- Name: vat_sin; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_sin ( - id integer NOT NULL, - block_number bigint, - block_hash text, - guy text, - sin numeric NOT NULL -); - - --- --- Name: vat_sin_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_sin_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_sin_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_sin_id_seq OWNED BY maker.vat_sin.id; - - --- --- Name: vat_slip; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_slip ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - guy text, - rad numeric, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vat_slip_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_slip_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_slip_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_slip_id_seq OWNED BY maker.vat_slip.id; - - --- --- Name: vat_toll; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_toll ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - urn text, - take numeric, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vat_toll_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_toll_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_toll_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_toll_id_seq OWNED BY maker.vat_toll.id; - - --- --- Name: vat_tune; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_tune ( - id integer NOT NULL, - header_id integer NOT NULL, - ilk integer NOT NULL, - urn text, - v text, - w text, - dink numeric, - dart numeric, - tx_idx integer NOT NULL, - log_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vat_tune_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_tune_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_tune_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_tune_id_seq OWNED BY maker.vat_tune.id; - - --- --- Name: vat_urn_art; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_urn_art ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - urn text, - art text -); - - --- --- Name: vat_urn_art_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_urn_art_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_urn_art_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_urn_art_id_seq OWNED BY maker.vat_urn_art.id; - - --- --- Name: vat_urn_ink; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_urn_ink ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ilk integer NOT NULL, - urn text, - ink numeric NOT NULL -); - - --- --- Name: vat_urn_ink_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_urn_ink_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_urn_ink_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_urn_ink_id_seq OWNED BY maker.vat_urn_ink.id; - - --- --- Name: vat_vice; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vat_vice ( - id integer NOT NULL, - block_number bigint, - block_hash text, - vice numeric NOT NULL -); - - --- --- Name: vat_vice_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vat_vice_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vat_vice_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vat_vice_id_seq OWNED BY maker.vat_vice.id; - - --- --- Name: vow_ash; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_ash ( - id integer NOT NULL, - block_number bigint, - block_hash text, - ash numeric -); - - --- --- Name: vow_ash_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_ash_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_ash_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_ash_id_seq OWNED BY maker.vow_ash.id; - - --- --- Name: vow_bump; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_bump ( - id integer NOT NULL, - block_number bigint, - block_hash text, - bump numeric -); - - --- --- Name: vow_bump_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_bump_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_bump_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_bump_id_seq OWNED BY maker.vow_bump.id; - - --- --- Name: vow_cow; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_cow ( - id integer NOT NULL, - block_number bigint, - block_hash text, - cow text -); - - --- --- Name: vow_cow_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_cow_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_cow_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_cow_id_seq OWNED BY maker.vow_cow.id; - - --- --- Name: vow_flog; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_flog ( - id integer NOT NULL, - header_id integer NOT NULL, - era integer NOT NULL, - log_idx integer NOT NULL, - tx_idx integer NOT NULL, - raw_log jsonb -); - - --- --- Name: vow_flog_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_flog_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_flog_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_flog_id_seq OWNED BY maker.vow_flog.id; - - --- --- Name: vow_hump; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_hump ( - id integer NOT NULL, - block_number bigint, - block_hash text, - hump numeric -); - - --- --- Name: vow_hump_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_hump_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_hump_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_hump_id_seq OWNED BY maker.vow_hump.id; - - --- --- Name: vow_row; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_row ( - id integer NOT NULL, - block_number bigint, - block_hash text, - "row" text -); - - --- --- Name: vow_row_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_row_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_row_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_row_id_seq OWNED BY maker.vow_row.id; - - --- --- Name: vow_sin; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_sin ( - id integer NOT NULL, - block_number bigint, - block_hash text, - sin numeric -); - - --- --- Name: vow_sin_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_sin_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_sin_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_sin_id_seq OWNED BY maker.vow_sin.id; - - --- --- Name: vow_sump; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_sump ( - id integer NOT NULL, - block_number bigint, - block_hash text, - sump numeric -); - - --- --- Name: vow_sump_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_sump_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_sump_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_sump_id_seq OWNED BY maker.vow_sump.id; - - --- --- Name: vow_vat; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_vat ( - id integer NOT NULL, - block_number bigint, - block_hash text, - vat text -); - - --- --- Name: vow_vat_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_vat_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_vat_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_vat_id_seq OWNED BY maker.vow_vat.id; - - --- --- Name: vow_wait; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_wait ( - id integer NOT NULL, - block_number bigint, - block_hash text, - wait numeric -); - - --- --- Name: vow_wait_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_wait_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_wait_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_wait_id_seq OWNED BY maker.vow_wait.id; - - --- --- Name: vow_woe; Type: TABLE; Schema: maker; Owner: - --- - -CREATE TABLE maker.vow_woe ( - id integer NOT NULL, - block_number bigint, - block_hash text, - woe numeric -); - - --- --- Name: vow_woe_id_seq; Type: SEQUENCE; Schema: maker; Owner: - --- - -CREATE SEQUENCE maker.vow_woe_id_seq - AS integer - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: vow_woe_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: - --- - -ALTER SEQUENCE maker.vow_woe_id_seq OWNED BY maker.vow_woe.id; - - -- -- Name: logs; Type: TABLE; Schema: public; Owner: - -- @@ -2461,35 +114,7 @@ ALTER SEQUENCE public.blocks_id_seq OWNED BY public.blocks.id; CREATE TABLE public.checked_headers ( id integer NOT NULL, - header_id integer NOT NULL, - price_feeds_checked integer DEFAULT 0 NOT NULL, - flip_kick_checked integer DEFAULT 0 NOT NULL, - frob_checked integer DEFAULT 0 NOT NULL, - tend_checked integer DEFAULT 0 NOT NULL, - bite_checked integer DEFAULT 0 NOT NULL, - dent_checked integer DEFAULT 0 NOT NULL, - pit_file_debt_ceiling_checked integer DEFAULT 0 NOT NULL, - pit_file_ilk_checked integer DEFAULT 0 NOT NULL, - vat_init_checked integer DEFAULT 0 NOT NULL, - drip_file_ilk_checked integer DEFAULT 0 NOT NULL, - drip_file_repo_checked integer DEFAULT 0 NOT NULL, - drip_file_vow_checked integer DEFAULT 0 NOT NULL, - deal_checked integer DEFAULT 0 NOT NULL, - drip_drip_checked integer DEFAULT 0 NOT NULL, - cat_file_chop_lump_checked integer DEFAULT 0 NOT NULL, - cat_file_flip_checked integer DEFAULT 0 NOT NULL, - cat_file_pit_vow_checked integer DEFAULT 0 NOT NULL, - flop_kick_checked integer DEFAULT 0 NOT NULL, - vat_move_checked integer DEFAULT 0 NOT NULL, - vat_fold_checked integer DEFAULT 0 NOT NULL, - vat_heal_checked integer DEFAULT 0 NOT NULL, - vat_toll_checked integer DEFAULT 0 NOT NULL, - vat_tune_checked integer DEFAULT 0 NOT NULL, - vat_grab_checked integer DEFAULT 0 NOT NULL, - vat_flux_checked integer DEFAULT 0 NOT NULL, - vat_slip_checked integer DEFAULT 0 NOT NULL, - vow_flog_checked integer DEFAULT 0 NOT NULL, - flap_kick_checked integer DEFAULT 0 NOT NULL + header_id integer NOT NULL ); @@ -2867,482 +492,6 @@ CREATE VIEW public.watched_event_logs AS WHERE ((((log_filters.topic0)::text = (logs.topic0)::text) OR (log_filters.topic0 IS NULL)) AND (((log_filters.topic1)::text = (logs.topic1)::text) OR (log_filters.topic1 IS NULL)) AND (((log_filters.topic2)::text = (logs.topic2)::text) OR (log_filters.topic2 IS NULL)) AND (((log_filters.topic3)::text = (logs.topic3)::text) OR (log_filters.topic3 IS NULL))); --- --- Name: bite id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.bite ALTER COLUMN id SET DEFAULT nextval('maker.bite_id_seq'::regclass); - - --- --- Name: cat_file_chop_lump id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_chop_lump ALTER COLUMN id SET DEFAULT nextval('maker.cat_file_chop_lump_id_seq'::regclass); - - --- --- Name: cat_file_flip id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_flip ALTER COLUMN id SET DEFAULT nextval('maker.cat_file_flip_id_seq'::regclass); - - --- --- Name: cat_file_pit_vow id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_pit_vow ALTER COLUMN id SET DEFAULT nextval('maker.cat_file_pit_vow_id_seq'::regclass); - - --- --- Name: cat_flip_ilk id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_flip_ilk ALTER COLUMN id SET DEFAULT nextval('maker.cat_flip_ilk_id_seq'::regclass); - - --- --- Name: cat_flip_ink id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_flip_ink ALTER COLUMN id SET DEFAULT nextval('maker.cat_flip_ink_id_seq'::regclass); - - --- --- Name: cat_flip_tab id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_flip_tab ALTER COLUMN id SET DEFAULT nextval('maker.cat_flip_tab_id_seq'::regclass); - - --- --- Name: cat_flip_urn id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_flip_urn ALTER COLUMN id SET DEFAULT nextval('maker.cat_flip_urn_id_seq'::regclass); - - --- --- Name: cat_ilk_chop id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_ilk_chop ALTER COLUMN id SET DEFAULT nextval('maker.cat_ilk_chop_id_seq'::regclass); - - --- --- Name: cat_ilk_flip id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_ilk_flip ALTER COLUMN id SET DEFAULT nextval('maker.cat_ilk_flip_id_seq'::regclass); - - --- --- Name: cat_ilk_lump id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_ilk_lump ALTER COLUMN id SET DEFAULT nextval('maker.cat_ilk_lump_id_seq'::regclass); - - --- --- Name: cat_live id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_live ALTER COLUMN id SET DEFAULT nextval('maker.cat_live_id_seq'::regclass); - - --- --- Name: cat_nflip id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_nflip ALTER COLUMN id SET DEFAULT nextval('maker.cat_nflip_id_seq'::regclass); - - --- --- Name: cat_pit id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_pit ALTER COLUMN id SET DEFAULT nextval('maker.cat_pit_id_seq'::regclass); - - --- --- Name: cat_vat id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_vat ALTER COLUMN id SET DEFAULT nextval('maker.cat_vat_id_seq'::regclass); - - --- --- Name: cat_vow id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_vow ALTER COLUMN id SET DEFAULT nextval('maker.cat_vow_id_seq'::regclass); - - --- --- Name: deal id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.deal ALTER COLUMN id SET DEFAULT nextval('maker.deal_id_seq'::regclass); - - --- --- Name: dent id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.dent ALTER COLUMN id SET DEFAULT nextval('maker.dent_id_seq'::regclass); - - --- --- Name: drip_drip id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_drip ALTER COLUMN id SET DEFAULT nextval('maker.drip_drip_id_seq'::regclass); - - --- --- Name: drip_file_ilk id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_ilk ALTER COLUMN id SET DEFAULT nextval('maker.drip_file_ilk_id_seq'::regclass); - - --- --- Name: drip_file_repo id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_repo ALTER COLUMN id SET DEFAULT nextval('maker.drip_file_repo_id_seq'::regclass); - - --- --- Name: drip_file_vow id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_vow ALTER COLUMN id SET DEFAULT nextval('maker.drip_file_vow_id_seq'::regclass); - - --- --- Name: flap_kick id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flap_kick ALTER COLUMN id SET DEFAULT nextval('maker.flap_kick_id_seq'::regclass); - - --- --- Name: flip_kick id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flip_kick ALTER COLUMN id SET DEFAULT nextval('maker.flip_kick_id_seq'::regclass); - - --- --- Name: flop_kick id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flop_kick ALTER COLUMN id SET DEFAULT nextval('maker.flop_kick_id_seq'::regclass); - - --- --- Name: frob id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.frob ALTER COLUMN id SET DEFAULT nextval('maker.frob_id_seq'::regclass); - - --- --- Name: ilks id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.ilks ALTER COLUMN id SET DEFAULT nextval('maker.ilks_id_seq'::regclass); - - --- --- Name: pit_drip id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_drip ALTER COLUMN id SET DEFAULT nextval('maker.pit_drip_id_seq'::regclass); - - --- --- Name: pit_file_debt_ceiling id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_file_debt_ceiling ALTER COLUMN id SET DEFAULT nextval('maker.pit_file_debt_ceiling_id_seq'::regclass); - - --- --- Name: pit_file_ilk id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_file_ilk ALTER COLUMN id SET DEFAULT nextval('maker.pit_file_ilk_id_seq'::regclass); - - --- --- Name: pit_ilk_line id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_ilk_line ALTER COLUMN id SET DEFAULT nextval('maker.pit_ilk_line_id_seq'::regclass); - - --- --- Name: pit_ilk_spot id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_ilk_spot ALTER COLUMN id SET DEFAULT nextval('maker.pit_ilk_spot_id_seq'::regclass); - - --- --- Name: pit_line id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_line ALTER COLUMN id SET DEFAULT nextval('maker.pit_line_id_seq'::regclass); - - --- --- Name: pit_live id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_live ALTER COLUMN id SET DEFAULT nextval('maker.pit_live_id_seq'::regclass); - - --- --- Name: pit_vat id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_vat ALTER COLUMN id SET DEFAULT nextval('maker.pit_vat_id_seq'::regclass); - - --- --- Name: price_feeds id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.price_feeds ALTER COLUMN id SET DEFAULT nextval('maker.price_feeds_id_seq'::regclass); - - --- --- Name: tend id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.tend ALTER COLUMN id SET DEFAULT nextval('maker.tend_id_seq'::regclass); - - --- --- Name: vat_dai id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_dai ALTER COLUMN id SET DEFAULT nextval('maker.vat_dai_id_seq'::regclass); - - --- --- Name: vat_debt id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_debt ALTER COLUMN id SET DEFAULT nextval('maker.vat_debt_id_seq'::regclass); - - --- --- Name: vat_flux id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_flux ALTER COLUMN id SET DEFAULT nextval('maker.vat_flux_id_seq'::regclass); - - --- --- Name: vat_fold id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_fold ALTER COLUMN id SET DEFAULT nextval('maker.vat_fold_id_seq'::regclass); - - --- --- Name: vat_gem id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_gem ALTER COLUMN id SET DEFAULT nextval('maker.vat_gem_id_seq'::regclass); - - --- --- Name: vat_grab id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_grab ALTER COLUMN id SET DEFAULT nextval('maker.vat_grab_id_seq'::regclass); - - --- --- Name: vat_heal id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_heal ALTER COLUMN id SET DEFAULT nextval('maker.vat_heal_id_seq'::regclass); - - --- --- Name: vat_ilk_art id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_art ALTER COLUMN id SET DEFAULT nextval('maker.vat_ilk_art_id_seq'::regclass); - - --- --- Name: vat_ilk_ink id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_ink ALTER COLUMN id SET DEFAULT nextval('maker.vat_ilk_ink_id_seq'::regclass); - - --- --- Name: vat_ilk_rate id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_rate ALTER COLUMN id SET DEFAULT nextval('maker.vat_ilk_rate_id_seq'::regclass); - - --- --- Name: vat_ilk_take id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_take ALTER COLUMN id SET DEFAULT nextval('maker.vat_ilk_take_id_seq'::regclass); - - --- --- Name: vat_init id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_init ALTER COLUMN id SET DEFAULT nextval('maker.vat_init_id_seq'::regclass); - - --- --- Name: vat_move id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_move ALTER COLUMN id SET DEFAULT nextval('maker.vat_move_id_seq'::regclass); - - --- --- Name: vat_sin id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_sin ALTER COLUMN id SET DEFAULT nextval('maker.vat_sin_id_seq'::regclass); - - --- --- Name: vat_slip id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_slip ALTER COLUMN id SET DEFAULT nextval('maker.vat_slip_id_seq'::regclass); - - --- --- Name: vat_toll id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_toll ALTER COLUMN id SET DEFAULT nextval('maker.vat_toll_id_seq'::regclass); - - --- --- Name: vat_tune id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_tune ALTER COLUMN id SET DEFAULT nextval('maker.vat_tune_id_seq'::regclass); - - --- --- Name: vat_urn_art id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_urn_art ALTER COLUMN id SET DEFAULT nextval('maker.vat_urn_art_id_seq'::regclass); - - --- --- Name: vat_urn_ink id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_urn_ink ALTER COLUMN id SET DEFAULT nextval('maker.vat_urn_ink_id_seq'::regclass); - - --- --- Name: vat_vice id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_vice ALTER COLUMN id SET DEFAULT nextval('maker.vat_vice_id_seq'::regclass); - - --- --- Name: vow_ash id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_ash ALTER COLUMN id SET DEFAULT nextval('maker.vow_ash_id_seq'::regclass); - - --- --- Name: vow_bump id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_bump ALTER COLUMN id SET DEFAULT nextval('maker.vow_bump_id_seq'::regclass); - - --- --- Name: vow_cow id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_cow ALTER COLUMN id SET DEFAULT nextval('maker.vow_cow_id_seq'::regclass); - - --- --- Name: vow_flog id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_flog ALTER COLUMN id SET DEFAULT nextval('maker.vow_flog_id_seq'::regclass); - - --- --- Name: vow_hump id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_hump ALTER COLUMN id SET DEFAULT nextval('maker.vow_hump_id_seq'::regclass); - - --- --- Name: vow_row id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_row ALTER COLUMN id SET DEFAULT nextval('maker.vow_row_id_seq'::regclass); - - --- --- Name: vow_sin id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_sin ALTER COLUMN id SET DEFAULT nextval('maker.vow_sin_id_seq'::regclass); - - --- --- Name: vow_sump id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_sump ALTER COLUMN id SET DEFAULT nextval('maker.vow_sump_id_seq'::regclass); - - --- --- Name: vow_vat id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_vat ALTER COLUMN id SET DEFAULT nextval('maker.vow_vat_id_seq'::regclass); - - --- --- Name: vow_wait id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_wait ALTER COLUMN id SET DEFAULT nextval('maker.vow_wait_id_seq'::regclass); - - --- --- Name: vow_woe id; Type: DEFAULT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_woe ALTER COLUMN id SET DEFAULT nextval('maker.vow_woe_id_seq'::regclass); - - -- -- Name: blocks id; Type: DEFAULT; Schema: public; Owner: - -- @@ -3427,782 +576,6 @@ ALTER TABLE ONLY public.transactions ALTER COLUMN id SET DEFAULT nextval('public ALTER TABLE ONLY public.watched_contracts ALTER COLUMN contract_id SET DEFAULT nextval('public.watched_contracts_contract_id_seq'::regclass); --- --- Name: bite bite_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.bite - ADD CONSTRAINT bite_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: bite bite_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.bite - ADD CONSTRAINT bite_pkey PRIMARY KEY (id); - - --- --- Name: cat_file_chop_lump cat_file_chop_lump_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_chop_lump - ADD CONSTRAINT cat_file_chop_lump_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: cat_file_chop_lump cat_file_chop_lump_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_chop_lump - ADD CONSTRAINT cat_file_chop_lump_pkey PRIMARY KEY (id); - - --- --- Name: cat_file_flip cat_file_flip_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_flip - ADD CONSTRAINT cat_file_flip_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: cat_file_flip cat_file_flip_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_flip - ADD CONSTRAINT cat_file_flip_pkey PRIMARY KEY (id); - - --- --- Name: cat_file_pit_vow cat_file_pit_vow_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_pit_vow - ADD CONSTRAINT cat_file_pit_vow_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: cat_file_pit_vow cat_file_pit_vow_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_pit_vow - ADD CONSTRAINT cat_file_pit_vow_pkey PRIMARY KEY (id); - - --- --- Name: cat_flip_ilk cat_flip_ilk_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_flip_ilk - ADD CONSTRAINT cat_flip_ilk_pkey PRIMARY KEY (id); - - --- --- Name: cat_flip_ink cat_flip_ink_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_flip_ink - ADD CONSTRAINT cat_flip_ink_pkey PRIMARY KEY (id); - - --- --- Name: cat_flip_tab cat_flip_tab_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_flip_tab - ADD CONSTRAINT cat_flip_tab_pkey PRIMARY KEY (id); - - --- --- Name: cat_flip_urn cat_flip_urn_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_flip_urn - ADD CONSTRAINT cat_flip_urn_pkey PRIMARY KEY (id); - - --- --- Name: cat_ilk_chop cat_ilk_chop_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_ilk_chop - ADD CONSTRAINT cat_ilk_chop_pkey PRIMARY KEY (id); - - --- --- Name: cat_ilk_flip cat_ilk_flip_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_ilk_flip - ADD CONSTRAINT cat_ilk_flip_pkey PRIMARY KEY (id); - - --- --- Name: cat_ilk_lump cat_ilk_lump_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_ilk_lump - ADD CONSTRAINT cat_ilk_lump_pkey PRIMARY KEY (id); - - --- --- Name: cat_live cat_live_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_live - ADD CONSTRAINT cat_live_pkey PRIMARY KEY (id); - - --- --- Name: cat_nflip cat_nflip_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_nflip - ADD CONSTRAINT cat_nflip_pkey PRIMARY KEY (id); - - --- --- Name: cat_pit cat_pit_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_pit - ADD CONSTRAINT cat_pit_pkey PRIMARY KEY (id); - - --- --- Name: cat_vat cat_vat_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_vat - ADD CONSTRAINT cat_vat_pkey PRIMARY KEY (id); - - --- --- Name: cat_vow cat_vow_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_vow - ADD CONSTRAINT cat_vow_pkey PRIMARY KEY (id); - - --- --- Name: deal deal_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.deal - ADD CONSTRAINT deal_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: deal deal_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.deal - ADD CONSTRAINT deal_pkey PRIMARY KEY (id); - - --- --- Name: dent dent_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.dent - ADD CONSTRAINT dent_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: dent dent_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.dent - ADD CONSTRAINT dent_pkey PRIMARY KEY (id); - - --- --- Name: drip_drip drip_drip_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_drip - ADD CONSTRAINT drip_drip_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: drip_drip drip_drip_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_drip - ADD CONSTRAINT drip_drip_pkey PRIMARY KEY (id); - - --- --- Name: drip_file_ilk drip_file_ilk_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_ilk - ADD CONSTRAINT drip_file_ilk_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: drip_file_ilk drip_file_ilk_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_ilk - ADD CONSTRAINT drip_file_ilk_pkey PRIMARY KEY (id); - - --- --- Name: drip_file_repo drip_file_repo_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_repo - ADD CONSTRAINT drip_file_repo_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: drip_file_repo drip_file_repo_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_repo - ADD CONSTRAINT drip_file_repo_pkey PRIMARY KEY (id); - - --- --- Name: drip_file_vow drip_file_vow_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_vow - ADD CONSTRAINT drip_file_vow_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: drip_file_vow drip_file_vow_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_vow - ADD CONSTRAINT drip_file_vow_pkey PRIMARY KEY (id); - - --- --- Name: flap_kick flap_kick_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flap_kick - ADD CONSTRAINT flap_kick_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: flap_kick flap_kick_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flap_kick - ADD CONSTRAINT flap_kick_pkey PRIMARY KEY (id); - - --- --- Name: flip_kick flip_kick_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flip_kick - ADD CONSTRAINT flip_kick_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: flip_kick flip_kick_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flip_kick - ADD CONSTRAINT flip_kick_pkey PRIMARY KEY (id); - - --- --- Name: flop_kick flop_kick_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flop_kick - ADD CONSTRAINT flop_kick_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: flop_kick flop_kick_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flop_kick - ADD CONSTRAINT flop_kick_pkey PRIMARY KEY (id); - - --- --- Name: frob frob_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.frob - ADD CONSTRAINT frob_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: frob frob_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.frob - ADD CONSTRAINT frob_pkey PRIMARY KEY (id); - - --- --- Name: ilks ilks_ilk_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.ilks - ADD CONSTRAINT ilks_ilk_key UNIQUE (ilk); - - --- --- Name: ilks ilks_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.ilks - ADD CONSTRAINT ilks_pkey PRIMARY KEY (id); - - --- --- Name: pit_drip pit_drip_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_drip - ADD CONSTRAINT pit_drip_pkey PRIMARY KEY (id); - - --- --- Name: pit_file_debt_ceiling pit_file_debt_ceiling_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_file_debt_ceiling - ADD CONSTRAINT pit_file_debt_ceiling_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: pit_file_debt_ceiling pit_file_debt_ceiling_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_file_debt_ceiling - ADD CONSTRAINT pit_file_debt_ceiling_pkey PRIMARY KEY (id); - - --- --- Name: pit_file_ilk pit_file_ilk_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_file_ilk - ADD CONSTRAINT pit_file_ilk_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: pit_file_ilk pit_file_ilk_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_file_ilk - ADD CONSTRAINT pit_file_ilk_pkey PRIMARY KEY (id); - - --- --- Name: pit_ilk_line pit_ilk_line_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_ilk_line - ADD CONSTRAINT pit_ilk_line_pkey PRIMARY KEY (id); - - --- --- Name: pit_ilk_spot pit_ilk_spot_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_ilk_spot - ADD CONSTRAINT pit_ilk_spot_pkey PRIMARY KEY (id); - - --- --- Name: pit_line pit_line_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_line - ADD CONSTRAINT pit_line_pkey PRIMARY KEY (id); - - --- --- Name: pit_live pit_live_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_live - ADD CONSTRAINT pit_live_pkey PRIMARY KEY (id); - - --- --- Name: pit_vat pit_vat_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_vat - ADD CONSTRAINT pit_vat_pkey PRIMARY KEY (id); - - --- --- Name: price_feeds price_feeds_header_id_medianizer_address_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.price_feeds - ADD CONSTRAINT price_feeds_header_id_medianizer_address_tx_idx_log_idx_key UNIQUE (header_id, medianizer_address, tx_idx, log_idx); - - --- --- Name: price_feeds price_feeds_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.price_feeds - ADD CONSTRAINT price_feeds_pkey PRIMARY KEY (id); - - --- --- Name: tend tend_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.tend - ADD CONSTRAINT tend_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: tend tend_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.tend - ADD CONSTRAINT tend_pkey PRIMARY KEY (id); - - --- --- Name: vat_dai vat_dai_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_dai - ADD CONSTRAINT vat_dai_pkey PRIMARY KEY (id); - - --- --- Name: vat_debt vat_debt_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_debt - ADD CONSTRAINT vat_debt_pkey PRIMARY KEY (id); - - --- --- Name: vat_flux vat_flux_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_flux - ADD CONSTRAINT vat_flux_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vat_flux vat_flux_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_flux - ADD CONSTRAINT vat_flux_pkey PRIMARY KEY (id); - - --- --- Name: vat_fold vat_fold_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_fold - ADD CONSTRAINT vat_fold_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vat_fold vat_fold_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_fold - ADD CONSTRAINT vat_fold_pkey PRIMARY KEY (id); - - --- --- Name: vat_gem vat_gem_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_gem - ADD CONSTRAINT vat_gem_pkey PRIMARY KEY (id); - - --- --- Name: vat_grab vat_grab_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_grab - ADD CONSTRAINT vat_grab_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vat_grab vat_grab_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_grab - ADD CONSTRAINT vat_grab_pkey PRIMARY KEY (id); - - --- --- Name: vat_heal vat_heal_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_heal - ADD CONSTRAINT vat_heal_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vat_heal vat_heal_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_heal - ADD CONSTRAINT vat_heal_pkey PRIMARY KEY (id); - - --- --- Name: vat_ilk_art vat_ilk_art_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_art - ADD CONSTRAINT vat_ilk_art_pkey PRIMARY KEY (id); - - --- --- Name: vat_ilk_ink vat_ilk_ink_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_ink - ADD CONSTRAINT vat_ilk_ink_pkey PRIMARY KEY (id); - - --- --- Name: vat_ilk_rate vat_ilk_rate_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_rate - ADD CONSTRAINT vat_ilk_rate_pkey PRIMARY KEY (id); - - --- --- Name: vat_ilk_take vat_ilk_take_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_take - ADD CONSTRAINT vat_ilk_take_pkey PRIMARY KEY (id); - - --- --- Name: vat_init vat_init_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_init - ADD CONSTRAINT vat_init_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vat_init vat_init_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_init - ADD CONSTRAINT vat_init_pkey PRIMARY KEY (id); - - --- --- Name: vat_move vat_move_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_move - ADD CONSTRAINT vat_move_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vat_move vat_move_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_move - ADD CONSTRAINT vat_move_pkey PRIMARY KEY (id); - - --- --- Name: vat_sin vat_sin_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_sin - ADD CONSTRAINT vat_sin_pkey PRIMARY KEY (id); - - --- --- Name: vat_slip vat_slip_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_slip - ADD CONSTRAINT vat_slip_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vat_slip vat_slip_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_slip - ADD CONSTRAINT vat_slip_pkey PRIMARY KEY (id); - - --- --- Name: vat_toll vat_toll_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_toll - ADD CONSTRAINT vat_toll_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vat_toll vat_toll_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_toll - ADD CONSTRAINT vat_toll_pkey PRIMARY KEY (id); - - --- --- Name: vat_tune vat_tune_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_tune - ADD CONSTRAINT vat_tune_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vat_tune vat_tune_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_tune - ADD CONSTRAINT vat_tune_pkey PRIMARY KEY (id); - - --- --- Name: vat_urn_art vat_urn_art_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_urn_art - ADD CONSTRAINT vat_urn_art_pkey PRIMARY KEY (id); - - --- --- Name: vat_urn_ink vat_urn_ink_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_urn_ink - ADD CONSTRAINT vat_urn_ink_pkey PRIMARY KEY (id); - - --- --- Name: vat_vice vat_vice_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_vice - ADD CONSTRAINT vat_vice_pkey PRIMARY KEY (id); - - --- --- Name: vow_ash vow_ash_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_ash - ADD CONSTRAINT vow_ash_pkey PRIMARY KEY (id); - - --- --- Name: vow_bump vow_bump_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_bump - ADD CONSTRAINT vow_bump_pkey PRIMARY KEY (id); - - --- --- Name: vow_cow vow_cow_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_cow - ADD CONSTRAINT vow_cow_pkey PRIMARY KEY (id); - - --- --- Name: vow_flog vow_flog_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_flog - ADD CONSTRAINT vow_flog_header_id_tx_idx_log_idx_key UNIQUE (header_id, tx_idx, log_idx); - - --- --- Name: vow_flog vow_flog_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_flog - ADD CONSTRAINT vow_flog_pkey PRIMARY KEY (id); - - --- --- Name: vow_hump vow_hump_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_hump - ADD CONSTRAINT vow_hump_pkey PRIMARY KEY (id); - - --- --- Name: vow_row vow_row_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_row - ADD CONSTRAINT vow_row_pkey PRIMARY KEY (id); - - --- --- Name: vow_sin vow_sin_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_sin - ADD CONSTRAINT vow_sin_pkey PRIMARY KEY (id); - - --- --- Name: vow_sump vow_sump_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_sump - ADD CONSTRAINT vow_sump_pkey PRIMARY KEY (id); - - --- --- Name: vow_vat vow_vat_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_vat - ADD CONSTRAINT vow_vat_pkey PRIMARY KEY (id); - - --- --- Name: vow_wait vow_wait_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_wait - ADD CONSTRAINT vow_wait_pkey PRIMARY KEY (id); - - --- --- Name: vow_woe vow_woe_pkey; Type: CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_woe - ADD CONSTRAINT vow_woe_pkey PRIMARY KEY (id); - - -- -- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -4358,445 +731,6 @@ CREATE INDEX tx_from_index ON public.transactions USING btree (tx_from); CREATE INDEX tx_to_index ON public.transactions USING btree (tx_to); --- --- Name: price_feeds notify_pricefeeds; Type: TRIGGER; Schema: maker; Owner: - --- - -CREATE TRIGGER notify_pricefeeds AFTER INSERT ON maker.price_feeds FOR EACH ROW EXECUTE PROCEDURE public.notify_pricefeed(); - - --- --- Name: bite bite_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.bite - ADD CONSTRAINT bite_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: bite bite_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.bite - ADD CONSTRAINT bite_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: cat_file_chop_lump cat_file_chop_lump_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_chop_lump - ADD CONSTRAINT cat_file_chop_lump_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: cat_file_chop_lump cat_file_chop_lump_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_chop_lump - ADD CONSTRAINT cat_file_chop_lump_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: cat_file_flip cat_file_flip_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_flip - ADD CONSTRAINT cat_file_flip_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: cat_file_pit_vow cat_file_pit_vow_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_file_pit_vow - ADD CONSTRAINT cat_file_pit_vow_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: cat_flip_ilk cat_flip_ilk_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_flip_ilk - ADD CONSTRAINT cat_flip_ilk_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: cat_ilk_chop cat_ilk_chop_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_ilk_chop - ADD CONSTRAINT cat_ilk_chop_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: cat_ilk_flip cat_ilk_flip_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_ilk_flip - ADD CONSTRAINT cat_ilk_flip_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: cat_ilk_lump cat_ilk_lump_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.cat_ilk_lump - ADD CONSTRAINT cat_ilk_lump_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: deal deal_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.deal - ADD CONSTRAINT deal_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: dent dent_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.dent - ADD CONSTRAINT dent_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: drip_drip drip_drip_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_drip - ADD CONSTRAINT drip_drip_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: drip_drip drip_drip_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_drip - ADD CONSTRAINT drip_drip_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: drip_file_ilk drip_file_ilk_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_ilk - ADD CONSTRAINT drip_file_ilk_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: drip_file_ilk drip_file_ilk_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_ilk - ADD CONSTRAINT drip_file_ilk_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: drip_file_repo drip_file_repo_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_repo - ADD CONSTRAINT drip_file_repo_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: drip_file_vow drip_file_vow_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.drip_file_vow - ADD CONSTRAINT drip_file_vow_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: flap_kick flap_kick_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flap_kick - ADD CONSTRAINT flap_kick_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: flip_kick flip_kick_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flip_kick - ADD CONSTRAINT flip_kick_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: flop_kick flop_kick_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.flop_kick - ADD CONSTRAINT flop_kick_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: frob frob_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.frob - ADD CONSTRAINT frob_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: frob frob_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.frob - ADD CONSTRAINT frob_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: pit_file_debt_ceiling pit_file_debt_ceiling_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_file_debt_ceiling - ADD CONSTRAINT pit_file_debt_ceiling_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: pit_file_ilk pit_file_ilk_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_file_ilk - ADD CONSTRAINT pit_file_ilk_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: pit_file_ilk pit_file_ilk_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_file_ilk - ADD CONSTRAINT pit_file_ilk_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: pit_ilk_line pit_ilk_line_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_ilk_line - ADD CONSTRAINT pit_ilk_line_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: pit_ilk_spot pit_ilk_spot_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.pit_ilk_spot - ADD CONSTRAINT pit_ilk_spot_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: price_feeds price_feeds_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.price_feeds - ADD CONSTRAINT price_feeds_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: tend tend_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.tend - ADD CONSTRAINT tend_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_flux vat_flux_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_flux - ADD CONSTRAINT vat_flux_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_flux vat_flux_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_flux - ADD CONSTRAINT vat_flux_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_fold vat_fold_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_fold - ADD CONSTRAINT vat_fold_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_fold vat_fold_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_fold - ADD CONSTRAINT vat_fold_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_gem vat_gem_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_gem - ADD CONSTRAINT vat_gem_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_grab vat_grab_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_grab - ADD CONSTRAINT vat_grab_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_grab vat_grab_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_grab - ADD CONSTRAINT vat_grab_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_heal vat_heal_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_heal - ADD CONSTRAINT vat_heal_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_ilk_art vat_ilk_art_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_art - ADD CONSTRAINT vat_ilk_art_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_ilk_ink vat_ilk_ink_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_ink - ADD CONSTRAINT vat_ilk_ink_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_ilk_rate vat_ilk_rate_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_rate - ADD CONSTRAINT vat_ilk_rate_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_ilk_take vat_ilk_take_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_ilk_take - ADD CONSTRAINT vat_ilk_take_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_init vat_init_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_init - ADD CONSTRAINT vat_init_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_init vat_init_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_init - ADD CONSTRAINT vat_init_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_move vat_move_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_move - ADD CONSTRAINT vat_move_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_slip vat_slip_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_slip - ADD CONSTRAINT vat_slip_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_slip vat_slip_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_slip - ADD CONSTRAINT vat_slip_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_toll vat_toll_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_toll - ADD CONSTRAINT vat_toll_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_toll vat_toll_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_toll - ADD CONSTRAINT vat_toll_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_tune vat_tune_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_tune - ADD CONSTRAINT vat_tune_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - --- --- Name: vat_tune vat_tune_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_tune - ADD CONSTRAINT vat_tune_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_urn_art vat_urn_art_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_urn_art - ADD CONSTRAINT vat_urn_art_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vat_urn_ink vat_urn_ink_ilk_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vat_urn_ink - ADD CONSTRAINT vat_urn_ink_ilk_fkey FOREIGN KEY (ilk) REFERENCES maker.ilks(id); - - --- --- Name: vow_flog vow_flog_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: - --- - -ALTER TABLE ONLY maker.vow_flog - ADD CONSTRAINT vow_flog_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE; - - -- -- Name: transactions blocks_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- diff --git a/environments/infura.toml b/environments/infura.toml index e906e85d..095e747d 100644 --- a/environments/infura.toml +++ b/environments/infura.toml @@ -4,15 +4,4 @@ hostname = "localhost" port = 5432 [client] -ipcPath = "https://mainnet.infura.io/J5Vd2fRtGsw0zZ0Ov3BL" - -[contract] -cat = "0x2f34f22a00ee4b7a8f8bbc4eaee1658774c624e0" -drip = "0x891c04639a5edcae088e546fa125b5d7fb6a2b9d" -eth_flip = "0x32D496Ad866D110060866B7125981C73642cc509" -mcd_flop = "0x6191C9b0086c2eBF92300cC507009b53996FbFFa" -pep = "0xB1997239Cfc3d15578A3a09730f7f84A90BB4975" -pip = "0x9FfFE440258B79c5d6604001674A4722FfC0f7Bc" -pit = "0xe7cf3198787c9a4daac73371a38f29aaeeced87e" -rep = "0xf88bbdc1e2718f8857f30a180076ec38d53cf296" -vat = "0xcd726790550afcd77e9a7a47e86a3f9010af126b" \ No newline at end of file +ipcPath = "https://mainnet.infura.io/J5Vd2fRtGsw0zZ0Ov3BL" \ No newline at end of file diff --git a/environments/private.toml b/environments/private.toml index 4681518b..30382733 100644 --- a/environments/private.toml +++ b/environments/private.toml @@ -4,16 +4,4 @@ hostname = "localhost" port = 5432 [client] -ipcPath = "http://127.0.0.1:7545" - -[contract] -cat = "0x2f34f22a00ee4b7a8f8bbc4eaee1658774c624e0" -drip = "0x891c04639a5edcae088e546fa125b5d7fb6a2b9d" -eth_flip = "0x32D496Ad866D110060866B7125981C73642cc509" -mcd_flop = "0x6191C9b0086c2eBF92300cC507009b53996FbFFa" -pep = "0xB1997239Cfc3d15578A3a09730f7f84A90BB4975" -pip = "0x9FfFE440258B79c5d6604001674A4722FfC0f7Bc" -pit = "0xe7cf3198787c9a4daac73371a38f29aaeeced87e" -rep = "0xf88bbdc1e2718f8857f30a180076ec38d53cf296" -vat = "0xcd726790550afcd77e9a7a47e86a3f9010af126b" -vow = "0x76189df410263ad1d9fe2f4af2eab3d24f1b6f41" +ipcPath = "http://127.0.0.1:7545" \ No newline at end of file diff --git a/environments/prod.toml b/environments/prod.toml deleted file mode 100644 index bbcbb11b..00000000 --- a/environments/prod.toml +++ /dev/null @@ -1,23 +0,0 @@ -[database] -name = "vulcanize_public" -hostname = "localhost" -user = "vulcanize" -password = "vulcanize" -port = 5432 - -[client] -ipcPath = "https://kovan.infura.io/J5Vd2fRtGsw0zZ0Ov3BL" - -[datadog] -name = "maker_vdb_prod" - -[contract] -cat = "0x2f34f22a00ee4b7a8f8bbc4eaee1658774c624e0" -drip = "0x891c04639a5edcae088e546fa125b5d7fb6a2b9d" -eth_flip = "0x32D496Ad866D110060866B7125981C73642cc509" -mcd_flop = "0x6191C9b0086c2eBF92300cC507009b53996FbFFa" -pep = "0xB1997239Cfc3d15578A3a09730f7f84A90BB4975" -pip = "0x9FfFE440258B79c5d6604001674A4722FfC0f7Bc" -pit = "0xe7cf3198787c9a4daac73371a38f29aaeeced87e" -rep = "0xf88bbdc1e2718f8857f30a180076ec38d53cf296" -vat = "0xcd726790550afcd77e9a7a47e86a3f9010af126b" \ No newline at end of file diff --git a/environments/public.toml.example b/environments/public.toml.example index dc294923..1e748bfb 100644 --- a/environments/public.toml.example +++ b/environments/public.toml.example @@ -5,16 +5,4 @@ port = 5432 [client] ipcPath = -levelDbPath = - -[contract] -cat = "0x2f34f22a00ee4b7a8f8bbc4eaee1658774c624e0" -drip = "0x891c04639a5edcae088e546fa125b5d7fb6a2b9d" -eth_flip = "0x32D496Ad866D110060866B7125981C73642cc509" -mcd_flap = "0x8868BAd8e74FcA4505676D1B5B21EcC23328d132" -mcd_flop = "0x6191C9b0086c2eBF92300cC507009b53996FbFFa" -pep = "0xB1997239Cfc3d15578A3a09730f7f84A90BB4975" -pip = "0x9FfFE440258B79c5d6604001674A4722FfC0f7Bc" -pit = "0xe7cf3198787c9a4daac73371a38f29aaeeced87e" -rep = "0xf88bBDc1E2718F8857F30A180076ec38d53cf296" -vat = "0xcd726790550afcd77e9a7a47e86a3f9010af126b" \ No newline at end of file +levelDbPath = \ No newline at end of file diff --git a/environments/staging.toml b/environments/staging.toml deleted file mode 100644 index 8954a483..00000000 --- a/environments/staging.toml +++ /dev/null @@ -1,52 +0,0 @@ -[database] - name = "vulcanize_public" - hostname = "localhost" - user = "vulcanize" - password = "vulcanize" - port = 5432 - -[client] - ipcPath = "http://kovan0.vulcanize.io:8545" - -[datadog] - name = "maker_vdb_staging" - -[filesystem] - storageDiffsPath = "INSERT-PATH-TO-STORAGE-DIFFS" - -[contract] - [contract.address] - cat = "0x2f34f22a00ee4b7a8f8bbc4eaee1658774c624e0" - drip = "0x891c04639a5edcae088e546fa125b5d7fb6a2b9d" - eth_flip = "0x32D496Ad866D110060866B7125981C73642cc509" - mcd_flap = "0x8868BAd8e74FcA4505676D1B5B21EcC23328d132" - mcd_flop = "0x6191C9b0086c2eBF92300cC507009b53996FbFFa" - pep = "0xB1997239Cfc3d15578A3a09730f7f84A90BB4975" - pip = "0x9FfFE440258B79c5d6604001674A4722FfC0f7Bc" - pit = "0xe7cf3198787c9a4daac73371a38f29aaeeced87e" - rep = "0xf88bbdc1e2718f8857f30a180076ec38d53cf296" - vat = "0xcd726790550afcd77e9a7a47e86a3f9010af126b" - vow = "0x3728e9777B2a0a611ee0F89e00E01044ce4736d1" - [contract.abi] - cat = '[{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x36569e77"},{"constant":true,"inputs":[],"name":"vow","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x626cb3c5"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"flips","outputs":[{"name":"ilk","type":"bytes32"},{"name":"urn","type":"bytes32"},{"name":"ink","type":"uint256"},{"name":"tab","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x70d9235a"},{"constant":true,"inputs":[],"name":"nflip","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x76181a51"},{"constant":true,"inputs":[],"name":"live","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x957aa58c"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"flip","type":"address"},{"name":"chop","type":"uint256"},{"name":"lump","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"constant":true,"inputs":[],"name":"pit","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xf03c7c6e"},{"inputs":[{"name":"vat_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"ilk","type":"bytes32"},{"indexed":true,"name":"urn","type":"bytes32"},{"indexed":false,"name":"ink","type":"uint256"},{"indexed":false,"name":"art","type":"uint256"},{"indexed":false,"name":"tab","type":"uint256"},{"indexed":false,"name":"flip","type":"uint256"},{"indexed":false,"name":"iArt","type":"uint256"}],"name":"Bite","type":"event","signature":"0x99b5620489b6ef926d4518936cfec15d305452712b88bd59da2d9c10fb0953e8"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event","signature":"0x644843f351d3fba4abcd60109eaff9f54bac8fb8ccf0bab941009c21df21cf31"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x1a0b287e"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"address"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xd4e8be83"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"what","type":"bytes32"},{"name":"flip","type":"address"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xebecb39d"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"urn","type":"bytes32"}],"name":"bite","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x72f7b593"},{"constant":false,"inputs":[{"name":"n","type":"uint256"},{"name":"wad","type":"uint256"}],"name":"flip","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xe6f95917"}]' - drip = '[{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x36569e77"},{"constant":true,"inputs":[],"name":"repo","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x56ff3122"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"vow","type":"bytes32"},{"name":"tax","type":"uint256"},{"name":"rho","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"inputs":[{"name":"vat_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event","signature":"0x644843f351d3fba4abcd60109eaff9f54bac8fb8ccf0bab941009c21df21cf31"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":true,"inputs":[],"name":"era","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x143e55e0"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"vow","type":"bytes32"},{"name":"tax","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x1a0b287e"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x29ae8114"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"}],"name":"drip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x44e2a5a8"}]' - mcd_flap = '[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"bids","outputs":[{"name":"bid","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"guy","type":"address"},{"name":"tic","type":"uint48"},{"name":"end","type":"uint48"},{"name":"gal","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ttl","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gem","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"beg","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tau","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kicks","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dai","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"dai_","type":"address"},{"name":"gem_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"lot","type":"uint256"},{"indexed":false,"name":"bid","type":"uint256"},{"indexed":false,"name":"gal","type":"address"},{"indexed":false,"name":"end","type":"uint48"}],"name":"Kick","type":"event"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"},{"constant":false,"inputs":[{"name":"gal","type":"address"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"kick","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"tend","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"deal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]' - eth_flip = '[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"bids","outputs":[{"name":"bid","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"guy","type":"address"},{"name":"tic","type":"uint48"},{"name":"end","type":"uint48"},{"name":"urn","type":"bytes32"},{"name":"gal","type":"address"},{"name":"tab","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x4423c5f1"},{"constant":true,"inputs":[],"name":"ttl","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x4e8b1dd5"},{"constant":true,"inputs":[],"name":"gem","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x7bd2bea7"},{"constant":true,"inputs":[],"name":"beg","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x7d780d82"},{"constant":true,"inputs":[],"name":"tau","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xcfc4af55"},{"constant":true,"inputs":[],"name":"kicks","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xcfdd3302"},{"constant":true,"inputs":[],"name":"dai","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xf4b9fa75"},{"inputs":[{"name":"dai_","type":"address"},{"name":"gem_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"lot","type":"uint256"},{"indexed":false,"name":"bid","type":"uint256"},{"indexed":false,"name":"gal","type":"address"},{"indexed":false,"name":"end","type":"uint48"},{"indexed":true,"name":"urn","type":"bytes32"},{"indexed":false,"name":"tab","type":"uint256"}],"name":"Kick","type":"event","signature":"0xbac86238bdba81d21995024470425ecb370078fa62b7271b90cf28cbd1e3e87e"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event","signature":"0x644843f351d3fba4abcd60109eaff9f54bac8fb8ccf0bab941009c21df21cf31"},{"constant":true,"inputs":[],"name":"era","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x143e55e0"},{"constant":false,"inputs":[{"name":"urn","type":"bytes32"},{"name":"gal","type":"address"},{"name":"tab","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"kick","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xeae19d9e"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"tick","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xfc7b6aee"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"tend","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x4b43ed12"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"dent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5ff3a382"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"deal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xc959c42b"}]' - mcd_flop = '[{"constant":true,"inputs":[],"name":"era","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"bids","outputs":[{"name":"bid","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"guy","type":"address"},{"name":"tic","type":"uint48"},{"name":"end","type":"uint48"},{"name":"vow","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ttl","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"dent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gem","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"beg","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"gal","type":"address"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"kick","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"deal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tau","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kicks","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dai","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"dai_","type":"address"},{"name":"gem_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"lot","type":"uint256"},{"indexed":false,"name":"bid","type":"uint256"},{"indexed":false,"name":"gal","type":"address"},{"indexed":false,"name":"end","type":"uint48"}],"name":"Kick","type":"event"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"}]' - medianizer = '[{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"","type":"bytes32"}],"name":"poke","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"poke","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"compute","outputs":[{"name":"","type":"bytes32"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"wat","type":"address"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"wat","type":"address"}],"name":"unset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"indexes","outputs":[{"name":"","type":"bytes12"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"next","outputs":[{"name":"","type":"bytes12"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"read","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"peek","outputs":[{"name":"","type":"bytes32"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes12"}],"name":"values","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"min_","type":"uint96"}],"name":"setMin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"void","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"pos","type":"bytes12"},{"name":"wat","type":"address"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"pos","type":"bytes12"}],"name":"unset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"next_","type":"bytes12"}],"name":"setNext","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"min","outputs":[{"name":"","type":"uint96"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"val","type":"bytes32"}],"name":"LogValue","type":"event"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}]]' - # TODO: replace with updated ABI when contract is deployed (with no pit file stability fee method + modified Frob event) - pit = '[{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x36569e77"},{"constant":true,"inputs":[],"name":"live","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x957aa58c"},{"constant":true,"inputs":[],"name":"drip","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x9f678cca"},{"constant":true,"inputs":[],"name":"Line","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbabe8a3f"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"spot","type":"uint256"},{"name":"line","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"inputs":[{"name":"vat_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"ilk","type":"bytes32"},{"indexed":true,"name":"urn","type":"bytes32"},{"indexed":false,"name":"ink","type":"uint256"},{"indexed":false,"name":"art","type":"uint256"},{"indexed":false,"name":"dink","type":"int256"},{"indexed":false,"name":"dart","type":"int256"},{"indexed":false,"name":"iArt","type":"uint256"}],"name":"Frob","type":"event","signature":"0xb2afa28318bcc689926b52835d844de174ef8de97e982a85c0199d584920791b"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event","signature":"0x644843f351d3fba4abcd60109eaff9f54bac8fb8ccf0bab941009c21df21cf31"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x1a0b287e"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x29ae8114"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"address"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xd4e8be83"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"dink","type":"int256"},{"name":"dart","type":"int256"}],"name":"frob","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5a984ded"}]' - vat = '[{"constant":true,"inputs":[],"name":"debt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x0dca59c1"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"bytes32"}],"name":"urns","outputs":[{"name":"ink","type":"uint256"},{"name":"art","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x26e27482"},{"constant":true,"inputs":[],"name":"vice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x2d61a355"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"sin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xa60f1d3e"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"bytes32"}],"name":"gem","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xc0912683"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"take","type":"uint256"},{"name":"rate","type":"uint256"},{"name":"Ink","type":"uint256"},{"name":"Art","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"dai","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xf53e4e69"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":true,"name":"too","type":"bytes32"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"Note","type":"event","signature":"0x8c2dbbc2b33ffaa77c104b777e574a8a4ff79829dfee8b66f4dc63e3f8067152"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"}],"name":"init","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x3b663195"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"guy","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"slip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x42066cbb"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"src","type":"bytes32"},{"name":"dst","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"flux","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xa6e41821"},{"constant":false,"inputs":[{"name":"src","type":"bytes32"},{"name":"dst","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"move","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x78f19470"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"v","type":"bytes32"},{"name":"w","type":"bytes32"},{"name":"dink","type":"int256"},{"name":"dart","type":"int256"}],"name":"tune","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5dd6471a"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"v","type":"bytes32"},{"name":"w","type":"bytes32"},{"name":"dink","type":"int256"},{"name":"dart","type":"int256"}],"name":"grab","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x3690ae4c"},{"constant":false,"inputs":[{"name":"u","type":"bytes32"},{"name":"v","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"heal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x990a5f63"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"rate","type":"int256"}],"name":"fold","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xe6a6a64d"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"take","type":"int256"}],"name":"toll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x09b7a0b5"}]' - vow = '[{"constant":true,"inputs":[],"name":"Awe","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"Joy","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"flap","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"hump","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"wad","type":"uint256"}],"name":"kiss","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"Ash","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"era","type":"uint48"}],"name":"flog","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"Woe","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"wait","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"bump","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tab","type":"uint256"}],"name":"fess","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"row","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint48"}],"name":"sin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"flop","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"sump","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"Sin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"addr","type":"address"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"cow","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"wad","type":"uint256"}],"name":"heal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"}]' - [contract.deployment-block] - cat = 8751794 - drip = 8762197 - eth_flip = 8535561 - mcd_flap = 8535544 - mcd_flop = 8535545 - pep = 8760655 - pip = 8760588 - pit = 8535538 - rep = 8760681 - vat = 8535536 - vow = 8751792 diff --git a/pkg/transformers/cat_file/flip/flip_suite_test.go b/libraries/shared/chunker/chunker_suite_test.go similarity index 90% rename from pkg/transformers/cat_file/flip/flip_suite_test.go rename to libraries/shared/chunker/chunker_suite_test.go index 83a58761..f28d59d6 100644 --- a/pkg/transformers/cat_file/flip/flip_suite_test.go +++ b/libraries/shared/chunker/chunker_suite_test.go @@ -14,20 +14,20 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package flip_test +package chunker_test import ( - log "github.com/sirupsen/logrus" - "io/ioutil" "testing" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" + "io/ioutil" ) -func TestFlip(t *testing.T) { +func TestFactories(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "Flip Suite") + RunSpecs(t, "Shared Chunker Suite") } var _ = BeforeSuite(func() { diff --git a/pkg/transformers/shared/log_chunker.go b/libraries/shared/chunker/log_chunker.go similarity index 90% rename from pkg/transformers/shared/log_chunker.go rename to libraries/shared/chunker/log_chunker.go index 183bb7d3..a8bbe089 100644 --- a/pkg/transformers/shared/log_chunker.go +++ b/libraries/shared/chunker/log_chunker.go @@ -14,16 +14,19 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared +package chunker import ( + "strings" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "strings" + + shared_t "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" ) type Chunker interface { - AddConfigs(transformerConfigs []TransformerConfig) + AddConfigs(transformerConfigs []shared_t.TransformerConfig) ChunkLogs(logs []types.Log) map[string][]types.Log } @@ -42,7 +45,7 @@ func NewLogChunker() *LogChunker { } // Configures the chunker by adding more addreses and topics to consider. -func (chunker *LogChunker) AddConfigs(transformerConfigs []TransformerConfig) { +func (chunker *LogChunker) AddConfigs(transformerConfigs []shared_t.TransformerConfig) { for _, config := range transformerConfigs { for _, address := range config.ContractAddresses { var lowerCaseAddress = strings.ToLower(address) diff --git a/pkg/transformers/shared/log_chunker_test.go b/libraries/shared/chunker/log_chunker_test.go similarity index 86% rename from pkg/transformers/shared/log_chunker_test.go rename to libraries/shared/chunker/log_chunker_test.go index cc75d7aa..9a724485 100644 --- a/pkg/transformers/shared/log_chunker_test.go +++ b/libraries/shared/chunker/log_chunker_test.go @@ -14,42 +14,44 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared_test +package chunker_test import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" + + chunk "github.com/vulcanize/vulcanizedb/libraries/shared/chunker" + shared_t "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" ) var _ = Describe("Log chunker", func() { var ( - configs []shared.TransformerConfig - chunker *shared.LogChunker + configs []shared_t.TransformerConfig + chunker *chunk.LogChunker ) BeforeEach(func() { - configA := shared.TransformerConfig{ + configA := shared_t.TransformerConfig{ TransformerName: "TransformerA", ContractAddresses: []string{"0x00000000000000000000000000000000000000A1", "0x00000000000000000000000000000000000000A2"}, Topic: "0xA", } - configB := shared.TransformerConfig{ + configB := shared_t.TransformerConfig{ TransformerName: "TransformerB", ContractAddresses: []string{"0x00000000000000000000000000000000000000B1"}, Topic: "0xB", } - configC := shared.TransformerConfig{ + configC := shared_t.TransformerConfig{ TransformerName: "TransformerC", ContractAddresses: []string{"0x00000000000000000000000000000000000000A2"}, Topic: "0xC", } - configs = []shared.TransformerConfig{configA, configB, configC} - chunker = shared.NewLogChunker() + configs = []shared_t.TransformerConfig{configA, configB, configC} + chunker = chunk.NewLogChunker() chunker.AddConfigs(configs) }) @@ -71,24 +73,24 @@ var _ = Describe("Log chunker", func() { Describe("AddConfigs", func() { It("can add more configs later", func() { - configD := shared.TransformerConfig{ + configD := shared_t.TransformerConfig{ TransformerName: "TransformerD", ContractAddresses: []string{"0x000000000000000000000000000000000000000D"}, Topic: "0xD", } - chunker.AddConfigs([]shared.TransformerConfig{configD}) + chunker.AddConfigs([]shared_t.TransformerConfig{configD}) Expect(chunker.AddressToNames).To(ContainElement([]string{"TransformerD"})) Expect(chunker.NameToTopic0).To(ContainElement(common.HexToHash("0xD"))) }) It("lower cases address", func() { - configD := shared.TransformerConfig{ + configD := shared_t.TransformerConfig{ TransformerName: "TransformerD", ContractAddresses: []string{"0x000000000000000000000000000000000000000D"}, Topic: "0xD", } - chunker.AddConfigs([]shared.TransformerConfig{configD}) + chunker.AddConfigs([]shared_t.TransformerConfig{configD}) Expect(chunker.AddressToNames["0x000000000000000000000000000000000000000d"]).To(Equal([]string{"TransformerD"})) }) diff --git a/pkg/transformers/price_feeds/constants.go b/libraries/shared/constants/checked_headers.go similarity index 78% rename from pkg/transformers/price_feeds/constants.go rename to libraries/shared/constants/checked_headers.go index 88df5115..2e02d3f9 100644 --- a/pkg/transformers/price_feeds/constants.go +++ b/libraries/shared/constants/checked_headers.go @@ -14,15 +14,12 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package price_feeds +package constants -import ( - "errors" - "math/big" -) +type TransformerExecution bool -var ( - ErrNoMatchingLog = errors.New("no matching log") - Ether = big.NewFloat(1e18) - Ray = big.NewFloat(1e27) +const ( + HeaderRecheck TransformerExecution = true + HeaderMissing TransformerExecution = false + RecheckHeaderCap = "4" ) diff --git a/pkg/transformers/test_data/wrong_types.go b/libraries/shared/constants/data.go similarity index 80% rename from pkg/transformers/test_data/wrong_types.go rename to libraries/shared/constants/data.go index 30aa69e1..e55ae76c 100644 --- a/pkg/transformers/test_data/wrong_types.go +++ b/libraries/shared/constants/data.go @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package test_data +package constants -type WrongEntity struct{} -type WrongModel struct{} +var DataItemLength = 32 + +// TODO Grab this from DB, since it can change through governance +var TTL = int64(10800) // 60 * 60 * 3 == 10800 seconds == 3 hours diff --git a/pkg/transformers/factories/converter.go b/libraries/shared/factories/converter.go similarity index 100% rename from pkg/transformers/factories/converter.go rename to libraries/shared/factories/converter.go diff --git a/pkg/transformers/cat_file/chop_lump/chop_lump_suite_test.go b/libraries/shared/factories/factories_suite_test.go similarity index 91% rename from pkg/transformers/cat_file/chop_lump/chop_lump_suite_test.go rename to libraries/shared/factories/factories_suite_test.go index 8bd2695d..497c53d3 100644 --- a/pkg/transformers/cat_file/chop_lump/chop_lump_suite_test.go +++ b/libraries/shared/factories/factories_suite_test.go @@ -14,20 +14,20 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package chop_lump_test +package factories_test import ( - log "github.com/sirupsen/logrus" - "io/ioutil" "testing" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" + "io/ioutil" ) -func TestChopLump(t *testing.T) { +func TestFactories(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "ChopLump Suite") + RunSpecs(t, "Factories Suite") } var _ = BeforeSuite(func() { diff --git a/pkg/transformers/factories/log_note_converter.go b/libraries/shared/factories/log_note_converter.go similarity index 100% rename from pkg/transformers/factories/log_note_converter.go rename to libraries/shared/factories/log_note_converter.go diff --git a/pkg/transformers/factories/log_note_transformer.go b/libraries/shared/factories/log_note_transformer.go similarity index 62% rename from pkg/transformers/factories/log_note_transformer.go rename to libraries/shared/factories/log_note_transformer.go index c22c5a42..7a96cfee 100644 --- a/pkg/transformers/factories/log_note_transformer.go +++ b/libraries/shared/factories/log_note_transformer.go @@ -20,29 +20,29 @@ import ( "github.com/ethereum/go-ethereum/core/types" log "github.com/sirupsen/logrus" + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" ) type LogNoteTransformer struct { - Config shared.TransformerConfig + Config transformer.TransformerConfig Converter LogNoteConverter Repository Repository } -func (transformer LogNoteTransformer) NewLogNoteTransformer(db *postgres.DB) shared.Transformer { - transformer.Repository.SetDB(db) - return transformer +func (tr LogNoteTransformer) NewLogNoteTransformer(db *postgres.DB) transformer.EventTransformer { + tr.Repository.SetDB(db) + return tr } -func (transformer LogNoteTransformer) Execute(logs []types.Log, header core.Header, recheckedHeader constants.TransformerExecution) error { - transformerName := transformer.Config.TransformerName +func (tr LogNoteTransformer) Execute(logs []types.Log, header core.Header, recheckedHeader constants.TransformerExecution) error { + transformerName := tr.Config.TransformerName // No matching logs, mark the header as checked for this type of logs if len(logs) < 1 { - err := transformer.Repository.MarkHeaderChecked(header.Id) + err := tr.Repository.MarkHeaderChecked(header.Id) if err != nil { log.Printf("Error marking header as checked in %v: %v", transformerName, err) return err @@ -50,13 +50,13 @@ func (transformer LogNoteTransformer) Execute(logs []types.Log, header core.Head return nil } - models, err := transformer.Converter.ToModels(logs) + models, err := tr.Converter.ToModels(logs) if err != nil { log.Printf("Error converting logs in %v: %v", transformerName, err) return err } - err = transformer.Repository.Create(header.Id, models) + err = tr.Repository.Create(header.Id, models) if err != nil { log.Printf("Error persisting %v record: %v", transformerName, err) return err @@ -64,10 +64,10 @@ func (transformer LogNoteTransformer) Execute(logs []types.Log, header core.Head return nil } -func (transformer LogNoteTransformer) GetName() string { - return transformer.Config.TransformerName +func (tr LogNoteTransformer) GetName() string { + return tr.Config.TransformerName } -func (transformer LogNoteTransformer) GetConfig() shared.TransformerConfig { - return transformer.Config +func (tr LogNoteTransformer) GetConfig() transformer.TransformerConfig { + return tr.Config } diff --git a/pkg/transformers/factories/log_note_transformer_test.go b/libraries/shared/factories/log_note_transformer_test.go similarity index 70% rename from pkg/transformers/factories/log_note_transformer_test.go rename to libraries/shared/factories/log_note_transformer_test.go index 851472f8..6d8ea569 100644 --- a/pkg/transformers/factories/log_note_transformer_test.go +++ b/libraries/shared/factories/log_note_transformer_test.go @@ -17,34 +17,36 @@ package factories_test import ( + "math/rand" + "github.com/ethereum/go-ethereum/core/types" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" + "github.com/vulcanize/vulcanizedb/libraries/shared/factories" + "github.com/vulcanize/vulcanizedb/libraries/shared/mocks" + "github.com/vulcanize/vulcanizedb/libraries/shared/test_data" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks" - "math/rand" ) var _ = Describe("LogNoteTransformer", func() { var ( - repository mocks.MockRepository - converter mocks.MockLogNoteConverter - headerOne core.Header - transformer shared.Transformer - model test_data.GenericModel - config = test_data.GenericTestConfig - logs = test_data.GenericTestLogs + repository mocks.MockRepository + converter mocks.MockLogNoteConverter + headerOne core.Header + t transformer.EventTransformer + model test_data.GenericModel + config = test_data.GenericTestConfig + logs = test_data.GenericTestLogs ) BeforeEach(func() { repository = mocks.MockRepository{} converter = mocks.MockLogNoteConverter{} - transformer = factories.LogNoteTransformer{ + t = factories.LogNoteTransformer{ Config: config, Converter: &converter, Repository: &repository, @@ -58,14 +60,14 @@ var _ = Describe("LogNoteTransformer", func() { }) It("marks header checked if no logs are provided", func() { - err := transformer.Execute([]types.Log{}, headerOne, constants.HeaderMissing) + err := t.Execute([]types.Log{}, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) repository.AssertMarkHeaderCheckedCalledWith(headerOne.Id) }) It("doesn't attempt to convert or persist an empty collection when there are no logs", func() { - err := transformer.Execute([]types.Log{}, headerOne, constants.HeaderMissing) + err := t.Execute([]types.Log{}, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) Expect(converter.ToModelsCalledCounter).To(Equal(0)) @@ -73,7 +75,7 @@ var _ = Describe("LogNoteTransformer", func() { }) It("does not call repository.MarkCheckedHeader when there are logs", func() { - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) repository.AssertMarkHeaderCheckedNotCalled() @@ -82,14 +84,14 @@ var _ = Describe("LogNoteTransformer", func() { It("returns error if marking header checked returns err", func() { repository.SetMarkHeaderCheckedError(fakes.FakeError) - err := transformer.Execute([]types.Log{}, headerOne, constants.HeaderMissing) + err := t.Execute([]types.Log{}, headerOne, constants.HeaderMissing) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fakes.FakeError)) }) It("converts matching logs to models", func() { - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) Expect(converter.PassedLogs).To(Equal(logs)) @@ -98,7 +100,7 @@ var _ = Describe("LogNoteTransformer", func() { It("returns error if converter returns error", func() { converter.SetConverterError(fakes.FakeError) - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fakes.FakeError)) @@ -106,7 +108,7 @@ var _ = Describe("LogNoteTransformer", func() { It("persists the model", func() { converter.SetReturnModels([]interface{}{model}) - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) Expect(repository.PassedHeaderID).To(Equal(headerOne.Id)) @@ -116,7 +118,7 @@ var _ = Describe("LogNoteTransformer", func() { It("returns error if repository returns error for create", func() { repository.SetCreateError(fakes.FakeError) - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fakes.FakeError)) diff --git a/pkg/transformers/factories/repository.go b/libraries/shared/factories/repository.go similarity index 100% rename from pkg/transformers/factories/repository.go rename to libraries/shared/factories/repository.go diff --git a/pkg/transformers/factories/storage/EXAMPLE.md b/libraries/shared/factories/storage/EXAMPLE.md similarity index 100% rename from pkg/transformers/factories/storage/EXAMPLE.md rename to libraries/shared/factories/storage/EXAMPLE.md diff --git a/pkg/transformers/factories/storage/README.md b/libraries/shared/factories/storage/README.md similarity index 100% rename from pkg/transformers/factories/storage/README.md rename to libraries/shared/factories/storage/README.md diff --git a/pkg/transformers/factories/storage/storage_suite_test.go b/libraries/shared/factories/storage/storage_suite_test.go similarity index 95% rename from pkg/transformers/factories/storage/storage_suite_test.go rename to libraries/shared/factories/storage/storage_suite_test.go index b8e3232e..3c2e86b8 100644 --- a/pkg/transformers/factories/storage/storage_suite_test.go +++ b/libraries/shared/factories/storage/storage_suite_test.go @@ -25,5 +25,5 @@ import ( func TestStorage(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "Storage Suite") + RunSpecs(t, "Storage Factories Suite") } diff --git a/pkg/transformers/factories/storage/transformer.go b/libraries/shared/factories/storage/transformer.go similarity index 71% rename from pkg/transformers/factories/storage/transformer.go rename to libraries/shared/factories/storage/transformer.go index 68baf5f7..b3570019 100644 --- a/pkg/transformers/factories/storage/transformer.go +++ b/libraries/shared/factories/storage/transformer.go @@ -18,19 +18,21 @@ package storage import ( "github.com/ethereum/go-ethereum/common" + + "github.com/vulcanize/vulcanizedb/libraries/shared/repository" + "github.com/vulcanize/vulcanizedb/libraries/shared/storage" + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/storage" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" ) type Transformer struct { Address common.Address - Mappings storage_diffs.Mappings - Repository storage_diffs.Repository + Mappings storage.Mappings + Repository repository.StorageRepository } -func (transformer Transformer) NewTransformer(db *postgres.DB) storage.Transformer { +func (transformer Transformer) NewTransformer(db *postgres.DB) transformer.StorageTransformer { transformer.Mappings.SetDB(db) transformer.Repository.SetDB(db) return transformer @@ -40,12 +42,12 @@ func (transformer Transformer) ContractAddress() common.Address { return transformer.Address } -func (transformer Transformer) Execute(row shared.StorageDiffRow) error { +func (transformer Transformer) Execute(row utils.StorageDiffRow) error { metadata, lookupErr := transformer.Mappings.Lookup(row.StorageKey) if lookupErr != nil { return lookupErr } - value, decodeErr := shared.Decode(row, metadata) + value, decodeErr := utils.Decode(row, metadata) if decodeErr != nil { return decodeErr } diff --git a/pkg/transformers/factories/storage/transformer_test.go b/libraries/shared/factories/storage/transformer_test.go similarity index 74% rename from pkg/transformers/factories/storage/transformer_test.go rename to libraries/shared/factories/storage/transformer_test.go index 43821e46..aa80fbfa 100644 --- a/pkg/transformers/factories/storage/transformer_test.go +++ b/libraries/shared/factories/storage/transformer_test.go @@ -20,23 +20,24 @@ import ( "github.com/ethereum/go-ethereum/common" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + + "github.com/vulcanize/vulcanizedb/libraries/shared/factories/storage" + "github.com/vulcanize/vulcanizedb/libraries/shared/mocks" + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories/storage" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks" ) var _ = Describe("Storage transformer", func() { var ( - mappings *mocks.MockMappings - repository *mocks.MockStorageRepository - transformer storage.Transformer + mappings *mocks.MockMappings + repository *mocks.MockStorageRepository + t storage.Transformer ) BeforeEach(func() { mappings = &mocks.MockMappings{} repository = &mocks.MockStorageRepository{} - transformer = storage.Transformer{ + t = storage.Transformer{ Address: common.Address{}, Mappings: mappings, Repository: repository, @@ -45,13 +46,13 @@ var _ = Describe("Storage transformer", func() { It("returns the contract address being watched", func() { fakeAddress := common.HexToAddress("0x12345") - transformer.Address = fakeAddress + t.Address = fakeAddress - Expect(transformer.ContractAddress()).To(Equal(fakeAddress)) + Expect(t.ContractAddress()).To(Equal(fakeAddress)) }) It("looks up metadata for storage key", func() { - transformer.Execute(shared.StorageDiffRow{}) + t.Execute(utils.StorageDiffRow{}) Expect(mappings.LookupCalled).To(BeTrue()) }) @@ -59,19 +60,19 @@ var _ = Describe("Storage transformer", func() { It("returns error if lookup fails", func() { mappings.LookupErr = fakes.FakeError - err := transformer.Execute(shared.StorageDiffRow{}) + err := t.Execute(utils.StorageDiffRow{}) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fakes.FakeError)) }) It("creates storage row with decoded data", func() { - fakeMetadata := shared.StorageValueMetadata{Type: shared.Address} + fakeMetadata := utils.StorageValueMetadata{Type: utils.Address} mappings.Metadata = fakeMetadata rawValue := common.HexToAddress("0x12345") fakeBlockNumber := 123 fakeBlockHash := "0x67890" - fakeRow := shared.StorageDiffRow{ + fakeRow := utils.StorageDiffRow{ Contract: common.Address{}, BlockHash: common.HexToHash(fakeBlockHash), BlockHeight: fakeBlockNumber, @@ -79,7 +80,7 @@ var _ = Describe("Storage transformer", func() { StorageValue: rawValue.Hash(), } - err := transformer.Execute(fakeRow) + err := t.Execute(fakeRow) Expect(err).NotTo(HaveOccurred()) Expect(repository.PassedBlockNumber).To(Equal(fakeBlockNumber)) @@ -90,11 +91,11 @@ var _ = Describe("Storage transformer", func() { It("returns error if creating row fails", func() { rawValue := common.HexToAddress("0x12345") - fakeMetadata := shared.StorageValueMetadata{Type: shared.Address} + fakeMetadata := utils.StorageValueMetadata{Type: utils.Address} mappings.Metadata = fakeMetadata repository.CreateErr = fakes.FakeError - err := transformer.Execute(shared.StorageDiffRow{StorageValue: rawValue.Hash()}) + err := t.Execute(utils.StorageDiffRow{StorageValue: rawValue.Hash()}) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fakes.FakeError)) diff --git a/pkg/transformers/factories/transformer.go b/libraries/shared/factories/transformer.go similarity index 86% rename from pkg/transformers/factories/transformer.go rename to libraries/shared/factories/transformer.go index cca34a66..7ef882bf 100644 --- a/pkg/transformers/factories/transformer.go +++ b/libraries/shared/factories/transformer.go @@ -20,19 +20,19 @@ import ( "github.com/ethereum/go-ethereum/core/types" log "github.com/sirupsen/logrus" + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" ) type Transformer struct { - Config shared.TransformerConfig + Config transformer.TransformerConfig Converter Converter Repository Repository } -func (transformer Transformer) NewTransformer(db *postgres.DB) shared.Transformer { +func (transformer Transformer) NewTransformer(db *postgres.DB) transformer.EventTransformer { transformer.Repository.SetDB(db) return transformer } @@ -75,6 +75,6 @@ func (transformer Transformer) GetName() string { return transformer.Config.TransformerName } -func (transformer Transformer) GetConfig() shared.TransformerConfig { +func (transformer Transformer) GetConfig() transformer.TransformerConfig { return transformer.Config } diff --git a/pkg/transformers/factories/transformer_test.go b/libraries/shared/factories/transformer_test.go similarity index 73% rename from pkg/transformers/factories/transformer_test.go rename to libraries/shared/factories/transformer_test.go index 3f8c0039..201044f3 100644 --- a/pkg/transformers/factories/transformer_test.go +++ b/libraries/shared/factories/transformer_test.go @@ -17,34 +17,36 @@ package factories_test import ( + "math/rand" + "github.com/ethereum/go-ethereum/core/types" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" + "github.com/vulcanize/vulcanizedb/libraries/shared/factories" + "github.com/vulcanize/vulcanizedb/libraries/shared/mocks" + "github.com/vulcanize/vulcanizedb/libraries/shared/test_data" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks" - "math/rand" ) var _ = Describe("Transformer", func() { var ( - repository mocks.MockRepository - converter mocks.MockConverter - transformer shared.Transformer - headerOne core.Header - config = test_data.GenericTestConfig - logs = test_data.GenericTestLogs + repository mocks.MockRepository + converter mocks.MockConverter + t transformer.EventTransformer + headerOne core.Header + config = test_data.GenericTestConfig + logs = test_data.GenericTestLogs ) BeforeEach(func() { repository = mocks.MockRepository{} converter = mocks.MockConverter{} - transformer = factories.Transformer{ + t = factories.Transformer{ Repository: &repository, Converter: &converter, Config: config, @@ -58,14 +60,14 @@ var _ = Describe("Transformer", func() { }) It("marks header checked if no logs returned", func() { - err := transformer.Execute([]types.Log{}, headerOne, constants.HeaderMissing) + err := t.Execute([]types.Log{}, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) repository.AssertMarkHeaderCheckedCalledWith(headerOne.Id) }) It("doesn't attempt to convert or persist an empty collection when there are no logs", func() { - err := transformer.Execute([]types.Log{}, headerOne, constants.HeaderMissing) + err := t.Execute([]types.Log{}, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) Expect(converter.ToEntitiesCalledCounter).To(Equal(0)) @@ -74,7 +76,7 @@ var _ = Describe("Transformer", func() { }) It("does not call repository.MarkCheckedHeader when there are logs", func() { - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) repository.AssertMarkHeaderCheckedNotCalled() @@ -83,14 +85,14 @@ var _ = Describe("Transformer", func() { It("returns error if marking header checked returns err", func() { repository.SetMarkHeaderCheckedError(fakes.FakeError) - err := transformer.Execute([]types.Log{}, headerOne, constants.HeaderMissing) + err := t.Execute([]types.Log{}, headerOne, constants.HeaderMissing) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fakes.FakeError)) }) It("converts an eth log to an entity", func() { - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) Expect(converter.ContractAbi).To(Equal(config.ContractAbi)) @@ -100,7 +102,7 @@ var _ = Describe("Transformer", func() { It("returns an error if converter fails", func() { converter.ToEntitiesError = fakes.FakeError - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fakes.FakeError)) @@ -109,7 +111,7 @@ var _ = Describe("Transformer", func() { It("converts an entity to a model", func() { converter.EntitiesToReturn = []interface{}{test_data.GenericEntity{}} - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) Expect(converter.EntitiesToConvert[0]).To(Equal(test_data.GenericEntity{})) @@ -119,7 +121,7 @@ var _ = Describe("Transformer", func() { converter.EntitiesToReturn = []interface{}{test_data.GenericEntity{}} converter.ToModelsError = fakes.FakeError - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fakes.FakeError)) @@ -128,7 +130,7 @@ var _ = Describe("Transformer", func() { It("persists the record", func() { converter.ModelsToReturn = []interface{}{test_data.GenericModel{}} - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) Expect(repository.PassedHeaderID).To(Equal(headerOne.Id)) @@ -137,7 +139,7 @@ var _ = Describe("Transformer", func() { It("returns error if persisting the record fails", func() { repository.SetCreateError(fakes.FakeError) - err := transformer.Execute(logs, headerOne, constants.HeaderMissing) + err := t.Execute(logs, headerOne, constants.HeaderMissing) Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fakes.FakeError)) diff --git a/pkg/transformers/bite/bite_suite_test.go b/libraries/shared/fetcher/fetcher_suite_test.go similarity index 90% rename from pkg/transformers/bite/bite_suite_test.go rename to libraries/shared/fetcher/fetcher_suite_test.go index b85d4a0a..09f024bd 100644 --- a/pkg/transformers/bite/bite_suite_test.go +++ b/libraries/shared/fetcher/fetcher_suite_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package bite_test +package fetcher_test import ( "testing" @@ -25,9 +25,9 @@ import ( "io/ioutil" ) -func TestBite(t *testing.T) { +func TestFactories(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "Bite Suite") + RunSpecs(t, "Shared Fetcher Suite") } var _ = BeforeSuite(func() { diff --git a/pkg/transformers/shared/log_fetcher.go b/libraries/shared/fetcher/log_fetcher.go similarity index 99% rename from pkg/transformers/shared/log_fetcher.go rename to libraries/shared/fetcher/log_fetcher.go index e786d48c..225c1469 100644 --- a/pkg/transformers/shared/log_fetcher.go +++ b/libraries/shared/fetcher/log_fetcher.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared +package fetcher import ( "github.com/ethereum/go-ethereum" diff --git a/pkg/transformers/shared/log_fetcher_test.go b/libraries/shared/fetcher/log_fetcher_test.go similarity index 92% rename from pkg/transformers/shared/log_fetcher_test.go rename to libraries/shared/fetcher/log_fetcher_test.go index 2c3ff75b..c8f23cf1 100644 --- a/pkg/transformers/shared/log_fetcher_test.go +++ b/libraries/shared/fetcher/log_fetcher_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared_test +package fetcher_test import ( "github.com/ethereum/go-ethereum" @@ -22,16 +22,16 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + fetch "github.com/vulcanize/vulcanizedb/libraries/shared/fetcher" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" ) var _ = Describe("Fetcher", func() { Describe("FetchLogs", func() { It("fetches logs based on the given query", func() { blockChain := fakes.NewMockBlockChain() - fetcher := shared.NewFetcher(blockChain) + fetcher := fetch.NewFetcher(blockChain) header := fakes.FakeHeader addresses := []common.Address{ @@ -59,7 +59,7 @@ var _ = Describe("Fetcher", func() { It("returns an error if fetching the logs fails", func() { blockChain := fakes.NewMockBlockChain() blockChain.SetGetEthLogsWithCustomQueryErr(fakes.FakeError) - fetcher := shared.NewFetcher(blockChain) + fetcher := fetch.NewFetcher(blockChain) _, err := fetcher.FetchLogs([]common.Address{}, []common.Hash{}, core.Header{}) diff --git a/pkg/transformers/test_data/mocks/converter.go b/libraries/shared/mocks/converter.go similarity index 64% rename from pkg/transformers/test_data/mocks/converter.go rename to libraries/shared/mocks/converter.go index fae4302d..0d5a2ae3 100644 --- a/pkg/transformers/test_data/mocks/converter.go +++ b/libraries/shared/mocks/converter.go @@ -1,3 +1,19 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package mocks import ( diff --git a/pkg/transformers/frob/entity.go b/libraries/shared/mocks/log_note_converter.go similarity index 58% rename from pkg/transformers/frob/entity.go rename to libraries/shared/mocks/log_note_converter.go index ddd9fcc0..1ab9312a 100644 --- a/pkg/transformers/frob/entity.go +++ b/libraries/shared/mocks/log_note_converter.go @@ -14,23 +14,29 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package frob +package mocks import ( - "math/big" - "github.com/ethereum/go-ethereum/core/types" ) -type FrobEntity struct { - Ilk [32]byte - Urn [32]byte - Ink *big.Int - Art *big.Int - Dink *big.Int - Dart *big.Int - IArt *big.Int - LogIndex uint - TransactionIndex uint - Raw types.Log +type MockLogNoteConverter struct { + err error + returnModels []interface{} + PassedLogs []types.Log + ToModelsCalledCounter int +} + +func (converter *MockLogNoteConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { + converter.PassedLogs = ethLogs + converter.ToModelsCalledCounter++ + return converter.returnModels, converter.err +} + +func (converter *MockLogNoteConverter) SetConverterError(e error) { + converter.err = e +} + +func (converter *MockLogNoteConverter) SetReturnModels(models []interface{}) { + converter.returnModels = models } diff --git a/pkg/transformers/flip_kick/entity.go b/libraries/shared/mocks/mappings.go similarity index 61% rename from pkg/transformers/flip_kick/entity.go rename to libraries/shared/mocks/mappings.go index 057225eb..0ad0dee9 100644 --- a/pkg/transformers/flip_kick/entity.go +++ b/libraries/shared/mocks/mappings.go @@ -14,24 +14,26 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package flip_kick +package mocks import ( - "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" + "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" ) -type FlipKickEntity struct { - Id *big.Int - Lot *big.Int - Bid *big.Int - Gal common.Address - End *big.Int - Urn [32]byte - Tab *big.Int - TransactionIndex uint - LogIndex uint - Raw types.Log +type MockMappings struct { + Metadata utils.StorageValueMetadata + LookupCalled bool + LookupErr error +} + +func (mappings *MockMappings) Lookup(key common.Hash) (utils.StorageValueMetadata, error) { + mappings.LookupCalled = true + return mappings.Metadata, mappings.LookupErr +} + +func (*MockMappings) SetDB(db *postgres.DB) { + panic("implement me") } diff --git a/pkg/transformers/test_data/mocks/mock_watcher_repository.go b/libraries/shared/mocks/mock_watcher_repository.go similarity index 70% rename from pkg/transformers/test_data/mocks/mock_watcher_repository.go rename to libraries/shared/mocks/mock_watcher_repository.go index 323fdddf..fe9d70a6 100644 --- a/pkg/transformers/test_data/mocks/mock_watcher_repository.go +++ b/libraries/shared/mocks/mock_watcher_repository.go @@ -1,3 +1,19 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package mocks import ( diff --git a/pkg/transformers/test_data/mocks/repository.go b/libraries/shared/mocks/repository.go similarity index 79% rename from pkg/transformers/test_data/mocks/repository.go rename to libraries/shared/mocks/repository.go index a19e7f86..4bd39e64 100644 --- a/pkg/transformers/test_data/mocks/repository.go +++ b/libraries/shared/mocks/repository.go @@ -1,3 +1,19 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + package mocks import ( diff --git a/pkg/transformers/drip_file/vow/vow_suite_test.go b/libraries/shared/mocks/storage_queue.go similarity index 72% rename from pkg/transformers/drip_file/vow/vow_suite_test.go rename to libraries/shared/mocks/storage_queue.go index fc8a56b1..ea668e54 100644 --- a/pkg/transformers/drip_file/vow/vow_suite_test.go +++ b/libraries/shared/mocks/storage_queue.go @@ -14,22 +14,18 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package vow_test +package mocks import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" ) -func TestVow(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Vow Suite") +type MockStorageQueue struct { + AddCalled bool + AddError error } -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) +func (queue *MockStorageQueue) Add(row utils.StorageDiffRow) error { + queue.AddCalled = true + return queue.AddError +} diff --git a/libraries/shared/mocks/storage_repository.go b/libraries/shared/mocks/storage_repository.go new file mode 100644 index 00000000..a370e745 --- /dev/null +++ b/libraries/shared/mocks/storage_repository.go @@ -0,0 +1,42 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package mocks + +import ( + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" + "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" +) + +type MockStorageRepository struct { + CreateErr error + PassedBlockNumber int + PassedBlockHash string + PassedMetadata utils.StorageValueMetadata + PassedValue interface{} +} + +func (repository *MockStorageRepository) Create(blockNumber int, blockHash string, metadata utils.StorageValueMetadata, value interface{}) error { + repository.PassedBlockNumber = blockNumber + repository.PassedBlockHash = blockHash + repository.PassedMetadata = metadata + repository.PassedValue = value + return repository.CreateErr +} + +func (*MockStorageRepository) SetDB(db *postgres.DB) { + panic("implement me") +} diff --git a/pkg/transformers/price_feeds/model.go b/libraries/shared/mocks/storage_transformer.go similarity index 52% rename from pkg/transformers/price_feeds/model.go rename to libraries/shared/mocks/storage_transformer.go index f21d75f5..047a9cc3 100644 --- a/pkg/transformers/price_feeds/model.go +++ b/libraries/shared/mocks/storage_transformer.go @@ -14,35 +14,31 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package price_feeds +package mocks import ( - "math/big" - "github.com/ethereum/go-ethereum/common" + + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" + "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" ) -type LogValueEntity struct { - Val common.Address +type MockStorageTransformer struct { + Address common.Address + ExecuteErr error + PassedRow utils.StorageDiffRow } -type PriceFeedModel struct { - BlockNumber uint64 `db:"block_number"` - MedianizerAddress string `db:"medianizer_address"` - UsdValue string `db:"usd_value"` - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` +func (transformer *MockStorageTransformer) Execute(row utils.StorageDiffRow) error { + transformer.PassedRow = row + return transformer.ExecuteErr } -func Convert(conversion string, value string, prec int) string { - var bgflt = big.NewFloat(0.0) - bgflt.SetString(value) - switch conversion { - case "ray": - bgflt.Quo(bgflt, Ray) - case "wad": - bgflt.Quo(bgflt, Ether) - } - return bgflt.Text('g', prec) +func (transformer *MockStorageTransformer) ContractAddress() common.Address { + return transformer.Address +} + +func (transformer *MockStorageTransformer) FakeTransformerInitializer(db *postgres.DB) transformer.StorageTransformer { + return transformer } diff --git a/libraries/shared/mocks/transformer.go b/libraries/shared/mocks/transformer.go new file mode 100644 index 00000000..f8a74c80 --- /dev/null +++ b/libraries/shared/mocks/transformer.go @@ -0,0 +1,62 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package mocks + +import ( + "github.com/ethereum/go-ethereum/core/types" + + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" + shared_t "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" + "github.com/vulcanize/vulcanizedb/pkg/core" + "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" +) + +type MockTransformer struct { + ExecuteWasCalled bool + ExecuteError error + PassedLogs []types.Log + PassedHeader core.Header + config shared_t.TransformerConfig +} + +func (mh *MockTransformer) Execute(logs []types.Log, header core.Header, recheckHeaders constants.TransformerExecution) error { + if mh.ExecuteError != nil { + return mh.ExecuteError + } + mh.ExecuteWasCalled = true + mh.PassedLogs = logs + mh.PassedHeader = header + return nil +} + +func (mh *MockTransformer) GetConfig() shared_t.TransformerConfig { + return mh.config +} + +func (mh *MockTransformer) SetTransformerConfig(config shared_t.TransformerConfig) { + mh.config = config +} + +func (mh *MockTransformer) FakeTransformerInitializer(db *postgres.DB) shared_t.EventTransformer { + return mh +} + +var FakeTransformerConfig = shared_t.TransformerConfig{ + TransformerName: "FakeTransformer", + ContractAddresses: []string{"FakeAddress"}, + Topic: "FakeTopic", +} diff --git a/pkg/transformers/shared/repository.go b/libraries/shared/repository/repository.go similarity index 86% rename from pkg/transformers/shared/repository.go rename to libraries/shared/repository/repository.go index bf156067..04d9ea4c 100644 --- a/pkg/transformers/shared/repository.go +++ b/libraries/shared/repository/repository.go @@ -1,39 +1,32 @@ -package shared +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package repository import ( "bytes" "database/sql" "database/sql/driver" "fmt" + + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" ) -func GetOrCreateIlk(ilk string, db *postgres.DB) (int, error) { - var ilkID int - err := db.Get(&ilkID, `SELECT id FROM maker.ilks WHERE ilk = $1`, ilk) - if err != nil { - if err == sql.ErrNoRows { - insertErr := db.QueryRow(`INSERT INTO maker.ilks (ilk) VALUES ($1) RETURNING id`, ilk).Scan(&ilkID) - return ilkID, insertErr - } - } - return ilkID, err -} - -func GetOrCreateIlkInTransaction(ilk string, tx *sql.Tx) (int, error) { - var ilkID int - err := tx.QueryRow(`SELECT id FROM maker.ilks WHERE ilk = $1`, ilk).Scan(&ilkID) - if err != nil { - if err == sql.ErrNoRows { - insertErr := tx.QueryRow(`INSERT INTO maker.ilks (ilk) VALUES ($1) RETURNING id`, ilk).Scan(&ilkID) - return ilkID, insertErr - } - } - return ilkID, err -} - func MarkHeaderChecked(headerID int64, db *postgres.DB, checkedHeadersColumn string) error { _, err := db.Exec(`INSERT INTO public.checked_headers (header_id, `+checkedHeadersColumn+`) VALUES ($1, $2) diff --git a/libraries/shared/repository/repository_suite_test.go b/libraries/shared/repository/repository_suite_test.go new file mode 100644 index 00000000..3e467abc --- /dev/null +++ b/libraries/shared/repository/repository_suite_test.go @@ -0,0 +1,35 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package repository_test + +import ( + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" + "io/ioutil" +) + +func TestFactories(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Shared Repository Suite") +} + +var _ = BeforeSuite(func() { + log.SetOutput(ioutil.Discard) +}) diff --git a/pkg/transformers/shared/repository_utility_test.go b/libraries/shared/repository/repository_utility_test.go similarity index 92% rename from pkg/transformers/shared/repository_utility_test.go rename to libraries/shared/repository/repository_utility_test.go index 1a8f762b..09791ec0 100644 --- a/pkg/transformers/shared/repository_utility_test.go +++ b/libraries/shared/repository/repository_utility_test.go @@ -14,21 +14,24 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared_test +package repository_test import ( "fmt" + "math/rand" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" + shared "github.com/vulcanize/vulcanizedb/libraries/shared/repository" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" + r2 "github.com/vulcanize/vulcanizedb/pkg/omni/light/repository" "github.com/vulcanize/vulcanizedb/test_config" - "math/rand" ) var _ = Describe("Repository utilities", func() { @@ -43,12 +46,15 @@ var _ = Describe("Repository utilities", func() { headerIDs []int64 notCheckedSQL string err error + hr r2.HeaderRepository ) BeforeEach(func() { db = test_config.NewTestDB(test_config.NewTestNode()) test_config.CleanTestDB(db) headerRepository = repositories.NewHeaderRepository(db) + hr = r2.NewHeaderRepository(db) + hr.AddCheckColumns(getExpectedColumnNames()) columnNames, err := shared.GetCheckedColumnNames(db) Expect(err).NotTo(HaveOccurred()) @@ -69,6 +75,10 @@ var _ = Describe("Repository utilities", func() { } }) + AfterEach(func() { + test_config.CleanCheckedHeadersTable(db, getExpectedColumnNames()) + }) + It("only treats headers as checked if the event specific logs have been checked", func() { _, err = db.Exec(`INSERT INTO public.checked_headers (header_id) VALUES ($1)`, headerIDs[1]) Expect(err).NotTo(HaveOccurred()) @@ -109,11 +119,14 @@ var _ = Describe("Repository utilities", func() { Describe("GetCheckedColumnNames", func() { It("gets the column names from checked_headers", func() { db := test_config.NewTestDB(test_config.NewTestNode()) + hr := r2.NewHeaderRepository(db) + hr.AddCheckColumns(getExpectedColumnNames()) test_config.CleanTestDB(db) expectedColumnNames := getExpectedColumnNames() actualColumnNames, err := shared.GetCheckedColumnNames(db) Expect(err).NotTo(HaveOccurred()) Expect(actualColumnNames).To(Equal(expectedColumnNames)) + test_config.CleanCheckedHeadersTable(db, getExpectedColumnNames()) }) }) diff --git a/pkg/transformers/storage_diffs/repository.go b/libraries/shared/repository/storage_repository.go similarity index 77% rename from pkg/transformers/storage_diffs/repository.go rename to libraries/shared/repository/storage_repository.go index 7baedb6a..379362e3 100644 --- a/pkg/transformers/storage_diffs/repository.go +++ b/libraries/shared/repository/storage_repository.go @@ -14,14 +14,14 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package storage_diffs +package repository import ( + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" ) -type Repository interface { - Create(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, value interface{}) error +type StorageRepository interface { + Create(blockNumber int, blockHash string, metadata utils.StorageValueMetadata, value interface{}) error SetDB(db *postgres.DB) } diff --git a/pkg/transformers/storage_diffs/mappings.go b/libraries/shared/storage/mappings.go similarity index 94% rename from pkg/transformers/storage_diffs/mappings.go rename to libraries/shared/storage/mappings.go index c3df7555..dab8efb7 100644 --- a/pkg/transformers/storage_diffs/mappings.go +++ b/libraries/shared/storage/mappings.go @@ -14,18 +14,20 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package storage_diffs +package storage import ( + "math/big" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" + + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "math/big" ) type Mappings interface { - Lookup(key common.Hash) (shared.StorageValueMetadata, error) + Lookup(key common.Hash) (utils.StorageValueMetadata, error) SetDB(db *postgres.DB) } diff --git a/libraries/shared/storage/storage_queue.go b/libraries/shared/storage/storage_queue.go new file mode 100644 index 00000000..9c5c7135 --- /dev/null +++ b/libraries/shared/storage/storage_queue.go @@ -0,0 +1,42 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package storage + +import ( + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" + "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" +) + +type IStorageQueue interface { + Add(row utils.StorageDiffRow) error +} + +type StorageQueue struct { + db *postgres.DB +} + +func NewStorageQueue(db *postgres.DB) StorageQueue { + return StorageQueue{db: db} +} + +func (queue StorageQueue) Add(row utils.StorageDiffRow) error { + _, err := queue.db.Exec(`INSERT INTO public.queued_storage (contract, + block_hash, block_height, storage_key, storage_value) VALUES + ($1, $2, $3, $4, $5)`, row.Contract.Bytes(), row.BlockHash.Bytes(), + row.BlockHeight, row.StorageKey.Bytes(), row.StorageValue.Bytes()) + return err +} diff --git a/libraries/shared/storage_queue_test.go b/libraries/shared/storage/storage_queue_test.go similarity index 75% rename from libraries/shared/storage_queue_test.go rename to libraries/shared/storage/storage_queue_test.go index c1d7349f..9157fcda 100644 --- a/libraries/shared/storage_queue_test.go +++ b/libraries/shared/storage/storage_queue_test.go @@ -1,17 +1,18 @@ -package shared_test +package storage_test import ( "github.com/ethereum/go-ethereum/common" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - shared2 "github.com/vulcanize/vulcanizedb/libraries/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" + + "github.com/vulcanize/vulcanizedb/libraries/shared/storage" + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" "github.com/vulcanize/vulcanizedb/test_config" ) var _ = Describe("Storage queue", func() { It("adds a storage row to the db", func() { - row := shared.StorageDiffRow{ + row := utils.StorageDiffRow{ Contract: common.HexToAddress("0x123456"), BlockHash: common.HexToHash("0x678901"), BlockHeight: 987, @@ -19,12 +20,12 @@ var _ = Describe("Storage queue", func() { StorageValue: common.HexToHash("0x198765"), } db := test_config.NewTestDB(test_config.NewTestNode()) - queue := shared2.NewStorageQueue(db) + queue := storage.NewStorageQueue(db) addErr := queue.Add(row) Expect(addErr).NotTo(HaveOccurred()) - var result shared.StorageDiffRow + var result utils.StorageDiffRow getErr := db.Get(&result, `SELECT contract, block_hash, block_height, storage_key, storage_value FROM public.queued_storage`) Expect(getErr).NotTo(HaveOccurred()) Expect(result).To(Equal(row)) diff --git a/libraries/shared/storage/storage_suite_test.go b/libraries/shared/storage/storage_suite_test.go new file mode 100644 index 00000000..7773fc65 --- /dev/null +++ b/libraries/shared/storage/storage_suite_test.go @@ -0,0 +1,35 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package storage_test + +import ( + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" + "io/ioutil" +) + +func TestFactories(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Shared Storage Suite") +} + +var _ = BeforeSuite(func() { + log.SetOutput(ioutil.Discard) +}) diff --git a/pkg/transformers/storage_diffs/shared/decoder.go b/libraries/shared/storage/utils/decoder.go similarity index 98% rename from pkg/transformers/storage_diffs/shared/decoder.go rename to libraries/shared/storage/utils/decoder.go index 2fcc39ef..f179355e 100644 --- a/pkg/transformers/storage_diffs/shared/decoder.go +++ b/libraries/shared/storage/utils/decoder.go @@ -14,12 +14,13 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared +package utils import ( "fmt" - "github.com/ethereum/go-ethereum/common" "math/big" + + "github.com/ethereum/go-ethereum/common" ) func Decode(row StorageDiffRow, metadata StorageValueMetadata) (interface{}, error) { diff --git a/pkg/transformers/storage_diffs/shared/decoder_test.go b/libraries/shared/storage/utils/decoder_test.go similarity index 75% rename from pkg/transformers/storage_diffs/shared/decoder_test.go rename to libraries/shared/storage/utils/decoder_test.go index 9e1e3a6c..28721d50 100644 --- a/pkg/transformers/storage_diffs/shared/decoder_test.go +++ b/libraries/shared/storage/utils/decoder_test.go @@ -14,23 +14,25 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared_test +package utils_test import ( + "math/big" + "github.com/ethereum/go-ethereum/common" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "math/big" + + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" ) var _ = Describe("Storage decoder", func() { It("decodes uint256", func() { fakeInt := common.HexToHash("0000000000000000000000000000000000000000000000000000000000000539") - row := shared.StorageDiffRow{StorageValue: fakeInt} - metadata := shared.StorageValueMetadata{Type: shared.Uint256} + row := utils.StorageDiffRow{StorageValue: fakeInt} + metadata := utils.StorageValueMetadata{Type: utils.Uint256} - result, err := shared.Decode(row, metadata) + result, err := utils.Decode(row, metadata) Expect(err).NotTo(HaveOccurred()) Expect(result).To(Equal(big.NewInt(0).SetBytes(fakeInt.Bytes()).String())) @@ -38,10 +40,10 @@ var _ = Describe("Storage decoder", func() { It("decodes address", func() { fakeAddress := common.HexToAddress("0x12345") - row := shared.StorageDiffRow{StorageValue: fakeAddress.Hash()} - metadata := shared.StorageValueMetadata{Type: shared.Address} + row := utils.StorageDiffRow{StorageValue: fakeAddress.Hash()} + metadata := utils.StorageValueMetadata{Type: utils.Address} - result, err := shared.Decode(row, metadata) + result, err := utils.Decode(row, metadata) Expect(err).NotTo(HaveOccurred()) Expect(result).To(Equal(fakeAddress.Hex())) diff --git a/pkg/transformers/storage_diffs/shared/errors.go b/libraries/shared/storage/utils/errors.go similarity index 98% rename from pkg/transformers/storage_diffs/shared/errors.go rename to libraries/shared/storage/utils/errors.go index b33fc3ee..2d698f27 100644 --- a/pkg/transformers/storage_diffs/shared/errors.go +++ b/libraries/shared/storage/utils/errors.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared +package utils import ( "fmt" diff --git a/pkg/transformers/storage_diffs/shared/row.go b/libraries/shared/storage/utils/row.go similarity index 99% rename from pkg/transformers/storage_diffs/shared/row.go rename to libraries/shared/storage/utils/row.go index 3f981def..840a8883 100644 --- a/pkg/transformers/storage_diffs/shared/row.go +++ b/libraries/shared/storage/utils/row.go @@ -14,11 +14,12 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared +package utils import ( - "github.com/ethereum/go-ethereum/common" "strconv" + + "github.com/ethereum/go-ethereum/common" ) const ExpectedRowLength = 5 diff --git a/pkg/transformers/storage_diffs/shared/row_test.go b/libraries/shared/storage/utils/row_test.go similarity index 84% rename from pkg/transformers/storage_diffs/shared/row_test.go rename to libraries/shared/storage/utils/row_test.go index a75201fb..261085c3 100644 --- a/pkg/transformers/storage_diffs/shared/row_test.go +++ b/libraries/shared/storage/utils/row_test.go @@ -14,13 +14,14 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared_test +package utils_test import ( "github.com/ethereum/go-ethereum/common" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" + + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" ) var _ = Describe("Storage row parsing", func() { @@ -32,7 +33,7 @@ var _ = Describe("Storage row parsing", func() { storageValue := "0x654" data := []string{contract, blockHash, blockHeight, storageKey, storageValue} - result, err := shared.FromStrings(data) + result, err := utils.FromStrings(data) Expect(err).NotTo(HaveOccurred()) Expect(result.Contract).To(Equal(common.HexToAddress(contract))) @@ -43,14 +44,14 @@ var _ = Describe("Storage row parsing", func() { }) It("returns an error if row is missing data", func() { - _, err := shared.FromStrings([]string{"0x123"}) + _, err := utils.FromStrings([]string{"0x123"}) Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrRowMalformed{Length: 1})) + Expect(err).To(MatchError(utils.ErrRowMalformed{Length: 1})) }) It("returns error if block height malformed", func() { - _, err := shared.FromStrings([]string{"", "", "", "", ""}) + _, err := utils.FromStrings([]string{"", "", "", "", ""}) Expect(err).To(HaveOccurred()) }) diff --git a/pkg/transformers/storage_diffs/shared/shared_suite_test.go b/libraries/shared/storage/utils/utils_suite_test.go similarity index 93% rename from pkg/transformers/storage_diffs/shared/shared_suite_test.go rename to libraries/shared/storage/utils/utils_suite_test.go index 865d8158..e5bc1ace 100644 --- a/pkg/transformers/storage_diffs/shared/shared_suite_test.go +++ b/libraries/shared/storage/utils/utils_suite_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared_test +package utils_test import ( "github.com/sirupsen/logrus" @@ -27,7 +27,7 @@ import ( func TestShared(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "Shared Suite") + RunSpecs(t, "Shared Storage Utils Suite") } var _ = BeforeSuite(func() { diff --git a/pkg/transformers/storage_diffs/shared/value.go b/libraries/shared/storage/utils/value.go similarity index 92% rename from pkg/transformers/storage_diffs/shared/value.go rename to libraries/shared/storage/utils/value.go index e5543bce..bbefb1d7 100644 --- a/pkg/transformers/storage_diffs/shared/value.go +++ b/libraries/shared/storage/utils/value.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared +package utils type ValueType int @@ -26,12 +26,6 @@ const ( type Key string -const ( - Ilk Key = "ilk" - Guy Key = "guy" - Flip Key = "flip" -) - type StorageValueMetadata struct { Name string Keys map[Key]string diff --git a/libraries/shared/storage_queue.go b/libraries/shared/storage_queue.go deleted file mode 100644 index 485c1a76..00000000 --- a/libraries/shared/storage_queue.go +++ /dev/null @@ -1,26 +0,0 @@ -package shared - -import ( - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type IStorageQueue interface { - Add(row shared.StorageDiffRow) error -} - -type StorageQueue struct { - db *postgres.DB -} - -func NewStorageQueue(db *postgres.DB) StorageQueue { - return StorageQueue{db: db} -} - -func (queue StorageQueue) Add(row shared.StorageDiffRow) error { - _, err := queue.db.Exec(`INSERT INTO public.queued_storage (contract, - block_hash, block_height, storage_key, storage_value) VALUES - ($1, $2, $3, $4, $5)`, row.Contract.Bytes(), row.BlockHash.Bytes(), - row.BlockHeight, row.StorageKey.Bytes(), row.StorageValue.Bytes()) - return err -} diff --git a/pkg/transformers/test_data/generic.go b/libraries/shared/test_data/generic.go similarity index 93% rename from pkg/transformers/test_data/generic.go rename to libraries/shared/test_data/generic.go index db5c8a0f..d4a34a7a 100644 --- a/pkg/transformers/test_data/generic.go +++ b/libraries/shared/test_data/generic.go @@ -17,11 +17,13 @@ package test_data import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "math/rand" "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" ) type GenericModel struct{} @@ -37,7 +39,7 @@ var GenericTestLogs = []types.Log{{ BlockNumber: uint64(startingBlockNumber), }} -var GenericTestConfig = shared.TransformerConfig{ +var GenericTestConfig = transformer.TransformerConfig{ TransformerName: "generic-test-transformer", ContractAddresses: []string{address}, ContractAbi: randomString(100), diff --git a/pkg/transformers/shared/transformer.go b/libraries/shared/transformer/event_transformer.go similarity index 90% rename from pkg/transformers/shared/transformer.go rename to libraries/shared/transformer/event_transformer.go index 7d3c7164..3b0fd626 100644 --- a/pkg/transformers/shared/transformer.go +++ b/libraries/shared/transformer/event_transformer.go @@ -14,23 +14,23 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared +package transformer import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/vulcanize/vulcanizedb/pkg/core" + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" ) -type Transformer interface { +type EventTransformer interface { Execute(logs []types.Log, header core.Header, recheckHeaders constants.TransformerExecution) error GetConfig() TransformerConfig } -type TransformerInitializer func(db *postgres.DB) Transformer +type TransformerInitializer func(db *postgres.DB) EventTransformer type TransformerConfig struct { TransformerName string diff --git a/pkg/transformers/flap_kick/entity.go b/libraries/shared/transformer/storage_transformer.go similarity index 69% rename from pkg/transformers/flap_kick/entity.go rename to libraries/shared/transformer/storage_transformer.go index 5f680b78..22ca9378 100644 --- a/pkg/transformers/flap_kick/entity.go +++ b/libraries/shared/transformer/storage_transformer.go @@ -14,22 +14,18 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package flap_kick +package transformer import ( - "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" + "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" ) -type FlapKickEntity struct { - Id *big.Int - Lot *big.Int - Bid *big.Int - Gal common.Address - End *big.Int - Raw types.Log - TransactionIndex uint - LogIndex uint +type StorageTransformer interface { + Execute(row utils.StorageDiffRow) error + ContractAddress() common.Address } + +type StorageTransformerInitializer func(db *postgres.DB) StorageTransformer diff --git a/libraries/shared/event_watcher.go b/libraries/shared/watcher/event_watcher.go similarity index 71% rename from libraries/shared/event_watcher.go rename to libraries/shared/watcher/event_watcher.go index bdcf0554..b957c878 100644 --- a/libraries/shared/event_watcher.go +++ b/libraries/shared/watcher/event_watcher.go @@ -14,31 +14,36 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared +package watcher import ( "fmt" + "github.com/ethereum/go-ethereum/common" log "github.com/sirupsen/logrus" + + chunk "github.com/vulcanize/vulcanizedb/libraries/shared/chunker" + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" + fetch "github.com/vulcanize/vulcanizedb/libraries/shared/fetcher" + repo "github.com/vulcanize/vulcanizedb/libraries/shared/repository" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" ) type EventWatcher struct { - Transformers []shared.Transformer + Transformers []transformer.EventTransformer DB *postgres.DB - Fetcher shared.LogFetcher - Chunker shared.Chunker + Fetcher fetch.LogFetcher + Chunker chunk.Chunker Addresses []common.Address Topics []common.Hash StartingBlock *int64 } func NewEventWatcher(db *postgres.DB, bc core.BlockChain) EventWatcher { - chunker := shared.NewLogChunker() - fetcher := shared.NewFetcher(bc) + chunker := chunk.NewLogChunker() + fetcher := fetch.NewFetcher(bc) return EventWatcher{ DB: db, Fetcher: fetcher, @@ -47,16 +52,16 @@ func NewEventWatcher(db *postgres.DB, bc core.BlockChain) EventWatcher { } // Adds transformers to the watcher and updates the chunker, so that it will consider the new transformers. -func (watcher *EventWatcher) AddTransformers(initializers []shared.TransformerInitializer) { +func (watcher *EventWatcher) AddTransformers(initializers []transformer.TransformerInitializer) { var contractAddresses []common.Address var topic0s []common.Hash - var configs []shared.TransformerConfig + var configs []transformer.TransformerConfig for _, initializer := range initializers { - transformer := initializer(watcher.DB) - watcher.Transformers = append(watcher.Transformers, transformer) + t := initializer(watcher.DB) + watcher.Transformers = append(watcher.Transformers, t) - config := transformer.GetConfig() + config := t.GetConfig() configs = append(configs, config) if watcher.StartingBlock == nil { @@ -65,7 +70,7 @@ func (watcher *EventWatcher) AddTransformers(initializers []shared.TransformerIn watcher.StartingBlock = &config.StartingBlockNumber } - addresses := shared.HexStringsToAddresses(config.ContractAddresses) + addresses := transformer.HexStringsToAddresses(config.ContractAddresses) contractAddresses = append(contractAddresses, addresses...) topic0s = append(topic0s, common.HexToHash(config.Topic)) } @@ -80,13 +85,13 @@ func (watcher *EventWatcher) Execute(recheckHeaders constants.TransformerExecuti return fmt.Errorf("No transformers added to watcher") } - checkedColumnNames, err := shared.GetCheckedColumnNames(watcher.DB) + checkedColumnNames, err := repo.GetCheckedColumnNames(watcher.DB) if err != nil { return err } - notCheckedSQL := shared.CreateNotCheckedSQL(checkedColumnNames, recheckHeaders) + notCheckedSQL := repo.CreateNotCheckedSQL(checkedColumnNames, recheckHeaders) - missingHeaders, err := shared.MissingHeaders(*watcher.StartingBlock, -1, watcher.DB, notCheckedSQL) + missingHeaders, err := repo.MissingHeaders(*watcher.StartingBlock, -1, watcher.DB, notCheckedSQL) if err != nil { log.Error("Fetching of missing headers failed in watcher!") return err @@ -105,10 +110,10 @@ func (watcher *EventWatcher) Execute(recheckHeaders constants.TransformerExecuti // Can't quit early and mark as checked if there are no logs. If we are running continuousLogSync, // not all logs we're interested in might have been fetched. - for _, transformer := range watcher.Transformers { - transformerName := transformer.GetConfig().TransformerName + for _, t := range watcher.Transformers { + transformerName := t.GetConfig().TransformerName logChunk := chunkedLogs[transformerName] - err = transformer.Execute(logChunk, header, constants.HeaderMissing) + err = t.Execute(logChunk, header, constants.HeaderMissing) if err != nil { log.Errorf("%v transformer failed to execute in watcher: %v", transformerName, err) return err diff --git a/libraries/shared/event_watcher_test.go b/libraries/shared/watcher/event_watcher_test.go similarity index 64% rename from libraries/shared/event_watcher_test.go rename to libraries/shared/watcher/event_watcher_test.go index 485b3682..5d8e2ae1 100644 --- a/libraries/shared/event_watcher_test.go +++ b/libraries/shared/watcher/event_watcher_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared_test +package watcher_test import ( "errors" @@ -25,85 +25,85 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/libraries/shared" + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" + "github.com/vulcanize/vulcanizedb/libraries/shared/mocks" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" + "github.com/vulcanize/vulcanizedb/libraries/shared/watcher" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" "github.com/vulcanize/vulcanizedb/pkg/fakes" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks" "github.com/vulcanize/vulcanizedb/test_config" ) -var _ = Describe("EventWatcher", func() { +var _ = Describe("Watcher", func() { It("initialises correctly", func() { db := test_config.NewTestDB(core.Node{ID: "testNode"}) bc := fakes.NewMockBlockChain() - watcher := shared.NewEventWatcher(db, bc) + w := watcher.NewEventWatcher(db, bc) - Expect(watcher.DB).To(Equal(db)) - Expect(watcher.Fetcher).NotTo(BeNil()) - Expect(watcher.Chunker).NotTo(BeNil()) + Expect(w.DB).To(Equal(db)) + Expect(w.Fetcher).NotTo(BeNil()) + Expect(w.Chunker).NotTo(BeNil()) }) It("adds transformers", func() { - watcher := shared.NewEventWatcher(nil, nil) + w := watcher.NewEventWatcher(nil, nil) fakeTransformer := &mocks.MockTransformer{} fakeTransformer.SetTransformerConfig(mocks.FakeTransformerConfig) - watcher.AddTransformers([]shared2.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + w.AddTransformers([]transformer.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) - Expect(len(watcher.Transformers)).To(Equal(1)) - Expect(watcher.Transformers).To(ConsistOf(fakeTransformer)) - Expect(watcher.Topics).To(Equal([]common.Hash{common.HexToHash("FakeTopic")})) - Expect(watcher.Addresses).To(Equal([]common.Address{common.HexToAddress("FakeAddress")})) + Expect(len(w.Transformers)).To(Equal(1)) + Expect(w.Transformers).To(ConsistOf(fakeTransformer)) + Expect(w.Topics).To(Equal([]common.Hash{common.HexToHash("FakeTopic")})) + Expect(w.Addresses).To(Equal([]common.Address{common.HexToAddress("FakeAddress")})) }) It("adds transformers from multiple sources", func() { - watcher := shared.NewEventWatcher(nil, nil) + w := watcher.NewEventWatcher(nil, nil) fakeTransformer1 := &mocks.MockTransformer{} fakeTransformer1.SetTransformerConfig(mocks.FakeTransformerConfig) fakeTransformer2 := &mocks.MockTransformer{} fakeTransformer2.SetTransformerConfig(mocks.FakeTransformerConfig) - watcher.AddTransformers([]shared2.TransformerInitializer{fakeTransformer1.FakeTransformerInitializer}) - watcher.AddTransformers([]shared2.TransformerInitializer{fakeTransformer2.FakeTransformerInitializer}) + w.AddTransformers([]transformer.TransformerInitializer{fakeTransformer1.FakeTransformerInitializer}) + w.AddTransformers([]transformer.TransformerInitializer{fakeTransformer2.FakeTransformerInitializer}) - Expect(len(watcher.Transformers)).To(Equal(2)) - Expect(watcher.Topics).To(Equal([]common.Hash{common.HexToHash("FakeTopic"), + Expect(len(w.Transformers)).To(Equal(2)) + Expect(w.Topics).To(Equal([]common.Hash{common.HexToHash("FakeTopic"), common.HexToHash("FakeTopic")})) - Expect(watcher.Addresses).To(Equal([]common.Address{common.HexToAddress("FakeAddress"), + Expect(w.Addresses).To(Equal([]common.Address{common.HexToAddress("FakeAddress"), common.HexToAddress("FakeAddress")})) }) It("calculates earliest starting block number", func() { fakeTransformer1 := &mocks.MockTransformer{} - fakeTransformer1.SetTransformerConfig(shared2.TransformerConfig{StartingBlockNumber: 5}) + fakeTransformer1.SetTransformerConfig(transformer.TransformerConfig{StartingBlockNumber: 5}) fakeTransformer2 := &mocks.MockTransformer{} - fakeTransformer2.SetTransformerConfig(shared2.TransformerConfig{StartingBlockNumber: 3}) + fakeTransformer2.SetTransformerConfig(transformer.TransformerConfig{StartingBlockNumber: 3}) - watcher := shared.NewEventWatcher(nil, nil) - watcher.AddTransformers([]shared2.TransformerInitializer{ + w := watcher.NewEventWatcher(nil, nil) + w.AddTransformers([]transformer.TransformerInitializer{ fakeTransformer1.FakeTransformerInitializer, fakeTransformer2.FakeTransformerInitializer, }) - Expect(*watcher.StartingBlock).To(Equal(int64(3))) + Expect(*w.StartingBlock).To(Equal(int64(3))) }) It("returns an error when run without transformers", func() { - watcher := shared.NewEventWatcher(nil, nil) - err := watcher.Execute(constants.HeaderMissing) + w := watcher.NewEventWatcher(nil, nil) + err := w.Execute(constants.HeaderMissing) Expect(err).To(MatchError("No transformers added to watcher")) }) Describe("with missing headers", func() { var ( db *postgres.DB - watcher shared.EventWatcher + w watcher.EventWatcher mockBlockChain fakes.MockBlockChain headerRepository repositories.HeaderRepository repository mocks.MockWatcherRepository @@ -118,27 +118,25 @@ var _ = Describe("EventWatcher", func() { Expect(err).NotTo(HaveOccurred()) repository = mocks.MockWatcherRepository{} - watcher = shared.NewEventWatcher(db, &mockBlockChain) + w = watcher.NewEventWatcher(db, &mockBlockChain) }) It("executes each transformer", func() { fakeTransformer := &mocks.MockTransformer{} - watcher.AddTransformers([]shared2.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + w.AddTransformers([]transformer.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) repository.SetMissingHeaders([]core.Header{fakes.FakeHeader}) - err := watcher.Execute(constants.HeaderMissing) - + err := w.Execute(constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) Expect(fakeTransformer.ExecuteWasCalled).To(BeTrue()) }) It("returns an error if transformer returns an error", func() { fakeTransformer := &mocks.MockTransformer{ExecuteError: errors.New("Something bad happened")} - watcher.AddTransformers([]shared2.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + w.AddTransformers([]transformer.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) repository.SetMissingHeaders([]core.Header{fakes.FakeHeader}) - err := watcher.Execute(constants.HeaderMissing) - + err := w.Execute(constants.HeaderMissing) Expect(err).To(HaveOccurred()) Expect(fakeTransformer.ExecuteWasCalled).To(BeFalse()) }) @@ -147,10 +145,10 @@ var _ = Describe("EventWatcher", func() { transformerA := &mocks.MockTransformer{} transformerB := &mocks.MockTransformer{} - configA := shared2.TransformerConfig{TransformerName: "transformerA", + configA := transformer.TransformerConfig{TransformerName: "transformerA", ContractAddresses: []string{"0x000000000000000000000000000000000000000A"}, Topic: "0xA"} - configB := shared2.TransformerConfig{TransformerName: "transformerB", + configB := transformer.TransformerConfig{TransformerName: "transformerB", ContractAddresses: []string{"0x000000000000000000000000000000000000000b"}, Topic: "0xB"} @@ -164,11 +162,11 @@ var _ = Describe("EventWatcher", func() { mockBlockChain.SetGetEthLogsWithCustomQueryReturnLogs([]types.Log{logA, logB}) repository.SetMissingHeaders([]core.Header{fakes.FakeHeader}) - watcher = shared.NewEventWatcher(db, &mockBlockChain) - watcher.AddTransformers([]shared2.TransformerInitializer{ + w = watcher.NewEventWatcher(db, &mockBlockChain) + w.AddTransformers([]transformer.TransformerInitializer{ transformerA.FakeTransformerInitializer, transformerB.FakeTransformerInitializer}) - err := watcher.Execute(constants.HeaderMissing) + err := w.Execute(constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) Expect(transformerA.PassedLogs).To(Equal([]types.Log{logA})) Expect(transformerB.PassedLogs).To(Equal([]types.Log{logB})) @@ -184,17 +182,17 @@ var _ = Describe("EventWatcher", func() { It("fetches logs for added transformers", func() { addresses := []string{"0xA", "0xB"} topic := "0x1" - fakeTransformer.SetTransformerConfig(shared2.TransformerConfig{ + fakeTransformer.SetTransformerConfig(transformer.TransformerConfig{ Topic: topic, ContractAddresses: addresses}) - watcher.AddTransformers([]shared2.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + w.AddTransformers([]transformer.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) - err := watcher.Execute(constants.HeaderMissing) + err := w.Execute(constants.HeaderMissing) Expect(err).NotTo(HaveOccurred()) fakeHash := common.HexToHash(fakes.FakeHeader.Hash) mockBlockChain.AssertGetEthLogsWithCustomQueryCalledWith(ethereum.FilterQuery{ BlockHash: &fakeHash, - Addresses: shared2.HexStringsToAddresses(addresses), + Addresses: transformer.HexStringsToAddresses(addresses), Topics: [][]common.Hash{{common.HexToHash(topic)}}, }) }) @@ -203,8 +201,8 @@ var _ = Describe("EventWatcher", func() { fetcherError := errors.New("FetcherError") mockBlockChain.SetGetEthLogsWithCustomQueryErr(fetcherError) - watcher.AddTransformers([]shared2.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) - err := watcher.Execute(constants.HeaderMissing) + w.AddTransformers([]transformer.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + err := w.Execute(constants.HeaderMissing) Expect(err).To(MatchError(fetcherError)) }) }) diff --git a/libraries/shared/storage_watcher.go b/libraries/shared/watcher/storage_watcher.go similarity index 72% rename from libraries/shared/storage_watcher.go rename to libraries/shared/watcher/storage_watcher.go index 49dea19e..87d078a0 100644 --- a/libraries/shared/storage_watcher.go +++ b/libraries/shared/watcher/storage_watcher.go @@ -14,30 +14,32 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared +package watcher import ( - "github.com/ethereum/go-ethereum/common" - "github.com/sirupsen/logrus" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/storage" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" "reflect" "strings" + "github.com/ethereum/go-ethereum/common" + "github.com/sirupsen/logrus" + + "github.com/vulcanize/vulcanizedb/libraries/shared/storage" + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" + "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" "github.com/vulcanize/vulcanizedb/pkg/fs" ) type StorageWatcher struct { db *postgres.DB tailer fs.Tailer - Queue IStorageQueue - Transformers map[common.Address]storage.Transformer + Queue storage.IStorageQueue + Transformers map[common.Address]transformer.StorageTransformer } func NewStorageWatcher(tailer fs.Tailer, db *postgres.DB) StorageWatcher { - transformers := make(map[common.Address]storage.Transformer) - queue := NewStorageQueue(db) + transformers := make(map[common.Address]transformer.StorageTransformer) + queue := storage.NewStorageQueue(db) return StorageWatcher{ db: db, tailer: tailer, @@ -46,7 +48,7 @@ func NewStorageWatcher(tailer fs.Tailer, db *postgres.DB) StorageWatcher { } } -func (watcher StorageWatcher) AddTransformers(initializers []storage.TransformerInitializer) { +func (watcher StorageWatcher) AddTransformers(initializers []transformer.StorageTransformerInitializer) { for _, initializer := range initializers { transformer := initializer(watcher.db) watcher.Transformers[transformer.ContractAddress()] = transformer @@ -59,13 +61,13 @@ func (watcher StorageWatcher) Execute() error { return tailErr } for line := range t.Lines { - row, parseErr := shared.FromStrings(strings.Split(line.Text, ",")) + row, parseErr := utils.FromStrings(strings.Split(line.Text, ",")) if parseErr != nil { return parseErr } transformer, ok := watcher.Transformers[row.Contract] if !ok { - logrus.Warn(shared.ErrContractNotFound{Contract: row.Contract.Hex()}.Error()) + logrus.Warn(utils.ErrContractNotFound{Contract: row.Contract.Hex()}.Error()) continue } executeErr := transformer.Execute(row) @@ -85,5 +87,5 @@ func (watcher StorageWatcher) Execute() error { } func isKeyNotFound(executeErr error) bool { - return reflect.TypeOf(executeErr) == reflect.TypeOf(shared.ErrStorageKeyNotFound{}) + return reflect.TypeOf(executeErr) == reflect.TypeOf(utils.ErrStorageKeyNotFound{}) } diff --git a/libraries/shared/storage_watcher_test.go b/libraries/shared/watcher/storage_watcher_test.go similarity index 67% rename from libraries/shared/storage_watcher_test.go rename to libraries/shared/watcher/storage_watcher_test.go index e0c67740..4a073be3 100644 --- a/libraries/shared/storage_watcher_test.go +++ b/libraries/shared/watcher/storage_watcher_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared_test +package watcher_test import ( "errors" @@ -30,12 +30,12 @@ import ( . "github.com/onsi/gomega" "github.com/sirupsen/logrus" - "github.com/vulcanize/vulcanizedb/libraries/shared" + "github.com/vulcanize/vulcanizedb/libraries/shared/mocks" + "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer" + "github.com/vulcanize/vulcanizedb/libraries/shared/watcher" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/storage" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks" "github.com/vulcanize/vulcanizedb/test_config" ) @@ -43,39 +43,39 @@ var _ = Describe("Storage Watcher", func() { It("adds transformers", func() { fakeAddress := common.HexToAddress("0x12345") fakeTransformer := &mocks.MockStorageTransformer{Address: fakeAddress} - watcher := shared.NewStorageWatcher(&fakes.MockTailer{}, test_config.NewTestDB(core.Node{})) + w := watcher.NewStorageWatcher(&fakes.MockTailer{}, test_config.NewTestDB(core.Node{})) - watcher.AddTransformers([]storage.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + w.AddTransformers([]transformer.StorageTransformerInitializer{fakeTransformer.FakeTransformerInitializer}) - Expect(watcher.Transformers[fakeAddress]).To(Equal(fakeTransformer)) + Expect(w.Transformers[fakeAddress]).To(Equal(fakeTransformer)) }) It("reads the tail of the storage diffs file", func() { mockTailer := fakes.NewMockTailer() - watcher := shared.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) + w := watcher.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) assert(func(err error) { Expect(err).To(BeNil()) Expect(mockTailer.TailCalled).To(BeTrue()) - }, watcher, mockTailer, []*tail.Line{}) + }, w, mockTailer, []*tail.Line{}) }) It("returns error if row parsing fails", func() { mockTailer := fakes.NewMockTailer() - watcher := shared.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) + w := watcher.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) line := &tail.Line{Text: "oops"} assert(func(err error) { Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared2.ErrRowMalformed{Length: 1})) - }, watcher, mockTailer, []*tail.Line{line}) + Expect(err).To(MatchError(utils.ErrRowMalformed{Length: 1})) + }, w, mockTailer, []*tail.Line{line}) }) It("logs error if no transformer can parse storage row", func() { mockTailer := fakes.NewMockTailer() address := common.HexToAddress("0x12345") line := getFakeLine(address.Bytes()) - watcher := shared.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) + w := watcher.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) tempFile, err := ioutil.TempFile("", "log") defer os.Remove(tempFile.Name()) Expect(err).NotTo(HaveOccurred()) @@ -85,24 +85,24 @@ var _ = Describe("Storage Watcher", func() { Expect(err).NotTo(HaveOccurred()) logContent, readErr := ioutil.ReadFile(tempFile.Name()) Expect(readErr).NotTo(HaveOccurred()) - Expect(string(logContent)).To(ContainSubstring(shared2.ErrContractNotFound{Contract: address.Hex()}.Error())) - }, watcher, mockTailer, []*tail.Line{line}) + Expect(string(logContent)).To(ContainSubstring(utils.ErrContractNotFound{Contract: address.Hex()}.Error())) + }, w, mockTailer, []*tail.Line{line}) }) It("executes transformer with storage row", func() { address := []byte{1, 2, 3} line := getFakeLine(address) mockTailer := fakes.NewMockTailer() - watcher := shared.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) + w := watcher.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) fakeTransformer := &mocks.MockStorageTransformer{Address: common.BytesToAddress(address)} - watcher.AddTransformers([]storage.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + w.AddTransformers([]transformer.StorageTransformerInitializer{fakeTransformer.FakeTransformerInitializer}) assert(func(err error) { Expect(err).To(BeNil()) - expectedRow, err := shared2.FromStrings(strings.Split(line.Text, ",")) + expectedRow, err := utils.FromStrings(strings.Split(line.Text, ",")) Expect(err).NotTo(HaveOccurred()) Expect(fakeTransformer.PassedRow).To(Equal(expectedRow)) - }, watcher, mockTailer, []*tail.Line{line}) + }, w, mockTailer, []*tail.Line{line}) }) Describe("when executing transformer fails", func() { @@ -110,30 +110,30 @@ var _ = Describe("Storage Watcher", func() { address := []byte{1, 2, 3} line := getFakeLine(address) mockTailer := fakes.NewMockTailer() - watcher := shared.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) + w := watcher.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) mockQueue := &mocks.MockStorageQueue{} - watcher.Queue = mockQueue - keyNotFoundError := shared2.ErrStorageKeyNotFound{Key: "unknown_storage_key"} + w.Queue = mockQueue + keyNotFoundError := utils.ErrStorageKeyNotFound{Key: "unknown_storage_key"} fakeTransformer := &mocks.MockStorageTransformer{Address: common.BytesToAddress(address), ExecuteErr: keyNotFoundError} - watcher.AddTransformers([]storage.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + w.AddTransformers([]transformer.StorageTransformerInitializer{fakeTransformer.FakeTransformerInitializer}) assert(func(err error) { Expect(err).NotTo(HaveOccurred()) Expect(mockQueue.AddCalled).To(BeTrue()) - }, watcher, mockTailer, []*tail.Line{line}) + }, w, mockTailer, []*tail.Line{line}) }) It("logs error if queuing row fails", func() { address := []byte{1, 2, 3} line := getFakeLine(address) mockTailer := fakes.NewMockTailer() - watcher := shared.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) + w := watcher.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) mockQueue := &mocks.MockStorageQueue{} mockQueue.AddError = fakes.FakeError - watcher.Queue = mockQueue - keyNotFoundError := shared2.ErrStorageKeyNotFound{Key: "unknown_storage_key"} + w.Queue = mockQueue + keyNotFoundError := utils.ErrStorageKeyNotFound{Key: "unknown_storage_key"} fakeTransformer := &mocks.MockStorageTransformer{Address: common.BytesToAddress(address), ExecuteErr: keyNotFoundError} - watcher.AddTransformers([]storage.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + w.AddTransformers([]transformer.StorageTransformerInitializer{fakeTransformer.FakeTransformerInitializer}) tempFile, err := ioutil.TempFile("", "log") defer os.Remove(tempFile.Name()) Expect(err).NotTo(HaveOccurred()) @@ -145,17 +145,17 @@ var _ = Describe("Storage Watcher", func() { logContent, readErr := ioutil.ReadFile(tempFile.Name()) Expect(readErr).NotTo(HaveOccurred()) Expect(string(logContent)).To(ContainSubstring(fakes.FakeError.Error())) - }, watcher, mockTailer, []*tail.Line{line}) + }, w, mockTailer, []*tail.Line{line}) }) It("logs any other error", func() { address := []byte{1, 2, 3} line := getFakeLine(address) mockTailer := fakes.NewMockTailer() - watcher := shared.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) + w := watcher.NewStorageWatcher(mockTailer, test_config.NewTestDB(core.Node{})) executionError := errors.New("storage watcher failed attempting to execute transformer") fakeTransformer := &mocks.MockStorageTransformer{Address: common.BytesToAddress(address), ExecuteErr: executionError} - watcher.AddTransformers([]storage.TransformerInitializer{fakeTransformer.FakeTransformerInitializer}) + w.AddTransformers([]transformer.StorageTransformerInitializer{fakeTransformer.FakeTransformerInitializer}) tempFile, err := ioutil.TempFile("", "log") defer os.Remove(tempFile.Name()) Expect(err).NotTo(HaveOccurred()) @@ -166,12 +166,12 @@ var _ = Describe("Storage Watcher", func() { logContent, readErr := ioutil.ReadFile(tempFile.Name()) Expect(readErr).NotTo(HaveOccurred()) Expect(string(logContent)).To(ContainSubstring(executionError.Error())) - }, watcher, mockTailer, []*tail.Line{line}) + }, w, mockTailer, []*tail.Line{line}) }) }) }) -func assert(assertion func(err error), watcher shared.StorageWatcher, mockTailer *fakes.MockTailer, lines []*tail.Line) { +func assert(assertion func(err error), watcher watcher.StorageWatcher, mockTailer *fakes.MockTailer, lines []*tail.Line) { errs := make(chan error, 1) done := make(chan bool, 1) go execute(watcher, errs, done) @@ -190,8 +190,8 @@ func assert(assertion func(err error), watcher shared.StorageWatcher, mockTailer } } -func execute(watcher shared.StorageWatcher, errs chan error, done chan bool) { - err := watcher.Execute() +func execute(w watcher.StorageWatcher, errs chan error, done chan bool) { + err := w.Execute() if err != nil { errs <- err } else { diff --git a/libraries/shared/shared_suite_test.go b/libraries/shared/watcher/watcher_suite_test.go similarity index 94% rename from libraries/shared/shared_suite_test.go rename to libraries/shared/watcher/watcher_suite_test.go index 3e3b5fcc..2425d502 100644 --- a/libraries/shared/shared_suite_test.go +++ b/libraries/shared/watcher/watcher_suite_test.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -package shared_test +package watcher_test import ( log "github.com/sirupsen/logrus" @@ -27,7 +27,7 @@ import ( func TestShared(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "Shared Suite") + RunSpecs(t, "Shared Watcher Suite") } var _ = BeforeSuite(func() { diff --git a/pkg/config/plugin.go b/pkg/config/plugin.go new file mode 100644 index 00000000..ef333380 --- /dev/null +++ b/pkg/config/plugin.go @@ -0,0 +1,117 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package config + +import ( + "path/filepath" + "strings" + + "github.com/vulcanize/vulcanizedb/pkg/plugin/helpers" +) + +type Plugin struct { + Transformers map[string]Transformer + FilePath string + FileName string + Save bool + Home string + Clone bool +} + +type Transformer struct { + Path string + Type TransformerType + MigrationPath string + RepositoryPath string +} + +func (c *Plugin) GetPluginPaths() (string, string, error) { + path, err := helpers.CleanPath(c.FilePath) + if err != nil { + return "", "", err + } + + name := strings.Split(c.FileName, ".")[0] + goFile := filepath.Join(path, name+".go") + soFile := filepath.Join(path, name+".so") + + return goFile, soFile, nil +} + +// Removes duplicate migration paths before returning them +func (c *Plugin) GetMigrationsPaths() (map[string]bool, error) { + paths := make(map[string]bool) + for _, transformer := range c.Transformers { + repo := transformer.RepositoryPath + mig := transformer.MigrationPath + path := filepath.Join("$GOPATH/src", c.Home, "vendor", repo, mig) + cleanPath, err := helpers.CleanPath(path) + if err != nil { + return nil, err + } + paths[cleanPath] = true + } + + return paths, nil +} + +// Removes duplicate repo paths before returning them +func (c *Plugin) GetRepoPaths() map[string]bool { + paths := make(map[string]bool) + for _, transformer := range c.Transformers { + paths[transformer.RepositoryPath] = true + } + + return paths +} + +type TransformerType int + +const ( + UnknownTransformerType TransformerType = iota + EthEvent + EthStorage +) + +func (pt TransformerType) String() string { + names := [...]string{ + "Unknown", + "eth_event", + "eth_storage", + } + + if pt > EthStorage || pt < EthEvent { + return "Unknown" + } + + return names[pt] +} + +func GetTransformerType(str string) TransformerType { + types := [...]TransformerType{ + EthEvent, + EthStorage, + } + + for _, ty := range types { + if ty.String() == str { + return ty + } + } + + return UnknownTransformerType +} diff --git a/pkg/fakes/data.go b/pkg/fakes/data.go index 59a43a2d..07492d40 100644 --- a/pkg/fakes/data.go +++ b/pkg/fakes/data.go @@ -24,8 +24,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/vulcanize/vulcanizedb/libraries/shared/constants" "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" ) var ( diff --git a/pkg/omni/full/transformer/transformer_test.go b/pkg/omni/full/transformer/transformer_test.go index 9d68143c..323a8e77 100644 --- a/pkg/omni/full/transformer/transformer_test.go +++ b/pkg/omni/full/transformer/transformer_test.go @@ -324,7 +324,7 @@ var _ = Describe("Transformer", func() { Expect(res.Address).To(Equal("0x0000000000000000000000000000000000000000")) Expect(res.TokenName).To(Equal("")) - err = db.QueryRowx(fmt.Sprintf("SELECT * FROM full_%s.owner_method WHERE node_ = '0x95832c7a47ff8a7840e28b78ceMADEUPaaf4HASHc186badTHIS288IS625bFAKE' AND block = '6194636'", ensAddr)).StructScan(&res) + err = db.QueryRowx(fmt.Sprintf("SELECT * FROM full_%s.owner_method WHERE node_ = '0x9THIS110dcc444fIS242510c09bbAbe21aFAKEcacNODE82f7b843HASH61ba391' AND block = '6194636'", ensAddr)).StructScan(&res) Expect(err).To(HaveOccurred()) }) diff --git a/pkg/omni/light/transformer/transformer_test.go b/pkg/omni/light/transformer/transformer_test.go index db805532..e776cb0b 100644 --- a/pkg/omni/light/transformer/transformer_test.go +++ b/pkg/omni/light/transformer/transformer_test.go @@ -331,7 +331,7 @@ var _ = Describe("Transformer", func() { Expect(res.Address).To(Equal("0x0000000000000000000000000000000000000000")) Expect(res.TokenName).To(Equal("")) - err = db.QueryRowx(fmt.Sprintf("SELECT * FROM light_%s.owner_method WHERE node_ = '0x95832c7a47ff8a7840e28b78ceMADEUPaaf4HASHc186badTHIS288IS625bFAKE' AND block = '6885696'", ensAddr)).StructScan(&res) + err = db.QueryRowx(fmt.Sprintf("SELECT * FROM light_%s.owner_method WHERE node_ = '0x9THIS110dcc444fIS242510c09bbAbe21aFAKEcacNODE82f7b843HASH61ba391' AND block = '6885696'", ensAddr)).StructScan(&res) Expect(err).To(HaveOccurred()) }) @@ -491,7 +491,7 @@ var _ = Describe("Transformer", func() { Expect(owner.Address).To(Equal("0x0000000000000000000000000000000000000000")) Expect(owner.TokenName).To(Equal("")) - err = db.QueryRowx(fmt.Sprintf("SELECT * FROM light_%s.owner_method WHERE node_ = '0x95832c7a47ff8a7840e28b78ceMADEUPaaf4HASHc186badTHIS288IS625bFAKE' AND block = '6885696'", ensAddr)).StructScan(&owner) + err = db.QueryRowx(fmt.Sprintf("SELECT * FROM light_%s.owner_method WHERE node_ = '0x95832c7a47ff8a7840e28b78ceMADEUPaaf4HASHc186badTHItransformers.8IS625bFAKE' AND block = '6885696'", ensAddr)).StructScan(&owner) Expect(err).To(HaveOccurred()) bal := test_helpers.BalanceOf{} diff --git a/pkg/omni/shared/contract/contract.go b/pkg/omni/shared/contract/contract.go index a916e734..70f3c123 100644 --- a/pkg/omni/shared/contract/contract.go +++ b/pkg/omni/shared/contract/contract.go @@ -18,6 +18,7 @@ package contract import ( "errors" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -78,7 +79,7 @@ func (c *Contract) GenerateFilters() error { for name, event := range c.Events { c.Filters[name] = filters.LogFilter{ - Name: event.Name, + Name: c.Address + "_" + event.Name, FromBlock: c.StartingBlock, ToBlock: -1, Address: common.HexToAddress(c.Address).Hex(), diff --git a/pkg/omni/shared/helpers/test_helpers/database.go b/pkg/omni/shared/helpers/test_helpers/database.go index 4c3c5059..1b9558b4 100644 --- a/pkg/omni/shared/helpers/test_helpers/database.go +++ b/pkg/omni/shared/helpers/test_helpers/database.go @@ -257,17 +257,10 @@ func TearDown(db *postgres.DB) { _, err = tx.Exec(`DELETE FROM receipts`) Expect(err).NotTo(HaveOccurred()) - _, err = tx.Exec(`ALTER TABLE checked_headers -DROP COLUMN IF EXISTS eventName_contractAddr, -DROP COLUMN IF EXISTS eventName_contractAddr2, -DROP COLUMN IF EXISTS eventName_contractAddr3, -DROP COLUMN IF EXISTS methodName_contractAddr, -DROP COLUMN IF EXISTS methodName_contractAddr2, -DROP COLUMN IF EXISTS methodName_contractAddr3, -DROP COLUMN IF EXISTS transfer_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e, -DROP COLUMN IF EXISTS balanceof_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e, -DROP COLUMN IF EXISTS newowner_0x314159265dd8dbb310642f98f50c066173c1259b, -DROP COLUMN IF EXISTS owner_0x314159265dd8dbb310642f98f50c066173c1259b`) + _, err = tx.Exec(`DROP TABLE checked_headers`) + Expect(err).NotTo(HaveOccurred()) + + _, err = tx.Exec(`CREATE TABLE checked_headers (id SERIAL PRIMARY KEY, header_id INTEGER UNIQUE NOT NULL REFERENCES headers (id) ON DELETE CASCADE);`) Expect(err).NotTo(HaveOccurred()) _, err = tx.Exec(`DROP SCHEMA IF EXISTS full_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e CASCADE`) diff --git a/pkg/omni/shared/helpers/test_helpers/mocks/entities.go b/pkg/omni/shared/helpers/test_helpers/mocks/entities.go index 4d865382..69e832d7 100644 --- a/pkg/omni/shared/helpers/test_helpers/mocks/entities.go +++ b/pkg/omni/shared/helpers/test_helpers/mocks/entities.go @@ -129,7 +129,7 @@ var NewOwnerBlock2 = core.Block{ } var ExpectedTransferFilter = filters.LogFilter{ - Name: "Transfer", + Name: constants.TusdContractAddress + "_" + "Transfer", Address: constants.TusdContractAddress, ToBlock: -1, FromBlock: 6194634, @@ -137,7 +137,7 @@ var ExpectedTransferFilter = filters.LogFilter{ } var ExpectedApprovalFilter = filters.LogFilter{ - Name: "Approval", + Name: constants.TusdContractAddress + "_" + "Approval", Address: constants.TusdContractAddress, ToBlock: -1, FromBlock: 6194634, diff --git a/pkg/omni/shared/parser/parser_test.go b/pkg/omni/shared/parser/parser_test.go index 0b7f3aa3..bd8b170d 100644 --- a/pkg/omni/shared/parser/parser_test.go +++ b/pkg/omni/shared/parser/parser_test.go @@ -112,7 +112,7 @@ var _ = Describe("Parser", func() { Expect(abiTy).To(Equal(abi.UintTy)) pgTy = e.Fields[2].PgType - Expect(pgTy).To(Equal("DECIMAL")) + Expect(pgTy).To(Equal("NUMERIC")) _, ok = events["Approval"] Expect(ok).To(Equal(false)) @@ -143,7 +143,7 @@ var _ = Describe("Parser", func() { Expect(abiTy).To(Equal(abi.UintTy)) pgTy = balOf.Return[0].PgType - Expect(pgTy).To(Equal("DECIMAL")) + Expect(pgTy).To(Equal("NUMERIC")) }) @@ -200,7 +200,7 @@ var _ = Describe("Parser", func() { Expect(abiTy).To(Equal(abi.UintTy)) pgTy = balOf.Return[0].PgType - Expect(pgTy).To(Equal("DECIMAL")) + Expect(pgTy).To(Equal("NUMERIC")) }) diff --git a/pkg/omni/shared/types/event.go b/pkg/omni/shared/types/event.go index 8d801d15..af1389e6 100644 --- a/pkg/omni/shared/types/event.go +++ b/pkg/omni/shared/types/event.go @@ -64,7 +64,7 @@ func NewEvent(e abi.Event) Event { case abi.HashTy, abi.AddressTy: fields[i].PgType = "CHARACTER VARYING(66)" case abi.IntTy, abi.UintTy: - fields[i].PgType = "DECIMAL" + fields[i].PgType = "NUMERIC" case abi.BoolTy: fields[i].PgType = "BOOLEAN" case abi.BytesTy, abi.FixedBytesTy: diff --git a/pkg/omni/shared/types/method.go b/pkg/omni/shared/types/method.go index fbd3e25a..1ef3eb8f 100644 --- a/pkg/omni/shared/types/method.go +++ b/pkg/omni/shared/types/method.go @@ -53,7 +53,7 @@ func NewMethod(m abi.Method) Method { case abi.HashTy, abi.AddressTy: inputs[i].PgType = "CHARACTER VARYING(66)" case abi.IntTy, abi.UintTy: - inputs[i].PgType = "DECIMAL" + inputs[i].PgType = "NUMERIC" case abi.BoolTy: inputs[i].PgType = "BOOLEAN" case abi.BytesTy, abi.FixedBytesTy: @@ -77,7 +77,7 @@ func NewMethod(m abi.Method) Method { case abi.HashTy, abi.AddressTy: outputs[i].PgType = "CHARACTER VARYING(66)" case abi.IntTy, abi.UintTy: - outputs[i].PgType = "DECIMAL" + outputs[i].PgType = "NUMERIC" case abi.BoolTy: outputs[i].PgType = "BOOLEAN" case abi.BytesTy, abi.FixedBytesTy: diff --git a/pkg/plugin/builder/builder.go b/pkg/plugin/builder/builder.go new file mode 100644 index 00000000..993a81ba --- /dev/null +++ b/pkg/plugin/builder/builder.go @@ -0,0 +1,146 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package builder + +import ( + "errors" + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/vulcanize/vulcanizedb/pkg/config" + "github.com/vulcanize/vulcanizedb/pkg/plugin/helpers" +) + +// Interface for compile Go code written by the +// PluginWriter into a shared object (.so file) +// which can be used loaded as a plugin +type PluginBuilder interface { + BuildPlugin() error + CleanUp() error +} + +type builder struct { + GenConfig config.Plugin + dependencies []string + tmpVenDirs []string // Keep track of temp vendor directories + goFile string // Keep track of goFile name +} + +// Requires populated plugin config +func NewPluginBuilder(gc config.Plugin) *builder { + return &builder{ + GenConfig: gc, + tmpVenDirs: make([]string, 0), + } +} + +func (b *builder) BuildPlugin() error { + // Get plugin .go and .so file paths + var err error + var soFile string + b.goFile, soFile, err = b.GenConfig.GetPluginPaths() + if err != nil { + return err + } + + // setup env to build plugin + err = b.setupBuildEnv() + if err != nil { + return err + } + + // Build the .go file into a .so plugin + err = exec.Command("go", "build", "-buildmode=plugin", "-o", soFile, b.goFile).Run() + if err != nil { + return errors.New(fmt.Sprintf("unable to build .so file: %s", err.Error())) + } + return nil +} + +// Sets up temporary vendor libs needed for plugin build +// This is to work around a conflict between plugins and vendoring (https://github.com/golang/go/issues/20481) +func (b *builder) setupBuildEnv() error { + // TODO: Less hacky way of handling plugin build deps + vendorPath, err := helpers.CleanPath(filepath.Join("$GOPATH/src", b.GenConfig.Home, "vendor")) + if err != nil { + return err + } + + repoPaths := b.GenConfig.GetRepoPaths() + + // Import transformer dependencies so that we can build our plugin + for importPath := range repoPaths { + dstPath := filepath.Join(vendorPath, importPath) + // When testing on Travis we need to clone the libs + if b.GenConfig.Clone { + // And if we want to be able to work with a private repo we need to use ssh instead of https + // and upload a permissioned ssh key to travis before deploying tests there + index := strings.Index(importPath, "/") + gitPath := importPath[:index] + ":" + importPath[index+1:] + importURL := "git@" + gitPath + ".git" + err = exec.Command("git", "clone", importURL, dstPath).Run() + if err != nil { + return errors.New(fmt.Sprintf("unable to clone transformer dependency from %s to %s: %s", importPath, dstPath, err.Error())) + } + } else { // If not on Travis we can work with libs at $GOPATH + srcDir, err := helpers.CleanPath(filepath.Join("$GOPATH/src", importPath)) + if err != nil { + return err + } + sp := strings.Split(dstPath, "/") + spj := strings.Join(sp[:len(sp)-1], "/") + err = exec.Command("rsync", "-a", srcDir, spj).Run() + if err != nil { + return errors.New(fmt.Sprintf("unable to copy transformer dependency from %s to %s: %s", srcDir, dstPath, err.Error())) + } + } + // Have to clear out the copied over vendor lib or plugin won't build (see issue above) + err := os.RemoveAll(filepath.Join(dstPath, "vendor")) + if err != nil { + return err + } + // Keep track of this vendor directory to clear later + b.tmpVenDirs = append(b.tmpVenDirs, dstPath) + } + + return nil +} + +// Used to clear all of the tmp vendor libs used to build the plugin +// Also clears the go file if saving it has not been specified in the config +// Do not call until after the MigrationManager has performed its operations +// as it needs to pull the db migrations from the tmpVenDirs +func (b *builder) CleanUp() error { + if !b.GenConfig.Save { + err := helpers.ClearFiles(b.goFile) + if err != nil { + return err + } + } + + for _, venDir := range b.tmpVenDirs { + err := os.RemoveAll(venDir) + if err != nil { + return err + } + } + + return nil +} diff --git a/pkg/plugin/generator.go b/pkg/plugin/generator.go new file mode 100644 index 00000000..c5ef1df5 --- /dev/null +++ b/pkg/plugin/generator.go @@ -0,0 +1,68 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package plugin + +import ( + "errors" + "github.com/vulcanize/vulcanizedb/pkg/config" + "github.com/vulcanize/vulcanizedb/pkg/plugin/builder" + "github.com/vulcanize/vulcanizedb/pkg/plugin/manager" + "github.com/vulcanize/vulcanizedb/pkg/plugin/writer" +) + +// Generator is the top-level interface for creating transformer plugins +type Generator interface { + GenerateExporterPlugin() error +} + +type generator struct { + writer.PluginWriter + builder.PluginBuilder + manager.MigrationManager +} + +// Creates a new generator from a plugin and database config +func NewGenerator(gc config.Plugin, dbc config.Database) (*generator, error) { + if len(gc.Transformers) < 1 { + return nil, errors.New("plugin generator is not configured with any transformers") + } + return &generator{ + PluginWriter: writer.NewPluginWriter(gc), + PluginBuilder: builder.NewPluginBuilder(gc), + MigrationManager: manager.NewMigrationManager(gc, dbc), + }, nil +} + +// Generates plugin for the transformer initializers specified in the generator config +// Writes plugin code => Sets up build environment => Builds .so file => Performs db migrations for the plugin transformers => Clean up +func (g *generator) GenerateExporterPlugin() error { + // Use plugin writer interface to write the plugin code + err := g.PluginWriter.WritePlugin() + if err != nil { + return err + } + // Clean up temporary files and directories when we are done + defer g.PluginBuilder.CleanUp() + // Use plugin builder interface to setup build environment and compile .go file into a .so file + err = g.PluginBuilder.BuildPlugin() + if err != nil { + return err + } + + // Perform db migrations for the transformers + return g.MigrationManager.RunMigrations() +} diff --git a/pkg/plugin/helpers/helpers.go b/pkg/plugin/helpers/helpers.go new file mode 100644 index 00000000..2885cbef --- /dev/null +++ b/pkg/plugin/helpers/helpers.go @@ -0,0 +1,77 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package helpers + +import ( + "io" + "os" + "path/filepath" + "strings" + "syscall" + + "github.com/mitchellh/go-homedir" +) + +func CleanPath(str string) (string, error) { + path, err := homedir.Expand(filepath.Clean(str)) + if err != nil { + return "", err + } + if strings.Contains(path, "$GOPATH") { + env := os.Getenv("GOPATH") + spl := strings.Split(path, "$GOPATH")[1] + path = filepath.Join(env, spl) + } + + return path, nil +} + +func ClearFiles(files ...string) error { + for _, file := range files { + if _, err := os.Stat(file); err == nil { + err = os.Remove(file) + if err != nil { + return err + } + } else if os.IsNotExist(err) { + continue + } else { + return err + } + } + + return nil +} + +func CopyFile(src, dst string) error { + in, err := os.Open(src) + if err != nil { + return err + } + defer in.Close() + out, err := os.OpenFile(dst, syscall.O_CREAT|syscall.O_EXCL|os.O_WRONLY, os.FileMode(0666)) // Doesn't overwrite files + if err != nil { + return err + } + defer out.Close() + + _, err = io.Copy(out, in) + if err != nil { + return err + } + return out.Close() +} diff --git a/pkg/plugin/manager/manager.go b/pkg/plugin/manager/manager.go new file mode 100644 index 00000000..a5afd965 --- /dev/null +++ b/pkg/plugin/manager/manager.go @@ -0,0 +1,135 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package manager + +import ( + "errors" + "fmt" + "github.com/vulcanize/vulcanizedb/pkg/config" + "github.com/vulcanize/vulcanizedb/pkg/plugin/helpers" + "io/ioutil" + "os" + "os/exec" + "path/filepath" +) + +// Interface for managing the db migrations for plugin transformers +type MigrationManager interface { + RunMigrations() error +} + +type manager struct { + GenConfig config.Plugin + DBConfig config.Database + tmpMigDir string +} + +// Manager requires both filled in generator and database configs +func NewMigrationManager(gc config.Plugin, dbc config.Database) *manager { + return &manager{ + GenConfig: gc, + DBConfig: dbc, + } +} + +func (m *manager) RunMigrations() error { + // Get paths to db migrations from the plugin config + paths, err := m.GenConfig.GetMigrationsPaths() + if err != nil { + return err + } + if len(paths) < 1 { + return nil + } + // Init directory for temporary copies of migrations + err = m.setupMigrationEnv() + if err != nil { + return err + } + defer m.cleanUp() + // Creates copies of migrations for all the plugin's transformers in a tmp dir + err = m.createMigrationCopies(paths) + if err != nil { + return err + } + // Fix the migrations + cmd := exec.Command("goose", "fix") + cmd.Dir = m.tmpMigDir + err = cmd.Run() + if err != nil { + return errors.New(fmt.Sprintf("version fixing for plugin migrations failed: %s", err.Error())) + } + // Run the copied migrations with goose + pgStr := fmt.Sprintf("postgres://%s:%d/%s?sslmode=disable", m.DBConfig.Hostname, m.DBConfig.Port, m.DBConfig.Name) + cmd = exec.Command("goose", "postgres", pgStr, "up") + cmd.Dir = m.tmpMigDir + err = cmd.Run() + if err != nil { + return errors.New(fmt.Sprintf("db migrations for plugin transformers failed: %s", err.Error())) + } + + return nil +} + +// Setup a temporary directory to hold transformer db migrations +func (m *manager) setupMigrationEnv() error { + var err error + m.tmpMigDir, err = helpers.CleanPath(filepath.Join("$GOPATH/src", m.GenConfig.Home+".plugin_migrations")) + if err != nil { + return err + } + err = os.RemoveAll(m.tmpMigDir) + if err != nil { + return errors.New(fmt.Sprintf("unable to remove file found at %s where tmp directory needs to be written", m.tmpMigDir)) + } + err = os.Mkdir(m.tmpMigDir, os.FileMode(os.ModePerm)) + if err != nil { + return errors.New(fmt.Sprintf("unable to create temporary migration directory %s", m.tmpMigDir)) + } + + return nil +} + +// Create copies of db migrations from vendored libs +func (m *manager) createMigrationCopies(paths map[string]bool) error { + // Iterate through migration paths to find migration directory + for path := range paths { + dir, err := ioutil.ReadDir(path) + if err != nil { + return err + } + // For each file in the directory check if it is a migration + for _, file := range dir { + if file.IsDir() || filepath.Ext(file.Name()) != ".sql" { + continue + } + src := filepath.Join(path, file.Name()) + dst := filepath.Join(m.tmpMigDir, file.Name()) + // and if it is make a copy of it to our tmp migration directory + err = helpers.CopyFile(src, dst) + if err != nil { + return err + } + } + } + + return nil +} + +func (m *manager) cleanUp() error { + return os.RemoveAll(m.tmpMigDir) +} diff --git a/pkg/plugin/test_helpers/database.go b/pkg/plugin/test_helpers/database.go new file mode 100644 index 00000000..8edea9c2 --- /dev/null +++ b/pkg/plugin/test_helpers/database.go @@ -0,0 +1,84 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package test_helpers + +import ( + "fmt" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rpc" + . "github.com/onsi/gomega" + + "github.com/vulcanize/vulcanizedb/pkg/config" + "github.com/vulcanize/vulcanizedb/pkg/core" + "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" + "github.com/vulcanize/vulcanizedb/pkg/geth" + "github.com/vulcanize/vulcanizedb/pkg/geth/client" + rpc2 "github.com/vulcanize/vulcanizedb/pkg/geth/converters/rpc" + "github.com/vulcanize/vulcanizedb/pkg/geth/node" +) + +func SetupDBandBC() (*postgres.DB, core.BlockChain) { + infuraIPC := "http://kovan0.vulcanize.io:8545" + rawRpcClient, err := rpc.Dial(infuraIPC) + Expect(err).NotTo(HaveOccurred()) + rpcClient := client.NewRpcClient(rawRpcClient, infuraIPC) + ethClient := ethclient.NewClient(rawRpcClient) + blockChainClient := client.NewEthClient(ethClient) + node := node.MakeNode(rpcClient) + transactionConverter := rpc2.NewRpcTransactionConverter(ethClient) + blockChain := geth.NewBlockChain(blockChainClient, rpcClient, node, transactionConverter) + + db, err := postgres.NewDB(config.Database{ + Hostname: "localhost", + Name: "vulcanize_private", + Port: 5432, + }, blockChain.Node()) + Expect(err).NotTo(HaveOccurred()) + + return db, blockChain +} + +func TearDown(db *postgres.DB) { + tx, err := db.Begin() + Expect(err).NotTo(HaveOccurred()) + + _, err = tx.Exec(`DELETE FROM headers`) + Expect(err).NotTo(HaveOccurred()) + + _, err = tx.Exec(`DELETE FROM logs`) + Expect(err).NotTo(HaveOccurred()) + + _, err = tx.Exec(`DELETE FROM log_filters`) + Expect(err).NotTo(HaveOccurred()) + + _, err = tx.Exec(`DELETE FROM transactions`) + Expect(err).NotTo(HaveOccurred()) + + _, err = tx.Exec(`DELETE FROM receipts`) + Expect(err).NotTo(HaveOccurred()) + + _, err = tx.Exec(`DELETE FROM checked_headers`) + Expect(err).NotTo(HaveOccurred()) + + err = tx.Commit() + Expect(err).NotTo(HaveOccurred()) +} + +func DropTestSchema(db *postgres.DB, schema string) { + _, err := db.Exec(fmt.Sprintf(`DROP SCHEMA IF EXISTS %s CASCADE`, schema)) + Expect(err).NotTo(HaveOccurred()) +} diff --git a/pkg/plugin/test_helpers/test/README.md b/pkg/plugin/test_helpers/test/README.md new file mode 100644 index 00000000..4f86bf4b --- /dev/null +++ b/pkg/plugin/test_helpers/test/README.md @@ -0,0 +1,3 @@ +### Test + +This empty directory is for holding the temporary .so and .go files generated during the generator_tests \ No newline at end of file diff --git a/pkg/plugin/writer/writer.go b/pkg/plugin/writer/writer.go new file mode 100644 index 00000000..7ab4ccd8 --- /dev/null +++ b/pkg/plugin/writer/writer.go @@ -0,0 +1,119 @@ +// VulcanizeDB +// Copyright © 2018 Vulcanize + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. + +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package writer + +import ( + "errors" + "fmt" + + . "github.com/dave/jennifer/jen" + + "github.com/vulcanize/vulcanizedb/pkg/config" + "github.com/vulcanize/vulcanizedb/pkg/plugin/helpers" +) + +// Interface for writing a .go file for a simple +// plugin that exports the set of transformer +// initializers specified in the config +type PluginWriter interface { + WritePlugin() error +} + +type writer struct { + GenConfig config.Plugin +} + +// Requires populated plugin config +func NewPluginWriter(gc config.Plugin) *writer { + return &writer{ + GenConfig: gc, + } +} + +// Generates the plugin code according to config specification +func (w *writer) WritePlugin() error { + // Setup plugin file paths + goFile, err := w.setupFilePath() + if err != nil { + return err + } + + // Begin code generation + f := NewFile("main") + f.HeaderComment("This is a plugin generated to export the configured transformer initializers") + + // Import pkgs for generic TransformerInitializer interface and specific TransformerInitializers specified in config + f.ImportAlias("github.com/vulcanize/vulcanizedb/libraries/shared/transformer", "interface") + for name, transformer := range w.GenConfig.Transformers { + f.ImportAlias(transformer.RepositoryPath+"/"+transformer.Path, name) + } + + // Collect initializer code + code, err := w.collectTransformers() + if err != nil { + return err + } + + // Create Exporter variable with method to export the set of the imported storage and event transformer initializers + f.Type().Id("exporter").String() + f.Var().Id("Exporter").Id("exporter") + f.Func().Params(Id("e").Id("exporter")).Id("Export").Params().Parens(List( + Index().Qual("github.com/vulcanize/vulcanizedb/libraries/shared/transformer", "TransformerInitializer"), + Index().Qual("github.com/vulcanize/vulcanizedb/libraries/shared/transformer", "StorageTransformerInitializer"), + )).Block(Return( + Index().Qual( + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer", + "TransformerInitializer").Values(code[config.EthEvent]...), + Index().Qual( + "github.com/vulcanize/vulcanizedb/libraries/shared/transformer", + "StorageTransformerInitializer").Values(code[config.EthStorage]...))) // Exports the collected event and storage transformer initializers + + // Write code to destination file + err = f.Save(goFile) + if err != nil { + return errors.New(fmt.Sprintf("failed to save generated .go file: %s\r\n%s", goFile, err.Error())) + } + return nil +} + +// Collect code for various types of initializers +func (w *writer) collectTransformers() (map[config.TransformerType][]Code, error) { + code := make(map[config.TransformerType][]Code) + for _, transformer := range w.GenConfig.Transformers { + path := transformer.RepositoryPath + "/" + transformer.Path + switch transformer.Type { + case config.EthEvent: + code[config.EthEvent] = append(code[config.EthEvent], Qual(path, "TransformerInitializer")) + case config.EthStorage: + code[config.EthStorage] = append(code[config.EthStorage], Qual(path, "StorageTransformerInitializer")) + default: + return nil, errors.New(fmt.Sprintf("invalid transformer type %s", transformer.Type)) + } + } + + return code, nil +} + +// Setup the .go, clear old ones if present +func (w *writer) setupFilePath() (string, error) { + goFile, soFile, err := w.GenConfig.GetPluginPaths() + if err != nil { + return "", err + } + // Clear .go and .so files of the same name if they exist + return goFile, helpers.ClearFiles(goFile, soFile) +} diff --git a/pkg/transformers/DOCUMENTATION.md b/pkg/transformers/DOCUMENTATION.md deleted file mode 100644 index de85a455..00000000 --- a/pkg/transformers/DOCUMENTATION.md +++ /dev/null @@ -1,129 +0,0 @@ -# Transformers - -## Architecture - -Transformers fetch logs from Ethereum, convert/decode them into usable data, and then persist them in postgres. - -A transformer consists of: - -- A fetcher -> Fetches raw logs from the blockchain and encodes them as go datatypes -- A converter -> Converts this raw data into a human friendly representation suitable for consumption in the API -- A repository -> Abstracts the database - -For Maker, vulcanize will be run in `lightSync` mode, so it will store all headers, and then fetchers pull relevant logs by making RPC calls. - -## Event Types - -For Maker there are two main types of log events that we're tracking: - -1. Custom events that are defined in the contract solidity code. -1. `LogNote` events which utilize the [DSNote library](https://github.com/dapphub/ds-note). -1. `Note` events in the `Vat` - -The transformer process for each of these different log types is the same, except for the converting process, as denoted below. - -## Creating a Transformer - -1. Pull an example event (from kovan / ganache etc.) -1. Add event & method sig, contract address, `checked_headers` column name, and label to relevant files in [`constants`](./shared/constants) -1. Write a test for the event sig in [`event_signature_generator_test.go`](./shared/event_signature_generator_test.go) -1. Create DB table (using [`create_migration`](../../scripts/create_migration)) -1. Create columns in `checked_headers` in the _same_ migration -1. Add a line to clean the new table `CleanTestDB` (in [`test_config.go`](../../test_config/test_config.go)) -1. Define `model.go` -1. Create test event in [`test_data`](./test_data) -1. Write converter + converter tests -1. Write repository + repository tests -1. Create converter + repository mocks -1. Create an config object [`shared.TransformerConfig`](./shared/transformer.go) in `config.go` -1. Wire up transformer in [`transformers.go`](./transformers.go), remembering to add it to `TransformerInitializers()` -1. Wire up transformer in [`continuousLogSync.go`](../../cmd/continuousLogSync.go) -1. Manually trigger an event and check that it gets persisted to postgres -1. Create an integration test for the shiny new transformer in [`integration_tests`](./integration_tests) - -**Fetching Logs** - -1. Generate an example raw log event, by either: - - - Pulling the log directly from the Kovan deployment ([address.go](https://github.com/8thlight/maker-vulcanizedb/blob/master/pkg/transformers/shared/constants/address.go)). - - Deploying the contract to a local chain and emiting the event manually. - -1. Fetch the logs from the chain based on the example event's topic zero: - - - The topic zero is based on the keccak-256 hash of the log event's method signature. These are located in [`pkg/transformers/shared/constants/signature.go`](./shared/constants/signature.go). - - Fetching is done in batch from the [`watcher`](../../libraries/shared/watcher.go). - - The logs are then chunked up by the [`chunker`](./shared/log_chunker.go) before being delegated to each transformer. - -**Coverting logs** - -- **Converting most custom events** (such as FlopKick) - - 1. Convert the raw log into a Go struct. - - We've been using [go-ethereum's abigen tool](https://github.com/ethereum/go-ethereum/tree/master/cmd/abigen) to get the contract's ABI, and a Go struct that represents the event log. We will unpack the raw logs into this struct. - - To use abigen: `abigen --sol flip.sol --pkg flip --out {/path/to/output_file}` - - sol: this is the path to the solidity contract - - pkg: a package name for the generated Go code - - out: the file path for the generated Go code (optional) - - the output for `flop.sol` will include the FlopperAbi and the FlopperKick struct: - ```go - type FlopperKick struct { - Id *big.Int - Lot *big.Int - Bid *big.Int - Gal common.Address - End *big.Int - Raw types.Log - } - ``` - - Using go-ethereum's `contract.UnpackLog` method we can unpack the raw log into the FlopperKick struct (which we're referring to as the `entity`). - - See the `ToEntity` method in [`pkg/transformers/flop_kick/converter.go`](./flop_kick/converter.go). - 1. Convert the entity into a database model. See the `ToModel` method in `pkg/transformers/flop_kick/converter`. - -- **Converting Price Feed custom events** - - - Price Feed contracts use the [LogNote event](https://github.com/makerdao/medianizer/blob/master/src/medianizer.sol#L23) - - The LogNote event takes in the value of the price feed as it's sole argument, and does not index it. This means that this value can be taken directly from the log's data, and then properly converted using the `price_feeds.Convert` method (located in the model.go file). - - Since this conversion from raw log to model includes less fields than some others, we've chosen to convert it directly to the database model, skipping the `ToEntity` step. - -- **Converting LogNote events** (such as tend) - - Since LogNote events are a generic structure, they depend on the method signature of the method that is calling them. For example, the `tend` method is called on the [flip.sol contract](https://github.com/makerdao/dss/blob/master/src/flip.sol#L117), and it's method signature looks like this: `tend(uint,uint,uint)`. - - The first four bytes of the Keccak-256 hashed method signature will be located in `topic[0]` on the log. - - The message sender will be in `topic[1]`. - - The first parameter passed to `tend` becomes `topic[2]`. - - The second parameter passed to `tend` will be `topic[3]`. - - Any additional parameters will be in the log's data field. - - More detail is located in the [DSNote repo](https://github.com/dapphub/ds-note). - -**Get all MissingHeaders** - -- Headers are inserted into VulcanizeDB as part of the `lightSync` command. Then for each transformer we check each header for matching logs. -- The MissingHeaders method queries the `checked_headers` table to see if the header has been checked for the given log type. - -**Persist the log record to VulcanizeDB** - -- Each event log has it's own table in the database, as well as it's own column in the `checked_headers` table. - - The `checked_headers` table allows us to keep track of which headers have been checked for a given log type. -- To create a new migration file: `./scripts/create_migration create_flop_kick` - - See `db/migrations/1536942529_create_flop_kick.up.sql`. - - The specific log event tables are all created in the `maker` schema. - - There is a one-many association between `headers` and the log - event tables. This is so that if a header is removed due to a reorg, the associated log event records are also removed. -- To run the migrations: `make migrate HOST=local_host PORT=5432 NAME=vulcanize_private` -- When a new log record is inserted into VulcanizeDB, we also need to make sure to insert a record into the `checked_headers` table for the given log type. -- We have been using the repository pattern (i.e. wrapping all SQL/ORM invocations in isolated namespaces per table) to interact with the database, see the `Create` method in `pkg/transformers/flop_kick/repository.go`. - -**MarkHeaderChecked** - -- There is a chance that a header does not have a log for the given transformer's log type, and in this instance we also want to record that the header has been "checked" so that we don't continue to query that header over and over. -- In the transformer we'll make sure to insert a row for the header indicating that it has been checked for the log type that the transformer is responsible for. - -**Wire each component up in the transformer** - -- We use a [`TransformerInitializer`](./shared/transformer.go) struct for each transformer so that we can inject ethRPC and postgresDB connections as well as configuration data (including the contract address, block range, etc.) into the transformer. -- See any of `pkg/transformers/flop_kick/transformer.go` -- All of the transformers are then initialized in `pkg/transformers/transformers.go` with their configuration. -- The transformers can be executed by using the `continuousLogSync` command, which can be configured to run specific transformers or all transformers. - -## Useful Documents - -[Ethereum Event ABI Specification](https://solidity.readthedocs.io/en/develop/abi-spec.html#events) diff --git a/pkg/transformers/bite/config.go b/pkg/transformers/bite/config.go deleted file mode 100644 index e6fcff04..00000000 --- a/pkg/transformers/bite/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package bite - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetBiteConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.BiteLabel, - ContractAddresses: []string{constants.CatContractAddress()}, - ContractAbi: constants.CatABI(), - Topic: constants.GetBiteSignature(), - StartingBlockNumber: constants.CatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/bite/converter.go b/pkg/transformers/bite/converter.go deleted file mode 100644 index aa367d3c..00000000 --- a/pkg/transformers/bite/converter.go +++ /dev/null @@ -1,94 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package bite - -import ( - "encoding/json" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/geth" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -type BiteConverter struct{} - -func (BiteConverter) ToEntities(contractAbi string, ethLogs []types.Log) ([]interface{}, error) { - var entities []interface{} - for _, ethLog := range ethLogs { - entity := &BiteEntity{} - address := ethLog.Address - abi, err := geth.ParseAbi(contractAbi) - if err != nil { - return nil, err - } - - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - - err = contract.UnpackLog(entity, "Bite", ethLog) - if err != nil { - return nil, err - } - - entity.Raw = ethLog - entity.LogIndex = ethLog.Index - entity.TransactionIndex = ethLog.TxIndex - - entities = append(entities, *entity) - } - - return entities, nil -} - -func (converter BiteConverter) ToModels(entities []interface{}) ([]interface{}, error) { - var models []interface{} - for _, entity := range entities { - biteEntity, ok := entity.(BiteEntity) - if !ok { - return nil, fmt.Errorf("entity of type %T, not %T", entity, BiteEntity{}) - } - - ilk := shared.GetHexWithoutPrefix(biteEntity.Ilk[:]) - urn := shared.GetHexWithoutPrefix(biteEntity.Urn[:]) - ink := biteEntity.Ink - art := biteEntity.Art - iArt := biteEntity.IArt - tab := biteEntity.Tab - flip := biteEntity.Flip - logIdx := biteEntity.LogIndex - txIdx := biteEntity.TransactionIndex - rawLog, err := json.Marshal(biteEntity.Raw) - if err != nil { - return nil, err - } - - model := BiteModel{ - Ilk: ilk, - Urn: urn, - Ink: shared.BigIntToString(ink), - Art: shared.BigIntToString(art), - IArt: shared.BigIntToString(iArt), - Tab: shared.BigIntToString(tab), - NFlip: shared.BigIntToString(flip), - LogIndex: logIdx, - TransactionIndex: txIdx, - Raw: rawLog, - } - models = append(models, model) - } - return models, nil -} diff --git a/pkg/transformers/bite/converter_test.go b/pkg/transformers/bite/converter_test.go deleted file mode 100644 index 6e95a12c..00000000 --- a/pkg/transformers/bite/converter_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package bite_test - -import ( - "encoding/json" - - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/bite" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Bite Converter", func() { - var converter = bite.BiteConverter{} - - Describe("ToEntity", func() { - It("converts an eth log to a bite entity", func() { - entities, err := converter.ToEntities(test_data.KovanCatABI, []types.Log{test_data.EthBiteLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(entities)).To(Equal(1)) - entity := entities[0] - Expect(entity).To(Equal(test_data.BiteEntity)) - }) - - It("returns an error if converting log to entity fails", func() { - _, err := converter.ToEntities("error abi", []types.Log{test_data.EthBiteLog}) - - Expect(err).To(HaveOccurred()) - }) - }) - - Describe("ToModel", func() { - var emptyEntity = bite.BiteEntity{} - - It("converts an Entity to a Model", func() { - models, err := converter.ToModels([]interface{}{test_data.BiteEntity}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - model := models[0] - Expect(model).To(Equal(test_data.BiteModel)) - }) - - It("returns an error if the entity type is wrong", func() { - _, err := converter.ToModels([]interface{}{test_data.WrongEntity{}}) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("entity of type test_data.WrongEntity, not bite.BiteEntity")) - }) - - It("handles nil values", func() { - emptyLog, err := json.Marshal(types.Log{}) - Expect(err).NotTo(HaveOccurred()) - expectedModel := bite.BiteModel{ - Ilk: "0000000000000000000000000000000000000000000000000000000000000000", - Urn: "0000000000000000000000000000000000000000000000000000000000000000", - Ink: "", - Art: "", - IArt: "", - Tab: "", - NFlip: "", - TransactionIndex: 0, - Raw: emptyLog, - } - models, err := converter.ToModels([]interface{}{emptyEntity}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - model := models[0] - Expect(model).To(Equal(expectedModel)) - }) - }) -}) diff --git a/pkg/transformers/bite/entity.go b/pkg/transformers/bite/entity.go deleted file mode 100644 index 16fbdf58..00000000 --- a/pkg/transformers/bite/entity.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package bite - -import ( - "github.com/ethereum/go-ethereum/core/types" - "math/big" -) - -type BiteEntity struct { - Ilk [32]byte - Urn [32]byte - Ink *big.Int - Art *big.Int - Tab *big.Int - Flip *big.Int - IArt *big.Int - LogIndex uint - TransactionIndex uint - Raw types.Log -} diff --git a/pkg/transformers/bite/model.go b/pkg/transformers/bite/model.go deleted file mode 100644 index e2fde40a..00000000 --- a/pkg/transformers/bite/model.go +++ /dev/null @@ -1,30 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package bite - -type BiteModel struct { - Ilk string - Urn string - Ink string - Art string - IArt string - Tab string - NFlip string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/bite/repository.go b/pkg/transformers/bite/repository.go deleted file mode 100644 index 927dc032..00000000 --- a/pkg/transformers/bite/repository.go +++ /dev/null @@ -1,99 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package bite - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type BiteRepository struct { - db *postgres.DB -} - -func (repository *BiteRepository) SetDB(db *postgres.DB) { - repository.db = db -} - -func (repository BiteRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - biteModel, ok := model.(BiteModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, BiteModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(biteModel.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.bite (header_id, ilk, urn, ink, art, iart, tab, nflip, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4::NUMERIC, $5::NUMERIC, $6::NUMERIC, $7::NUMERIC, $8::NUMERIC, $9, $10, $11) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, urn = $3, ink = $4, art = $5, iart = $6, tab = $7, nflip = $8, raw_log = $11;`, - headerID, ilkID, biteModel.Urn, biteModel.Ink, biteModel.Art, biteModel.IArt, biteModel.Tab, biteModel.NFlip, biteModel.LogIndex, biteModel.TransactionIndex, biteModel.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.BiteChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository BiteRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.BiteChecked) -} - -func (repository BiteRepository) MissingHeaders(startingBlockNumber int64, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.BiteChecked) -} - -func (repository BiteRepository) RecheckHeaders(startingBlockNumber int64, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.BiteChecked) -} diff --git a/pkg/transformers/bite/repository_test.go b/pkg/transformers/bite/repository_test.go deleted file mode 100644 index dc0f2b0c..00000000 --- a/pkg/transformers/bite/repository_test.go +++ /dev/null @@ -1,95 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package bite_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/bite" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Bite repository", func() { - var ( - biteRepository bite.BiteRepository - db *postgres.DB - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - biteRepository = bite.BiteRepository{} - biteRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.BiteModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.BiteChecked, - LogEventTableName: "maker.bite", - TestModel: test_data.BiteModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &biteRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists a bite record", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = biteRepository.Create(headerID, []interface{}{test_data.BiteModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbBite bite.BiteModel - err = db.Get(&dbBite, `SELECT ilk, urn, ink, art, tab, nflip, iart, log_idx, tx_idx, raw_log FROM maker.bite WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.BiteModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbBite.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbBite.Urn).To(Equal(test_data.BiteModel.Urn)) - Expect(dbBite.Ink).To(Equal(test_data.BiteModel.Ink)) - Expect(dbBite.Art).To(Equal(test_data.BiteModel.Art)) - Expect(dbBite.Tab).To(Equal(test_data.BiteModel.Tab)) - Expect(dbBite.NFlip).To(Equal(test_data.BiteModel.NFlip)) - Expect(dbBite.IArt).To(Equal(test_data.BiteModel.IArt)) - Expect(dbBite.LogIndex).To(Equal(test_data.BiteModel.LogIndex)) - Expect(dbBite.TransactionIndex).To(Equal(test_data.BiteModel.TransactionIndex)) - Expect(dbBite.Raw).To(MatchJSON(test_data.BiteModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.BiteChecked, - Repository: &biteRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/cat_file/chop_lump/config.go b/pkg/transformers/cat_file/chop_lump/config.go deleted file mode 100644 index 01c32106..00000000 --- a/pkg/transformers/cat_file/chop_lump/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package chop_lump - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetCatFileChopLumpConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.CatFileChopLumpLabel, - ContractAddresses: []string{constants.CatContractAddress()}, - ContractAbi: constants.CatABI(), - Topic: constants.GetCatFileChopLumpSignature(), - StartingBlockNumber: constants.CatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/cat_file/chop_lump/converter.go b/pkg/transformers/cat_file/chop_lump/converter.go deleted file mode 100644 index 753dd76c..00000000 --- a/pkg/transformers/cat_file/chop_lump/converter.go +++ /dev/null @@ -1,84 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package chop_lump - -import ( - "bytes" - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "math/big" -) - -var ( - chop = "chop" - lump = "lump" -) - -type CatFileChopLumpConverter struct{} - -func (CatFileChopLumpConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var results []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - what := string(bytes.Trim(ethLog.Topics[3].Bytes(), "\x00")) - dataBytes := ethLog.Data[len(ethLog.Data)-constants.DataItemLength:] - data := big.NewInt(0).SetBytes(dataBytes).String() - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - result := CatFileChopLumpModel{ - Ilk: ilk, - What: what, - Data: convertData(what, data), - TransactionIndex: ethLog.TxIndex, - LogIndex: ethLog.Index, - Raw: raw, - } - results = append(results, result) - } - return results, nil -} - -func convertData(what, data string) string { - var convertedData string - if what == chop { - convertedData = shared.ConvertToRay(data) - } else if what == lump { - convertedData = shared.ConvertToWad(data) - } - - return convertedData -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - if len(log.Data) < constants.DataItemLength { - return errors.New("log missing data") - } - return nil -} diff --git a/pkg/transformers/cat_file/chop_lump/converter_test.go b/pkg/transformers/cat_file/chop_lump/converter_test.go deleted file mode 100644 index 7f0f0da8..00000000 --- a/pkg/transformers/cat_file/chop_lump/converter_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package chop_lump_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/chop_lump" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Cat file chop lump converter", func() { - var converter chop_lump.CatFileChopLumpConverter - - BeforeEach(func() { - converter = chop_lump.CatFileChopLumpConverter{} - }) - - Context("chop events", func() { - It("converts a chop log to a model", func() { - models, err := converter.ToModels([]types.Log{test_data.EthCatFileChopLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(models).To(Equal([]interface{}{test_data.CatFileChopModel})) - }) - }) - - Context("lump events", func() { - It("converts a lump log to a model", func() { - models, err := converter.ToModels([]types.Log{test_data.EthCatFileLumpLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(models).To(Equal([]interface{}{test_data.CatFileLumpModel})) - }) - }) - - It("returns err if log is missing topics", func() { - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - Expect(err).To(HaveOccurred()) - }) - - It("returns err if log is missing data", func() { - badLog := types.Log{ - Topics: []common.Hash{{}, {}, {}, {}}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - Expect(err).To(HaveOccurred()) - }) -}) diff --git a/pkg/transformers/cat_file/chop_lump/model.go b/pkg/transformers/cat_file/chop_lump/model.go deleted file mode 100644 index ada429ce..00000000 --- a/pkg/transformers/cat_file/chop_lump/model.go +++ /dev/null @@ -1,26 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package chop_lump - -type CatFileChopLumpModel struct { - Ilk string - What string - Data string - TransactionIndex uint `db:"tx_idx"` - LogIndex uint `db:"log_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/cat_file/chop_lump/repository.go b/pkg/transformers/cat_file/chop_lump/repository.go deleted file mode 100644 index 4cc68b2e..00000000 --- a/pkg/transformers/cat_file/chop_lump/repository.go +++ /dev/null @@ -1,99 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package chop_lump - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type CatFileChopLumpRepository struct { - db *postgres.DB -} - -func (repository CatFileChopLumpRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - chopLump, ok := model.(CatFileChopLumpModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, CatFileChopLumpModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(chopLump.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.cat_file_chop_lump (header_id, ilk, what, data, tx_idx, log_idx, raw_log) - VALUES($1, $2, $3, $4::NUMERIC, $5, $6, $7) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, what = $3, data = $4, raw_log = $7;`, - headerID, ilkID, chopLump.What, chopLump.Data, chopLump.TransactionIndex, chopLump.LogIndex, chopLump.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.CatFileChopLumpChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository CatFileChopLumpRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.CatFileChopLumpChecked) -} - -func (repository CatFileChopLumpRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.CatFileChopLumpChecked) -} - -func (repository CatFileChopLumpRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.CatFileChopLumpChecked) -} - -func (repository *CatFileChopLumpRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/cat_file/chop_lump/repository_test.go b/pkg/transformers/cat_file/chop_lump/repository_test.go deleted file mode 100644 index 7747a86b..00000000 --- a/pkg/transformers/cat_file/chop_lump/repository_test.go +++ /dev/null @@ -1,109 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package chop_lump_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/chop_lump" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" - "strconv" -) - -var _ = Describe("Cat file chop lump repository", func() { - var ( - catFileRepository chop_lump.CatFileChopLumpRepository - db *postgres.DB - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - catFileRepository = chop_lump.CatFileChopLumpRepository{} - catFileRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.CatFileChopModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.CatFileChopLumpChecked, - LogEventTableName: "maker.cat_file_chop_lump", - TestModel: test_data.CatFileChopModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &catFileRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a cat file chop event", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = catFileRepository.Create(headerID, []interface{}{test_data.CatFileChopModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbResult chop_lump.CatFileChopLumpModel - err = db.Get(&dbResult, `SELECT ilk, what, data, tx_idx, log_idx, raw_log FROM maker.cat_file_chop_lump WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.CatFileChopModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult.What).To(Equal(test_data.CatFileChopModel.What)) - Expect(dbResult.Data).To(Equal(test_data.CatFileChopModel.Data)) - Expect(dbResult.TransactionIndex).To(Equal(test_data.CatFileChopModel.TransactionIndex)) - Expect(dbResult.LogIndex).To(Equal(test_data.CatFileChopModel.LogIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.CatFileChopModel.Raw)) - }) - - It("adds a cat file lump event", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = catFileRepository.Create(headerID, []interface{}{test_data.CatFileLumpModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbResult chop_lump.CatFileChopLumpModel - err = db.Get(&dbResult, `SELECT ilk, what, data, tx_idx, log_idx, raw_log FROM maker.cat_file_chop_lump WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.CatFileLumpModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult.What).To(Equal(test_data.CatFileLumpModel.What)) - Expect(dbResult.Data).To(Equal(test_data.CatFileLumpModel.Data)) - Expect(dbResult.TransactionIndex).To(Equal(test_data.CatFileLumpModel.TransactionIndex)) - Expect(dbResult.LogIndex).To(Equal(test_data.CatFileLumpModel.LogIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.CatFileLumpModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.CatFileChopLumpChecked, - Repository: &catFileRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/cat_file/flip/config.go b/pkg/transformers/cat_file/flip/config.go deleted file mode 100644 index f8401d2d..00000000 --- a/pkg/transformers/cat_file/flip/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetCatFileFlipConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.CatFileFlipLabel, - ContractAddresses: []string{constants.CatContractAddress()}, - ContractAbi: constants.CatABI(), - Topic: constants.GetCatFileFlipSignature(), - StartingBlockNumber: constants.CatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/cat_file/flip/converter.go b/pkg/transformers/cat_file/flip/converter.go deleted file mode 100644 index eb748972..00000000 --- a/pkg/transformers/cat_file/flip/converter.go +++ /dev/null @@ -1,68 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip - -import ( - "bytes" - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type CatFileFlipConverter struct{} - -func (CatFileFlipConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var results []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - what := string(bytes.Trim(ethLog.Topics[3].Bytes(), "\x00")) - flipBytes := ethLog.Data[len(ethLog.Data)-constants.DataItemLength:] - flip := common.BytesToAddress(flipBytes).String() - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - result := CatFileFlipModel{ - Ilk: ilk, - What: what, - Flip: flip, - TransactionIndex: ethLog.TxIndex, - LogIndex: ethLog.Index, - Raw: raw, - } - results = append(results, result) - } - return results, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - if len(log.Data) < constants.DataItemLength { - return errors.New("log missing data") - } - return nil -} diff --git a/pkg/transformers/cat_file/flip/converter_test.go b/pkg/transformers/cat_file/flip/converter_test.go deleted file mode 100644 index dd73dc53..00000000 --- a/pkg/transformers/cat_file/flip/converter_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/flip" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Cat file flip converter", func() { - var converter flip.CatFileFlipConverter - - BeforeEach(func() { - converter = flip.CatFileFlipConverter{} - }) - - It("returns err if log is missing topics", func() { - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - Expect(err).To(HaveOccurred()) - }) - - It("returns err if log is missing data", func() { - badLog := types.Log{ - Topics: []common.Hash{{}, {}, {}, {}}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to an model", func() { - models, err := converter.ToModels([]types.Log{test_data.EthCatFileFlipLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(models).To(Equal([]interface{}{test_data.CatFileFlipModel})) - }) -}) diff --git a/pkg/transformers/cat_file/flip/model.go b/pkg/transformers/cat_file/flip/model.go deleted file mode 100644 index 31dcdaa8..00000000 --- a/pkg/transformers/cat_file/flip/model.go +++ /dev/null @@ -1,26 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip - -type CatFileFlipModel struct { - Ilk string - What string - Flip string - TransactionIndex uint `db:"tx_idx"` - LogIndex uint `db:"log_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/cat_file/flip/repository.go b/pkg/transformers/cat_file/flip/repository.go deleted file mode 100644 index 648effea..00000000 --- a/pkg/transformers/cat_file/flip/repository.go +++ /dev/null @@ -1,89 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type CatFileFlipRepository struct { - db *postgres.DB -} - -func (repository CatFileFlipRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - flip, ok := model.(CatFileFlipModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, CatFileFlipModel{}) - } - - _, execErr := repository.db.Exec( - `INSERT into maker.cat_file_flip (header_id, ilk, what, flip, tx_idx, log_idx, raw_log) - VALUES($1, $2, $3, $4, $5, $6, $7) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, what = $3, flip = $4, raw_log = $7;`, - headerID, flip.Ilk, flip.What, flip.Flip, flip.TransactionIndex, flip.LogIndex, flip.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.CatFileFlipChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository CatFileFlipRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.CatFileFlipChecked) -} - -func (repository CatFileFlipRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.CatFileFlipChecked) -} - -func (repository CatFileFlipRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.CatFileFlipChecked) -} - -func (repository *CatFileFlipRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/cat_file/flip/repository_test.go b/pkg/transformers/cat_file/flip/repository_test.go deleted file mode 100644 index fd345ff1..00000000 --- a/pkg/transformers/cat_file/flip/repository_test.go +++ /dev/null @@ -1,88 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/flip" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Cat file flip repository", func() { - var ( - catFileFlipRepository flip.CatFileFlipRepository - db *postgres.DB - headerRepository datastore.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - headerRepository = repositories.NewHeaderRepository(db) - catFileFlipRepository = flip.CatFileFlipRepository{} - catFileFlipRepository.SetDB(db) - }) - - Describe("Create", func() { - catFileFlipWithDifferentIdx := test_data.CatFileFlipModel - catFileFlipWithDifferentIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.CatFileFlipChecked, - LogEventTableName: "maker.cat_file_flip", - TestModel: test_data.CatFileFlipModel, - ModelWithDifferentLogIdx: catFileFlipWithDifferentIdx, - Repository: &catFileFlipRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a cat file flip event", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = catFileFlipRepository.Create(headerID, []interface{}{test_data.CatFileFlipModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbResult flip.CatFileFlipModel - err = db.Get(&dbResult, `SELECT ilk, what, flip, tx_idx, log_idx, raw_log FROM maker.cat_file_flip WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.Ilk).To(Equal(test_data.CatFileFlipModel.Ilk)) - Expect(dbResult.What).To(Equal(test_data.CatFileFlipModel.What)) - Expect(dbResult.Flip).To(Equal(test_data.CatFileFlipModel.Flip)) - Expect(dbResult.TransactionIndex).To(Equal(test_data.CatFileFlipModel.TransactionIndex)) - Expect(dbResult.LogIndex).To(Equal(test_data.CatFileFlipModel.LogIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.CatFileFlipModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.CatFileFlipChecked, - Repository: &catFileFlipRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/cat_file/pit_vow/config.go b/pkg/transformers/cat_file/pit_vow/config.go deleted file mode 100644 index 4db102a5..00000000 --- a/pkg/transformers/cat_file/pit_vow/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit_vow - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetCatFilePitVowConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.CatFilePitVowLabel, - ContractAddresses: []string{constants.CatContractAddress()}, - ContractAbi: constants.CatABI(), - Topic: constants.GetCatFilePitVowSignature(), - StartingBlockNumber: constants.CatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/cat_file/pit_vow/converter.go b/pkg/transformers/cat_file/pit_vow/converter.go deleted file mode 100644 index ad35e4a9..00000000 --- a/pkg/transformers/cat_file/pit_vow/converter.go +++ /dev/null @@ -1,66 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit_vow - -import ( - "bytes" - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type CatFilePitVowConverter struct{} - -func (CatFilePitVowConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var results []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - - what := string(bytes.Trim(ethLog.Topics[2].Bytes(), "\x00")) - data := common.BytesToAddress(ethLog.Topics[3].Bytes()).String() - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - - result := CatFilePitVowModel{ - What: what, - Data: data, - TransactionIndex: ethLog.TxIndex, - LogIndex: ethLog.Index, - Raw: raw, - } - results = append(results, result) - } - return results, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - if len(log.Data) < constants.DataItemLength { - return errors.New("log missing data") - } - return nil -} diff --git a/pkg/transformers/cat_file/pit_vow/converter_test.go b/pkg/transformers/cat_file/pit_vow/converter_test.go deleted file mode 100644 index 6ccf1152..00000000 --- a/pkg/transformers/cat_file/pit_vow/converter_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit_vow_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/pit_vow" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Cat file pit vow converter", func() { - var converter pit_vow.CatFilePitVowConverter - - BeforeEach(func() { - converter = pit_vow.CatFilePitVowConverter{} - }) - - It("returns err if log is missing topics", func() { - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - Expect(err).To(HaveOccurred()) - }) - - It("returns err if log is missing data", func() { - badLog := types.Log{ - Topics: []common.Hash{{}, {}, {}, {}}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to an model", func() { - models, err := converter.ToModels([]types.Log{test_data.EthCatFilePitVowLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(models).To(Equal([]interface{}{test_data.CatFilePitVowModel})) - }) -}) diff --git a/pkg/transformers/cat_file/pit_vow/model.go b/pkg/transformers/cat_file/pit_vow/model.go deleted file mode 100644 index 02539305..00000000 --- a/pkg/transformers/cat_file/pit_vow/model.go +++ /dev/null @@ -1,25 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit_vow - -type CatFilePitVowModel struct { - What string - Data string - TransactionIndex uint `db:"tx_idx"` - LogIndex uint `db:"log_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/cat_file/pit_vow/pit_vow_suite_test.go b/pkg/transformers/cat_file/pit_vow/pit_vow_suite_test.go deleted file mode 100644 index 9116a813..00000000 --- a/pkg/transformers/cat_file/pit_vow/pit_vow_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit_vow_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestPitVow(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "PitVow Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/cat_file/pit_vow/repository.go b/pkg/transformers/cat_file/pit_vow/repository.go deleted file mode 100644 index bc737c29..00000000 --- a/pkg/transformers/cat_file/pit_vow/repository.go +++ /dev/null @@ -1,89 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit_vow - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type CatFilePitVowRepository struct { - db *postgres.DB -} - -func (repository CatFilePitVowRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - vow, ok := model.(CatFilePitVowModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, CatFilePitVowModel{}) - } - - _, execErr := repository.db.Exec( - `INSERT into maker.cat_file_pit_vow (header_id, what, data, tx_idx, log_idx, raw_log) - VALUES($1, $2, $3, $4, $5, $6) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET what = $2, data = $3, raw_log = $6;`, - headerID, vow.What, vow.Data, vow.TransactionIndex, vow.LogIndex, vow.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.CatFilePitVowChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository CatFilePitVowRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.CatFilePitVowChecked) -} - -func (repository CatFilePitVowRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.CatFilePitVowChecked) -} - -func (repository CatFilePitVowRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.CatFilePitVowChecked) -} - -func (repository *CatFilePitVowRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/cat_file/pit_vow/repository_test.go b/pkg/transformers/cat_file/pit_vow/repository_test.go deleted file mode 100644 index f476c820..00000000 --- a/pkg/transformers/cat_file/pit_vow/repository_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit_vow_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/pit_vow" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Cat file pit vow repository", func() { - var ( - catFilePitVowRepository pit_vow.CatFilePitVowRepository - db *postgres.DB - headerRepository datastore.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - headerRepository = repositories.NewHeaderRepository(db) - catFilePitVowRepository = pit_vow.CatFilePitVowRepository{} - catFilePitVowRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.CatFilePitVowModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.CatFilePitVowChecked, - LogEventTableName: "maker.cat_file_pit_vow", - TestModel: test_data.CatFilePitVowModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &catFilePitVowRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a cat file pit vow event", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = catFilePitVowRepository.Create(headerID, []interface{}{test_data.CatFilePitVowModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbResult pit_vow.CatFilePitVowModel - err = db.Get(&dbResult, `SELECT what, data, tx_idx, log_idx, raw_log FROM maker.cat_file_pit_vow WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.What).To(Equal(test_data.CatFilePitVowModel.What)) - Expect(dbResult.Data).To(Equal(test_data.CatFilePitVowModel.Data)) - Expect(dbResult.TransactionIndex).To(Equal(test_data.CatFilePitVowModel.TransactionIndex)) - Expect(dbResult.LogIndex).To(Equal(test_data.CatFilePitVowModel.LogIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.CatFilePitVowModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.CatFilePitVowChecked, - Repository: &catFilePitVowRepository, - } - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/deal/config.go b/pkg/transformers/deal/config.go deleted file mode 100644 index f9f77f77..00000000 --- a/pkg/transformers/deal/config.go +++ /dev/null @@ -1,34 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package deal - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetDealConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.DealLabel, - ContractAddresses: []string{constants.FlapperContractAddress(), constants.FlipperContractAddress(), constants.FlopperContractAddress()}, - ContractAbi: constants.FlipperABI(), - Topic: constants.GetDealSignature(), - StartingBlockNumber: shared.MinInt64([]int64{ - constants.FlapperDeploymentBlock(), constants.FlipperDeploymentBlock(), constants.FlopperDeploymentBlock()}), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/deal/converter.go b/pkg/transformers/deal/converter.go deleted file mode 100644 index d9545b21..00000000 --- a/pkg/transformers/deal/converter.go +++ /dev/null @@ -1,59 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package deal - -import ( - "encoding/json" - "errors" - - "github.com/ethereum/go-ethereum/core/types" -) - -type DealConverter struct{} - -func (DealConverter) ToModels(ethLogs []types.Log) (result []interface{}, err error) { - for _, log := range ethLogs { - err := validateLog(log) - if err != nil { - return nil, err - } - - bidId := log.Topics[2].Big() - raw, err := json.Marshal(log) - if err != nil { - return nil, err - } - - model := DealModel{ - BidId: bidId.String(), - ContractAddress: log.Address.Hex(), - LogIndex: log.Index, - TransactionIndex: log.TxIndex, - Raw: raw, - } - result = append(result, model) - } - - return result, nil -} - -func validateLog(ethLog types.Log) error { - if len(ethLog.Topics) < 3 { - return errors.New("deal log does not contain expected topics") - } - return nil -} diff --git a/pkg/transformers/deal/converter_test.go b/pkg/transformers/deal/converter_test.go deleted file mode 100644 index b2284aed..00000000 --- a/pkg/transformers/deal/converter_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package deal_test - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/deal" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Flip Deal Converter", func() { - It("converts logs to models", func() { - converter := deal.DealConverter{} - - models, err := converter.ToModels([]types.Log{test_data.DealLogNote}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.DealModel)) - }) - - It("returns an error if the expected amount of topics aren't in the log", func() { - converter := deal.DealConverter{} - invalidLog := test_data.DealLogNote - invalidLog.Topics = []common.Hash{} - - _, err := converter.ToModels([]types.Log{invalidLog}) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError("deal log does not contain expected topics")) - }) -}) diff --git a/pkg/transformers/deal/deal_suite_test.go b/pkg/transformers/deal/deal_suite_test.go deleted file mode 100644 index 064213b2..00000000 --- a/pkg/transformers/deal/deal_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package deal_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - log "github.com/sirupsen/logrus" - "io/ioutil" -) - -func TestFlipDeal(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Deal Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/deal/model.go b/pkg/transformers/deal/model.go deleted file mode 100644 index fe0210f6..00000000 --- a/pkg/transformers/deal/model.go +++ /dev/null @@ -1,25 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package deal - -type DealModel struct { - BidId string `db:"bid_id"` - ContractAddress string `db:"contract_address"` - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/deal/repository.go b/pkg/transformers/deal/repository.go deleted file mode 100644 index b0572abd..00000000 --- a/pkg/transformers/deal/repository.go +++ /dev/null @@ -1,90 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package deal - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type DealRepository struct { - db *postgres.DB -} - -func (repository DealRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - dealModel, ok := model.(DealModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, DealModel{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.deal (header_id, bid_id, contract_address, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4, $5, $6) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET bid_id = $2, contract_address = $3, raw_log = $6;`, - headerID, dealModel.BidId, dealModel.ContractAddress, dealModel.LogIndex, dealModel.TransactionIndex, dealModel.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DealChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository DealRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.DealChecked) -} - -func (repository DealRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DealChecked) -} - -func (repository DealRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DealChecked) -} - -func (repository *DealRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/deal/repository_test.go b/pkg/transformers/deal/repository_test.go deleted file mode 100644 index 96a31685..00000000 --- a/pkg/transformers/deal/repository_test.go +++ /dev/null @@ -1,89 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package deal_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/deal" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Deal Repository", func() { - var ( - db *postgres.DB - dealRepository deal.DealRepository - headerRepository repositories.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - dealRepository = deal.DealRepository{} - dealRepository.SetDB(db) - headerRepository = repositories.NewHeaderRepository(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.DealModel - modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1 - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.DealChecked, - LogEventTableName: "maker.deal", - TestModel: test_data.DealModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &dealRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists a deal record", func() { - headerId, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = dealRepository.Create(headerId, []interface{}{test_data.DealModel}) - - Expect(err).NotTo(HaveOccurred()) - var count int - db.QueryRow(`SELECT count(*) FROM maker.deal`).Scan(&count) - Expect(count).To(Equal(1)) - var dbResult deal.DealModel - err = db.Get(&dbResult, `SELECT bid_id, contract_address, log_idx, tx_idx, raw_log FROM maker.deal WHERE header_id = $1`, headerId) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.BidId).To(Equal(test_data.DealModel.BidId)) - Expect(dbResult.ContractAddress).To(Equal(test_data.DealModel.ContractAddress)) - Expect(dbResult.LogIndex).To(Equal(test_data.DealModel.LogIndex)) - Expect(dbResult.TransactionIndex).To(Equal(test_data.DealModel.TransactionIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.DealModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.DealChecked, - Repository: &dealRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/dent/config.go b/pkg/transformers/dent/config.go deleted file mode 100644 index c6703946..00000000 --- a/pkg/transformers/dent/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package dent - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetDentConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.DentLabel, - ContractAddresses: []string{constants.FlipperContractAddress(), constants.FlopperContractAddress()}, - ContractAbi: constants.FlipperABI(), - Topic: constants.GetDentFunctionSignature(), - StartingBlockNumber: shared.MinInt64([]int64{constants.FlipperDeploymentBlock(), constants.FlopperDeploymentBlock()}), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/dent/converter.go b/pkg/transformers/dent/converter.go deleted file mode 100644 index 70f83b00..00000000 --- a/pkg/transformers/dent/converter.go +++ /dev/null @@ -1,88 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package dent - -import ( - "encoding/json" - "errors" - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" -) - -type DentConverter struct{} - -func NewDentConverter() DentConverter { - return DentConverter{} -} - -func (c DentConverter) ToModels(ethLogs []types.Log) (result []interface{}, err error) { - for _, log := range ethLogs { - err := validateLog(log) - if err != nil { - return nil, err - } - - bidId := log.Topics[2].Big() - lot := log.Topics[3].Big().String() - bidValue := getBidValue(log) - // TODO: verify guy is available on Topics[1] (looks like it may just be an int id) - guy := common.HexToAddress(log.Topics[1].Hex()).String() - - logIndex := log.Index - transactionIndex := log.TxIndex - - raw, err := json.Marshal(log) - if err != nil { - return nil, err - } - - model := DentModel{ - BidId: bidId.String(), - Lot: lot, - Bid: bidValue, - Guy: guy, - LogIndex: logIndex, - TransactionIndex: transactionIndex, - Raw: raw, - } - result = append(result, model) - } - return result, err -} - -func validateLog(ethLog types.Log) error { - if len(ethLog.Data) <= 0 { - return errors.New("dent log data is empty") - } - - if len(ethLog.Topics) < 4 { - return errors.New("dent log does not contain expected topics") - } - - return nil -} - -func getBidValue(ethLog types.Log) string { - itemByteLength := 32 - lastDataItemStartIndex := len(ethLog.Data) - itemByteLength - lastItem := ethLog.Data[lastDataItemStartIndex:] - lastValue := big.NewInt(0).SetBytes(lastItem) - - return lastValue.String() -} diff --git a/pkg/transformers/dent/converter_test.go b/pkg/transformers/dent/converter_test.go deleted file mode 100644 index 0a68fd9b..00000000 --- a/pkg/transformers/dent/converter_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package dent_test - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/dent" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Dent Converter", func() { - var converter dent.DentConverter - - BeforeEach(func() { - converter = dent.NewDentConverter() - }) - - It("converts an eth log to a db model", func() { - models, err := converter.ToModels([]types.Log{test_data.DentLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0].(dent.DentModel)).To(Equal(test_data.DentModel)) - }) - - It("returns an error if the expected amount of topics aren't in the log", func() { - invalidLog := test_data.DentLog - invalidLog.Topics = []common.Hash{} - _, err := converter.ToModels([]types.Log{invalidLog}) - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError("dent log does not contain expected topics")) - }) - - It("returns an error if the log data is empty", func() { - emptyDataLog := test_data.DentLog - emptyDataLog.Data = []byte{} - _, err := converter.ToModels([]types.Log{emptyDataLog}) - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError("dent log data is empty")) - }) -}) diff --git a/pkg/transformers/dent/dent_suite_test.go b/pkg/transformers/dent/dent_suite_test.go deleted file mode 100644 index 6fa8d633..00000000 --- a/pkg/transformers/dent/dent_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package dent_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - log "github.com/sirupsen/logrus" - "io/ioutil" -) - -func TestDent(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Dent Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/dent/model.go b/pkg/transformers/dent/model.go deleted file mode 100644 index 24f038ac..00000000 --- a/pkg/transformers/dent/model.go +++ /dev/null @@ -1,27 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package dent - -type DentModel struct { - BidId string `db:"bid_id"` - Lot string - Bid string - Guy string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/dent/repository.go b/pkg/transformers/dent/repository.go deleted file mode 100644 index ceac4e95..00000000 --- a/pkg/transformers/dent/repository.go +++ /dev/null @@ -1,93 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package dent - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type DentRepository struct { - db *postgres.DB -} - -func (repository DentRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - tic, getTicErr := shared.GetTicInTx(headerID, tx) - if getTicErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return getTicErr - } - - for _, model := range models { - dent, ok := model.(DentModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, DentModel{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.dent (header_id, bid_id, lot, bid, guy, tic, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET bid_Id = $2, lot = $3, bid = $4, guy = $5, tic = $6, raw_log = $9;`, - headerID, dent.BidId, dent.Lot, dent.Bid, dent.Guy, tic, dent.LogIndex, dent.TransactionIndex, dent.Raw, - ) - if execErr != nil { - tx.Rollback() - return execErr - } - } - - err := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DentChecked) - if err != nil { - tx.Rollback() - return err - } - return tx.Commit() -} - -func (repository DentRepository) MarkHeaderChecked(headerId int64) error { - return shared.MarkHeaderChecked(headerId, repository.db, constants.DentChecked) -} - -func (repository DentRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DentChecked) -} - -func (repository DentRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DentChecked) -} - -func (repository *DentRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/dent/repository_test.go b/pkg/transformers/dent/repository_test.go deleted file mode 100644 index 4e075f4b..00000000 --- a/pkg/transformers/dent/repository_test.go +++ /dev/null @@ -1,97 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package dent_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/dent" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Dent Repository", func() { - var ( - db *postgres.DB - dentRepository dent.DentRepository - headerRepository repositories.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - dentRepository = dent.DentRepository{} - dentRepository.SetDB(db) - headerRepository = repositories.NewHeaderRepository(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.DentModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.DentChecked, - LogEventTableName: "maker.dent", - TestModel: test_data.DentModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &dentRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists a dent record", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = dentRepository.Create(headerID, []interface{}{test_data.DentModel}) - Expect(err).NotTo(HaveOccurred()) - - var count int - db.QueryRow(`SELECT count(*) FROM maker.dent`).Scan(&count) - Expect(count).To(Equal(1)) - - var dbResult dent.DentModel - err = db.Get(&dbResult, `SELECT bid_id, lot, bid, guy, log_idx, tx_idx, raw_log FROM maker.dent WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.BidId).To(Equal(test_data.DentModel.BidId)) - Expect(dbResult.Lot).To(Equal(test_data.DentModel.Lot)) - Expect(dbResult.Bid).To(Equal(test_data.DentModel.Bid)) - Expect(dbResult.Guy).To(Equal(test_data.DentModel.Guy)) - Expect(dbResult.LogIndex).To(Equal(test_data.DentModel.LogIndex)) - Expect(dbResult.TransactionIndex).To(Equal(test_data.DentModel.TransactionIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.DentModel.Raw)) - - var dbTic int64 - err = db.Get(&dbTic, `SELECT tic FROM maker.dent WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbTic).To(Equal(fakes.FakeHeaderTic)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.DentChecked, - Repository: &dentRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/drip_drip/config.go b/pkg/transformers/drip_drip/config.go deleted file mode 100644 index 6ad1921f..00000000 --- a/pkg/transformers/drip_drip/config.go +++ /dev/null @@ -1,32 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package drip_drip - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetDripDripConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - ContractAddresses: []string{constants.DripContractAddress()}, - ContractAbi: constants.DripABI(), - Topic: constants.GetDripDripSignature(), - StartingBlockNumber: constants.DripDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/drip_drip/converter.go b/pkg/transformers/drip_drip/converter.go deleted file mode 100644 index 534242e1..00000000 --- a/pkg/transformers/drip_drip/converter.go +++ /dev/null @@ -1,56 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package drip_drip - -import ( - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -type DripDripConverter struct{} - -func (DripDripConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - model := DripDripModel{ - Ilk: ilk, - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 3 { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/drip_drip/converter_test.go b/pkg/transformers/drip_drip/converter_test.go deleted file mode 100644 index faeb9308..00000000 --- a/pkg/transformers/drip_drip/converter_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package drip_drip_test - -import ( - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_drip" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Drip drip converter", func() { - It("returns err if log is missing topics", func() { - converter := drip_drip.DripDripConverter{} - badLog := types.Log{} - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to an model", func() { - converter := drip_drip.DripDripConverter{} - - model, err := converter.ToModels([]types.Log{test_data.EthDripDripLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(model).To(Equal([]interface{}{test_data.DripDripModel})) - }) -}) diff --git a/pkg/transformers/drip_drip/drip_drip_suite_test.go b/pkg/transformers/drip_drip/drip_drip_suite_test.go deleted file mode 100644 index ec70dc7e..00000000 --- a/pkg/transformers/drip_drip/drip_drip_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package drip_drip_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestDripDrip(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "DripDrip Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/drip_drip/model.go b/pkg/transformers/drip_drip/model.go deleted file mode 100644 index 4e7b19ee..00000000 --- a/pkg/transformers/drip_drip/model.go +++ /dev/null @@ -1,24 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package drip_drip - -type DripDripModel struct { - Ilk string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/drip_drip/repository.go b/pkg/transformers/drip_drip/repository.go deleted file mode 100644 index accf41f6..00000000 --- a/pkg/transformers/drip_drip/repository.go +++ /dev/null @@ -1,98 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package drip_drip - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type DripDripRepository struct { - db *postgres.DB -} - -func (repository DripDripRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - dripDrip, ok := model.(DripDripModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, DripDripModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(dripDrip.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.drip_drip (header_id, ilk, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4, $5) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk= $2, raw_log = $5;`, - headerID, ilkID, dripDrip.LogIndex, dripDrip.TransactionIndex, dripDrip.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DripDripChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository DripDripRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.DripDripChecked) -} - -func (repository DripDripRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripDripChecked) -} - -func (repository DripDripRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripDripChecked) -} - -func (repository *DripDripRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/drip_drip/repository_test.go b/pkg/transformers/drip_drip/repository_test.go deleted file mode 100644 index c97e477c..00000000 --- a/pkg/transformers/drip_drip/repository_test.go +++ /dev/null @@ -1,89 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package drip_drip_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_drip" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" - "strconv" -) - -var _ = Describe("Drip drip repository", func() { - var ( - db *postgres.DB - dripDripRepository drip_drip.DripDripRepository - headerRepository datastore.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - headerRepository = repositories.NewHeaderRepository(db) - dripDripRepository = drip_drip.DripDripRepository{} - dripDripRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.DripDripModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.DripDripChecked, - LogEventTableName: "maker.drip_drip", - TestModel: test_data.DripDripModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &dripDripRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a drip drip event", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = dripDripRepository.Create(headerID, []interface{}{test_data.DripDripModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbDripDrip drip_drip.DripDripModel - err = db.Get(&dbDripDrip, `SELECT ilk, log_idx, tx_idx, raw_log FROM maker.drip_drip WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.DripDripModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbDripDrip.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbDripDrip.LogIndex).To(Equal(test_data.DripDripModel.LogIndex)) - Expect(dbDripDrip.TransactionIndex).To(Equal(test_data.DripDripModel.TransactionIndex)) - Expect(dbDripDrip.Raw).To(MatchJSON(test_data.DripDripModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.DripDripChecked, - Repository: &dripDripRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/drip_file/ilk/config.go b/pkg/transformers/drip_file/ilk/config.go deleted file mode 100644 index 1ada59ba..00000000 --- a/pkg/transformers/drip_file/ilk/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetDripFileIlkConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.DripFileIlkLabel, - ContractAddresses: []string{constants.DripContractAddress()}, - ContractAbi: constants.DripABI(), - Topic: constants.GetDripFileIlkSignature(), - StartingBlockNumber: constants.DripDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/drip_file/ilk/converter.go b/pkg/transformers/drip_file/ilk/converter.go deleted file mode 100644 index 8dfaafb3..00000000 --- a/pkg/transformers/drip_file/ilk/converter.go +++ /dev/null @@ -1,70 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk - -import ( - "encoding/json" - "errors" - "math/big" - - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type DripFileIlkConverter struct{} - -func (DripFileIlkConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - vow := shared.GetHexWithoutPrefix(ethLog.Topics[3].Bytes()) - taxBytes := ethLog.Data[len(ethLog.Data)-constants.DataItemLength:] - tax := shared.ConvertToRay(big.NewInt(0).SetBytes(taxBytes).String()) - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - - model := DripFileIlkModel{ - Ilk: ilk, - Vow: vow, - Tax: tax, - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - if len(log.Data) < constants.DataItemLength { - return errors.New("log missing data") - } - return nil -} diff --git a/pkg/transformers/drip_file/ilk/converter_test.go b/pkg/transformers/drip_file/ilk/converter_test.go deleted file mode 100644 index 7af73627..00000000 --- a/pkg/transformers/drip_file/ilk/converter_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/ilk" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Drip file ilk converter", func() { - It("returns err if log missing topics", func() { - converter := ilk.DripFileIlkConverter{} - badLog := types.Log{ - Topics: []common.Hash{{}}, - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("returns err if log missing data", func() { - converter := ilk.DripFileIlkConverter{} - badLog := types.Log{ - Topics: []common.Hash{{}, {}, {}, {}}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - - }) - - It("converts a log to a model", func() { - converter := ilk.DripFileIlkConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthDripFileIlkLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0].(ilk.DripFileIlkModel)).To(Equal(test_data.DripFileIlkModel)) - }) -}) diff --git a/pkg/transformers/drip_file/ilk/ilk_suite_test.go b/pkg/transformers/drip_file/ilk/ilk_suite_test.go deleted file mode 100644 index 469bede6..00000000 --- a/pkg/transformers/drip_file/ilk/ilk_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestIlk(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Ilk Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/drip_file/ilk/model.go b/pkg/transformers/drip_file/ilk/model.go deleted file mode 100644 index f2e6fdb8..00000000 --- a/pkg/transformers/drip_file/ilk/model.go +++ /dev/null @@ -1,26 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk - -type DripFileIlkModel struct { - Ilk string - Vow string - Tax string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/drip_file/ilk/repository.go b/pkg/transformers/drip_file/ilk/repository.go deleted file mode 100644 index b0122520..00000000 --- a/pkg/transformers/drip_file/ilk/repository.go +++ /dev/null @@ -1,100 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type DripFileIlkRepository struct { - db *postgres.DB -} - -func (repository DripFileIlkRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - ilk, ok := model.(DripFileIlkModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, DripFileIlkModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(ilk.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.drip_file_ilk (header_id, ilk, vow, tax, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4::NUMERIC, $5, $6, $7)`, - headerID, ilkID, ilk.Vow, ilk.Tax, ilk.LogIndex, ilk.TransactionIndex, ilk.Raw, - ) - - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DripFileIlkChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository DripFileIlkRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.DripFileIlkChecked) -} - -func (repository DripFileIlkRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripFileIlkChecked) -} - -func (repository DripFileIlkRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripFileIlkChecked) -} - -func (repository *DripFileIlkRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/drip_file/ilk/repository_test.go b/pkg/transformers/drip_file/ilk/repository_test.go deleted file mode 100644 index f632e9f8..00000000 --- a/pkg/transformers/drip_file/ilk/repository_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/ilk" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" - "strconv" -) - -var _ = Describe("Drip file ilk repository", func() { - var ( - db *postgres.DB - dripFileIlkRepository ilk.DripFileIlkRepository - headerRepository datastore.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - headerRepository = repositories.NewHeaderRepository(db) - dripFileIlkRepository = ilk.DripFileIlkRepository{} - dripFileIlkRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.DripFileIlkModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.DripFileIlkChecked, - LogEventTableName: "maker.drip_file_ilk", - TestModel: test_data.DripFileIlkModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &dripFileIlkRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a drip file ilk event", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = dripFileIlkRepository.Create(headerID, []interface{}{test_data.DripFileIlkModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbDripFileIlk ilk.DripFileIlkModel - err = db.Get(&dbDripFileIlk, `SELECT ilk, vow, tax, log_idx, tx_idx, raw_log FROM maker.drip_file_ilk WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.DripFileIlkModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbDripFileIlk.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbDripFileIlk.Vow).To(Equal(test_data.DripFileIlkModel.Vow)) - Expect(dbDripFileIlk.Tax).To(Equal(test_data.DripFileIlkModel.Tax)) - Expect(dbDripFileIlk.LogIndex).To(Equal(test_data.DripFileIlkModel.LogIndex)) - Expect(dbDripFileIlk.TransactionIndex).To(Equal(test_data.DripFileIlkModel.TransactionIndex)) - Expect(dbDripFileIlk.Raw).To(MatchJSON(test_data.DripFileIlkModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.DripFileIlkChecked, - Repository: &dripFileIlkRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/drip_file/repo/config.go b/pkg/transformers/drip_file/repo/config.go deleted file mode 100644 index ecbf0e3f..00000000 --- a/pkg/transformers/drip_file/repo/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package repo - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetDripFileRepoConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.DripFileRepoLabel, - ContractAddresses: []string{constants.DripContractAddress()}, - ContractAbi: constants.DripABI(), - Topic: constants.GetDripFileRepoSignature(), - StartingBlockNumber: constants.DripDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/drip_file/repo/converter.go b/pkg/transformers/drip_file/repo/converter.go deleted file mode 100644 index 0c851bc7..00000000 --- a/pkg/transformers/drip_file/repo/converter.go +++ /dev/null @@ -1,61 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package repo - -import ( - "bytes" - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "math/big" -) - -type DripFileRepoConverter struct{} - -func (DripFileRepoConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - - what := string(bytes.Trim(ethLog.Topics[2].Bytes(), "\x00")) - data := big.NewInt(0).SetBytes(ethLog.Topics[3].Bytes()).String() - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - - model := DripFileRepoModel{ - What: what, - Data: data, - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/drip_file/repo/converter_test.go b/pkg/transformers/drip_file/repo/converter_test.go deleted file mode 100644 index ae4e2144..00000000 --- a/pkg/transformers/drip_file/repo/converter_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package repo_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/repo" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Drip file repo converter", func() { - It("returns err if log missing topics", func() { - converter := repo.DripFileRepoConverter{} - badLog := types.Log{ - Topics: []common.Hash{{}}, - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to a model", func() { - converter := repo.DripFileRepoConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthDripFileRepoLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0].(repo.DripFileRepoModel)).To(Equal(test_data.DripFileRepoModel)) - }) -}) diff --git a/pkg/transformers/drip_file/repo/model.go b/pkg/transformers/drip_file/repo/model.go deleted file mode 100644 index cb5da51e..00000000 --- a/pkg/transformers/drip_file/repo/model.go +++ /dev/null @@ -1,25 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package repo - -type DripFileRepoModel struct { - What string - Data string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/drip_file/repo/repo_suite_test.go b/pkg/transformers/drip_file/repo/repo_suite_test.go deleted file mode 100644 index 965d83d8..00000000 --- a/pkg/transformers/drip_file/repo/repo_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package repo_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestRepo(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Repo Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/drip_file/repo/repository.go b/pkg/transformers/drip_file/repo/repository.go deleted file mode 100644 index 4490af00..00000000 --- a/pkg/transformers/drip_file/repo/repository.go +++ /dev/null @@ -1,91 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package repo - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type DripFileRepoRepository struct { - db *postgres.DB -} - -func (repository DripFileRepoRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - repo, ok := model.(DripFileRepoModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, DripFileRepoModel{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.drip_file_repo (header_id, what, data, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3::NUMERIC, $4, $5, $6)`, - headerID, repo.What, repo.Data, repo.LogIndex, repo.TransactionIndex, repo.Raw, - ) - - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DripFileRepoChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository DripFileRepoRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.DripFileRepoChecked) -} - -func (repository DripFileRepoRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripFileRepoChecked) -} - -func (repository DripFileRepoRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripFileRepoChecked) -} - -func (repository *DripFileRepoRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/drip_file/repo/repository_test.go b/pkg/transformers/drip_file/repo/repository_test.go deleted file mode 100644 index 5f4c021e..00000000 --- a/pkg/transformers/drip_file/repo/repository_test.go +++ /dev/null @@ -1,87 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package repo_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/repo" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Drip file repo repository", func() { - var ( - db *postgres.DB - dripFileRepoRepository repo.DripFileRepoRepository - headerRepository datastore.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - headerRepository = repositories.NewHeaderRepository(db) - dripFileRepoRepository = repo.DripFileRepoRepository{} - dripFileRepoRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.DripFileRepoModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.DripFileRepoChecked, - LogEventTableName: "maker.drip_file_repo", - TestModel: test_data.DripFileRepoModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &dripFileRepoRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a drip file repo event", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = dripFileRepoRepository.Create(headerID, []interface{}{test_data.DripFileRepoModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbDripFileRepo repo.DripFileRepoModel - err = db.Get(&dbDripFileRepo, `SELECT what, data, log_idx, tx_idx, raw_log FROM maker.drip_file_repo WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbDripFileRepo.What).To(Equal(test_data.DripFileRepoModel.What)) - Expect(dbDripFileRepo.Data).To(Equal(test_data.DripFileRepoModel.Data)) - Expect(dbDripFileRepo.LogIndex).To(Equal(test_data.DripFileRepoModel.LogIndex)) - Expect(dbDripFileRepo.TransactionIndex).To(Equal(test_data.DripFileRepoModel.TransactionIndex)) - Expect(dbDripFileRepo.Raw).To(MatchJSON(test_data.DripFileRepoModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.DripFileRepoChecked, - Repository: &dripFileRepoRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/drip_file/vow/config.go b/pkg/transformers/drip_file/vow/config.go deleted file mode 100644 index e296bb09..00000000 --- a/pkg/transformers/drip_file/vow/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetDripFileVowConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.DripFileVowLabel, - ContractAddresses: []string{constants.DripContractAddress()}, - ContractAbi: constants.DripABI(), - Topic: constants.GetDripFileVowSignature(), - StartingBlockNumber: constants.DripDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/drip_file/vow/converter.go b/pkg/transformers/drip_file/vow/converter.go deleted file mode 100644 index d1a47d7f..00000000 --- a/pkg/transformers/drip_file/vow/converter.go +++ /dev/null @@ -1,61 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow - -import ( - "bytes" - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" -) - -type DripFileVowConverter struct{} - -func (DripFileVowConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - - what := string(bytes.Trim(ethLog.Topics[2].Bytes(), "\x00")) - data := common.BytesToAddress(ethLog.Topics[3].Bytes()).String() - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - - model := DripFileVowModel{ - What: what, - Data: data, - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/drip_file/vow/converter_test.go b/pkg/transformers/drip_file/vow/converter_test.go deleted file mode 100644 index 370dd575..00000000 --- a/pkg/transformers/drip_file/vow/converter_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/vow" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Drip file repo converter", func() { - It("returns err if log missing topics", func() { - converter := vow.DripFileVowConverter{} - badLog := types.Log{ - Topics: []common.Hash{{}}, - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to a model", func() { - converter := vow.DripFileVowConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthDripFileVowLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0].(vow.DripFileVowModel)).To(Equal(test_data.DripFileVowModel)) - }) -}) diff --git a/pkg/transformers/drip_file/vow/model.go b/pkg/transformers/drip_file/vow/model.go deleted file mode 100644 index 1e0cbd9c..00000000 --- a/pkg/transformers/drip_file/vow/model.go +++ /dev/null @@ -1,25 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow - -type DripFileVowModel struct { - What string - Data string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/drip_file/vow/repository.go b/pkg/transformers/drip_file/vow/repository.go deleted file mode 100644 index 2f008dc5..00000000 --- a/pkg/transformers/drip_file/vow/repository.go +++ /dev/null @@ -1,91 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type DripFileVowRepository struct { - db *postgres.DB -} - -func (repository DripFileVowRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - vow, ok := model.(DripFileVowModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, DripFileVowModel{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.drip_file_vow (header_id, what, data, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4, $5, $6) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET what = $2, data = $3, raw_log = $6;`, - headerID, vow.What, vow.Data, vow.LogIndex, vow.TransactionIndex, vow.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.DripFileVowChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository DripFileVowRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.DripFileVowChecked) -} - -func (repository DripFileVowRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripFileVowChecked) -} - -func (repository DripFileVowRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.DripFileVowChecked) -} - -func (repository *DripFileVowRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/drip_file/vow/repository_test.go b/pkg/transformers/drip_file/vow/repository_test.go deleted file mode 100644 index 067e0cad..00000000 --- a/pkg/transformers/drip_file/vow/repository_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/vow" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Drip file vow repository", func() { - var ( - db *postgres.DB - dripFileVowRepository vow.DripFileVowRepository - headerRepository datastore.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - headerRepository = repositories.NewHeaderRepository(db) - dripFileVowRepository = vow.DripFileVowRepository{} - dripFileVowRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.DripFileVowModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.DripFileVowChecked, - LogEventTableName: "maker.drip_file_vow", - TestModel: test_data.DripFileVowModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &dripFileVowRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a drip file vow event", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = dripFileVowRepository.Create(headerID, []interface{}{test_data.DripFileVowModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbDripFileVow vow.DripFileVowModel - err = db.Get(&dbDripFileVow, `SELECT what, data, log_idx, tx_idx, raw_log FROM maker.drip_file_vow WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbDripFileVow.What).To(Equal(test_data.DripFileVowModel.What)) - Expect(dbDripFileVow.Data).To(Equal(test_data.DripFileVowModel.Data)) - Expect(dbDripFileVow.LogIndex).To(Equal(test_data.DripFileVowModel.LogIndex)) - Expect(dbDripFileVow.TransactionIndex).To(Equal(test_data.DripFileVowModel.TransactionIndex)) - Expect(dbDripFileVow.Raw).To(MatchJSON(test_data.DripFileVowModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.DripFileVowChecked, - Repository: &dripFileVowRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/factories/factories_suite_test.go b/pkg/transformers/factories/factories_suite_test.go deleted file mode 100644 index fa938ceb..00000000 --- a/pkg/transformers/factories/factories_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package factories_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - log "github.com/sirupsen/logrus" - "io/ioutil" -) - -func TestFactories(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Factories Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/flap_kick/config.go b/pkg/transformers/flap_kick/config.go deleted file mode 100644 index 70c5b7c9..00000000 --- a/pkg/transformers/flap_kick/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flap_kick - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetFlapKickConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.FlapKickLabel, - ContractAddresses: []string{constants.FlapperContractAddress()}, - ContractAbi: constants.FlapperABI(), - Topic: constants.GetFlapKickSignature(), - StartingBlockNumber: constants.FlapperDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/flap_kick/converter.go b/pkg/transformers/flap_kick/converter.go deleted file mode 100644 index 811d0495..00000000 --- a/pkg/transformers/flap_kick/converter.go +++ /dev/null @@ -1,91 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flap_kick - -import ( - "encoding/json" - "errors" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/geth" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "time" -) - -type FlapKickConverter struct { -} - -func (FlapKickConverter) ToEntities(contractAbi string, ethLogs []types.Log) ([]interface{}, error) { - var entities []interface{} - for _, ethLog := range ethLogs { - entity := &FlapKickEntity{} - address := ethLog.Address - abi, err := geth.ParseAbi(contractAbi) - if err != nil { - return nil, err - } - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - err = contract.UnpackLog(entity, "Kick", ethLog) - if err != nil { - return nil, err - } - entity.Raw = ethLog - entity.TransactionIndex = ethLog.TxIndex - entity.LogIndex = ethLog.Index - entities = append(entities, *entity) - } - return entities, nil -} - -func (FlapKickConverter) ToModels(entities []interface{}) ([]interface{}, error) { - var models []interface{} - for _, entity := range entities { - flapKickEntity, ok := entity.(FlapKickEntity) - if !ok { - return nil, fmt.Errorf("entity of type %T, not %T", entity, FlapKickEntity{}) - } - - if flapKickEntity.Id == nil { - return nil, errors.New("FlapKick log ID cannot be nil.") - } - - id := flapKickEntity.Id.String() - lot := shared.BigIntToString(flapKickEntity.Lot) - bid := shared.BigIntToString(flapKickEntity.Bid) - gal := flapKickEntity.Gal.String() - endValue := shared.BigIntToInt64(flapKickEntity.End) - end := time.Unix(endValue, 0) - rawLog, err := json.Marshal(flapKickEntity.Raw) - if err != nil { - return nil, err - } - - model := FlapKickModel{ - BidId: id, - Lot: lot, - Bid: bid, - Gal: gal, - End: end, - TransactionIndex: flapKickEntity.TransactionIndex, - LogIndex: flapKickEntity.LogIndex, - Raw: rawLog, - } - models = append(models, model) - } - return models, nil -} diff --git a/pkg/transformers/flap_kick/converter_test.go b/pkg/transformers/flap_kick/converter_test.go deleted file mode 100644 index b83f8a31..00000000 --- a/pkg/transformers/flap_kick/converter_test.go +++ /dev/null @@ -1,97 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flap_kick_test - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flap_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "math/big" - "time" -) - -var _ = Describe("Flap kick converter", func() { - var converter = flap_kick.FlapKickConverter{} - - Describe("ToEntity", func() { - It("converts an Eth Log to a FlapKickEntity", func() { - entities, err := converter.ToEntities(test_data.KovanFlapperABI, []types.Log{test_data.EthFlapKickLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(entities)).To(Equal(1)) - Expect(entities[0]).To(Equal(test_data.FlapKickEntity)) - }) - - It("returns an error if converting log to entity fails", func() { - _, err := converter.ToEntities("error abi", []types.Log{test_data.EthFlapKickLog}) - - Expect(err).To(HaveOccurred()) - }) - }) - - Describe("ToModel", func() { - - BeforeEach(func() { - }) - - It("converts an Entity to a Model", func() { - models, err := converter.ToModels([]interface{}{test_data.FlapKickEntity}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.FlapKickModel)) - }) - - It("handles nil values", func() { - emptyAddressHex := "0x0000000000000000000000000000000000000000" - emptyString := "" - emptyTime := time.Unix(0, 0) - emptyEntity := flap_kick.FlapKickEntity{} - emptyEntity.Id = big.NewInt(1) - emptyRawLogJson, err := json.Marshal(types.Log{}) - Expect(err).NotTo(HaveOccurred()) - - models, err := converter.ToModels([]interface{}{emptyEntity}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - model := models[0].(flap_kick.FlapKickModel) - Expect(model.BidId).To(Equal("1")) - Expect(model.Lot).To(Equal(emptyString)) - Expect(model.Bid).To(Equal(emptyString)) - Expect(model.Gal).To(Equal(emptyAddressHex)) - Expect(model.End).To(Equal(emptyTime)) - Expect(model.Raw).To(Equal(emptyRawLogJson)) - }) - - It("returns an error if the flap kick event id is nil", func() { - _, err := converter.ToModels([]interface{}{flap_kick.FlapKickEntity{}}) - - Expect(err).To(HaveOccurred()) - }) - - It("returns an error if the wrong entity type is passed in", func() { - _, err := converter.ToModels([]interface{}{test_data.WrongEntity{}}) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("entity of type")) - }) - }) -}) diff --git a/pkg/transformers/flap_kick/flap_kick_suite_test.go b/pkg/transformers/flap_kick/flap_kick_suite_test.go deleted file mode 100644 index 7925e9fe..00000000 --- a/pkg/transformers/flap_kick/flap_kick_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flap_kick_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestFlapKick(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "FlapKick Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/flap_kick/model.go b/pkg/transformers/flap_kick/model.go deleted file mode 100644 index 7c7635e4..00000000 --- a/pkg/transformers/flap_kick/model.go +++ /dev/null @@ -1,30 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flap_kick - -import "time" - -type FlapKickModel struct { - BidId string `db:"bid_id"` - Lot string - Bid string - Gal string - End time.Time - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/flap_kick/repository.go b/pkg/transformers/flap_kick/repository.go deleted file mode 100644 index ea9547dc..00000000 --- a/pkg/transformers/flap_kick/repository.go +++ /dev/null @@ -1,85 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flap_kick - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type FlapKickRepository struct { - db *postgres.DB -} - -func (repository *FlapKickRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - flapKickModel, ok := model.(FlapKickModel) - if !ok { - return fmt.Errorf("model of type %T, not %T", model, FlapKickModel{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.flap_kick (header_id, bid_id, lot, bid, gal, "end", tx_idx, log_idx, raw_log) - VALUES($1, $2::NUMERIC, $3::NUMERIC, $4::NUMERIC, $5, $6, $7, $8, $9) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET bid_id = $2, lot = $3, bid = $4, gal = $5, "end" = $6, raw_log = $9;`, - headerID, flapKickModel.BidId, flapKickModel.Lot, flapKickModel.Bid, flapKickModel.Gal, flapKickModel.End, flapKickModel.TransactionIndex, flapKickModel.LogIndex, flapKickModel.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.FlapKickChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository *FlapKickRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.FlapKickChecked) -} - -func (repository FlapKickRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.FlapKickChecked) -} - -func (repository FlapKickRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.FlapKickChecked) -} - -func (repository *FlapKickRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/flap_kick/repository_test.go b/pkg/transformers/flap_kick/repository_test.go deleted file mode 100644 index 3c38b246..00000000 --- a/pkg/transformers/flap_kick/repository_test.go +++ /dev/null @@ -1,92 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flap_kick_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flap_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Flap Kick Repository", func() { - var ( - db *postgres.DB - flapKickRepository flap_kick.FlapKickRepository - headerRepository repositories.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - flapKickRepository = flap_kick.FlapKickRepository{} - flapKickRepository.SetDB(db) - headerRepository = repositories.NewHeaderRepository(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.FlapKickModel - modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1 - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.FlapKickChecked, - LogEventTableName: "maker.flap_kick", - TestModel: test_data.FlapKickModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &flapKickRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists a flap kick record", func() { - headerId, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = flapKickRepository.Create(headerId, []interface{}{test_data.FlapKickModel}) - - Expect(err).NotTo(HaveOccurred()) - var count int - db.QueryRow(`SELECT count(*) FROM maker.flap_kick`).Scan(&count) - Expect(count).To(Equal(1)) - var dbResult flap_kick.FlapKickModel - err = db.Get(&dbResult, `SELECT bid, bid_id, "end", gal, lot, log_idx, tx_idx, raw_log FROM maker.flap_kick WHERE header_id = $1`, headerId) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.Bid).To(Equal(test_data.FlapKickModel.Bid)) - Expect(dbResult.BidId).To(Equal(test_data.FlapKickModel.BidId)) - Expect(dbResult.End.Equal(test_data.FlapKickModel.End)).To(BeTrue()) - Expect(dbResult.Gal).To(Equal(test_data.FlapKickModel.Gal)) - Expect(dbResult.Lot).To(Equal(test_data.FlapKickModel.Lot)) - Expect(dbResult.LogIndex).To(Equal(test_data.FlapKickModel.LogIndex)) - Expect(dbResult.TransactionIndex).To(Equal(test_data.FlapKickModel.TransactionIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.FlapKickModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.FlapKickChecked, - Repository: &flapKickRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/flip_kick/config.go b/pkg/transformers/flip_kick/config.go deleted file mode 100644 index 7fa8d908..00000000 --- a/pkg/transformers/flip_kick/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip_kick - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetFlipKickConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.FlipKickLabel, - ContractAddresses: []string{constants.FlipperContractAddress()}, - ContractAbi: constants.FlipperABI(), - Topic: constants.GetFlipKickSignature(), - StartingBlockNumber: constants.FlipperDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/flip_kick/converter.go b/pkg/transformers/flip_kick/converter.go deleted file mode 100644 index 93ba551b..00000000 --- a/pkg/transformers/flip_kick/converter.go +++ /dev/null @@ -1,100 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip_kick - -import ( - "encoding/json" - "errors" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - - "fmt" - "github.com/vulcanize/vulcanizedb/pkg/geth" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -type FlipKickConverter struct{} - -func (FlipKickConverter) ToEntities(contractAbi string, ethLogs []types.Log) ([]interface{}, error) { - var entities []interface{} - for _, ethLog := range ethLogs { - entity := &FlipKickEntity{} - address := ethLog.Address - abi, err := geth.ParseAbi(contractAbi) - if err != nil { - return nil, err - } - - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - - err = contract.UnpackLog(entity, "Kick", ethLog) - if err != nil { - return nil, err - } - entity.Raw = ethLog - entity.TransactionIndex = ethLog.TxIndex - entity.LogIndex = ethLog.Index - entities = append(entities, *entity) - } - - return entities, nil -} - -func (FlipKickConverter) ToModels(entities []interface{}) ([]interface{}, error) { - var models []interface{} - for _, entity := range entities { - flipKickEntity, ok := entity.(FlipKickEntity) - if !ok { - return nil, fmt.Errorf("entity of type %T, not %T", entity, FlipKickEntity{}) - } - - if flipKickEntity.Id == nil { - return nil, errors.New("FlipKick log ID cannot be nil.") - } - - id := flipKickEntity.Id.String() - lot := shared.BigIntToString(flipKickEntity.Lot) - bid := shared.BigIntToString(flipKickEntity.Bid) - gal := flipKickEntity.Gal.String() - endValue := shared.BigIntToInt64(flipKickEntity.End) - end := time.Unix(endValue, 0) - urn := common.BytesToAddress(flipKickEntity.Urn[:common.AddressLength]).String() - tab := shared.BigIntToString(flipKickEntity.Tab) - rawLog, err := json.Marshal(flipKickEntity.Raw) - if err != nil { - return nil, err - } - - model := FlipKickModel{ - BidId: id, - Lot: lot, - Bid: bid, - Gal: gal, - End: end, - Urn: urn, - Tab: tab, - TransactionIndex: flipKickEntity.TransactionIndex, - LogIndex: flipKickEntity.LogIndex, - Raw: rawLog, - } - models = append(models, model) - } - return models, nil -} diff --git a/pkg/transformers/flip_kick/converter_test.go b/pkg/transformers/flip_kick/converter_test.go deleted file mode 100644 index a12c4006..00000000 --- a/pkg/transformers/flip_kick/converter_test.go +++ /dev/null @@ -1,104 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip_kick_test - -import ( - "encoding/json" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/flip_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("FlipKick Converter", func() { - var converter = flip_kick.FlipKickConverter{} - - Describe("ToEntity", func() { - It("converts an Eth Log to a FlipKickEntity", func() { - entities, err := converter.ToEntities(test_data.KovanFlipperABI, []types.Log{test_data.EthFlipKickLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(entities)).To(Equal(1)) - entity := entities[0] - Expect(entity).To(Equal(test_data.FlipKickEntity)) - }) - - It("returns an error if converting log to entity fails", func() { - _, err := converter.ToEntities("error abi", []types.Log{test_data.EthFlipKickLog}) - - Expect(err).To(HaveOccurred()) - }) - }) - - Describe("ToModel", func() { - var emptyAddressHex = "0x0000000000000000000000000000000000000000" - var emptyString = "" - var emptyTime = time.Unix(0, 0) - var emptyEntity = flip_kick.FlipKickEntity{} - var emptyRawLog []byte - var err error - - BeforeEach(func() { - emptyEntity.Id = big.NewInt(1) - emptyRawLog, err = json.Marshal(types.Log{}) - Expect(err).NotTo(HaveOccurred()) - }) - - It("converts an Entity to a Model", func() { - models, err := converter.ToModels([]interface{}{test_data.FlipKickEntity}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.FlipKickModel)) - }) - - It("handles nil values", func() { - models, err := converter.ToModels([]interface{}{emptyEntity}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - model := models[0].(flip_kick.FlipKickModel) - Expect(model.BidId).To(Equal("1")) - Expect(model.Lot).To(Equal(emptyString)) - Expect(model.Bid).To(Equal(emptyString)) - Expect(model.Gal).To(Equal(emptyAddressHex)) - Expect(model.End).To(Equal(emptyTime)) - Expect(model.Urn).To(Equal(emptyAddressHex)) - Expect(model.Tab).To(Equal(emptyString)) - Expect(model.Raw).To(Equal(emptyRawLog)) - }) - - It("returns an error if the flip kick event id is nil", func() { - emptyEntity.Id = nil - _, err := converter.ToModels([]interface{}{emptyEntity}) - - Expect(err).To(HaveOccurred()) - }) - - It("returns an error if the wrong entity type is passed in", func() { - _, err := converter.ToModels([]interface{}{test_data.WrongEntity{}}) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("entity of type")) - }) - }) -}) diff --git a/pkg/transformers/flip_kick/flip_kick_suite_test.go b/pkg/transformers/flip_kick/flip_kick_suite_test.go deleted file mode 100644 index b813aef9..00000000 --- a/pkg/transformers/flip_kick/flip_kick_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip_kick - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestFlipKick(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "FlipKick Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/flip_kick/model.go b/pkg/transformers/flip_kick/model.go deleted file mode 100644 index bc817886..00000000 --- a/pkg/transformers/flip_kick/model.go +++ /dev/null @@ -1,32 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip_kick - -import "time" - -type FlipKickModel struct { - BidId string `db:"bid_id"` - Lot string - Bid string - Gal string - End time.Time - Urn string - Tab string - TransactionIndex uint `db:"tx_idx"` - LogIndex uint `db:"log_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/flip_kick/repository.go b/pkg/transformers/flip_kick/repository.go deleted file mode 100644 index fb18c9f3..00000000 --- a/pkg/transformers/flip_kick/repository.go +++ /dev/null @@ -1,83 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip_kick - -import ( - "fmt" - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type FlipKickRepository struct { - db *postgres.DB -} - -func (repository FlipKickRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - flipKickModel, ok := model.(FlipKickModel) - if !ok { - return fmt.Errorf("model of type %T, not %T", model, FlipKickModel{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.flip_kick (header_id, bid_id, lot, bid, gal, "end", urn, tab, tx_idx, log_idx, raw_log) - VALUES($1, $2::NUMERIC, $3::NUMERIC, $4::NUMERIC, $5, $6, $7, $8::NUMERIC, $9, $10, $11) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET bid_id = $2, lot = $3, bid = $4, gal = $5, "end" = $6, urn= $7, tab = $8, raw_log = $11;`, - headerID, flipKickModel.BidId, flipKickModel.Lot, flipKickModel.Bid, flipKickModel.Gal, flipKickModel.End, flipKickModel.Urn, flipKickModel.Tab, flipKickModel.TransactionIndex, flipKickModel.LogIndex, flipKickModel.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.FlipKickChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository FlipKickRepository) MarkHeaderChecked(headerId int64) error { - return shared.MarkHeaderChecked(headerId, repository.db, constants.FlipKickChecked) -} - -func (repository FlipKickRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.FlipKickChecked) -} - -func (repository FlipKickRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.FlipKickChecked) -} - -func (repository *FlipKickRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/flip_kick/repository_test.go b/pkg/transformers/flip_kick/repository_test.go deleted file mode 100644 index 9d9d42f8..00000000 --- a/pkg/transformers/flip_kick/repository_test.go +++ /dev/null @@ -1,100 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flip_kick_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flip_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("FlipKick Repository", func() { - var db *postgres.DB - var flipKickRepository flip_kick.FlipKickRepository - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - flipKickRepository = flip_kick.FlipKickRepository{} - flipKickRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.FlipKickModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.FlipKickChecked, - LogEventTableName: "maker.flip_kick", - TestModel: test_data.FlipKickModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &flipKickRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists flip_kick records", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerId, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = flipKickRepository.Create(headerId, []interface{}{test_data.FlipKickModel}) - Expect(err).NotTo(HaveOccurred()) - - assertDBRecordCount(db, "maker.flip_kick", 1) - - dbResult := test_data.FlipKickDBRow{} - err = db.QueryRowx(`SELECT * FROM maker.flip_kick`).StructScan(&dbResult) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.HeaderId).To(Equal(headerId)) - Expect(dbResult.BidId).To(Equal(test_data.FlipKickModel.BidId)) - Expect(dbResult.Lot).To(Equal(test_data.FlipKickModel.Lot)) - Expect(dbResult.Bid).To(Equal(test_data.FlipKickModel.Bid)) - Expect(dbResult.Gal).To(Equal(test_data.FlipKickModel.Gal)) - Expect(dbResult.End.Equal(test_data.FlipKickModel.End)).To(BeTrue()) - Expect(dbResult.Urn).To(Equal(test_data.FlipKickModel.Urn)) - Expect(dbResult.Tab).To(Equal(test_data.FlipKickModel.Tab)) - Expect(dbResult.TransactionIndex).To(Equal(test_data.FlipKickModel.TransactionIndex)) - Expect(dbResult.LogIndex).To(Equal(test_data.FlipKickModel.LogIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.FlipKickModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.FlipKickChecked, - Repository: &flipKickRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) - -func assertDBRecordCount(db *postgres.DB, dbTable string, expectedCount int) { - var count int - query := `SELECT count(*) FROM ` + dbTable - err := db.QueryRow(query).Scan(&count) - Expect(err).NotTo(HaveOccurred()) - Expect(count).To(Equal(expectedCount)) -} diff --git a/pkg/transformers/flop_kick/config.go b/pkg/transformers/flop_kick/config.go deleted file mode 100644 index 5356dbe3..00000000 --- a/pkg/transformers/flop_kick/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flop_kick - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetFlopKickConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.FlopKickLabel, - ContractAddresses: []string{constants.FlopperContractAddress()}, - ContractAbi: constants.FlopperABI(), - Topic: constants.GetFlopKickSignature(), - StartingBlockNumber: constants.FlopperDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/flop_kick/converter.go b/pkg/transformers/flop_kick/converter.go deleted file mode 100644 index 412a7e4d..00000000 --- a/pkg/transformers/flop_kick/converter.go +++ /dev/null @@ -1,85 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flop_kick - -import ( - "encoding/json" - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/core/types" - - "fmt" - "github.com/vulcanize/vulcanizedb/pkg/geth" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -type FlopKickConverter struct{} - -func (FlopKickConverter) ToEntities(contractAbi string, ethLogs []types.Log) ([]interface{}, error) { - var results []interface{} - for _, ethLog := range ethLogs { - entity := Entity{} - address := ethLog.Address - abi, err := geth.ParseAbi(contractAbi) - if err != nil { - return nil, err - } - - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - - err = contract.UnpackLog(&entity, "Kick", ethLog) - if err != nil { - return nil, err - } - entity.Raw = ethLog - entity.TransactionIndex = ethLog.TxIndex - entity.LogIndex = ethLog.Index - results = append(results, entity) - } - return results, nil -} - -func (FlopKickConverter) ToModels(entities []interface{}) ([]interface{}, error) { - var results []interface{} - for _, entity := range entities { - flopKickEntity, ok := entity.(Entity) - if !ok { - return nil, fmt.Errorf("entity of type %T, not %T", entity, Entity{}) - } - - endValue := shared.BigIntToInt64(flopKickEntity.End) - rawLogJson, err := json.Marshal(flopKickEntity.Raw) - if err != nil { - return nil, err - } - - model := Model{ - BidId: shared.BigIntToString(flopKickEntity.Id), - Lot: shared.BigIntToString(flopKickEntity.Lot), - Bid: shared.BigIntToString(flopKickEntity.Bid), - Gal: flopKickEntity.Gal.String(), - End: time.Unix(endValue, 0), - TransactionIndex: flopKickEntity.TransactionIndex, - LogIndex: flopKickEntity.LogIndex, - Raw: rawLogJson, - } - results = append(results, model) - } - - return results, nil -} diff --git a/pkg/transformers/flop_kick/converter_test.go b/pkg/transformers/flop_kick/converter_test.go deleted file mode 100644 index ee9faf3c..00000000 --- a/pkg/transformers/flop_kick/converter_test.go +++ /dev/null @@ -1,93 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flop_kick_test - -import ( - "encoding/json" - "time" - - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/flop_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("FlopKick Converter", func() { - Describe("ToEntities", func() { - It("converts a log to a FlopKick entity", func() { - converter := flop_kick.FlopKickConverter{} - entities, err := converter.ToEntities(test_data.KovanFlopperABI, []types.Log{test_data.FlopKickLog}) - - Expect(err).NotTo(HaveOccurred()) - entity := entities[0] - Expect(entity).To(Equal(test_data.FlopKickEntity)) - }) - - It("returns an error if converting the log to an entity fails", func() { - converter := flop_kick.FlopKickConverter{} - entities, err := converter.ToEntities("error abi", []types.Log{test_data.FlopKickLog}) - - Expect(err).To(HaveOccurred()) - Expect(entities).To(BeNil()) - }) - }) - - Describe("ToModels", func() { - var emptyAddressHex = "0x0000000000000000000000000000000000000000" - var emptyString = "" - var emptyTime = time.Unix(0, 0) - var emptyEntity = flop_kick.Entity{} - - It("converts an Entity to a Model", func() { - converter := flop_kick.FlopKickConverter{} - models, err := converter.ToModels([]interface{}{test_data.FlopKickEntity}) - - Expect(err).NotTo(HaveOccurred()) - Expect(models[0]).To(Equal(test_data.FlopKickModel)) - }) - - It("returns error if wrong entity", func() { - converter := flop_kick.FlopKickConverter{} - _, err := converter.ToModels([]interface{}{test_data.WrongEntity{}}) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("entity of type test_data.WrongEntity, not flop_kick.Entity")) - }) - - It("handles nil values", func() { - emptyLog, err := json.Marshal(types.Log{}) - - converter := flop_kick.FlopKickConverter{} - expectedModel := flop_kick.Model{ - BidId: emptyString, - Lot: emptyString, - Bid: emptyString, - Gal: emptyAddressHex, - End: emptyTime, - TransactionIndex: 0, - Raw: emptyLog, - } - - models, err := converter.ToModels([]interface{}{emptyEntity}) - model := models[0] - Expect(err).NotTo(HaveOccurred()) - Expect(model).To(Equal(expectedModel)) - }) - }) -}) diff --git a/pkg/transformers/flop_kick/entity.go b/pkg/transformers/flop_kick/entity.go deleted file mode 100644 index 3a598288..00000000 --- a/pkg/transformers/flop_kick/entity.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flop_kick - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" -) - -type Entity struct { - Id *big.Int - Lot *big.Int - Bid *big.Int - Gal common.Address - End *big.Int - TransactionIndex uint - LogIndex uint - Raw types.Log -} diff --git a/pkg/transformers/flop_kick/flop_kick_suite_test.go b/pkg/transformers/flop_kick/flop_kick_suite_test.go deleted file mode 100644 index e54ed14b..00000000 --- a/pkg/transformers/flop_kick/flop_kick_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package flop_kick_test - -import ( - "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestFlopKick(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "FlopKick Suite") -} - -var _ = BeforeSuite(func() { - logrus.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/flop_kick/model.go b/pkg/transformers/flop_kick/model.go deleted file mode 100644 index d78547cf..00000000 --- a/pkg/transformers/flop_kick/model.go +++ /dev/null @@ -1,30 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flop_kick - -import "time" - -type Model struct { - BidId string `db:"bid_id"` - Lot string - Bid string - Gal string - End time.Time - TransactionIndex uint `db:"tx_idx"` - LogIndex uint `db:"log_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/flop_kick/repository.go b/pkg/transformers/flop_kick/repository.go deleted file mode 100644 index a71a618b..00000000 --- a/pkg/transformers/flop_kick/repository.go +++ /dev/null @@ -1,87 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flop_kick - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type FlopKickRepository struct { - db *postgres.DB -} - -func (repository FlopKickRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, flopKick := range models { - flopKickModel, ok := flopKick.(Model) - - if !ok { - return fmt.Errorf("model of type %T, not %T", flopKick, Model{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.flop_kick (header_id, bid_id, lot, bid, gal, "end", tx_idx, log_idx, raw_log) - VALUES($1, $2::NUMERIC, $3::NUMERIC, $4::NUMERIC, $5, $6, $7, $8, $9) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET bid_id = $2, lot = $3, bid = $4, gal = $5, "end" = $6, raw_log = $9;`, - headerID, flopKickModel.BidId, flopKickModel.Lot, flopKickModel.Bid, flopKickModel.Gal, flopKickModel.End, flopKickModel.TransactionIndex, flopKickModel.LogIndex, flopKickModel.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.FlopKickChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository FlopKickRepository) MarkHeaderChecked(headerId int64) error { - return shared.MarkHeaderChecked(headerId, repository.db, constants.FlopKickChecked) -} - -func (repository FlopKickRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.FlopKickChecked) -} - -func (repository FlopKickRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.FlopKickChecked) -} - -func (repository *FlopKickRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/flop_kick/repository_test.go b/pkg/transformers/flop_kick/repository_test.go deleted file mode 100644 index cf2990ce..00000000 --- a/pkg/transformers/flop_kick/repository_test.go +++ /dev/null @@ -1,90 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package flop_kick_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flop_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("FlopRepository", func() { - var ( - db *postgres.DB - repository flop_kick.FlopKickRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repository = flop_kick.FlopKickRepository{} - repository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.FlopKickModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.FlopKickChecked, - LogEventTableName: "maker.flop_kick", - TestModel: test_data.FlopKickModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("creates FlopKick records", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerId, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = repository.Create(headerId, []interface{}{test_data.FlopKickModel}) - Expect(err).NotTo(HaveOccurred()) - - dbResult := test_data.FlopKickDBResult{} - err = db.QueryRowx(`SELECT * FROM maker.flop_kick WHERE header_id = $1`, headerId).StructScan(&dbResult) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.HeaderId).To(Equal(headerId)) - Expect(dbResult.BidId).To(Equal(test_data.FlopKickModel.BidId)) - Expect(dbResult.Lot).To(Equal(test_data.FlopKickModel.Lot)) - Expect(dbResult.Bid).To(Equal(test_data.FlopKickModel.Bid)) - Expect(dbResult.Gal).To(Equal(test_data.FlopKickModel.Gal)) - Expect(dbResult.End.Equal(test_data.FlopKickModel.End)).To(BeTrue()) - Expect(dbResult.TransactionIndex).To(Equal(test_data.FlopKickModel.TransactionIndex)) - Expect(dbResult.LogIndex).To(Equal(test_data.FlopKickModel.LogIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.FlopKickModel.Raw)) - }) - }) - - Describe("MarkedHeadersChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.FlopKickChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/frob/config.go b/pkg/transformers/frob/config.go deleted file mode 100644 index 5c91231a..00000000 --- a/pkg/transformers/frob/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package frob - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetFrobConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.FrobLabel, - ContractAddresses: []string{constants.PitContractAddress()}, - ContractAbi: constants.PitABI(), - Topic: constants.GetFrobSignature(), - StartingBlockNumber: constants.PitDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/frob/converter.go b/pkg/transformers/frob/converter.go deleted file mode 100644 index a69809bb..00000000 --- a/pkg/transformers/frob/converter.go +++ /dev/null @@ -1,81 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package frob - -import ( - "encoding/json" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - - "github.com/vulcanize/vulcanizedb/pkg/geth" -) - -type FrobConverter struct{} - -func (FrobConverter) ToEntities(contractAbi string, ethLogs []types.Log) ([]interface{}, error) { - var entities []interface{} - for _, ethLog := range ethLogs { - entity := FrobEntity{} - address := ethLog.Address - abi, err := geth.ParseAbi(contractAbi) - if err != nil { - return nil, err - } - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - err = contract.UnpackLog(&entity, "Frob", ethLog) - if err != nil { - return entities, err - } - entity.LogIndex = ethLog.Index - entity.TransactionIndex = ethLog.TxIndex - entity.Raw = ethLog - entities = append(entities, entity) - } - - return entities, nil -} - -func (FrobConverter) ToModels(entities []interface{}) ([]interface{}, error) { - var models []interface{} - for _, entity := range entities { - frobEntity, ok := entity.(FrobEntity) - if !ok { - return nil, fmt.Errorf("entity of type %T, not %T", entity, FrobEntity{}) - } - - rawLog, err := json.Marshal(frobEntity.Raw) - if err != nil { - return nil, err - } - model := FrobModel{ - Ilk: shared.GetHexWithoutPrefix(frobEntity.Ilk[:]), - Urn: shared.GetHexWithoutPrefix(frobEntity.Urn[:]), - Ink: frobEntity.Ink.String(), - Art: frobEntity.Art.String(), - Dink: frobEntity.Dink.String(), - Dart: frobEntity.Dart.String(), - IArt: frobEntity.IArt.String(), - LogIndex: frobEntity.LogIndex, - TransactionIndex: frobEntity.TransactionIndex, - Raw: rawLog, - } - models = append(models, model) - } - return models, nil -} diff --git a/pkg/transformers/frob/converter_test.go b/pkg/transformers/frob/converter_test.go deleted file mode 100644 index 75b7ccf1..00000000 --- a/pkg/transformers/frob/converter_test.go +++ /dev/null @@ -1,58 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package frob_test - -import ( - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/frob" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Frob converter", func() { - var converter = frob.FrobConverter{} - It("converts a log to an entity", func() { - entities, err := converter.ToEntities(test_data.KovanPitABI, []types.Log{test_data.EthFrobLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(entities)).To(Equal(1)) - Expect(entities[0]).To(Equal(test_data.FrobEntity)) - }) - - It("returns an error if converting to an entity fails", func() { - _, err := converter.ToEntities("bad abi", []types.Log{test_data.EthFrobLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts an entity to a model", func() { - models, err := converter.ToModels([]interface{}{test_data.FrobEntity}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.FrobModel)) - }) - - It("returns an error if the entity type is wrong", func() { - _, err := converter.ToModels([]interface{}{test_data.WrongEntity{}}) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("entity of type test_data.WrongEntity, not frob.FrobEntity")) - }) -}) diff --git a/pkg/transformers/frob/frob_suite_test.go b/pkg/transformers/frob/frob_suite_test.go deleted file mode 100644 index 16b3b57a..00000000 --- a/pkg/transformers/frob/frob_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package frob_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestFrob(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Frob Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/frob/model.go b/pkg/transformers/frob/model.go deleted file mode 100644 index 86acc6a9..00000000 --- a/pkg/transformers/frob/model.go +++ /dev/null @@ -1,30 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package frob - -type FrobModel struct { - Ilk string - Urn string - Ink string - Art string - Dink string - Dart string - IArt string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/frob/repository.go b/pkg/transformers/frob/repository.go deleted file mode 100644 index 14cb20ae..00000000 --- a/pkg/transformers/frob/repository.go +++ /dev/null @@ -1,94 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package frob - -import ( - "fmt" - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type FrobRepository struct { - db *postgres.DB -} - -func (repository FrobRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - frobModel, ok := model.(FrobModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, FrobModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(frobModel.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec(`INSERT INTO maker.frob (header_id, art, dart, dink, iart, ilk, ink, urn, raw_log, log_idx, tx_idx) - VALUES($1, $2::NUMERIC, $3::NUMERIC, $4::NUMERIC, $5::NUMERIC, $6, $7::NUMERIC, $8, $9, $10, $11) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET art = $2, dart = $3, dink = $4, iart = $5, ilk = $6, ink = $7, urn = $8, raw_log = $9;`, - headerID, frobModel.Art, frobModel.Dart, frobModel.Dink, frobModel.IArt, ilkID, frobModel.Ink, frobModel.Urn, frobModel.Raw, frobModel.LogIndex, frobModel.TransactionIndex) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.FrobChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository FrobRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.FrobChecked) -} - -func (repository FrobRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.FrobChecked) -} - -func (repository FrobRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.FrobChecked) -} - -func (repository *FrobRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/frob/repository_test.go b/pkg/transformers/frob/repository_test.go deleted file mode 100644 index bcb095a4..00000000 --- a/pkg/transformers/frob/repository_test.go +++ /dev/null @@ -1,95 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package frob_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/frob" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Frob repository", func() { - var ( - db *postgres.DB - frobRepository frob.FrobRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - frobRepository = frob.FrobRepository{} - frobRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.FrobModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.FrobChecked, - LogEventTableName: "maker.frob", - TestModel: test_data.FrobModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &frobRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a frob", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = frobRepository.Create(headerID, []interface{}{test_data.FrobModel}) - Expect(err).NotTo(HaveOccurred()) - var dbFrob frob.FrobModel - err = db.Get(&dbFrob, `SELECT art, dart, dink, iart, ilk, ink, urn, log_idx, tx_idx, raw_log FROM maker.frob WHERE header_id = $1`, headerID) - - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.FrobModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbFrob.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbFrob.Urn).To(Equal(test_data.FrobModel.Urn)) - Expect(dbFrob.Ink).To(Equal(test_data.FrobModel.Ink)) - Expect(dbFrob.Art).To(Equal(test_data.FrobModel.Art)) - Expect(dbFrob.Dink).To(Equal(test_data.FrobModel.Dink)) - Expect(dbFrob.Dart).To(Equal(test_data.FrobModel.Dart)) - Expect(dbFrob.IArt).To(Equal(test_data.FrobModel.IArt)) - Expect(dbFrob.LogIndex).To(Equal(test_data.FrobModel.LogIndex)) - Expect(dbFrob.TransactionIndex).To(Equal(test_data.FrobModel.TransactionIndex)) - Expect(dbFrob.Raw).To(MatchJSON(test_data.FrobModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.FrobChecked, - Repository: &frobRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/integration_tests/bite.go b/pkg/transformers/integration_tests/bite.go deleted file mode 100644 index 28c1cb8c..00000000 --- a/pkg/transformers/integration_tests/bite.go +++ /dev/null @@ -1,181 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "strconv" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - - "github.com/vulcanize/vulcanizedb/pkg/geth" - "github.com/vulcanize/vulcanizedb/pkg/transformers/bite" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var testBiteConfig = shared.TransformerConfig{ - TransformerName: constants.BiteLabel, - ContractAddresses: []string{test_data.KovanCatContractAddress}, - ContractAbi: test_data.KovanCatABI, - Topic: test_data.KovanBiteSignature, - StartingBlockNumber: 0, - EndingBlockNumber: -1, -} - -var _ = Describe("Bite Transformer", func() { - It("fetches and transforms a Bite event from Kovan chain", func() { - blockNumber := int64(8956422) - config := testBiteConfig - config.StartingBlockNumber = blockNumber - config.EndingBlockNumber = blockNumber - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.Transformer{ - Config: config, - Converter: &bite.BiteConverter{}, - Repository: &bite.BiteRepository{}, - } - transformer := initializer.NewTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - []common.Address{common.HexToAddress(config.ContractAddresses[0])}, - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []bite.BiteModel - err = db.Select(&dbResult, `SELECT art, iart, ilk, ink, nflip, tab, urn from maker.bite`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Art).To(Equal("149846666666666655744")) - Expect(dbResult[0].IArt).To(Equal("1645356666666666655736")) - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Ink).To(Equal("1000000000000000000")) - Expect(dbResult[0].NFlip).To(Equal("2")) - Expect(dbResult[0].Tab).To(Equal("149846666666666655744")) - Expect(dbResult[0].Urn).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb")) - }) - - It("unpacks an event log", func() { - address := common.HexToAddress(test_data.KovanCatContractAddress) - abi, err := geth.ParseAbi(test_data.KovanCatABI) - Expect(err).NotTo(HaveOccurred()) - - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - entity := &bite.BiteEntity{} - - var eventLog = test_data.EthBiteLog - - err = contract.UnpackLog(entity, "Bite", eventLog) - Expect(err).NotTo(HaveOccurred()) - - expectedEntity := test_data.BiteEntity - Expect(entity.Art).To(Equal(expectedEntity.Art)) - Expect(entity.Ilk).To(Equal(expectedEntity.Ilk)) - Expect(entity.Ink).To(Equal(expectedEntity.Ink)) - }) - - It("rechecks header for bite event", func() { - blockNumber := int64(8956422) - config := testBiteConfig - config.StartingBlockNumber = blockNumber - config.EndingBlockNumber = blockNumber - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.Transformer{ - Config: config, - Converter: &bite.BiteConverter{}, - Repository: &bite.BiteRepository{}, - } - transformer := initializer.NewTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - []common.Address{common.HexToAddress(config.ContractAddresses[0])}, - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var biteChecked []int - err = db.Select(&biteChecked, `SELECT bite_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(biteChecked[0]).To(Equal(2)) - }) - - It("unpacks an event log", func() { - address := common.HexToAddress(test_data.KovanCatContractAddress) - abi, err := geth.ParseAbi(test_data.KovanCatABI) - Expect(err).NotTo(HaveOccurred()) - - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - entity := &bite.BiteEntity{} - - var eventLog = test_data.EthBiteLog - - err = contract.UnpackLog(entity, "Bite", eventLog) - Expect(err).NotTo(HaveOccurred()) - - expectedEntity := test_data.BiteEntity - Expect(entity.Art).To(Equal(expectedEntity.Art)) - Expect(entity.Ilk).To(Equal(expectedEntity.Ilk)) - Expect(entity.Ink).To(Equal(expectedEntity.Ink)) - }) -}) diff --git a/pkg/transformers/integration_tests/cat_file.go b/pkg/transformers/integration_tests/cat_file.go deleted file mode 100644 index 48ce0c37..00000000 --- a/pkg/transformers/integration_tests/cat_file.go +++ /dev/null @@ -1,304 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "sort" - "strconv" - - "github.com/ethereum/go-ethereum/ethclient" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/geth/client" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/chop_lump" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/flip" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/pit_vow" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Cat File transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - rpcClient client.RpcClient - err error - ethClient *ethclient.Client - fetcher *shared.Fetcher - ) - - BeforeEach(func() { - rpcClient, ethClient, err = getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - fetcher = shared.NewFetcher(blockChain) - }) - - // Cat contract Kovan address: 0x2f34f22a00ee4b7a8f8bbc4eaee1658774c624e0 - It("persists a chop lump event", func() { - // transaction: 0x98574bfba4d05c3875be10d2376e678d005dbebe9a4520363407508fd21f4014 - chopLumpBlockNumber := int64(8762253) - header, err := persistHeader(db, chopLumpBlockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - config := shared.TransformerConfig{ - TransformerName: constants.CatFileChopLumpLabel, - ContractAddresses: []string{test_data.KovanCatContractAddress}, - ContractAbi: test_data.KovanCatABI, - Topic: test_data.KovanCatFileChopLumpSignature, - StartingBlockNumber: chopLumpBlockNumber, - EndingBlockNumber: chopLumpBlockNumber, - } - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &chop_lump.CatFileChopLumpConverter{}, - Repository: &chop_lump.CatFileChopLumpRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - logs, err := fetcher.FetchLogs( - []common.Address{common.HexToAddress(config.ContractAddresses[0])}, - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []chop_lump.CatFileChopLumpModel - err = db.Select(&dbResult, `SELECT ilk, what, data, log_idx FROM maker.cat_file_chop_lump`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(2)) - sort.Sort(byLogIndexChopLump(dbResult)) - - ilkID, err := shared.GetOrCreateIlk("5245500000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].What).To(Equal("lump")) - Expect(dbResult[0].Data).To(Equal("10000.000000000000000000")) - Expect(dbResult[0].LogIndex).To(Equal(uint(3))) - - Expect(dbResult[1].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[1].What).To(Equal("chop")) - Expect(dbResult[1].Data).To(Equal("1.000000000000000000000000000")) - Expect(dbResult[1].LogIndex).To(Equal(uint(4))) - }) - - It("rechecks header for chop lump event", func() { - // transaction: 0x98574bfba4d05c3875be10d2376e678d005dbebe9a4520363407508fd21f4014 - chopLumpBlockNumber := int64(8762253) - header, err := persistHeader(db, chopLumpBlockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - config := shared.TransformerConfig{ - TransformerName: constants.CatFileChopLumpLabel, - ContractAddresses: []string{test_data.KovanCatContractAddress}, - ContractAbi: test_data.KovanCatABI, - Topic: test_data.KovanCatFileChopLumpSignature, - StartingBlockNumber: chopLumpBlockNumber, - EndingBlockNumber: chopLumpBlockNumber, - } - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &chop_lump.CatFileChopLumpConverter{}, - Repository: &chop_lump.CatFileChopLumpRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - logs, err := fetcher.FetchLogs( - []common.Address{common.HexToAddress(config.ContractAddresses[0])}, - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, chopLumpBlockNumber) - Expect(err).NotTo(HaveOccurred()) - - var catChopLumpChecked []int - err = db.Select(&catChopLumpChecked, `SELECT cat_file_chop_lump_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(catChopLumpChecked[0]).To(Equal(2)) - }) - - It("persists a flip event", func() { - // transaction: 0x44bc18fdb1a5a263db114e7879653304db3e19ceb4e4496f21bc0a76c5faccbe - flipBlockNumber := int64(8751794) - header, err := persistHeader(db, flipBlockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - config := shared.TransformerConfig{ - TransformerName: constants.CatFileFlipLabel, - ContractAddresses: []string{test_data.KovanCatContractAddress}, - ContractAbi: test_data.KovanCatABI, - Topic: test_data.KovanCatFileFlipSignature, - StartingBlockNumber: flipBlockNumber, - EndingBlockNumber: flipBlockNumber, - } - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &flip.CatFileFlipConverter{}, - Repository: &flip.CatFileFlipRepository{}, - } - - transformer := initializer.NewLogNoteTransformer(db) - - logs, err := fetcher.FetchLogs( - []common.Address{common.HexToAddress(config.ContractAddresses[0])}, - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []flip.CatFileFlipModel - err = db.Select(&dbResult, `SELECT ilk, what, flip FROM maker.cat_file_flip`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000")) - Expect(dbResult[0].What).To(Equal("flip")) - Expect(dbResult[0].Flip).To(Equal("0x32D496Ad866D110060866B7125981C73642cc509")) - }) - - It("rechecks a flip event", func() { - // transaction: 0x44bc18fdb1a5a263db114e7879653304db3e19ceb4e4496f21bc0a76c5faccbe - flipBlockNumber := int64(8751794) - header, err := persistHeader(db, flipBlockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - config := shared.TransformerConfig{ - TransformerName: constants.CatFileFlipLabel, - ContractAddresses: []string{test_data.KovanCatContractAddress}, - ContractAbi: test_data.KovanCatABI, - Topic: test_data.KovanCatFileFlipSignature, - StartingBlockNumber: flipBlockNumber, - EndingBlockNumber: flipBlockNumber, - } - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &flip.CatFileFlipConverter{}, - Repository: &flip.CatFileFlipRepository{}, - } - - transformer := initializer.NewLogNoteTransformer(db) - - logs, err := fetcher.FetchLogs( - []common.Address{common.HexToAddress(config.ContractAddresses[0])}, - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, flipBlockNumber) - Expect(err).NotTo(HaveOccurred()) - - var catFlipChecked []int - err = db.Select(&catFlipChecked, `SELECT cat_file_flip_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(catFlipChecked[0]).To(Equal(2)) - }) - - It("persists a pit vow event", func() { - // transaction: 0x44bc18fdb1a5a263db114e7879653304db3e19ceb4e4496f21bc0a76c5faccbe - pitVowBlockNumber := int64(8751794) - header, err := persistHeader(db, pitVowBlockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - config := shared.TransformerConfig{ - TransformerName: constants.CatFilePitVowLabel, - ContractAddresses: []string{test_data.KovanCatContractAddress}, - ContractAbi: test_data.KovanCatABI, - Topic: test_data.KovanCatFilePitVowSignature, - StartingBlockNumber: pitVowBlockNumber, - EndingBlockNumber: pitVowBlockNumber, - } - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &pit_vow.CatFilePitVowConverter{}, - Repository: &pit_vow.CatFilePitVowRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - logs, err := fetcher.FetchLogs( - []common.Address{common.HexToAddress(config.ContractAddresses[0])}, - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []pit_vow.CatFilePitVowModel - err = db.Select(&dbResult, `SELECT what, data, log_idx FROM maker.cat_file_pit_vow`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(2)) - sort.Sort(byLogIndexPitVow(dbResult)) - Expect(dbResult[0].What).To(Equal("vow")) - Expect(dbResult[0].Data).To(Equal("0x3728e9777B2a0a611ee0F89e00E01044ce4736d1")) - Expect(dbResult[0].LogIndex).To(Equal(uint(1))) - - Expect(dbResult[1].What).To(Equal("pit")) - Expect(dbResult[1].Data).To(Equal("0xE7CF3198787C9A4daAc73371A38f29aAeECED87e")) - Expect(dbResult[1].LogIndex).To(Equal(uint(2))) - }) -}) - -type byLogIndexChopLump []chop_lump.CatFileChopLumpModel - -func (c byLogIndexChopLump) Len() int { return len(c) } -func (c byLogIndexChopLump) Less(i, j int) bool { return c[i].LogIndex < c[j].LogIndex } -func (c byLogIndexChopLump) Swap(i, j int) { c[i], c[j] = c[j], c[i] } - -type byLogIndexPitVow []pit_vow.CatFilePitVowModel - -func (c byLogIndexPitVow) Len() int { return len(c) } -func (c byLogIndexPitVow) Less(i, j int) bool { return c[i].LogIndex < c[j].LogIndex } -func (c byLogIndexPitVow) Swap(i, j int) { c[i], c[j] = c[j], c[i] } diff --git a/pkg/transformers/integration_tests/deal.go b/pkg/transformers/integration_tests/deal.go deleted file mode 100644 index 8e8a6908..00000000 --- a/pkg/transformers/integration_tests/deal.go +++ /dev/null @@ -1,154 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/deal" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Deal transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - config shared.TransformerConfig - initializer factories.LogNoteTransformer - fetcher *shared.Fetcher - addresses []common.Address - topics []common.Hash - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - config = shared.TransformerConfig{ - TransformerName: constants.DealLabel, - ContractAddresses: []string{test_data.KovanFlapperContractAddress, test_data.KovanFlipperContractAddress, test_data.KovanFlopperContractAddress}, - ContractAbi: test_data.KovanFlipperABI, - Topic: test_data.KovanDealSignature, - StartingBlockNumber: 0, - EndingBlockNumber: -1, - } - - initializer = factories.LogNoteTransformer{ - Config: config, - Converter: &deal.DealConverter{}, - Repository: &deal.DealRepository{}, - } - - fetcher = shared.NewFetcher(blockChain) - addresses = shared.HexStringsToAddresses(config.ContractAddresses) - topics = []common.Hash{common.HexToHash(config.Topic)} - - }) - - It("persists a flip deal log event", func() { - // transaction: 0x05b5eabac2ace136f0f7e0efc61d7d42abe8e8938cc0f04fbf1a6ba545d59e58 - flipBlockNumber := int64(8958007) - header, err := persistHeader(db, flipBlockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer.Config.StartingBlockNumber = flipBlockNumber - initializer.Config.EndingBlockNumber = flipBlockNumber - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []deal.DealModel - err = db.Select(&dbResult, `SELECT bid_id, contract_address FROM maker.deal`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].BidId).To(Equal("6")) - Expect(dbResult[0].ContractAddress).To(Equal(test_data.KovanFlipperContractAddress)) - }) - - It("rechecks flip deal event", func() { - // transaction: 0x05b5eabac2ace136f0f7e0efc61d7d42abe8e8938cc0f04fbf1a6ba545d59e58 - flipBlockNumber := int64(8958007) - header, err := persistHeader(db, flipBlockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer.Config.StartingBlockNumber = flipBlockNumber - initializer.Config.EndingBlockNumber = flipBlockNumber - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, flipBlockNumber) - Expect(err).NotTo(HaveOccurred()) - - var dentChecked []int - err = db.Select(&dentChecked, `SELECT deal_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - }) - - It("persists a flop deal log event", func() { - //TODO: There are currently no Flop.deal events on Kovan - }) - - It("persists a flap deal log event", func() { - flapBlockNumber := int64(9004628) - header, err := persistHeader(db, flapBlockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer.Config.StartingBlockNumber = flapBlockNumber - initializer.Config.EndingBlockNumber = flapBlockNumber - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []deal.DealModel - err = db.Select(&dbResult, `SELECT bid_id, contract_address FROM maker.deal`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].BidId).To(Equal("1")) - Expect(dbResult[0].ContractAddress).To(Equal(test_data.KovanFlapperContractAddress)) - }) -}) diff --git a/pkg/transformers/integration_tests/dent.go b/pkg/transformers/integration_tests/dent.go deleted file mode 100644 index aa12143a..00000000 --- a/pkg/transformers/integration_tests/dent.go +++ /dev/null @@ -1,123 +0,0 @@ -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/dent" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Dent transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - fetcher *shared.Fetcher - transformer shared.Transformer - config shared.TransformerConfig - addresses []common.Address - topics []common.Hash - initializer factories.LogNoteTransformer - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - config = shared.TransformerConfig{ - TransformerName: constants.DentLabel, - ContractAddresses: []string{test_data.KovanFlipperContractAddress, test_data.KovanFlopperContractAddress}, - ContractAbi: test_data.KovanFlipperABI, - Topic: test_data.KovanDentFunctionSignature, - StartingBlockNumber: 0, - EndingBlockNumber: -1, - } - - addresses = shared.HexStringsToAddresses(config.ContractAddresses) - topics = []common.Hash{common.HexToHash(config.Topic)} - fetcher = shared.NewFetcher(blockChain) - - initializer = factories.LogNoteTransformer{ - Config: config, - Converter: &dent.DentConverter{}, - Repository: &dent.DentRepository{}, - } - }) - - It("persists a flop dent log event", func() { - blockNumber := int64(8955613) - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer = initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []dent.DentModel - err = db.Select(&dbResult, `SELECT bid, bid_id, guy, lot FROM maker.dent`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("10000000000000000000000")) - Expect(dbResult[0].BidId).To(Equal("2")) - Expect(dbResult[0].Guy).To(Equal("0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB")) - Expect(dbResult[0].Lot).To(Equal("1000000000000000000000000000")) - - var dbTic int64 - err = db.Get(&dbTic, `SELECT tic FROM maker.dent`) - Expect(err).NotTo(HaveOccurred()) - - actualTic := 1538637780 + constants.TTL - Expect(dbTic).To(Equal(actualTic)) - }) - - It("rechecks header for flop dent log event", func() { - blockNumber := int64(8955613) - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer = initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var dentChecked []int - err = db.Select(&dentChecked, `SELECT dent_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(dentChecked[0]).To(Equal(2)) - }) - - It("persists a flip dent log event", func() { - //TODO: There are currently no Flip.dent events on Kovan - }) -}) diff --git a/pkg/transformers/integration_tests/drip_drip.go b/pkg/transformers/integration_tests/drip_drip.go deleted file mode 100644 index f369a529..00000000 --- a/pkg/transformers/integration_tests/drip_drip.go +++ /dev/null @@ -1,131 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_drip" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("DripDrip Transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - config shared.TransformerConfig - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - config = shared.TransformerConfig{ - ContractAddresses: []string{test_data.KovanDripContractAddress}, - ContractAbi: test_data.KovanDripABI, - Topic: test_data.KovanDripDripSignature, - StartingBlockNumber: 0, - EndingBlockNumber: -1, - } - }) - - It("transforms DripDrip log events", func() { - blockNumber := int64(8934775) - config.StartingBlockNumber = blockNumber - config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &drip_drip.DripDripConverter{}, - Repository: &drip_drip.DripDripRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResults []drip_drip.DripDripModel - err = db.Select(&dbResults, `SELECT ilk from maker.drip_drip`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResults)).To(Equal(1)) - dbResult := dbResults[0] - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.Ilk).To(Equal(strconv.Itoa(ilkID))) - }) - - It("rechecks drip drip event", func() { - blockNumber := int64(8934775) - config.StartingBlockNumber = blockNumber - config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &drip_drip.DripDripConverter{}, - Repository: &drip_drip.DripDripRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var dripdripChecked []int - err = db.Select(&dripdripChecked, `SELECT drip_drip_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - }) -}) diff --git a/pkg/transformers/integration_tests/drip_file_vow.go b/pkg/transformers/integration_tests/drip_file_vow.go deleted file mode 100644 index 459e33eb..00000000 --- a/pkg/transformers/integration_tests/drip_file_vow.go +++ /dev/null @@ -1,133 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/vow" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Drip File Vow LogNoteTransformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - }) - - It("transforms DripFileVow log events", func() { - blockNumber := int64(8762197) - config := shared.TransformerConfig{ - TransformerName: constants.DripFileVowLabel, - ContractAddresses: []string{test_data.KovanDripContractAddress}, - ContractAbi: test_data.KovanDripABI, - Topic: test_data.KovanDripFileVowSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &vow.DripFileVowConverter{}, - Repository: &vow.DripFileVowRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []vow.DripFileVowModel - err = db.Select(&dbResult, `SELECT what, data FROM maker.drip_file_vow`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].What).To(Equal("vow")) - Expect(dbResult[0].Data).To(Equal("0x3728e9777B2a0a611ee0F89e00E01044ce4736d1")) - }) - - It("rechecks drip file vow event", func() { - blockNumber := int64(8762197) - config := shared.TransformerConfig{ - TransformerName: constants.DripFileVowLabel, - ContractAddresses: []string{test_data.KovanDripContractAddress}, - ContractAbi: test_data.KovanDripABI, - Topic: test_data.KovanDripFileVowSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &vow.DripFileVowConverter{}, - Repository: &vow.DripFileVowRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var dripfilevowChecked []int - err = db.Select(&dripfilevowChecked, `SELECT drip_file_vow_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(dripfilevowChecked[0]).To(Equal(2)) - }) -}) diff --git a/pkg/transformers/integration_tests/flap_kick.go b/pkg/transformers/integration_tests/flap_kick.go deleted file mode 100644 index 4aecc055..00000000 --- a/pkg/transformers/integration_tests/flap_kick.go +++ /dev/null @@ -1,136 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/test_config" - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flap_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -var _ = Describe("FlapKick Transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - }) - - It("fetches and transforms a FlapKick event from Kovan chain", func() { - blockNumber := int64(9002933) - config := shared.TransformerConfig{ - TransformerName: constants.FlapKickLabel, - ContractAddresses: []string{test_data.KovanFlapperContractAddress}, - ContractAbi: test_data.KovanFlapperABI, - Topic: test_data.KovanFlapKickSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.Transformer{ - Config: config, - Converter: &flap_kick.FlapKickConverter{}, - Repository: &flap_kick.FlapKickRepository{}, - }.NewTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []flap_kick.FlapKickModel - err = db.Select(&dbResult, `SELECT bid, bid_id, "end", gal, lot FROM maker.flap_kick`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("0")) - Expect(dbResult[0].BidId).To(Equal("1")) - Expect(dbResult[0].End.Equal(time.Unix(1539163860, 0))).To(BeTrue()) - Expect(dbResult[0].Gal).To(Equal("0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB")) - Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) - }) - - It("rechecks flap kick transformer", func() { - blockNumber := int64(9002933) - config := shared.TransformerConfig{ - TransformerName: constants.FlapKickLabel, - ContractAddresses: []string{test_data.KovanFlapperContractAddress}, - ContractAbi: test_data.KovanFlapperABI, - Topic: test_data.KovanFlapKickSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.Transformer{ - Config: config, - Converter: &flap_kick.FlapKickConverter{}, - Repository: &flap_kick.FlapKickRepository{}, - }.NewTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var flapkickChecked []int - err = db.Select(&flapkickChecked, `SELECT flap_kick_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(flapkickChecked[0]).To(Equal(2)) - }) -}) diff --git a/pkg/transformers/integration_tests/flip_kick.go b/pkg/transformers/integration_tests/flip_kick.go deleted file mode 100644 index 0068db7a..00000000 --- a/pkg/transformers/integration_tests/flip_kick.go +++ /dev/null @@ -1,159 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/geth" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flip_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("FlipKick Transformer", func() { - It("unpacks an event log", func() { - address := common.HexToAddress(test_data.KovanFlipperContractAddress) - abi, err := geth.ParseAbi(test_data.KovanFlipperABI) - Expect(err).NotTo(HaveOccurred()) - - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - entity := &flip_kick.FlipKickEntity{} - - var eventLog = test_data.EthFlipKickLog - - err = contract.UnpackLog(entity, "Kick", eventLog) - Expect(err).NotTo(HaveOccurred()) - - expectedEntity := test_data.FlipKickEntity - Expect(entity.Id).To(Equal(expectedEntity.Id)) - Expect(entity.Lot).To(Equal(expectedEntity.Lot)) - Expect(entity.Bid).To(Equal(expectedEntity.Bid)) - Expect(entity.Gal).To(Equal(expectedEntity.Gal)) - Expect(entity.End).To(Equal(expectedEntity.End)) - Expect(entity.Urn).To(Equal(expectedEntity.Urn)) - Expect(entity.Tab).To(Equal(expectedEntity.Tab)) - }) - - It("fetches and transforms a FlipKick event from Kovan chain", func() { - blockNumber := int64(8956476) - config := shared.TransformerConfig{ - TransformerName: constants.FlipKickLabel, - ContractAddresses: []string{test_data.KovanFlipperContractAddress}, - ContractAbi: test_data.KovanFlipperABI, - Topic: test_data.KovanFlipKickSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.Transformer{ - Config: config, - Converter: &flip_kick.FlipKickConverter{}, - Repository: &flip_kick.FlipKickRepository{}, - }.NewTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []flip_kick.FlipKickModel - err = db.Select(&dbResult, `SELECT bid, bid_id, "end", gal, lot FROM maker.flip_kick`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("0")) - Expect(dbResult[0].BidId).To(Equal("6")) - Expect(dbResult[0].End.Equal(time.Unix(1538816904, 0))).To(BeTrue()) - Expect(dbResult[0].Gal).To(Equal("0x3728e9777B2a0a611ee0F89e00E01044ce4736d1")) - Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) - }) - - It("rechecks flip kick event", func() { - blockNumber := int64(8956476) - config := shared.TransformerConfig{ - TransformerName: constants.FlipKickLabel, - ContractAddresses: []string{test_data.KovanFlipperContractAddress}, - ContractAbi: test_data.KovanFlipperABI, - Topic: test_data.KovanFlipKickSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.Transformer{ - Config: config, - Converter: &flip_kick.FlipKickConverter{}, - Repository: &flip_kick.FlipKickRepository{}, - }.NewTransformer(db) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var flipkickChecked []int - err = db.Select(&flipkickChecked, `SELECT flip_kick_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(flipkickChecked[0]).To(Equal(2)) - }) -}) diff --git a/pkg/transformers/integration_tests/flop_kick.go b/pkg/transformers/integration_tests/flop_kick.go deleted file mode 100644 index 78e26751..00000000 --- a/pkg/transformers/integration_tests/flop_kick.go +++ /dev/null @@ -1,193 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "time" - - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/geth" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flop_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("FlopKick Transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - config shared.TransformerConfig - initializer factories.Transformer - fetcher shared.LogFetcher - addresses []common.Address - topics []common.Hash - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - config = shared.TransformerConfig{ - TransformerName: constants.FlopKickLabel, - ContractAddresses: []string{test_data.KovanFlopperContractAddress}, - ContractAbi: test_data.KovanFlopperABI, - Topic: test_data.KovanFlopKickSignature, - StartingBlockNumber: 0, - EndingBlockNumber: -1, - } - - initializer = factories.Transformer{ - Config: config, - Converter: &flop_kick.FlopKickConverter{}, - Repository: &flop_kick.FlopKickRepository{}, - } - - fetcher = shared.NewFetcher(blockChain) - addresses = shared.HexStringsToAddresses(config.ContractAddresses) - topics = []common.Hash{common.HexToHash(config.Topic)} - }) - - It("fetches and transforms a FlopKick event from Kovan chain", func() { - blockNumber := int64(8672119) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []flop_kick.Model - err = db.Select(&dbResult, `SELECT bid, bid_id, "end", gal, lot FROM maker.flop_kick`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("0")) - Expect(dbResult[0].BidId).To(Equal("1")) - Expect(dbResult[0].End.Equal(time.Unix(1536726768, 0))).To(BeTrue()) - Expect(dbResult[0].Gal).To(Equal("0x9B870D55BaAEa9119dBFa71A92c5E26E79C4726d")) - // this very large number appears to be derived from the data including: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - Expect(dbResult[0].Lot).To(Equal("115792089237316195423570985008687907853269984665640564039457584007913129639935")) - }) - - It("rechecks flop kick event", func() { - blockNumber := int64(8672119) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []flop_kick.Model - err = db.Select(&dbResult, `SELECT bid, bid_id, "end", gal, lot FROM maker.flop_kick`) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var flopKickChecked []int - err = db.Select(&flopKickChecked, `SELECT flop_kick_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(flopKickChecked[0]).To(Equal(2)) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("0")) - Expect(dbResult[0].BidId).To(Equal("1")) - Expect(dbResult[0].End.Equal(time.Unix(1536726768, 0))).To(BeTrue()) - Expect(dbResult[0].Gal).To(Equal("0x9B870D55BaAEa9119dBFa71A92c5E26E79C4726d")) - // this very large number appears to be derived from the data including: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - Expect(dbResult[0].Lot).To(Equal("115792089237316195423570985008687907853269984665640564039457584007913129639935")) - }) - - It("fetches and transforms another FlopKick event from Kovan chain", func() { - blockNumber := int64(8955611) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []flop_kick.Model - err = db.Select(&dbResult, `SELECT bid, bid_id, "end", gal, lot FROM maker.flop_kick`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("10000000000000000000000")) - Expect(dbResult[0].BidId).To(Equal("2")) - Expect(dbResult[0].End.Equal(time.Unix(1538810564, 0))).To(BeTrue()) - Expect(dbResult[0].Gal).To(Equal("0x3728e9777B2a0a611ee0F89e00E01044ce4736d1")) - Expect(dbResult[0].Lot).To(Equal("115792089237316195423570985008687907853269984665640564039457584007913129639935")) - }) - - It("unpacks an flop kick event log", func() { - address := common.HexToAddress(test_data.KovanFlopperContractAddress) - abi, err := geth.ParseAbi(test_data.KovanFlopperABI) - Expect(err).NotTo(HaveOccurred()) - - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - entity := &flop_kick.Entity{} - - var eventLog = test_data.FlopKickLog - - err = contract.UnpackLog(entity, "Kick", eventLog) - Expect(err).NotTo(HaveOccurred()) - - expectedEntity := test_data.FlopKickEntity - Expect(entity.Id).To(Equal(expectedEntity.Id)) - Expect(entity.Lot).To(Equal(expectedEntity.Lot)) - Expect(entity.Bid).To(Equal(expectedEntity.Bid)) - Expect(entity.Gal).To(Equal(expectedEntity.Gal)) - Expect(entity.End).To(Equal(expectedEntity.End)) - }) -}) diff --git a/pkg/transformers/integration_tests/frob.go b/pkg/transformers/integration_tests/frob.go deleted file mode 100644 index 43ef42d9..00000000 --- a/pkg/transformers/integration_tests/frob.go +++ /dev/null @@ -1,172 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/geth" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/frob" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Frob Transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - fetcher *shared.Fetcher - config shared.TransformerConfig - initializer factories.Transformer - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - fetcher = shared.NewFetcher(blockChain) - config = shared.TransformerConfig{ - TransformerName: constants.FrobLabel, - ContractAddresses: []string{test_data.KovanPitContractAddress}, - ContractAbi: test_data.KovanPitABI, - Topic: test_data.KovanFrobSignature, - StartingBlockNumber: 0, - EndingBlockNumber: -1, - } - - initializer = factories.Transformer{ - Config: config, - Converter: &frob.FrobConverter{}, - Repository: &frob.FrobRepository{}, - } - }) - - It("fetches and transforms a Frob event from Kovan chain", func() { - blockNumber := int64(8935258) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []frob.FrobModel - err = db.Select(&dbResult, `SELECT art, dart, dink, iart, ilk, ink, urn from maker.frob`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Art).To(Equal("10000000000000000")) - Expect(dbResult[0].Dart).To(Equal("0")) - Expect(dbResult[0].Dink).To(Equal("10000000000000")) - Expect(dbResult[0].IArt).To(Equal("1495509999999999999992")) - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Ink).To(Equal("10050100000000000")) - Expect(dbResult[0].Urn).To(Equal("000000000000000000000000c8e093e5f3f9b5aa6a6b33ea45960b93c161430c")) - }) - - It("rechecks frob event", func() { - blockNumber := int64(8935258) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var frobChecked []int - err = db.Select(&frobChecked, `SELECT frob_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(frobChecked[0]).To(Equal(2)) - - var dbResult []frob.FrobModel - err = db.Select(&dbResult, `SELECT art, dart, dink, iart, ilk, ink, urn from maker.frob`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Art).To(Equal("10000000000000000")) - Expect(dbResult[0].Dart).To(Equal("0")) - Expect(dbResult[0].Dink).To(Equal("10000000000000")) - Expect(dbResult[0].IArt).To(Equal("1495509999999999999992")) - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Ink).To(Equal("10050100000000000")) - Expect(dbResult[0].Urn).To(Equal("000000000000000000000000c8e093e5f3f9b5aa6a6b33ea45960b93c161430c")) - }) - - It("unpacks an event log", func() { - address := common.HexToAddress(test_data.KovanPitContractAddress) - abi, err := geth.ParseAbi(test_data.KovanPitABI) - Expect(err).NotTo(HaveOccurred()) - - contract := bind.NewBoundContract(address, abi, nil, nil, nil) - entity := &frob.FrobEntity{} - - var eventLog = test_data.EthFrobLog - - err = contract.UnpackLog(entity, "Frob", eventLog) - Expect(err).NotTo(HaveOccurred()) - - expectedEntity := test_data.FrobEntity - Expect(entity.Art).To(Equal(expectedEntity.Art)) - Expect(entity.IArt).To(Equal(expectedEntity.IArt)) - Expect(entity.Ilk).To(Equal(expectedEntity.Ilk)) - Expect(entity.Ink).To(Equal(expectedEntity.Ink)) - Expect(entity.Urn).To(Equal(expectedEntity.Urn)) - }) -}) diff --git a/pkg/transformers/integration_tests/helpers.go b/pkg/transformers/integration_tests/helpers.go deleted file mode 100644 index 8d7681d3..00000000 --- a/pkg/transformers/integration_tests/helpers.go +++ /dev/null @@ -1,59 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/rpc" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/geth" - "github.com/vulcanize/vulcanizedb/pkg/geth/client" - rpc2 "github.com/vulcanize/vulcanizedb/pkg/geth/converters/rpc" - "github.com/vulcanize/vulcanizedb/pkg/geth/node" -) - -var ipc string - -func getClients(ipc string) (client.RpcClient, *ethclient.Client, error) { - raw, err := rpc.Dial(ipc) - if err != nil { - return client.RpcClient{}, ðclient.Client{}, err - } - return client.NewRpcClient(raw, ipc), ethclient.NewClient(raw), nil -} - -func getBlockChain(rpcClient client.RpcClient, ethClient *ethclient.Client) (core.BlockChain, error) { - client := client.NewEthClient(ethClient) - node := node.MakeNode(rpcClient) - transactionConverter := rpc2.NewRpcTransactionConverter(client) - blockChain := geth.NewBlockChain(client, rpcClient, node, transactionConverter) - return blockChain, nil -} - -// Persist the header for a given block to postgres. Returns the header if successful. -func persistHeader(db *postgres.DB, blockNumber int64, blockChain core.BlockChain) (core.Header, error) { - header, err := blockChain.GetHeaderByNumber(blockNumber) - if err != nil { - return core.Header{}, err - } - headerRepository := repositories.NewHeaderRepository(db) - id, err := headerRepository.CreateOrUpdateHeader(header) - header.Id = id - return header, err -} diff --git a/pkg/transformers/integration_tests/integration_tests_suite_test.go b/pkg/transformers/integration_tests/integration_tests_suite_test.go deleted file mode 100644 index 301e779e..00000000 --- a/pkg/transformers/integration_tests/integration_tests_suite_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package integration_tests - -import ( - log "github.com/sirupsen/logrus" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/spf13/viper" - "io/ioutil" -) - -func TestIntegrationTests(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "IntegrationTests Suite") -} - -var _ = BeforeSuite(func() { - testConfig := viper.New() - testConfig.SetConfigName("staging") - testConfig.AddConfigPath("$GOPATH/src/github.com/vulcanize/vulcanizedb/environments/") - err := testConfig.ReadInConfig() - ipc = testConfig.GetString("client.ipcPath") - if err != nil { - log.Fatal(err) - } - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/integration_tests/pit_file_debt_ceiling.go b/pkg/transformers/integration_tests/pit_file_debt_ceiling.go deleted file mode 100644 index 94cf232d..00000000 --- a/pkg/transformers/integration_tests/pit_file_debt_ceiling.go +++ /dev/null @@ -1,141 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/debt_ceiling" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("PitFileDebtCeiling LogNoteTransformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - }) - - It("fetches and transforms a PitFileDebtCeiling event from Kovan chain", func() { - blockNumber := int64(8535578) - config := shared.TransformerConfig{ - TransformerName: constants.PitFileDebtCeilingLabel, - ContractAddresses: []string{test_data.KovanPitContractAddress}, - ContractAbi: test_data.KovanPitABI, - Topic: test_data.KovanPitFileDebtCeilingSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &debt_ceiling.PitFileDebtCeilingConverter{}, - Repository: &debt_ceiling.PitFileDebtCeilingRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []debt_ceiling.PitFileDebtCeilingModel - err = db.Select(&dbResult, `SELECT what, data from maker.pit_file_debt_ceiling`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].What).To(Equal("Line")) - Expect(dbResult[0].Data).To(Equal("10000000.000000000000000000")) - }) - - It("rechecks pit file debt ceiling event", func() { - blockNumber := int64(8535578) - config := shared.TransformerConfig{ - TransformerName: constants.PitFileDebtCeilingLabel, - ContractAddresses: []string{test_data.KovanPitContractAddress}, - ContractAbi: test_data.KovanPitABI, - Topic: test_data.KovanPitFileDebtCeilingSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &debt_ceiling.PitFileDebtCeilingConverter{}, - Repository: &debt_ceiling.PitFileDebtCeilingRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var pitFileDebtCeilingChecked []int - err = db.Select(&pitFileDebtCeilingChecked, `SELECT pit_file_debt_ceiling_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(pitFileDebtCeilingChecked[0]).To(Equal(2)) - - var dbResult []debt_ceiling.PitFileDebtCeilingModel - err = db.Select(&dbResult, `SELECT what, data from maker.pit_file_debt_ceiling`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].What).To(Equal("Line")) - Expect(dbResult[0].Data).To(Equal("10000000.000000000000000000")) - }) -}) diff --git a/pkg/transformers/integration_tests/pit_file_ilk.go b/pkg/transformers/integration_tests/pit_file_ilk.go deleted file mode 100644 index 9c8c221c..00000000 --- a/pkg/transformers/integration_tests/pit_file_ilk.go +++ /dev/null @@ -1,171 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("PitFileIlk LogNoteTransformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - initializer factories.LogNoteTransformer - addresses []common.Address - topics []common.Hash - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - config := shared.TransformerConfig{ - TransformerName: constants.PitFileIlkLabel, - ContractAddresses: []string{test_data.KovanPitContractAddress}, - ContractAbi: test_data.KovanPitABI, - Topic: test_data.KovanPitFileIlkSignature, - StartingBlockNumber: 0, - EndingBlockNumber: -1, - } - - addresses = shared.HexStringsToAddresses(config.ContractAddresses) - topics = []common.Hash{common.HexToHash(config.Topic)} - - initializer = factories.LogNoteTransformer{ - Config: config, - Converter: &ilk.PitFileIlkConverter{}, - Repository: &ilk.PitFileIlkRepository{}, - } - }) - - It("fetches and transforms a Pit.file ilk 'spot' event from Kovan", func() { - blockNumber := int64(9103223) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []ilk.PitFileIlkModel - err = db.Select(&dbResult, `SELECT ilk, what, data from maker.pit_file_ilk`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].What).To(Equal("spot")) - Expect(dbResult[0].Data).To(Equal("139.840000000000003410605131648")) - }) - - It("rechecks pit file ilk event", func() { - blockNumber := int64(9103223) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var pitFileIlkChecked []int - err = db.Select(&pitFileIlkChecked, `SELECT pit_file_ilk_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(pitFileIlkChecked[0]).To(Equal(2)) - - var dbResult []ilk.PitFileIlkModel - err = db.Select(&dbResult, `SELECT ilk, what, data from maker.pit_file_ilk`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].What).To(Equal("spot")) - Expect(dbResult[0].Data).To(Equal("139.840000000000003410605131648")) - }) - - It("fetches and transforms a Pit.file ilk 'line' event from Kovan", func() { - blockNumber := int64(8762253) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []ilk.PitFileIlkModel - err = db.Select(&dbResult, `SELECT ilk, what, data from maker.pit_file_ilk`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(2)) - var pitFileIlkLineModel ilk.PitFileIlkModel - for _, result := range dbResult { - if result.What == "line" { - pitFileIlkLineModel = result - } - } - ilkID, err := shared.GetOrCreateIlk("5245500000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(pitFileIlkLineModel.Data).To(Equal("2000000.000000000000000000")) - }) -}) diff --git a/pkg/transformers/integration_tests/price_feeds.go b/pkg/transformers/integration_tests/price_feeds.go deleted file mode 100644 index 7bb27945..00000000 --- a/pkg/transformers/integration_tests/price_feeds.go +++ /dev/null @@ -1,178 +0,0 @@ -// VulcanizeDB // Copyright © 2018 Vulcanize // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Price feeds transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - config shared.TransformerConfig - fetcher *shared.Fetcher - initializer factories.LogNoteTransformer - topics []common.Hash - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - config = shared.TransformerConfig{ - TransformerName: constants.PriceFeedLabel, - ContractAddresses: []string{ - test_data.KovanPepContractAddress, - test_data.KovanPipContractAddress, - test_data.KovanRepContractAddress, - }, - ContractAbi: test_data.KovanMedianizerABI, - Topic: test_data.KovanLogValueSignature, - StartingBlockNumber: 0, - EndingBlockNumber: -1, - } - - topics = []common.Hash{common.HexToHash(config.Topic)} - - fetcher = shared.NewFetcher(blockChain) - - initializer = factories.LogNoteTransformer{ - Config: config, - Converter: &price_feeds.PriceFeedConverter{}, - Repository: &price_feeds.PriceFeedRepository{}, - } - }) - - It("persists a ETH/USD price feed event", func() { - blockNumber := int64(8763054) - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - addresses := []string{test_data.KovanPipContractAddress} - initializer.Config.ContractAddresses = addresses - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(addresses), - topics, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - - Expect(err).NotTo(HaveOccurred()) - var model price_feeds.PriceFeedModel - err = db.Get(&model, `SELECT block_number, medianizer_address, usd_value, tx_idx, raw_log FROM maker.price_feeds WHERE block_number = $1`, initializer.Config.StartingBlockNumber) - Expect(err).NotTo(HaveOccurred()) - Expect(model.UsdValue).To(Equal("207.314891143000011198")) - Expect(model.MedianizerAddress).To(Equal(addresses[0])) - }) - - It("rechecks price feed event", func() { - blockNumber := int64(8763054) - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - addresses := []string{test_data.KovanPipContractAddress} - initializer.Config.ContractAddresses = addresses - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(addresses), - topics, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var priceFeedChecked []int - err = db.Select(&priceFeedChecked, `SELECT price_feeds_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(priceFeedChecked[0]).To(Equal(2)) - - var model price_feeds.PriceFeedModel - err = db.Get(&model, `SELECT block_number, medianizer_address, usd_value, tx_idx, raw_log FROM maker.price_feeds WHERE block_number = $1`, initializer.Config.StartingBlockNumber) - Expect(err).NotTo(HaveOccurred()) - Expect(model.UsdValue).To(Equal("207.314891143000011198")) - Expect(model.MedianizerAddress).To(Equal(addresses[0])) - }) - - It("persists a MKR/USD price feed event", func() { - blockNumber := int64(8763059) - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - addresses := []string{test_data.KovanPepContractAddress} - initializer.Config.ContractAddresses = addresses - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(addresses), - topics, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - - Expect(err).NotTo(HaveOccurred()) - var model price_feeds.PriceFeedModel - err = db.Get(&model, `SELECT block_number, medianizer_address, usd_value, tx_idx, raw_log FROM maker.price_feeds WHERE block_number = $1`, initializer.Config.StartingBlockNumber) - Expect(err).NotTo(HaveOccurred()) - Expect(model.UsdValue).To(Equal("391.803979212000001553")) - Expect(model.MedianizerAddress).To(Equal(addresses[0])) - }) - - It("persists a REP/USD price feed event", func() { - blockNumber := int64(8763062) - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - addresses := []string{test_data.KovanRepContractAddress} - initializer.Config.ContractAddresses = addresses - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(addresses), - topics, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - - Expect(err).NotTo(HaveOccurred()) - var model price_feeds.PriceFeedModel - err = db.Get(&model, `SELECT block_number, medianizer_address, usd_value, tx_idx, raw_log FROM maker.price_feeds WHERE block_number = $1`, initializer.Config.StartingBlockNumber) - Expect(err).NotTo(HaveOccurred()) - Expect(model.UsdValue).To(Equal("12.816928482699999847")) - Expect(model.MedianizerAddress).To(Equal(addresses[0])) - }) -}) diff --git a/pkg/transformers/integration_tests/tend.go b/pkg/transformers/integration_tests/tend.go deleted file mode 100644 index b621bc66..00000000 --- a/pkg/transformers/integration_tests/tend.go +++ /dev/null @@ -1,216 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/tend" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Tend LogNoteTransformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - config shared.TransformerConfig - fetcher *shared.Fetcher - initializer factories.LogNoteTransformer - addresses []common.Address - topics []common.Hash - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - config = shared.TransformerConfig{ - TransformerName: constants.TendLabel, - ContractAddresses: []string{test_data.KovanFlapperContractAddress, test_data.KovanFlipperContractAddress}, - ContractAbi: test_data.KovanFlipperABI, - Topic: test_data.KovanTendFunctionSignature, - StartingBlockNumber: 0, - EndingBlockNumber: -1, - } - - fetcher = shared.NewFetcher(blockChain) - addresses = shared.HexStringsToAddresses(config.ContractAddresses) - topics = []common.Hash{common.HexToHash(config.Topic)} - - initializer = factories.LogNoteTransformer{ - Config: config, - Converter: &tend.TendConverter{}, - Repository: &tend.TendRepository{}, - } - }) - - It("fetches and transforms a Flip Tend event from Kovan chain", func() { - blockNumber := int64(8935601) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []tend.TendModel - err = db.Select(&dbResult, `SELECT bid, bid_id, guy, lot FROM maker.tend`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("4000")) - Expect(dbResult[0].BidId).To(Equal("3")) - Expect(dbResult[0].Guy).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb")) - Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) - - var dbTic int64 - err = db.Get(&dbTic, `SELECT tic FROM maker.tend`) - Expect(err).NotTo(HaveOccurred()) - - actualTic := 1538490276 + constants.TTL - Expect(dbTic).To(Equal(actualTic)) - }) - - It("rechecks tend event", func() { - blockNumber := int64(8935601) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var tendChecked []int - err = db.Select(&tendChecked, `SELECT tend_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(tendChecked[0]).To(Equal(2)) - - var dbResult []tend.TendModel - err = db.Select(&dbResult, `SELECT bid, bid_id, guy, lot from maker.tend where header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("4000")) - Expect(dbResult[0].BidId).To(Equal("3")) - Expect(dbResult[0].Guy).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb")) - Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) - - var dbTic int64 - err = db.Get(&dbTic, `SELECT tic FROM maker.tend`) - Expect(err).NotTo(HaveOccurred()) - - actualTic := 1538490276 + constants.TTL - Expect(dbTic).To(Equal(actualTic)) - }) - - It("fetches and transforms a subsequent Flip Tend event from Kovan chain for the same auction", func() { - blockNumber := int64(8935731) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []tend.TendModel - err = db.Select(&dbResult, `SELECT bid, bid_id, guy, lot from maker.tend`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("4300")) - Expect(dbResult[0].BidId).To(Equal("3")) - Expect(dbResult[0].Guy).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb")) - Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) - - var dbTic int64 - err = db.Get(&dbTic, `SELECT tic FROM maker.tend`) - Expect(err).NotTo(HaveOccurred()) - - actualTic := 1538491224 + constants.TTL - Expect(dbTic).To(Equal(actualTic)) - }) - - It("fetches and transforms a Flap Tend event from the Kovan chain", func() { - blockNumber := int64(9003177) - initializer.Config.StartingBlockNumber = blockNumber - initializer.Config.EndingBlockNumber = blockNumber - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - logs, err := fetcher.FetchLogs(addresses, topics, header) - Expect(err).NotTo(HaveOccurred()) - - transformer := initializer.NewLogNoteTransformer(db) - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []tend.TendModel - err = db.Select(&dbResult, `SELECT bid, bid_id, guy, lot from maker.tend`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - Expect(dbResult[0].Bid).To(Equal("1000000000000000")) - Expect(dbResult[0].BidId).To(Equal("1")) - Expect(dbResult[0].Guy).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb")) - Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) - - var dbTic int64 - err = db.Get(&dbTic, `SELECT tic FROM maker.tend`) - Expect(err).NotTo(HaveOccurred()) - - actualTic := 1538992860 + constants.TTL - Expect(dbTic).To(Equal(actualTic)) - }) -}) diff --git a/pkg/transformers/integration_tests/vat_flux.go b/pkg/transformers/integration_tests/vat_flux.go deleted file mode 100644 index f2bb9433..00000000 --- a/pkg/transformers/integration_tests/vat_flux.go +++ /dev/null @@ -1,152 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_flux" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("VatFlux LogNoteTransformer", func() { - It("transforms VatFlux log events", func() { - blockNumber := int64(9004474) - config := shared.TransformerConfig{ - TransformerName: constants.VatFluxLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatFluxSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_flux.VatFluxConverter{}, - Repository: &vat_flux.VatFluxRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []vat_flux.VatFluxModel - err = db.Select(&dbResult, `SELECT ilk, src, dst, rad from maker.vat_flux`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - ilkID, err := shared.GetOrCreateIlk("5245500000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Src).To(Equal("000000000000000000000000c0851f73cc8dd5c0765e71980ec7e7fd1ef74434")) - Expect(dbResult[0].Dst).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb")) - Expect(dbResult[0].Rad).To(Equal("1800000000000000000000000000000000000000000000")) - Expect(dbResult[0].TransactionIndex).To(Equal(uint(0))) - }) - - It("rechecks vat flux event", func() { - blockNumber := int64(9004474) - config := shared.TransformerConfig{ - TransformerName: constants.VatFluxLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatFluxSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - initializer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_flux.VatFluxConverter{}, - Repository: &vat_flux.VatFluxRepository{}, - } - transformer := initializer.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var vatFluxChecked []int - err = db.Select(&vatFluxChecked, `SELECT vat_flux_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(vatFluxChecked[0]).To(Equal(2)) - - var dbResult []vat_flux.VatFluxModel - err = db.Select(&dbResult, `SELECT ilk, src, dst, rad from maker.vat_flux`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - ilkID, err := shared.GetOrCreateIlk("5245500000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Src).To(Equal("000000000000000000000000c0851f73cc8dd5c0765e71980ec7e7fd1ef74434")) - Expect(dbResult[0].Dst).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb")) - Expect(dbResult[0].Rad).To(Equal("1800000000000000000000000000000000000000000000")) - Expect(dbResult[0].TransactionIndex).To(Equal(uint(0))) - }) -}) diff --git a/pkg/transformers/integration_tests/vat_fold.go b/pkg/transformers/integration_tests/vat_fold.go deleted file mode 100644 index 39bb93f4..00000000 --- a/pkg/transformers/integration_tests/vat_fold.go +++ /dev/null @@ -1,148 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/test_config" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_fold" -) - -var _ = Describe("VatFold Transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - }) - - It("transforms VatFold log events", func() { - blockNumber := int64(9367233) - config := shared.TransformerConfig{ - TransformerName: constants.VatFoldLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatFoldSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_fold.VatFoldConverter{}, - Repository: &vat_fold.VatFoldRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResults []vat_fold.VatFoldModel - err = db.Select(&dbResults, `SELECT ilk, urn, rate from maker.vat_fold`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResults)).To(Equal(1)) - dbResult := dbResults[0] - ilkID, err := shared.GetOrCreateIlk("5245500000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult.Urn).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1")) - Expect(dbResult.Rate).To(Equal("0.000000000000000000000000000")) - }) - - It("rechecks vat fold event", func() { - blockNumber := int64(9367233) - config := shared.TransformerConfig{ - TransformerName: constants.VatFoldLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatFoldSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_fold.VatFoldConverter{}, - Repository: &vat_fold.VatFoldRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var vatFoldChecked []int - err = db.Select(&vatFoldChecked, `SELECT vat_fold_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(vatFoldChecked[0]).To(Equal(2)) - - var dbResults []vat_fold.VatFoldModel - err = db.Select(&dbResults, `SELECT ilk, urn, rate from maker.vat_fold`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResults)).To(Equal(1)) - dbResult := dbResults[0] - ilkID, err := shared.GetOrCreateIlk("5245500000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult.Urn).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1")) - Expect(dbResult.Rate).To(Equal("0.000000000000000000000000000")) - }) -}) diff --git a/pkg/transformers/integration_tests/vat_grab.go b/pkg/transformers/integration_tests/vat_grab.go deleted file mode 100644 index 19360710..00000000 --- a/pkg/transformers/integration_tests/vat_grab.go +++ /dev/null @@ -1,163 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "math/big" - "strconv" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_grab" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vat Grab Transformer", func() { - It("transforms VatGrab log events", func() { - blockNumber := int64(8958230) - config := shared.TransformerConfig{ - TransformerName: constants.VatGrabLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatGrabSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_grab.VatGrabConverter{}, - Repository: &vat_grab.VatGrabRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []vat_grab.VatGrabModel - err = db.Select(&dbResult, `SELECT ilk, urn, v, w, dink, dart from maker.vat_grab`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - ilkID, err := shared.GetOrCreateIlk("5245500000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Urn).To(Equal("0000000000000000000000006a3ae20c315e845b2e398e68effe39139ec6060c")) - Expect(dbResult[0].V).To(Equal("0000000000000000000000002f34f22a00ee4b7a8f8bbc4eaee1658774c624e0")) //cat contract address as bytes32 - Expect(dbResult[0].W).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1")) - expectedDink := new(big.Int) - expectedDink.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10) - Expect(dbResult[0].Dink).To(Equal(expectedDink.String())) - expectedDart := new(big.Int) - expectedDart.SetString("115792089237316195423570985008687907853269984665640564039441803007913129639936", 10) - Expect(dbResult[0].Dart).To(Equal(expectedDart.String())) - Expect(dbResult[0].TransactionIndex).To(Equal(uint(0))) - }) - - It("rechecks vat grab event", func() { - blockNumber := int64(8958230) - config := shared.TransformerConfig{ - TransformerName: constants.VatGrabLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatGrabSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_grab.VatGrabConverter{}, - Repository: &vat_grab.VatGrabRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var vatGrabChecked []int - err = db.Select(&vatGrabChecked, `SELECT vat_grab_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(vatGrabChecked[0]).To(Equal(2)) - - var dbResult []vat_grab.VatGrabModel - err = db.Select(&dbResult, `SELECT ilk, urn, v, w, dink, dart from maker.vat_grab`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - ilkID, err := shared.GetOrCreateIlk("5245500000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Urn).To(Equal("0000000000000000000000006a3ae20c315e845b2e398e68effe39139ec6060c")) - Expect(dbResult[0].V).To(Equal("0000000000000000000000002f34f22a00ee4b7a8f8bbc4eaee1658774c624e0")) //cat contract address - Expect(dbResult[0].W).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1")) - expectedDink := new(big.Int) - expectedDink.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10) - Expect(dbResult[0].Dink).To(Equal(expectedDink.String())) - expectedDart := new(big.Int) - expectedDart.SetString("115792089237316195423570985008687907853269984665640564039441803007913129639936", 10) - Expect(dbResult[0].Dart).To(Equal(expectedDart.String())) - Expect(dbResult[0].TransactionIndex).To(Equal(uint(0))) - }) -}) diff --git a/pkg/transformers/integration_tests/vat_heal.go b/pkg/transformers/integration_tests/vat_heal.go deleted file mode 100644 index e59b861f..00000000 --- a/pkg/transformers/integration_tests/vat_heal.go +++ /dev/null @@ -1,142 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_heal" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("VatHeal Transformer", func() { - It("transforms VatHeal log events", func() { - blockNumber := int64(8935578) - config := shared.TransformerConfig{ - TransformerName: constants.VatHealLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatHealSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_heal.VatHealConverter{}, - Repository: &vat_heal.VatHealRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResults []vat_heal.VatHealModel - err = db.Select(&dbResults, `SELECT urn, v, rad from maker.vat_heal`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResults)).To(Equal(1)) - dbResult := dbResults[0] - Expect(dbResult.Urn).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1")) - Expect(dbResult.V).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1")) - Expect(dbResult.Rad).To(Equal("1000000000000000000000000000")) - }) - - It("rechecks vat heal event", func() { - blockNumber := int64(8935578) - config := shared.TransformerConfig{ - TransformerName: constants.VatHealLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatHealSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_heal.VatHealConverter{}, - Repository: &vat_heal.VatHealRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var vatHealChecked []int - err = db.Select(&vatHealChecked, `SELECT vat_heal_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(vatHealChecked[0]).To(Equal(2)) - - var dbResults []vat_heal.VatHealModel - err = db.Select(&dbResults, `SELECT urn, v, rad from maker.vat_heal`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResults)).To(Equal(1)) - dbResult := dbResults[0] - Expect(dbResult.Urn).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1")) - Expect(dbResult.V).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1")) - Expect(dbResult.Rad).To(Equal("1000000000000000000000000000")) - }) -}) diff --git a/pkg/transformers/integration_tests/vat_init.go b/pkg/transformers/integration_tests/vat_init.go deleted file mode 100644 index 0835e396..00000000 --- a/pkg/transformers/integration_tests/vat_init.go +++ /dev/null @@ -1,144 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_init" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("VatInit LogNoteTransformer", func() { - It("transforms VatInit log events", func() { - blockNumber := int64(8535561) - config := shared.TransformerConfig{ - TransformerName: constants.VatInitLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatInitSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_init.VatInitConverter{}, - Repository: &vat_init.VatInitRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResults []vat_init.VatInitModel - err = db.Select(&dbResults, `SELECT ilk from maker.vat_init`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResults)).To(Equal(1)) - dbResult := dbResults[0] - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.Ilk).To(Equal(strconv.Itoa(ilkID))) - }) - - It("rechecks vat init event", func() { - blockNumber := int64(8535561) - config := shared.TransformerConfig{ - TransformerName: constants.VatInitLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatInitSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_init.VatInitConverter{}, - Repository: &vat_init.VatInitRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var vatInitChecked []int - err = db.Select(&vatInitChecked, `SELECT vat_init_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(vatInitChecked[0]).To(Equal(2)) - - var dbResults []vat_init.VatInitModel - err = db.Select(&dbResults, `SELECT ilk from maker.vat_init`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResults)).To(Equal(1)) - dbResult := dbResults[0] - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult.Ilk).To(Equal(strconv.Itoa(ilkID))) - }) -}) diff --git a/pkg/transformers/integration_tests/vat_move.go b/pkg/transformers/integration_tests/vat_move.go deleted file mode 100644 index ffa3b2ed..00000000 --- a/pkg/transformers/integration_tests/vat_move.go +++ /dev/null @@ -1,143 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_move" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("VatMove LogNoteTransformer", func() { - It("transforms VatMove log events", func() { - blockNumber := int64(9004628) - config := shared.TransformerConfig{ - TransformerName: constants.VatMoveLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatMoveSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_move.VatMoveConverter{}, - Repository: &vat_move.VatMoveRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResults []vat_move.VatMoveModel - err = db.Select(&dbResults, `SELECT src, dst, rad from maker.vat_move`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResults)).To(Equal(1)) - dbResult := dbResults[0] - Expect(dbResult.Src).To(Equal("0000000000000000000000008868bad8e74fca4505676d1b5b21ecc23328d132")) - Expect(dbResult.Dst).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb")) - Expect(dbResult.Rad).To(Equal("1000000000000000000000000000000000000000000000")) - }) - - It("rechecks vat move event", func() { - blockNumber := int64(9004628) - config := shared.TransformerConfig{ - TransformerName: constants.VatMoveLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatMoveSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_move.VatMoveConverter{}, - Repository: &vat_move.VatMoveRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var vatMoveChecked []int - err = db.Select(&vatMoveChecked, `SELECT vat_move_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(vatMoveChecked[0]).To(Equal(2)) - - var dbResults []vat_move.VatMoveModel - err = db.Select(&dbResults, `SELECT src, dst, rad from maker.vat_move`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResults)).To(Equal(1)) - dbResult := dbResults[0] - Expect(dbResult.Src).To(Equal("0000000000000000000000008868bad8e74fca4505676d1b5b21ecc23328d132")) - Expect(dbResult.Dst).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb")) - Expect(dbResult.Rad).To(Equal("1000000000000000000000000000000000000000000000")) - }) -}) diff --git a/pkg/transformers/integration_tests/vat_slip.go b/pkg/transformers/integration_tests/vat_slip.go deleted file mode 100644 index f5ba2560..00000000 --- a/pkg/transformers/integration_tests/vat_slip.go +++ /dev/null @@ -1,141 +0,0 @@ -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_slip" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vat slip transformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - }) - - It("persists vat slip event", func() { - blockNumber := int64(8953655) - config := shared.TransformerConfig{ - TransformerName: constants.VatSlipLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatSlipSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_slip.VatSlipConverter{}, - Repository: &vat_slip.VatSlipRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - - Expect(err).NotTo(HaveOccurred()) - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - var model vat_slip.VatSlipModel - err = db.Get(&model, `SELECT ilk, guy, rad, tx_idx FROM maker.vat_slip WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(model.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(model.Guy).To(Equal("000000000000000000000000da15dce70ab462e66779f23ee14f21d993789ee3")) - Expect(model.Rad).To(Equal("100000000000000000000000000000000000000000000000")) - Expect(model.TransactionIndex).To(Equal(uint(0))) - var headerChecked bool - err = db.Get(&headerChecked, `SELECT vat_slip_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(headerChecked).To(BeTrue()) - }) - - It("rechecks vat slip event", func() { - blockNumber := int64(8953655) - config := shared.TransformerConfig{ - TransformerName: constants.VatSlipLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatSlipSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_slip.VatSlipConverter{}, - Repository: &vat_slip.VatSlipRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var vatSlipChecked []int - err = db.Select(&vatSlipChecked, `SELECT vat_slip_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(vatSlipChecked[0]).To(Equal(2)) - - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - var model vat_slip.VatSlipModel - err = db.Get(&model, `SELECT ilk, guy, rad, tx_idx FROM maker.vat_slip WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(model.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(model.Guy).To(Equal("000000000000000000000000da15dce70ab462e66779f23ee14f21d993789ee3")) - Expect(model.Rad).To(Equal("100000000000000000000000000000000000000000000000")) - Expect(model.TransactionIndex).To(Equal(uint(0))) - var headerChecked int - err = db.Get(&headerChecked, `SELECT vat_slip_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(headerChecked).To(Equal(2)) - }) -}) diff --git a/pkg/transformers/integration_tests/vat_tune.go b/pkg/transformers/integration_tests/vat_tune.go deleted file mode 100644 index c962f278..00000000 --- a/pkg/transformers/integration_tests/vat_tune.go +++ /dev/null @@ -1,160 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "math/big" - "strconv" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_tune" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("VatTune LogNoteTransformer", func() { - It("transforms VatTune log events", func() { - blockNumber := int64(8761670) - config := shared.TransformerConfig{ - TransformerName: constants.VatTuneLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatTuneSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_tune.VatTuneConverter{}, - Repository: &vat_tune.VatTuneRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []vat_tune.VatTuneModel - err = db.Select(&dbResult, `SELECT ilk, urn, v, w, dink, dart from maker.vat_tune`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Urn).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876")) - Expect(dbResult[0].V).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876")) - Expect(dbResult[0].W).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876")) - Expect(dbResult[0].Dink).To(Equal("0")) - expectedDart := new(big.Int) - expectedDart.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10) - Expect(dbResult[0].Dart).To(Equal(expectedDart.String())) - Expect(dbResult[0].TransactionIndex).To(Equal(uint(0))) - }) - - It("transforms VatTune log events", func() { - blockNumber := int64(8761670) - config := shared.TransformerConfig{ - TransformerName: constants.VatTuneLabel, - ContractAddresses: []string{test_data.KovanVatContractAddress}, - ContractAbi: test_data.KovanVatABI, - Topic: test_data.KovanVatTuneSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err := getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - - db := test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vat_tune.VatTuneConverter{}, - Repository: &vat_tune.VatTuneRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var vatTuneChecked []int - err = db.Select(&vatTuneChecked, `SELECT vat_tune_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(vatTuneChecked[0]).To(Equal(2)) - - var dbResult []vat_tune.VatTuneModel - err = db.Select(&dbResult, `SELECT ilk, urn, v, w, dink, dart from maker.vat_tune`) - Expect(err).NotTo(HaveOccurred()) - - Expect(len(dbResult)).To(Equal(1)) - ilkID, err := shared.GetOrCreateIlk("4554480000000000000000000000000000000000000000000000000000000000", db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Urn).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876")) - Expect(dbResult[0].V).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876")) - Expect(dbResult[0].W).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876")) - Expect(dbResult[0].Dink).To(Equal("0")) - expectedDart := new(big.Int) - expectedDart.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10) - Expect(dbResult[0].Dart).To(Equal(expectedDart.String())) - Expect(dbResult[0].TransactionIndex).To(Equal(uint(0))) - }) -}) diff --git a/pkg/transformers/integration_tests/vow_flog.go b/pkg/transformers/integration_tests/vow_flog.go deleted file mode 100644 index 545a7680..00000000 --- a/pkg/transformers/integration_tests/vow_flog.go +++ /dev/null @@ -1,138 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package integration_tests - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vow_flog" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("VowFlog LogNoteTransformer", func() { - var ( - db *postgres.DB - blockChain core.BlockChain - ) - - BeforeEach(func() { - rpcClient, ethClient, err := getClients(ipc) - Expect(err).NotTo(HaveOccurred()) - blockChain, err = getBlockChain(rpcClient, ethClient) - Expect(err).NotTo(HaveOccurred()) - db = test_config.NewTestDB(blockChain.Node()) - test_config.CleanTestDB(db) - }) - - It("transforms VowFlog log events", func() { - blockNumber := int64(8946819) - config := shared.TransformerConfig{ - TransformerName: constants.VowFlogLabel, - ContractAddresses: []string{test_data.KovanVowContractAddress}, - ContractAbi: test_data.KovanVowABI, - Topic: test_data.KovanVowFlogSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vow_flog.VowFlogConverter{}, - Repository: &vow_flog.VowFlogRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - var dbResult []vow_flog.VowFlogModel - err = db.Select(&dbResult, `SELECT era, log_idx, tx_idx from maker.vow_flog`) - Expect(err).NotTo(HaveOccurred()) - - Expect(dbResult[0].Era).To(Equal("1538558052")) - Expect(dbResult[0].LogIndex).To(Equal(uint(2))) - Expect(dbResult[0].TransactionIndex).To(Equal(uint(2))) - }) - - It("rechecks vow flog event", func() { - blockNumber := int64(8946819) - config := shared.TransformerConfig{ - TransformerName: constants.VowFlogLabel, - ContractAddresses: []string{test_data.KovanVowContractAddress}, - ContractAbi: test_data.KovanVowABI, - Topic: test_data.KovanVowFlogSignature, - StartingBlockNumber: blockNumber, - EndingBlockNumber: blockNumber, - } - - header, err := persistHeader(db, blockNumber, blockChain) - Expect(err).NotTo(HaveOccurred()) - - fetcher := shared.NewFetcher(blockChain) - logs, err := fetcher.FetchLogs( - shared.HexStringsToAddresses(config.ContractAddresses), - []common.Hash{common.HexToHash(config.Topic)}, - header) - Expect(err).NotTo(HaveOccurred()) - transformer := factories.LogNoteTransformer{ - Config: config, - Converter: &vow_flog.VowFlogConverter{}, - Repository: &vow_flog.VowFlogRepository{}, - }.NewLogNoteTransformer(db) - - err = transformer.Execute(logs, header, constants.HeaderMissing) - Expect(err).NotTo(HaveOccurred()) - - err = transformer.Execute(logs, header, constants.HeaderRecheck) - Expect(err).NotTo(HaveOccurred()) - - var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) - Expect(err).NotTo(HaveOccurred()) - - var vowFlogChecked []int - err = db.Select(&vowFlogChecked, `SELECT vow_flog_checked FROM public.checked_headers WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(vowFlogChecked[0]).To(Equal(2)) - - var dbResult []vow_flog.VowFlogModel - err = db.Select(&dbResult, `SELECT era, log_idx, tx_idx from maker.vow_flog`) - Expect(err).NotTo(HaveOccurred()) - - Expect(dbResult[0].Era).To(Equal("1538558052")) - Expect(dbResult[0].LogIndex).To(Equal(uint(2))) - Expect(dbResult[0].TransactionIndex).To(Equal(uint(2))) - }) -}) diff --git a/pkg/transformers/pit_file/debt_ceiling/config.go b/pkg/transformers/pit_file/debt_ceiling/config.go deleted file mode 100644 index 70ab91fc..00000000 --- a/pkg/transformers/pit_file/debt_ceiling/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package debt_ceiling - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetDebtCeilingFileConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.PitFileDebtCeilingLabel, - ContractAddresses: []string{constants.PitContractAddress()}, - ContractAbi: constants.PitABI(), - Topic: constants.GetPitFileDebtCeilingSignature(), - StartingBlockNumber: constants.PitDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/pit_file/debt_ceiling/converter.go b/pkg/transformers/pit_file/debt_ceiling/converter.go deleted file mode 100644 index 4a8c0f41..00000000 --- a/pkg/transformers/pit_file/debt_ceiling/converter.go +++ /dev/null @@ -1,64 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package debt_ceiling - -import ( - "bytes" - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type PitFileDebtCeilingConverter struct{} - -func (PitFileDebtCeilingConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - what := string(bytes.Trim(ethLog.Topics[2].Bytes(), "\x00")) - data := shared.ConvertToWad(ethLog.Topics[3].Big().String()) - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - model := PitFileDebtCeilingModel{ - What: what, - Data: data, - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 2 { - return errors.New("log missing topics") - } - if len(log.Data) < constants.DataItemLength { - return errors.New("log missing data") - } - return nil -} diff --git a/pkg/transformers/pit_file/debt_ceiling/converter_test.go b/pkg/transformers/pit_file/debt_ceiling/converter_test.go deleted file mode 100644 index 1c2c7ee7..00000000 --- a/pkg/transformers/pit_file/debt_ceiling/converter_test.go +++ /dev/null @@ -1,61 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package debt_ceiling_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/debt_ceiling" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Pit file debt ceiling converter", func() { - It("returns err if log is missing topics", func() { - converter := debt_ceiling.PitFileDebtCeilingConverter{} - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("returns err if log is missing data", func() { - converter := debt_ceiling.PitFileDebtCeilingConverter{} - badLog := types.Log{ - Topics: []common.Hash{{}, {}, {}, {}}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to an model", func() { - converter := debt_ceiling.PitFileDebtCeilingConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthPitFileDebtCeilingLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0].(debt_ceiling.PitFileDebtCeilingModel)).To(Equal(test_data.PitFileDebtCeilingModel)) - }) -}) diff --git a/pkg/transformers/pit_file/debt_ceiling/debt_ceiling_suite_test.go b/pkg/transformers/pit_file/debt_ceiling/debt_ceiling_suite_test.go deleted file mode 100644 index 8bece7ec..00000000 --- a/pkg/transformers/pit_file/debt_ceiling/debt_ceiling_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package debt_ceiling_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestDebtCeiling(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "DebtCeiling Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/pit_file/debt_ceiling/model.go b/pkg/transformers/pit_file/debt_ceiling/model.go deleted file mode 100644 index 3639a3e6..00000000 --- a/pkg/transformers/pit_file/debt_ceiling/model.go +++ /dev/null @@ -1,25 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package debt_ceiling - -type PitFileDebtCeilingModel struct { - What string - Data string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/pit_file/debt_ceiling/repository.go b/pkg/transformers/pit_file/debt_ceiling/repository.go deleted file mode 100644 index eff9703a..00000000 --- a/pkg/transformers/pit_file/debt_ceiling/repository.go +++ /dev/null @@ -1,92 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package debt_ceiling - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type PitFileDebtCeilingRepository struct { - db *postgres.DB -} - -func (repository PitFileDebtCeilingRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - pitFileDC, ok := model.(PitFileDebtCeilingModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, PitFileDebtCeilingModel{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.pit_file_debt_ceiling (header_id, what, data, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3::NUMERIC, $4, $5, $6) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET what = $2, data = $3, raw_log = $6;`, - headerID, pitFileDC.What, pitFileDC.Data, pitFileDC.LogIndex, pitFileDC.TransactionIndex, pitFileDC.Raw, - ) - - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.PitFileDebtCeilingChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository PitFileDebtCeilingRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.PitFileDebtCeilingChecked) -} - -func (repository PitFileDebtCeilingRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PitFileDebtCeilingChecked) -} - -func (repository PitFileDebtCeilingRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PitFileDebtCeilingChecked) -} - -func (repository *PitFileDebtCeilingRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/pit_file/debt_ceiling/repository_test.go b/pkg/transformers/pit_file/debt_ceiling/repository_test.go deleted file mode 100644 index de06cc78..00000000 --- a/pkg/transformers/pit_file/debt_ceiling/repository_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package debt_ceiling_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/debt_ceiling" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Pit file debt ceiling repository", func() { - var ( - db *postgres.DB - pitFileDebtCeilingRepository debt_ceiling.PitFileDebtCeilingRepository - headerRepository repositories.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - pitFileDebtCeilingRepository = debt_ceiling.PitFileDebtCeilingRepository{} - pitFileDebtCeilingRepository.SetDB(db) - headerRepository = repositories.NewHeaderRepository(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.PitFileDebtCeilingModel - modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1 - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.PitFileDebtCeilingChecked, - LogEventTableName: "maker.pit_file_debt_ceiling", - TestModel: test_data.PitFileDebtCeilingModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &pitFileDebtCeilingRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a pit file debt ceiling event", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = pitFileDebtCeilingRepository.Create(headerID, []interface{}{test_data.PitFileDebtCeilingModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbPitFile debt_ceiling.PitFileDebtCeilingModel - err = db.Get(&dbPitFile, `SELECT what, data, log_idx, tx_idx, raw_log FROM maker.pit_file_debt_ceiling WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbPitFile.What).To(Equal(test_data.PitFileDebtCeilingModel.What)) - Expect(dbPitFile.Data).To(Equal(test_data.PitFileDebtCeilingModel.Data)) - Expect(dbPitFile.LogIndex).To(Equal(test_data.PitFileDebtCeilingModel.LogIndex)) - Expect(dbPitFile.TransactionIndex).To(Equal(test_data.PitFileDebtCeilingModel.TransactionIndex)) - Expect(dbPitFile.Raw).To(MatchJSON(test_data.PitFileDebtCeilingModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.PitFileDebtCeilingChecked, - Repository: &pitFileDebtCeilingRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/pit_file/ilk/config.go b/pkg/transformers/pit_file/ilk/config.go deleted file mode 100644 index 6ac0374e..00000000 --- a/pkg/transformers/pit_file/ilk/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetIlkFileConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.PitFileIlkLabel, - ContractAddresses: []string{constants.PitContractAddress()}, - ContractAbi: constants.PitABI(), - Topic: constants.GetPitFileIlkSignature(), - StartingBlockNumber: constants.PitDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/pit_file/ilk/converter.go b/pkg/transformers/pit_file/ilk/converter.go deleted file mode 100644 index 3013b032..00000000 --- a/pkg/transformers/pit_file/ilk/converter.go +++ /dev/null @@ -1,84 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk - -import ( - "bytes" - "encoding/json" - "errors" - "math/big" - - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type PitFileIlkConverter struct{} - -func (PitFileIlkConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - what := string(bytes.Trim(ethLog.Topics[3].Bytes(), "\x00")) - dataBytes := ethLog.Data[len(ethLog.Data)-constants.DataItemLength:] - data, err := getData(dataBytes, what) - if err != nil { - return nil, err - } - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - model := PitFileIlkModel{ - Ilk: ilk, - What: what, - Data: data, - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func getData(dataBytes []byte, what string) (string, error) { - n := big.NewInt(0).SetBytes(dataBytes).String() - if what == "spot" { - return shared.ConvertToRay(n), nil - } else if what == "line" { - return shared.ConvertToWad(n), nil - } else { - return "", errors.New("unexpected payload for 'what'") - } -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - if len(log.Data) < constants.DataItemLength { - return errors.New("log missing data") - } - return nil -} diff --git a/pkg/transformers/pit_file/ilk/converter_test.go b/pkg/transformers/pit_file/ilk/converter_test.go deleted file mode 100644 index 3b15d50a..00000000 --- a/pkg/transformers/pit_file/ilk/converter_test.go +++ /dev/null @@ -1,97 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Pit file ilk converter", func() { - It("returns err if log is missing topics", func() { - converter := ilk.PitFileIlkConverter{} - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("returns err if log is missing data", func() { - converter := ilk.PitFileIlkConverter{} - badLog := types.Log{ - Topics: []common.Hash{{}, {}, {}, {}}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("returns error if 'what' field is unknown", func() { - log := types.Log{ - Address: test_data.EthPitFileIlkLineLog.Address, - Topics: []common.Hash{ - test_data.EthPitFileIlkLineLog.Topics[0], - test_data.EthPitFileIlkLineLog.Topics[1], - test_data.EthPitFileIlkLineLog.Topics[2], - common.HexToHash("0x1111111100000000000000000000000000000000000000000000000000000000"), - }, - Data: test_data.EthPitFileIlkLineLog.Data, - BlockNumber: test_data.EthPitFileIlkLineLog.BlockNumber, - TxHash: test_data.EthPitFileIlkLineLog.TxHash, - TxIndex: test_data.EthPitFileIlkLineLog.TxIndex, - BlockHash: test_data.EthPitFileIlkLineLog.BlockHash, - Index: test_data.EthPitFileIlkLineLog.Index, - } - converter := ilk.PitFileIlkConverter{} - - _, err := converter.ToModels([]types.Log{log}) - - Expect(err).To(HaveOccurred()) - }) - - Describe("when log is valid", func() { - It("converts to model with data converted to ray when what is 'spot'", func() { - converter := ilk.PitFileIlkConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthPitFileIlkSpotLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0].(ilk.PitFileIlkModel)).To(Equal(test_data.PitFileIlkSpotModel)) - }) - - It("converts to model with data converted to wad when what is 'line'", func() { - converter := ilk.PitFileIlkConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthPitFileIlkLineLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0].(ilk.PitFileIlkModel)).To(Equal(test_data.PitFileIlkLineModel)) - }) - }) - -}) diff --git a/pkg/transformers/pit_file/ilk/ilk_suite_test.go b/pkg/transformers/pit_file/ilk/ilk_suite_test.go deleted file mode 100644 index 469bede6..00000000 --- a/pkg/transformers/pit_file/ilk/ilk_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestIlk(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Ilk Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/pit_file/ilk/model.go b/pkg/transformers/pit_file/ilk/model.go deleted file mode 100644 index 7c73ab98..00000000 --- a/pkg/transformers/pit_file/ilk/model.go +++ /dev/null @@ -1,26 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk - -type PitFileIlkModel struct { - Ilk string - What string - Data string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/pit_file/ilk/repository.go b/pkg/transformers/pit_file/ilk/repository.go deleted file mode 100644 index 25b5af34..00000000 --- a/pkg/transformers/pit_file/ilk/repository.go +++ /dev/null @@ -1,99 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type PitFileIlkRepository struct { - db *postgres.DB -} - -func (repository PitFileIlkRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - pitFileIlk, ok := model.(PitFileIlkModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, PitFileIlkModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(pitFileIlk.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.pit_file_ilk (header_id, ilk, what, data, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4::NUMERIC, $5, $6, $7) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, what = $3, data = $4, raw_log = $7;`, - headerID, ilkID, pitFileIlk.What, pitFileIlk.Data, pitFileIlk.LogIndex, pitFileIlk.TransactionIndex, pitFileIlk.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.PitFileIlkChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository PitFileIlkRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.PitFileIlkChecked) -} - -func (repository PitFileIlkRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PitFileIlkChecked) -} - -func (repository PitFileIlkRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PitFileIlkChecked) -} - -func (repository *PitFileIlkRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/pit_file/ilk/repository_test.go b/pkg/transformers/pit_file/ilk/repository_test.go deleted file mode 100644 index f4b79681..00000000 --- a/pkg/transformers/pit_file/ilk/repository_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ilk_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Pit file ilk repository", func() { - var ( - db *postgres.DB - pitFileIlkRepository ilk.PitFileIlkRepository - headerRepository repositories.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - pitFileIlkRepository = ilk.PitFileIlkRepository{} - pitFileIlkRepository.SetDB(db) - headerRepository = repositories.NewHeaderRepository(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.PitFileIlkSpotModel - modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1 - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.PitFileIlkChecked, - LogEventTableName: "maker.pit_file_ilk", - TestModel: test_data.PitFileIlkSpotModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &pitFileIlkRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a pit file ilk event", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = pitFileIlkRepository.Create(headerID, []interface{}{test_data.PitFileIlkSpotModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbPitFile ilk.PitFileIlkModel - err = db.Get(&dbPitFile, `SELECT ilk, what, data, log_idx, tx_idx, raw_log FROM maker.pit_file_ilk WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.PitFileIlkSpotModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbPitFile.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbPitFile.What).To(Equal(test_data.PitFileIlkSpotModel.What)) - Expect(dbPitFile.Data).To(Equal(test_data.PitFileIlkSpotModel.Data)) - Expect(dbPitFile.LogIndex).To(Equal(test_data.PitFileIlkSpotModel.LogIndex)) - Expect(dbPitFile.TransactionIndex).To(Equal(test_data.PitFileIlkSpotModel.TransactionIndex)) - Expect(dbPitFile.Raw).To(MatchJSON(test_data.PitFileIlkSpotModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.PitFileIlkChecked, - Repository: &pitFileIlkRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/price_feeds/config.go b/pkg/transformers/price_feeds/config.go deleted file mode 100644 index bff9a8ec..00000000 --- a/pkg/transformers/price_feeds/config.go +++ /dev/null @@ -1,37 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package price_feeds - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetPriceFeedConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.PriceFeedLabel, - ContractAddresses: []string{ - constants.PepContractAddress(), constants.PipContractAddress(), constants.RepContractAddress(), - }, - ContractAbi: constants.MedianizerABI(), - Topic: constants.GetLogValueSignature(), - StartingBlockNumber: shared.MinInt64([]int64{ - constants.PepDeploymentBlock(), constants.PipDeploymentBlock(), constants.RepDeploymentBlock(), - }), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/price_feeds/converter.go b/pkg/transformers/price_feeds/converter.go deleted file mode 100644 index c36e4c46..00000000 --- a/pkg/transformers/price_feeds/converter.go +++ /dev/null @@ -1,46 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package price_feeds - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -type PriceFeedConverter struct{} - -func (converter PriceFeedConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var results []interface{} - for _, log := range ethLogs { - raw, err := json.Marshal(log) - if err != nil { - return nil, err - } - model := PriceFeedModel{ - BlockNumber: log.BlockNumber, - MedianizerAddress: log.Address.String(), - UsdValue: shared.ConvertToWad(hexutil.Encode(log.Data)), - LogIndex: log.Index, - TransactionIndex: log.TxIndex, - Raw: raw, - } - results = append(results, model) - } - return results, nil -} diff --git a/pkg/transformers/price_feeds/converter_test.go b/pkg/transformers/price_feeds/converter_test.go deleted file mode 100644 index 36931d21..00000000 --- a/pkg/transformers/price_feeds/converter_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package price_feeds_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Price feed Converter", func() { - It("converts a log to a price feed model", func() { - converter := price_feeds.PriceFeedConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthPriceFeedLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.PriceFeedModel)) - }) -}) diff --git a/pkg/transformers/price_feeds/price_feeds_suite_test.go b/pkg/transformers/price_feeds/price_feeds_suite_test.go deleted file mode 100644 index 04417f29..00000000 --- a/pkg/transformers/price_feeds/price_feeds_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package price_feeds_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestPriceFeeds(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "PriceFeeds Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/price_feeds/repository.go b/pkg/transformers/price_feeds/repository.go deleted file mode 100644 index ed776e73..00000000 --- a/pkg/transformers/price_feeds/repository.go +++ /dev/null @@ -1,84 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package price_feeds - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type PriceFeedRepository struct { - db *postgres.DB -} - -func (repository PriceFeedRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - priceUpdate, ok := model.(PriceFeedModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, PriceFeedModel{}) - } - - _, err := tx.Exec(`INSERT INTO maker.price_feeds (block_number, header_id, medianizer_address, usd_value, log_idx, tx_idx, raw_log) - VALUES ($1, $2, $3, $4::NUMERIC, $5, $6, $7) - ON CONFLICT (header_id, medianizer_address, tx_idx, log_idx) DO UPDATE SET block_number = $1, usd_value = $4, raw_log = $7;`, - priceUpdate.BlockNumber, headerID, priceUpdate.MedianizerAddress, priceUpdate.UsdValue, priceUpdate.LogIndex, priceUpdate.TransactionIndex, priceUpdate.Raw) - if err != nil { - tx.Rollback() - return err - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.PriceFeedsChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository PriceFeedRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.PriceFeedsChecked) -} - -func (repository PriceFeedRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PriceFeedsChecked) -} - -func (repository PriceFeedRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.PriceFeedsChecked) -} - -func (repository *PriceFeedRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/price_feeds/repository_test.go b/pkg/transformers/price_feeds/repository_test.go deleted file mode 100644 index 41c86359..00000000 --- a/pkg/transformers/price_feeds/repository_test.go +++ /dev/null @@ -1,87 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package price_feeds_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Price feeds repository", func() { - var ( - db *postgres.DB - priceFeedRepository price_feeds.PriceFeedRepository - headerRepository repositories.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - priceFeedRepository = price_feeds.PriceFeedRepository{} - priceFeedRepository.SetDB(db) - headerRepository = repositories.NewHeaderRepository(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.PriceFeedModel - modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1 - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.PriceFeedsChecked, - LogEventTableName: "maker.price_feeds", - TestModel: test_data.PriceFeedModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &priceFeedRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists a price feed update", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = priceFeedRepository.Create(headerID, []interface{}{test_data.PriceFeedModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbPriceFeedUpdate price_feeds.PriceFeedModel - err = db.Get(&dbPriceFeedUpdate, `SELECT block_number, medianizer_address, usd_value, log_idx, tx_idx, raw_log FROM maker.price_feeds WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbPriceFeedUpdate.BlockNumber).To(Equal(test_data.PriceFeedModel.BlockNumber)) - Expect(dbPriceFeedUpdate.MedianizerAddress).To(Equal(test_data.PriceFeedModel.MedianizerAddress)) - Expect(dbPriceFeedUpdate.UsdValue).To(Equal(test_data.PriceFeedModel.UsdValue)) - Expect(dbPriceFeedUpdate.LogIndex).To(Equal(test_data.PriceFeedModel.LogIndex)) - Expect(dbPriceFeedUpdate.TransactionIndex).To(Equal(test_data.PriceFeedModel.TransactionIndex)) - Expect(dbPriceFeedUpdate.Raw).To(MatchJSON(test_data.PriceFeedModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.PriceFeedsChecked, - Repository: &priceFeedRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/shared/TransformerREADME.md b/pkg/transformers/shared/TransformerREADME.md deleted file mode 100644 index 1049f271..00000000 --- a/pkg/transformers/shared/TransformerREADME.md +++ /dev/null @@ -1,27 +0,0 @@ -# Transformers - -## Description -Transformers must be defined in order to define what events should trigger data updates and how those are performed. - -## Interface - -### Initializer -Accepts DB and Blockchain from Vulcanize and returns a new transformer. E.g. for a new object "Cup": -`func NewCupTransformer(db *postgres.DB, blockchain core.ContractDataFetcher) transformers.Transformer` - -### Execute -Triggers operations to take in response to a given log event. -Can persist data from logs, fetch and persist arbitrary data from outside services (e.g. contract state), or take any number of other actions. E.g.: -`func (cupTransformer *CupTransformer) Execute() error` - -## Additional Requirements -Transformers must define log filters and create them so that relevant watched events can be identified and retrieved. E.g.: -```$xslt - { - Name: "CupsBite", - FromBlock: 0, - ToBlock: -1, - Address: "0x448a5065aebb8e423f0896e6c5d525c040f59af3", - Topics: core.Topics{"0x40cc885400000000000000000000000000000000000000000000000000000000"}, - }, -``` \ No newline at end of file diff --git a/pkg/transformers/shared/constants/checked_headers.go b/pkg/transformers/shared/constants/checked_headers.go deleted file mode 100644 index ccbd250e..00000000 --- a/pkg/transformers/shared/constants/checked_headers.go +++ /dev/null @@ -1,40 +0,0 @@ -package constants - -type TransformerExecution bool - -const ( - HeaderRecheck TransformerExecution = true - HeaderMissing TransformerExecution = false - RecheckHeaderCap = "4" -) - -var ( - BiteChecked = "bite_checked" - CatFileChopLumpChecked = "cat_file_chop_lump_checked" - CatFileFlipChecked = "cat_file_flip_checked" - CatFilePitVowChecked = "cat_file_pit_vow_checked" - DealChecked = "deal_checked" - DentChecked = "dent_checked" - DripDripChecked = "drip_drip_checked" - DripFileIlkChecked = "drip_file_ilk_checked" - DripFileRepoChecked = "drip_file_repo_checked" - DripFileVowChecked = "drip_file_vow_checked" - FlapKickChecked = "flap_kick_checked" - FlipKickChecked = "flip_kick_checked" - FlopKickChecked = "flop_kick_checked" - FrobChecked = "frob_checked" - PitFileDebtCeilingChecked = "pit_file_debt_ceiling_checked" - PitFileIlkChecked = "pit_file_ilk_checked" - PriceFeedsChecked = "price_feeds_checked" - TendChecked = "tend_checked" - VatFluxChecked = "vat_flux_checked" - VatFoldChecked = "vat_fold_checked" - VatGrabChecked = "vat_grab_checked" - VatHealChecked = "vat_heal_checked" - VatInitChecked = "vat_init_checked" - VatMoveChecked = "vat_move_checked" - VatSlipChecked = "vat_slip_checked" - VatTollChecked = "vat_toll_checked" - VatTuneChecked = "vat_tune_checked" - VowFlogChecked = "vow_flog_checked" -) diff --git a/pkg/transformers/shared/constants/constants_suite_test.go b/pkg/transformers/shared/constants/constants_suite_test.go deleted file mode 100644 index 4aae199f..00000000 --- a/pkg/transformers/shared/constants/constants_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package constants_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestConstants(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Constants Suite") -} diff --git a/pkg/transformers/shared/constants/data.go b/pkg/transformers/shared/constants/data.go deleted file mode 100644 index 001952ba..00000000 --- a/pkg/transformers/shared/constants/data.go +++ /dev/null @@ -1,6 +0,0 @@ -package constants - -var DataItemLength = 32 - -// TODO Grab this from DB, since it can change through governance -var TTL = int64(10800) // 60 * 60 * 3 == 10800 seconds == 3 hours diff --git a/pkg/transformers/shared/constants/event_signature_generator.go b/pkg/transformers/shared/constants/event_signature_generator.go deleted file mode 100644 index aa288094..00000000 --- a/pkg/transformers/shared/constants/event_signature_generator.go +++ /dev/null @@ -1,59 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package constants - -import ( - "fmt" - "strings" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/crypto" - - "github.com/vulcanize/vulcanizedb/pkg/geth" -) - -func GetEventSignature(solidityMethodSignature string) string { - eventSignature := []byte(solidityMethodSignature) - hash := crypto.Keccak256Hash(eventSignature) - return hash.Hex() -} - -func GetLogNoteSignature(solidityMethodSignature string) string { - rawSignature := GetEventSignature(solidityMethodSignature) - return rawSignature[:10] + "00000000000000000000000000000000000000000000000000000000" -} - -func GetSolidityMethodSignature(abi, name string) string { - parsedAbi, _ := geth.ParseAbi(abi) - - if method, ok := parsedAbi.Methods[name]; ok { - return method.Sig() - } else if event, ok := parsedAbi.Events[name]; ok { - return getEventSignature(event) - } - panic("Error: could not get Solidity method signature for: " + name) -} - -func getEventSignature(event abi.Event) string { - types := make([]string, len(event.Inputs)) - for i, input := range event.Inputs { - types[i] = input.Type.String() - i++ - } - - return fmt.Sprintf("%v(%v)", event.Name, strings.Join(types, ",")) -} diff --git a/pkg/transformers/shared/constants/event_signature_generator_test.go b/pkg/transformers/shared/constants/event_signature_generator_test.go deleted file mode 100644 index 54a15d85..00000000 --- a/pkg/transformers/shared/constants/event_signature_generator_test.go +++ /dev/null @@ -1,272 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package constants_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Event signature generator", func() { - Describe("generating non-anonymous event signatures", func() { - It("generates bite event signature", func() { - expected := "0x99b5620489b6ef926d4518936cfec15d305452712b88bd59da2d9c10fb0953e8" - actual := constants.GetEventSignature("Bite(bytes32,bytes32,uint256,uint256,uint256,uint256,uint256)") - - Expect(expected).To(Equal(actual)) - }) - - It("generates frob event signature", func() { - expected := "0xb2afa28318bcc689926b52835d844de174ef8de97e982a85c0199d584920791b" - actual := constants.GetEventSignature("Frob(bytes32,bytes32,uint256,uint256,int256,int256,uint256)") - - Expect(expected).To(Equal(actual)) - }) - - It("generates the flap kick event signature", func() { - expected := "0xefa52d9342a199cb30efd2692463f2c2bef63cd7186b50382d4fb94ad207880e" - actual := constants.GetEventSignature("Kick(uint256,uint256,uint256,address,uint48)") - - Expect(expected).To(Equal(actual)) - }) - - It("generates flip kick event signature", func() { - expected := "0xbac86238bdba81d21995024470425ecb370078fa62b7271b90cf28cbd1e3e87e" - actual := constants.GetEventSignature("Kick(uint256,uint256,uint256,address,uint48,bytes32,uint256)") - - Expect(expected).To(Equal(actual)) - }) - - It("generates log value event signature", func() { - expected := "0x296ba4ca62c6c21c95e828080cb8aec7481b71390585605300a8a76f9e95b527" - actual := constants.GetEventSignature("LogValue(bytes32)") - - Expect(expected).To(Equal(actual)) - }) - }) - - Describe("generating LogNote event signatures", func() { - It("generates flip tend event signature", func() { - expected := "0x4b43ed1200000000000000000000000000000000000000000000000000000000" - actual := constants.GetLogNoteSignature("tend(uint256,uint256,uint256)") - - Expect(expected).To(Equal(actual)) - }) - - It("generates pit file event signature for overloaded function with three arguments", func() { - expected := "0x1a0b287e00000000000000000000000000000000000000000000000000000000" - actual := constants.GetLogNoteSignature("file(bytes32,bytes32,uint256)") - - Expect(expected).To(Equal(actual)) - }) - - It("generates pit file event signature for overloaded function with two arguments", func() { - expected := "0x29ae811400000000000000000000000000000000000000000000000000000000" - actual := constants.GetLogNoteSignature("file(bytes32,uint256)") - - Expect(expected).To(Equal(actual)) - }) - - It("generates pit file event signature for overloaded function with two different arguments", func() { - expected := "0xd4e8be8300000000000000000000000000000000000000000000000000000000" - actual := constants.GetLogNoteSignature("file(bytes32,address)") - - Expect(expected).To(Equal(actual)) - }) - }) - - Describe("getting the solidity method/event signature from the abi", func() { - Describe("it handles methods", func() { - Describe("from the cat contract", func() { - It("gets the file method signature", func() { - expected := "file(bytes32,bytes32,address)" - actual := constants.GetSolidityMethodSignature(test_data.KovanCatABI, "file") - - Expect(expected).To(Equal(actual)) - }) - }) - - Describe("from the drip contract", func() { - It("gets the drip method signature", func() { - expected := "drip(bytes32)" - actual := constants.GetSolidityMethodSignature(test_data.KovanDripABI, "drip") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the file method signature", func() { - expected := "file(bytes32,uint256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanDripABI, "file") - - Expect(expected).To(Equal(actual)) - }) - }) - - Describe("from the flipper contract", func() { - It("gets the deal method signature", func() { - expected := "deal(uint256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanFlipperABI, "deal") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the dent method signature", func() { - expected := "dent(uint256,uint256,uint256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanFlipperABI, "dent") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the tend method signature", func() { - expected := "tend(uint256,uint256,uint256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanFlipperABI, "tend") - - Expect(expected).To(Equal(actual)) - }) - }) - - Describe("from the pit contract", func() { - It("gets the file method signature", func() { - expected := "file(bytes32,address)" - actual := constants.GetSolidityMethodSignature(test_data.KovanPitABI, "file") - - Expect(expected).To(Equal(actual)) - }) - }) - - Describe("from the vat contract", func() { - It("gets the init method signature", func() { - expected := "init(bytes32)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVatABI, "init") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the heal method signature", func() { - expected := "heal(bytes32,bytes32,int256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVatABI, "heal") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the fold method signature", func() { - expected := "fold(bytes32,bytes32,int256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVatABI, "fold") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the flux method signature", func() { - expected := "flux(bytes32,bytes32,bytes32,int256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVatABI, "flux") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the grab method signature", func() { - expected := "grab(bytes32,bytes32,bytes32,bytes32,int256,int256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVatABI, "grab") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the move method signature", func() { - expected := "move(bytes32,bytes32,int256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVatABI, "move") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the slip method signature", func() { - expected := "slip(bytes32,bytes32,int256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVatABI, "slip") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the toll method signature", func() { - expected := "toll(bytes32,bytes32,int256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVatABI, "toll") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the tune method signature", func() { - expected := "tune(bytes32,bytes32,bytes32,bytes32,int256,int256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVatABI, "tune") - - Expect(expected).To(Equal(actual)) - }) - }) - - Describe("from the vow contract", func() { - It("gets the flog method signature", func() { - expected := "flog(uint48)" - actual := constants.GetSolidityMethodSignature(test_data.KovanVowABI, "flog") - - Expect(expected).To(Equal(actual)) - }) - }) - }) - - Describe("it handles events", func() { - It("gets the Bite event signature", func() { - expected := "Bite(bytes32,bytes32,uint256,uint256,uint256,uint256,uint256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanCatABI, "Bite") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the flap Kick event signature", func() { - expected := "Kick(uint256,uint256,uint256,address,uint48)" - actual := constants.GetSolidityMethodSignature(test_data.KovanFlapperABI, "Kick") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the flip Kick event signature", func() { - expected := "Kick(uint256,uint256,uint256,address,uint48,bytes32,uint256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanFlipperABI, "Kick") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the flop Kick event signature", func() { - expected := "Kick(uint256,uint256,uint256,address,uint48)" - actual := constants.GetSolidityMethodSignature(test_data.KovanFlopperABI, "Kick") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the pit frob event signature", func() { - expected := "Frob(bytes32,bytes32,uint256,uint256,int256,int256,uint256)" - actual := constants.GetSolidityMethodSignature(test_data.KovanPitABI, "Frob") - - Expect(expected).To(Equal(actual)) - }) - - It("gets the log value method signature", func() { - expected := "LogValue(bytes32)" - actual := constants.GetSolidityMethodSignature(test_data.KovanMedianizerABI, "LogValue") - - Expect(expected).To(Equal(actual)) - }) - }) - }) -}) diff --git a/pkg/transformers/shared/constants/external.go b/pkg/transformers/shared/constants/external.go deleted file mode 100644 index 5b14d435..00000000 --- a/pkg/transformers/shared/constants/external.go +++ /dev/null @@ -1,62 +0,0 @@ -package constants - -import ( - "fmt" - - "github.com/spf13/viper" -) - -func getEnvironmentString(key string) string { - value := viper.GetString(key) - if value == "" { - panic(fmt.Sprintf("No environment configuration variable set for key: \"%v\"", key)) - } - return value -} - -// Returns an int from the environment, defaulting to 0 if it does not exist -func getEnvironmentInt64(key string) int64 { - value := viper.GetInt64(key) - if value == -1 { - return 0 - } - return value -} - -// Getters for contract addresses from environment files -func CatContractAddress() string { return getEnvironmentString("contract.address.cat") } -func DripContractAddress() string { return getEnvironmentString("contract.address.drip") } -func FlapperContractAddress() string { return getEnvironmentString("contract.address.mcd_flap") } -func FlipperContractAddress() string { return getEnvironmentString("contract.address.eth_flip") } -func FlopperContractAddress() string { return getEnvironmentString("contract.address.mcd_flop") } -func PepContractAddress() string { return getEnvironmentString("contract.address.pep") } -func PipContractAddress() string { return getEnvironmentString("contract.address.pip") } -func PitContractAddress() string { return getEnvironmentString("contract.address.pit") } -func RepContractAddress() string { return getEnvironmentString("contract.address.rep") } -func VatContractAddress() string { return getEnvironmentString("contract.address.vat") } -func VowContractAddress() string { return getEnvironmentString("contract.address.vow") } - -func CatABI() string { return getEnvironmentString("contract.abi.cat") } -func DripABI() string { return getEnvironmentString("contract.abi.drip") } -func FlapperABI() string { return getEnvironmentString("contract.abi.mcd_flap") } -func FlipperABI() string { return getEnvironmentString("contract.abi.eth_flip") } -func FlopperABI() string { return getEnvironmentString("contract.abi.mcd_flop") } -func MedianizerABI() string { return getEnvironmentString("contract.abi.medianizer") } -func PitABI() string { return getEnvironmentString("contract.abi.pit") } -func VatABI() string { return getEnvironmentString("contract.abi.vat") } -func VowABI() string { return getEnvironmentString("contract.abi.vow") } - -func CatDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.cat") } -func DripDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.drip") } -func FlapperDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.mcd_flap") } -func FlipperDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.eth_flip") } -func FlopperDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.mcd_flop") } -func PepDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.pep") } -func PipDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.pip") } -func PitDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.pit") } -func RepDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.rep") } -func VatDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.vat") } -func VowDeploymentBlock() int64 { return getEnvironmentInt64("contract.deployment-block.vow") } -func MedianizerDeploymentBlock() int64 { - return getEnvironmentInt64("contract.deployment-block.medianizer") -} diff --git a/pkg/transformers/shared/constants/label.go b/pkg/transformers/shared/constants/label.go deleted file mode 100644 index ffee43eb..00000000 --- a/pkg/transformers/shared/constants/label.go +++ /dev/null @@ -1,65 +0,0 @@ -package constants - -const ( - BiteLabel = "bite" - CatFileChopLumpLabel = "catFileChopLump" - CatFileFlipLabel = "catFileFlip" - CatFilePitVowLabel = "catFilePitVow" - DealLabel = "deal" - DentLabel = "dent" - DripDripLabel = "dripDrip" - DripFileIlkLabel = "dripFileIlk" - DripFileRepoLabel = "dripFileRepo" - DripFileVowLabel = "dripFileVow" - FlapKickLabel = "flapKick" - FlipKickLabel = "flipKick" - FlopKickLabel = "flopKick" - FrobLabel = "frob" - PitFileDebtCeilingLabel = "pitFileDebtCeiling" - PitFileIlkLabel = "pitFileIlk" - PriceFeedLabel = "priceFeed" - TendLabel = "tend" - VatFluxLabel = "vatFlux" - VatFoldLabel = "vatFold" - VatGrabLabel = "vatGrab" - VatHealLabel = "vatHeal" - VatInitLabel = "vatInit" - VatMoveLabel = "vatMove" - VatSlipLabel = "vatSlip" - VatTollLabel = "vatToll" - VatTuneLabel = "vatTune" - VowFlogLabel = "vowFlog" -) - -func AllTransformerLabels() []string { - return []string{ - BiteLabel, - CatFileChopLumpLabel, - CatFileFlipLabel, - CatFilePitVowLabel, - DealLabel, - DentLabel, - DripDripLabel, - DripFileIlkLabel, - DripFileRepoLabel, - DripFileVowLabel, - FlapKickLabel, - FlipKickLabel, - FlopKickLabel, - FrobLabel, - PitFileDebtCeilingLabel, - PitFileIlkLabel, - PriceFeedLabel, - TendLabel, - VatFluxLabel, - VatFoldLabel, - VatGrabLabel, - VatHealLabel, - VatInitLabel, - VatMoveLabel, - VatSlipLabel, - VatTollLabel, - VatTuneLabel, - VowFlogLabel, - } -} diff --git a/pkg/transformers/shared/constants/method.go b/pkg/transformers/shared/constants/method.go deleted file mode 100644 index b6d658cf..00000000 --- a/pkg/transformers/shared/constants/method.go +++ /dev/null @@ -1,31 +0,0 @@ -package constants - -//TODO: get cat, pit, and drip file method signatures directly from the ABI -func biteMethod() string { return GetSolidityMethodSignature(CatABI(), "Bite") } -func catFileChopLumpMethod() string { return "file(bytes32,bytes32,uint256)" } -func catFileFlipMethod() string { return GetSolidityMethodSignature(CatABI(), "file") } -func catFilePitVowMethod() string { return "file(bytes32,address)" } -func dealMethod() string { return GetSolidityMethodSignature(FlipperABI(), "deal") } -func dentMethod() string { return GetSolidityMethodSignature(FlipperABI(), "dent") } -func dripDripMethod() string { return GetSolidityMethodSignature(DripABI(), "drip") } -func dripFileIlkMethod() string { return "file(bytes32,bytes32,uint256)" } -func dripFileRepoMethod() string { return GetSolidityMethodSignature(DripABI(), "file") } -func dripFileVowMethod() string { return "file(bytes32,bytes32)" } -func flapKickMethod() string { return GetSolidityMethodSignature(FlapperABI(), "Kick") } -func flipKickMethod() string { return GetSolidityMethodSignature(FlipperABI(), "Kick") } -func flopKickMethod() string { return GetSolidityMethodSignature(FlopperABI(), "Kick") } -func frobMethod() string { return GetSolidityMethodSignature(PitABI(), "Frob") } -func logValueMethod() string { return GetSolidityMethodSignature(MedianizerABI(), "LogValue") } -func pitFileDebtCeilingMethod() string { return "file(bytes32,uint256)" } -func pitFileIlkMethod() string { return "file(bytes32,bytes32,uint256)" } -func tendMethod() string { return GetSolidityMethodSignature(FlipperABI(), "tend") } -func vatFluxMethod() string { return GetSolidityMethodSignature(VatABI(), "flux") } -func vatFoldMethod() string { return GetSolidityMethodSignature(VatABI(), "fold") } -func vatGrabMethod() string { return GetSolidityMethodSignature(VatABI(), "grab") } -func vatHealMethod() string { return GetSolidityMethodSignature(VatABI(), "heal") } -func vatInitMethod() string { return GetSolidityMethodSignature(VatABI(), "init") } -func vatMoveMethod() string { return GetSolidityMethodSignature(VatABI(), "move") } -func vatSlipMethod() string { return GetSolidityMethodSignature(VatABI(), "slip") } -func vatTollMethod() string { return GetSolidityMethodSignature(VatABI(), "toll") } -func vatTuneMethod() string { return GetSolidityMethodSignature(VatABI(), "tune") } -func vowFlogMethod() string { return GetSolidityMethodSignature(VowABI(), "flog") } diff --git a/pkg/transformers/shared/constants/signature.go b/pkg/transformers/shared/constants/signature.go deleted file mode 100644 index baa10d5f..00000000 --- a/pkg/transformers/shared/constants/signature.go +++ /dev/null @@ -1,30 +0,0 @@ -package constants - -func GetBiteSignature() string { return GetEventSignature(biteMethod()) } -func GetCatFileChopLumpSignature() string { return GetLogNoteSignature(catFileChopLumpMethod()) } -func GetCatFileFlipSignature() string { return GetLogNoteSignature(catFileFlipMethod()) } -func GetCatFilePitVowSignature() string { return GetLogNoteSignature(catFilePitVowMethod()) } -func GetDealSignature() string { return GetLogNoteSignature(dealMethod()) } -func GetDentFunctionSignature() string { return GetLogNoteSignature(dentMethod()) } -func GetDripDripSignature() string { return GetLogNoteSignature(dripDripMethod()) } -func GetDripFileIlkSignature() string { return GetLogNoteSignature(dripFileIlkMethod()) } -func GetDripFileRepoSignature() string { return GetLogNoteSignature(dripFileRepoMethod()) } -func GetDripFileVowSignature() string { return GetLogNoteSignature(dripFileVowMethod()) } -func GetFlapKickSignature() string { return GetEventSignature(flapKickMethod()) } -func GetFlipKickSignature() string { return GetEventSignature(flipKickMethod()) } -func GetFlopKickSignature() string { return GetEventSignature(flopKickMethod()) } -func GetFrobSignature() string { return GetEventSignature(frobMethod()) } -func GetLogValueSignature() string { return GetEventSignature(logValueMethod()) } -func GetPitFileDebtCeilingSignature() string { return GetLogNoteSignature(pitFileDebtCeilingMethod()) } -func GetPitFileIlkSignature() string { return GetLogNoteSignature(pitFileIlkMethod()) } -func GetTendFunctionSignature() string { return GetLogNoteSignature(tendMethod()) } -func GetVatFluxSignature() string { return GetLogNoteSignature(vatFluxMethod()) } -func GetVatFoldSignature() string { return GetLogNoteSignature(vatFoldMethod()) } -func GetVatGrabSignature() string { return GetLogNoteSignature(vatGrabMethod()) } -func GetVatHealSignature() string { return GetLogNoteSignature(vatHealMethod()) } -func GetVatInitSignature() string { return GetLogNoteSignature(vatInitMethod()) } -func GetVatMoveSignature() string { return GetLogNoteSignature(vatMoveMethod()) } -func GetVatSlipSignature() string { return GetLogNoteSignature(vatSlipMethod()) } -func GetVatTollSignature() string { return GetLogNoteSignature(vatTollMethod()) } -func GetVatTuneSignature() string { return GetLogNoteSignature(vatTuneMethod()) } -func GetVowFlogSignature() string { return GetLogNoteSignature(vowFlogMethod()) } diff --git a/pkg/transformers/shared/shared_suite_test.go b/pkg/transformers/shared/shared_suite_test.go deleted file mode 100644 index ff768f49..00000000 --- a/pkg/transformers/shared/shared_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package shared_test - -import ( - "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestShared(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Shared Suite") -} - -var _ = BeforeSuite(func() { - logrus.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/shared/storage/transformer.go b/pkg/transformers/shared/storage/transformer.go deleted file mode 100644 index 240f8ca1..00000000 --- a/pkg/transformers/shared/storage/transformer.go +++ /dev/null @@ -1,14 +0,0 @@ -package storage - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type Transformer interface { - Execute(row shared.StorageDiffRow) error - ContractAddress() common.Address -} - -type TransformerInitializer func(db *postgres.DB) Transformer diff --git a/pkg/transformers/shared/utilities.go b/pkg/transformers/shared/utilities.go deleted file mode 100644 index a33587ae..00000000 --- a/pkg/transformers/shared/utilities.go +++ /dev/null @@ -1,100 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package shared - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "math/big" -) - -var ( - rayBase = big.NewFloat(1e27) - wadBase = big.NewFloat(1e18) - rayPrecision = 27 - wadPrecision = 18 - ray = "ray" - wad = "wad" -) - -func BigIntToInt64(value *big.Int) int64 { - if value == nil { - return int64(0) - } else { - return value.Int64() - } -} - -func BigIntToString(value *big.Int) string { - result := value.String() - if result == "" { - return "" - } else { - return result - } -} - -func GetDataBytesAtIndex(n int, logData []byte) []byte { - switch { - case n == -1: - return logData[len(logData)-constants.DataItemLength:] - case n == -2: - return logData[len(logData)-(2*constants.DataItemLength) : len(logData)-constants.DataItemLength] - case n == -3: - return logData[len(logData)-(3*constants.DataItemLength) : len(logData)-(2*constants.DataItemLength)] - } - return []byte{} -} - -func GetHexWithoutPrefix(raw []byte) string { - return common.Bytes2Hex(raw) -} - -func ConvertToRay(value string) string { - return convert(ray, value, rayPrecision) -} - -func ConvertToWad(value string) string { - return convert(wad, value, wadPrecision) -} - -func convert(conversion string, value string, precision int) string { - result := big.NewFloat(0.0) - bigFloat := big.NewFloat(0.0) - bigFloat.SetString(value) - - switch conversion { - case ray: - result.Quo(bigFloat, rayBase) - case wad: - result.Quo(bigFloat, wadBase) - } - return result.Text('f', precision) -} - -func MinInt64(ints []int64) (min int64) { - if len(ints) == 0 { - return 0 - } - min = ints[0] - for _, i := range ints { - if i < min { - min = i - } - } - return -} diff --git a/pkg/transformers/shared/utilities_test.go b/pkg/transformers/shared/utilities_test.go deleted file mode 100644 index 56a02e95..00000000 --- a/pkg/transformers/shared/utilities_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package shared_test - -import ( - "github.com/ethereum/go-ethereum/common/hexutil" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "math/big" -) - -var _ = Describe("Shared utilities", func() { - Describe("getting data at index", func() { - It("gets bytes for the last index in log data", func() { - logData := hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c45dd6471a66616b6520696c6b0000000000000000000000000000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b00000000000000000000000000f243e26db94b5426032e6dfa6007802dea2a61400000000000000000000000000000000000000000000000000000000000000000000000000000000075bcd15000000000000000000000000000000000000000000000000000000003ade68b1") - bigIntBytes := big.NewInt(987654321).Bytes() - // big.Int.Bytes() does not include zero padding, but bytes in data index are of fixed length and include zero padding - expected := []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - expected = append(expected, bigIntBytes...) - - actual := shared.GetDataBytesAtIndex(-1, logData) - - Expect(expected[:]).To(Equal(actual)) - }) - - It("gets bytes for the second-to-last index in log data", func() { - logData := hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c45dd6471a66616b6520696c6b0000000000000000000000000000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b00000000000000000000000000f243e26db94b5426032e6dfa6007802dea2a61400000000000000000000000000000000000000000000000000000000000000000000000000000000075bcd15000000000000000000000000000000000000000000000000000000003ade68b1") - bigIntBytes := big.NewInt(123456789).Bytes() - expected := []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - expected = append(expected, bigIntBytes...) - - actual := shared.GetDataBytesAtIndex(-2, logData) - - Expect(expected[:]).To(Equal(actual)) - }) - - It("gets bytes for the third-to-last index in log data", func() { - logData := hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c45dd6471a66616b6520696c6b0000000000000000000000000000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b00000000000000000000000000f243e26db94b5426032e6dfa6007802dea2a61400000000000000000000000000000000000000000000000000000000000000000000000000000000075bcd15000000000000000000000000000000000000000000000000000000003ade68b1") - addressBytes := common.HexToAddress("0x0F243E26db94B5426032E6DFA6007802Dea2a614").Bytes() - // common.address.Bytes() returns [20]byte{}, need [32]byte{} - expected := append(addressBytes, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}...) - - actual := shared.GetDataBytesAtIndex(-3, logData) - - Expect(expected[:]).To(Equal(actual)) - }) - - It("converts values to rays", func() { - rayOne := shared.ConvertToRay("123456789012345678901234567890") - Expect(rayOne).To(Equal("123.456789012345680589533003513")) - - rayTwo := shared.ConvertToRay("1234567890123456790123567890") - Expect(rayTwo).To(Equal("1.234567890123456912476740399")) - }) - - It("converts values to wads", func() { - wadOne := shared.ConvertToWad("12345678901234567890123") - Expect(wadOne).To(Equal("12345.678901234567092615")) - - wadTwo := shared.ConvertToWad("1234567890123456789") - Expect(wadTwo).To(Equal("1.234567890123456690")) - }) - }) - - Describe("getting hex without prefix", func() { - It("returns bytes as hex without 0x prefix", func() { - raw := common.HexToHash("0x4554480000000000000000000000000000000000000000000000000000000000").Bytes() - result := shared.GetHexWithoutPrefix(raw) - Expect(result).To(Equal("4554480000000000000000000000000000000000000000000000000000000000")) - }) - }) -}) diff --git a/pkg/transformers/storage_diffs/maker/cat/cat_suite_test.go b/pkg/transformers/storage_diffs/maker/cat/cat_suite_test.go deleted file mode 100644 index 98207fa0..00000000 --- a/pkg/transformers/storage_diffs/maker/cat/cat_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package cat_test - -import ( - "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestCat(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Cat Suite") -} - -var _ = BeforeSuite(func() { - logrus.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/storage_diffs/maker/cat/mappings.go b/pkg/transformers/storage_diffs/maker/cat/mappings.go deleted file mode 100644 index 46ade008..00000000 --- a/pkg/transformers/storage_diffs/maker/cat/mappings.go +++ /dev/null @@ -1,198 +0,0 @@ -package cat - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/sirupsen/logrus" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "strconv" -) - -const ( - NFlip = "nflip" - Live = "live" - Vat = "vat" - Pit = "pit" - Vow = "vow" - - IlkFlip = "flip" - IlkChop = "chop" - IlkLump = "lump" - - FlipIlk = "ilk" - FlipUrn = "urn" - FlipInk = "ink" - FlipTab = "tab" -) - -var ( - // wards takes up index 0 - IlksMappingIndex = storage_diffs.IndexOne // bytes32 => flip address; chop (ray), lump (wad) uint256 - FlipsMappingIndex = storage_diffs.IndexTwo // uint256 => ilk, urn bytes32; ink, tab uint256 (both wad) - - NFlipKey = common.HexToHash(storage_diffs.IndexThree) - NFlipMetadata = shared.GetStorageValueMetadata(NFlip, nil, shared.Uint256) - - LiveKey = common.HexToHash(storage_diffs.IndexFour) - LiveMetadata = shared.GetStorageValueMetadata(Live, nil, shared.Uint256) - - VatKey = common.HexToHash(storage_diffs.IndexFive) - VatMetadata = shared.GetStorageValueMetadata(Vat, nil, shared.Address) - - PitKey = common.HexToHash(storage_diffs.IndexSix) - PitMetadata = shared.GetStorageValueMetadata(Pit, nil, shared.Address) - - VowKey = common.HexToHash(storage_diffs.IndexSeven) - VowMetadata = shared.GetStorageValueMetadata(Vow, nil, shared.Address) -) - -type CatMappings struct { - StorageRepository maker.IMakerStorageRepository - mappings map[common.Hash]shared.StorageValueMetadata -} - -func (mappings CatMappings) Lookup(key common.Hash) (shared.StorageValueMetadata, error) { - metadata, ok := mappings.mappings[key] - if !ok { - err := mappings.loadMappings() - if err != nil { - return metadata, err - } - metadata, ok = mappings.mappings[key] - if !ok { - return metadata, shared.ErrStorageKeyNotFound{Key: key.Hex()} - } - } - return metadata, nil -} - -func (mappings *CatMappings) SetDB(db *postgres.DB) { - mappings.StorageRepository.SetDB(db) -} - -func (mappings *CatMappings) loadMappings() error { - mappings.mappings = loadStaticMappings() - ilkErr := mappings.loadIlkKeys() - if ilkErr != nil { - return ilkErr - } - - flipsErr := mappings.loadFlipsKeys() - if flipsErr != nil { - return flipsErr - } - - return nil -} - -func loadStaticMappings() map[common.Hash]shared.StorageValueMetadata { - mappings := make(map[common.Hash]shared.StorageValueMetadata) - mappings[NFlipKey] = NFlipMetadata - mappings[LiveKey] = LiveMetadata - mappings[VatKey] = VatMetadata - mappings[PitKey] = PitMetadata - mappings[VowKey] = VowMetadata - return mappings -} - -// Ilks -func (mappings *CatMappings) loadIlkKeys() error { - ilks, err := mappings.StorageRepository.GetIlks() - if err != nil { - return err - } - for _, ilk := range ilks { - mappings.mappings[getIlkFlipKey(ilk)] = getIlkFlipMetadata(ilk) - mappings.mappings[getIlkChopKey(ilk)] = getIlkChopMetadata(ilk) - mappings.mappings[getIlkLumpKey(ilk)] = getIlkLumpMetadata(ilk) - } - return nil -} - -func getIlkFlipKey(ilk string) common.Hash { - return storage_diffs.GetMapping(IlksMappingIndex, ilk) -} - -func getIlkFlipMetadata(ilk string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk} - return shared.GetStorageValueMetadata(IlkFlip, keys, shared.Address) -} - -func getIlkChopKey(ilk string) common.Hash { - return storage_diffs.GetIncrementedKey(getIlkFlipKey(ilk), 1) -} - -func getIlkChopMetadata(ilk string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk} - return shared.GetStorageValueMetadata(IlkChop, keys, shared.Uint256) -} - -func getIlkLumpKey(ilk string) common.Hash { - return storage_diffs.GetIncrementedKey(getIlkFlipKey(ilk), 2) -} - -func getIlkLumpMetadata(ilk string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk} - return shared.GetStorageValueMetadata(IlkLump, keys, shared.Uint256) -} - -// Flip ID increments each time it happens, so we just need the biggest flip ID from the DB -// and we can interpolate the sequence [0..max]. This makes sure we track all earlier flips, -// even if we've missed events -func (mappings CatMappings) loadFlipsKeys() error { - maxFlip, err := mappings.StorageRepository.GetMaxFlip() - if err != nil { - logrus.Error("loadFlipsKeys: error getting max flip: ", err) - return err - } else if maxFlip == nil { // No flips occurred yet - return nil - } - - last := maxFlip.Int64() - for flip := 0; int64(flip) <= last; flip++ { - flipStr := strconv.Itoa(flip) - mappings.mappings[getFlipIlkKey(flipStr)] = getFlipIlkMetadata(flipStr) - mappings.mappings[getFlipUrnKey(flipStr)] = getFlipUrnMetadata(flipStr) - mappings.mappings[getFlipInkKey(flipStr)] = getFlipInkMetadata(flipStr) - mappings.mappings[getFlipTabKey(flipStr)] = getFlipTabMetadata(flipStr) - } - return nil -} - -func getFlipIlkKey(flip string) common.Hash { - return storage_diffs.GetMapping(FlipsMappingIndex, flip) -} - -func getFlipIlkMetadata(flip string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Flip: flip} - return shared.GetStorageValueMetadata(FlipIlk, keys, shared.Bytes32) -} - -func getFlipUrnKey(flip string) common.Hash { - return storage_diffs.GetIncrementedKey(getFlipIlkKey(flip), 1) -} - -func getFlipUrnMetadata(flip string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Flip: flip} - return shared.GetStorageValueMetadata(FlipUrn, keys, shared.Bytes32) -} - -func getFlipInkKey(flip string) common.Hash { - return storage_diffs.GetIncrementedKey(getFlipIlkKey(flip), 2) -} - -func getFlipInkMetadata(flip string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Flip: flip} - return shared.GetStorageValueMetadata(FlipInk, keys, shared.Uint256) -} - -func getFlipTabKey(flip string) common.Hash { - return storage_diffs.GetIncrementedKey(getFlipIlkKey(flip), 3) -} - -func getFlipTabMetadata(flip string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Flip: flip} - return shared.GetStorageValueMetadata(FlipTab, keys, shared.Uint256) -} diff --git a/pkg/transformers/storage_diffs/maker/cat/mappings_test.go b/pkg/transformers/storage_diffs/maker/cat/mappings_test.go deleted file mode 100644 index 4cf725b7..00000000 --- a/pkg/transformers/storage_diffs/maker/cat/mappings_test.go +++ /dev/null @@ -1,177 +0,0 @@ -package cat_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/cat" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/test_helpers" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "math/big" -) - -var _ = Describe("Cat storage mappings", func() { - const ( - fakeIlk = "fakeIlk" - fakeFlip = "2" - ) - - var ( - storageRepository *test_helpers.MockMakerStorageRepository - mappings cat.CatMappings - ) - - BeforeEach(func() { - storageRepository = &test_helpers.MockMakerStorageRepository{} - mappings = cat.CatMappings{StorageRepository: storageRepository} - }) - - Describe("looking up static keys", func() { - It("returns value metadata if key exists", func() { - Expect(mappings.Lookup(cat.NFlipKey)).To(Equal(cat.NFlipMetadata)) - Expect(mappings.Lookup(cat.LiveKey)).To(Equal(cat.LiveMetadata)) - Expect(mappings.Lookup(cat.VatKey)).To(Equal(cat.VatMetadata)) - Expect(mappings.Lookup(cat.PitKey)).To(Equal(cat.PitMetadata)) - Expect(mappings.Lookup(cat.VowKey)).To(Equal(cat.VowMetadata)) - }) - - It("returns error if key does not exist", func() { - _, err := mappings.Lookup(common.HexToHash(fakes.FakeHash.Hex())) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrStorageKeyNotFound{Key: fakes.FakeHash.Hex()})) - }) - }) - - Describe("looking up dynamic keys", func() { - It("refreshes mappings from repository if key not found", func() { - _, _ = mappings.Lookup(fakes.FakeHash) - - Expect(storageRepository.GetIlksCalled).To(BeTrue()) - Expect(storageRepository.GetMaxFlipCalled).To(BeTrue()) - }) - - It("returns error if ilks lookup fails", func() { - storageRepository.GetIlksError = fakes.FakeError - - _, err := mappings.Lookup(fakes.FakeHash) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(fakes.FakeError)) - }) - - It("returns error if max flip lookup fails", func() { - storageRepository.GetMaxFlipError = fakes.FakeError - - _, err := mappings.Lookup(fakes.FakeHash) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(fakes.FakeError)) - }) - - It("interpolates flips up to max", func() { - storageRepository.MaxFlip = big.NewInt(1) - - _, err := mappings.Lookup(storage_diffs.GetMapping(storage_diffs.IndexTwo, "0")) - Expect(err).NotTo(HaveOccurred()) - - _, err = mappings.Lookup(storage_diffs.GetMapping(storage_diffs.IndexTwo, "1")) - Expect(err).NotTo(HaveOccurred()) - }) - - Describe("ilk", func() { - var ilkFlipKey = common.BytesToHash(crypto.Keccak256(common.FromHex(fakeIlk + cat.IlksMappingIndex))) - - BeforeEach(func() { - storageRepository.Ilks = []string{fakeIlk} - }) - - It("returns value metadata for ilk flip", func() { - expectedMetadata := shared.StorageValueMetadata{ - Name: cat.IlkFlip, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk}, - Type: shared.Address, - } - Expect(mappings.Lookup(ilkFlipKey)).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for ilk chop", func() { - ilkChopKey := storage_diffs.GetIncrementedKey(ilkFlipKey, 1) - expectedMetadata := shared.StorageValueMetadata{ - Name: cat.IlkChop, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk}, - Type: shared.Uint256, - } - Expect(mappings.Lookup(ilkChopKey)).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for ilk lump", func() { - ilkLumpKey := storage_diffs.GetIncrementedKey(ilkFlipKey, 2) - expectedMetadata := shared.StorageValueMetadata{ - Name: cat.IlkLump, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk}, - Type: shared.Uint256, - } - Expect(mappings.Lookup(ilkLumpKey)).To(Equal(expectedMetadata)) - }) - }) - - Describe("flip", func() { - var flipIlkKey = common.BytesToHash(crypto.Keccak256(common.FromHex(fakeFlip + cat.FlipsMappingIndex))) - - BeforeEach(func() { - storageRepository.MaxFlip = big.NewInt(2) - }) - - It("returns value metadata for flip ilk", func() { - expectedMetadata := shared.StorageValueMetadata{ - Name: cat.FlipIlk, - Keys: map[shared.Key]string{shared.Flip: fakeFlip}, - Type: shared.Bytes32, - } - actualMetadata, err := mappings.Lookup(flipIlkKey) - Expect(err).NotTo(HaveOccurred()) - Expect(actualMetadata).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for flip urn", func() { - flipUrnKey := storage_diffs.GetIncrementedKey(flipIlkKey, 1) - expectedMetadata := shared.StorageValueMetadata{ - Name: cat.FlipUrn, - Keys: map[shared.Key]string{shared.Flip: fakeFlip}, - Type: shared.Bytes32, - } - actualMetadata, err := mappings.Lookup(flipUrnKey) - Expect(err).NotTo(HaveOccurred()) - Expect(actualMetadata).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for flip ink", func() { - flipInkKey := storage_diffs.GetIncrementedKey(flipIlkKey, 2) - expectedMetadata := shared.StorageValueMetadata{ - Name: cat.FlipInk, - Keys: map[shared.Key]string{shared.Flip: fakeFlip}, - Type: shared.Uint256, - } - actualMetadata, err := mappings.Lookup(flipInkKey) - Expect(err).NotTo(HaveOccurred()) - Expect(actualMetadata).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for flip tab", func() { - flipTabKey := storage_diffs.GetIncrementedKey(flipIlkKey, 3) - expectedMetadata := shared.StorageValueMetadata{ - Name: cat.FlipTab, - Keys: map[shared.Key]string{shared.Flip: fakeFlip}, - Type: shared.Uint256, - } - actualMetadata, err := mappings.Lookup(flipTabKey) - Expect(err).NotTo(HaveOccurred()) - Expect(actualMetadata).To(Equal(expectedMetadata)) - }) - }) - }) -}) diff --git a/pkg/transformers/storage_diffs/maker/cat/repository.go b/pkg/transformers/storage_diffs/maker/cat/repository.go deleted file mode 100644 index 51c4e8ef..00000000 --- a/pkg/transformers/storage_diffs/maker/cat/repository.go +++ /dev/null @@ -1,253 +0,0 @@ -package cat - -import ( - "fmt" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type CatStorageRepository struct { - db *postgres.DB -} - -func (repository *CatStorageRepository) Create(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, value interface{}) error { - switch metadata.Name { - case NFlip: - return repository.insertNFlip(blockNumber, blockHash, value.(string)) - case Live: - return repository.insertLive(blockNumber, blockHash, value.(string)) - case Vat: - return repository.insertVat(blockNumber, blockHash, value.(string)) - case Pit: - return repository.insertPit(blockNumber, blockHash, value.(string)) - case Vow: - return repository.insertVow(blockNumber, blockHash, value.(string)) - case IlkFlip: - return repository.insertIlkFlip(blockNumber, blockHash, metadata, value.(string)) - case IlkChop: - return repository.insertIlkChop(blockNumber, blockHash, metadata, value.(string)) - case IlkLump: - return repository.insertIlkLump(blockNumber, blockHash, metadata, value.(string)) - case FlipIlk: - return repository.insertFlipIlk(blockNumber, blockHash, metadata, value.(string)) - case FlipUrn: - return repository.insertFlipUrn(blockNumber, blockHash, metadata, value.(string)) - case FlipInk: - return repository.insertFlipInk(blockNumber, blockHash, metadata, value.(string)) - case FlipTab: - return repository.insertFlipTab(blockNumber, blockHash, metadata, value.(string)) - default: - panic(fmt.Sprintf("unrecognized cat contract storage name: %s", metadata.Name)) - } -} - -func (repository *CatStorageRepository) SetDB(db *postgres.DB) { - repository.db = db -} - -func (repository *CatStorageRepository) insertNFlip(blockNumber int, blockHash string, nflip string) error { - _, writeErr := repository.db.Exec( - `INSERT INTO maker.cat_nflip (block_number, block_hash, nflip) VALUES ($1, $2, $3)`, - blockNumber, blockHash, nflip) - return writeErr -} - -func (repository *CatStorageRepository) insertLive(blockNumber int, blockHash string, live string) error { - _, writeErr := repository.db.Exec( - `INSERT INTO maker.cat_live (block_number, block_hash, live) VALUES ($1, $2, $3 )`, - blockNumber, blockHash, live) - return writeErr -} - -func (repository *CatStorageRepository) insertVat(blockNumber int, blockHash string, vat string) error { - _, writeErr := repository.db.Exec( - `INSERT INTO maker.cat_vat (block_number, block_hash, vat) VALUES ($1, $2, $3 )`, - blockNumber, blockHash, vat) - return writeErr -} - -func (repository *CatStorageRepository) insertPit(blockNumber int, blockHash string, pit string) error { - _, writeErr := repository.db.Exec( - `INSERT INTO maker.cat_pit (block_number, block_hash, pit) VALUES ($1, $2, $3 )`, - blockNumber, blockHash, pit) - return writeErr -} - -func (repository *CatStorageRepository) insertVow(blockNumber int, blockHash string, vow string) error { - _, writeErr := repository.db.Exec( - `INSERT INTO maker.cat_vow (block_number, block_hash, vow) VALUES ($1, $2, $3 )`, - blockNumber, blockHash, vow) - return writeErr -} - -// Ilks mapping: bytes32 => flip address; chop (ray), lump (wad) uint256 -func (repository *CatStorageRepository) insertIlkFlip(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, flip string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec( - `INSERT INTO maker.cat_ilk_flip (block_number, block_hash, ilk, flip) VALUES ($1, $2, $3, $4)`, - blockNumber, blockHash, ilkID, flip) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk flip: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *CatStorageRepository) insertIlkChop(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, chop string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec( - `INSERT INTO maker.cat_ilk_chop (block_number, block_hash, ilk, chop) VALUES ($1, $2, $3, $4)`, - blockNumber, blockHash, ilkID, chop) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk chop: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *CatStorageRepository) insertIlkLump(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, lump string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec( - `INSERT INTO maker.cat_ilk_lump (block_number, block_hash, ilk, lump) VALUES ($1, $2, $3, $4)`, - blockNumber, blockHash, ilkID, lump) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk lump: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -// Flips mapping: uint256 => ilk, urn bytes32; ink, tab uint256 (both wad) -func (repository *CatStorageRepository) insertFlipIlk(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, ilk string) error { - flip, err := getFlip(metadata.Keys) - if err != nil { - return err - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec( - `INSERT INTO maker.cat_flip_ilk (block_number, block_hash, flip, ilk) VALUES ($1, $2, $3, $4)`, - blockNumber, blockHash, flip, ilkID) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert flip ilk: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *CatStorageRepository) insertFlipUrn(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, urn string) error { - flip, err := getFlip(metadata.Keys) - if err != nil { - return err - } - _, writeErr := repository.db.Exec( - `INSERT INTO maker.cat_flip_urn (block_number, block_hash, flip, urn) VALUES ($1, $2, $3, $4)`, - blockNumber, blockHash, flip, urn) - return writeErr -} - -func (repository *CatStorageRepository) insertFlipInk(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, ink string) error { - flip, err := getFlip(metadata.Keys) - if err != nil { - return err - } - _, writeErr := repository.db.Exec( - `INSERT INTO maker.cat_flip_ink (block_number, block_hash, flip, ink) VALUES ($1, $2, $3, $4)`, - blockNumber, blockHash, flip, ink) - return writeErr -} - -func (repository *CatStorageRepository) insertFlipTab(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, tab string) error { - flip, err := getFlip(metadata.Keys) - if err != nil { - return err - } - _, writeErr := repository.db.Exec( - `INSERT INTO maker.cat_flip_tab (block_number, block_hash, flip, tab) VALUES ($1, $2, $3, $4)`, - blockNumber, blockHash, flip, tab) - return writeErr -} - -func getIlk(keys map[shared.Key]string) (string, error) { - ilk, ok := keys[shared.Ilk] - if !ok { - return "", shared.ErrMetadataMalformed{MissingData: shared.Ilk} - } - return ilk, nil -} - -func getFlip(keys map[shared.Key]string) (string, error) { - flip, ok := keys[shared.Flip] - if !ok { - return "", shared.ErrMetadataMalformed{MissingData: shared.Flip} - } - return flip, nil -} diff --git a/pkg/transformers/storage_diffs/maker/cat/repository_test.go b/pkg/transformers/storage_diffs/maker/cat/repository_test.go deleted file mode 100644 index 525ae845..00000000 --- a/pkg/transformers/storage_diffs/maker/cat/repository_test.go +++ /dev/null @@ -1,258 +0,0 @@ -package cat_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/cat" - . "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/test_helpers" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "github.com/vulcanize/vulcanizedb/test_config" - "strconv" -) - -var _ = Describe("Cat storage repository", func() { - var ( - db *postgres.DB - repo cat.CatStorageRepository - fakeBlockNumber = 123 - fakeBlockHash = "expected_block_hash" - fakeAddress = "0x12345" - fakeIlk = "fake_ilk" - fakeUint256 = "12345" - fakeBytes32 = "fake_bytes32" - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repo = cat.CatStorageRepository{} - repo.SetDB(db) - }) - - Describe("Variable", func() { - var result VariableRes - - Describe("NFlip", func() { - It("writes a row", func() { - nFlipMetadata := shared.GetStorageValueMetadata(cat.NFlip, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, nFlipMetadata, fakeUint256) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, nflip AS value FROM maker.cat_nflip`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeUint256) - }) - }) - - Describe("Live", func() { - It("writes a row", func() { - liveMetadata := shared.GetStorageValueMetadata(cat.Live, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, liveMetadata, fakeUint256) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, live AS value FROM maker.cat_live`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeUint256) - }) - }) - - Describe("Vat", func() { - It("writes a row", func() { - vatMetadata := shared.GetStorageValueMetadata(cat.Vat, nil, shared.Address) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, vatMetadata, fakeAddress) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, vat AS value FROM maker.cat_vat`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeAddress) - }) - }) - - Describe("Pit", func() { - It("writes a row", func() { - pitMetadata := shared.GetStorageValueMetadata(cat.Pit, nil, shared.Address) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, pitMetadata, fakeAddress) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, pit AS value FROM maker.cat_pit`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeAddress) - }) - }) - - Describe("Vow", func() { - It("writes a row", func() { - vowMetadata := shared.GetStorageValueMetadata(cat.Vow, nil, shared.Address) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, vowMetadata, fakeAddress) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, vow AS value FROM maker.cat_vow`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeAddress) - }) - }) - }) - - Describe("Ilk", func() { - var result MappingRes - - Describe("Flip", func() { - It("writes a row", func() { - ilkFlipMetadata := shared.GetStorageValueMetadata(cat.IlkFlip, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Address) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, ilkFlipMetadata, fakeAddress) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key, flip AS value FROM maker.cat_ilk_flip`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeAddress) - }) - - It("returns an error if metadata missing ilk", func() { - malformedIlkFlipMetadata := shared.GetStorageValueMetadata(cat.IlkFlip, map[shared.Key]string{}, shared.Address) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedIlkFlipMetadata, fakeAddress) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - }) - - Describe("Chop", func() { - It("writes a row", func() { - ilkChopMetadata := shared.GetStorageValueMetadata(cat.IlkChop, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, ilkChopMetadata, fakeUint256) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key, chop AS value FROM maker.cat_ilk_chop`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeUint256) - }) - - It("returns an error if metadata missing ilk", func() { - malformedIlkChopMetadata := shared.GetStorageValueMetadata(cat.IlkChop, map[shared.Key]string{}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedIlkChopMetadata, fakeAddress) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - }) - - Describe("Lump", func() { - It("writes a row", func() { - ilkLumpMetadata := shared.GetStorageValueMetadata(cat.IlkLump, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, ilkLumpMetadata, fakeUint256) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key, lump AS value FROM maker.cat_ilk_lump`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeUint256) - }) - - It("returns an error if metadata missing ilk", func() { - malformedIlkLumpMetadata := shared.GetStorageValueMetadata(cat.IlkLump, map[shared.Key]string{}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedIlkLumpMetadata, fakeAddress) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - }) - }) - - Describe("Flip", func() { - var result MappingRes - - Describe("FlipIlk", func() { - It("writes a row", func() { - flipIlkMetadata := shared.GetStorageValueMetadata(cat.FlipIlk, map[shared.Key]string{shared.Flip: fakeUint256}, shared.Bytes32) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, flipIlkMetadata, fakeBytes32) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, flip AS key, ilk AS value FROM maker.cat_flip_ilk`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeBytes32, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, fakeUint256, strconv.Itoa(ilkID)) - }) - - It("returns an error if metadata missing flip", func() { - malformedFlipIlkMetadata := shared.GetStorageValueMetadata(cat.FlipIlk, map[shared.Key]string{}, shared.Bytes32) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedFlipIlkMetadata, fakeBytes32) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Flip})) - }) - }) - - Describe("FlipUrn", func() { - It("writes a row", func() { - flipUrnMetadata := shared.GetStorageValueMetadata(cat.FlipUrn, map[shared.Key]string{shared.Flip: fakeUint256}, shared.Bytes32) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, flipUrnMetadata, fakeBytes32) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, flip AS key, urn AS value FROM maker.cat_flip_urn`) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, fakeUint256, fakeBytes32) - }) - - It("returns an error if metadata missing flip", func() { - malformedFlipUrnMetadata := shared.GetStorageValueMetadata(cat.FlipUrn, map[shared.Key]string{}, shared.Bytes32) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedFlipUrnMetadata, fakeBytes32) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Flip})) - }) - }) - - Describe("FlipInk", func() { - It("writes a row", func() { - flipInkMetadata := shared.GetStorageValueMetadata(cat.FlipInk, map[shared.Key]string{shared.Flip: fakeUint256}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, flipInkMetadata, fakeUint256) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, flip AS key, ink AS value FROM maker.cat_flip_ink`) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, fakeUint256, fakeUint256) - }) - - It("returns an error if metadata missing flip", func() { - malformedFlipInkMetadata := shared.GetStorageValueMetadata(cat.FlipInk, map[shared.Key]string{}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedFlipInkMetadata, fakeUint256) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Flip})) - }) - }) - - Describe("FlipTab", func() { - It("writes a row", func() { - flipTabMetadata := shared.GetStorageValueMetadata(cat.FlipTab, map[shared.Key]string{shared.Flip: fakeUint256}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, flipTabMetadata, fakeUint256) - Expect(err).NotTo(HaveOccurred()) - - err = db.Get(&result, `SELECT block_number, block_hash, flip AS key, tab AS value FROM maker.cat_flip_tab`) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, fakeUint256, fakeUint256) - }) - - It("returns an error if metadata missing flip", func() { - malformedFlipTabMetadata := shared.GetStorageValueMetadata(cat.FlipTab, map[shared.Key]string{}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedFlipTabMetadata, fakeUint256) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Flip})) - }) - }) - }) -}) diff --git a/pkg/transformers/storage_diffs/maker/maker_storage_repository.go b/pkg/transformers/storage_diffs/maker/maker_storage_repository.go deleted file mode 100644 index 7916b059..00000000 --- a/pkg/transformers/storage_diffs/maker/maker_storage_repository.go +++ /dev/null @@ -1,125 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package maker - -import ( - "database/sql" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "math/big" -) - -type Urn struct { - Ilk string - Guy string -} - -type IMakerStorageRepository interface { - GetDaiKeys() ([]string, error) - GetMaxFlip() (*big.Int, error) - GetGemKeys() ([]Urn, error) - GetIlks() ([]string, error) - GetSinKeys() ([]string, error) - GetUrns() ([]Urn, error) - SetDB(db *postgres.DB) -} - -type MakerStorageRepository struct { - db *postgres.DB -} - -func (repository *MakerStorageRepository) GetDaiKeys() ([]string, error) { - var daiKeys []string - err := repository.db.Select(&daiKeys, ` - SELECT DISTINCT src FROM maker.vat_move UNION - SELECT DISTINCT dst FROM maker.vat_move UNION - SELECT DISTINCT w FROM maker.vat_tune UNION - SELECT DISTINCT v FROM maker.vat_heal UNION - SELECT DISTINCT urn FROM maker.vat_fold - `) - return daiKeys, err -} - -func (repository *MakerStorageRepository) GetMaxFlip() (*big.Int, error) { - var maxFlip big.Int - err := repository.db.Get(&maxFlip, `SELECT MAX(nflip) FROM maker.cat_nflip`) - if err == sql.ErrNoRows { - // No flips have occurred; this is different from flip 0 having occurred - return nil, nil - } - return &maxFlip, err -} - -func (repository *MakerStorageRepository) GetGemKeys() ([]Urn, error) { - var gems []Urn - err := repository.db.Select(&gems, ` - SELECT DISTINCT ilks.ilk, slip.guy - FROM maker.vat_slip slip - INNER JOIN maker.ilks ilks ON ilks.id = slip.ilk - UNION - SELECT DISTINCT ilks.ilk, flux.src AS guy - FROM maker.vat_flux flux - INNER JOIN maker.ilks ilks ON ilks.id = flux.ilk - UNION - SELECT DISTINCT ilks.ilk, flux.dst AS guy - FROM maker.vat_flux flux - INNER JOIN maker.ilks ilks ON ilks.id = flux.ilk - UNION - SELECT DISTINCT ilks.ilk, tune.v AS guy - FROM maker.vat_tune tune - INNER JOIN maker.ilks ilks ON ilks.id = tune.ilk - UNION - SELECT DISTINCT ilks.ilk, grab.v AS guy - FROM maker.vat_grab grab - INNER JOIN maker.ilks ilks ON ilks.id = grab.ilk - UNION - SELECT DISTINCT ilks.ilk, toll.urn AS guy - FROM maker.vat_toll toll - INNER JOIN maker.ilks ilks ON ilks.id = toll.ilk - `) - return gems, err -} - -func (repository MakerStorageRepository) GetIlks() ([]string, error) { - var ilks []string - err := repository.db.Select(&ilks, `SELECT DISTINCT ilk FROM maker.ilks`) - return ilks, err -} - -func (repository *MakerStorageRepository) GetSinKeys() ([]string, error) { - var sinKeys []string - err := repository.db.Select(&sinKeys, `SELECT DISTINCT w FROM maker.vat_grab UNION - SELECT DISTINCT urn FROM maker.vat_heal`) - return sinKeys, err -} - -func (repository *MakerStorageRepository) GetUrns() ([]Urn, error) { - var urns []Urn - err := repository.db.Select(&urns, ` - SELECT DISTINCT ilks.ilk, tune.urn AS guy - FROM maker.vat_tune tune - INNER JOIN maker.ilks ilks ON ilks.id = tune.ilk - UNION - SELECT DISTINCT ilks.ilk, grab.urn AS guy - FROM maker.vat_grab grab - INNER JOIN maker.ilks ilks ON ilks.id = grab.ilk -`) - return urns, err -} - -func (repository *MakerStorageRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/storage_diffs/maker/maker_storage_repository_test.go b/pkg/transformers/storage_diffs/maker/maker_storage_repository_test.go deleted file mode 100644 index ac8a5e68..00000000 --- a/pkg/transformers/storage_diffs/maker/maker_storage_repository_test.go +++ /dev/null @@ -1,409 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package maker_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Maker storage repository", func() { - var ( - db *postgres.DB - repository maker.IMakerStorageRepository - ilk1 = "ilk1" - ilk2 = "ilk2" - guy1 = "guy1" - guy2 = "guy2" - guy3 = "guy3" - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repository = &maker.MakerStorageRepository{} - repository.SetDB(db) - }) - - Describe("getting dai keys", func() { - It("fetches guy from both src and dst field on vat_move", func() { - insertVatMove(guy1, guy2, 1, db) - - keys, err := repository.GetDaiKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(keys)).To(Equal(2)) - Expect(keys).To(ConsistOf(guy1, guy2)) - }) - - It("fetches guy from w field on vat_tune", func() { - insertVatTune(guy1, guy1, guy1, guy2, 1, db) - - keys, err := repository.GetDaiKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(keys)).To(Equal(1)) - Expect(keys).To(ConsistOf(guy2)) - }) - - It("fetches guy from v field on vat_heal", func() { - insertVatHeal(guy2, guy1, 1, db) - - keys, err := repository.GetDaiKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(keys)).To(Equal(1)) - Expect(keys).To(ConsistOf(guy1)) - }) - - It("fetches unique guys from vat_move + vat_tune + vat_heal + vat_fold", func() { - guy4 := "guy4" - guy5 := "guy5" - guy6 := "guy6" - insertVatMove(guy1, guy2, 1, db) - insertVatTune(guy1, guy1, guy1, guy3, 2, db) - insertVatHeal(guy6, guy4, 3, db) - insertVatFold(guy5, 4, db) - // duplicates - insertVatMove(guy3, guy1, 5, db) - insertVatTune(guy2, guy2, guy2, guy5, 6, db) - insertVatHeal(guy6, guy2, 7, db) - insertVatFold(guy4, 8, db) - - keys, err := repository.GetDaiKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(keys)).To(Equal(5)) - Expect(keys).To(ConsistOf(guy1, guy2, guy3, guy4, guy5)) - }) - - It("does not return error if no matching rows", func() { - daiKeys, err := repository.GetDaiKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(daiKeys)).To(BeZero()) - }) - }) - - Describe("getting gem keys", func() { - It("fetches guy from both src and dst field on vat_flux", func() { - insertVatFlux(ilk1, guy1, guy2, 1, db) - - gems, err := repository.GetGemKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(gems)).To(Equal(2)) - Expect(gems).To(ConsistOf([]maker.Urn{{ - Ilk: ilk1, - Guy: guy1, - }, { - Ilk: ilk1, - Guy: guy2, - }})) - }) - - It("fetches guy from v field on vat_tune + vat_grab", func() { - insertVatTune(ilk1, guy1, guy2, guy1, 1, db) - insertVatGrab(ilk1, guy1, guy3, guy1, 2, db) - - gems, err := repository.GetGemKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(gems)).To(Equal(2)) - Expect(gems).To(ConsistOf([]maker.Urn{{ - Ilk: ilk1, - Guy: guy2, - }, { - Ilk: ilk1, - Guy: guy3, - }})) - }) - - It("fetches unique urns from vat_slip + vat_flux + vat_tune + vat_grab + vat_toll events", func() { - insertVatSlip(ilk1, guy1, 1, db) - insertVatFlux(ilk1, guy2, guy3, 2, db) - insertVatTune(ilk2, guy1, guy1, guy1, 3, db) - insertVatGrab(ilk2, guy1, guy2, guy1, 4, db) - insertVatToll(ilk2, guy3, 5, db) - // duplicates - insertVatSlip(ilk1, guy2, 6, db) - insertVatFlux(ilk2, guy2, guy3, 7, db) - insertVatTune(ilk2, guy1, guy1, guy1, 8, db) - insertVatGrab(ilk1, guy1, guy1, guy1, 9, db) - insertVatToll(ilk1, guy3, 10, db) - - gems, err := repository.GetGemKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(gems)).To(Equal(6)) - Expect(gems).To(ConsistOf([]maker.Urn{{ - Ilk: ilk1, - Guy: guy1, - }, { - Ilk: ilk1, - Guy: guy2, - }, { - Ilk: ilk1, - Guy: guy3, - }, { - Ilk: ilk2, - Guy: guy1, - }, { - Ilk: ilk2, - Guy: guy2, - }, { - Ilk: ilk2, - Guy: guy3, - }})) - }) - - It("does not return error if no matching rows", func() { - gemKeys, err := repository.GetGemKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(gemKeys)).To(BeZero()) - }) - }) - - Describe("getting ilks", func() { - It("fetches unique ilks from vat init events", func() { - insertVatInit(ilk1, 1, db) - insertVatInit(ilk2, 2, db) - insertVatInit(ilk2, 3, db) - - ilks, err := repository.GetIlks() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(ilks)).To(Equal(2)) - Expect(ilks).To(ConsistOf(ilk1, ilk2)) - }) - - It("does not return error if no matching rows", func() { - ilks, err := repository.GetIlks() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(ilks)).To(BeZero()) - }) - }) - - Describe("getting sin keys", func() { - It("fetches guy from w field of vat grab", func() { - insertVatGrab(guy1, guy1, guy1, guy2, 1, db) - - sinKeys, err := repository.GetSinKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(sinKeys)).To(Equal(1)) - Expect(sinKeys).To(ConsistOf(guy2)) - }) - - It("fetches guy from u field of vat heal", func() { - insertVatHeal(guy1, guy2, 1, db) - - sinKeys, err := repository.GetSinKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(sinKeys)).To(Equal(1)) - Expect(sinKeys).To(ConsistOf(guy1)) - }) - - It("fetches unique sin keys from vat_grab + vat_heal", func() { - insertVatGrab(guy3, guy3, guy3, guy1, 1, db) - insertVatHeal(guy2, guy3, 2, db) - // duplicates - insertVatGrab(guy2, guy2, guy2, guy2, 3, db) - insertVatHeal(guy1, guy2, 4, db) - - sinKeys, err := repository.GetSinKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(sinKeys)).To(Equal(2)) - Expect(sinKeys).To(ConsistOf(guy1, guy2)) - }) - - It("does not return error if no matching rows", func() { - sinKeys, err := repository.GetSinKeys() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(sinKeys)).To(BeZero()) - }) - }) - - Describe("getting urns", func() { - It("fetches unique urns from vat_tune + vat_grab events", func() { - insertVatTune(ilk1, guy1, guy1, guy1, 1, db) - insertVatTune(ilk1, guy2, guy1, guy1, 2, db) - insertVatTune(ilk2, guy1, guy1, guy1, 3, db) - insertVatTune(ilk1, guy1, guy1, guy1, 4, db) - insertVatGrab(ilk1, guy1, guy1, guy1, 5, db) - insertVatGrab(ilk1, guy3, guy1, guy1, 6, db) - - urns, err := repository.GetUrns() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(urns)).To(Equal(4)) - Expect(urns).To(ConsistOf([]maker.Urn{{ - Ilk: ilk1, - Guy: guy1, - }, { - Ilk: ilk1, - Guy: guy2, - }, { - Ilk: ilk2, - Guy: guy1, - }, { - Ilk: ilk1, - Guy: guy3, - }})) - }) - - It("does not return error if no matching rows", func() { - urns, err := repository.GetUrns() - - Expect(err).NotTo(HaveOccurred()) - Expect(len(urns)).To(BeZero()) - }) - }) -}) - -func insertVatFold(urn string, blockNumber int64, db *postgres.DB) { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk("fake_ilk", db) - Expect(err).NotTo(HaveOccurred()) - _, execErr := db.Exec( - `INSERT INTO maker.vat_fold (header_id, urn, ilk, log_idx, tx_idx) - VALUES($1, $2, $3, $4, $5)`, - headerID, urn, ilkID, 0, 0, - ) - Expect(execErr).NotTo(HaveOccurred()) -} - -func insertVatFlux(ilk, src, dst string, blockNumber int64, db *postgres.DB) { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(ilk, db) - Expect(err).NotTo(HaveOccurred()) - _, execErr := db.Exec( - `INSERT INTO maker.vat_flux (header_id, ilk, src, dst, log_idx, tx_idx) - VALUES($1, $2, $3, $4, $5, $6)`, - headerID, ilkID, src, dst, 0, 0, - ) - Expect(execErr).NotTo(HaveOccurred()) -} - -func insertVatGrab(ilk, urn, v, w string, blockNumber int64, db *postgres.DB) { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(ilk, db) - Expect(err).NotTo(HaveOccurred()) - _, execErr := db.Exec( - `INSERT INTO maker.vat_grab (header_id, ilk, urn, v, w, log_idx, tx_idx) - VALUES($1, $2, $3, $4, $5, $6, $7)`, - headerID, ilkID, urn, v, w, 0, 0, - ) - Expect(execErr).NotTo(HaveOccurred()) -} - -func insertVatHeal(urn, v string, blockNumber int64, db *postgres.DB) { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) - Expect(err).NotTo(HaveOccurred()) - _, execErr := db.Exec( - `INSERT INTO maker.vat_heal (header_id, urn, v, log_idx, tx_idx) - VALUES($1, $2, $3, $4, $5)`, - headerID, urn, v, 0, 0, - ) - Expect(execErr).NotTo(HaveOccurred()) -} - -func insertVatInit(ilk string, blockNumber int64, db *postgres.DB) { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(ilk, db) - Expect(err).NotTo(HaveOccurred()) - _, execErr := db.Exec( - `INSERT INTO maker.vat_init (header_id, ilk, log_idx, tx_idx) - VALUES($1, $2, $3, $4)`, - headerID, ilkID, 0, 0, - ) - Expect(execErr).NotTo(HaveOccurred()) -} - -func insertVatMove(src, dst string, blockNumber int64, db *postgres.DB) { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) - Expect(err).NotTo(HaveOccurred()) - _, execErr := db.Exec( - `INSERT INTO maker.vat_move (header_id, src, dst, rad, log_idx, tx_idx) - VALUES($1, $2, $3, $4, $5, $6)`, - headerID, src, dst, 0, 0, 0, - ) - Expect(execErr).NotTo(HaveOccurred()) -} - -func insertVatSlip(ilk, guy string, blockNumber int64, db *postgres.DB) { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(ilk, db) - Expect(err).NotTo(HaveOccurred()) - _, execErr := db.Exec( - `INSERT INTO maker.vat_slip (header_id, ilk, guy, log_idx, tx_idx) - VALUES($1, $2, $3, $4, $5)`, - headerID, ilkID, guy, 0, 0, - ) - Expect(execErr).NotTo(HaveOccurred()) -} - -func insertVatToll(ilk, urn string, blockNumber int64, db *postgres.DB) { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(ilk, db) - Expect(err).NotTo(HaveOccurred()) - _, execErr := db.Exec( - `INSERT INTO maker.vat_toll (header_id, ilk, urn, log_idx, tx_idx) - VALUES($1, $2, $3, $4, $5)`, - headerID, ilkID, urn, 0, 0, - ) - Expect(execErr).NotTo(HaveOccurred()) -} - -func insertVatTune(ilk, urn, v, w string, blockNumber int64, db *postgres.DB) { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(ilk, db) - Expect(err).NotTo(HaveOccurred()) - _, execErr := db.Exec( - `INSERT INTO maker.vat_tune (header_id, ilk, urn, v, w, log_idx, tx_idx) - VALUES($1, $2, $3, $4, $5, $6, $7)`, - headerID, ilkID, urn, v, w, 0, 0, - ) - Expect(execErr).NotTo(HaveOccurred()) -} diff --git a/pkg/transformers/storage_diffs/maker/maker_suite_test.go b/pkg/transformers/storage_diffs/maker/maker_suite_test.go deleted file mode 100644 index e0a3151c..00000000 --- a/pkg/transformers/storage_diffs/maker/maker_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package maker_test - -import ( - "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestMaker(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Maker Suite") -} - -var _ = BeforeSuite(func() { - logrus.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/storage_diffs/maker/pit/mappings.go b/pkg/transformers/storage_diffs/maker/pit/mappings.go deleted file mode 100644 index 46e5938c..00000000 --- a/pkg/transformers/storage_diffs/maker/pit/mappings.go +++ /dev/null @@ -1,134 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -const ( - IlkLine = "line" - IlkSpot = "spot" - PitDrip = "drip" - PitLine = "Line" - PitLive = "live" - PitVat = "vat" -) - -var ( - // storage key and value metadata for "drip" on the Pit contract - DripKey = common.HexToHash(storage_diffs.IndexFive) - DripMetadata = shared.StorageValueMetadata{ - Name: PitDrip, - Keys: nil, - Type: shared.Address, - } - - IlkSpotIndex = storage_diffs.IndexOne - - // storage key and value metadata for "Spot" on the Pit contract - LineKey = common.HexToHash(storage_diffs.IndexThree) - LineMetadata = shared.StorageValueMetadata{ - Name: PitLine, - Keys: nil, - Type: shared.Uint256, - } - - // storage key and value metadata for "live" on the Pit contract - LiveKey = common.HexToHash(storage_diffs.IndexTwo) - LiveMetadata = shared.StorageValueMetadata{ - Name: PitLive, - Keys: nil, - Type: shared.Uint256, - } - - // storage key and value metadata for "vat" on the Pit contract - VatKey = common.HexToHash(storage_diffs.IndexFour) - VatMetadata = shared.StorageValueMetadata{ - Name: PitVat, - Keys: nil, - Type: shared.Address, - } -) - -type PitMappings struct { - StorageRepository maker.IMakerStorageRepository - mappings map[common.Hash]shared.StorageValueMetadata -} - -func (mappings *PitMappings) SetDB(db *postgres.DB) { - mappings.StorageRepository.SetDB(db) -} - -func (mappings *PitMappings) Lookup(key common.Hash) (shared.StorageValueMetadata, error) { - metadata, ok := mappings.mappings[key] - if !ok { - err := mappings.loadMappings() - if err != nil { - return metadata, err - } - metadata, ok = mappings.mappings[key] - if !ok { - return metadata, shared.ErrStorageKeyNotFound{Key: key.Hex()} - } - } - return metadata, nil -} - -func (mappings *PitMappings) loadMappings() error { - mappings.mappings = getStaticMappings() - ilks, err := mappings.StorageRepository.GetIlks() - if err != nil { - return err - } - for _, ilk := range ilks { - mappings.mappings[getSpotKey(ilk)] = getSpotMetadata(ilk) - mappings.mappings[getLineKey(ilk)] = getLineMetadata(ilk) - } - return nil -} - -func getStaticMappings() map[common.Hash]shared.StorageValueMetadata { - mappings := make(map[common.Hash]shared.StorageValueMetadata) - mappings[DripKey] = DripMetadata - mappings[LineKey] = LineMetadata - mappings[LiveKey] = LiveMetadata - mappings[VatKey] = VatMetadata - return mappings -} - -func getSpotKey(ilk string) common.Hash { - return storage_diffs.GetMapping(IlkSpotIndex, ilk) -} - -func getSpotMetadata(ilk string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk} - return shared.GetStorageValueMetadata(IlkSpot, keys, shared.Uint256) -} - -func getLineKey(ilk string) common.Hash { - return storage_diffs.GetIncrementedKey(getSpotKey(ilk), 1) -} - -func getLineMetadata(ilk string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk} - return shared.GetStorageValueMetadata(IlkLine, keys, shared.Uint256) -} diff --git a/pkg/transformers/storage_diffs/maker/pit/mappings_test.go b/pkg/transformers/storage_diffs/maker/pit/mappings_test.go deleted file mode 100644 index 7097a029..00000000 --- a/pkg/transformers/storage_diffs/maker/pit/mappings_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package pit_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/pit" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/test_helpers" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "math/big" -) - -var _ = Describe("Pit storage mappings", func() { - Describe("looking up static keys", func() { - It("returns value metadata if key exists", func() { - storageRepository := &test_helpers.MockMakerStorageRepository{} - mappings := pit.PitMappings{StorageRepository: storageRepository} - - Expect(mappings.Lookup(pit.DripKey)).To(Equal(pit.DripMetadata)) - Expect(mappings.Lookup(pit.LineKey)).To(Equal(pit.LineMetadata)) - Expect(mappings.Lookup(pit.LiveKey)).To(Equal(pit.LiveMetadata)) - Expect(mappings.Lookup(pit.VatKey)).To(Equal(pit.VatMetadata)) - }) - - It("returns error if key does not exist", func() { - mappings := pit.PitMappings{StorageRepository: &test_helpers.MockMakerStorageRepository{}} - - _, err := mappings.Lookup(common.HexToHash(fakes.FakeHash.Hex())) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrStorageKeyNotFound{Key: fakes.FakeHash.Hex()})) - }) - }) - - Describe("looking up dynamic keys", func() { - It("refreshes mappings from repository if key not found", func() { - storageRepository := &test_helpers.MockMakerStorageRepository{} - mappings := pit.PitMappings{StorageRepository: storageRepository} - - mappings.Lookup(fakes.FakeHash) - - Expect(storageRepository.GetIlksCalled).To(BeTrue()) - }) - - It("returns value metadata for spot when ilk in the DB", func() { - storageRepository := &test_helpers.MockMakerStorageRepository{} - fakeIlk := "fakeIlk" - storageRepository.Ilks = []string{fakeIlk} - mappings := pit.PitMappings{StorageRepository: storageRepository} - ilkSpotKey := common.BytesToHash(crypto.Keccak256(common.FromHex("0x" + fakeIlk + pit.IlkSpotIndex))) - expectedMetadata := shared.StorageValueMetadata{ - Name: pit.IlkSpot, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(ilkSpotKey)).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for line when ilk in the DB", func() { - storageRepository := &test_helpers.MockMakerStorageRepository{} - fakeIlk := "fakeIlk" - storageRepository.Ilks = []string{fakeIlk} - mappings := pit.PitMappings{StorageRepository: storageRepository} - ilkSpotKeyBytes := crypto.Keccak256(common.FromHex("0x" + fakeIlk + pit.IlkSpotIndex)) - ilkSpotAsInt := big.NewInt(0).SetBytes(ilkSpotKeyBytes) - incrementedIlkSpot := big.NewInt(0).Add(ilkSpotAsInt, big.NewInt(1)) - ilkLineKey := common.BytesToHash(incrementedIlkSpot.Bytes()) - expectedMetadata := shared.StorageValueMetadata{ - Name: pit.IlkLine, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(ilkLineKey)).To(Equal(expectedMetadata)) - }) - - It("returns error if key not found", func() { - storageRepository := &test_helpers.MockMakerStorageRepository{} - mappings := pit.PitMappings{StorageRepository: storageRepository} - - _, err := mappings.Lookup(fakes.FakeHash) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrStorageKeyNotFound{Key: fakes.FakeHash.Hex()})) - }) - }) -}) diff --git a/pkg/transformers/storage_diffs/maker/pit/pit_suite_test.go b/pkg/transformers/storage_diffs/maker/pit/pit_suite_test.go deleted file mode 100644 index 7a8fc165..00000000 --- a/pkg/transformers/storage_diffs/maker/pit/pit_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package pit_test - -import ( - "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestPit(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Pit Suite") -} - -var _ = BeforeSuite(func() { - logrus.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/storage_diffs/maker/pit/repository.go b/pkg/transformers/storage_diffs/maker/pit/repository.go deleted file mode 100644 index fc73faa3..00000000 --- a/pkg/transformers/storage_diffs/maker/pit/repository.go +++ /dev/null @@ -1,135 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit - -import ( - "fmt" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type PitStorageRepository struct { - db *postgres.DB -} - -func (repository *PitStorageRepository) SetDB(db *postgres.DB) { - repository.db = db -} - -func (repository PitStorageRepository) Create(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, value interface{}) error { - switch metadata.Name { - case IlkLine: - return repository.insertIlkLine(blockNumber, blockHash, metadata, value.(string)) - case IlkSpot: - return repository.insertIlkSpot(blockNumber, blockHash, metadata, value.(string)) - case PitDrip: - return repository.insertPitDrip(blockNumber, blockHash, value.(string)) - case PitLine: - return repository.insertPitLine(blockNumber, blockHash, value.(string)) - case PitLive: - return repository.insertPitLive(blockNumber, blockHash, value.(string)) - case PitVat: - return repository.insertPitVat(blockNumber, blockHash, value.(string)) - default: - panic(fmt.Sprintf("unrecognized pit contract storage name: %s", metadata.Name)) - } -} - -func (repository PitStorageRepository) insertIlkLine(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, line string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - tx, err := repository.db.Begin() - if err != nil { - return err - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec(`INSERT INTO maker.pit_ilk_line (block_number, block_hash, ilk, line) VALUES ($1, $2, $3, $4)`, blockNumber, blockHash, ilkID, line) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert pit ilk line: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository PitStorageRepository) insertIlkSpot(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, spot string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - tx, err := repository.db.Begin() - if err != nil { - return err - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec(`INSERT INTO maker.pit_ilk_spot (block_number, block_hash, ilk, spot) VALUES ($1, $2, $3, $4)`, blockNumber, blockHash, ilkID, spot) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert pit ilk spot: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository PitStorageRepository) insertPitDrip(blockNumber int, blockHash string, drip string) error { - _, err := repository.db.Exec(`INSERT INTO maker.pit_drip (block_number, block_hash, drip) VALUES ($1, $2, $3)`, blockNumber, blockHash, drip) - return err -} - -func (repository PitStorageRepository) insertPitLine(blockNumber int, blockHash string, line string) error { - _, err := repository.db.Exec(`INSERT INTO maker.pit_line (block_number, block_hash, line) VALUES ($1, $2, $3)`, blockNumber, blockHash, line) - return err -} - -func (repository PitStorageRepository) insertPitLive(blockNumber int, blockHash string, live string) error { - _, err := repository.db.Exec(`INSERT INTO maker.pit_live (block_number, block_hash, live) VALUES ($1, $2, $3)`, blockNumber, blockHash, live) - return err -} - -func (repository PitStorageRepository) insertPitVat(blockNumber int, blockHash string, vat string) error { - _, err := repository.db.Exec(`INSERT INTO maker.pit_vat (block_number, block_hash, vat) VALUES ($1, $2, $3)`, blockNumber, blockHash, vat) - return err -} - -func getIlk(keys map[shared.Key]string) (string, error) { - ilk, ok := keys[shared.Ilk] - if !ok { - return "", shared.ErrMetadataMalformed{MissingData: shared.Ilk} - } - return ilk, nil -} diff --git a/pkg/transformers/storage_diffs/maker/pit/repository_test.go b/pkg/transformers/storage_diffs/maker/pit/repository_test.go deleted file mode 100644 index 4b58befb..00000000 --- a/pkg/transformers/storage_diffs/maker/pit/repository_test.go +++ /dev/null @@ -1,137 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package pit_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/pit" - . "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/test_helpers" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "github.com/vulcanize/vulcanizedb/test_config" - "strconv" -) - -var _ = Describe("Pit storage repository", func() { - var ( - db *postgres.DB - err error - repo pit.PitStorageRepository - fakeAddress = "0x12345" - fakeBlockHash = "expected_block_hash" - fakeBlockNumber = 123 - fakeIlk = "fake_ilk" - fakeUint256 = "12345" - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repo = pit.PitStorageRepository{} - repo.SetDB(db) - }) - - Describe("Ilk", func() { - Describe("Line", func() { - It("writes a row", func() { - ilkLineMetadata := shared.GetStorageValueMetadata(pit.IlkLine, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err = repo.Create(fakeBlockNumber, fakeBlockHash, ilkLineMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - var result MappingRes - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key, line AS value FROM maker.pit_ilk_line`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeUint256) - }) - - It("returns an error if metadata missing ilk", func() { - malformedIlkLineMetadata := shared.GetStorageValueMetadata(pit.IlkLine, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedIlkLineMetadata, fakeUint256) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - }) - - Describe("Spot", func() { - It("writes a row", func() { - ilkSpotMetadata := shared.GetStorageValueMetadata(pit.IlkSpot, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err = repo.Create(fakeBlockNumber, fakeBlockHash, ilkSpotMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - var result MappingRes - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key, spot AS value FROM maker.pit_ilk_spot`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeUint256) - }) - - It("returns an error if metadata missing ilk", func() { - malformedIlkSpotMetadata := shared.GetStorageValueMetadata(pit.IlkSpot, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedIlkSpotMetadata, fakeUint256) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - }) - }) - - It("persists a pit drip", func() { - err = repo.Create(fakeBlockNumber, fakeBlockHash, pit.DripMetadata, fakeAddress) - - Expect(err).NotTo(HaveOccurred()) - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, drip AS value FROM maker.pit_drip`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeAddress) - }) - - It("persists a pit line", func() { - err = repo.Create(fakeBlockNumber, fakeBlockHash, pit.LineMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, line AS value FROM maker.pit_line`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeUint256) - }) - - It("persists a pit live", func() { - err = repo.Create(fakeBlockNumber, fakeBlockHash, pit.LiveMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, live AS value FROM maker.pit_live`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeUint256) - }) - - It("persists a pit vat", func() { - err = repo.Create(fakeBlockNumber, fakeBlockHash, pit.VatMetadata, fakeAddress) - - Expect(err).NotTo(HaveOccurred()) - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, vat AS value FROM maker.pit_vat`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeAddress) - }) -}) diff --git a/pkg/transformers/storage_diffs/maker/test_helpers/datatypes.go b/pkg/transformers/storage_diffs/maker/test_helpers/datatypes.go deleted file mode 100644 index 09c6bcc6..00000000 --- a/pkg/transformers/storage_diffs/maker/test_helpers/datatypes.go +++ /dev/null @@ -1,49 +0,0 @@ -package test_helpers - -import ( - . "github.com/onsi/gomega" -) - -type BlockMetadata struct { - BlockNumber int `db:"block_number"` - BlockHash string `db:"block_hash"` -} - -type VariableRes struct { - BlockMetadata - Value string -} - -type MappingRes struct { - BlockMetadata - Key string - Value string -} - -type DoubleMappingRes struct { - BlockMetadata - KeyOne string `db:"key_one"` - KeyTwo string `db:"key_two"` - Value string -} - -func AssertVariable(res VariableRes, blockNumber int, blockHash, value string) { - Expect(res.BlockNumber).To(Equal(blockNumber)) - Expect(res.BlockHash).To(Equal(blockHash)) - Expect(res.Value).To(Equal(value)) -} - -func AssertMapping(res MappingRes, blockNumber int, blockHash, key, value string) { - Expect(res.BlockNumber).To(Equal(blockNumber)) - Expect(res.BlockHash).To(Equal(blockHash)) - Expect(res.Key).To(Equal(key)) - Expect(res.Value).To(Equal(value)) -} - -func AssertDoubleMapping(res DoubleMappingRes, blockNumber int, blockHash, keyOne, keyTwo, value string) { - Expect(res.BlockNumber).To(Equal(blockNumber)) - Expect(res.BlockHash).To(Equal(blockHash)) - Expect(res.KeyOne).To(Equal(keyOne)) - Expect(res.KeyTwo).To(Equal(keyTwo)) - Expect(res.Value).To(Equal(value)) -} diff --git a/pkg/transformers/storage_diffs/maker/test_helpers/maker_storage_repository.go b/pkg/transformers/storage_diffs/maker/test_helpers/maker_storage_repository.go deleted file mode 100644 index 3ce7c08c..00000000 --- a/pkg/transformers/storage_diffs/maker/test_helpers/maker_storage_repository.go +++ /dev/null @@ -1,60 +0,0 @@ -package test_helpers - -import ( - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker" - "math/big" -) - -type MockMakerStorageRepository struct { - DaiKeys []string - GemKeys []maker.Urn - GetDaiKeysCalled bool - GetDaiKeysError error - GetGemKeysCalled bool - GetGemKeysError error - GetIlksCalled bool - GetIlksError error - GetMaxFlipCalled bool - GetMaxFlipError error - GetSinKeysCalled bool - GetSinKeysError error - GetUrnsCalled bool - GetUrnsError error - Ilks []string - MaxFlip *big.Int - SinKeys []string - Urns []maker.Urn -} - -func (repository *MockMakerStorageRepository) GetDaiKeys() ([]string, error) { - repository.GetDaiKeysCalled = true - return repository.DaiKeys, repository.GetDaiKeysError -} - -func (repository *MockMakerStorageRepository) GetGemKeys() ([]maker.Urn, error) { - repository.GetGemKeysCalled = true - return repository.GemKeys, repository.GetGemKeysError -} - -func (repository *MockMakerStorageRepository) GetIlks() ([]string, error) { - repository.GetIlksCalled = true - return repository.Ilks, repository.GetIlksError -} - -func (repository *MockMakerStorageRepository) GetMaxFlip() (*big.Int, error) { - repository.GetMaxFlipCalled = true - return repository.MaxFlip, repository.GetMaxFlipError -} - -func (repository *MockMakerStorageRepository) GetSinKeys() ([]string, error) { - repository.GetSinKeysCalled = true - return repository.SinKeys, repository.GetSinKeysError -} - -func (repository *MockMakerStorageRepository) GetUrns() ([]maker.Urn, error) { - repository.GetUrnsCalled = true - return repository.Urns, repository.GetUrnsError -} - -func (repository *MockMakerStorageRepository) SetDB(db *postgres.DB) {} diff --git a/pkg/transformers/storage_diffs/maker/vat/mappings.go b/pkg/transformers/storage_diffs/maker/vat/mappings.go deleted file mode 100644 index 58e2bf6a..00000000 --- a/pkg/transformers/storage_diffs/maker/vat/mappings.go +++ /dev/null @@ -1,241 +0,0 @@ -package vat - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -const ( - Dai = "dai" - Gem = "gem" - IlkArt = "Art" - IlkInk = "Ink" - IlkRate = "rate" - IlkTake = "take" - Sin = "sin" - UrnArt = "art" - UrnInk = "ink" - VatDebt = "debt" - VatVice = "vice" -) - -var ( - DebtKey = common.HexToHash(storage_diffs.IndexSix) - DebtMetadata = shared.StorageValueMetadata{ - Name: VatDebt, - Keys: nil, - Type: 0, - } - - IlksMappingIndex = storage_diffs.IndexOne - UrnsMappingIndex = storage_diffs.IndexTwo - GemsMappingIndex = storage_diffs.IndexThree - DaiMappingIndex = storage_diffs.IndexFour - SinMappingIndex = storage_diffs.IndexFive - - ViceKey = common.HexToHash(storage_diffs.IndexSeven) - ViceMetadata = shared.StorageValueMetadata{ - Name: VatVice, - Keys: nil, - Type: 0, - } -) - -type VatMappings struct { - StorageRepository maker.IMakerStorageRepository - mappings map[common.Hash]shared.StorageValueMetadata -} - -func (mappings VatMappings) Lookup(key common.Hash) (shared.StorageValueMetadata, error) { - metadata, ok := mappings.mappings[key] - if !ok { - err := mappings.loadMappings() - if err != nil { - return metadata, err - } - metadata, ok = mappings.mappings[key] - if !ok { - return metadata, shared.ErrStorageKeyNotFound{Key: key.Hex()} - } - } - return metadata, nil -} - -func (mappings *VatMappings) SetDB(db *postgres.DB) { - mappings.StorageRepository.SetDB(db) -} - -func (mappings *VatMappings) loadMappings() error { - mappings.mappings = loadStaticMappings() - daiErr := mappings.loadDaiKeys() - if daiErr != nil { - return daiErr - } - gemErr := mappings.loadGemKeys() - if gemErr != nil { - return gemErr - } - ilkErr := mappings.loadIlkKeys() - if ilkErr != nil { - return ilkErr - } - sinErr := mappings.loadSinKeys() - if sinErr != nil { - return sinErr - } - urnErr := mappings.loadUrnKeys() - if urnErr != nil { - return urnErr - } - return nil -} - -func loadStaticMappings() map[common.Hash]shared.StorageValueMetadata { - mappings := make(map[common.Hash]shared.StorageValueMetadata) - mappings[DebtKey] = DebtMetadata - mappings[ViceKey] = ViceMetadata - return mappings -} - -func (mappings *VatMappings) loadDaiKeys() error { - daiKeys, err := mappings.StorageRepository.GetDaiKeys() - if err != nil { - return err - } - for _, d := range daiKeys { - mappings.mappings[getDaiKey(d)] = getDaiMetadata(d) - } - return nil -} - -func (mappings *VatMappings) loadGemKeys() error { - gemKeys, err := mappings.StorageRepository.GetGemKeys() - if err != nil { - return err - } - for _, gem := range gemKeys { - mappings.mappings[getGemKey(gem.Ilk, gem.Guy)] = getGemMetadata(gem.Ilk, gem.Guy) - } - return nil -} - -func (mappings *VatMappings) loadIlkKeys() error { - ilks, err := mappings.StorageRepository.GetIlks() - if err != nil { - return err - } - for _, ilk := range ilks { - mappings.mappings[getIlkTakeKey(ilk)] = getIlkTakeMetadata(ilk) - mappings.mappings[getIlkRateKey(ilk)] = getIlkRateMetadata(ilk) - mappings.mappings[getIlkInkKey(ilk)] = getIlkInkMetadata(ilk) - mappings.mappings[getIlkArtKey(ilk)] = getIlkArtMetadata(ilk) - } - return nil -} - -func (mappings *VatMappings) loadSinKeys() error { - sinKeys, err := mappings.StorageRepository.GetSinKeys() - if err != nil { - return err - } - for _, s := range sinKeys { - mappings.mappings[getSinKey(s)] = getSinMetadata(s) - } - return nil -} - -func (mappings *VatMappings) loadUrnKeys() error { - urns, err := mappings.StorageRepository.GetUrns() - if err != nil { - return err - } - for _, urn := range urns { - mappings.mappings[getUrnInkKey(urn.Ilk, urn.Guy)] = getUrnInkMetadata(urn.Ilk, urn.Guy) - mappings.mappings[getUrnArtKey(urn.Ilk, urn.Guy)] = getUrnArtMetadata(urn.Ilk, urn.Guy) - } - return nil -} - -func getIlkTakeKey(ilk string) common.Hash { - return storage_diffs.GetMapping(IlksMappingIndex, ilk) -} - -func getIlkTakeMetadata(ilk string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk} - return shared.GetStorageValueMetadata(IlkTake, keys, shared.Uint256) -} - -func getIlkRateKey(ilk string) common.Hash { - return storage_diffs.GetIncrementedKey(getIlkTakeKey(ilk), 1) -} - -func getIlkRateMetadata(ilk string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk} - return shared.GetStorageValueMetadata(IlkRate, keys, shared.Uint256) -} - -func getIlkInkKey(ilk string) common.Hash { - return storage_diffs.GetIncrementedKey(getIlkTakeKey(ilk), 2) -} - -func getIlkInkMetadata(ilk string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk} - return shared.GetStorageValueMetadata(IlkInk, keys, shared.Uint256) -} - -func getIlkArtKey(ilk string) common.Hash { - return storage_diffs.GetIncrementedKey(getIlkTakeKey(ilk), 3) -} - -func getIlkArtMetadata(ilk string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk} - return shared.GetStorageValueMetadata(IlkArt, keys, shared.Uint256) -} - -func getUrnInkKey(ilk, guy string) common.Hash { - return storage_diffs.GetNestedMapping(UrnsMappingIndex, ilk, guy) -} - -func getUrnInkMetadata(ilk, guy string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk, shared.Guy: guy} - return shared.GetStorageValueMetadata(UrnInk, keys, shared.Uint256) -} - -func getUrnArtKey(ilk, guy string) common.Hash { - return storage_diffs.GetIncrementedKey(getUrnInkKey(ilk, guy), 1) -} - -func getUrnArtMetadata(ilk, guy string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk, shared.Guy: guy} - return shared.GetStorageValueMetadata(UrnArt, keys, shared.Uint256) -} - -func getGemKey(ilk, guy string) common.Hash { - return storage_diffs.GetNestedMapping(GemsMappingIndex, ilk, guy) -} - -func getGemMetadata(ilk, guy string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Ilk: ilk, shared.Guy: guy} - return shared.GetStorageValueMetadata(Gem, keys, shared.Uint256) -} - -func getDaiKey(guy string) common.Hash { - return storage_diffs.GetMapping(DaiMappingIndex, guy) -} - -func getDaiMetadata(guy string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Guy: guy} - return shared.GetStorageValueMetadata(Dai, keys, shared.Uint256) -} - -func getSinKey(guy string) common.Hash { - return storage_diffs.GetMapping(SinMappingIndex, guy) -} - -func getSinMetadata(guy string) shared.StorageValueMetadata { - keys := map[shared.Key]string{shared.Guy: guy} - return shared.GetStorageValueMetadata(Sin, keys, shared.Uint256) -} diff --git a/pkg/transformers/storage_diffs/maker/vat/mappings_test.go b/pkg/transformers/storage_diffs/maker/vat/mappings_test.go deleted file mode 100644 index 06f7a052..00000000 --- a/pkg/transformers/storage_diffs/maker/vat/mappings_test.go +++ /dev/null @@ -1,233 +0,0 @@ -package vat_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/test_helpers" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vat" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "math/big" -) - -var _ = Describe("Vat storage mappings", func() { - var ( - fakeIlk = "fakeIlk" - fakeGuy = "fakeGuy" - storageRepository *test_helpers.MockMakerStorageRepository - mappings vat.VatMappings - ) - - BeforeEach(func() { - storageRepository = &test_helpers.MockMakerStorageRepository{} - mappings = vat.VatMappings{StorageRepository: storageRepository} - }) - - Describe("looking up static keys", func() { - It("returns value metadata if key exists", func() { - Expect(mappings.Lookup(vat.DebtKey)).To(Equal(vat.DebtMetadata)) - Expect(mappings.Lookup(vat.ViceKey)).To(Equal(vat.ViceMetadata)) - }) - - It("returns error if key does not exist", func() { - _, err := mappings.Lookup(common.HexToHash(fakes.FakeHash.Hex())) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrStorageKeyNotFound{Key: fakes.FakeHash.Hex()})) - }) - }) - - Describe("looking up dynamic keys", func() { - It("refreshes mappings from repository if key not found", func() { - mappings.Lookup(fakes.FakeHash) - - Expect(storageRepository.GetDaiKeysCalled).To(BeTrue()) - Expect(storageRepository.GetGemKeysCalled).To(BeTrue()) - Expect(storageRepository.GetIlksCalled).To(BeTrue()) - Expect(storageRepository.GetSinKeysCalled).To(BeTrue()) - Expect(storageRepository.GetUrnsCalled).To(BeTrue()) - }) - - It("returns error if dai keys lookup fails", func() { - storageRepository.GetDaiKeysError = fakes.FakeError - - _, err := mappings.Lookup(fakes.FakeHash) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(fakes.FakeError)) - }) - - It("returns error if gem keys lookup fails", func() { - storageRepository.GetGemKeysError = fakes.FakeError - - _, err := mappings.Lookup(fakes.FakeHash) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(fakes.FakeError)) - }) - - It("returns error if ilks lookup fails", func() { - storageRepository.GetIlksError = fakes.FakeError - - _, err := mappings.Lookup(fakes.FakeHash) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(fakes.FakeError)) - }) - - It("returns error if sin keys lookup fails", func() { - storageRepository.GetSinKeysError = fakes.FakeError - - _, err := mappings.Lookup(fakes.FakeHash) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(fakes.FakeError)) - }) - - It("returns error if urns lookup fails", func() { - storageRepository.GetUrnsError = fakes.FakeError - - _, err := mappings.Lookup(fakes.FakeHash) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(fakes.FakeError)) - }) - - Describe("ilk", func() { - It("returns value metadata for ilk take", func() { - storageRepository.Ilks = []string{fakeIlk} - ilkTakeKey := common.BytesToHash(crypto.Keccak256(common.FromHex("0x" + fakeIlk + vat.IlksMappingIndex))) - expectedMetadata := shared.StorageValueMetadata{ - Name: vat.IlkTake, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(ilkTakeKey)).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for ilk rate", func() { - storageRepository.Ilks = []string{fakeIlk} - ilkTakeBytes := crypto.Keccak256(common.FromHex("0x" + fakeIlk + vat.IlksMappingIndex)) - ilkTakeAsInt := big.NewInt(0).SetBytes(ilkTakeBytes) - incrementedIlkTake := big.NewInt(0).Add(ilkTakeAsInt, big.NewInt(1)) - ilkRateKey := common.BytesToHash(incrementedIlkTake.Bytes()) - expectedMetadata := shared.StorageValueMetadata{ - Name: vat.IlkRate, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(ilkRateKey)).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for ilk Ink", func() { - storageRepository.Ilks = []string{fakeIlk} - ilkTakeBytes := crypto.Keccak256(common.FromHex("0x" + fakeIlk + vat.IlksMappingIndex)) - ilkTakeAsInt := big.NewInt(0).SetBytes(ilkTakeBytes) - doubleIncrementedIlkTake := big.NewInt(0).Add(ilkTakeAsInt, big.NewInt(2)) - ilkInkKey := common.BytesToHash(doubleIncrementedIlkTake.Bytes()) - expectedMetadata := shared.StorageValueMetadata{ - Name: vat.IlkInk, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(ilkInkKey)).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for ilk Art", func() { - storageRepository.Ilks = []string{fakeIlk} - ilkTakeBytes := crypto.Keccak256(common.FromHex("0x" + fakeIlk + vat.IlksMappingIndex)) - ilkTakeAsInt := big.NewInt(0).SetBytes(ilkTakeBytes) - tripleIncrementedIlkTake := big.NewInt(0).Add(ilkTakeAsInt, big.NewInt(3)) - ilkArtKey := common.BytesToHash(tripleIncrementedIlkTake.Bytes()) - expectedMetadata := shared.StorageValueMetadata{ - Name: vat.IlkArt, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(ilkArtKey)).To(Equal(expectedMetadata)) - }) - }) - - Describe("urn", func() { - It("returns value metadata for urn ink", func() { - storageRepository.Urns = []maker.Urn{{Ilk: fakeIlk, Guy: fakeGuy}} - encodedPrimaryMapIndex := crypto.Keccak256(common.FromHex("0x" + fakeIlk + vat.UrnsMappingIndex)) - encodedSecondaryMapIndex := crypto.Keccak256(common.FromHex(fakeGuy), encodedPrimaryMapIndex) - urnInkKey := common.BytesToHash(encodedSecondaryMapIndex) - expectedMetadata := shared.StorageValueMetadata{ - Name: vat.UrnInk, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk, shared.Guy: fakeGuy}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(urnInkKey)).To(Equal(expectedMetadata)) - }) - - It("returns value metadata for urn art", func() { - storageRepository.Urns = []maker.Urn{{Ilk: fakeIlk, Guy: fakeGuy}} - encodedPrimaryMapIndex := crypto.Keccak256(common.FromHex("0x" + fakeIlk + vat.UrnsMappingIndex)) - urnInkAsInt := big.NewInt(0).SetBytes(crypto.Keccak256(common.FromHex(fakeGuy), encodedPrimaryMapIndex)) - incrementedUrnInk := big.NewInt(0).Add(urnInkAsInt, big.NewInt(1)) - urnArtKey := common.BytesToHash(incrementedUrnInk.Bytes()) - expectedMetadata := shared.StorageValueMetadata{ - Name: vat.UrnArt, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk, shared.Guy: fakeGuy}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(urnArtKey)).To(Equal(expectedMetadata)) - }) - }) - - Describe("gem", func() { - It("returns value metadata for gem", func() { - storageRepository.GemKeys = []maker.Urn{{Ilk: fakeIlk, Guy: fakeGuy}} - encodedPrimaryMapIndex := crypto.Keccak256(common.FromHex("0x" + fakeIlk + vat.GemsMappingIndex)) - encodedSecondaryMapIndex := crypto.Keccak256(common.FromHex(fakeGuy), encodedPrimaryMapIndex) - gemKey := common.BytesToHash(encodedSecondaryMapIndex) - expectedMetadata := shared.StorageValueMetadata{ - Name: vat.Gem, - Keys: map[shared.Key]string{shared.Ilk: fakeIlk, shared.Guy: fakeGuy}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(gemKey)).To(Equal(expectedMetadata)) - }) - }) - - Describe("dai", func() { - It("returns value metadata for dai", func() { - storageRepository.DaiKeys = []string{fakeGuy} - daiKey := common.BytesToHash(crypto.Keccak256(common.FromHex("0x" + fakeGuy + vat.DaiMappingIndex))) - expectedMetadata := shared.StorageValueMetadata{ - Name: vat.Dai, - Keys: map[shared.Key]string{shared.Guy: fakeGuy}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(daiKey)).To(Equal(expectedMetadata)) - }) - }) - - Describe("when sin key exists in the db", func() { - It("returns value metadata for sin", func() { - storageRepository.SinKeys = []string{fakeGuy} - sinKey := common.BytesToHash(crypto.Keccak256(common.FromHex("0x" + fakeGuy + vat.SinMappingIndex))) - expectedMetadata := shared.StorageValueMetadata{ - Name: vat.Sin, - Keys: map[shared.Key]string{shared.Guy: fakeGuy}, - Type: shared.Uint256, - } - - Expect(mappings.Lookup(sinKey)).To(Equal(expectedMetadata)) - }) - }) - }) -}) diff --git a/pkg/transformers/storage_diffs/maker/vat/repository.go b/pkg/transformers/storage_diffs/maker/vat/repository.go deleted file mode 100644 index 65dcf5b9..00000000 --- a/pkg/transformers/storage_diffs/maker/vat/repository.go +++ /dev/null @@ -1,297 +0,0 @@ -package vat - -import ( - "fmt" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type VatStorageRepository struct { - db *postgres.DB -} - -func (repository *VatStorageRepository) Create(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, value interface{}) error { - switch metadata.Name { - case Dai: - return repository.insertDai(blockNumber, blockHash, metadata, value.(string)) - case Gem: - return repository.insertGem(blockNumber, blockHash, metadata, value.(string)) - case IlkArt: - return repository.insertIlkArt(blockNumber, blockHash, metadata, value.(string)) - case IlkInk: - return repository.insertIlkInk(blockNumber, blockHash, metadata, value.(string)) - case IlkRate: - return repository.insertIlkRate(blockNumber, blockHash, metadata, value.(string)) - case IlkTake: - return repository.insertIlkTake(blockNumber, blockHash, metadata, value.(string)) - case Sin: - return repository.insertSin(blockNumber, blockHash, metadata, value.(string)) - case UrnArt: - return repository.insertUrnArt(blockNumber, blockHash, metadata, value.(string)) - case UrnInk: - return repository.insertUrnInk(blockNumber, blockHash, metadata, value.(string)) - case VatDebt: - return repository.insertVatDebt(blockNumber, blockHash, value.(string)) - case VatVice: - return repository.insertVatVice(blockNumber, blockHash, value.(string)) - default: - panic(fmt.Sprintf("unrecognized vat contract storage name: %s", metadata.Name)) - } -} - -func (repository *VatStorageRepository) SetDB(db *postgres.DB) { - repository.db = db -} - -func (repository *VatStorageRepository) insertDai(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, dai string) error { - guy, err := getGuy(metadata.Keys) - if err != nil { - return err - } - _, writeErr := repository.db.Exec(`INSERT INTO maker.vat_dai (block_number, block_hash, guy, dai) VALUES ($1, $2, $3, $4)`, blockNumber, blockHash, guy, dai) - return writeErr -} - -func (repository *VatStorageRepository) insertGem(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, gem string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - guy, guyErr := getGuy(metadata.Keys) - if guyErr != nil { - return guyErr - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec(`INSERT INTO maker.vat_gem (block_number, block_hash, ilk, guy, gem) VALUES ($1, $2, $3, $4, $5)`, blockNumber, blockHash, ilkID, guy, gem) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert gem: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *VatStorageRepository) insertIlkArt(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, art string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec(`INSERT INTO maker.vat_ilk_art (block_number, block_hash, ilk, art) VALUES ($1, $2, $3, $4)`, blockNumber, blockHash, ilkID, art) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk art: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *VatStorageRepository) insertIlkInk(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, ink string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec(`INSERT INTO maker.vat_ilk_ink (block_number, block_hash, ilk, ink) VALUES ($1, $2, $3, $4)`, blockNumber, blockHash, ilkID, ink) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk ink: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *VatStorageRepository) insertIlkRate(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, rate string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec(`INSERT INTO maker.vat_ilk_rate (block_number, block_hash, ilk, rate) VALUES ($1, $2, $3, $4)`, blockNumber, blockHash, ilkID, rate) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk rate: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *VatStorageRepository) insertIlkTake(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, take string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec(`INSERT INTO maker.vat_ilk_take (block_number, block_hash, ilk, take) VALUES ($1, $2, $3, $4)`, blockNumber, blockHash, ilkID, take) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk take: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *VatStorageRepository) insertSin(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, sin string) error { - guy, err := getGuy(metadata.Keys) - if err != nil { - return err - } - _, writeErr := repository.db.Exec(`INSERT INTO maker.vat_sin (block_number, block_hash, guy, sin) VALUES ($1, $2, $3, $4)`, blockNumber, blockHash, guy, sin) - return writeErr -} - -func (repository *VatStorageRepository) insertUrnArt(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, art string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - guy, guyErr := getGuy(metadata.Keys) - if guyErr != nil { - return guyErr - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec(`INSERT INTO maker.vat_urn_art (block_number, block_hash, ilk, urn, art) VALUES ($1, $2, $3, $4, $5)`, blockNumber, blockHash, ilkID, guy, art) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert urn art: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *VatStorageRepository) insertUrnInk(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, ink string) error { - ilk, err := getIlk(metadata.Keys) - if err != nil { - return err - } - guy, guyErr := getGuy(metadata.Keys) - if guyErr != nil { - return guyErr - } - tx, txErr := repository.db.Begin() - if txErr != nil { - return txErr - } - ilkID, ilkErr := shared2.GetOrCreateIlkInTransaction(ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert ilk: %s", ilkErr.Error()) - } - return ilkErr - } - _, writeErr := tx.Exec(`INSERT INTO maker.vat_urn_ink (block_number, block_hash, ilk, urn, ink) VALUES ($1, $2, $3, $4, $5)`, blockNumber, blockHash, ilkID, guy, ink) - if writeErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - return fmt.Errorf("failed to rollback transaction after failing to insert urn ink: %s", writeErr.Error()) - } - return writeErr - } - return tx.Commit() -} - -func (repository *VatStorageRepository) insertVatDebt(blockNumber int, blockHash, debt string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vat_debt (block_number, block_hash, debt) VALUES ($1, $2, $3)`, blockNumber, blockHash, debt) - return err -} - -func (repository *VatStorageRepository) insertVatVice(blockNumber int, blockHash, vice string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vat_vice (block_number, block_hash, vice) VALUES ($1, $2, $3)`, blockNumber, blockHash, vice) - return err -} - -func getGuy(keys map[shared.Key]string) (string, error) { - guy, ok := keys[shared.Guy] - if !ok { - return "", shared.ErrMetadataMalformed{MissingData: shared.Guy} - } - return guy, nil -} - -func getIlk(keys map[shared.Key]string) (string, error) { - ilk, ok := keys[shared.Ilk] - if !ok { - return "", shared.ErrMetadataMalformed{MissingData: shared.Ilk} - } - return ilk, nil -} diff --git a/pkg/transformers/storage_diffs/maker/vat/repository_test.go b/pkg/transformers/storage_diffs/maker/vat/repository_test.go deleted file mode 100644 index 9553f26d..00000000 --- a/pkg/transformers/storage_diffs/maker/vat/repository_test.go +++ /dev/null @@ -1,311 +0,0 @@ -package vat_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - . "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/test_helpers" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vat" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" - "github.com/vulcanize/vulcanizedb/test_config" - "strconv" -) - -var _ = Describe("Vat storage repository", func() { - var ( - db *postgres.DB - repo vat.VatStorageRepository - fakeBlockNumber = 123 - fakeBlockHash = "expected_block_hash" - fakeIlk = "fake_ilk" - fakeGuy = "fake_urn" - fakeUint256 = "12345" - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repo = vat.VatStorageRepository{} - repo.SetDB(db) - }) - - Describe("dai", func() { - It("writes a row", func() { - daiMetadata := shared.GetStorageValueMetadata(vat.Dai, map[shared.Key]string{shared.Guy: fakeGuy}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, daiMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result MappingRes - err = db.Get(&result, `SELECT block_number, block_hash, guy AS key, dai AS value FROM maker.vat_dai`) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, fakeGuy, fakeUint256) - }) - - It("returns error if metadata missing guy", func() { - malformedDaiMetadata := shared.GetStorageValueMetadata(vat.Dai, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedDaiMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Guy})) - }) - }) - - Describe("gem", func() { - It("writes row", func() { - gemMetadata := shared.GetStorageValueMetadata(vat.Gem, map[shared.Key]string{shared.Ilk: fakeIlk, shared.Guy: fakeGuy}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, gemMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result DoubleMappingRes - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key_one, guy AS key_two, gem AS value FROM maker.vat_gem`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertDoubleMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeGuy, fakeUint256) - }) - - It("returns error if metadata missing ilk", func() { - malformedGemMetadata := shared.GetStorageValueMetadata(vat.Gem, map[shared.Key]string{shared.Guy: fakeGuy}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedGemMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - - It("returns error if metadata missing guy", func() { - malformedGemMetadata := shared.GetStorageValueMetadata(vat.Gem, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedGemMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Guy})) - }) - }) - - Describe("ilk Art", func() { - It("writes row", func() { - ilkArtMetadata := shared.GetStorageValueMetadata(vat.IlkArt, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, ilkArtMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result MappingRes - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key, art AS value FROM maker.vat_ilk_art`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeUint256) - }) - - It("returns error if metadata missing ilk", func() { - malformedIlkArtMetadata := shared.GetStorageValueMetadata(vat.IlkArt, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedIlkArtMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - }) - - Describe("ilk Ink", func() { - It("writes row", func() { - ilkInkMetadata := shared.GetStorageValueMetadata(vat.IlkInk, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, ilkInkMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result MappingRes - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key, ink AS value FROM maker.vat_ilk_ink`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeUint256) - }) - - It("returns error if metadata missing ilk", func() { - malformedIlkInkMetadata := shared.GetStorageValueMetadata(vat.IlkInk, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedIlkInkMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - }) - - Describe("ilk rate", func() { - It("writes row", func() { - ilkRateMetadata := shared.GetStorageValueMetadata(vat.IlkRate, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, ilkRateMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result MappingRes - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key, rate AS value FROM maker.vat_ilk_rate`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeUint256) - }) - - It("returns error if metadata missing ilk", func() { - malformedIlkRateMetadata := shared.GetStorageValueMetadata(vat.IlkRate, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedIlkRateMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - }) - - Describe("ilk take", func() { - It("writes row", func() { - ilkTakeMetadata := shared.GetStorageValueMetadata(vat.IlkTake, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, ilkTakeMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result MappingRes - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key, take AS value FROM maker.vat_ilk_take`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeUint256) - }) - - It("returns error if metadata missing ilk", func() { - malformedIlkTakeMetadata := shared.GetStorageValueMetadata(vat.IlkTake, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedIlkTakeMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - }) - - Describe("sin", func() { - It("writes a row", func() { - sinMetadata := shared.GetStorageValueMetadata(vat.Sin, map[shared.Key]string{shared.Guy: fakeGuy}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, sinMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result MappingRes - err = db.Get(&result, `SELECT block_number, block_hash, guy AS key, sin AS value FROM maker.vat_sin`) - Expect(err).NotTo(HaveOccurred()) - AssertMapping(result, fakeBlockNumber, fakeBlockHash, fakeGuy, fakeUint256) - }) - - It("returns error if metadata missing guy", func() { - malformedSinMetadata := shared.GetStorageValueMetadata(vat.Sin, nil, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedSinMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Guy})) - }) - }) - - Describe("urn art", func() { - It("writes row", func() { - urnArtMetadata := shared.GetStorageValueMetadata(vat.UrnArt, map[shared.Key]string{shared.Ilk: fakeIlk, shared.Guy: fakeGuy}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, urnArtMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result DoubleMappingRes - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key_one, urn AS key_two, art AS value FROM maker.vat_urn_art`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertDoubleMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeGuy, fakeUint256) - }) - - It("returns error if metadata missing ilk", func() { - malformedUrnArtMetadata := shared.GetStorageValueMetadata(vat.UrnArt, map[shared.Key]string{shared.Guy: fakeGuy}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedUrnArtMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - - It("returns error if metadata missing guy", func() { - malformedUrnArtMetadata := shared.GetStorageValueMetadata(vat.UrnArt, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedUrnArtMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Guy})) - }) - }) - - Describe("urn ink", func() { - It("writes row", func() { - urnInkMetadata := shared.GetStorageValueMetadata(vat.UrnInk, map[shared.Key]string{shared.Ilk: fakeIlk, shared.Guy: fakeGuy}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, urnInkMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result DoubleMappingRes - err = db.Get(&result, `SELECT block_number, block_hash, ilk AS key_one, urn AS key_two, ink AS value FROM maker.vat_urn_ink`) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared2.GetOrCreateIlk(fakeIlk, db) - Expect(err).NotTo(HaveOccurred()) - AssertDoubleMapping(result, fakeBlockNumber, fakeBlockHash, strconv.Itoa(ilkID), fakeGuy, fakeUint256) - }) - - It("returns error if metadata missing ilk", func() { - malformedUrnInkMetadata := shared.GetStorageValueMetadata(vat.UrnInk, map[shared.Key]string{shared.Guy: fakeGuy}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedUrnInkMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Ilk})) - }) - - It("returns error if metadata missing guy", func() { - malformedUrnInkMetadata := shared.GetStorageValueMetadata(vat.UrnInk, map[shared.Key]string{shared.Ilk: fakeIlk}, shared.Uint256) - - err := repo.Create(fakeBlockNumber, fakeBlockHash, malformedUrnInkMetadata, fakeUint256) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrMetadataMalformed{MissingData: shared.Guy})) - }) - }) - - It("persists vat debt", func() { - err := repo.Create(fakeBlockNumber, fakeBlockHash, vat.DebtMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, debt AS value FROM maker.vat_debt`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeUint256) - }) - - It("persists vat vice", func() { - err := repo.Create(fakeBlockNumber, fakeBlockHash, vat.ViceMetadata, fakeUint256) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, vice AS value FROM maker.vat_vice`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, fakeBlockNumber, fakeBlockHash, fakeUint256) - }) -}) diff --git a/pkg/transformers/storage_diffs/maker/vat/vat_suite_test.go b/pkg/transformers/storage_diffs/maker/vat/vat_suite_test.go deleted file mode 100644 index d385774e..00000000 --- a/pkg/transformers/storage_diffs/maker/vat/vat_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package vat_test - -import ( - "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestVat(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Vat Suite") -} - -var _ = BeforeSuite(func() { - logrus.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/storage_diffs/maker/vow/mappings.go b/pkg/transformers/storage_diffs/maker/vow/mappings.go deleted file mode 100644 index 8f9a7d26..00000000 --- a/pkg/transformers/storage_diffs/maker/vow/mappings.go +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2018 Vulcanize - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package vow - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -const ( - VowVat = "vat" - VowCow = "cow" - VowRow = "row" - VowSin = "Sin" - VowWoe = "Woe" - VowAsh = "Ash" - VowWait = "wait" - VowSump = "sump" - VowBump = "bump" - VowHump = "hump" -) - -var ( - VatKey = common.HexToHash(storage_diffs.IndexOne) - VatMetadata = shared.StorageValueMetadata{ - Name: VowVat, - Keys: nil, - Type: shared.Address, - } - - CowKey = common.HexToHash(storage_diffs.IndexTwo) - CowMetadata = shared.StorageValueMetadata{ - Name: VowCow, - Keys: nil, - Type: shared.Address, - } - - RowKey = common.HexToHash(storage_diffs.IndexThree) - RowMetadata = shared.StorageValueMetadata{ - Name: VowRow, - Keys: nil, - Type: shared.Address, - } - - SinKey = common.HexToHash(storage_diffs.IndexFive) - SinMetadata = shared.StorageValueMetadata{ - Name: VowSin, - Keys: nil, - Type: shared.Uint256, - } - - WoeKey = common.HexToHash(storage_diffs.IndexSix) - WoeMetadata = shared.StorageValueMetadata{ - Name: VowWoe, - Keys: nil, - Type: shared.Uint256, - } - - AshKey = common.HexToHash(storage_diffs.IndexSeven) - AshMetadata = shared.StorageValueMetadata{ - Name: VowAsh, - Keys: nil, - Type: shared.Uint256, - } - - WaitKey = common.HexToHash(storage_diffs.IndexEight) - WaitMetadata = shared.StorageValueMetadata{ - Name: VowWait, - Keys: nil, - Type: shared.Uint256, - } - - SumpKey = common.HexToHash(storage_diffs.IndexNine) - SumpMetadata = shared.StorageValueMetadata{ - Name: VowSump, - Keys: nil, - Type: shared.Uint256, - } - - BumpKey = common.HexToHash(storage_diffs.IndexTen) - BumpMetadata = shared.StorageValueMetadata{ - Name: VowBump, - Keys: nil, - Type: shared.Uint256, - } - - HumpKey = common.HexToHash(storage_diffs.IndexEleven) - HumpMetadata = shared.StorageValueMetadata{ - Name: VowHump, - Keys: nil, - Type: shared.Uint256, - } -) - -type VowMappings struct { - StorageRepository maker.IMakerStorageRepository - mappings map[common.Hash]shared.StorageValueMetadata -} - -func (mappings *VowMappings) Lookup(key common.Hash) (shared.StorageValueMetadata, error) { - metadata, ok := mappings.mappings[key] - if !ok { - err := mappings.loadMappings() - if err != nil { - return metadata, err - } - metadata, ok = mappings.mappings[key] - if !ok { - return metadata, shared.ErrStorageKeyNotFound{Key: key.Hex()} - } - } - return metadata, nil -} - -func (mappings *VowMappings) loadMappings() error { - staticMappings := make(map[common.Hash]shared.StorageValueMetadata) - staticMappings[VatKey] = VatMetadata - staticMappings[CowKey] = CowMetadata - staticMappings[RowKey] = RowMetadata - staticMappings[SinKey] = SinMetadata - staticMappings[WoeKey] = WoeMetadata - staticMappings[AshKey] = AshMetadata - staticMappings[WaitKey] = WaitMetadata - staticMappings[SumpKey] = SumpMetadata - staticMappings[BumpKey] = BumpMetadata - staticMappings[HumpKey] = HumpMetadata - - mappings.mappings = staticMappings - - return nil -} - -func (mappings *VowMappings) SetDB(db *postgres.DB) { - mappings.StorageRepository.SetDB(db) -} diff --git a/pkg/transformers/storage_diffs/maker/vow/mappings_test.go b/pkg/transformers/storage_diffs/maker/vow/mappings_test.go deleted file mode 100644 index 44c7970f..00000000 --- a/pkg/transformers/storage_diffs/maker/vow/mappings_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package vow_test - -import ( - "github.com/ethereum/go-ethereum/common" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/test_helpers" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vow" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -var _ = Describe("Vow storage mappings", func() { - Describe("looking up static keys", func() { - It("returns value metadata if key exists", func() { - storageRepository := &test_helpers.MockMakerStorageRepository{} - - mappings := vow.VowMappings{StorageRepository: storageRepository} - - Expect(mappings.Lookup(vow.VatKey)).To(Equal(vow.VatMetadata)) - Expect(mappings.Lookup(vow.CowKey)).To(Equal(vow.CowMetadata)) - Expect(mappings.Lookup(vow.RowKey)).To(Equal(vow.RowMetadata)) - Expect(mappings.Lookup(vow.SinKey)).To(Equal(vow.SinMetadata)) - Expect(mappings.Lookup(vow.WoeKey)).To(Equal(vow.WoeMetadata)) - Expect(mappings.Lookup(vow.AshKey)).To(Equal(vow.AshMetadata)) - Expect(mappings.Lookup(vow.WaitKey)).To(Equal(vow.WaitMetadata)) - Expect(mappings.Lookup(vow.SumpKey)).To(Equal(vow.SumpMetadata)) - Expect(mappings.Lookup(vow.BumpKey)).To(Equal(vow.BumpMetadata)) - Expect(mappings.Lookup(vow.HumpKey)).To(Equal(vow.HumpMetadata)) - }) - - It("returns error if key does not exist", func() { - storageRepository := &test_helpers.MockMakerStorageRepository{} - - mappings := vow.VowMappings{StorageRepository: storageRepository} - _, err := mappings.Lookup(common.HexToHash(fakes.FakeHash.Hex())) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(shared.ErrStorageKeyNotFound{Key: fakes.FakeHash.Hex()})) - }) - }) -}) diff --git a/pkg/transformers/storage_diffs/maker/vow/repository.go b/pkg/transformers/storage_diffs/maker/vow/repository.go deleted file mode 100644 index 0a655d9a..00000000 --- a/pkg/transformers/storage_diffs/maker/vow/repository.go +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2018 Vulcanize - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package vow - -import ( - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type VowStorageRepository struct { - db *postgres.DB -} - -func (repository *VowStorageRepository) SetDB(db *postgres.DB) { - repository.db = db -} - -func (repository VowStorageRepository) Create(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, value interface{}) error { - switch metadata.Name { - case VowVat: - return repository.insertVowVat(blockNumber, blockHash, value.(string)) - case VowCow: - return repository.insertVowCow(blockNumber, blockHash, value.(string)) - case VowRow: - return repository.insertVowRow(blockNumber, blockHash, value.(string)) - case VowSin: - return repository.insertVowSin(blockNumber, blockHash, value.(string)) - case VowWoe: - return repository.insertVowWoe(blockNumber, blockHash, value.(string)) - case VowAsh: - return repository.insertVowAsh(blockNumber, blockHash, value.(string)) - case VowWait: - return repository.insertVowWait(blockNumber, blockHash, value.(string)) - case VowSump: - return repository.insertVowSump(blockNumber, blockHash, value.(string)) - case VowBump: - return repository.insertVowBump(blockNumber, blockHash, value.(string)) - case VowHump: - return repository.insertVowHump(blockNumber, blockHash, value.(string)) - default: - panic("unrecognized storage metadata name") - } -} - -func (repository VowStorageRepository) insertVowVat(blockNumber int, blockHash string, vat string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_vat (block_number, block_hash, vat) VALUES ($1, $2, $3)`, blockNumber, blockHash, vat) - - return err -} - -func (repository VowStorageRepository) insertVowCow(blockNumber int, blockHash string, cow string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_cow (block_number, block_hash, cow) VALUES ($1, $2, $3)`, blockNumber, blockHash, cow) - - return err -} - -func (repository VowStorageRepository) insertVowRow(blockNumber int, blockHash string, row string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_row (block_number, block_hash, row) VALUES ($1, $2, $3)`, blockNumber, blockHash, row) - - return err -} - -func (repository VowStorageRepository) insertVowSin(blockNumber int, blockHash string, sin string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_sin (block_number, block_hash, sin) VALUES ($1, $2, $3)`, blockNumber, blockHash, sin) - - return err -} - -func (repository VowStorageRepository) insertVowWoe(blockNumber int, blockHash string, woe string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_woe (block_number, block_hash, woe) VALUES ($1, $2, $3)`, blockNumber, blockHash, woe) - - return err -} - -func (repository VowStorageRepository) insertVowAsh(blockNumber int, blockHash string, ash string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_ash (block_number, block_hash, ash) VALUES ($1, $2, $3)`, blockNumber, blockHash, ash) - - return err -} - -func (repository VowStorageRepository) insertVowWait(blockNumber int, blockHash string, wait string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_wait (block_number, block_hash, wait) VALUES ($1, $2, $3)`, blockNumber, blockHash, wait) - - return err -} - -func (repository VowStorageRepository) insertVowSump(blockNumber int, blockHash string, sump string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_sump (block_number, block_hash, sump) VALUES ($1, $2, $3)`, blockNumber, blockHash, sump) - - return err -} - -func (repository VowStorageRepository) insertVowBump(blockNumber int, blockHash string, bump string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_bump (block_number, block_hash, bump) VALUES ($1, $2, $3)`, blockNumber, blockHash, bump) - - return err -} - -func (repository VowStorageRepository) insertVowHump(blockNumber int, blockHash string, hump string) error { - _, err := repository.db.Exec(`INSERT INTO maker.vow_hump (block_number, block_hash, hump) VALUES ($1, $2, $3)`, blockNumber, blockHash, hump) - - return err -} diff --git a/pkg/transformers/storage_diffs/maker/vow/repository_test.go b/pkg/transformers/storage_diffs/maker/vow/repository_test.go deleted file mode 100644 index eb116342..00000000 --- a/pkg/transformers/storage_diffs/maker/vow/repository_test.go +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 2018 Vulcanize - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package vow_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/test_helpers" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vow" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vow storage repository test", func() { - var ( - blockNumber int - blockHash string - db *postgres.DB - err error - repo vow.VowStorageRepository - ) - - BeforeEach(func() { - blockNumber = 123 - blockHash = "expected_block_hash" - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repo = vow.VowStorageRepository{} - repo.SetDB(db) - }) - - It("persists a vow vat", func() { - expectedVat := "123" - - err = repo.Create(blockNumber, blockHash, vow.VatMetadata, expectedVat) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, vat AS value from maker.vow_vat`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedVat) - }) - - It("persists a vow cow", func() { - expectedCow := "123" - - err = repo.Create(blockNumber, blockHash, vow.CowMetadata, expectedCow) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, cow AS value from maker.vow_cow`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedCow) - }) - - It("persists a vow row", func() { - expectedRow := "123" - - err = repo.Create(blockNumber, blockHash, vow.RowMetadata, expectedRow) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, row AS value from maker.vow_row`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedRow) - }) - - It("persists a vow Sin", func() { - expectedSow := "123" - - err = repo.Create(blockNumber, blockHash, vow.SinMetadata, expectedSow) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, sin AS value from maker.vow_sin`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedSow) - }) - - It("persists a vow woe", func() { - expectedWoe := "123" - - err = repo.Create(blockNumber, blockHash, vow.WoeMetadata, expectedWoe) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, woe AS value from maker.vow_woe`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedWoe) - }) - - It("persists a vow Ash", func() { - expectedAsh := "123" - - err = repo.Create(blockNumber, blockHash, vow.AshMetadata, expectedAsh) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, ash AS value from maker.vow_ash`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedAsh) - }) - - It("persists a vow Wait", func() { - expectedWait := "123" - - err = repo.Create(blockNumber, blockHash, vow.WaitMetadata, expectedWait) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, wait AS value from maker.vow_wait`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedWait) - }) - - It("persists a vow Bump", func() { - expectedBump := "123" - - err = repo.Create(blockNumber, blockHash, vow.BumpMetadata, expectedBump) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, bump AS value from maker.vow_bump`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedBump) - }) - - It("persists a vow Sump", func() { - expectedSump := "123" - - err = repo.Create(blockNumber, blockHash, vow.SumpMetadata, expectedSump) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, sump AS value from maker.vow_sump`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedSump) - }) - - It("persists a vow Hump", func() { - expectedHump := "123" - - err = repo.Create(blockNumber, blockHash, vow.HumpMetadata, expectedHump) - - Expect(err).NotTo(HaveOccurred()) - - var result VariableRes - err = db.Get(&result, `SELECT block_number, block_hash, hump AS value from maker.vow_hump`) - Expect(err).NotTo(HaveOccurred()) - AssertVariable(result, blockNumber, blockHash, expectedHump) - }) -}) diff --git a/pkg/transformers/storage_diffs/maker/vow/vow_suite_test.go b/pkg/transformers/storage_diffs/maker/vow/vow_suite_test.go deleted file mode 100644 index d5f42d1e..00000000 --- a/pkg/transformers/storage_diffs/maker/vow/vow_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package vow_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestVow(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Storage Diff Vow Suite") -} diff --git a/pkg/transformers/storage_transformers.go b/pkg/transformers/storage_transformers.go deleted file mode 100644 index 48e2771b..00000000 --- a/pkg/transformers/storage_transformers.go +++ /dev/null @@ -1,44 +0,0 @@ -package transformers - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories/storage" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/cat" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/pit" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vat" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vow" -) - -func GetCatStorageTransformer() storage.Transformer { - return storage.Transformer{ - Address: common.HexToAddress(constants.CatContractAddress()), - Mappings: &cat.CatMappings{StorageRepository: &maker.MakerStorageRepository{}}, - Repository: &cat.CatStorageRepository{}, - } -} - -func GetPitStorageTransformer() storage.Transformer { - return storage.Transformer{ - Address: common.HexToAddress(constants.PitContractAddress()), - Mappings: &pit.PitMappings{StorageRepository: &maker.MakerStorageRepository{}}, - Repository: &pit.PitStorageRepository{}, - } -} - -func GetVatStorageTransformer() storage.Transformer { - return storage.Transformer{ - Address: common.HexToAddress(constants.VatContractAddress()), - Mappings: &vat.VatMappings{StorageRepository: &maker.MakerStorageRepository{}}, - Repository: &vat.VatStorageRepository{}, - } -} - -func GetVowStorageTransformer() storage.Transformer { - return storage.Transformer{ - Address: common.HexToAddress(constants.VowContractAddress()), - Mappings: &vow.VowMappings{StorageRepository: &maker.MakerStorageRepository{}}, - Repository: &vow.VowStorageRepository{}, - } -} diff --git a/pkg/transformers/tend/config.go b/pkg/transformers/tend/config.go deleted file mode 100644 index 8013e97d..00000000 --- a/pkg/transformers/tend/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package tend - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetTendConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.TendLabel, - ContractAddresses: []string{constants.FlapperContractAddress(), constants.FlipperContractAddress()}, - ContractAbi: constants.FlipperABI(), - Topic: constants.GetTendFunctionSignature(), - StartingBlockNumber: shared.MinInt64([]int64{constants.FlapperDeploymentBlock(), constants.FlipperDeploymentBlock()}), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/tend/converter.go b/pkg/transformers/tend/converter.go deleted file mode 100644 index 3f8602ce..00000000 --- a/pkg/transformers/tend/converter.go +++ /dev/null @@ -1,77 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package tend - -import ( - "encoding/json" - "errors" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "math/big" - - "github.com/ethereum/go-ethereum/core/types" -) - -type TendConverter struct{} - -func (TendConverter) ToModels(ethLogs []types.Log) (results []interface{}, err error) { - for _, ethLog := range ethLogs { - err := validateLog(ethLog) - if err != nil { - return nil, err - } - - bidId := ethLog.Topics[2].Big() - guy := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - lot := ethLog.Topics[3].Big().String() - - lastDataItemStartIndex := len(ethLog.Data) - 32 - lastItem := ethLog.Data[lastDataItemStartIndex:] - last := big.NewInt(0).SetBytes(lastItem) - bidValue := last.String() - transactionIndex := ethLog.TxIndex - logIndex := ethLog.Index - - rawLog, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - - model := TendModel{ - BidId: bidId.String(), - Lot: lot, - Bid: bidValue, - Guy: guy, - LogIndex: logIndex, - TransactionIndex: transactionIndex, - Raw: rawLog, - } - results = append(results, model) - } - return results, err -} - -func validateLog(ethLog types.Log) error { - if len(ethLog.Data) <= 0 { - return errors.New("tend log note data is empty") - } - - if len(ethLog.Topics) < 4 { - return errors.New("tend log does not contain expected topics") - } - - return nil -} diff --git a/pkg/transformers/tend/converter_test.go b/pkg/transformers/tend/converter_test.go deleted file mode 100644 index 2ede2f08..00000000 --- a/pkg/transformers/tend/converter_test.go +++ /dev/null @@ -1,62 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package tend_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/tend" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Tend TendConverter", func() { - var converter tend.TendConverter - - BeforeEach(func() { - converter = tend.TendConverter{} - }) - - Describe("ToModels", func() { - It("converts an eth log to a db model", func() { - models, err := converter.ToModels([]types.Log{test_data.TendLogNote}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.TendModel)) - }) - - It("returns an error if the log data is empty", func() { - emptyDataLog := test_data.TendLogNote - emptyDataLog.Data = []byte{} - _, err := converter.ToModels([]types.Log{emptyDataLog}) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError("tend log note data is empty")) - }) - - It("returns an error if the expected amount of topics aren't in the log", func() { - invalidLog := test_data.TendLogNote - invalidLog.Topics = []common.Hash{} - _, err := converter.ToModels([]types.Log{invalidLog}) - - Expect(err).To(MatchError("tend log does not contain expected topics")) - }) - }) -}) diff --git a/pkg/transformers/tend/model.go b/pkg/transformers/tend/model.go deleted file mode 100644 index 4c08ba11..00000000 --- a/pkg/transformers/tend/model.go +++ /dev/null @@ -1,27 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package tend - -type TendModel struct { - BidId string `db:"bid_id"` - Lot string - Bid string - Guy string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/tend/repository.go b/pkg/transformers/tend/repository.go deleted file mode 100644 index 89e3f08e..00000000 --- a/pkg/transformers/tend/repository.go +++ /dev/null @@ -1,100 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package tend - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type TendRepository struct { - db *postgres.DB -} - -func (repository TendRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - tic, getTicErr := shared.GetTicInTx(headerID, tx) - if getTicErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return getTicErr - } - - for _, model := range models { - tend, ok := model.(TendModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, TendModel{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.tend (header_id, bid_id, lot, bid, guy, tic, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3::NUMERIC, $4::NUMERIC, $5, $6, $7, $8, $9) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET bid_id = $2, lot = $3, bid = $4, guy = $5, tic = $6, raw_log = $9;`, - headerID, tend.BidId, tend.Lot, tend.Bid, tend.Guy, tic, tend.LogIndex, tend.TransactionIndex, tend.Raw, - ) - - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.TendChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository TendRepository) MarkHeaderChecked(headerId int64) error { - return shared.MarkHeaderChecked(headerId, repository.db, constants.TendChecked) -} - -func (repository TendRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.TendChecked) -} - -func (repository TendRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.TendChecked) -} - -func (repository *TendRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/tend/repository_test.go b/pkg/transformers/tend/repository_test.go deleted file mode 100644 index e8d3da73..00000000 --- a/pkg/transformers/tend/repository_test.go +++ /dev/null @@ -1,99 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package tend_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/tend" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("TendRepository", func() { - var ( - db *postgres.DB - tendRepository tend.TendRepository - headerRepository repositories.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - headerRepository = repositories.NewHeaderRepository(db) - tendRepository = tend.TendRepository{} - tendRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.TendModel - modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1 - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.TendChecked, - LogEventTableName: "maker.tend", - TestModel: test_data.TendModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &tendRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists a tend record", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = tendRepository.Create(headerID, []interface{}{test_data.TendModel}) - - Expect(err).NotTo(HaveOccurred()) - var count int - err = db.QueryRow(`SELECT count(*) from maker.tend`).Scan(&count) - Expect(err).NotTo(HaveOccurred()) - Expect(count).To(Equal(1)) - - dbResult := tend.TendModel{} - err = db.Get(&dbResult, `SELECT bid_id, lot, bid, guy, log_idx, tx_idx, raw_log FROM maker.tend WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - Expect(dbResult.BidId).To(Equal(test_data.TendModel.BidId)) - Expect(dbResult.Lot).To(Equal(test_data.TendModel.Lot)) - Expect(dbResult.Bid).To(Equal(test_data.TendModel.Bid)) - Expect(dbResult.Guy).To(Equal(test_data.TendModel.Guy)) - Expect(dbResult.LogIndex).To(Equal(test_data.TendModel.LogIndex)) - Expect(dbResult.TransactionIndex).To(Equal(test_data.TendModel.TransactionIndex)) - Expect(dbResult.Raw).To(MatchJSON(test_data.TendModel.Raw)) - - var dbTic int64 - err = db.Get(&dbTic, `SELECT tic FROM maker.tend WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbTic).To(Equal(fakes.FakeHeaderTic)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.TendChecked, - Repository: &tendRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/tend/tend_suite_test.go b/pkg/transformers/tend/tend_suite_test.go deleted file mode 100644 index 828d2d10..00000000 --- a/pkg/transformers/tend/tend_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package tend_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestTend(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Tend Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/test_data/abi.go b/pkg/transformers/test_data/abi.go deleted file mode 100644 index 5bc04c28..00000000 --- a/pkg/transformers/test_data/abi.go +++ /dev/null @@ -1,14 +0,0 @@ -package test_data - -const ( - KovanCatABI = `[{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x36569e77"},{"constant":true,"inputs":[],"name":"vow","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x626cb3c5"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"flips","outputs":[{"name":"ilk","type":"bytes32"},{"name":"urn","type":"bytes32"},{"name":"ink","type":"uint256"},{"name":"tab","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x70d9235a"},{"constant":true,"inputs":[],"name":"nflip","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x76181a51"},{"constant":true,"inputs":[],"name":"live","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x957aa58c"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"flip","type":"address"},{"name":"chop","type":"uint256"},{"name":"lump","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"constant":true,"inputs":[],"name":"pit","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xf03c7c6e"},{"inputs":[{"name":"vat_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"ilk","type":"bytes32"},{"indexed":true,"name":"urn","type":"bytes32"},{"indexed":false,"name":"ink","type":"uint256"},{"indexed":false,"name":"art","type":"uint256"},{"indexed":false,"name":"tab","type":"uint256"},{"indexed":false,"name":"flip","type":"uint256"},{"indexed":false,"name":"iArt","type":"uint256"}],"name":"Bite","type":"event","signature":"0x99b5620489b6ef926d4518936cfec15d305452712b88bd59da2d9c10fb0953e8"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event","signature":"0x644843f351d3fba4abcd60109eaff9f54bac8fb8ccf0bab941009c21df21cf31"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x1a0b287e"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"address"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xd4e8be83"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"what","type":"bytes32"},{"name":"flip","type":"address"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xebecb39d"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"urn","type":"bytes32"}],"name":"bite","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x72f7b593"},{"constant":false,"inputs":[{"name":"n","type":"uint256"},{"name":"wad","type":"uint256"}],"name":"flip","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xe6f95917"}]` - KovanDripABI = `[{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x36569e77"},{"constant":true,"inputs":[],"name":"repo","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x56ff3122"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"vow","type":"bytes32"},{"name":"tax","type":"uint256"},{"name":"rho","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"inputs":[{"name":"vat_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event","signature":"0x644843f351d3fba4abcd60109eaff9f54bac8fb8ccf0bab941009c21df21cf31"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":true,"inputs":[],"name":"era","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x143e55e0"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"vow","type":"bytes32"},{"name":"tax","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x1a0b287e"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x29ae8114"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"}],"name":"drip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x44e2a5a8"}]` - KovanFlapperABI = `[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"bids","outputs":[{"name":"bid","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"guy","type":"address"},{"name":"tic","type":"uint48"},{"name":"end","type":"uint48"},{"name":"gal","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ttl","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gem","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"beg","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tau","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kicks","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dai","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"dai_","type":"address"},{"name":"gem_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"lot","type":"uint256"},{"indexed":false,"name":"bid","type":"uint256"},{"indexed":false,"name":"gal","type":"address"},{"indexed":false,"name":"end","type":"uint48"}],"name":"Kick","type":"event"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"},{"constant":false,"inputs":[{"name":"gal","type":"address"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"kick","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"tend","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"deal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]` - KovanFlipperABI = `[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"bids","outputs":[{"name":"bid","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"guy","type":"address"},{"name":"tic","type":"uint48"},{"name":"end","type":"uint48"},{"name":"urn","type":"bytes32"},{"name":"gal","type":"address"},{"name":"tab","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x4423c5f1"},{"constant":true,"inputs":[],"name":"ttl","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x4e8b1dd5"},{"constant":true,"inputs":[],"name":"gem","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x7bd2bea7"},{"constant":true,"inputs":[],"name":"beg","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x7d780d82"},{"constant":true,"inputs":[],"name":"tau","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xcfc4af55"},{"constant":true,"inputs":[],"name":"kicks","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xcfdd3302"},{"constant":true,"inputs":[],"name":"dai","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xf4b9fa75"},{"inputs":[{"name":"dai_","type":"address"},{"name":"gem_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"lot","type":"uint256"},{"indexed":false,"name":"bid","type":"uint256"},{"indexed":false,"name":"gal","type":"address"},{"indexed":false,"name":"end","type":"uint48"},{"indexed":true,"name":"urn","type":"bytes32"},{"indexed":false,"name":"tab","type":"uint256"}],"name":"Kick","type":"event","signature":"0xbac86238bdba81d21995024470425ecb370078fa62b7271b90cf28cbd1e3e87e"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event","signature":"0x644843f351d3fba4abcd60109eaff9f54bac8fb8ccf0bab941009c21df21cf31"},{"constant":true,"inputs":[],"name":"era","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x143e55e0"},{"constant":false,"inputs":[{"name":"urn","type":"bytes32"},{"name":"gal","type":"address"},{"name":"tab","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"kick","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xeae19d9e"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"tick","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xfc7b6aee"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"tend","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x4b43ed12"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"dent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5ff3a382"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"deal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xc959c42b"}]` - KovanFlopperABI = `[{"constant":true,"inputs":[],"name":"era","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"bids","outputs":[{"name":"bid","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"guy","type":"address"},{"name":"tic","type":"uint48"},{"name":"end","type":"uint48"},{"name":"vow","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ttl","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"dent","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"gem","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"beg","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"gal","type":"address"},{"name":"lot","type":"uint256"},{"name":"bid","type":"uint256"}],"name":"kick","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"deal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tau","outputs":[{"name":"","type":"uint48"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kicks","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"dai","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"dai_","type":"address"},{"name":"gem_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"lot","type":"uint256"},{"indexed":false,"name":"bid","type":"uint256"},{"indexed":false,"name":"gal","type":"address"},{"indexed":false,"name":"end","type":"uint48"}],"name":"Kick","type":"event"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"}]` - KovanMedianizerABI = `[{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"","type":"bytes32"}],"name":"poke","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"poke","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"compute","outputs":[{"name":"","type":"bytes32"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"wat","type":"address"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"wat","type":"address"}],"name":"unset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"indexes","outputs":[{"name":"","type":"bytes12"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"next","outputs":[{"name":"","type":"bytes12"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"read","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"peek","outputs":[{"name":"","type":"bytes32"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes12"}],"name":"values","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"min_","type":"uint96"}],"name":"setMin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"void","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"pos","type":"bytes12"},{"name":"wat","type":"address"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"pos","type":"bytes12"}],"name":"unset","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"next_","type":"bytes12"}],"name":"setNext","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"min","outputs":[{"name":"","type":"uint96"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"val","type":"bytes32"}],"name":"LogValue","type":"event"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}]]` - // TODO: replace with updated ABI when contract is deployed (with no pit file stability fee method + modified Frob event) - KovanPitABI = `[{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x36569e77"},{"constant":true,"inputs":[],"name":"live","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x957aa58c"},{"constant":true,"inputs":[],"name":"drip","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x9f678cca"},{"constant":true,"inputs":[],"name":"Line","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbabe8a3f"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"spot","type":"uint256"},{"name":"line","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"inputs":[{"name":"vat_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"ilk","type":"bytes32"},{"indexed":true,"name":"urn","type":"bytes32"},{"indexed":false,"name":"ink","type":"uint256"},{"indexed":false,"name":"art","type":"uint256"},{"indexed":false,"name":"dink","type":"int256"},{"indexed":false,"name":"dart","type":"int256"},{"indexed":false,"name":"iArt","type":"uint256"}],"name":"Frob","type":"event","signature":"0xb2afa28318bcc689926b52835d844de174ef8de97e982a85c0199d584920791b"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event","signature":"0x644843f351d3fba4abcd60109eaff9f54bac8fb8ccf0bab941009c21df21cf31"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x1a0b287e"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x29ae8114"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"address"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xd4e8be83"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"dink","type":"int256"},{"name":"dart","type":"int256"}],"name":"frob","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5a984ded"}]` - KovanVatABI = `[{"constant":true,"inputs":[],"name":"debt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x0dca59c1"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"bytes32"}],"name":"urns","outputs":[{"name":"ink","type":"uint256"},{"name":"art","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x26e27482"},{"constant":true,"inputs":[],"name":"vice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x2d61a355"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"sin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xa60f1d3e"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"bytes32"}],"name":"gem","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xc0912683"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"take","type":"uint256"},{"name":"rate","type":"uint256"},{"name":"Ink","type":"uint256"},{"name":"Art","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"dai","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xf53e4e69"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":true,"name":"too","type":"bytes32"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"Note","type":"event","signature":"0x8c2dbbc2b33ffaa77c104b777e574a8a4ff79829dfee8b66f4dc63e3f8067152"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"}],"name":"init","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x3b663195"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"guy","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"slip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x42066cbb"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"src","type":"bytes32"},{"name":"dst","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"flux","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xa6e41821"},{"constant":false,"inputs":[{"name":"src","type":"bytes32"},{"name":"dst","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"move","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x78f19470"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"v","type":"bytes32"},{"name":"w","type":"bytes32"},{"name":"dink","type":"int256"},{"name":"dart","type":"int256"}],"name":"tune","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5dd6471a"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"v","type":"bytes32"},{"name":"w","type":"bytes32"},{"name":"dink","type":"int256"},{"name":"dart","type":"int256"}],"name":"grab","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x3690ae4c"},{"constant":false,"inputs":[{"name":"u","type":"bytes32"},{"name":"v","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"heal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x990a5f63"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"rate","type":"int256"}],"name":"fold","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xe6a6a64d"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"take","type":"int256"}],"name":"toll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x09b7a0b5"}]` - KovanVowABI = `[{"constant":true,"inputs":[],"name":"Awe","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"Joy","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"flap","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"hump","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"wad","type":"uint256"}],"name":"kiss","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"Ash","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"era","type":"uint48"}],"name":"flog","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"Woe","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"wait","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"bump","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"tab","type":"uint256"}],"name":"fess","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"row","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint48"}],"name":"sin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"flop","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"sump","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"Sin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"addr","type":"address"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"cow","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"wad","type":"uint256"}],"name":"heal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"}]` -) diff --git a/pkg/transformers/test_data/addresses.go b/pkg/transformers/test_data/addresses.go deleted file mode 100644 index 67c8e582..00000000 --- a/pkg/transformers/test_data/addresses.go +++ /dev/null @@ -1,15 +0,0 @@ -package test_data - -const ( - KovanCatContractAddress = "0x2f34f22a00ee4b7a8f8bbc4eaee1658774c624e0" - KovanDripContractAddress = "0x891c04639a5edcae088e546fa125b5d7fb6a2b9d" - KovanFlapperContractAddress = "0x8868BAd8e74FcA4505676D1B5B21EcC23328d132" - KovanFlipperContractAddress = "0x32D496Ad866D110060866B7125981C73642cc509" - KovanFlopperContractAddress = "0x6191C9b0086c2eBF92300cC507009b53996FbFFa" - KovanPepContractAddress = "0xB1997239Cfc3d15578A3a09730f7f84A90BB4975" - KovanPipContractAddress = "0x9FfFE440258B79c5d6604001674A4722FfC0f7Bc" - KovanPitContractAddress = "0xe7cf3198787c9a4daac73371a38f29aaeeced87e" - KovanRepContractAddress = "0xf88bBDc1E2718F8857F30A180076ec38d53cf296" - KovanVatContractAddress = "0xcd726790550afcd77e9a7a47e86a3f9010af126b" - KovanVowContractAddress = "0x3728e9777B2a0a611ee0F89e00E01044ce4736d1" -) diff --git a/pkg/transformers/test_data/bite.go b/pkg/transformers/test_data/bite.go deleted file mode 100644 index 7456684e..00000000 --- a/pkg/transformers/test_data/bite.go +++ /dev/null @@ -1,88 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/bite" - "math/big" -) - -const ( - TemporaryBiteBlockNumber = int64(26) - TemporaryBiteData = "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005" - TemporaryBiteTransaction = "0x5c698f13940a2153440c6d19660878bc90219d9298fdcf37365aa8d88d40fc42" -) - -var ( - biteInk = big.NewInt(1) - biteArt = big.NewInt(2) - biteTab = big.NewInt(3) - biteFlip = big.NewInt(4) - biteIArt = big.NewInt(5) - biteRawJson, _ = json.Marshal(EthBiteLog) - biteIlk = [32]byte{69, 84, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - biteLad = [32]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216, 180, 20, 126, 218, 128, 254, 199, 18, 42, 225, 109, 162, 71, 156, 189, 127, 251} - biteIlkString = "4554480000000000000000000000000000000000000000000000000000000000" - biteLadString = "0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb" -) - -var EthBiteLog = types.Log{ - Address: common.HexToAddress("0x2f34f22a00ee4b7a8f8bbc4eaee1658774c624e0"), - Topics: []common.Hash{ - common.HexToHash("0x99b5620489b6ef926d4518936cfec15d305452712b88bd59da2d9c10fb0953e8"), - common.HexToHash("0x4554480000000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"), - }, - Data: hexutil.MustDecode(TemporaryBiteData), - BlockNumber: uint64(TemporaryBiteBlockNumber), - TxHash: common.HexToHash(TemporaryBiteTransaction), - TxIndex: 111, - BlockHash: fakes.FakeHash, - Index: 7, - Removed: false, -} - -var BiteEntity = bite.BiteEntity{ - Ilk: biteIlk, - Urn: biteLad, - Ink: biteInk, - Art: biteArt, - Tab: biteTab, - Flip: biteFlip, - IArt: biteIArt, - LogIndex: EthBiteLog.Index, - TransactionIndex: EthBiteLog.TxIndex, - Raw: EthBiteLog, -} - -var BiteModel = bite.BiteModel{ - Ilk: biteIlkString, - Urn: biteLadString, - Ink: biteInk.String(), - Art: biteArt.String(), - IArt: biteIArt.String(), - Tab: biteTab.String(), - NFlip: biteFlip.String(), - LogIndex: EthBiteLog.Index, - TransactionIndex: EthBiteLog.TxIndex, - Raw: biteRawJson, -} diff --git a/pkg/transformers/test_data/cat_file.go b/pkg/transformers/test_data/cat_file.go deleted file mode 100644 index 180262a6..00000000 --- a/pkg/transformers/test_data/cat_file.go +++ /dev/null @@ -1,133 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/chop_lump" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/flip" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/pit_vow" -) - -var EthCatFileChopLog = types.Log{ - Address: common.HexToAddress(KovanCatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x1a0b287e00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x63686f7000000000000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000641a0b287e66616b6520696c6b00000000000000000000000000000000000000000000000063686f700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018EE90FF6C373E0EE4E3F0AD2"), - BlockNumber: 110, - TxHash: common.HexToHash("0xe32dfe6afd7ea28475569756fc30f0eea6ad4cfd32f67436ff1d1c805e4382df"), - TxIndex: 13, - BlockHash: fakes.FakeHash, - Index: 1, - Removed: false, -} -var rawCatFileChopLog, _ = json.Marshal(EthCatFileChopLog) -var CatFileChopModel = chop_lump.CatFileChopLumpModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - What: "chop", - Data: "123.456789012345680589533003513", - TransactionIndex: EthCatFileChopLog.TxIndex, - LogIndex: EthCatFileChopLog.Index, - Raw: rawCatFileChopLog, -} - -var EthCatFileLumpLog = types.Log{ - Address: common.HexToAddress(KovanCatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x1a0b287e00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x6c756d7000000000000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000641a0b287e66616b6520696c6b00000000000000000000000000000000000000000000000063686f700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029D42B64E76714244CB"), - BlockNumber: 110, - TxHash: common.HexToHash("0xe32dfe6afd7ea28475569756fc30f0eea6ad4cfd32f67436ff1d1c805e4382df"), - TxIndex: 15, - BlockHash: fakes.FakeHash, - Index: 3, - Removed: false, -} -var rawCatFileLumpLog, _ = json.Marshal(EthCatFileLumpLog) -var CatFileLumpModel = chop_lump.CatFileChopLumpModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - What: "lump", - Data: "12345.678901234567092615", - TransactionIndex: EthCatFileLumpLog.TxIndex, - LogIndex: EthCatFileLumpLog.Index, - Raw: rawCatFileLumpLog, -} - -var EthCatFileFlipLog = types.Log{ - Address: common.HexToAddress(KovanCatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xebecb39d00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x666c697000000000000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064ebecb39d66616b6520696c6b000000000000000000000000000000000000000000000000666c69700000000000000000000000000000000000000000000000000000000000000000000000000000000007fa9ef6609ca7921112231f8f195138ebba2977"), - BlockNumber: 88, - TxHash: common.HexToHash("0xc71ef3e9999595913d31e89446cab35319bd4289520e55611a1b42fc2a8463b6"), - TxIndex: 12, - BlockHash: fakes.FakeHash, - Index: 1, - Removed: false, -} - -var rawCatFileFlipLog, _ = json.Marshal(EthCatFileFlipLog) -var CatFileFlipModel = flip.CatFileFlipModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - What: "flip", - Flip: "0x07Fa9eF6609cA7921112231F8f195138ebbA2977", - TransactionIndex: EthCatFileFlipLog.TxIndex, - LogIndex: EthCatFileFlipLog.Index, - Raw: rawCatFileFlipLog, -} - -var EthCatFilePitVowLog = types.Log{ - Address: common.HexToAddress(KovanCatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xd4e8be8300000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x7069740000000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000008e84a1e068d77059cbe263c43ad0cdc130863313"), - }, - Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000044d4e8be8370697400000000000000000000000000000000000000000000000000000000000000000000000000000000008e84a1e068d77059cbe263c43ad0cdc130863313"), - BlockNumber: 87, - TxHash: common.HexToHash("0x6515c7dfe53f0ad83ce1173fa99032c24a07cfd8b5d5a1c1f80486c99dd52800"), - TxIndex: 11, - BlockHash: fakes.FakeHash, - Index: 2, - Removed: false, -} - -var rawCatFilePitVowLog, _ = json.Marshal(EthCatFilePitVowLog) -var CatFilePitVowModel = pit_vow.CatFilePitVowModel{ - What: "pit", - Data: "0x8E84a1e068d77059Cbe263C43AD0cDc130863313", - TransactionIndex: EthCatFilePitVowLog.TxIndex, - LogIndex: EthCatFilePitVowLog.Index, - Raw: rawCatFilePitVowLog, -} diff --git a/pkg/transformers/test_data/deal.go b/pkg/transformers/test_data/deal.go deleted file mode 100644 index ab1e64cf..00000000 --- a/pkg/transformers/test_data/deal.go +++ /dev/null @@ -1,52 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/deal" -) - -var DealLogNote = types.Log{ - Address: common.HexToAddress(KovanFlipperContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xc959c42b00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x000000000000000000000000000000000000000000000000000000000000007b"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024c959c42b000000000000000000000000000000000000000000000000000000000000007b"), - BlockNumber: 16, - TxHash: common.HexToHash("0xc6ff19de9299e5b290ba2d52fdb4662360ca86376613d78ee546244866a0be2d"), - TxIndex: 74, - BlockHash: fakes.FakeHash, - Index: 75, - Removed: false, -} -var dealRawJson, _ = json.Marshal(DealLogNote) - -var DealModel = deal.DealModel{ - BidId: "123", - ContractAddress: KovanFlipperContractAddress, - LogIndex: DealLogNote.Index, - TransactionIndex: DealLogNote.TxIndex, - Raw: dealRawJson, -} diff --git a/pkg/transformers/test_data/dent.go b/pkg/transformers/test_data/dent.go deleted file mode 100644 index 027bf0be..00000000 --- a/pkg/transformers/test_data/dent.go +++ /dev/null @@ -1,64 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/dent" - "strconv" -) - -var ( - DentData = "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000645ff3a382000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000098a7d9b8314c000000000000000000000000000000000000000000000000000029a2241af62c0000" - DentTransactionHash = "0x5a210319fcd31eea5959fedb4a1b20881c21a21976e23ff19dff3b44cc1c71e8" - dentBidId = int64(1) - dentLot = "11000000000000000000" - dentBid = "3000000000000000000" - dentGuy = "0x64d922894153BE9EEf7b7218dc565d1D0Ce2a092" - dentRawJson, _ = json.Marshal(DentLog) -) - -var DentLog = types.Log{ - Address: common.HexToAddress(KovanFlipperContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x5ff3a38200000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001"), - common.HexToHash("0x00000000000000000000000000000000000000000000000098a7d9b8314c0000"), - }, - Data: hexutil.MustDecode(DentData), - BlockNumber: 15, - TxHash: common.HexToHash(DentTransactionHash), - TxIndex: 5, - BlockHash: fakes.FakeHash, - Index: 2, - Removed: false, -} - -var DentModel = dent.DentModel{ - BidId: strconv.FormatInt(dentBidId, 10), - Lot: dentLot, - Bid: dentBid, - Guy: dentGuy, - LogIndex: DentLog.Index, - TransactionIndex: DentLog.TxIndex, - Raw: dentRawJson, -} diff --git a/pkg/transformers/test_data/drip_drip.go b/pkg/transformers/test_data/drip_drip.go deleted file mode 100644 index f87382e0..00000000 --- a/pkg/transformers/test_data/drip_drip.go +++ /dev/null @@ -1,51 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_drip" -) - -var EthDripDripLog = types.Log{ - Address: common.HexToAddress(KovanDripContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x44e2a5a800000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002444e2a5a866616b6520696c6b000000000000000000000000000000000000000000000000"), - BlockNumber: 62, - TxHash: common.HexToHash("0xa34fd5cfcb125ebfc81d33633495701b531753669712092bdb8aa6159a240040"), - TxIndex: 10, - BlockHash: fakes.FakeHash, - Index: 11, - Removed: false, -} - -var rawDripDripLog, _ = json.Marshal(EthDripDripLog) -var DripDripModel = drip_drip.DripDripModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - LogIndex: EthDripDripLog.Index, - TransactionIndex: EthDripDripLog.TxIndex, - Raw: rawDripDripLog, -} diff --git a/pkg/transformers/test_data/drip_file.go b/pkg/transformers/test_data/drip_file.go deleted file mode 100644 index bc393128..00000000 --- a/pkg/transformers/test_data/drip_file.go +++ /dev/null @@ -1,108 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - ilk2 "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/ilk" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/repo" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/vow" - "math/big" -) - -var EthDripFileIlkLog = types.Log{ - Address: common.HexToAddress(KovanDripContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x1a0b287e00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x66616b6520766f77000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000641a0b287e66616b6520696c6b00000000000000000000000000000000000000000000000066616b6520766f77000000000000000000000000000000000000000000000000000000000000000000000000000000000000009B3F7188CE95D16E5AE0000000"), - BlockNumber: 35, - TxHash: common.HexToHash("0xa1c31b7e6389470902237161263558615e60b40f2e63060b2f4aeafe92d57e5f"), - TxIndex: 12, - BlockHash: fakes.FakeHash, - Index: 15, - Removed: false, -} - -var rawDripFileIlkLog, _ = json.Marshal(EthDripFileIlkLog) -var DripFileIlkModel = ilk2.DripFileIlkModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - Vow: "66616b6520766f77000000000000000000000000000000000000000000000000", - Tax: "12300.000000000000000000000000000", - LogIndex: EthDripFileIlkLog.Index, - TransactionIndex: EthDripFileIlkLog.TxIndex, - Raw: rawDripFileIlkLog, -} - -var EthDripFileRepoLog = types.Log{ - Address: common.HexToAddress(KovanDripContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x29ae811400000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x66616b6520776861740000000000000000000000000000000000000000000000"), - common.HexToHash("0x000000000000000000000000000000000000000000000000000000000000007b"), - }, - Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004429ae811466616b6520776861740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007b"), - BlockNumber: 36, - TxHash: common.HexToHash("0xeeaa16de1d91c239b66773e8c2116a26cfeaaf5d962b31466c9bf047a5caa20f"), - TxIndex: 13, - BlockHash: fakes.FakeHash, - Index: 16, - Removed: false, -} - -var rawDripFileRepoLog, _ = json.Marshal(EthDripFileRepoLog) -var DripFileRepoModel = repo.DripFileRepoModel{ - What: "fake what", - Data: big.NewInt(123).String(), - LogIndex: EthDripFileRepoLog.Index, - TransactionIndex: EthDripFileRepoLog.TxIndex, - Raw: rawDripFileRepoLog, -} - -var EthDripFileVowLog = types.Log{ - Address: common.HexToAddress(KovanDripContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xe9b674b900000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x766f770000000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"), - }, - Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000044e9b674b966616b652077686174000000000000000000000000000000000000000000000066616b6520646174610000000000000000000000000000000000000000000000"), - BlockNumber: 51, - TxHash: common.HexToHash("0x586e26b71b41fcd6905044dbe8f0cca300517542278f74a9b925c4f800fed85c"), - TxIndex: 14, - BlockHash: fakes.FakeHash, - Index: 17, - Removed: false, -} - -var rawDripFileVowLog, _ = json.Marshal(EthDripFileVowLog) -var DripFileVowModel = vow.DripFileVowModel{ - What: "vow", - Data: "0x3728e9777B2a0a611ee0F89e00E01044ce4736d1", - LogIndex: EthDripFileVowLog.Index, - TransactionIndex: EthDripFileVowLog.TxIndex, - Raw: rawDripFileVowLog, -} diff --git a/pkg/transformers/test_data/flap_kick.go b/pkg/transformers/test_data/flap_kick.go deleted file mode 100644 index d8d87201..00000000 --- a/pkg/transformers/test_data/flap_kick.go +++ /dev/null @@ -1,50 +0,0 @@ -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flap_kick" - "math/big" - "time" -) - -var EthFlapKickLog = types.Log{ - Address: common.HexToAddress(KovanFlapperContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xefa52d9342a199cb30efd2692463f2c2bef63cd7186b50382d4fb94ad207880e"), - common.HexToHash("0x00000000000000000000000000000000000000000000000000000000069f6bc7"), - }, - Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000003ade68b100000000000000000000000000000000000000000000000000000000075bcd150000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6000000000000000000000000000000000000000000000000000000005be469c5"), - BlockNumber: 65, - TxHash: common.HexToHash("0xee7930b76b6e93974bd3f37824644ae42a89a3887a1131a7bcb3267ab4dc0169"), - TxIndex: 66, - BlockHash: fakes.FakeHash, - Index: 67, - Removed: false, -} - -var FlapKickEntity = flap_kick.FlapKickEntity{ - Id: big.NewInt(111111111), - Lot: big.NewInt(987654321), - Bid: big.NewInt(123456789), - Gal: common.HexToAddress("0x7d7bEe5fCfD8028cf7b00876C5b1421c800561A6"), - End: big.NewInt(1541695941), - Raw: EthFlapKickLog, - TransactionIndex: EthFlapKickLog.TxIndex, - LogIndex: EthFlapKickLog.Index, -} - -var rawFlapKickLog, _ = json.Marshal(EthFlapKickLog) -var FlapKickModel = flap_kick.FlapKickModel{ - BidId: FlapKickEntity.Id.String(), - Lot: FlapKickEntity.Lot.String(), - Bid: FlapKickEntity.Bid.String(), - Gal: FlapKickEntity.Gal.String(), - End: time.Unix(1541695941, 0), - Raw: rawFlapKickLog, - TransactionIndex: EthFlapKickLog.TxIndex, - LogIndex: EthFlapKickLog.Index, -} diff --git a/pkg/transformers/test_data/flip_kick.go b/pkg/transformers/test_data/flip_kick.go deleted file mode 100644 index 16d62d50..00000000 --- a/pkg/transformers/test_data/flip_kick.go +++ /dev/null @@ -1,100 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "math/big" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/flip_kick" -) - -var ( - idString = "1" - id, _ = new(big.Int).SetString(idString, 10) - lotString = "100" - lot, _ = new(big.Int).SetString(lotString, 10) - bidString = "0" - bid = new(big.Int).SetBytes([]byte{0}) - gal = "0x07Fa9eF6609cA7921112231F8f195138ebbA2977" - end = int64(1535991025) - urnBytes = [32]byte{115, 64, 224, 6, 244, 19, 91, 166, 151, 13, 67, 191, 67, 216, 141, 202, 212, 231, 168, 202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - urnString = "0x7340e006f4135BA6970D43bf43d88DCAD4e7a8CA" - tabString = "50" - tab, _ = new(big.Int).SetString(tabString, 10) - rawLog, _ = json.Marshal(EthFlipKickLog) -) - -var ( - flipKickTransactionHash = "0xd11ab35cfb1ad71f790d3dd488cc1a2046080e765b150e8997aa0200947d4a9b" - flipKickData = "0x0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007fa9ef6609ca7921112231f8f195138ebba2977000000000000000000000000000000000000000000000000000000005b8d5cf10000000000000000000000000000000000000000000000000000000000000032" - FlipKickBlockNumber = int64(10) -) - -var EthFlipKickLog = types.Log{ - Address: common.HexToAddress(KovanFlipperContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xbac86238bdba81d21995024470425ecb370078fa62b7271b90cf28cbd1e3e87e"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001"), - common.HexToHash("0x7340e006f4135ba6970d43bf43d88dcad4e7a8ca000000000000000000000000"), - }, - Data: hexutil.MustDecode(flipKickData), - BlockNumber: uint64(FlipKickBlockNumber), - TxHash: common.HexToHash(flipKickTransactionHash), - TxIndex: 999, - BlockHash: fakes.FakeHash, - Index: 1, - Removed: false, -} - -var FlipKickEntity = flip_kick.FlipKickEntity{ - Id: id, - Lot: lot, - Bid: bid, - Gal: common.HexToAddress(gal), - End: big.NewInt(end), - Urn: urnBytes, - Tab: tab, - TransactionIndex: EthFlipKickLog.TxIndex, - LogIndex: EthFlipKickLog.Index, - Raw: EthFlipKickLog, -} - -var FlipKickModel = flip_kick.FlipKickModel{ - BidId: idString, - Lot: lotString, - Bid: bidString, - Gal: gal, - End: time.Unix(end, 0), - Urn: urnString, - Tab: tabString, - TransactionIndex: EthFlipKickLog.TxIndex, - LogIndex: EthFlipKickLog.Index, - Raw: rawLog, -} - -type FlipKickDBRow struct { - ID int64 - HeaderId int64 `db:"header_id"` - flip_kick.FlipKickModel -} diff --git a/pkg/transformers/test_data/flop_kick.go b/pkg/transformers/test_data/flop_kick.go deleted file mode 100644 index a573e271..00000000 --- a/pkg/transformers/test_data/flop_kick.go +++ /dev/null @@ -1,82 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flop_kick" - "math/big" - "strconv" - "time" -) - -var ( - FlopKickLog = types.Log{ - Address: common.HexToAddress(KovanFlopperContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xefa52d9342a199cb30efd2692463f2c2bef63cd7186b50382d4fb94ad207880e"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000005"), - }, - Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000020000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6000000000000000000000000000000000000000000000000000000000002a300"), - BlockNumber: 19, - TxHash: common.HexToHash("0xd8fd67b37a6aa64a3cef4937204765183b180d8dc92eecd0d233f445526d31b5"), - TxIndex: flopTxIndex, - BlockHash: fakes.FakeHash, - Index: 32, - Removed: false, - } - - flopTxIndex = uint(33) - flopBidId = int64(5) - flopLot = int64(15) - flopBid = int64(2) - flopGal = "0x7d7bEe5fCfD8028cf7b00876C5b1421c800561A6" - rawFlopLogJson, _ = json.Marshal(FlopKickLog) - flopEnd = int64(172800) - - FlopKickEntity = flop_kick.Entity{ - Id: big.NewInt(flopBidId), - Lot: big.NewInt(flopLot), - Bid: big.NewInt(flopBid), - Gal: common.HexToAddress(flopGal), - End: big.NewInt(flopEnd), - TransactionIndex: flopTxIndex, - LogIndex: FlopKickLog.Index, - Raw: FlopKickLog, - } - - FlopKickModel = flop_kick.Model{ - BidId: strconv.FormatInt(flopBidId, 10), - Lot: strconv.FormatInt(flopLot, 10), - Bid: strconv.FormatInt(flopBid, 10), - Gal: flopGal, - End: time.Unix(flopEnd, 0), - TransactionIndex: flopTxIndex, - LogIndex: FlopKickLog.Index, - Raw: rawFlopLogJson, - } -) - -type FlopKickDBResult struct { - Id int64 - HeaderId int64 `db:"header_id"` - flop_kick.Model -} diff --git a/pkg/transformers/test_data/frob.go b/pkg/transformers/test_data/frob.go deleted file mode 100644 index 9b0aad05..00000000 --- a/pkg/transformers/test_data/frob.go +++ /dev/null @@ -1,89 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/frob" - "math/big" -) - -var ( - TemporaryFrobBlockNumber = int64(13) - TemporaryFrobData = "0x000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019" - TemporaryFrobTransaction = "0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9" -) - -var ( - // need to set bytes as 0 or else the big Int 0 evaluates differently from the one unpacked by the abi - art = big.NewInt(20) - dink = big.NewInt(10) - dart = big.NewInt(0).SetBytes([]byte{0}) - iArt = big.NewInt(25) - frobLad = [32]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 217, 34, 137, 65, 83, 190, 158, 239, 123, 114, 24, 220, 86, 93, 29, 12, 226, 160, 146} - ink = big.NewInt(15) - ilk = [32]byte{102, 97, 107, 101, 32, 105, 108, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - frobIlkString = "66616b6520696c6b000000000000000000000000000000000000000000000000" - frobUrnString = "00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092" -) - -var EthFrobLog = types.Log{ - Address: common.HexToAddress(KovanPitContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xb2afa28318bcc689926b52835d844de174ef8de97e982a85c0199d584920791b"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - }, - Data: hexutil.MustDecode(TemporaryFrobData), - BlockNumber: uint64(TemporaryFrobBlockNumber), - TxHash: common.HexToHash(TemporaryFrobTransaction), - TxIndex: 123, - BlockHash: fakes.FakeHash, - Index: 7, - Removed: false, -} - -var FrobEntity = frob.FrobEntity{ - Ilk: ilk, - Urn: frobLad, - Ink: ink, - Art: art, - Dink: dink, - Dart: dart, - IArt: iArt, - LogIndex: EthFrobLog.Index, - TransactionIndex: EthFrobLog.TxIndex, - Raw: EthFrobLog, -} - -var rawFrobLog, _ = json.Marshal(EthFrobLog) -var FrobModel = frob.FrobModel{ - Ilk: frobIlkString, - Urn: frobUrnString, - Ink: ink.String(), - Art: art.String(), - Dink: dink.String(), - Dart: dart.String(), - IArt: iArt.String(), - LogIndex: EthFrobLog.Index, - TransactionIndex: EthFrobLog.TxIndex, - Raw: rawFrobLog, -} diff --git a/pkg/transformers/test_data/mocks/log_fetcher.go b/pkg/transformers/test_data/mocks/log_fetcher.go deleted file mode 100644 index bd73276c..00000000 --- a/pkg/transformers/test_data/mocks/log_fetcher.go +++ /dev/null @@ -1,54 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package mocks - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/core" -) - -type MockLogFetcher struct { - FetchedContractAddresses [][]common.Address - FetchedTopics [][]common.Hash - FetchedBlocks []int64 - fetcherError error - FetchedLogs []types.Log - SetBcCalled bool - FetchLogsCalled bool -} - -func (mlf *MockLogFetcher) FetchLogs(contractAddresses []common.Address, topics []common.Hash, header core.Header) ([]types.Log, error) { - mlf.FetchedContractAddresses = append(mlf.FetchedContractAddresses, contractAddresses) - mlf.FetchedTopics = [][]common.Hash{topics} - mlf.FetchedBlocks = append(mlf.FetchedBlocks, header.BlockNumber) - mlf.FetchLogsCalled = true - - return mlf.FetchedLogs, mlf.fetcherError -} - -func (mlf *MockLogFetcher) SetBC(bc core.BlockChain) { - mlf.SetBcCalled = true -} - -func (mlf *MockLogFetcher) SetFetcherError(err error) { - mlf.fetcherError = err -} - -func (mlf *MockLogFetcher) SetFetchedLogs(logs []types.Log) { - mlf.FetchedLogs = logs -} diff --git a/pkg/transformers/test_data/mocks/log_note_converter.go b/pkg/transformers/test_data/mocks/log_note_converter.go deleted file mode 100644 index 9a43434e..00000000 --- a/pkg/transformers/test_data/mocks/log_note_converter.go +++ /dev/null @@ -1,26 +0,0 @@ -package mocks - -import ( - "github.com/ethereum/go-ethereum/core/types" -) - -type MockLogNoteConverter struct { - err error - returnModels []interface{} - PassedLogs []types.Log - ToModelsCalledCounter int -} - -func (converter *MockLogNoteConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - converter.PassedLogs = ethLogs - converter.ToModelsCalledCounter++ - return converter.returnModels, converter.err -} - -func (converter *MockLogNoteConverter) SetConverterError(e error) { - converter.err = e -} - -func (converter *MockLogNoteConverter) SetReturnModels(models []interface{}) { - converter.returnModels = models -} diff --git a/pkg/transformers/test_data/mocks/mappings.go b/pkg/transformers/test_data/mocks/mappings.go deleted file mode 100644 index 18ab4a08..00000000 --- a/pkg/transformers/test_data/mocks/mappings.go +++ /dev/null @@ -1,22 +0,0 @@ -package mocks - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type MockMappings struct { - Metadata shared.StorageValueMetadata - LookupCalled bool - LookupErr error -} - -func (mappings *MockMappings) Lookup(key common.Hash) (shared.StorageValueMetadata, error) { - mappings.LookupCalled = true - return mappings.Metadata, mappings.LookupErr -} - -func (*MockMappings) SetDB(db *postgres.DB) { - panic("implement me") -} diff --git a/pkg/transformers/test_data/mocks/storage_queue.go b/pkg/transformers/test_data/mocks/storage_queue.go deleted file mode 100644 index 6a4cda74..00000000 --- a/pkg/transformers/test_data/mocks/storage_queue.go +++ /dev/null @@ -1,15 +0,0 @@ -package mocks - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type MockStorageQueue struct { - AddCalled bool - AddError error -} - -func (queue *MockStorageQueue) Add(row shared.StorageDiffRow) error { - queue.AddCalled = true - return queue.AddError -} diff --git a/pkg/transformers/test_data/mocks/storage_repository.go b/pkg/transformers/test_data/mocks/storage_repository.go deleted file mode 100644 index 62e88186..00000000 --- a/pkg/transformers/test_data/mocks/storage_repository.go +++ /dev/null @@ -1,26 +0,0 @@ -package mocks - -import ( - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type MockStorageRepository struct { - CreateErr error - PassedBlockNumber int - PassedBlockHash string - PassedMetadata shared.StorageValueMetadata - PassedValue interface{} -} - -func (repository *MockStorageRepository) Create(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, value interface{}) error { - repository.PassedBlockNumber = blockNumber - repository.PassedBlockHash = blockHash - repository.PassedMetadata = metadata - repository.PassedValue = value - return repository.CreateErr -} - -func (*MockStorageRepository) SetDB(db *postgres.DB) { - panic("implement me") -} diff --git a/pkg/transformers/test_data/mocks/storage_transformer.go b/pkg/transformers/test_data/mocks/storage_transformer.go deleted file mode 100644 index 34c00007..00000000 --- a/pkg/transformers/test_data/mocks/storage_transformer.go +++ /dev/null @@ -1,27 +0,0 @@ -package mocks - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/storage" - "github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared" -) - -type MockStorageTransformer struct { - Address common.Address - ExecuteErr error - PassedRow shared.StorageDiffRow -} - -func (transformer *MockStorageTransformer) Execute(row shared.StorageDiffRow) error { - transformer.PassedRow = row - return transformer.ExecuteErr -} - -func (transformer *MockStorageTransformer) ContractAddress() common.Address { - return transformer.Address -} - -func (transformer *MockStorageTransformer) FakeTransformerInitializer(db *postgres.DB) storage.Transformer { - return transformer -} diff --git a/pkg/transformers/test_data/mocks/transformer.go b/pkg/transformers/test_data/mocks/transformer.go deleted file mode 100644 index 452e5794..00000000 --- a/pkg/transformers/test_data/mocks/transformer.go +++ /dev/null @@ -1,45 +0,0 @@ -package mocks - -import ( - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type MockTransformer struct { - ExecuteWasCalled bool - ExecuteError error - PassedLogs []types.Log - PassedHeader core.Header - config shared.TransformerConfig -} - -func (mh *MockTransformer) Execute(logs []types.Log, header core.Header, recheckHeaders constants.TransformerExecution) error { - if mh.ExecuteError != nil { - return mh.ExecuteError - } - mh.ExecuteWasCalled = true - mh.PassedLogs = logs - mh.PassedHeader = header - return nil -} - -func (mh *MockTransformer) GetConfig() shared.TransformerConfig { - return mh.config -} - -func (mh *MockTransformer) SetTransformerConfig(config shared.TransformerConfig) { - mh.config = config -} - -func (mh *MockTransformer) FakeTransformerInitializer(db *postgres.DB) shared.Transformer { - return mh -} - -var FakeTransformerConfig = shared.TransformerConfig{ - TransformerName: "FakeTransformer", - ContractAddresses: []string{"FakeAddress"}, - Topic: "FakeTopic", -} diff --git a/pkg/transformers/test_data/pit_file.go b/pkg/transformers/test_data/pit_file.go deleted file mode 100644 index 155578b5..00000000 --- a/pkg/transformers/test_data/pit_file.go +++ /dev/null @@ -1,111 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/debt_ceiling" - ilk2 "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -var EthPitFileDebtCeilingLog = types.Log{ - Address: common.HexToAddress(KovanPitContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x29ae811400000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x4c696e6500000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x000000000000000000000000000000000000000000000000000000000001e240"), - }, - Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004429ae81144c696e6500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e240"), - BlockNumber: 22, - TxHash: common.HexToHash("0xd744878a0b6655e3ba729e1019f56b563b4a16750196b8ad6104f3977db43f42"), - TxIndex: 333, - BlockHash: fakes.FakeHash, - Index: 15, - Removed: false, -} - -var rawPitFileDebtCeilingLog, _ = json.Marshal(EthPitFileDebtCeilingLog) -var PitFileDebtCeilingModel = debt_ceiling.PitFileDebtCeilingModel{ - What: "Line", - Data: shared.ConvertToWad(big.NewInt(123456).String()), - LogIndex: EthPitFileDebtCeilingLog.Index, - TransactionIndex: EthPitFileDebtCeilingLog.TxIndex, - Raw: rawPitFileDebtCeilingLog, -} - -var EthPitFileIlkLineLog = types.Log{ - Address: common.HexToAddress(KovanPitContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x1a0b287e00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x6c696e6500000000000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000641a0b287e66616b6520696c6b0000000000000000000000000000000000000000000000006c696e6500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e8d4a51000"), - BlockNumber: 12, - TxHash: common.HexToHash("0x2e27c962a697d4f7ec5d3206d0c058bd510f7593a711f082e55f3b62d44d8dd9"), - TxIndex: 112, - BlockHash: fakes.FakeHash, - Index: 15, - Removed: false, -} - -var rawPitFileIlkLineLog, _ = json.Marshal(EthPitFileIlkLineLog) -var PitFileIlkLineModel = ilk2.PitFileIlkModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - What: "line", - Data: "0.000001000000000000", - LogIndex: EthPitFileIlkLineLog.Index, - TransactionIndex: EthPitFileIlkLineLog.TxIndex, - Raw: rawPitFileIlkLineLog, -} - -var EthPitFileIlkSpotLog = types.Log{ - Address: common.HexToAddress(KovanPitContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x1a0b287e00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x73706f7400000000000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000641a0b287e66616b6520696c6b00000000000000000000000000000000000000000000000073706f7400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e8d4a51000"), - BlockNumber: 11, - TxHash: common.HexToHash("0x1ba8125f60fa045c85b35df3983bee37db8627fbc32e3442a5cf17c85bb83f09"), - TxIndex: 111, - BlockHash: fakes.FakeHash, - Index: 14, - Removed: false, -} - -var rawPitFileIlkSpotLog, _ = json.Marshal(EthPitFileIlkSpotLog) -var PitFileIlkSpotModel = ilk2.PitFileIlkModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - What: "spot", - Data: "0.000000000000001000000000000", - LogIndex: EthPitFileIlkSpotLog.Index, - TransactionIndex: EthPitFileIlkSpotLog.TxIndex, - Raw: rawPitFileIlkSpotLog, -} diff --git a/pkg/transformers/test_data/price_feed.go b/pkg/transformers/test_data/price_feed.go deleted file mode 100644 index c9f59739..00000000 --- a/pkg/transformers/test_data/price_feed.go +++ /dev/null @@ -1,54 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds" -) - -var ( - medianizerAddress = common.HexToAddress("0x99041f808d598b782d5a3e498681c2452a31da08") - blockNumber = uint64(6147230) - txIndex = uint(119) -) - -// https://etherscan.io/tx/0xa51a50a2adbfba4e2ab3d72dfd67a21c769f1bc8d2b180663a15500a56cde58f -var EthPriceFeedLog = types.Log{ - Address: medianizerAddress, - Topics: []common.Hash{common.HexToHash("0x296ba4ca62c6c21c95e828080cb8aec7481b71390585605300a8a76f9e95b527")}, - Data: common.FromHex("00000000000000000000000000000000000000000000001486f658319fb0c100"), - BlockNumber: blockNumber, - TxHash: common.HexToHash("0xa51a50a2adbfba4e2ab3d72dfd67a21c769f1bc8d2b180663a15500a56cde58f"), - TxIndex: txIndex, - BlockHash: fakes.FakeHash, - Index: 8, - Removed: false, -} - -var rawPriceFeedLog, _ = json.Marshal(EthPriceFeedLog) -var PriceFeedModel = price_feeds.PriceFeedModel{ - BlockNumber: blockNumber, - MedianizerAddress: EthPriceFeedLog.Address.String(), - UsdValue: "378.659938889700015352", - LogIndex: EthPriceFeedLog.Index, - TransactionIndex: EthPriceFeedLog.TxIndex, - Raw: rawPriceFeedLog, -} diff --git a/pkg/transformers/test_data/shared_behaviors/repository_behaviors.go b/pkg/transformers/test_data/shared_behaviors/repository_behaviors.go deleted file mode 100644 index d12008fa..00000000 --- a/pkg/transformers/test_data/shared_behaviors/repository_behaviors.go +++ /dev/null @@ -1,187 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package shared_behaviors - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var ( - db *postgres.DB - headerRepository datastore.HeaderRepository - err error - headerId int64 -) - -type CreateBehaviorInputs struct { - CheckedHeaderColumnName string - LogEventTableName string - TestModel interface{} - RecheckTestModel interface{} - ModelWithDifferentLogIdx interface{} - Repository factories.Repository -} - -type MarkedHeaderCheckedBehaviorInputs struct { - CheckedHeaderColumnName string - Repository factories.Repository -} - -type MissingHeadersBehaviorInputs struct { - Repository factories.Repository - RepositoryTwo factories.Repository -} - -func SharedRepositoryCreateBehaviors(inputs *CreateBehaviorInputs) { - Describe("Create", func() { - var headerID int64 - var repository = inputs.Repository - var checkedHeaderColumn = inputs.CheckedHeaderColumnName - var logEventModel = inputs.TestModel - - BeforeEach(func() { - headerRepository = getHeaderRepository() - headerID, err = headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - }) - - It("marks header as checked for logs", func() { - err = repository.Create(headerID, []interface{}{logEventModel}) - - Expect(err).NotTo(HaveOccurred()) - var headerChecked int - query := `SELECT ` + checkedHeaderColumn + ` FROM public.checked_headers WHERE header_id = $1` - err = db.Get(&headerChecked, query, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(headerChecked).To(Equal(1)) - }) - - It("updates the header to checked if checked headers row already exists", func() { - _, err := db.Exec(`INSERT INTO public.checked_headers (header_id) VALUES ($1)`, headerID) - Expect(err).NotTo(HaveOccurred()) - - err = repository.Create(headerID, []interface{}{logEventModel}) - - Expect(err).NotTo(HaveOccurred()) - var headerChecked int - query := `SELECT ` + checkedHeaderColumn + ` FROM public.checked_headers WHERE header_id = $1` - err = db.Get(&headerChecked, query, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(headerChecked).To(Equal(1)) - }) - - It("allows for multiple log events of the same type in one transaction if they have different log indexes", func() { - err = repository.Create(headerID, []interface{}{logEventModel}) - Expect(err).NotTo(HaveOccurred()) - - err = repository.Create(headerID, []interface{}{inputs.ModelWithDifferentLogIdx}) - Expect(err).NotTo(HaveOccurred()) - }) - - It("removes the log event record if the corresponding header is deleted", func() { - err = repository.Create(headerID, []interface{}{logEventModel}) - Expect(err).NotTo(HaveOccurred()) - - _, err = db.Exec(`DELETE FROM headers WHERE id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - var count int - query := `SELECT count(*) from ` + inputs.LogEventTableName - err = db.QueryRow(query).Scan(&count) - Expect(err).NotTo(HaveOccurred()) - Expect(count).To(Equal(0)) - }) - - It("returns an error if model is of wrong type", func() { - err = repository.Create(headerID, []interface{}{test_data.WrongModel{}}) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("model of type")) - }) - }) -} - -func SharedRepositoryMarkHeaderCheckedBehaviors(inputs *MarkedHeaderCheckedBehaviorInputs) { - var repository = inputs.Repository - var checkedHeaderColumn = inputs.CheckedHeaderColumnName - - Describe("MarkHeaderChecked", func() { - BeforeEach(func() { - headerRepository = getHeaderRepository() - headerId, err = headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - }) - - It("creates a row for a new headerId", func() { - err = repository.MarkHeaderChecked(headerId) - - Expect(err).NotTo(HaveOccurred()) - var headerChecked int - query := `SELECT ` + checkedHeaderColumn + ` FROM public.checked_headers WHERE header_id = $1` - err = db.Get(&headerChecked, query, headerId) - Expect(err).NotTo(HaveOccurred()) - Expect(headerChecked).To(Equal(1)) - }) - - It("updates row when headerID already exists", func() { - _, err = db.Exec(`INSERT INTO public.checked_headers (header_id) VALUES ($1)`, headerId) - - err = repository.MarkHeaderChecked(headerId) - - Expect(err).NotTo(HaveOccurred()) - var headerChecked int - query := `SELECT ` + checkedHeaderColumn + ` FROM public.checked_headers WHERE header_id = $1` - err = db.Get(&headerChecked, query, headerId) - Expect(err).NotTo(HaveOccurred()) - Expect(headerChecked).To(Equal(1)) - }) - - It("returns an error if upserting a record fails", func() { - err = repository.MarkHeaderChecked(0) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("violates foreign key constraint")) - }) - - It("increments header checked", func() { - err = repository.MarkHeaderChecked(headerId) - err = repository.MarkHeaderChecked(headerId) - - Expect(err).NotTo(HaveOccurred()) - var headerChecked int - query := `SELECT ` + checkedHeaderColumn + ` FROM public.checked_headers WHERE header_id = $1` - err = db.Get(&headerChecked, query, headerId) - Expect(err).NotTo(HaveOccurred()) - Expect(headerChecked).To(Equal(2)) - }) - }) -} - -func getHeaderRepository() repositories.HeaderRepository { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - - return repositories.NewHeaderRepository(db) -} diff --git a/pkg/transformers/test_data/signatures.go b/pkg/transformers/test_data/signatures.go deleted file mode 100644 index ffa60c2d..00000000 --- a/pkg/transformers/test_data/signatures.go +++ /dev/null @@ -1,32 +0,0 @@ -package test_data - -const ( - KovanVatSlipSignature = "0x42066cbb00000000000000000000000000000000000000000000000000000000" - KovanVatTuneSignature = "0x5dd6471a00000000000000000000000000000000000000000000000000000000" - KovanBiteSignature = "0x99b5620489b6ef926d4518936cfec15d305452712b88bd59da2d9c10fb0953e8" - KovanCatFileFlipSignature = "0xebecb39d00000000000000000000000000000000000000000000000000000000" - KovanDripFileRepoSignature = "0x29ae811400000000000000000000000000000000000000000000000000000000" - KovanPitFileDebtCeilingSignature = "0x29ae811400000000000000000000000000000000000000000000000000000000" - KovanDentFunctionSignature = "0x5ff3a38200000000000000000000000000000000000000000000000000000000" - KovanFlopKickSignature = "0xefa52d9342a199cb30efd2692463f2c2bef63cd7186b50382d4fb94ad207880e" - KovanTendFunctionSignature = "0x4b43ed1200000000000000000000000000000000000000000000000000000000" - KovanVatGrabSignature = "0x3690ae4c00000000000000000000000000000000000000000000000000000000" - KovanPitFileIlkSignature = "0x1a0b287e00000000000000000000000000000000000000000000000000000000" - KovanVatFluxSignature = "0xa6e4182100000000000000000000000000000000000000000000000000000000" - KovanVatMoveSignature = "0x78f1947000000000000000000000000000000000000000000000000000000000" - KovanDripFileIlkSignature = "0x1a0b287e00000000000000000000000000000000000000000000000000000000" - KovanFlapKickSignature = "0xefa52d9342a199cb30efd2692463f2c2bef63cd7186b50382d4fb94ad207880e" - KovanDealSignature = "0xc959c42b00000000000000000000000000000000000000000000000000000000" - KovanVatFoldSignature = "0xe6a6a64d00000000000000000000000000000000000000000000000000000000" - KovanVatHealSignature = "0x990a5f6300000000000000000000000000000000000000000000000000000000" - KovanCatFileChopLumpSignature = "0x1a0b287e00000000000000000000000000000000000000000000000000000000" - KovanFlipKickSignature = "0xbac86238bdba81d21995024470425ecb370078fa62b7271b90cf28cbd1e3e87e" - KovanVatInitSignature = "0x3b66319500000000000000000000000000000000000000000000000000000000" - KovanCatFilePitVowSignature = "0xd4e8be8300000000000000000000000000000000000000000000000000000000" - KovanDripDripSignature = "0x44e2a5a800000000000000000000000000000000000000000000000000000000" - KovanDripFileVowSignature = "0xe9b674b900000000000000000000000000000000000000000000000000000000" - KovanFrobSignature = "0xb2afa28318bcc689926b52835d844de174ef8de97e982a85c0199d584920791b" - KovanLogValueSignature = "0x296ba4ca62c6c21c95e828080cb8aec7481b71390585605300a8a76f9e95b527" - KovanVatTollSignature = "0x09b7a0b500000000000000000000000000000000000000000000000000000000" - KovanVowFlogSignature = "0x35aee16f00000000000000000000000000000000000000000000000000000000" -) diff --git a/pkg/transformers/test_data/tend.go b/pkg/transformers/test_data/tend.go deleted file mode 100644 index 13dadc62..00000000 --- a/pkg/transformers/test_data/tend.go +++ /dev/null @@ -1,67 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "strconv" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/tend" -) - -var ( - tendBidId = int64(10) - tendLot = "85000000000000000000" - tendBid = "1000000000000000000" - tendGuy = "0000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6" - tendData = "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000644b43ed12000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000049b9ca9a6943400000000000000000000000000000000000000000000000000000de0b6b3a7640000" - tendTransactionHash = "0x7909c8793ded2b8348f5db623044fbc26bb7ab78ad5792897abdf68ddc1df63d" - tendBlockHash = "0xa8ea87147c0a68daeb6b1d9f8c0937ba975a650809cab80d19c969e8d0df452c" -) - -var TendLogNote = types.Log{ - Address: common.HexToAddress(KovanFlipperContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x4b43ed1200000000000000000000000000000000000000000000000000000000"), //abbreviated tend function signature - common.HexToHash("0x0000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6"), //msg caller address - common.HexToHash("0x000000000000000000000000000000000000000000000000000000000000000a"), //first param of the function called (i.e. flip kick id) - common.HexToHash("0x0000000000000000000000000000000000000000000000049b9ca9a694340000"), //second param of the function called (i.e. lot) - }, - Data: hexutil.MustDecode(tendData), - BlockNumber: 11, - TxHash: common.HexToHash(tendTransactionHash), - TxIndex: 10, - BlockHash: fakes.FakeHash, - Index: 1, - Removed: false, -} - -var rawTendLog, _ = json.Marshal(TendLogNote) -var TendModel = tend.TendModel{ - BidId: strconv.FormatInt(tendBidId, 10), - Lot: tendLot, - Bid: tendBid, - Guy: tendGuy, - LogIndex: TendLogNote.Index, - TransactionIndex: TendLogNote.TxIndex, - Raw: rawTendLog, -} diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x1faae5bf0d78e3d8cc018d2e87db91d0e1e64edc1e69e2ef1dd8caec3afec93c b/pkg/transformers/test_data/test_chain/!blockHashes!0x1faae5bf0d78e3d8cc018d2e87db91d0e1e64edc1e69e2ef1dd8caec3afec93c deleted file mode 100644 index 301160a9..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x1faae5bf0d78e3d8cc018d2e87db91d0e1e64edc1e69e2ef1dd8caec3afec93c +++ /dev/null @@ -1 +0,0 @@ -8 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x56ba7ae1c6f7aaa74ae77f9613b43a5a50a7fad09f1fca42888e163fb34f0537 b/pkg/transformers/test_data/test_chain/!blockHashes!0x56ba7ae1c6f7aaa74ae77f9613b43a5a50a7fad09f1fca42888e163fb34f0537 deleted file mode 100644 index d8263ee9..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x56ba7ae1c6f7aaa74ae77f9613b43a5a50a7fad09f1fca42888e163fb34f0537 +++ /dev/null @@ -1 +0,0 @@ -2 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x6151d2ee962c0182b8d259362d9c84a7f11bf0f1f3f9113e88f23cc80e6e5a24 b/pkg/transformers/test_data/test_chain/!blockHashes!0x6151d2ee962c0182b8d259362d9c84a7f11bf0f1f3f9113e88f23cc80e6e5a24 deleted file mode 100644 index c7930257..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x6151d2ee962c0182b8d259362d9c84a7f11bf0f1f3f9113e88f23cc80e6e5a24 +++ /dev/null @@ -1 +0,0 @@ -7 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x61c5cb2a574755ca1bb146fe391418c638bb118b74fa456748cebad6f5565dd2 b/pkg/transformers/test_data/test_chain/!blockHashes!0x61c5cb2a574755ca1bb146fe391418c638bb118b74fa456748cebad6f5565dd2 deleted file mode 100644 index f11c82a4..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x61c5cb2a574755ca1bb146fe391418c638bb118b74fa456748cebad6f5565dd2 +++ /dev/null @@ -1 +0,0 @@ -9 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x6803ff793873c6143a8e1734584ea759b2b3fdb8a13a1cb023c6d0822e650aa1 b/pkg/transformers/test_data/test_chain/!blockHashes!0x6803ff793873c6143a8e1734584ea759b2b3fdb8a13a1cb023c6d0822e650aa1 deleted file mode 100644 index 62f94575..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x6803ff793873c6143a8e1734584ea759b2b3fdb8a13a1cb023c6d0822e650aa1 +++ /dev/null @@ -1 +0,0 @@ -6 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x71f36ea384f3f25e317f6c4b5f889578811b77e710f9e7c1a75ed5e1cff13a65 b/pkg/transformers/test_data/test_chain/!blockHashes!0x71f36ea384f3f25e317f6c4b5f889578811b77e710f9e7c1a75ed5e1cff13a65 deleted file mode 100644 index 56a6051c..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x71f36ea384f3f25e317f6c4b5f889578811b77e710f9e7c1a75ed5e1cff13a65 +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x876ecbdafaee12440e7619a789e1fcdab1e0252c236b3ec622fb2f565a3f2216 b/pkg/transformers/test_data/test_chain/!blockHashes!0x876ecbdafaee12440e7619a789e1fcdab1e0252c236b3ec622fb2f565a3f2216 deleted file mode 100644 index c2270834..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x876ecbdafaee12440e7619a789e1fcdab1e0252c236b3ec622fb2f565a3f2216 +++ /dev/null @@ -1 +0,0 @@ -0 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x8fbe0d8442f58c843bd8003e93f2b100c81f2b57e5a339fea6d8de9bee764afa b/pkg/transformers/test_data/test_chain/!blockHashes!0x8fbe0d8442f58c843bd8003e93f2b100c81f2b57e5a339fea6d8de9bee764afa deleted file mode 100644 index 3cacc0b9..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x8fbe0d8442f58c843bd8003e93f2b100c81f2b57e5a339fea6d8de9bee764afa +++ /dev/null @@ -1 +0,0 @@ -12 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x903a879c68f1485576c44d211ceb42e7dc0ad30e33f08fad8578384c334d9254 b/pkg/transformers/test_data/test_chain/!blockHashes!0x903a879c68f1485576c44d211ceb42e7dc0ad30e33f08fad8578384c334d9254 deleted file mode 100644 index 7813681f..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x903a879c68f1485576c44d211ceb42e7dc0ad30e33f08fad8578384c334d9254 +++ /dev/null @@ -1 +0,0 @@ -5 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0x9a97cef69601c548306f2029e3e2059c02716eafa859f0f4eae08c23b5b78903 b/pkg/transformers/test_data/test_chain/!blockHashes!0x9a97cef69601c548306f2029e3e2059c02716eafa859f0f4eae08c23b5b78903 deleted file mode 100644 index e440e5c8..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0x9a97cef69601c548306f2029e3e2059c02716eafa859f0f4eae08c23b5b78903 +++ /dev/null @@ -1 +0,0 @@ -3 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0xa4dc9cf47b1ac951d65d325778b2be463d13e50974d41afc2b5463f5dc6b5550 b/pkg/transformers/test_data/test_chain/!blockHashes!0xa4dc9cf47b1ac951d65d325778b2be463d13e50974d41afc2b5463f5dc6b5550 deleted file mode 100644 index 9a037142..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0xa4dc9cf47b1ac951d65d325778b2be463d13e50974d41afc2b5463f5dc6b5550 +++ /dev/null @@ -1 +0,0 @@ -10 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0xc95293bdd8a065d159347c1444656ffe4993ecd8e2108d00ba842f6b98821c1f b/pkg/transformers/test_data/test_chain/!blockHashes!0xc95293bdd8a065d159347c1444656ffe4993ecd8e2108d00ba842f6b98821c1f deleted file mode 100644 index 9d607966..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0xc95293bdd8a065d159347c1444656ffe4993ecd8e2108d00ba842f6b98821c1f +++ /dev/null @@ -1 +0,0 @@ -11 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockHashes!0xe6c87e0c062c3544efe2e9f7d0ed346abd16b0ed27fcfd8dfddab878bc34c085 b/pkg/transformers/test_data/test_chain/!blockHashes!0xe6c87e0c062c3544efe2e9f7d0ed346abd16b0ed27fcfd8dfddab878bc34c085 deleted file mode 100644 index bf0d87ab..00000000 --- a/pkg/transformers/test_data/test_chain/!blockHashes!0xe6c87e0c062c3544efe2e9f7d0ed346abd16b0ed27fcfd8dfddab878bc34c085 +++ /dev/null @@ -1 +0,0 @@ -4 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!0 b/pkg/transformers/test_data/test_chain/!blockLogs!0 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!0 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!1 b/pkg/transformers/test_data/test_chain/!blockLogs!1 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!1 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!10 b/pkg/transformers/test_data/test_chain/!blockLogs!10 deleted file mode 100644 index 98b44f8c..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!10 +++ /dev/null @@ -1 +0,0 @@ -[{"logIndex":"0x0","transactionIndex":"0x0","transactionHash":"0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191","blockHash":"0xa4dc9cf47b1ac951d65d325778b2be463d13e50974d41afc2b5463f5dc6b5550","blockNumber":"0xa","address":"0x08cb6176addcca2e1d1ffe21bee464b72ee4cd8d","data":"0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae218266616b6520696c6b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a09200000000000000000000000007fa9ef6609ca7921112231f8f195138ebba2977000000000000000000000000000000000000000000000000000000005b7f2174000000000000000000000000000000000000000000000000000000005b75e6f40000000000000000000000007340e006f4135ba6970d43bf43d88dcad4e7a8ca0000000000000000000000000000000000000000000000000000000000000032","topics":["0x8828a22eb6a18623309ad55592866c4b077989e9e8a25e1b85f9bf6f7282520f"],"type":"mined"}] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!11 b/pkg/transformers/test_data/test_chain/!blockLogs!11 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!11 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!12 b/pkg/transformers/test_data/test_chain/!blockLogs!12 deleted file mode 100644 index 796036e9..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!12 +++ /dev/null @@ -1 +0,0 @@ -[{"logIndex":"0x0","transactionIndex":"0x0","transactionHash":"0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9","blockHash":"0x8fbe0d8442f58c843bd8003e93f2b100c81f2b57e5a339fea6d8de9bee764afa","blockNumber":"0xc","address":"0x38219779a699d67d7e7740b8c8f43d3e2dae2182","data":"0x00000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae218200000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092000000000000000000000000000000000000000000000000000000000000000074756e6500000000000000000000000000000000000000000000000000000000","topics":["0xd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8"],"type":"mined"},{"logIndex":"0x1","transactionIndex":"0x0","transactionHash":"0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9","blockHash":"0x8fbe0d8442f58c843bd8003e93f2b100c81f2b57e5a339fea6d8de9bee764afa","blockNumber":"0xc","address":"0xff3f2400f1600f3f493a9a92704a29b96795af1a","data":"0x66616b6520696c6b00000000000000000000000000000000000000000000000000000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b75e6fd","topics":["0x6cedf1d3a466a3d6bab04887b1642177bf6dbf1daa737c2e8f639cd0b020d9d0"],"type":"mined"}] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!2 b/pkg/transformers/test_data/test_chain/!blockLogs!2 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!2 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!3 b/pkg/transformers/test_data/test_chain/!blockLogs!3 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!3 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!4 b/pkg/transformers/test_data/test_chain/!blockLogs!4 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!4 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!5 b/pkg/transformers/test_data/test_chain/!blockLogs!5 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!5 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!6 b/pkg/transformers/test_data/test_chain/!blockLogs!6 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!6 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!7 b/pkg/transformers/test_data/test_chain/!blockLogs!7 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!7 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!8 b/pkg/transformers/test_data/test_chain/!blockLogs!8 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!8 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!9 b/pkg/transformers/test_data/test_chain/!blockLogs!9 deleted file mode 100644 index 0637a088..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!9 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blockLogs!length b/pkg/transformers/test_data/test_chain/!blockLogs!length deleted file mode 100644 index ca7bf83a..00000000 --- a/pkg/transformers/test_data/test_chain/!blockLogs!length +++ /dev/null @@ -1 +0,0 @@ -13 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!0 b/pkg/transformers/test_data/test_chain/!blocks!0 deleted file mode 100644 index 1686f4a7..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!0 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0xafc7c6a8161d69dc1b082bbf799d38f88c2f251a7504b87039b2a4f682cbf323","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x","gasLimit":"0x6691b7","gasUsed":"0x","timestamp":"0x5b75e6d9","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!1 b/pkg/transformers/test_data/test_chain/!blocks!1 deleted file mode 100644 index 316d11a1..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!1 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x876ecbdafaee12440e7619a789e1fcdab1e0252c236b3ec622fb2f565a3f2216","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0x506ea6c4ce6d0dbb8c3047fb0dc2a337dc2aa860aadb3b0d3bc7a19f09d88012","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x01","gasLimit":"0x6691b7","gasUsed":"0x043bd6","timestamp":"0x5b75e6e8","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102f8806100606000396000f300608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100aa5780638da5cb5b146100d5578063fdacd5761461012c575b600080fd5b34801561007357600080fd5b506100a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610159565b005b3480156100b657600080fd5b506100bf610241565b6040518082815260200191505060405180910390f35b3480156100e157600080fd5b506100ea610247565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561013857600080fd5b506101576004803603810190808035906020019092919050505061026c565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023d578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561022457600080fd5b505af1158015610238573d6000803e3d6000fd5b505050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102c957806001819055505b505600a165627a7a72305820248859af1d09c2b1e0f445f0b5d9022e93fe3d74bd99f3328b20a491c951c1410029","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0xa04e60c48a756ddb94babf195ae4de2699515f0eb9b70b09221ec74ca7dea343"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!10 b/pkg/transformers/test_data/test_chain/!blocks!10 deleted file mode 100644 index 1b937f8d..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!10 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x61c5cb2a574755ca1bb146fe391418c638bb118b74fa456748cebad6f5565dd2","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0x3c8ffa547eb6fc72e5db76cbe3575136c1aa46cdb7d974e86d26ddf52aeffc6e","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000080000000040000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x0a","gasLimit":"0x6691b7","gasUsed":"0x027b55","timestamp":"0x5b75e6f4","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x","gasPrice":"0x01","gasLimit":"0x44aa20","to":"0x08cb6176addcca2e1d1ffe21bee464b72ee4cd8d","value":"0x","data":"0x351de6000000000000000000000000007340e006f4135ba6970d43bf43d88dcad4e7a8ca00000000000000000000000007fa9ef6609ca7921112231f8f195138ebba2977000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000","v":"0x1c","r":"0x","s":"0x","from":"0x64d922894153be9eef7b7218dc565d1d0ce2a092","hash":"0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!11 b/pkg/transformers/test_data/test_chain/!blocks!11 deleted file mode 100644 index 4526bd1f..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!11 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0xa4dc9cf47b1ac951d65d325778b2be463d13e50974d41afc2b5463f5dc6b5550","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0x48be751a35aa9113a4b007a39e012fbd05984958b811673256623eb1e0b2d463","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x0b","gasLimit":"0x6691b7","gasUsed":"0xa81e","timestamp":"0x5b75e6fd","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x01","gasPrice":"0x01","gasLimit":"0x44aa20","to":"0x38219779a699d67d7e7740b8c8f43d3e2dae2182","value":"0x","data":"0x815d245d66616b6520696c6b00000000000000000000000000000000000000000000000072617465000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032","v":"0x1c","r":"0x","s":"0x","from":"0x64d922894153be9eef7b7218dc565d1d0ce2a092","hash":"0x001b40cb161afd969df9f958665d25384bb0d3f12b59780458f81f9fe11c4464"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!12 b/pkg/transformers/test_data/test_chain/!blocks!12 deleted file mode 100644 index ff8647f8..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!12 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0xc95293bdd8a065d159347c1444656ffe4993ecd8e2108d00ba842f6b98821c1f","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0xa8e1de3e2a1305af70ac8d37e88888df7db23a75e44a5eb1f7da957cb254af85","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000001000000000000000000000000000001000000000000000010100000000000000000000000000000000000000000000000010000000000000000000000000000000000000040000000000000000000000000002020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000","difficulty":"0x","number":"0x0c","gasLimit":"0x6691b7","gasUsed":"0x019884","timestamp":"0x5b75e6fd","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x02","gasPrice":"0x01","gasLimit":"0x44aa20","to":"0xff3f2400f1600f3f493a9a92704a29b96795af1a","value":"0x","data":"0x5a984ded66616b6520696c6b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000","v":"0x1c","r":"0x","s":"0x","from":"0x64d922894153be9eef7b7218dc565d1d0ce2a092","hash":"0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!2 b/pkg/transformers/test_data/test_chain/!blocks!2 deleted file mode 100644 index 966a6edb..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!2 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x71f36ea384f3f25e317f6c4b5f889578811b77e710f9e7c1a75ed5e1cff13a65","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0x96a4cfbd7fbdfe5ae66bd6e9a07673a25c21b0561775ad9613e4a05b0c7f27a7","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x02","gasLimit":"0x6691b7","gasUsed":"0xa418","timestamp":"0x5b75e6e9","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x01","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0xfc0ba85028256ef48f5ba64dd65dc258988955f6","value":"0x","data":"0xfdacd5760000000000000000000000000000000000000000000000000000000000000001","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0xc0bdfdb15c288d6a7b0af865d953677c4818c6655d26631bd7b840e9cfb2d668"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!3 b/pkg/transformers/test_data/test_chain/!blocks!3 deleted file mode 100644 index 8e692212..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!3 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x56ba7ae1c6f7aaa74ae77f9613b43a5a50a7fad09f1fca42888e163fb34f0537","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0x7fb0f90f7cb04e7e00015bbf2ccb39c9efdce13b1272dd0b428faed488b05fde","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x03","gasLimit":"0x6691b7","gasUsed":"0x010cba","timestamp":"0x5b75e6e9","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x02","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x6080604052348015600f57600080fd5b50603580601d6000396000f3006080604052600080fd00a165627a7a72305820e87fe4eeacae18669e2102297afe663d59888094e838594e73a01821fc8d2a640029","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0xa8e605dfe8af972342126849910aa42ed1ce7df6b88230375628b48c54dfa146"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!4 b/pkg/transformers/test_data/test_chain/!blocks!4 deleted file mode 100644 index b32d1820..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!4 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x9a97cef69601c548306f2029e3e2059c02716eafa859f0f4eae08c23b5b78903","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0xb9bea21fee534e5d3a2efe93f17da081408739047e6491ea9058ec3b0b205326","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x04","gasLimit":"0x6691b7","gasUsed":"0x163f8b","timestamp":"0x5b75e6e9","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x03","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b506114d4806100206000396000f3006080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806311045bee146100d55780632424be5c1461015a57806327219087146101cd5780632d61a3551461023a5780636c25b346146102655780637cdd3fde146102bc578063815d245d14610317578063a4593c5214610360578063b65337df146103c5578063bb35783b14610420578063d9638d361461048d578063dc42e309146104d9578063ee8cd74814610504578063f059212a14610571575b600080fd5b3480156100e157600080fd5b506101586004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506105c8565b005b34801561016657600080fd5b506101a96004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610819565b60405180848152602001838152602001828152602001935050505060405180910390f35b3480156101d957600080fd5b50610238600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610850565b005b34801561024657600080fd5b5061024f610abc565b6040518082815260200191505060405180910390f35b34801561027157600080fd5b506102a6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac2565b6040518082815260200191505060405180910390f35b3480156102c857600080fd5b506103156004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ada565b005b34801561032357600080fd5b5061035e6004803603810190808035600019169060200190929190803560001916906020019092919080359060200190929190505050610c0e565b005b34801561036c57600080fd5b506103c36004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050610c63565b005b3480156103d157600080fd5b5061041e6004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ec7565b005b34801561042c57600080fd5b5061048b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611077565b005b34801561049957600080fd5b506104bc6004803603810190808035600019169060200190929190505050611097565b604051808381526020018281526020019250505060405180910390f35b3480156104e557600080fd5b506104ee6110bb565b6040518082815260200191505060405180910390f35b34801561051057600080fd5b5061056f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110c1565b005b34801561057d57600080fd5b506105b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061139d565b6040518082815260200191505060405180910390f35b60008060036000886000191660001916815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060026000886000191660001916815260200190815260200160002090506106508260010154856113b5565b82600101819055506106668260020154846113b5565b826002018190555061067c8160010154846113b5565b81600101819055506106da600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106d58360000154866113f6565b611462565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107366005546107318360000154866113f6565b611462565b6005819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8308661076d8460000154876113f6565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f6772616200000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a150505050505050565b6003602052816000526040600020602052806000526040600020600091509150508060000154908060010154908060020154905083565b6000610868826b033b2e3c9fd0803ce80000006113f6565b90506108b26000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611462565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061093c6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826113b5565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f25e802ca4c681361b4e886aa3337404f6931451d42a314f69f9381f483b4020b848483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a160008060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412158015610aab575060008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412155b1515610ab657600080fd5b50505050565b60055481565b60006020528060005260406000206000915090505481565b610b3f60036000856000191660001916815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154826113b5565b60036000856000191660001916815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600060036000856000191660001916815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015412151515610c0957600080fd5b505050565b7f726174650000000000000000000000000000000000000000000000000000000082600019161415610c5e5780600260008560001916600019168152602001908152602001600020600001819055505b505050565b60008060036000876000191660001916815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091506002600087600019166000191681526020019081526020016000209050610ceb826000015485611462565b8260000181905550610d018260010154856113b5565b8260010181905550610d178260020154846113b5565b8260020181905550610d2d8160010154846113b5565b8160010181905550610d8a6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d858360000154866113f6565b6113b5565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610de5600454610de08360000154866113f6565b6113b5565b6004819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b83086610e1c8460000154876113f6565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f74756e6500000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a1505050505050565b6000806002600086600019166000191681526020019081526020016000209150610ef58260000154846113b5565b8260000181905550610f0b8260010154846113f6565b9050610f556000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826113b5565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fa3600454826113b5565b6004819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8308583604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f666f6c6400000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a15050505050565b6000811215151561108757600080fd5b611092838383610850565b505050565b60026020528060005260406000206000915090508060000154908060010154905082565b60045481565b60006110d9826b033b2e3c9fd0803ce80000006113f6565b9050611124600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611462565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111af6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611462565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111fd60055482611462565b60058190555061120f60045482611462565b6004819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8308483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f6865616c00000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a16000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541215801561136b575060008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412155b151561137657600080fd5b60006005541215801561138c5750600060045412155b151561139757600080fd5b50505050565b60016020528060005260406000206000915090505481565b600081830190506000821315806113cb57508281135b15156113d657600080fd5b6000821215806113e557508281125b15156113f057600080fd5b92915050565b6000818302905060008212158061142d57507f80000000000000000000000000000000000000000000000000000000000000008314155b151561143857600080fd5b6000821480611451575082828281151561144e57fe5b05145b151561145c57600080fd5b92915050565b60007f8000000000000000000000000000000000000000000000000000000000000000821415151561149357600080fd5b6114a083836000036113b5565b9050929150505600a165627a7a72305820fe3b4cc787b56823b0000494bdc149bd06182ff3067aff805573ec2791616c630029","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x8956d8bdced261516039ea57abcfaaa71bbd770886afa1d3e6ac2e5b65bc6293"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!5 b/pkg/transformers/test_data/test_chain/!blocks!5 deleted file mode 100644 index 31a43ead..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!5 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0xe6c87e0c062c3544efe2e9f7d0ed346abd16b0ed27fcfd8dfddab878bc34c085","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0xe9b9ea49eb759376e9b3311f8f50b0c48eb722b83adf0b99368624f2716011db","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x05","gasLimit":"0x6691b7","gasUsed":"0x6980","timestamp":"0x5b75e6ea","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x04","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0xfc0ba85028256ef48f5ba64dd65dc258988955f6","value":"0x","data":"0xfdacd5760000000000000000000000000000000000000000000000000000000000000002","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x2194da14a0d4be36fb809efd3f9f426bf60842dbf244788d0a84b894b3e6bd49"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!6 b/pkg/transformers/test_data/test_chain/!blocks!6 deleted file mode 100644 index 28cc0f67..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!6 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x903a879c68f1485576c44d211ceb42e7dc0ad30e33f08fad8578384c334d9254","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0xd44519568c01afd79cb7ddd8417238739c5aaeebc833c81e0169ffd81eb32117","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x06","gasLimit":"0x6691b7","gasUsed":"0x0c03ca","timestamp":"0x5b75e6ea","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x05","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b50604051602080610ae783398101806040528101908080519060200190929190505050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600260006101000a81548160ff02191690831515021790555050610a498061009e6000396000f300608060405260043610610083576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806336569e77146100885780635a984ded146100df578063815d245d14610124578063957aa58c1461016d5780639be856111461019c578063babe8a3f146101d7578063d9638d3614610202575b600080fd5b34801561009457600080fd5b5061009d61024e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100eb57600080fd5b5061012260048036038101908080356000191690602001909291908035906020019092919080359060200190929190505050610273565b005b34801561013057600080fd5b5061016b60048036038101908080356000191690602001909291908035600019169060200190929190803590602001909291905050506107f9565b005b34801561017957600080fd5b506101826108f5565b604051808215151515815260200191505060405180910390f35b3480156101a857600080fd5b506101d5600480360381019080803560001916906020019092919080359060200190929190505050610908565b005b3480156101e357600080fd5b506101ec610987565b6040518082815260200191505060405180910390f35b34801561020e57600080fd5b50610231600480360381019080803560001916906020019092919050505061098d565b604051808381526020018281526020019250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000806000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a4593c528e338f8f6040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018085600019166000191681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050600060405180830381600087803b15801561035e57600080fd5b505af1158015610372573d6000803e3d6000fd5b50505050600360008e6000191660001916815260200190815260200160002099506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d368e6040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600019166000191681526020019150506040805180830381600087803b15801561042a57600080fd5b505af115801561043e573d6000803e3d6000fd5b505050506040513d604081101561045457600080fd5b810190808051906020019092919080519060200190929190505050985098506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632424be5c8e336040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600019166000191681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050606060405180830381600087803b15801561053f57600080fd5b505af1158015610553573d6000803e3d6000fd5b505050506040513d606081101561056957600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509650965096506105c8600360008f60001916600019168152602001908152602001600020600101546b033b2e3c9fd0803ce80000006109b1565b6105d2898b6109b1565b131580156106b557506105f36001546b033b2e3c9fd0803ce80000006109b1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc42e3096040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561067857600080fd5b505af115801561068c573d6000803e3d6000fd5b505050506040513d60208110156106a257600080fd5b8101908080519060200190929190505050125b935060008b1315925060008c121591506106cf858a6109b1565b6106dd878c600001546109b1565b1215905083806106ea5750825b801561070457508280156106fb5750815b806107035750805b5b801561071c5750600260009054906101000a900460ff165b151561072757600080fd5b6000891415151561073757600080fd5b7f6cedf1d3a466a3d6bab04887b1642177bf6dbf1daa737c2e8f639cd0b020d9d08d33898f8f8b8b426040518089600019166000191681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018581526020018481526020018381526020018265ffffffffffff1665ffffffffffff1681526020019850505050505050505060405180910390a150505050505050505050505050565b7f73706f7400000000000000000000000000000000000000000000000000000000826000191614156108495780600360008560001916600019168152602001908152602001600020600001819055505b7f6c696e6500000000000000000000000000000000000000000000000000000000826000191614156108995780600360008560001916600019168152602001908152602001600020600101819055505b7fb80446ca592fac4d11848fd8a1aeb8b3de78791ab4079c424db00ed4547bb8768383836040518084600019166000191681526020018360001916600019168152602001828152602001935050505060405180910390a1505050565b600260009054906101000a900460ff1681565b7f4c696e65000000000000000000000000000000000000000000000000000000008260001916141561093c57806001819055505b7f134b2912c1a5fbb942de04eb642d59a9b018427189818dd7c3ff65b7f948562e82826040518083600019166000191681526020018281526020019250505060405180910390a15050565b60015481565b60036020528060005260406000206000915090508060000154908060010154905082565b600081830290506000821215806109e857507f80000000000000000000000000000000000000000000000000000000000000008314155b15156109f357600080fd5b6000821480610a0c5750828282811515610a0957fe5b05145b1515610a1757600080fd5b929150505600a165627a7a72305820b9361d759877e537db2973b3e90840aa1c75fc76091f3ec71f9b249aff4251e6002900000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae2182","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x99eafa867c60105b21589ad055bd60c567482d9b532b926978236477bb34a1db"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!7 b/pkg/transformers/test_data/test_chain/!blocks!7 deleted file mode 100644 index 24508676..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!7 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x6803ff793873c6143a8e1734584ea759b2b3fdb8a13a1cb023c6d0822e650aa1","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0x1daf92424a9e4f706bb9234b6fb02fb4329318278fd032617e1786f2ccf66e3e","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x07","gasLimit":"0x6691b7","gasUsed":"0x10828a","timestamp":"0x5b75e6ea","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x06","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b50610f5c806100206000396000f3006080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305db45381461010157806307a832b41461012c5780630e01198b14610157578063143e55e0146101825780632506855a146101bd57806329ae8114146101ea5780632a1d2b3c1461022557806335aee16f1461025057806349dd5bb21461028557806353cb8def146102b057806364bd7013146102db578063697efb78146103065780637f49edc4146103335780639361266c1461037c578063bbbb0d7b146103a7578063d0adc35f146103d2578063d4e8be83146103fd578063f37ac61c1461044e575b600080fd5b34801561010d57600080fd5b5061011661047b565b6040518082815260200191505060405180910390f35b34801561013857600080fd5b5061014161049b565b6040518082815260200191505060405180910390f35b34801561016357600080fd5b5061016c6105b0565b6040518082815260200191505060405180910390f35b34801561018e57600080fd5b50610197610706565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b3480156101c957600080fd5b506101e86004803603810190808035906020019092919050505061070e565b005b3480156101f657600080fd5b50610223600480360381019080803560001916906020019092919080359060200190929190505050610864565b005b34801561023157600080fd5b5061023a610917565b6040518082815260200191505060405180910390f35b34801561025c57600080fd5b50610283600480360381019080803565ffffffffffff16906020019092919050505061091d565b005b34801561029157600080fd5b5061029a6109b3565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c56109b9565b6040518082815260200191505060405180910390f35b3480156102e757600080fd5b506102f06109bf565b6040518082815260200191505060405180910390f35b34801561031257600080fd5b50610331600480360381019080803590602001909291905050506109c5565b005b34801561033f57600080fd5b50610366600480360381019080803565ffffffffffff169060200190929190505050610a3c565b6040518082815260200191505060405180910390f35b34801561038857600080fd5b50610391610a54565b6040518082815260200191505060405180910390f35b3480156103b357600080fd5b506103bc610a5a565b6040518082815260200191505060405180910390f35b3480156103de57600080fd5b506103e7610bdc565b6040518082815260200191505060405180910390f35b34801561040957600080fd5b5061044c6004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be2565b005b34801561045a57600080fd5b5061047960048036038101908080359060200190929190505050610da2565b005b600061049661048e600454600554610ef8565b600654610ef8565b905090565b60006b033b2e3c9fd0803ce80000006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636c25b346306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561056657600080fd5b505af115801561057a573d6000803e3d6000fd5b505050506040513d602081101561059057600080fd5b81019080805190602001909291905050508115156105aa57fe5b04905090565b60006105d06105c86105c061047b565b600854610ef8565b600954610ef8565b6105d861049b565b101515156105e557600080fd5b60006005541415156105f657600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b7e9cd243060085460006040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b1580156106c657600080fd5b505af11580156106da573d6000803e3d6000fd5b505050506040513d60208110156106f057600080fd5b8101908080519060200190929190505050905090565b600042905090565b6006548111158015610727575061072361049b565b8111155b8015610734575060008112155b151561073f57600080fd5b61074b60065482610f14565b6006819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee8cd7483030846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561084957600080fd5b505af115801561085d573d6000803e3d6000fd5b5050505050565b7f6c756d70000000000000000000000000000000000000000000000000000000008260001916141561089857806008819055505b7f7061640000000000000000000000000000000000000000000000000000000000826000191614156108cc57806009819055505b7f8a9b1ca0a6295c2e892a579edd3076c4914c2a82a4d5caab9420945c64c7fe4182826040518083600019166000191681526020018281526020019250505060405180910390a15050565b60065481565b61094c600454600360008465ffffffffffff1665ffffffffffff16815260200190815260200160002054610f14565b600481905550610981600554600360008465ffffffffffff1665ffffffffffff16815260200190815260200160002054610ef8565b6005819055506000600360008365ffffffffffff1665ffffffffffff1681526020019081526020016000208190555050565b60055481565b60085481565b60075481565b6109f9600360006109d4610706565b65ffffffffffff1665ffffffffffff1681526020019081526020016000205482610ef8565b60036000610a05610706565b65ffffffffffff1665ffffffffffff16815260200190815260200160002081905550610a3360045482610ef8565b60048190555050565b60036020528060005260406000206000915090505481565b60095481565b600060085460055410151515610a6f57600080fd5b6000610a7961049b565b141515610a8557600080fd5b610a93600554600854610f14565b600581905550610aa7600654600854610ef8565b600681905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b7e9cd24307fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6008546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b158015610b9c57600080fd5b505af1158015610bb0573d6000803e3d6000fd5b505050506040513d6020811015610bc657600080fd5b8101908080519060200190929190505050905090565b60045481565b7f666c61700000000000000000000000000000000000000000000000000000000082600019161415610c505780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7f666c6f700000000000000000000000000000000000000000000000000000000082600019161415610cbe5780600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7f766174000000000000000000000000000000000000000000000000000000000082600019161415610d2b57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7fa8113be4b615eb027dc9305f13990b41b39a3fcb82bf872ce96a40827831e4d182826040518083600019166000191681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b610daa61049b565b8111158015610dbb57506005548111155b8015610dc8575060008112155b1515610dd357600080fd5b610ddf60055482610f14565b6005819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee8cd7483030846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610edd57600080fd5b505af1158015610ef1573d6000803e3d6000fd5b5050505050565b60008183019050828110151515610f0e57600080fd5b92915050565b60008183039050828111151515610f2a57600080fd5b929150505600a165627a7a7230582072b3db6bacdfa5af0372b289ff3a98ea4ee2d522a25b03c7669d2fccd135abde0029","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x5b37b7a5bd08efac0e4bb3ac507761a8f13a87176eabb20301e223c74f587434"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!8 b/pkg/transformers/test_data/test_chain/!blocks!8 deleted file mode 100644 index 79af321e..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!8 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x6151d2ee962c0182b8d259362d9c84a7f11bf0f1f3f9113e88f23cc80e6e5a24","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0x65455aec5f2e81c82c26a1e0484d57985264872776eb895656179b208be6451b","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x08","gasLimit":"0x6691b7","gasUsed":"0x0e3275","timestamp":"0x5b75e6ea","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x07","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b50604051602080610d0883398101806040528101908080519060200190929190505050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610c85806100836000396000f3006080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b3146100b457806318160ddd1461011957806323b872dd1461014457806336569e77146101c957806370a0823114610220578063a9059cbb14610277578063b753a98c146102dc578063bb35783b14610329578063daea85c514610396578063dd62ed3e146103d9578063f2d5d56b14610450575b600080fd5b3480156100c057600080fd5b506100ff600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061049d565b604051808215151515815260200191505060405180910390f35b34801561012557600080fd5b5061012e6105f4565b6040518082815260200191505060405180910390f35b34801561015057600080fd5b506101af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d2565b604051808215151515815260200191505060405180910390f35b3480156101d557600080fd5b506101de610a81565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022c57600080fd5b50610261600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa6565b6040518082815260200191505060405180910390f35b34801561028357600080fd5b506102c2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bbd565b604051808215151515815260200191505060405180910390f35b3480156102e857600080fd5b50610327600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd5565b005b34801561033557600080fd5b50610394600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610be5565b005b3480156103a257600080fd5b506103d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf6565b005b3480156103e557600080fd5b5061043a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c24565b6040518082815260200191505060405180910390f35b34801561045c57600080fd5b5061049b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c49565b005b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055507f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92533847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8502604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16001905092915050565b60006b033b2e3c9fd0803ce80000006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc42e3096040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561068857600080fd5b505af115801561069c573d6000803e3d6000fd5b505050506040513d60208110156106b257600080fd5b81019080805190602001909291905050508115156106cc57fe5b04905090565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156107ac57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b156108c75781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561083c57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b8585856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b1580156109bf57600080fd5b505af11580156109d3573d6000803e3d6000fd5b505050507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1600190509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006b033b2e3c9fd0803ce80000006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636c25b346846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610b7157600080fd5b505af1158015610b85573d6000803e3d6000fd5b505050506040513d6020811015610b9b57600080fd5b8101908080519060200190929190505050811515610bb557fe5b049050919050565b6000610bca3384846106d2565b506001905092915050565b610be03383836106d2565b505050565b610bf08383836106d2565b50505050565b610c20817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61049d565b5050565b6001602052816000526040600020602052806000526040600020600091509150505481565b610c548233836106d2565b5050505600a165627a7a723058205ba33f32f961d260de79eb9763f7cd5ff7ac88d18cba75e66216d72317a5709b002900000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae2182","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0xa18a1a6c0f6dffd28c90aaaf6d822a206797367ee094ebcf0ee003f52c812f02"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!9 b/pkg/transformers/test_data/test_chain/!blocks!9 deleted file mode 100644 index 77007e52..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!9 +++ /dev/null @@ -1 +0,0 @@ -{"header":{"parentHash":"0x1faae5bf0d78e3d8cc018d2e87db91d0e1e64edc1e69e2ef1dd8caec3afec93c","uncleHash":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","coinbase":"0x0000000000000000000000000000000000000000","stateRoot":"0x19abe03cab8ad9d724d76a8a409f5c7f02f48d24f48aaab91fbd8f0af1ab25d8","transactionsTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptTrie":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x","number":"0x09","gasLimit":"0x6691b7","gasUsed":"0x1df816","timestamp":"0x5b75e6ea","extraData":"0x","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x"},"transactions":[{"nonce":"0x08","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x6080604052670e92596fd6290000600255612a30600360006101000a81548165ffffffffffff021916908365ffffffffffff16021790555062093a80600360066101000a81548165ffffffffffff021916908365ffffffffffff16021790555034801561006b57600080fd5b50604051604080611bb483398101806040528101908080519060200190929190805190602001909291905050508060018160001916905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050611ac0806100f46000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063143e55e0146100ca578063351de6001461010557806336569e771461019a5780634423c5f1146101f15780634b43ed12146103075780634e8b1dd5146103485780635ff3a382146103835780637d780d82146103c4578063c5ce281e146103ef578063c959c42b14610422578063cfc4af551461044f578063cfdd33021461048a578063fc7b6aee146104b5575b600080fd5b3480156100d657600080fd5b506100df6104e2565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b34801561011157600080fd5b50610184600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001909291905050506104ea565b6040518082815260200191505060405180910390f35b3480156101a657600080fd5b506101af6108ae565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101fd57600080fd5b5061021c600480360381019080803590602001909291905050506108d3565b604051808981526020018881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018665ffffffffffff1665ffffffffffff1681526020018565ffffffffffff1665ffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019850505050505050505060405180910390f35b34801561031357600080fd5b5061034660048036038101908080359060200190929190803590602001909291908035906020019092919050505061099f565b005b34801561035457600080fd5b5061035d610ffd565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b34801561038f57600080fd5b506103c2600480360381019080803590602001909291908035906020019092919080359060200190929190505050611015565b005b3480156103d057600080fd5b506103d961161a565b6040518082815260200191505060405180910390f35b3480156103fb57600080fd5b50610404611620565b60405180826000191660001916815260200191505060405180910390f35b34801561042e57600080fd5b5061044d60048036038101908080359060200190929190505050611626565b005b34801561045b57600080fd5b50610464611961565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b34801561049657600080fd5b5061049f611979565b6040518082815260200191505060405180910390f35b3480156104c157600080fd5b506104e06004803603810190808035906020019092919050505061197f565b005b600042905090565b6000806004600081546001019190508190559050826005600083815260200190815260200160002060000181905550836005600083815260200190815260200160002060010181905550336005600083815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360069054906101000a900465ffffffffffff166105a66104e2565b0160056000838152602001908152602001600020600201601a6101000a81548165ffffffffffff021916908365ffffffffffff160217905550866005600083815260200190815260200160002060030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550856005600083815260200190815260200160002060040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460056000838152602001908152602001600020600501819055507f8828a22eb6a18623309ad55592866c4b077989e9e8a25e1b85f9bf6f7282520f816000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166001548787338c600560008a8152602001908152602001600020600201601a9054906101000a900465ffffffffffff166107206104e2565b600560008c815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560008d815260200190815260200160002060050154604051808c81526020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a600019166000191681526020018981526020018881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018565ffffffffffff1665ffffffffffff1681526020018465ffffffffffff1665ffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019b50505050505050505050505060405180910390a18091505095945050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60056020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160149054906101000a900465ffffffffffff169080600201601a9054906101000a900465ffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060050154905088565b60006005600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156109fb57600080fd5b610a036104e2565b65ffffffffffff166005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff161180610a78575060006005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff16145b1515610a8357600080fd5b610a8b6104e2565b65ffffffffffff1660056000858152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff16111515610ad057600080fd5b600560008481526020019081526020016000206001015482141515610af457600080fd5b60056000848152602001908152602001600020600501548111151515610b1957600080fd5b600560008481526020019081526020016000206000015481111515610b3d57600080fd5b610b5f6002546005600086815260200190815260200160002060000154611a64565b610b7182670de0b6b3a7640000611a64565b101580610b935750600560008481526020019081526020016000206005015481145b1515610b9e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b336005600087815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660056000888152602001908152602001600020600001546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610ce257600080fd5b505af1158015610cf6573d6000803e3d6000fd5b505050506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b336005600087815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560008881526020019081526020016000206000015485036040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610e4057600080fd5b505af1158015610e54573d6000803e3d6000fd5b50505050336005600085815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806005600085815260200190815260200160002060000181905550600360009054906101000a900465ffffffffffff16610ee56104e2565b016005600085815260200190815260200160002060020160146101000a81548165ffffffffffff021916908365ffffffffffff1602179055507fd4aef477d7912041a69c5b85f2d78b618c76e40a4a92b91122c85ab5b404a64a838383336005600089815260200190815260200160002060020160149054906101000a900465ffffffffffff16610f746104e2565b604051808781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018365ffffffffffff1665ffffffffffff1681526020018265ffffffffffff1665ffffffffffff168152602001965050505050505060405180910390a1505050565b600360009054906101000a900465ffffffffffff1681565b60006005600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561107157600080fd5b6110796104e2565b65ffffffffffff166005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff1611806110ee575060006005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff16145b15156110f957600080fd5b6111016104e2565b65ffffffffffff1660056000858152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff1611151561114657600080fd5b60056000848152602001908152602001600020600001548114151561116a57600080fd5b60056000848152602001908152602001600020600501548114151561118e57600080fd5b6005600084815260200190815260200160002060010154821015156111b257600080fd5b6111da6005600085815260200190815260200160002060010154670de0b6b3a7640000611a64565b6111e660025484611a64565b111515156111f357600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b336005600087815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561132157600080fd5b505af1158015611335573d6000803e3d6000fd5b505050506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637cdd3fde6001546005600087815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856005600089815260200190815260200160002060010154036040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561145d57600080fd5b505af1158015611471573d6000803e3d6000fd5b50505050336005600085815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816005600085815260200190815260200160002060010181905550600360009054906101000a900465ffffffffffff166115026104e2565b016005600085815260200190815260200160002060020160146101000a81548165ffffffffffff021916908365ffffffffffff1602179055507f380cb3bf83f57ec05d0229938aeb5d4fba1de0228097701d1c03379c88cec5d4838383336005600089815260200190815260200160002060020160149054906101000a900465ffffffffffff166115916104e2565b604051808781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018365ffffffffffff1665ffffffffffff1681526020018265ffffffffffff1665ffffffffffff168152602001965050505050505060405180910390a1505050565b60025481565b60015481565b61162e6104e2565b65ffffffffffff166005600083815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff161080156116a5575060006005600083815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff1614155b806116ee57506116b36104e2565b65ffffffffffff1660056000838152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff16105b15156116f957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637cdd3fde6001546005600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660056000868152602001908152602001600020600101546040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561181b57600080fd5b505af115801561182f573d6000803e3d6000fd5b505050506005600082815260200190815260200160002060008082016000905560018201600090556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160146101000a81549065ffffffffffff021916905560028201601a6101000a81549065ffffffffffff02191690556003820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556004820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600582016000905550507f9b83ce9ac5e3a4e55a5b95c0e529b8cbe35d29682e2d851f51dd4e0bf9a6d3d1816119326104e2565b604051808381526020018265ffffffffffff1665ffffffffffff1681526020019250505060405180910390a150565b600360069054906101000a900465ffffffffffff1681565b60045481565b6119876104e2565b65ffffffffffff1660056000838152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff161015156119cc57600080fd5b60006005600083815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff16141515611a0b57600080fd5b600360069054906101000a900465ffffffffffff16611a286104e2565b0160056000838152602001908152602001600020600201601a6101000a81548165ffffffffffff021916908365ffffffffffff16021790555050565b600080821480611a8357508282838502925082811515611a8057fe5b04145b1515611a8e57600080fd5b929150505600a165627a7a72305820be360886965ff94b58c48a287326520577aeb8e46a36d2c7f0ea9c040eaa9dbe002900000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae218266616b6520696c6b000000000000000000000000000000000000000000000000","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x30e1e9cb6ee8d98c1fbe6b7ca89d53034c0607b1298226fcd28f774df6f1b09d"}],"uncleHeaders":[]} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!blocks!length b/pkg/transformers/test_data/test_chain/!blocks!length deleted file mode 100644 index ca7bf83a..00000000 --- a/pkg/transformers/test_data/test_chain/!blocks!length +++ /dev/null @@ -1 +0,0 @@ -13 \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x001b40cb161afd969df9f958665d25384bb0d3f12b59780458f81f9fe11c4464 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0x001b40cb161afd969df9f958665d25384bb0d3f12b59780458f81f9fe11c4464 deleted file mode 100644 index 3eabb650..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x001b40cb161afd969df9f958665d25384bb0d3f12b59780458f81f9fe11c4464 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0x001b40cb161afd969df9f958665d25384bb0d3f12b59780458f81f9fe11c4464","transactionIndex":"0x0","blockHash":"0xc95293bdd8a065d159347c1444656ffe4993ecd8e2108d00ba842f6b98821c1f","blockNumber":"0xb","gasUsed":"0xa81e","cumulativeGasUsed":"0xa81e","contractAddress":null,"logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x2194da14a0d4be36fb809efd3f9f426bf60842dbf244788d0a84b894b3e6bd49 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0x2194da14a0d4be36fb809efd3f9f426bf60842dbf244788d0a84b894b3e6bd49 deleted file mode 100644 index 93d68d5e..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x2194da14a0d4be36fb809efd3f9f426bf60842dbf244788d0a84b894b3e6bd49 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0x2194da14a0d4be36fb809efd3f9f426bf60842dbf244788d0a84b894b3e6bd49","transactionIndex":"0x0","blockHash":"0x903a879c68f1485576c44d211ceb42e7dc0ad30e33f08fad8578384c334d9254","blockNumber":"0x5","gasUsed":"0x6980","cumulativeGasUsed":"0x6980","contractAddress":null,"logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x30e1e9cb6ee8d98c1fbe6b7ca89d53034c0607b1298226fcd28f774df6f1b09d b/pkg/transformers/test_data/test_chain/!transactionReceipts!0x30e1e9cb6ee8d98c1fbe6b7ca89d53034c0607b1298226fcd28f774df6f1b09d deleted file mode 100644 index 47257e17..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x30e1e9cb6ee8d98c1fbe6b7ca89d53034c0607b1298226fcd28f774df6f1b09d +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0x30e1e9cb6ee8d98c1fbe6b7ca89d53034c0607b1298226fcd28f774df6f1b09d","transactionIndex":"0x0","blockHash":"0x61c5cb2a574755ca1bb146fe391418c638bb118b74fa456748cebad6f5565dd2","blockNumber":"0x9","gasUsed":"0x1df816","cumulativeGasUsed":"0x1df816","contractAddress":"0x08cb6176addcca2e1d1ffe21bee464b72ee4cd8d","logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x5b37b7a5bd08efac0e4bb3ac507761a8f13a87176eabb20301e223c74f587434 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0x5b37b7a5bd08efac0e4bb3ac507761a8f13a87176eabb20301e223c74f587434 deleted file mode 100644 index bd87c3b2..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x5b37b7a5bd08efac0e4bb3ac507761a8f13a87176eabb20301e223c74f587434 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0x5b37b7a5bd08efac0e4bb3ac507761a8f13a87176eabb20301e223c74f587434","transactionIndex":"0x0","blockHash":"0x6151d2ee962c0182b8d259362d9c84a7f11bf0f1f3f9113e88f23cc80e6e5a24","blockNumber":"0x7","gasUsed":"0x10828a","cumulativeGasUsed":"0x10828a","contractAddress":"0x76189df410263ad1d9fe2f4af2eab3d24f1b6f41","logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191 deleted file mode 100644 index e8b1300e..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191","transactionIndex":"0x0","blockHash":"0xa4dc9cf47b1ac951d65d325778b2be463d13e50974d41afc2b5463f5dc6b5550","blockNumber":"0xa","gasUsed":"0x27b55","cumulativeGasUsed":"0x27b55","contractAddress":null,"logs":[{"logIndex":"0x0","transactionIndex":"0x0","transactionHash":"0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191","blockHash":"0xa4dc9cf47b1ac951d65d325778b2be463d13e50974d41afc2b5463f5dc6b5550","blockNumber":"0xa","address":"0x08cb6176addcca2e1d1ffe21bee464b72ee4cd8d","data":"0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae218266616b6520696c6b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a09200000000000000000000000007fa9ef6609ca7921112231f8f195138ebba2977000000000000000000000000000000000000000000000000000000005b7f2174000000000000000000000000000000000000000000000000000000005b75e6f40000000000000000000000007340e006f4135ba6970d43bf43d88dcad4e7a8ca0000000000000000000000000000000000000000000000000000000000000032","topics":["0x8828a22eb6a18623309ad55592866c4b077989e9e8a25e1b85f9bf6f7282520f"],"type":"mined"}],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000080000000040000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x8956d8bdced261516039ea57abcfaaa71bbd770886afa1d3e6ac2e5b65bc6293 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0x8956d8bdced261516039ea57abcfaaa71bbd770886afa1d3e6ac2e5b65bc6293 deleted file mode 100644 index ee7747fe..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x8956d8bdced261516039ea57abcfaaa71bbd770886afa1d3e6ac2e5b65bc6293 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0x8956d8bdced261516039ea57abcfaaa71bbd770886afa1d3e6ac2e5b65bc6293","transactionIndex":"0x0","blockHash":"0xe6c87e0c062c3544efe2e9f7d0ed346abd16b0ed27fcfd8dfddab878bc34c085","blockNumber":"0x4","gasUsed":"0x163f8b","cumulativeGasUsed":"0x163f8b","contractAddress":"0x38219779a699d67d7e7740b8c8f43d3e2dae2182","logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x99eafa867c60105b21589ad055bd60c567482d9b532b926978236477bb34a1db b/pkg/transformers/test_data/test_chain/!transactionReceipts!0x99eafa867c60105b21589ad055bd60c567482d9b532b926978236477bb34a1db deleted file mode 100644 index 38bde70d..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0x99eafa867c60105b21589ad055bd60c567482d9b532b926978236477bb34a1db +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0x99eafa867c60105b21589ad055bd60c567482d9b532b926978236477bb34a1db","transactionIndex":"0x0","blockHash":"0x6803ff793873c6143a8e1734584ea759b2b3fdb8a13a1cb023c6d0822e650aa1","blockNumber":"0x6","gasUsed":"0xc03ca","cumulativeGasUsed":"0xc03ca","contractAddress":"0xff3f2400f1600f3f493a9a92704a29b96795af1a","logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xa04e60c48a756ddb94babf195ae4de2699515f0eb9b70b09221ec74ca7dea343 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0xa04e60c48a756ddb94babf195ae4de2699515f0eb9b70b09221ec74ca7dea343 deleted file mode 100644 index 39cdb2ed..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xa04e60c48a756ddb94babf195ae4de2699515f0eb9b70b09221ec74ca7dea343 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0xa04e60c48a756ddb94babf195ae4de2699515f0eb9b70b09221ec74ca7dea343","transactionIndex":"0x0","blockHash":"0x71f36ea384f3f25e317f6c4b5f889578811b77e710f9e7c1a75ed5e1cff13a65","blockNumber":"0x1","gasUsed":"0x43bd6","cumulativeGasUsed":"0x43bd6","contractAddress":"0xfc0ba85028256ef48f5ba64dd65dc258988955f6","logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xa18a1a6c0f6dffd28c90aaaf6d822a206797367ee094ebcf0ee003f52c812f02 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0xa18a1a6c0f6dffd28c90aaaf6d822a206797367ee094ebcf0ee003f52c812f02 deleted file mode 100644 index 9711c9f4..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xa18a1a6c0f6dffd28c90aaaf6d822a206797367ee094ebcf0ee003f52c812f02 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0xa18a1a6c0f6dffd28c90aaaf6d822a206797367ee094ebcf0ee003f52c812f02","transactionIndex":"0x0","blockHash":"0x1faae5bf0d78e3d8cc018d2e87db91d0e1e64edc1e69e2ef1dd8caec3afec93c","blockNumber":"0x8","gasUsed":"0xe3275","cumulativeGasUsed":"0xe3275","contractAddress":"0x7dbda851034713f899a122f95860eaf707b9f833","logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xa8e605dfe8af972342126849910aa42ed1ce7df6b88230375628b48c54dfa146 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0xa8e605dfe8af972342126849910aa42ed1ce7df6b88230375628b48c54dfa146 deleted file mode 100644 index 0d8f5bab..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xa8e605dfe8af972342126849910aa42ed1ce7df6b88230375628b48c54dfa146 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0xa8e605dfe8af972342126849910aa42ed1ce7df6b88230375628b48c54dfa146","transactionIndex":"0x0","blockHash":"0x9a97cef69601c548306f2029e3e2059c02716eafa859f0f4eae08c23b5b78903","blockNumber":"0x3","gasUsed":"0x10cba","cumulativeGasUsed":"0x10cba","contractAddress":"0xa970ed54e41d9db6d91db5e7ff7a9451dad98993","logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9 deleted file mode 100644 index c114ad9a..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9","transactionIndex":"0x0","blockHash":"0x8fbe0d8442f58c843bd8003e93f2b100c81f2b57e5a339fea6d8de9bee764afa","blockNumber":"0xc","gasUsed":"0x19884","cumulativeGasUsed":"0x19884","contractAddress":null,"logs":[{"logIndex":"0x0","transactionIndex":"0x0","transactionHash":"0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9","blockHash":"0x8fbe0d8442f58c843bd8003e93f2b100c81f2b57e5a339fea6d8de9bee764afa","blockNumber":"0xc","address":"0x38219779a699d67d7e7740b8c8f43d3e2dae2182","data":"0x00000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae218200000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092000000000000000000000000000000000000000000000000000000000000000074756e6500000000000000000000000000000000000000000000000000000000","topics":["0xd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8"],"type":"mined"},{"logIndex":"0x1","transactionIndex":"0x0","transactionHash":"0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9","blockHash":"0x8fbe0d8442f58c843bd8003e93f2b100c81f2b57e5a339fea6d8de9bee764afa","blockNumber":"0xc","address":"0xff3f2400f1600f3f493a9a92704a29b96795af1a","data":"0x66616b6520696c6b00000000000000000000000000000000000000000000000000000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b75e6fd","topics":["0x6cedf1d3a466a3d6bab04887b1642177bf6dbf1daa737c2e8f639cd0b020d9d0"],"type":"mined"}],"status":"0x1","logsBloom":"0x00000000000000000000001000000000000000000000000000001000000000000000010100000000000000000000000000000000000000000000000010000000000000000000000000000000000000040000000000000000000000000002020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xc0bdfdb15c288d6a7b0af865d953677c4818c6655d26631bd7b840e9cfb2d668 b/pkg/transformers/test_data/test_chain/!transactionReceipts!0xc0bdfdb15c288d6a7b0af865d953677c4818c6655d26631bd7b840e9cfb2d668 deleted file mode 100644 index ae1e2ad5..00000000 --- a/pkg/transformers/test_data/test_chain/!transactionReceipts!0xc0bdfdb15c288d6a7b0af865d953677c4818c6655d26631bd7b840e9cfb2d668 +++ /dev/null @@ -1 +0,0 @@ -{"transactionHash":"0xc0bdfdb15c288d6a7b0af865d953677c4818c6655d26631bd7b840e9cfb2d668","transactionIndex":"0x0","blockHash":"0x56ba7ae1c6f7aaa74ae77f9613b43a5a50a7fad09f1fca42888e163fb34f0537","blockNumber":"0x2","gasUsed":"0xa418","cumulativeGasUsed":"0xa418","contractAddress":null,"logs":[],"status":"0x1","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0x001b40cb161afd969df9f958665d25384bb0d3f12b59780458f81f9fe11c4464 b/pkg/transformers/test_data/test_chain/!transactions!0x001b40cb161afd969df9f958665d25384bb0d3f12b59780458f81f9fe11c4464 deleted file mode 100644 index e8e6bdde..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0x001b40cb161afd969df9f958665d25384bb0d3f12b59780458f81f9fe11c4464 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x01","gasPrice":"0x01","gasLimit":"0x44aa20","to":"0x38219779a699d67d7e7740b8c8f43d3e2dae2182","value":"0x","data":"0x815d245d66616b6520696c6b00000000000000000000000000000000000000000000000072617465000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032","v":"0x1c","r":"0x","s":"0x","from":"0x64d922894153be9eef7b7218dc565d1d0ce2a092","hash":"0x001b40cb161afd969df9f958665d25384bb0d3f12b59780458f81f9fe11c4464"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0x2194da14a0d4be36fb809efd3f9f426bf60842dbf244788d0a84b894b3e6bd49 b/pkg/transformers/test_data/test_chain/!transactions!0x2194da14a0d4be36fb809efd3f9f426bf60842dbf244788d0a84b894b3e6bd49 deleted file mode 100644 index b9842790..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0x2194da14a0d4be36fb809efd3f9f426bf60842dbf244788d0a84b894b3e6bd49 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x04","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0xfc0ba85028256ef48f5ba64dd65dc258988955f6","value":"0x","data":"0xfdacd5760000000000000000000000000000000000000000000000000000000000000002","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x2194da14a0d4be36fb809efd3f9f426bf60842dbf244788d0a84b894b3e6bd49"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0x30e1e9cb6ee8d98c1fbe6b7ca89d53034c0607b1298226fcd28f774df6f1b09d b/pkg/transformers/test_data/test_chain/!transactions!0x30e1e9cb6ee8d98c1fbe6b7ca89d53034c0607b1298226fcd28f774df6f1b09d deleted file mode 100644 index 7046d1d2..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0x30e1e9cb6ee8d98c1fbe6b7ca89d53034c0607b1298226fcd28f774df6f1b09d +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x08","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x6080604052670e92596fd6290000600255612a30600360006101000a81548165ffffffffffff021916908365ffffffffffff16021790555062093a80600360066101000a81548165ffffffffffff021916908365ffffffffffff16021790555034801561006b57600080fd5b50604051604080611bb483398101806040528101908080519060200190929190805190602001909291905050508060018160001916905550816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050611ac0806100f46000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063143e55e0146100ca578063351de6001461010557806336569e771461019a5780634423c5f1146101f15780634b43ed12146103075780634e8b1dd5146103485780635ff3a382146103835780637d780d82146103c4578063c5ce281e146103ef578063c959c42b14610422578063cfc4af551461044f578063cfdd33021461048a578063fc7b6aee146104b5575b600080fd5b3480156100d657600080fd5b506100df6104e2565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b34801561011157600080fd5b50610184600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001909291905050506104ea565b6040518082815260200191505060405180910390f35b3480156101a657600080fd5b506101af6108ae565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101fd57600080fd5b5061021c600480360381019080803590602001909291905050506108d3565b604051808981526020018881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018665ffffffffffff1665ffffffffffff1681526020018565ffffffffffff1665ffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019850505050505050505060405180910390f35b34801561031357600080fd5b5061034660048036038101908080359060200190929190803590602001909291908035906020019092919050505061099f565b005b34801561035457600080fd5b5061035d610ffd565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b34801561038f57600080fd5b506103c2600480360381019080803590602001909291908035906020019092919080359060200190929190505050611015565b005b3480156103d057600080fd5b506103d961161a565b6040518082815260200191505060405180910390f35b3480156103fb57600080fd5b50610404611620565b60405180826000191660001916815260200191505060405180910390f35b34801561042e57600080fd5b5061044d60048036038101908080359060200190929190505050611626565b005b34801561045b57600080fd5b50610464611961565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b34801561049657600080fd5b5061049f611979565b6040518082815260200191505060405180910390f35b3480156104c157600080fd5b506104e06004803603810190808035906020019092919050505061197f565b005b600042905090565b6000806004600081546001019190508190559050826005600083815260200190815260200160002060000181905550836005600083815260200190815260200160002060010181905550336005600083815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360069054906101000a900465ffffffffffff166105a66104e2565b0160056000838152602001908152602001600020600201601a6101000a81548165ffffffffffff021916908365ffffffffffff160217905550866005600083815260200190815260200160002060030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550856005600083815260200190815260200160002060040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460056000838152602001908152602001600020600501819055507f8828a22eb6a18623309ad55592866c4b077989e9e8a25e1b85f9bf6f7282520f816000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166001548787338c600560008a8152602001908152602001600020600201601a9054906101000a900465ffffffffffff166107206104e2565b600560008c815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560008d815260200190815260200160002060050154604051808c81526020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a600019166000191681526020018981526020018881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018565ffffffffffff1665ffffffffffff1681526020018465ffffffffffff1665ffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019b50505050505050505050505060405180910390a18091505095945050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60056020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160149054906101000a900465ffffffffffff169080600201601a9054906101000a900465ffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060050154905088565b60006005600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156109fb57600080fd5b610a036104e2565b65ffffffffffff166005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff161180610a78575060006005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff16145b1515610a8357600080fd5b610a8b6104e2565b65ffffffffffff1660056000858152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff16111515610ad057600080fd5b600560008481526020019081526020016000206001015482141515610af457600080fd5b60056000848152602001908152602001600020600501548111151515610b1957600080fd5b600560008481526020019081526020016000206000015481111515610b3d57600080fd5b610b5f6002546005600086815260200190815260200160002060000154611a64565b610b7182670de0b6b3a7640000611a64565b101580610b935750600560008481526020019081526020016000206005015481145b1515610b9e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b336005600087815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660056000888152602001908152602001600020600001546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610ce257600080fd5b505af1158015610cf6573d6000803e3d6000fd5b505050506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b336005600087815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560008881526020019081526020016000206000015485036040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610e4057600080fd5b505af1158015610e54573d6000803e3d6000fd5b50505050336005600085815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806005600085815260200190815260200160002060000181905550600360009054906101000a900465ffffffffffff16610ee56104e2565b016005600085815260200190815260200160002060020160146101000a81548165ffffffffffff021916908365ffffffffffff1602179055507fd4aef477d7912041a69c5b85f2d78b618c76e40a4a92b91122c85ab5b404a64a838383336005600089815260200190815260200160002060020160149054906101000a900465ffffffffffff16610f746104e2565b604051808781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018365ffffffffffff1665ffffffffffff1681526020018265ffffffffffff1665ffffffffffff168152602001965050505050505060405180910390a1505050565b600360009054906101000a900465ffffffffffff1681565b60006005600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561107157600080fd5b6110796104e2565b65ffffffffffff166005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff1611806110ee575060006005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff16145b15156110f957600080fd5b6111016104e2565b65ffffffffffff1660056000858152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff1611151561114657600080fd5b60056000848152602001908152602001600020600001548114151561116a57600080fd5b60056000848152602001908152602001600020600501548114151561118e57600080fd5b6005600084815260200190815260200160002060010154821015156111b257600080fd5b6111da6005600085815260200190815260200160002060010154670de0b6b3a7640000611a64565b6111e660025484611a64565b111515156111f357600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b336005600087815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561132157600080fd5b505af1158015611335573d6000803e3d6000fd5b505050506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637cdd3fde6001546005600087815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856005600089815260200190815260200160002060010154036040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561145d57600080fd5b505af1158015611471573d6000803e3d6000fd5b50505050336005600085815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816005600085815260200190815260200160002060010181905550600360009054906101000a900465ffffffffffff166115026104e2565b016005600085815260200190815260200160002060020160146101000a81548165ffffffffffff021916908365ffffffffffff1602179055507f380cb3bf83f57ec05d0229938aeb5d4fba1de0228097701d1c03379c88cec5d4838383336005600089815260200190815260200160002060020160149054906101000a900465ffffffffffff166115916104e2565b604051808781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018365ffffffffffff1665ffffffffffff1681526020018265ffffffffffff1665ffffffffffff168152602001965050505050505060405180910390a1505050565b60025481565b60015481565b61162e6104e2565b65ffffffffffff166005600083815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff161080156116a5575060006005600083815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff1614155b806116ee57506116b36104e2565b65ffffffffffff1660056000838152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff16105b15156116f957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637cdd3fde6001546005600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660056000868152602001908152602001600020600101546040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561181b57600080fd5b505af115801561182f573d6000803e3d6000fd5b505050506005600082815260200190815260200160002060008082016000905560018201600090556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160146101000a81549065ffffffffffff021916905560028201601a6101000a81549065ffffffffffff02191690556003820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556004820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600582016000905550507f9b83ce9ac5e3a4e55a5b95c0e529b8cbe35d29682e2d851f51dd4e0bf9a6d3d1816119326104e2565b604051808381526020018265ffffffffffff1665ffffffffffff1681526020019250505060405180910390a150565b600360069054906101000a900465ffffffffffff1681565b60045481565b6119876104e2565b65ffffffffffff1660056000838152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff161015156119cc57600080fd5b60006005600083815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff16141515611a0b57600080fd5b600360069054906101000a900465ffffffffffff16611a286104e2565b0160056000838152602001908152602001600020600201601a6101000a81548165ffffffffffff021916908365ffffffffffff16021790555050565b600080821480611a8357508282838502925082811515611a8057fe5b04145b1515611a8e57600080fd5b929150505600a165627a7a72305820be360886965ff94b58c48a287326520577aeb8e46a36d2c7f0ea9c040eaa9dbe002900000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae218266616b6520696c6b000000000000000000000000000000000000000000000000","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x30e1e9cb6ee8d98c1fbe6b7ca89d53034c0607b1298226fcd28f774df6f1b09d"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0x5b37b7a5bd08efac0e4bb3ac507761a8f13a87176eabb20301e223c74f587434 b/pkg/transformers/test_data/test_chain/!transactions!0x5b37b7a5bd08efac0e4bb3ac507761a8f13a87176eabb20301e223c74f587434 deleted file mode 100644 index f369a47c..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0x5b37b7a5bd08efac0e4bb3ac507761a8f13a87176eabb20301e223c74f587434 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x06","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b50610f5c806100206000396000f3006080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305db45381461010157806307a832b41461012c5780630e01198b14610157578063143e55e0146101825780632506855a146101bd57806329ae8114146101ea5780632a1d2b3c1461022557806335aee16f1461025057806349dd5bb21461028557806353cb8def146102b057806364bd7013146102db578063697efb78146103065780637f49edc4146103335780639361266c1461037c578063bbbb0d7b146103a7578063d0adc35f146103d2578063d4e8be83146103fd578063f37ac61c1461044e575b600080fd5b34801561010d57600080fd5b5061011661047b565b6040518082815260200191505060405180910390f35b34801561013857600080fd5b5061014161049b565b6040518082815260200191505060405180910390f35b34801561016357600080fd5b5061016c6105b0565b6040518082815260200191505060405180910390f35b34801561018e57600080fd5b50610197610706565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b3480156101c957600080fd5b506101e86004803603810190808035906020019092919050505061070e565b005b3480156101f657600080fd5b50610223600480360381019080803560001916906020019092919080359060200190929190505050610864565b005b34801561023157600080fd5b5061023a610917565b6040518082815260200191505060405180910390f35b34801561025c57600080fd5b50610283600480360381019080803565ffffffffffff16906020019092919050505061091d565b005b34801561029157600080fd5b5061029a6109b3565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c56109b9565b6040518082815260200191505060405180910390f35b3480156102e757600080fd5b506102f06109bf565b6040518082815260200191505060405180910390f35b34801561031257600080fd5b50610331600480360381019080803590602001909291905050506109c5565b005b34801561033f57600080fd5b50610366600480360381019080803565ffffffffffff169060200190929190505050610a3c565b6040518082815260200191505060405180910390f35b34801561038857600080fd5b50610391610a54565b6040518082815260200191505060405180910390f35b3480156103b357600080fd5b506103bc610a5a565b6040518082815260200191505060405180910390f35b3480156103de57600080fd5b506103e7610bdc565b6040518082815260200191505060405180910390f35b34801561040957600080fd5b5061044c6004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be2565b005b34801561045a57600080fd5b5061047960048036038101908080359060200190929190505050610da2565b005b600061049661048e600454600554610ef8565b600654610ef8565b905090565b60006b033b2e3c9fd0803ce80000006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636c25b346306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561056657600080fd5b505af115801561057a573d6000803e3d6000fd5b505050506040513d602081101561059057600080fd5b81019080805190602001909291905050508115156105aa57fe5b04905090565b60006105d06105c86105c061047b565b600854610ef8565b600954610ef8565b6105d861049b565b101515156105e557600080fd5b60006005541415156105f657600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b7e9cd243060085460006040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b1580156106c657600080fd5b505af11580156106da573d6000803e3d6000fd5b505050506040513d60208110156106f057600080fd5b8101908080519060200190929190505050905090565b600042905090565b6006548111158015610727575061072361049b565b8111155b8015610734575060008112155b151561073f57600080fd5b61074b60065482610f14565b6006819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee8cd7483030846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561084957600080fd5b505af115801561085d573d6000803e3d6000fd5b5050505050565b7f6c756d70000000000000000000000000000000000000000000000000000000008260001916141561089857806008819055505b7f7061640000000000000000000000000000000000000000000000000000000000826000191614156108cc57806009819055505b7f8a9b1ca0a6295c2e892a579edd3076c4914c2a82a4d5caab9420945c64c7fe4182826040518083600019166000191681526020018281526020019250505060405180910390a15050565b60065481565b61094c600454600360008465ffffffffffff1665ffffffffffff16815260200190815260200160002054610f14565b600481905550610981600554600360008465ffffffffffff1665ffffffffffff16815260200190815260200160002054610ef8565b6005819055506000600360008365ffffffffffff1665ffffffffffff1681526020019081526020016000208190555050565b60055481565b60085481565b60075481565b6109f9600360006109d4610706565b65ffffffffffff1665ffffffffffff1681526020019081526020016000205482610ef8565b60036000610a05610706565b65ffffffffffff1665ffffffffffff16815260200190815260200160002081905550610a3360045482610ef8565b60048190555050565b60036020528060005260406000206000915090505481565b60095481565b600060085460055410151515610a6f57600080fd5b6000610a7961049b565b141515610a8557600080fd5b610a93600554600854610f14565b600581905550610aa7600654600854610ef8565b600681905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b7e9cd24307fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6008546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b158015610b9c57600080fd5b505af1158015610bb0573d6000803e3d6000fd5b505050506040513d6020811015610bc657600080fd5b8101908080519060200190929190505050905090565b60045481565b7f666c61700000000000000000000000000000000000000000000000000000000082600019161415610c505780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7f666c6f700000000000000000000000000000000000000000000000000000000082600019161415610cbe5780600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7f766174000000000000000000000000000000000000000000000000000000000082600019161415610d2b57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7fa8113be4b615eb027dc9305f13990b41b39a3fcb82bf872ce96a40827831e4d182826040518083600019166000191681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b610daa61049b565b8111158015610dbb57506005548111155b8015610dc8575060008112155b1515610dd357600080fd5b610ddf60055482610f14565b6005819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee8cd7483030846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610edd57600080fd5b505af1158015610ef1573d6000803e3d6000fd5b5050505050565b60008183019050828110151515610f0e57600080fd5b92915050565b60008183039050828111151515610f2a57600080fd5b929150505600a165627a7a7230582072b3db6bacdfa5af0372b289ff3a98ea4ee2d522a25b03c7669d2fccd135abde0029","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x5b37b7a5bd08efac0e4bb3ac507761a8f13a87176eabb20301e223c74f587434"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191 b/pkg/transformers/test_data/test_chain/!transactions!0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191 deleted file mode 100644 index 8ac6b8d1..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x","gasPrice":"0x01","gasLimit":"0x44aa20","to":"0x08cb6176addcca2e1d1ffe21bee464b72ee4cd8d","value":"0x","data":"0x351de6000000000000000000000000007340e006f4135ba6970d43bf43d88dcad4e7a8ca00000000000000000000000007fa9ef6609ca7921112231f8f195138ebba2977000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000","v":"0x1c","r":"0x","s":"0x","from":"0x64d922894153be9eef7b7218dc565d1d0ce2a092","hash":"0x6b155a55fd77b751195deeebf7abfd8691ca01ee588817a920f19d5b27f65191"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0x8956d8bdced261516039ea57abcfaaa71bbd770886afa1d3e6ac2e5b65bc6293 b/pkg/transformers/test_data/test_chain/!transactions!0x8956d8bdced261516039ea57abcfaaa71bbd770886afa1d3e6ac2e5b65bc6293 deleted file mode 100644 index 79cb4ea3..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0x8956d8bdced261516039ea57abcfaaa71bbd770886afa1d3e6ac2e5b65bc6293 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x03","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b506114d4806100206000396000f3006080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806311045bee146100d55780632424be5c1461015a57806327219087146101cd5780632d61a3551461023a5780636c25b346146102655780637cdd3fde146102bc578063815d245d14610317578063a4593c5214610360578063b65337df146103c5578063bb35783b14610420578063d9638d361461048d578063dc42e309146104d9578063ee8cd74814610504578063f059212a14610571575b600080fd5b3480156100e157600080fd5b506101586004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506105c8565b005b34801561016657600080fd5b506101a96004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610819565b60405180848152602001838152602001828152602001935050505060405180910390f35b3480156101d957600080fd5b50610238600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610850565b005b34801561024657600080fd5b5061024f610abc565b6040518082815260200191505060405180910390f35b34801561027157600080fd5b506102a6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac2565b6040518082815260200191505060405180910390f35b3480156102c857600080fd5b506103156004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ada565b005b34801561032357600080fd5b5061035e6004803603810190808035600019169060200190929190803560001916906020019092919080359060200190929190505050610c0e565b005b34801561036c57600080fd5b506103c36004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050610c63565b005b3480156103d157600080fd5b5061041e6004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ec7565b005b34801561042c57600080fd5b5061048b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611077565b005b34801561049957600080fd5b506104bc6004803603810190808035600019169060200190929190505050611097565b604051808381526020018281526020019250505060405180910390f35b3480156104e557600080fd5b506104ee6110bb565b6040518082815260200191505060405180910390f35b34801561051057600080fd5b5061056f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110c1565b005b34801561057d57600080fd5b506105b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061139d565b6040518082815260200191505060405180910390f35b60008060036000886000191660001916815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060026000886000191660001916815260200190815260200160002090506106508260010154856113b5565b82600101819055506106668260020154846113b5565b826002018190555061067c8160010154846113b5565b81600101819055506106da600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106d58360000154866113f6565b611462565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107366005546107318360000154866113f6565b611462565b6005819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8308661076d8460000154876113f6565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f6772616200000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a150505050505050565b6003602052816000526040600020602052806000526040600020600091509150508060000154908060010154908060020154905083565b6000610868826b033b2e3c9fd0803ce80000006113f6565b90506108b26000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611462565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061093c6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826113b5565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f25e802ca4c681361b4e886aa3337404f6931451d42a314f69f9381f483b4020b848483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a160008060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412158015610aab575060008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412155b1515610ab657600080fd5b50505050565b60055481565b60006020528060005260406000206000915090505481565b610b3f60036000856000191660001916815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154826113b5565b60036000856000191660001916815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600060036000856000191660001916815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015412151515610c0957600080fd5b505050565b7f726174650000000000000000000000000000000000000000000000000000000082600019161415610c5e5780600260008560001916600019168152602001908152602001600020600001819055505b505050565b60008060036000876000191660001916815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091506002600087600019166000191681526020019081526020016000209050610ceb826000015485611462565b8260000181905550610d018260010154856113b5565b8260010181905550610d178260020154846113b5565b8260020181905550610d2d8160010154846113b5565b8160010181905550610d8a6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d858360000154866113f6565b6113b5565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610de5600454610de08360000154866113f6565b6113b5565b6004819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b83086610e1c8460000154876113f6565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f74756e6500000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a1505050505050565b6000806002600086600019166000191681526020019081526020016000209150610ef58260000154846113b5565b8260000181905550610f0b8260010154846113f6565b9050610f556000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826113b5565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fa3600454826113b5565b6004819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8308583604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f666f6c6400000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a15050505050565b6000811215151561108757600080fd5b611092838383610850565b505050565b60026020528060005260406000206000915090508060000154908060010154905082565b60045481565b60006110d9826b033b2e3c9fd0803ce80000006113f6565b9050611124600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611462565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111af6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611462565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111fd60055482611462565b60058190555061120f60045482611462565b6004819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8308483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f6865616c00000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a16000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541215801561136b575060008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412155b151561137657600080fd5b60006005541215801561138c5750600060045412155b151561139757600080fd5b50505050565b60016020528060005260406000206000915090505481565b600081830190506000821315806113cb57508281135b15156113d657600080fd5b6000821215806113e557508281125b15156113f057600080fd5b92915050565b6000818302905060008212158061142d57507f80000000000000000000000000000000000000000000000000000000000000008314155b151561143857600080fd5b6000821480611451575082828281151561144e57fe5b05145b151561145c57600080fd5b92915050565b60007f8000000000000000000000000000000000000000000000000000000000000000821415151561149357600080fd5b6114a083836000036113b5565b9050929150505600a165627a7a72305820fe3b4cc787b56823b0000494bdc149bd06182ff3067aff805573ec2791616c630029","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x8956d8bdced261516039ea57abcfaaa71bbd770886afa1d3e6ac2e5b65bc6293"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0x99eafa867c60105b21589ad055bd60c567482d9b532b926978236477bb34a1db b/pkg/transformers/test_data/test_chain/!transactions!0x99eafa867c60105b21589ad055bd60c567482d9b532b926978236477bb34a1db deleted file mode 100644 index 87103892..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0x99eafa867c60105b21589ad055bd60c567482d9b532b926978236477bb34a1db +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x05","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b50604051602080610ae783398101806040528101908080519060200190929190505050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600260006101000a81548160ff02191690831515021790555050610a498061009e6000396000f300608060405260043610610083576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806336569e77146100885780635a984ded146100df578063815d245d14610124578063957aa58c1461016d5780639be856111461019c578063babe8a3f146101d7578063d9638d3614610202575b600080fd5b34801561009457600080fd5b5061009d61024e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100eb57600080fd5b5061012260048036038101908080356000191690602001909291908035906020019092919080359060200190929190505050610273565b005b34801561013057600080fd5b5061016b60048036038101908080356000191690602001909291908035600019169060200190929190803590602001909291905050506107f9565b005b34801561017957600080fd5b506101826108f5565b604051808215151515815260200191505060405180910390f35b3480156101a857600080fd5b506101d5600480360381019080803560001916906020019092919080359060200190929190505050610908565b005b3480156101e357600080fd5b506101ec610987565b6040518082815260200191505060405180910390f35b34801561020e57600080fd5b50610231600480360381019080803560001916906020019092919050505061098d565b604051808381526020018281526020019250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000806000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a4593c528e338f8f6040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018085600019166000191681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050600060405180830381600087803b15801561035e57600080fd5b505af1158015610372573d6000803e3d6000fd5b50505050600360008e6000191660001916815260200190815260200160002099506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d368e6040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600019166000191681526020019150506040805180830381600087803b15801561042a57600080fd5b505af115801561043e573d6000803e3d6000fd5b505050506040513d604081101561045457600080fd5b810190808051906020019092919080519060200190929190505050985098506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632424be5c8e336040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600019166000191681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050606060405180830381600087803b15801561053f57600080fd5b505af1158015610553573d6000803e3d6000fd5b505050506040513d606081101561056957600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509650965096506105c8600360008f60001916600019168152602001908152602001600020600101546b033b2e3c9fd0803ce80000006109b1565b6105d2898b6109b1565b131580156106b557506105f36001546b033b2e3c9fd0803ce80000006109b1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc42e3096040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561067857600080fd5b505af115801561068c573d6000803e3d6000fd5b505050506040513d60208110156106a257600080fd5b8101908080519060200190929190505050125b935060008b1315925060008c121591506106cf858a6109b1565b6106dd878c600001546109b1565b1215905083806106ea5750825b801561070457508280156106fb5750815b806107035750805b5b801561071c5750600260009054906101000a900460ff165b151561072757600080fd5b6000891415151561073757600080fd5b7f6cedf1d3a466a3d6bab04887b1642177bf6dbf1daa737c2e8f639cd0b020d9d08d33898f8f8b8b426040518089600019166000191681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018581526020018481526020018381526020018265ffffffffffff1665ffffffffffff1681526020019850505050505050505060405180910390a150505050505050505050505050565b7f73706f7400000000000000000000000000000000000000000000000000000000826000191614156108495780600360008560001916600019168152602001908152602001600020600001819055505b7f6c696e6500000000000000000000000000000000000000000000000000000000826000191614156108995780600360008560001916600019168152602001908152602001600020600101819055505b7fb80446ca592fac4d11848fd8a1aeb8b3de78791ab4079c424db00ed4547bb8768383836040518084600019166000191681526020018360001916600019168152602001828152602001935050505060405180910390a1505050565b600260009054906101000a900460ff1681565b7f4c696e65000000000000000000000000000000000000000000000000000000008260001916141561093c57806001819055505b7f134b2912c1a5fbb942de04eb642d59a9b018427189818dd7c3ff65b7f948562e82826040518083600019166000191681526020018281526020019250505060405180910390a15050565b60015481565b60036020528060005260406000206000915090508060000154908060010154905082565b600081830290506000821215806109e857507f80000000000000000000000000000000000000000000000000000000000000008314155b15156109f357600080fd5b6000821480610a0c5750828282811515610a0957fe5b05145b1515610a1757600080fd5b929150505600a165627a7a72305820b9361d759877e537db2973b3e90840aa1c75fc76091f3ec71f9b249aff4251e6002900000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae2182","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0x99eafa867c60105b21589ad055bd60c567482d9b532b926978236477bb34a1db"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0xa04e60c48a756ddb94babf195ae4de2699515f0eb9b70b09221ec74ca7dea343 b/pkg/transformers/test_data/test_chain/!transactions!0xa04e60c48a756ddb94babf195ae4de2699515f0eb9b70b09221ec74ca7dea343 deleted file mode 100644 index 2ef02853..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0xa04e60c48a756ddb94babf195ae4de2699515f0eb9b70b09221ec74ca7dea343 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102f8806100606000396000f300608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100aa5780638da5cb5b146100d5578063fdacd5761461012c575b600080fd5b34801561007357600080fd5b506100a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610159565b005b3480156100b657600080fd5b506100bf610241565b6040518082815260200191505060405180910390f35b3480156100e157600080fd5b506100ea610247565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561013857600080fd5b506101576004803603810190808035906020019092919050505061026c565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023d578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561022457600080fd5b505af1158015610238573d6000803e3d6000fd5b505050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102c957806001819055505b505600a165627a7a72305820248859af1d09c2b1e0f445f0b5d9022e93fe3d74bd99f3328b20a491c951c1410029","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0xa04e60c48a756ddb94babf195ae4de2699515f0eb9b70b09221ec74ca7dea343"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0xa18a1a6c0f6dffd28c90aaaf6d822a206797367ee094ebcf0ee003f52c812f02 b/pkg/transformers/test_data/test_chain/!transactions!0xa18a1a6c0f6dffd28c90aaaf6d822a206797367ee094ebcf0ee003f52c812f02 deleted file mode 100644 index 4a5b3ae3..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0xa18a1a6c0f6dffd28c90aaaf6d822a206797367ee094ebcf0ee003f52c812f02 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x07","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x608060405234801561001057600080fd5b50604051602080610d0883398101806040528101908080519060200190929190505050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610c85806100836000396000f3006080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b3146100b457806318160ddd1461011957806323b872dd1461014457806336569e77146101c957806370a0823114610220578063a9059cbb14610277578063b753a98c146102dc578063bb35783b14610329578063daea85c514610396578063dd62ed3e146103d9578063f2d5d56b14610450575b600080fd5b3480156100c057600080fd5b506100ff600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061049d565b604051808215151515815260200191505060405180910390f35b34801561012557600080fd5b5061012e6105f4565b6040518082815260200191505060405180910390f35b34801561015057600080fd5b506101af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d2565b604051808215151515815260200191505060405180910390f35b3480156101d557600080fd5b506101de610a81565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022c57600080fd5b50610261600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa6565b6040518082815260200191505060405180910390f35b34801561028357600080fd5b506102c2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bbd565b604051808215151515815260200191505060405180910390f35b3480156102e857600080fd5b50610327600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd5565b005b34801561033557600080fd5b50610394600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610be5565b005b3480156103a257600080fd5b506103d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf6565b005b3480156103e557600080fd5b5061043a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c24565b6040518082815260200191505060405180910390f35b34801561045c57600080fd5b5061049b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c49565b005b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055507f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92533847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8502604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16001905092915050565b60006b033b2e3c9fd0803ce80000006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc42e3096040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561068857600080fd5b505af115801561069c573d6000803e3d6000fd5b505050506040513d60208110156106b257600080fd5b81019080805190602001909291905050508115156106cc57fe5b04905090565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156107ac57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b156108c75781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561083c57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b8585856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b1580156109bf57600080fd5b505af11580156109d3573d6000803e3d6000fd5b505050507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1600190509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006b033b2e3c9fd0803ce80000006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636c25b346846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610b7157600080fd5b505af1158015610b85573d6000803e3d6000fd5b505050506040513d6020811015610b9b57600080fd5b8101908080519060200190929190505050811515610bb557fe5b049050919050565b6000610bca3384846106d2565b506001905092915050565b610be03383836106d2565b505050565b610bf08383836106d2565b50505050565b610c20817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61049d565b5050565b6001602052816000526040600020602052806000526040600020600091509150505481565b610c548233836106d2565b5050505600a165627a7a723058205ba33f32f961d260de79eb9763f7cd5ff7ac88d18cba75e66216d72317a5709b002900000000000000000000000038219779a699d67d7e7740b8c8f43d3e2dae2182","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0xa18a1a6c0f6dffd28c90aaaf6d822a206797367ee094ebcf0ee003f52c812f02"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0xa8e605dfe8af972342126849910aa42ed1ce7df6b88230375628b48c54dfa146 b/pkg/transformers/test_data/test_chain/!transactions!0xa8e605dfe8af972342126849910aa42ed1ce7df6b88230375628b48c54dfa146 deleted file mode 100644 index 8e052a07..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0xa8e605dfe8af972342126849910aa42ed1ce7df6b88230375628b48c54dfa146 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x02","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0x","value":"0x","data":"0x6080604052348015600f57600080fd5b50603580601d6000396000f3006080604052600080fd00a165627a7a72305820e87fe4eeacae18669e2102297afe663d59888094e838594e73a01821fc8d2a640029","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0xa8e605dfe8af972342126849910aa42ed1ce7df6b88230375628b48c54dfa146"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9 b/pkg/transformers/test_data/test_chain/!transactions!0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9 deleted file mode 100644 index f99ff0b3..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x02","gasPrice":"0x01","gasLimit":"0x44aa20","to":"0xff3f2400f1600f3f493a9a92704a29b96795af1a","value":"0x","data":"0x5a984ded66616b6520696c6b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000","v":"0x1c","r":"0x","s":"0x","from":"0x64d922894153be9eef7b7218dc565d1d0ce2a092","hash":"0xbcff98316acb5732891d1a7e02f23ec12fbf8c231ca4b5530fa7a21c1e9b6aa9"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!transactions!0xc0bdfdb15c288d6a7b0af865d953677c4818c6655d26631bd7b840e9cfb2d668 b/pkg/transformers/test_data/test_chain/!transactions!0xc0bdfdb15c288d6a7b0af865d953677c4818c6655d26631bd7b840e9cfb2d668 deleted file mode 100644 index d00c29ed..00000000 --- a/pkg/transformers/test_data/test_chain/!transactions!0xc0bdfdb15c288d6a7b0af865d953677c4818c6655d26631bd7b840e9cfb2d668 +++ /dev/null @@ -1 +0,0 @@ -{"nonce":"0x01","gasPrice":"0x174876e800","gasLimit":"0x6691b7","to":"0xfc0ba85028256ef48f5ba64dd65dc258988955f6","value":"0x","data":"0xfdacd5760000000000000000000000000000000000000000000000000000000000000001","v":"0x1c","r":"0x","s":"0x","from":"0x8e84a1e068d77059cbe263c43ad0cdc130863313","hash":"0xc0bdfdb15c288d6a7b0af865d953677c4818c6655d26631bd7b840e9cfb2d668"} \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x018307e454fab3317e51ac01fcb6c49b6204ae6e1e11a768a52ad80fef5c45de b/pkg/transformers/test_data/test_chain/!trie_db!0x018307e454fab3317e51ac01fcb6c49b6204ae6e1e11a768a52ad80fef5c45de deleted file mode 100644 index 4f357f63..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x018307e454fab3317e51ac01fcb6c49b6204ae6e1e11a768a52ad80fef5c45de +++ /dev/null @@ -1 +0,0 @@ -"0xf8518080808080808080a0caabb5eace0c874816d18d87a14bdd47d6ca59824abbd2930b90caff6fd8d2588080808080a0334d59a6b826ca00e56207b7be9c9d3ffc03fe1bb8a08fc967edacac01f440058080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x03a6152e38d112bbb90b47ce492c6f8c7719668be7d71faedd55c522e8a756c7 b/pkg/transformers/test_data/test_chain/!trie_db!0x03a6152e38d112bbb90b47ce492c6f8c7719668be7d71faedd55c522e8a756c7 deleted file mode 100644 index d9532639..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x03a6152e38d112bbb90b47ce492c6f8c7719668be7d71faedd55c522e8a756c7 +++ /dev/null @@ -1 +0,0 @@ -"0xf85120b84ef84c8088fd7e20e377bf4800a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x0580883480974cf8d76b4a4d6eb1a04a3080df15d235779a7318839acd4ec0bb b/pkg/transformers/test_data/test_chain/!trie_db!0x0580883480974cf8d76b4a4d6eb1a04a3080df15d235779a7318839acd4ec0bb deleted file mode 100644 index d6291398..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x0580883480974cf8d76b4a4d6eb1a04a3080df15d235779a7318839acd4ec0bb +++ /dev/null @@ -1 +0,0 @@ -"0xf8f1a0422861bc32af762face51a81dfb4e3f2d563beb99ee972cf1fa30b944e6b85f580a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2808080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0a7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963a051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c194a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x0669e99db03fadf7104f6fce6f5dee43e3082eea0a429e7bc05c0aa06937a1b4 b/pkg/transformers/test_data/test_chain/!trie_db!0x0669e99db03fadf7104f6fce6f5dee43e3082eea0a429e7bc05c0aa06937a1b4 deleted file mode 100644 index fecf220a..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x0669e99db03fadf7104f6fce6f5dee43e3082eea0a429e7bc05c0aa06937a1b4 +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a008fc4b6336e7757c3d89b620ecf6f1b5a7fbee90374484591347ac658909505b" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x070abfdf0f48e22d8997a1da98af511067fa17d3472bb7b2053e26663154e6b5 b/pkg/transformers/test_data/test_chain/!trie_db!0x070abfdf0f48e22d8997a1da98af511067fa17d3472bb7b2053e26663154e6b5 deleted file mode 100644 index e946ab99..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x070abfdf0f48e22d8997a1da98af511067fa17d3472bb7b2053e26663154e6b5 +++ /dev/null @@ -1 +0,0 @@ -"0x608060405260043610610083576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806336569e77146100885780635a984ded146100df578063815d245d14610124578063957aa58c1461016d5780639be856111461019c578063babe8a3f146101d7578063d9638d3614610202575b600080fd5b34801561009457600080fd5b5061009d61024e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100eb57600080fd5b5061012260048036038101908080356000191690602001909291908035906020019092919080359060200190929190505050610273565b005b34801561013057600080fd5b5061016b60048036038101908080356000191690602001909291908035600019169060200190929190803590602001909291905050506107f9565b005b34801561017957600080fd5b506101826108f5565b604051808215151515815260200191505060405180910390f35b3480156101a857600080fd5b506101d5600480360381019080803560001916906020019092919080359060200190929190505050610908565b005b3480156101e357600080fd5b506101ec610987565b6040518082815260200191505060405180910390f35b34801561020e57600080fd5b50610231600480360381019080803560001916906020019092919050505061098d565b604051808381526020018281526020019250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000806000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a4593c528e338f8f6040518563ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018085600019166000191681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050600060405180830381600087803b15801561035e57600080fd5b505af1158015610372573d6000803e3d6000fd5b50505050600360008e6000191660001916815260200190815260200160002099506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d9638d368e6040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600019166000191681526020019150506040805180830381600087803b15801561042a57600080fd5b505af115801561043e573d6000803e3d6000fd5b505050506040513d604081101561045457600080fd5b810190808051906020019092919080519060200190929190505050985098506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632424be5c8e336040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600019166000191681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050606060405180830381600087803b15801561053f57600080fd5b505af1158015610553573d6000803e3d6000fd5b505050506040513d606081101561056957600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509650965096506105c8600360008f60001916600019168152602001908152602001600020600101546b033b2e3c9fd0803ce80000006109b1565b6105d2898b6109b1565b131580156106b557506105f36001546b033b2e3c9fd0803ce80000006109b1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc42e3096040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561067857600080fd5b505af115801561068c573d6000803e3d6000fd5b505050506040513d60208110156106a257600080fd5b8101908080519060200190929190505050125b935060008b1315925060008c121591506106cf858a6109b1565b6106dd878c600001546109b1565b1215905083806106ea5750825b801561070457508280156106fb5750815b806107035750805b5b801561071c5750600260009054906101000a900460ff165b151561072757600080fd5b6000891415151561073757600080fd5b7f6cedf1d3a466a3d6bab04887b1642177bf6dbf1daa737c2e8f639cd0b020d9d08d33898f8f8b8b426040518089600019166000191681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018681526020018581526020018481526020018381526020018265ffffffffffff1665ffffffffffff1681526020019850505050505050505060405180910390a150505050505050505050505050565b7f73706f7400000000000000000000000000000000000000000000000000000000826000191614156108495780600360008560001916600019168152602001908152602001600020600001819055505b7f6c696e6500000000000000000000000000000000000000000000000000000000826000191614156108995780600360008560001916600019168152602001908152602001600020600101819055505b7fb80446ca592fac4d11848fd8a1aeb8b3de78791ab4079c424db00ed4547bb8768383836040518084600019166000191681526020018360001916600019168152602001828152602001935050505060405180910390a1505050565b600260009054906101000a900460ff1681565b7f4c696e65000000000000000000000000000000000000000000000000000000008260001916141561093c57806001819055505b7f134b2912c1a5fbb942de04eb642d59a9b018427189818dd7c3ff65b7f948562e82826040518083600019166000191681526020018281526020019250505060405180910390a15050565b60015481565b60036020528060005260406000206000915090508060000154908060010154905082565b600081830290506000821215806109e857507f80000000000000000000000000000000000000000000000000000000000000008314155b15156109f357600080fd5b6000821480610a0c5750828282811515610a0957fe5b05145b1515610a1757600080fd5b929150505600a165627a7a72305820b9361d759877e537db2973b3e90840aa1c75fc76091f3ec71f9b249aff4251e60029" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x08cb51ef4d2a0a75ebaf16e59652f0a909bf9a461c2916e8b600f7e0b4c03624 b/pkg/transformers/test_data/test_chain/!trie_db!0x08cb51ef4d2a0a75ebaf16e59652f0a909bf9a461c2916e8b600f7e0b4c03624 deleted file mode 100644 index 20ca99c8..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x08cb51ef4d2a0a75ebaf16e59652f0a909bf9a461c2916e8b600f7e0b4c03624 +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a0f417ac2b221084cc9f25360f16f68983f1636169ed35c027c83b2925ea63a3b9a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x08fc4b6336e7757c3d89b620ecf6f1b5a7fbee90374484591347ac658909505b b/pkg/transformers/test_data/test_chain/!trie_db!0x08fc4b6336e7757c3d89b620ecf6f1b5a7fbee90374484591347ac658909505b deleted file mode 100644 index 4daa68fc..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x08fc4b6336e7757c3d89b620ecf6f1b5a7fbee90374484591347ac658909505b +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a0903b0cd1beb1b190eb88e579ed2cdedd31e48e7e4f9c188b6068620d222b568ea05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x0e1adb36bae65d3155a1a7f0ab1f18cb8bd59db49e62cdebf6705b13116e15ca b/pkg/transformers/test_data/test_chain/!trie_db!0x0e1adb36bae65d3155a1a7f0ab1f18cb8bd59db49e62cdebf6705b13116e15ca deleted file mode 100644 index 2625a687..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x0e1adb36bae65d3155a1a7f0ab1f18cb8bd59db49e62cdebf6705b13116e15ca +++ /dev/null @@ -1 +0,0 @@ -"0xf85120b84ef84c80887d705cb8966c4000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x0e90d9cbe0bf11f02708860522fb09308ce0db17ba249df1a4aa8802824f374e b/pkg/transformers/test_data/test_chain/!trie_db!0x0e90d9cbe0bf11f02708860522fb09308ce0db17ba249df1a4aa8802824f374e deleted file mode 100644 index ac962bbc..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x0e90d9cbe0bf11f02708860522fb09308ce0db17ba249df1a4aa8802824f374e +++ /dev/null @@ -1 +0,0 @@ -"0xf85d9438219779a699d67d7e7740b8c8f43d3e2dae2182b846f8440180a0018307e454fab3317e51ac01fcb6c49b6204ae6e1e11a768a52ad80fef5c45dea0b66ab966cb58bb54b74fef7c873db3cfe39f1667ff01c5814956fa040efda263" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x126fe799e67c134d54afc67d5aeee9fc376ab1d87f435750ae382befc5bd3926 b/pkg/transformers/test_data/test_chain/!trie_db!0x126fe799e67c134d54afc67d5aeee9fc376ab1d87f435750ae382befc5bd3926 deleted file mode 100644 index 701ad9a0..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x126fe799e67c134d54afc67d5aeee9fc376ab1d87f435750ae382befc5bd3926 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d068905681615ebb058b800a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x14a96b69c2eef02d5e6634d7934993c4b23d133a8f96001f6a03a9664c02f758 b/pkg/transformers/test_data/test_chain/!trie_db!0x14a96b69c2eef02d5e6634d7934993c4b23d133a8f96001f6a03a9664c02f758 deleted file mode 100644 index 4ddd4421..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x14a96b69c2eef02d5e6634d7934993c4b23d133a8f96001f6a03a9664c02f758 +++ /dev/null @@ -1 +0,0 @@ -"0xf842a01000000000000000000000000000000000000000000000000000000000000000a066c5d0a6016165e537ac63b121df2d074c649a16b50ca7a2839abc5eb3894a9a" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x151e5297e1c821d226d7df4a96b11752d522dcfd50b08d2cc58b38af68ce67c5 b/pkg/transformers/test_data/test_chain/!trie_db!0x151e5297e1c821d226d7df4a96b11752d522dcfd50b08d2cc58b38af68ce67c5 deleted file mode 100644 index 328e2375..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x151e5297e1c821d226d7df4a96b11752d522dcfd50b08d2cc58b38af68ce67c5 +++ /dev/null @@ -1 +0,0 @@ -"0xf891808080a03900e16f35744fd8e6732d9253866e50977eb123efb7ecb3ae0508b5d72afef280a0b2aea4b00c6faa6890b6e8256dcb98b86808a19ab61c59994ab8b8bdf9acfa4da0d1620f6254ebf95f7c5133c1faaeb0d95e4e47a6ef5f7e9cc0c1babbf99882e6808080808080a0daebc99a7107bb7774be5685fc91dc9b2a240431ff2477cb8b15d6cc57ae8bd5808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x1530dd82eba8342920e0b0e94f1caa940c9208ee1549369307fce12672f34fcc b/pkg/transformers/test_data/test_chain/!trie_db!0x1530dd82eba8342920e0b0e94f1caa940c9208ee1549369307fce12672f34fcc deleted file mode 100644 index 9c89cce4..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x1530dd82eba8342920e0b0e94f1caa940c9208ee1549369307fce12672f34fcc +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a003a6152e38d112bbb90b47ce492c6f8c7719668be7d71faedd55c522e8a756c7a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x157933e4f44b7ff7eb5b84bec2e32e7809151518a104fbff813500b0c235ab7c b/pkg/transformers/test_data/test_chain/!trie_db!0x157933e4f44b7ff7eb5b84bec2e32e7809151518a104fbff813500b0c235ab7c deleted file mode 100644 index 8e43ee90..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x157933e4f44b7ff7eb5b84bec2e32e7809151518a104fbff813500b0c235ab7c +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a0fb53e64824f62daa3a1598b6864c077c8b3feafa8d6f93bb5185dcd52a55f4b5" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x161a254a50e709306848b2b1932c171c039301fa9142d0727501a028e38ba0f9 b/pkg/transformers/test_data/test_chain/!trie_db!0x161a254a50e709306848b2b1932c171c039301fa9142d0727501a028e38ba0f9 deleted file mode 100644 index c464fc92..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x161a254a50e709306848b2b1932c171c039301fa9142d0727501a028e38ba0f9 +++ /dev/null @@ -1 +0,0 @@ -"0xf891808080a03900e16f35744fd8e6732d9253866e50977eb123efb7ecb3ae0508b5d72afef280a0b2aea4b00c6faa6890b6e8256dcb98b86808a19ab61c59994ab8b8bdf9acfa4da0d1620f6254ebf95f7c5133c1faaeb0d95e4e47a6ef5f7e9cc0c1babbf99882e6808080808080a02ac25c8b39e9ba3a99e3983a69cc607e6b2a4f04adbe1abb9167b8b5d454056e808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x162a37ba4b241919df4de217c7067bda5e49d83e82fe395a5e4d12b437a42cff b/pkg/transformers/test_data/test_chain/!trie_db!0x162a37ba4b241919df4de217c7067bda5e49d83e82fe395a5e4d12b437a42cff deleted file mode 100644 index 77280d4d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x162a37ba4b241919df4de217c7067bda5e49d83e82fe395a5e4d12b437a42cff +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a0e6e2c72b27c006bf6a0b3e89f9d5f2137134dd25d6560f27258078b60b15aaeca05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x16f0a9df893b180dfea7a14cd9bfa31961a121a44cde32886b8aeef67c78ec03 b/pkg/transformers/test_data/test_chain/!trie_db!0x16f0a9df893b180dfea7a14cd9bfa31961a121a44cde32886b8aeef67c78ec03 deleted file mode 100644 index ab16d6fe..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x16f0a9df893b180dfea7a14cd9bfa31961a121a44cde32886b8aeef67c78ec03 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d04890569376c14237fc800a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x193d91e77927d4dd6888eb3cd28c6c3570cef82bd0ce193d6d78a420d076988f b/pkg/transformers/test_data/test_chain/!trie_db!0x193d91e77927d4dd6888eb3cd28c6c3570cef82bd0ce193d6d78a420d076988f deleted file mode 100644 index 0c6f689c..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x193d91e77927d4dd6888eb3cd28c6c3570cef82bd0ce193d6d78a420d076988f +++ /dev/null @@ -1 +0,0 @@ -"0xf85fd720959438219779a699d67d7e7740b8c8f43d3e2dae2182a0bd71221ec6a606a213189d3d27d5da39a39474894d83029f1397c838c9ac428bcb2089880e92596fd6290000cc208a89093a80000000002a3080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x19abe03cab8ad9d724d76a8a409f5c7f02f48d24f48aaab91fbd8f0af1ab25d8 b/pkg/transformers/test_data/test_chain/!trie_db!0x19abe03cab8ad9d724d76a8a409f5c7f02f48d24f48aaab91fbd8f0af1ab25d8 deleted file mode 100644 index 9ed79f54..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x19abe03cab8ad9d724d76a8a409f5c7f02f48d24f48aaab91fbd8f0af1ab25d8 +++ /dev/null @@ -1 +0,0 @@ -"0xf90131a07c815b5979b2a34ecdf46a8d5fc1bb97b3a7ba7e4f814154d5982ecc39e0b63a80a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2a044d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f8080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0151e5297e1c821d226d7df4a96b11752d522dcfd50b08d2cc58b38af68ce67c5a0c31a76584f994c2a759c12f1cc81372888596ed0ec2fa57e6e99bb2c1db470b4a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a0c2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c487725080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x1ae66f56e80b6ce3f6dd2c657d165248c788005cbee34e61ff0a5459edae1722 b/pkg/transformers/test_data/test_chain/!trie_db!0x1ae66f56e80b6ce3f6dd2c657d165248c788005cbee34e61ff0a5459edae1722 deleted file mode 100644 index 2ef1809b..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x1ae66f56e80b6ce3f6dd2c657d165248c788005cbee34e61ff0a5459edae1722 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d0189056b64cb27c8321000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x1b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2 b/pkg/transformers/test_data/test_chain/!trie_db!0x1b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2 deleted file mode 100644 index d52787c7..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x1b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943463dbb283c08844ebc2aa38c225e3ebc6a0c4e4b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x1daf92424a9e4f706bb9234b6fb02fb4329318278fd032617e1786f2ccf66e3e b/pkg/transformers/test_data/test_chain/!trie_db!0x1daf92424a9e4f706bb9234b6fb02fb4329318278fd032617e1786f2ccf66e3e deleted file mode 100644 index f1000454..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x1daf92424a9e4f706bb9234b6fb02fb4329318278fd032617e1786f2ccf66e3e +++ /dev/null @@ -1 +0,0 @@ -"0xf90131a03438447aae59d759a4d06c10dfaf35c0f8a71dffb05ab251e40a65e313fd9e9080a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2a044d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f8080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0161a254a50e709306848b2b1932c171c039301fa9142d0727501a028e38ba0f9a0ec77d285a767ea2ec58ce52c0022aac4c71efc3f396f1989598c33e75e8bedd1a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a0c2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c487725080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x1e557e6b926d9d0134f16c89d535bef90b3eb53766480f01abdb8af373d9a59c b/pkg/transformers/test_data/test_chain/!trie_db!0x1e557e6b926d9d0134f16c89d535bef90b3eb53766480f01abdb8af373d9a59c deleted file mode 100644 index 3dc29211..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x1e557e6b926d9d0134f16c89d535bef90b3eb53766480f01abdb8af373d9a59c +++ /dev/null @@ -1 +0,0 @@ -"0xf8518080808080808080a0caabb5eace0c874816d18d87a14bdd47d6ca59824abbd2930b90caff6fd8d2588080808080a09d95a14094467e02ae8432ed98cded72b5b835a1d1ebd16704f595043e2ba1f88080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x1e566933d70b71a726f5cc492316cd71fe8ee35d224575d33e29280c409c3c8d b/pkg/transformers/test_data/test_chain/!trie_db!0x1e566933d70b71a726f5cc492316cd71fe8ee35d224575d33e29280c409c3c8d deleted file mode 100644 index 99ae3694..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x1e566933d70b71a726f5cc492316cd71fe8ee35d224575d33e29280c409c3c8d +++ /dev/null @@ -1 +0,0 @@ -"0xf871a0157933e4f44b7ff7eb5b84bec2e32e7809151518a104fbff813500b0c235ab7c808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b045580808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x21844edeb0c63d6c416c3ac4ccf639034227a206e8d39e76dadd463b61e5508b b/pkg/transformers/test_data/test_chain/!trie_db!0x21844edeb0c63d6c416c3ac4ccf639034227a206e8d39e76dadd463b61e5508b deleted file mode 100644 index 61aa46a6..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x21844edeb0c63d6c416c3ac4ccf639034227a206e8d39e76dadd463b61e5508b +++ /dev/null @@ -1 +0,0 @@ -"0xf85120b84ef84c80882a04b7209109f000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x221c15544fb2c48a614af13e7e982ccf155677eb4559bcb31ae2c5dc9462bd1f b/pkg/transformers/test_data/test_chain/!trie_db!0x221c15544fb2c48a614af13e7e982ccf155677eb4559bcb31ae2c5dc9462bd1f deleted file mode 100644 index 4c499cc7..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x221c15544fb2c48a614af13e7e982ccf155677eb4559bcb31ae2c5dc9462bd1f +++ /dev/null @@ -1 +0,0 @@ -"0xf85d9438219779a699d67d7e7740b8c8f43d3e2dae2182b846f8440180a0aedf1dbd059f29ddca302e42ae94381f71559c17f7d5f03ca4e49bba1f534459a0b66ab966cb58bb54b74fef7c873db3cfe39f1667ff01c5814956fa040efda263" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x24716f1f68fda94f79ba00d9f8a96dec0fd15a20e2c926c191d462b34acba94f b/pkg/transformers/test_data/test_chain/!trie_db!0x24716f1f68fda94f79ba00d9f8a96dec0fd15a20e2c926c191d462b34acba94f deleted file mode 100644 index 8eac2379..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x24716f1f68fda94f79ba00d9f8a96dec0fd15a20e2c926c191d462b34acba94f +++ /dev/null @@ -1 +0,0 @@ -"0xf85d9420cb6176addcca2e1d1ffe21bee464b72ee4cd8db846f8440180a03f5286f5cae259e122279b4ad4a24c5f98f82ec5b90976e8467e3d3e6445947ea09dda99178f00c917ef52162c403077b802a1e0897e3e175ba6bfa09b9b9e29ae" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x25fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577b b/pkg/transformers/test_data/test_chain/!trie_db!0x25fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577b deleted file mode 100644 index ce895faa..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x25fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577b +++ /dev/null @@ -1 +0,0 @@ -"0xf8669433086347c52a8878af71bb818509d484c6a2e1bfb84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x26eeb42d0c6d7914ad039df7694003b2f4f98adf0e0153a57c1f84532127f1c1 b/pkg/transformers/test_data/test_chain/!trie_db!0x26eeb42d0c6d7914ad039df7694003b2f4f98adf0e0153a57c1f84532127f1c1 deleted file mode 100644 index 916adde7..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x26eeb42d0c6d7914ad039df7694003b2f4f98adf0e0153a57c1f84532127f1c1 +++ /dev/null @@ -1 +0,0 @@ -"0xf851a0d8592c6f97b855e192b45cbc3a21093b529abc9cca3c368066d44aa31c9f0a57a0b975d8ac2b88dd356291b4d8f7b58de83b7a0632edb3ebaac088213b8538c22e808080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x294e0688e78b8ebe45c45e778e11e00302f5dc9d735569c1b5a4a0cf48b848e2 b/pkg/transformers/test_data/test_chain/!trie_db!0x294e0688e78b8ebe45c45e778e11e00302f5dc9d735569c1b5a4a0cf48b848e2 deleted file mode 100644 index caed1053..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x294e0688e78b8ebe45c45e778e11e00302f5dc9d735569c1b5a4a0cf48b848e2 +++ /dev/null @@ -1 +0,0 @@ -"0xea808080808080808080808080c22064d720959464d922894153be9eef7b7218dc565d1d0ce2a092808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x2ac25c8b39e9ba3a99e3983a69cc607e6b2a4f04adbe1abb9167b8b5d454056e b/pkg/transformers/test_data/test_chain/!trie_db!0x2ac25c8b39e9ba3a99e3983a69cc607e6b2a4f04adbe1abb9167b8b5d454056e deleted file mode 100644 index 4de3996c..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x2ac25c8b39e9ba3a99e3983a69cc607e6b2a4f04adbe1abb9167b8b5d454056e +++ /dev/null @@ -1 +0,0 @@ -"0xf86694207bee5fcfd8028cf7b00876c5b1421c800561a6b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x2b440d3b0b2327c14c3a867f273c26a6d198524da9ecffcc6dbe65b39ff6decf b/pkg/transformers/test_data/test_chain/!trie_db!0x2b440d3b0b2327c14c3a867f273c26a6d198524da9ecffcc6dbe65b39ff6decf deleted file mode 100644 index 00d71a3e..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x2b440d3b0b2327c14c3a867f273c26a6d198524da9ecffcc6dbe65b39ff6decf +++ /dev/null @@ -1 +0,0 @@ -"0xf891a07d057a734d406684b905569e243499dd5216cc2b606c65519b16edeaa3ed743b808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b0455a072fa55f4ee28320ddd7ffa2b28fa312896c37fccfb15d6d409cbcf4a6a342b82808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x316409abe1ceb4849f2756816ef63a6112def8047feb8701fe90c1101c78fe71 b/pkg/transformers/test_data/test_chain/!trie_db!0x316409abe1ceb4849f2756816ef63a6112def8047feb8701fe90c1101c78fe71 deleted file mode 100644 index c1891500..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x316409abe1ceb4849f2756816ef63a6112def8047feb8701fe90c1101c78fe71 +++ /dev/null @@ -1 +0,0 @@ -"0xf85d942070ed54e41d9db6d91db5e7ff7a9451dad98993b846f8440180a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0a966cb9d74a564c6798b583cbef8462394b3f99aa721ec871a2b8ee82f857c5a" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x334d59a6b826ca00e56207b7be9c9d3ffc03fe1bb8a08fc967edacac01f44005 b/pkg/transformers/test_data/test_chain/!trie_db!0x334d59a6b826ca00e56207b7be9c9d3ffc03fe1bb8a08fc967edacac01f44005 deleted file mode 100644 index 7953731a..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x334d59a6b826ca00e56207b7be9c9d3ffc03fe1bb8a08fc967edacac01f44005 +++ /dev/null @@ -1 +0,0 @@ -"0xf842a000240d12856c0964a2f9ad0c4011e50fe717957f8c336910a8727e772119ea7fa03df45dfd0e2d184dfcf3de07627ea3b523c2a291029632e4402d8616c03d70cf" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3438447aae59d759a4d06c10dfaf35c0f8a71dffb05ab251e40a65e313fd9e90 b/pkg/transformers/test_data/test_chain/!trie_db!0x3438447aae59d759a4d06c10dfaf35c0f8a71dffb05ab251e40a65e313fd9e90 deleted file mode 100644 index 11e51b45..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3438447aae59d759a4d06c10dfaf35c0f8a71dffb05ab251e40a65e313fd9e90 +++ /dev/null @@ -1 +0,0 @@ -"0xf871a0369ec720123cab87d401f1b284c66712344edab7ff4c99da27f5e77e6263d4cd808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b045580808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3545df9679886d70fa5b4d5fd3483749ad064ad7dcfcb0d530ec6eab49a03877 b/pkg/transformers/test_data/test_chain/!trie_db!0x3545df9679886d70fa5b4d5fd3483749ad064ad7dcfcb0d530ec6eab49a03877 deleted file mode 100644 index 76af8471..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3545df9679886d70fa5b4d5fd3483749ad064ad7dcfcb0d530ec6eab49a03877 +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a079543ccd0f558d5c5350afdfc3862b23e3ac166d432e8a268608ea046375137ea05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x354eb16bf2e29db7155a4a6bd376f4b8d456969ca8239266ce35ba948caaeb7e b/pkg/transformers/test_data/test_chain/!trie_db!0x354eb16bf2e29db7155a4a6bd376f4b8d456969ca8239266ce35ba948caaeb7e deleted file mode 100644 index 28bbcfed..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x354eb16bf2e29db7155a4a6bd376f4b8d456969ca8239266ce35ba948caaeb7e +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a05a548cb14b27785a732bcc95585605b033ff42b37b40803445ebbbf97dc179a8" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x369ec720123cab87d401f1b284c66712344edab7ff4c99da27f5e77e6263d4cd b/pkg/transformers/test_data/test_chain/!trie_db!0x369ec720123cab87d401f1b284c66712344edab7ff4c99da27f5e77e6263d4cd deleted file mode 100644 index 632e0839..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x369ec720123cab87d401f1b284c66712344edab7ff4c99da27f5e77e6263d4cd +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a03545df9679886d70fa5b4d5fd3483749ad064ad7dcfcb0d530ec6eab49a03877" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x372afacecb5d397370430cfa7481601253172b63d77e80278ab3d4895b20001b b/pkg/transformers/test_data/test_chain/!trie_db!0x372afacecb5d397370430cfa7481601253172b63d77e80278ab3d4895b20001b deleted file mode 100644 index 7941daad..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x372afacecb5d397370430cfa7481601253172b63d77e80278ab3d4895b20001b +++ /dev/null @@ -1 +0,0 @@ -"0xf8f180a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3900e16f35744fd8e6732d9253866e50977eb123efb7ecb3ae0508b5d72afef2 b/pkg/transformers/test_data/test_chain/!trie_db!0x3900e16f35744fd8e6732d9253866e50977eb123efb7ecb3ae0508b5d72afef2 deleted file mode 100644 index cbb9c849..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3900e16f35744fd8e6732d9253866e50977eb123efb7ecb3ae0508b5d72afef2 +++ /dev/null @@ -1 +0,0 @@ -"0xf866942040e006f4135ba6970d43bf43d88dcad4e7a8cab84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3a875851ff16b0c695633e0db893a7ec4043ecc3551cd7fc633f0032c3e7b326 b/pkg/transformers/test_data/test_chain/!trie_db!0x3a875851ff16b0c695633e0db893a7ec4043ecc3551cd7fc633f0032c3e7b326 deleted file mode 100644 index 614ad9b5..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3a875851ff16b0c695633e0db893a7ec4043ecc3551cd7fc633f0032c3e7b326 +++ /dev/null @@ -1 +0,0 @@ -"0xf85d943c0ba85028256ef48f5ba64dd65dc258988955f6b846f8440180a0af884a3280efc05cbccc0c8e2fbf065aaa4165652efa1d89d174d440c96e25cfa098cb48227dc1977d88644fff7161f5b23b5c2a3e21dc1c28468b10c7c84c791b" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3be1026c1b3878769a10a398a4ed467d60278e117ab6ec2b3d89e69618992bb7 b/pkg/transformers/test_data/test_chain/!trie_db!0x3be1026c1b3878769a10a398a4ed467d60278e117ab6ec2b3d89e69618992bb7 deleted file mode 100644 index a93e21cb..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3be1026c1b3878769a10a398a4ed467d60278e117ab6ec2b3d89e69618992bb7 +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a0e855e4e8bfd909066a8059e6796be225553e199a2c22f4b65ddaeea511d19014" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3c8ffa547eb6fc72e5db76cbe3575136c1aa46cdb7d974e86d26ddf52aeffc6e b/pkg/transformers/test_data/test_chain/!trie_db!0x3c8ffa547eb6fc72e5db76cbe3575136c1aa46cdb7d974e86d26ddf52aeffc6e deleted file mode 100644 index 5f678145..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3c8ffa547eb6fc72e5db76cbe3575136c1aa46cdb7d974e86d26ddf52aeffc6e +++ /dev/null @@ -1 +0,0 @@ -"0xf90131a0cd9a145c136f5eca333f964b63eff22e7d5a154dac0e47e2d9effcd796a5308f80a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2a044d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f8080a0dce4225c8f8ab070aacf8bd8759e71a54c27ec9724cb5d37c1a80370eef9bb65a0151e5297e1c821d226d7df4a96b11752d522dcfd50b08d2cc58b38af68ce67c5a0c31a76584f994c2a759c12f1cc81372888596ed0ec2fa57e6e99bb2c1db470b4a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a0c2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c487725080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3df45dfd0e2d184dfcf3de07627ea3b523c2a291029632e4402d8616c03d70cf b/pkg/transformers/test_data/test_chain/!trie_db!0x3df45dfd0e2d184dfcf3de07627ea3b523c2a291029632e4402d8616c03d70cf deleted file mode 100644 index 5e11c34d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3df45dfd0e2d184dfcf3de07627ea3b523c2a291029632e4402d8616c03d70cf +++ /dev/null @@ -1 +0,0 @@ -"0xf38080808080808080808080a06a9414509d1897a93d7701779bf75e343be5148f1740edcdf2f9935124adfc64c2200a80808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3e473a1ed587c1edee5e85718874bf87e3f17e314bc604df3820d5c71c249711 b/pkg/transformers/test_data/test_chain/!trie_db!0x3e473a1ed587c1edee5e85718874bf87e3f17e314bc604df3820d5c71c249711 deleted file mode 100644 index 6645d5fb..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3e473a1ed587c1edee5e85718874bf87e3f17e314bc604df3820d5c71c249711 +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a0a83e88c544f24f884fef77e11356372da4d7073fe1dc9b6d0672048f97461fbca05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3e9dee0a3894a2bd8b3ff56f496055d9c66346b4810abcf8ecc2f1ab13483e89 b/pkg/transformers/test_data/test_chain/!trie_db!0x3e9dee0a3894a2bd8b3ff56f496055d9c66346b4810abcf8ecc2f1ab13483e89 deleted file mode 100644 index 6308c405..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3e9dee0a3894a2bd8b3ff56f496055d9c66346b4810abcf8ecc2f1ab13483e89 +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a054ea506fbfef710a7ac83211106487c3920b195e7fc316d9e489de5bd09c77b2a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x3f5286f5cae259e122279b4ad4a24c5f98f82ec5b90976e8467e3d3e6445947e b/pkg/transformers/test_data/test_chain/!trie_db!0x3f5286f5cae259e122279b4ad4a24c5f98f82ec5b90976e8467e3d3e6445947e deleted file mode 100644 index b7b81870..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x3f5286f5cae259e122279b4ad4a24c5f98f82ec5b90976e8467e3d3e6445947e +++ /dev/null @@ -1 +0,0 @@ -"0xf842a01000000000000000000000000000000000000000000000000000000000000000a0193d91e77927d4dd6888eb3cd28c6c3570cef82bd0ce193d6d78a420d076988f" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f b/pkg/transformers/test_data/test_chain/!trie_db!0x406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f deleted file mode 100644 index 082efd67..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f +++ /dev/null @@ -1 +0,0 @@ -"0xf8669420243e26db94b5426032e6dfa6007802dea2a614b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x422861bc32af762face51a81dfb4e3f2d563beb99ee972cf1fa30b944e6b85f5 b/pkg/transformers/test_data/test_chain/!trie_db!0x422861bc32af762face51a81dfb4e3f2d563beb99ee972cf1fa30b944e6b85f5 deleted file mode 100644 index 3b24e60e..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x422861bc32af762face51a81dfb4e3f2d563beb99ee972cf1fa30b944e6b85f5 +++ /dev/null @@ -1 +0,0 @@ -"0xf871a062ab8b4e7f7569eb032e637fcdcfd5b561442347326a3ffca40ae225d0029d4c808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b045580808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x429b0f28e1011b174b50343f41f0d9cb6707fa8659ba6f0e93ff298b0f94cb49 b/pkg/transformers/test_data/test_chain/!trie_db!0x429b0f28e1011b174b50343f41f0d9cb6707fa8659ba6f0e93ff298b0f94cb49 deleted file mode 100644 index 03c6fc4f..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x429b0f28e1011b174b50343f41f0d9cb6707fa8659ba6f0e93ff298b0f94cb49 +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a03e9dee0a3894a2bd8b3ff56f496055d9c66346b4810abcf8ecc2f1ab13483e89" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x44d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f b/pkg/transformers/test_data/test_chain/!trie_db!0x44d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f deleted file mode 100644 index e12afd5e..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x44d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f +++ /dev/null @@ -1 +0,0 @@ -"0xf85d9438219779a699d67d7e7740b8c8f43d3e2dae2182b846f8440180a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0b66ab966cb58bb54b74fef7c873db3cfe39f1667ff01c5814956fa040efda263" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x45989b865ec84b498e81eb3804224799d80a0903e62502244ff3ab00af28a910 b/pkg/transformers/test_data/test_chain/!trie_db!0x45989b865ec84b498e81eb3804224799d80a0903e62502244ff3ab00af28a910 deleted file mode 100644 index 73c82584..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x45989b865ec84b498e81eb3804224799d80a0903e62502244ff3ab00af28a910 +++ /dev/null @@ -1 +0,0 @@ -"0xf85120b84ef84c8088a918828518403800a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x48be751a35aa9113a4b007a39e012fbd05984958b811673256623eb1e0b2d463 b/pkg/transformers/test_data/test_chain/!trie_db!0x48be751a35aa9113a4b007a39e012fbd05984958b811673256623eb1e0b2d463 deleted file mode 100644 index 877b000d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x48be751a35aa9113a4b007a39e012fbd05984958b811673256623eb1e0b2d463 +++ /dev/null @@ -1 +0,0 @@ -"0xf90131a0e1e9a9ea0c7be782a715d4444db86e0e6a408f7d7663d3d16c770a9d535feb6f80a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2a0221c15544fb2c48a614af13e7e982ccf155677eb4559bcb31ae2c5dc9462bd1f8080a0abcda7b93e50553667d1de3cb7cd9527b993f3495bffe594a0b8eecf3f74cbfba0151e5297e1c821d226d7df4a96b11752d522dcfd50b08d2cc58b38af68ce67c5a0c31a76584f994c2a759c12f1cc81372888596ed0ec2fa57e6e99bb2c1db470b4a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a0c2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c487725080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x48bef2949d1b9e743c3372264d49e8811a5e316cc7eb8a0eb12cc91159e9bc89 b/pkg/transformers/test_data/test_chain/!trie_db!0x48bef2949d1b9e743c3372264d49e8811a5e316cc7eb8a0eb12cc91159e9bc89 deleted file mode 100644 index 9446d601..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x48bef2949d1b9e743c3372264d49e8811a5e316cc7eb8a0eb12cc91159e9bc89 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d0389056b3d6dc5af27c000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x49d8c70a6f9beb022d9e57fbd45b8d49390d820889f2a835b74dc9bd160c5682 b/pkg/transformers/test_data/test_chain/!trie_db!0x49d8c70a6f9beb022d9e57fbd45b8d49390d820889f2a835b74dc9bd160c5682 deleted file mode 100644 index a6d43e8c..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x49d8c70a6f9beb022d9e57fbd45b8d49390d820889f2a835b74dc9bd160c5682 +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a03e473a1ed587c1edee5e85718874bf87e3f17e314bc604df3820d5c71c249711" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x4a620dd91dbe73f56ca2fbac126a6d98f36699888043bee37beaa2efd72f32d8 b/pkg/transformers/test_data/test_chain/!trie_db!0x4a620dd91dbe73f56ca2fbac126a6d98f36699888043bee37beaa2efd72f32d8 deleted file mode 100644 index 695305a4..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x4a620dd91dbe73f56ca2fbac126a6d98f36699888043bee37beaa2efd72f32d8 +++ /dev/null @@ -1 +0,0 @@ -"0xf8d1a0b849d833c3c299ab14d40e9dda4d67a6f2e7a5ec13ec49680683cdc24a3df77080a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a280808080a0a7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963a051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c194a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x4ef305cd67b97b743669faa6b70fab3c29d545df173e5798da1a3bef0efeb5d9 b/pkg/transformers/test_data/test_chain/!trie_db!0x4ef305cd67b97b743669faa6b70fab3c29d545df173e5798da1a3bef0efeb5d9 deleted file mode 100644 index b0cc304a..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x4ef305cd67b97b743669faa6b70fab3c29d545df173e5798da1a3bef0efeb5d9 +++ /dev/null @@ -1 +0,0 @@ -"0xf6940000000000000000000000000000000000000000a0372afacecb5d397370430cfa7481601253172b63d77e80278ab3d4895b20001b" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x4fa6053972ef0f71dfeca3ad2c42ef1471f7597831c1b4cda4508d211e1e5fe7 b/pkg/transformers/test_data/test_chain/!trie_db!0x4fa6053972ef0f71dfeca3ad2c42ef1471f7597831c1b4cda4508d211e1e5fe7 deleted file mode 100644 index b9a6ea75..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x4fa6053972ef0f71dfeca3ad2c42ef1471f7597831c1b4cda4508d211e1e5fe7 +++ /dev/null @@ -1 +0,0 @@ -"0xf842a01000000000000000000000000000000000000000000000000000000000000000a07ac0c41c0d80d8e020f83ae1b7f6bf62c1a5eca81c5d618a9512114809b884cb" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x506ea6c4ce6d0dbb8c3047fb0dc2a337dc2aa860aadb3b0d3bc7a19f09d88012 b/pkg/transformers/test_data/test_chain/!trie_db!0x506ea6c4ce6d0dbb8c3047fb0dc2a337dc2aa860aadb3b0d3bc7a19f09d88012 deleted file mode 100644 index 58c419e6..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x506ea6c4ce6d0dbb8c3047fb0dc2a337dc2aa860aadb3b0d3bc7a19f09d88012 +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a01e566933d70b71a726f5cc492316cd71fe8ee35d224575d33e29280c409c3c8d80a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2808080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0f39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80ca01ae66f56e80b6ce3f6dd2c657d165248c788005cbee34e61ff0a5459edae1722a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde280808080a03a875851ff16b0c695633e0db893a7ec4043ecc3551cd7fc633f0032c3e7b32680" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x5072a6c1e2e016ff4e5b6b35caf68673a43b7a13bb1fa82f2643bad3e4d1c253 b/pkg/transformers/test_data/test_chain/!trie_db!0x5072a6c1e2e016ff4e5b6b35caf68673a43b7a13bb1fa82f2643bad3e4d1c253 deleted file mode 100644 index d711d7bd..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x5072a6c1e2e016ff4e5b6b35caf68673a43b7a13bb1fa82f2643bad3e4d1c253 +++ /dev/null @@ -1 +0,0 @@ -"0xf8d180a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a80808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x50c257a83e805b0c15f7dcdac955e22e29b2c6a89be444e7b996602c26dfc4c6 b/pkg/transformers/test_data/test_chain/!trie_db!0x50c257a83e805b0c15f7dcdac955e22e29b2c6a89be444e7b996602c26dfc4c6 deleted file mode 100644 index 7f9b2ada..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x50c257a83e805b0c15f7dcdac955e22e29b2c6a89be444e7b996602c26dfc4c6 +++ /dev/null @@ -1 +0,0 @@ -"0xf8f1a0422861bc32af762face51a81dfb4e3f2d563beb99ee972cf1fa30b944e6b85f580a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2808080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0c34b6254fe0b63fd193c05815394207384070546c321e43b2c8fe77c7d2f909da051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c194a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x512797b9b116aadab3366c66cfbff2e4b0e5ff3d557efe4d820ecd930a306176 b/pkg/transformers/test_data/test_chain/!trie_db!0x512797b9b116aadab3366c66cfbff2e4b0e5ff3d557efe4d820ecd930a306176 deleted file mode 100644 index 029bb8b5..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x512797b9b116aadab3366c66cfbff2e4b0e5ff3d557efe4d820ecd930a306176 +++ /dev/null @@ -1 +0,0 @@ -"0xf85d943c0ba85028256ef48f5ba64dd65dc258988955f6b846f8440180a08b1ba0894221f78d2d10aa32895e2d402fe71d272af2994483bb9b56e2f1b6caa098cb48227dc1977d88644fff7161f5b23b5c2a3e21dc1c28468b10c7c84c791b" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x51e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c194 b/pkg/transformers/test_data/test_chain/!trie_db!0x51e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c194 deleted file mode 100644 index 19381344..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x51e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c194 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x54350d30b48d6984395cf168b20e31952619100e01a31e619f91393e34d80ab5 b/pkg/transformers/test_data/test_chain/!trie_db!0x54350d30b48d6984395cf168b20e31952619100e01a31e619f91393e34d80ab5 deleted file mode 100644 index d244c1c9..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x54350d30b48d6984395cf168b20e31952619100e01a31e619f91393e34d80ab5 +++ /dev/null @@ -1 +0,0 @@ -"0xf85e95200000000000000000000000000000000000000001b846f8448080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x54ea506fbfef710a7ac83211106487c3920b195e7fc316d9e489de5bd09c77b2 b/pkg/transformers/test_data/test_chain/!trie_db!0x54ea506fbfef710a7ac83211106487c3920b195e7fc316d9e489de5bd09c77b2 deleted file mode 100644 index 4a2dabef..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x54ea506fbfef710a7ac83211106487c3920b195e7fc316d9e489de5bd09c77b2 +++ /dev/null @@ -1 +0,0 @@ -"0xf85120b84ef84c808853b5c7d67efbb000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x562e1406eac4555052e43c2bdc9e21fd697837624e9fa4704e6ced900721fc08 b/pkg/transformers/test_data/test_chain/!trie_db!0x562e1406eac4555052e43c2bdc9e21fd697837624e9fa4704e6ced900721fc08 deleted file mode 100644 index aaae3d0c..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x562e1406eac4555052e43c2bdc9e21fd697837624e9fa4704e6ced900721fc08 +++ /dev/null @@ -1 +0,0 @@ -"0xf85220b84ff84d808901538d5d2d5da86000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x57507c46a4a2813bd15ab7628ad3cea6eee2913f9841d89f477c6685eeadb0f3 b/pkg/transformers/test_data/test_chain/!trie_db!0x57507c46a4a2813bd15ab7628ad3cea6eee2913f9841d89f477c6685eeadb0f3 deleted file mode 100644 index 65328c30..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x57507c46a4a2813bd15ab7628ad3cea6eee2913f9841d89f477c6685eeadb0f3 +++ /dev/null @@ -1 +0,0 @@ -"0xead720959438219779a699d67d7e7740b8c8f43d3e2dae218280c220018080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x5911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a b/pkg/transformers/test_data/test_chain/!trie_db!0x5911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a deleted file mode 100644 index 73bd6fef..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x5911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a +++ /dev/null @@ -1 +0,0 @@ -"0xf84920b846f8448080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x59199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b0455 b/pkg/transformers/test_data/test_chain/!trie_db!0x59199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b0455 deleted file mode 100644 index 149edfe4..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x59199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b0455 +++ /dev/null @@ -1 +0,0 @@ -"0xf8669420fa9ef6609ca7921112231f8f195138ebba2977b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x5a548cb14b27785a732bcc95585605b033ff42b37b40803445ebbbf97dc179a8 b/pkg/transformers/test_data/test_chain/!trie_db!0x5a548cb14b27785a732bcc95585605b033ff42b37b40803445ebbbf97dc179a8 deleted file mode 100644 index e9d9d3fe..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x5a548cb14b27785a732bcc95585605b033ff42b37b40803445ebbbf97dc179a8 +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a0d82a7e871271fe9e9a8e25d05978546987306eeedd6c1fde6ff89b01f7554405a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x5e287c9213b0dcabfdf484092e2b6133f6826e045c391501e80374760de69320 b/pkg/transformers/test_data/test_chain/!trie_db!0x5e287c9213b0dcabfdf484092e2b6133f6826e045c391501e80374760de69320 deleted file mode 100644 index bb473d2c..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x5e287c9213b0dcabfdf484092e2b6133f6826e045c391501e80374760de69320 +++ /dev/null @@ -1 +0,0 @@ -"0xf85180a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a8080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x60b37e6a056ee52545c169ae2074181fda1f14f9abb6363e4d9a152fd9f07c90 b/pkg/transformers/test_data/test_chain/!trie_db!0x60b37e6a056ee52545c169ae2074181fda1f14f9abb6363e4d9a152fd9f07c90 deleted file mode 100644 index 10321f0b..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x60b37e6a056ee52545c169ae2074181fda1f14f9abb6363e4d9a152fd9f07c90 +++ /dev/null @@ -1 +0,0 @@ -"0xead72095948e84a1e068d77059cbe263c43ad0cdc130863313c22002808080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x62ab8b4e7f7569eb032e637fcdcfd5b561442347326a3ffca40ae225d0029d4c b/pkg/transformers/test_data/test_chain/!trie_db!0x62ab8b4e7f7569eb032e637fcdcfd5b561442347326a3ffca40ae225d0029d4c deleted file mode 100644 index f81615a6..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x62ab8b4e7f7569eb032e637fcdcfd5b561442347326a3ffca40ae225d0029d4c +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a0372afacecb5d397370430cfa7481601253172b63d77e80278ab3d4895b20001b" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x63a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2 b/pkg/transformers/test_data/test_chain/!trie_db!0x63a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2 deleted file mode 100644 index 6308bd9f..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x63a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2 +++ /dev/null @@ -1 +0,0 @@ -"0xf8669433e37186e017747dba34042e83e3f76ad3cce9b0b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x65455aec5f2e81c82c26a1e0484d57985264872776eb895656179b208be6451b b/pkg/transformers/test_data/test_chain/!trie_db!0x65455aec5f2e81c82c26a1e0484d57985264872776eb895656179b208be6451b deleted file mode 100644 index e975bf8e..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x65455aec5f2e81c82c26a1e0484d57985264872776eb895656179b208be6451b +++ /dev/null @@ -1 +0,0 @@ -"0xf90131a0aeb877203026a5476c69d73319e819d642e2ddc74cf15a8b219afcd9d488be5b80a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2a044d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f8080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0151e5297e1c821d226d7df4a96b11752d522dcfd50b08d2cc58b38af68ce67c5a0be7ac73e79834cc32500daf7984ba02dfc883fb3fd00bdfef7a66054cc9c5a2da025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a0c2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c487725080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x66c5d0a6016165e537ac63b121df2d074c649a16b50ca7a2839abc5eb3894a9a b/pkg/transformers/test_data/test_chain/!trie_db!0x66c5d0a6016165e537ac63b121df2d074c649a16b50ca7a2839abc5eb3894a9a deleted file mode 100644 index fa0eb94b..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x66c5d0a6016165e537ac63b121df2d074c649a16b50ca7a2839abc5eb3894a9a +++ /dev/null @@ -1 +0,0 @@ -"0xe88080cb2089880e92596fd6290000cc208a89093a80000000002a3080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x67bcaf1d60f75a22d49b037c88c00e44733094250664cbfc9d9bbf9eda3ca745 b/pkg/transformers/test_data/test_chain/!trie_db!0x67bcaf1d60f75a22d49b037c88c00e44733094250664cbfc9d9bbf9eda3ca745 deleted file mode 100644 index aa17b399..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x67bcaf1d60f75a22d49b037c88c00e44733094250664cbfc9d9bbf9eda3ca745 +++ /dev/null @@ -1 +0,0 @@ -"0xf6941000000000000000000000000000000000000000a0fe3d828c2803bd586bc34641752157c205a391ec9a1b730031bccc77a9276b02" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x6a9414509d1897a93d7701779bf75e343be5148f1740edcdf2f9935124adfc64 b/pkg/transformers/test_data/test_chain/!trie_db!0x6a9414509d1897a93d7701779bf75e343be5148f1740edcdf2f9935124adfc64 deleted file mode 100644 index cc317c09..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x6a9414509d1897a93d7701779bf75e343be5148f1740edcdf2f9935124adfc64 +++ /dev/null @@ -1 +0,0 @@ -"0xe320a1a0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x6cebfe106ade0f88e6b68581d9f8b4def74d71d0cbf3ec3c5039ce6d0d2c35ae b/pkg/transformers/test_data/test_chain/!trie_db!0x6cebfe106ade0f88e6b68581d9f8b4def74d71d0cbf3ec3c5039ce6d0d2c35ae deleted file mode 100644 index f9035fff..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x6cebfe106ade0f88e6b68581d9f8b4def74d71d0cbf3ec3c5039ce6d0d2c35ae +++ /dev/null @@ -1 +0,0 @@ -"0xf842a01000000000000000000000000000000000000000000000000000000000000000a0a855e7870075f22bca3187c9fcf5f0ae0f9bcf0bc40aba289d2876006140eada" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x72fa55f4ee28320ddd7ffa2b28fa312896c37fccfb15d6d409cbcf4a6a342b82 b/pkg/transformers/test_data/test_chain/!trie_db!0x72fa55f4ee28320ddd7ffa2b28fa312896c37fccfb15d6d409cbcf4a6a342b82 deleted file mode 100644 index 70b28315..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x72fa55f4ee28320ddd7ffa2b28fa312896c37fccfb15d6d409cbcf4a6a342b82 +++ /dev/null @@ -1 +0,0 @@ -"0xf85d9420cb6176addcca2e1d1ffe21bee464b72ee4cd8db846f8440180a0731ee2886a490335c1aa4b528adfdca719605a1377f014a30224664502755fa6a09dda99178f00c917ef52162c403077b802a1e0897e3e175ba6bfa09b9b9e29ae" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x731ee2886a490335c1aa4b528adfdca719605a1377f014a30224664502755fa6 b/pkg/transformers/test_data/test_chain/!trie_db!0x731ee2886a490335c1aa4b528adfdca719605a1377f014a30224664502755fa6 deleted file mode 100644 index 110844c4..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x731ee2886a490335c1aa4b528adfdca719605a1377f014a30224664502755fa6 +++ /dev/null @@ -1 +0,0 @@ -"0xf851a0d8592c6f97b855e192b45cbc3a21093b529abc9cca3c368066d44aa31c9f0a57a0db65034b0cb52ce3cc1db6ba302a9d4e12b2b6e91d432961f2088d6d1d8cc976808080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x73b9acd169ae7c4768c29d7dbbc8944bed84f86ddade7f2b48a0b0d5592ec11b b/pkg/transformers/test_data/test_chain/!trie_db!0x73b9acd169ae7c4768c29d7dbbc8944bed84f86ddade7f2b48a0b0d5592ec11b deleted file mode 100644 index 533324be..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x73b9acd169ae7c4768c29d7dbbc8944bed84f86ddade7f2b48a0b0d5592ec11b +++ /dev/null @@ -1 +0,0 @@ -"0xf842a000471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017a07e41e42b954550a5bf0a63f8e729fcbbf8da38646338b50e31c2e7fff3b5cfa5" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x74952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03 b/pkg/transformers/test_data/test_chain/!trie_db!0x74952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03 deleted file mode 100644 index 4464d064..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x74952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03 +++ /dev/null @@ -1 +0,0 @@ -"0xf8669434d922894153be9eef7b7218dc565d1d0ce2a092b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x74fa5366290bbbc6072e78cf47c7eb339089174128a36e413312695be1c2f42f b/pkg/transformers/test_data/test_chain/!trie_db!0x74fa5366290bbbc6072e78cf47c7eb339089174128a36e413312695be1c2f42f deleted file mode 100644 index 1a414a9b..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x74fa5366290bbbc6072e78cf47c7eb339089174128a36e413312695be1c2f42f +++ /dev/null @@ -1 +0,0 @@ -"0xf842a01000000000000000000000000000000000000000000000000000000000000000a057507c46a4a2813bd15ab7628ad3cea6eee2913f9841d89f477c6685eeadb0f3" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7604b45506a0b39430208425bde0a01f3705f6c9b1756f6c93fdc09248227c94 b/pkg/transformers/test_data/test_chain/!trie_db!0x7604b45506a0b39430208425bde0a01f3705f6c9b1756f6c93fdc09248227c94 deleted file mode 100644 index c99a82e8..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7604b45506a0b39430208425bde0a01f3705f6c9b1756f6c93fdc09248227c94 +++ /dev/null @@ -1 +0,0 @@ -"0xf8b1a0b849d833c3c299ab14d40e9dda4d67a6f2e7a5ec13ec49680683cdc24a3df77080a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a280808080a0a7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963a051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c19480a063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7661280f0be4e17138aef98a3b2d8e313db3c4acab857d5f3cf3e6e2fbd8cbda b/pkg/transformers/test_data/test_chain/!trie_db!0x7661280f0be4e17138aef98a3b2d8e313db3c4acab857d5f3cf3e6e2fbd8cbda deleted file mode 100644 index 02514ba8..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7661280f0be4e17138aef98a3b2d8e313db3c4acab857d5f3cf3e6e2fbd8cbda +++ /dev/null @@ -1 +0,0 @@ -"0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063095ea7b3146100b457806318160ddd1461011957806323b872dd1461014457806336569e77146101c957806370a0823114610220578063a9059cbb14610277578063b753a98c146102dc578063bb35783b14610329578063daea85c514610396578063dd62ed3e146103d9578063f2d5d56b14610450575b600080fd5b3480156100c057600080fd5b506100ff600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061049d565b604051808215151515815260200191505060405180910390f35b34801561012557600080fd5b5061012e6105f4565b6040518082815260200191505060405180910390f35b34801561015057600080fd5b506101af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d2565b604051808215151515815260200191505060405180910390f35b3480156101d557600080fd5b506101de610a81565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022c57600080fd5b50610261600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa6565b6040518082815260200191505060405180910390f35b34801561028357600080fd5b506102c2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bbd565b604051808215151515815260200191505060405180910390f35b3480156102e857600080fd5b50610327600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd5565b005b34801561033557600080fd5b50610394600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610be5565b005b3480156103a257600080fd5b506103d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bf6565b005b3480156103e557600080fd5b5061043a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c24565b6040518082815260200191505060405180910390f35b34801561045c57600080fd5b5061049b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c49565b005b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055507f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92533847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8502604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16001905092915050565b60006b033b2e3c9fd0803ce80000006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc42e3096040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561068857600080fd5b505af115801561069c573d6000803e3d6000fd5b505050506040513d60208110156106b257600080fd5b81019080805190602001909291905050508115156106cc57fe5b04905090565b60003373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156107ac57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b156108c75781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561083c57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b8585856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b1580156109bf57600080fd5b505af11580156109d3573d6000803e3d6000fd5b505050507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1600190509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006b033b2e3c9fd0803ce80000006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636c25b346846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610b7157600080fd5b505af1158015610b85573d6000803e3d6000fd5b505050506040513d6020811015610b9b57600080fd5b8101908080519060200190929190505050811515610bb557fe5b049050919050565b6000610bca3384846106d2565b506001905092915050565b610be03383836106d2565b505050565b610bf08383836106d2565b50505050565b610c20817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61049d565b5050565b6001602052816000526040600020602052806000526040600020600091509150505481565b610c548233836106d2565b5050505600a165627a7a723058205ba33f32f961d260de79eb9763f7cd5ff7ac88d18cba75e66216d72317a5709b0029" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x77a5923f8e9ef2f5935c8efc6ba46597fc03d86301b3844fe5ebd02dbc3298b2 b/pkg/transformers/test_data/test_chain/!trie_db!0x77a5923f8e9ef2f5935c8efc6ba46597fc03d86301b3844fe5ebd02dbc3298b2 deleted file mode 100644 index e18a6ee0..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x77a5923f8e9ef2f5935c8efc6ba46597fc03d86301b3844fe5ebd02dbc3298b2 +++ /dev/null @@ -1 +0,0 @@ -"0xf3808080808080808080808080c22064a0a698486eab05e8aafce2080867bd63489acc93af9122d9cfdbfd323f1523baba808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x77ecddca419c697a6aae21fa9a02f85475aaa5b109d41dc35f1893dc5bb3cf72 b/pkg/transformers/test_data/test_chain/!trie_db!0x77ecddca419c697a6aae21fa9a02f85475aaa5b109d41dc35f1893dc5bb3cf72 deleted file mode 100644 index 292c5e8d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x77ecddca419c697a6aae21fa9a02f85475aaa5b109d41dc35f1893dc5bb3cf72 +++ /dev/null @@ -1 +0,0 @@ -"0xf6941000000000000000000000000000000000000000a0372afacecb5d397370430cfa7481601253172b63d77e80278ab3d4895b20001b" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7857f0f18874ffb3d54af6e413368716e3b932b92c1e5e625e6dc947c3eb3248 b/pkg/transformers/test_data/test_chain/!trie_db!0x7857f0f18874ffb3d54af6e413368716e3b932b92c1e5e625e6dc947c3eb3248 deleted file mode 100644 index 925a2ed1..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7857f0f18874ffb3d54af6e413368716e3b932b92c1e5e625e6dc947c3eb3248 +++ /dev/null @@ -1 +0,0 @@ -"0xf871a0a5c81c7c0d0cdaed4b866b2da6cbf578a099740bced6d6ea401a08ff99e63fcd808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b045580808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7876d09d07838d1e8aa713fdcb1da8149ab4fe2240dfa1ce57ec821d5b18c981 b/pkg/transformers/test_data/test_chain/!trie_db!0x7876d09d07838d1e8aa713fdcb1da8149ab4fe2240dfa1ce57ec821d5b18c981 deleted file mode 100644 index e684bfd4..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7876d09d07838d1e8aa713fdcb1da8149ab4fe2240dfa1ce57ec821d5b18c981 +++ /dev/null @@ -1 +0,0 @@ -"0xf851a04ef305cd67b97b743669faa6b70fab3c29d545df173e5798da1a3bef0efeb5d980808080808080a051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c1948080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x79543ccd0f558d5c5350afdfc3862b23e3ac166d432e8a268608ea046375137e b/pkg/transformers/test_data/test_chain/!trie_db!0x79543ccd0f558d5c5350afdfc3862b23e3ac166d432e8a268608ea046375137e deleted file mode 100644 index 845688ef..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x79543ccd0f558d5c5350afdfc3862b23e3ac166d432e8a268608ea046375137e +++ /dev/null @@ -1 +0,0 @@ -"0xf85220b84ff84d80890128a0abc65fd45800a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x79b9aa7f3bfc53dde3d5f06102bce3649bc358aa26ea150ada9053e81bf7f579 b/pkg/transformers/test_data/test_chain/!trie_db!0x79b9aa7f3bfc53dde3d5f06102bce3649bc358aa26ea150ada9053e81bf7f579 deleted file mode 100644 index 18f79cc9..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x79b9aa7f3bfc53dde3d5f06102bce3649bc358aa26ea150ada9053e81bf7f579 +++ /dev/null @@ -1 +0,0 @@ -"0xf84880a0bd71221ec6a606a213189d3d27d5da39a39474894d83029f1397c838c9ac428bcb2089880e92596fd6290000cc208a89093a80000000002a3080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7ac0c41c0d80d8e020f83ae1b7f6bf62c1a5eca81c5d618a9512114809b884cb b/pkg/transformers/test_data/test_chain/!trie_db!0x7ac0c41c0d80d8e020f83ae1b7f6bf62c1a5eca81c5d618a9512114809b884cb deleted file mode 100644 index 91f556ab..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7ac0c41c0d80d8e020f83ae1b7f6bf62c1a5eca81c5d618a9512114809b884cb +++ /dev/null @@ -1 +0,0 @@ -"0xe18080cb2089880e92596fd6290000c52083822a3080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7b25204f93e559dc7c1fc1a4b9fdf17f217e89849d6c5e36c99619f168b2101c b/pkg/transformers/test_data/test_chain/!trie_db!0x7b25204f93e559dc7c1fc1a4b9fdf17f217e89849d6c5e36c99619f168b2101c deleted file mode 100644 index 7f10cab3..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7b25204f93e559dc7c1fc1a4b9fdf17f217e89849d6c5e36c99619f168b2101c +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a045989b865ec84b498e81eb3804224799d80a0903e62502244ff3ab00af28a910a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7c815b5979b2a34ecdf46a8d5fc1bb97b3a7ba7e4f814154d5982ecc39e0b63a b/pkg/transformers/test_data/test_chain/!trie_db!0x7c815b5979b2a34ecdf46a8d5fc1bb97b3a7ba7e4f814154d5982ecc39e0b63a deleted file mode 100644 index c8df8ed8..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7c815b5979b2a34ecdf46a8d5fc1bb97b3a7ba7e4f814154d5982ecc39e0b63a +++ /dev/null @@ -1 +0,0 @@ -"0xf891a0354eb16bf2e29db7155a4a6bd376f4b8d456969ca8239266ce35ba948caaeb7e808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b0455a024716f1f68fda94f79ba00d9f8a96dec0fd15a20e2c926c191d462b34acba94f808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7d057a734d406684b905569e243499dd5216cc2b606c65519b16edeaa3ed743b b/pkg/transformers/test_data/test_chain/!trie_db!0x7d057a734d406684b905569e243499dd5216cc2b606c65519b16edeaa3ed743b deleted file mode 100644 index 0433af30..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7d057a734d406684b905569e243499dd5216cc2b606c65519b16edeaa3ed743b +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a0162a37ba4b241919df4de217c7067bda5e49d83e82fe395a5e4d12b437a42cff" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7e41e42b954550a5bf0a63f8e729fcbbf8da38646338b50e31c2e7fff3b5cfa5 b/pkg/transformers/test_data/test_chain/!trie_db!0x7e41e42b954550a5bf0a63f8e729fcbbf8da38646338b50e31c2e7fff3b5cfa5 deleted file mode 100644 index dafc1734..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7e41e42b954550a5bf0a63f8e729fcbbf8da38646338b50e31c2e7fff3b5cfa5 +++ /dev/null @@ -1 +0,0 @@ -"0xf84a808080808080808080808080c22064a0a698486eab05e8aafce2080867bd63489acc93af9122d9cfdbfd323f1523babad72095947340e006f4135ba6970d43bf43d88dcad4e7a8ca8080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7f58526de3503c41aa43ef3fb1891a4f45c21d7b16f3f99f4e558a33436f1f76 b/pkg/transformers/test_data/test_chain/!trie_db!0x7f58526de3503c41aa43ef3fb1891a4f45c21d7b16f3f99f4e558a33436f1f76 deleted file mode 100644 index 350683ec..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7f58526de3503c41aa43ef3fb1891a4f45c21d7b16f3f99f4e558a33436f1f76 +++ /dev/null @@ -1 +0,0 @@ -"0xf8669420e37186e017747dba34042e83e3f76ad3cce9b0b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x7fb0f90f7cb04e7e00015bbf2ccb39c9efdce13b1272dd0b428faed488b05fde b/pkg/transformers/test_data/test_chain/!trie_db!0x7fb0f90f7cb04e7e00015bbf2ccb39c9efdce13b1272dd0b428faed488b05fde deleted file mode 100644 index 5c0d032f..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x7fb0f90f7cb04e7e00015bbf2ccb39c9efdce13b1272dd0b428faed488b05fde +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a0cf2759c659bd860d34b51ade81828c957ccf8622569c2cb25a546bd325a84a2580a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2808080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0f39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80ca048bef2949d1b9e743c3372264d49e8811a5e316cc7eb8a0eb12cc91159e9bc89a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a0512797b9b116aadab3366c66cfbff2e4b0e5ff3d557efe4d820ecd930a30617680" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x83097864ebee0be81925b10976490ab2c71a0643e9f16e16807811b7112ed032 b/pkg/transformers/test_data/test_chain/!trie_db!0x83097864ebee0be81925b10976490ab2c71a0643e9f16e16807811b7112ed032 deleted file mode 100644 index fe96610e..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x83097864ebee0be81925b10976490ab2c71a0643e9f16e16807811b7112ed032 +++ /dev/null @@ -1 +0,0 @@ -"0xf6941000000000000000000000000000000000000000a098ad39fb8468cbcb93a0990018ded196413ef989c0062341ff886889f39ab41b" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x83cbaef3696047cce6331a82207455b14fe95994662a6c9133552594ce6c95aa b/pkg/transformers/test_data/test_chain/!trie_db!0x83cbaef3696047cce6331a82207455b14fe95994662a6c9133552594ce6c95aa deleted file mode 100644 index cfe9a9c3..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x83cbaef3696047cce6331a82207455b14fe95994662a6c9133552594ce6c95aa +++ /dev/null @@ -1 +0,0 @@ -"0xf8669434d922894153be9eef7b7218dc565d1d0ce2a092b84ff84d0389056bc75e2d630b4409a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x8424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe b/pkg/transformers/test_data/test_chain/!trie_db!0x8424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe deleted file mode 100644 index c8e873bd..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x8424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe +++ /dev/null @@ -1 +0,0 @@ -"0xf851808080a07f58526de3503c41aa43ef3fb1891a4f45c21d7b16f3f99f4e558a33436f1f768080808080a0316409abe1ceb4849f2756816ef63a6112def8047feb8701fe90c1101c78fe7180808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x86981bd51e6d3e80868efc10e47ae05e5b490888d9de8efee4c3e08291b13c51 b/pkg/transformers/test_data/test_chain/!trie_db!0x86981bd51e6d3e80868efc10e47ae05e5b490888d9de8efee4c3e08291b13c51 deleted file mode 100644 index 9ef7f551..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x86981bd51e6d3e80868efc10e47ae05e5b490888d9de8efee4c3e08291b13c51 +++ /dev/null @@ -1 +0,0 @@ -"0xf380808080808080a0903b04e989376399328450ad3e8710fba28b3530dd3076696f7fc9844df0d094c230328080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x87ff3bbe1430ed5cc0f2cc2ad5b75f139955ef1aa3d618d17cef880433e70dc6 b/pkg/transformers/test_data/test_chain/!trie_db!0x87ff3bbe1430ed5cc0f2cc2ad5b75f139955ef1aa3d618d17cef880433e70dc6 deleted file mode 100644 index d967f810..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x87ff3bbe1430ed5cc0f2cc2ad5b75f139955ef1aa3d618d17cef880433e70dc6 +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a0c10146e60c892a940009077be47b47625f3ca8023e92cc10bf73329a699933ad" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x8a083a05cf77f2f36f6c055ac468fc88ab99335759bb47d22b0947229f0b170a b/pkg/transformers/test_data/test_chain/!trie_db!0x8a083a05cf77f2f36f6c055ac468fc88ab99335759bb47d22b0947229f0b170a deleted file mode 100644 index d1b4951e..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x8a083a05cf77f2f36f6c055ac468fc88ab99335759bb47d22b0947229f0b170a +++ /dev/null @@ -1 +0,0 @@ -"0xf6941000000000000000000000000000000000000000a05e287c9213b0dcabfdf484092e2b6133f6826e045c391501e80374760de69320" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x8ac88fd296fe71814c119087c21bae16a9e5809241b5bd5a36845a5f5d357a6e b/pkg/transformers/test_data/test_chain/!trie_db!0x8ac88fd296fe71814c119087c21bae16a9e5809241b5bd5a36845a5f5d357a6e deleted file mode 100644 index 3326d915..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x8ac88fd296fe71814c119087c21bae16a9e5809241b5bd5a36845a5f5d357a6e +++ /dev/null @@ -1 +0,0 @@ -"0xf851a0d8592c6f97b855e192b45cbc3a21093b529abc9cca3c368066d44aa31c9f0a57a0ed89ce8c7b8d2657d679fd3eb25076b5d12bd24ecfd91f2b19891722703a43e2808080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x8b1ba0894221f78d2d10aa32895e2d402fe71d272af2994483bb9b56e2f1b6ca b/pkg/transformers/test_data/test_chain/!trie_db!0x8b1ba0894221f78d2d10aa32895e2d402fe71d272af2994483bb9b56e2f1b6ca deleted file mode 100644 index 54729896..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x8b1ba0894221f78d2d10aa32895e2d402fe71d272af2994483bb9b56e2f1b6ca +++ /dev/null @@ -1 +0,0 @@ -"0xf842a01000000000000000000000000000000000000000000000000000000000000000a0c2509c936c6a49946f4d1f8ea285ba22df97bb1283f3b5a8326d7ee1b2ba2ed2" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x8e9dd18a2a9762cc0e7a01eb55499cfbddd821895c655e75c7607cf896b6c0da b/pkg/transformers/test_data/test_chain/!trie_db!0x8e9dd18a2a9762cc0e7a01eb55499cfbddd821895c655e75c7607cf896b6c0da deleted file mode 100644 index 2de2de4e..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x8e9dd18a2a9762cc0e7a01eb55499cfbddd821895c655e75c7607cf896b6c0da +++ /dev/null @@ -1 +0,0 @@ -"0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305db45381461010157806307a832b41461012c5780630e01198b14610157578063143e55e0146101825780632506855a146101bd57806329ae8114146101ea5780632a1d2b3c1461022557806335aee16f1461025057806349dd5bb21461028557806353cb8def146102b057806364bd7013146102db578063697efb78146103065780637f49edc4146103335780639361266c1461037c578063bbbb0d7b146103a7578063d0adc35f146103d2578063d4e8be83146103fd578063f37ac61c1461044e575b600080fd5b34801561010d57600080fd5b5061011661047b565b6040518082815260200191505060405180910390f35b34801561013857600080fd5b5061014161049b565b6040518082815260200191505060405180910390f35b34801561016357600080fd5b5061016c6105b0565b6040518082815260200191505060405180910390f35b34801561018e57600080fd5b50610197610706565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b3480156101c957600080fd5b506101e86004803603810190808035906020019092919050505061070e565b005b3480156101f657600080fd5b50610223600480360381019080803560001916906020019092919080359060200190929190505050610864565b005b34801561023157600080fd5b5061023a610917565b6040518082815260200191505060405180910390f35b34801561025c57600080fd5b50610283600480360381019080803565ffffffffffff16906020019092919050505061091d565b005b34801561029157600080fd5b5061029a6109b3565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c56109b9565b6040518082815260200191505060405180910390f35b3480156102e757600080fd5b506102f06109bf565b6040518082815260200191505060405180910390f35b34801561031257600080fd5b50610331600480360381019080803590602001909291905050506109c5565b005b34801561033f57600080fd5b50610366600480360381019080803565ffffffffffff169060200190929190505050610a3c565b6040518082815260200191505060405180910390f35b34801561038857600080fd5b50610391610a54565b6040518082815260200191505060405180910390f35b3480156103b357600080fd5b506103bc610a5a565b6040518082815260200191505060405180910390f35b3480156103de57600080fd5b506103e7610bdc565b6040518082815260200191505060405180910390f35b34801561040957600080fd5b5061044c6004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610be2565b005b34801561045a57600080fd5b5061047960048036038101908080359060200190929190505050610da2565b005b600061049661048e600454600554610ef8565b600654610ef8565b905090565b60006b033b2e3c9fd0803ce80000006000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636c25b346306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561056657600080fd5b505af115801561057a573d6000803e3d6000fd5b505050506040513d602081101561059057600080fd5b81019080805190602001909291905050508115156105aa57fe5b04905090565b60006105d06105c86105c061047b565b600854610ef8565b600954610ef8565b6105d861049b565b101515156105e557600080fd5b60006005541415156105f657600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b7e9cd243060085460006040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b1580156106c657600080fd5b505af11580156106da573d6000803e3d6000fd5b505050506040513d60208110156106f057600080fd5b8101908080519060200190929190505050905090565b600042905090565b6006548111158015610727575061072361049b565b8111155b8015610734575060008112155b151561073f57600080fd5b61074b60065482610f14565b6006819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee8cd7483030846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561084957600080fd5b505af115801561085d573d6000803e3d6000fd5b5050505050565b7f6c756d70000000000000000000000000000000000000000000000000000000008260001916141561089857806008819055505b7f7061640000000000000000000000000000000000000000000000000000000000826000191614156108cc57806009819055505b7f8a9b1ca0a6295c2e892a579edd3076c4914c2a82a4d5caab9420945c64c7fe4182826040518083600019166000191681526020018281526020019250505060405180910390a15050565b60065481565b61094c600454600360008465ffffffffffff1665ffffffffffff16815260200190815260200160002054610f14565b600481905550610981600554600360008465ffffffffffff1665ffffffffffff16815260200190815260200160002054610ef8565b6005819055506000600360008365ffffffffffff1665ffffffffffff1681526020019081526020016000208190555050565b60055481565b60085481565b60075481565b6109f9600360006109d4610706565b65ffffffffffff1665ffffffffffff1681526020019081526020016000205482610ef8565b60036000610a05610706565b65ffffffffffff1665ffffffffffff16815260200190815260200160002081905550610a3360045482610ef8565b60048190555050565b60036020528060005260406000206000915090505481565b60095481565b600060085460055410151515610a6f57600080fd5b6000610a7961049b565b141515610a8557600080fd5b610a93600554600854610f14565b600581905550610aa7600654600854610ef8565b600681905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b7e9cd24307fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6008546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019350505050602060405180830381600087803b158015610b9c57600080fd5b505af1158015610bb0573d6000803e3d6000fd5b505050506040513d6020811015610bc657600080fd5b8101908080519060200190929190505050905090565b60045481565b7f666c61700000000000000000000000000000000000000000000000000000000082600019161415610c505780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7f666c6f700000000000000000000000000000000000000000000000000000000082600019161415610cbe5780600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7f766174000000000000000000000000000000000000000000000000000000000082600019161415610d2b57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7fa8113be4b615eb027dc9305f13990b41b39a3fcb82bf872ce96a40827831e4d182826040518083600019166000191681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b610daa61049b565b8111158015610dbb57506005548111155b8015610dc8575060008112155b1515610dd357600080fd5b610ddf60055482610f14565b6005819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee8cd7483030846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610edd57600080fd5b505af1158015610ef1573d6000803e3d6000fd5b5050505050565b60008183019050828110151515610f0e57600080fd5b92915050565b60008183039050828111151515610f2a57600080fd5b929150505600a165627a7a7230582072b3db6bacdfa5af0372b289ff3a98ea4ee2d522a25b03c7669d2fccd135abde0029" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x9002532949cb4c50b9cd01c41e0ecfe9b2f4e7c0f2551d1ad2d5c6f05a0a1198 b/pkg/transformers/test_data/test_chain/!trie_db!0x9002532949cb4c50b9cd01c41e0ecfe9b2f4e7c0f2551d1ad2d5c6f05a0a1198 deleted file mode 100644 index 285ebaf1..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x9002532949cb4c50b9cd01c41e0ecfe9b2f4e7c0f2551d1ad2d5c6f05a0a1198 +++ /dev/null @@ -1 +0,0 @@ -"0xf842a000471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017a0903b04e989376399328450ad3e8710fba28b3530dd3076696f7fc9844df0d094" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x903b04e989376399328450ad3e8710fba28b3530dd3076696f7fc9844df0d094 b/pkg/transformers/test_data/test_chain/!trie_db!0x903b04e989376399328450ad3e8710fba28b3530dd3076696f7fc9844df0d094 deleted file mode 100644 index af20479b..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x903b04e989376399328450ad3e8710fba28b3530dd3076696f7fc9844df0d094 +++ /dev/null @@ -1 +0,0 @@ -"0xf861808080808080808080808080c22064a0a698486eab05e8aafce2080867bd63489acc93af9122d9cfdbfd323f1523babad72095947340e006f4135ba6970d43bf43d88dcad4e7a8cad720959407fa9ef6609ca7921112231f8f195138ebba297780" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x903b0cd1beb1b190eb88e579ed2cdedd31e48e7e4f9c188b6068620d222b568e b/pkg/transformers/test_data/test_chain/!trie_db!0x903b0cd1beb1b190eb88e579ed2cdedd31e48e7e4f9c188b6068620d222b568e deleted file mode 100644 index ef7c88e9..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x903b0cd1beb1b190eb88e579ed2cdedd31e48e7e4f9c188b6068620d222b568e +++ /dev/null @@ -1 +0,0 @@ -"0xf85120b84ef84c8088d2c43efd0f083800a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x907b9cb17ed4afdf1e49593aa2a077f3019a7e851ec9faf4b21ad72aea963675 b/pkg/transformers/test_data/test_chain/!trie_db!0x907b9cb17ed4afdf1e49593aa2a077f3019a7e851ec9faf4b21ad72aea963675 deleted file mode 100644 index db2835f0..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x907b9cb17ed4afdf1e49593aa2a077f3019a7e851ec9faf4b21ad72aea963675 +++ /dev/null @@ -1 +0,0 @@ -"0xf842a000471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017a0294e0688e78b8ebe45c45e778e11e00302f5dc9d735569c1b5a4a0cf48b848e2" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x96a4cfbd7fbdfe5ae66bd6e9a07673a25c21b0561775ad9613e4a05b0c7f27a7 b/pkg/transformers/test_data/test_chain/!trie_db!0x96a4cfbd7fbdfe5ae66bd6e9a07673a25c21b0561775ad9613e4a05b0c7f27a7 deleted file mode 100644 index b09667f6..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x96a4cfbd7fbdfe5ae66bd6e9a07673a25c21b0561775ad9613e4a05b0c7f27a7 +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a0aa9f11e9216645caffc0b16ba04465953bbe7a9d5c1e321f1f022d21d86bc13880a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2808080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0f39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80ca0bea5ac5b5b294572a69eeb79ac50511dad8558456cbd1f0f99342215d69d141ca025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde280808080a0512797b9b116aadab3366c66cfbff2e4b0e5ff3d557efe4d820ecd930a30617680" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x977f3e78fd927245d850c04695f06db28c3c19f59f40e67ad6e7558c31669a10 b/pkg/transformers/test_data/test_chain/!trie_db!0x977f3e78fd927245d850c04695f06db28c3c19f59f40e67ad6e7558c31669a10 deleted file mode 100644 index bf6c3305..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x977f3e78fd927245d850c04695f06db28c3c19f59f40e67ad6e7558c31669a10 +++ /dev/null @@ -1 +0,0 @@ -"0xf842a01000000000000000000000000000000000000000000000000000000000000000a079b9aa7f3bfc53dde3d5f06102bce3649bc358aa26ea150ada9053e81bf7f579" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x98ad39fb8468cbcb93a0990018ded196413ef989c0062341ff886889f39ab41b b/pkg/transformers/test_data/test_chain/!trie_db!0x98ad39fb8468cbcb93a0990018ded196413ef989c0062341ff886889f39ab41b deleted file mode 100644 index 43f3b84b..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x98ad39fb8468cbcb93a0990018ded196413ef989c0062341ff886889f39ab41b +++ /dev/null @@ -1 +0,0 @@ -"0xf8b180a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a8080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x98cb48227dc1977d88644fff7161f5b23b5c2a3e21dc1c28468b10c7c84c791b b/pkg/transformers/test_data/test_chain/!trie_db!0x98cb48227dc1977d88644fff7161f5b23b5c2a3e21dc1c28468b10c7c84c791b deleted file mode 100644 index 3012cd48..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x98cb48227dc1977d88644fff7161f5b23b5c2a3e21dc1c28468b10c7c84c791b +++ /dev/null @@ -1 +0,0 @@ -"0x608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100aa5780638da5cb5b146100d5578063fdacd5761461012c575b600080fd5b34801561007357600080fd5b506100a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610159565b005b3480156100b657600080fd5b506100bf610241565b6040518082815260200191505060405180910390f35b3480156100e157600080fd5b506100ea610247565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561013857600080fd5b506101576004803603810190808035906020019092919050505061026c565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023d578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561022457600080fd5b505af1158015610238573d6000803e3d6000fd5b505050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102c957806001819055505b505600a165627a7a72305820248859af1d09c2b1e0f445f0b5d9022e93fe3d74bd99f3328b20a491c951c1410029" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x9bdb510955ca6fd0ae2d5c77ab871254c9a8bb50cdaa80816a22151cea8c27fa b/pkg/transformers/test_data/test_chain/!trie_db!0x9bdb510955ca6fd0ae2d5c77ab871254c9a8bb50cdaa80816a22151cea8c27fa deleted file mode 100644 index 497a8adb..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x9bdb510955ca6fd0ae2d5c77ab871254c9a8bb50cdaa80816a22151cea8c27fa +++ /dev/null @@ -1 +0,0 @@ -"0xf85d943c0ba85028256ef48f5ba64dd65dc258988955f6b846f8440180a0db0af948d55394775495207faf2541a5432ef2b567e0f6faccb7e193d64d48cfa098cb48227dc1977d88644fff7161f5b23b5c2a3e21dc1c28468b10c7c84c791b" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x9d95a14094467e02ae8432ed98cded72b5b835a1d1ebd16704f595043e2ba1f8 b/pkg/transformers/test_data/test_chain/!trie_db!0x9d95a14094467e02ae8432ed98cded72b5b835a1d1ebd16704f595043e2ba1f8 deleted file mode 100644 index 453822a6..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x9d95a14094467e02ae8432ed98cded72b5b835a1d1ebd16704f595043e2ba1f8 +++ /dev/null @@ -1 +0,0 @@ -"0xf843a03240d12856c0964a2f9ad0c4011e50fe717957f8c336910a8727e772119ea7fba1a0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0x9dda99178f00c917ef52162c403077b802a1e0897e3e175ba6bfa09b9b9e29ae b/pkg/transformers/test_data/test_chain/!trie_db!0x9dda99178f00c917ef52162c403077b802a1e0897e3e175ba6bfa09b9b9e29ae deleted file mode 100644 index 6065aa6f..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0x9dda99178f00c917ef52162c403077b802a1e0897e3e175ba6bfa09b9b9e29ae +++ /dev/null @@ -1 +0,0 @@ -"0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063143e55e0146100ca578063351de6001461010557806336569e771461019a5780634423c5f1146101f15780634b43ed12146103075780634e8b1dd5146103485780635ff3a382146103835780637d780d82146103c4578063c5ce281e146103ef578063c959c42b14610422578063cfc4af551461044f578063cfdd33021461048a578063fc7b6aee146104b5575b600080fd5b3480156100d657600080fd5b506100df6104e2565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b34801561011157600080fd5b50610184600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001909291905050506104ea565b6040518082815260200191505060405180910390f35b3480156101a657600080fd5b506101af6108ae565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101fd57600080fd5b5061021c600480360381019080803590602001909291905050506108d3565b604051808981526020018881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018665ffffffffffff1665ffffffffffff1681526020018565ffffffffffff1665ffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019850505050505050505060405180910390f35b34801561031357600080fd5b5061034660048036038101908080359060200190929190803590602001909291908035906020019092919050505061099f565b005b34801561035457600080fd5b5061035d610ffd565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b34801561038f57600080fd5b506103c2600480360381019080803590602001909291908035906020019092919080359060200190929190505050611015565b005b3480156103d057600080fd5b506103d961161a565b6040518082815260200191505060405180910390f35b3480156103fb57600080fd5b50610404611620565b60405180826000191660001916815260200191505060405180910390f35b34801561042e57600080fd5b5061044d60048036038101908080359060200190929190505050611626565b005b34801561045b57600080fd5b50610464611961565b604051808265ffffffffffff1665ffffffffffff16815260200191505060405180910390f35b34801561049657600080fd5b5061049f611979565b6040518082815260200191505060405180910390f35b3480156104c157600080fd5b506104e06004803603810190808035906020019092919050505061197f565b005b600042905090565b6000806004600081546001019190508190559050826005600083815260200190815260200160002060000181905550836005600083815260200190815260200160002060010181905550336005600083815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360069054906101000a900465ffffffffffff166105a66104e2565b0160056000838152602001908152602001600020600201601a6101000a81548165ffffffffffff021916908365ffffffffffff160217905550866005600083815260200190815260200160002060030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550856005600083815260200190815260200160002060040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460056000838152602001908152602001600020600501819055507f8828a22eb6a18623309ad55592866c4b077989e9e8a25e1b85f9bf6f7282520f816000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166001548787338c600560008a8152602001908152602001600020600201601a9054906101000a900465ffffffffffff166107206104e2565b600560008c815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560008d815260200190815260200160002060050154604051808c81526020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a600019166000191681526020018981526020018881526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018565ffffffffffff1665ffffffffffff1681526020018465ffffffffffff1665ffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019b50505050505050505050505060405180910390a18091505095945050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60056020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160149054906101000a900465ffffffffffff169080600201601a9054906101000a900465ffffffffffff16908060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060050154905088565b60006005600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156109fb57600080fd5b610a036104e2565b65ffffffffffff166005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff161180610a78575060006005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff16145b1515610a8357600080fd5b610a8b6104e2565b65ffffffffffff1660056000858152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff16111515610ad057600080fd5b600560008481526020019081526020016000206001015482141515610af457600080fd5b60056000848152602001908152602001600020600501548111151515610b1957600080fd5b600560008481526020019081526020016000206000015481111515610b3d57600080fd5b610b5f6002546005600086815260200190815260200160002060000154611a64565b610b7182670de0b6b3a7640000611a64565b101580610b935750600560008481526020019081526020016000206005015481145b1515610b9e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b336005600087815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660056000888152602001908152602001600020600001546040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610ce257600080fd5b505af1158015610cf6573d6000803e3d6000fd5b505050506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b336005600087815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560008881526020019081526020016000206000015485036040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610e4057600080fd5b505af1158015610e54573d6000803e3d6000fd5b50505050336005600085815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550806005600085815260200190815260200160002060000181905550600360009054906101000a900465ffffffffffff16610ee56104e2565b016005600085815260200190815260200160002060020160146101000a81548165ffffffffffff021916908365ffffffffffff1602179055507fd4aef477d7912041a69c5b85f2d78b618c76e40a4a92b91122c85ab5b404a64a838383336005600089815260200190815260200160002060020160149054906101000a900465ffffffffffff16610f746104e2565b604051808781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018365ffffffffffff1665ffffffffffff1681526020018265ffffffffffff1665ffffffffffff168152602001965050505050505060405180910390a1505050565b600360009054906101000a900465ffffffffffff1681565b60006005600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561107157600080fd5b6110796104e2565b65ffffffffffff166005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff1611806110ee575060006005600085815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff16145b15156110f957600080fd5b6111016104e2565b65ffffffffffff1660056000858152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff1611151561114657600080fd5b60056000848152602001908152602001600020600001548114151561116a57600080fd5b60056000848152602001908152602001600020600501548114151561118e57600080fd5b6005600084815260200190815260200160002060010154821015156111b257600080fd5b6111da6005600085815260200190815260200160002060010154670de0b6b3a7640000611a64565b6111e660025484611a64565b111515156111f357600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bb35783b336005600087815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561132157600080fd5b505af1158015611335573d6000803e3d6000fd5b505050506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637cdd3fde6001546005600087815260200190815260200160002060030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856005600089815260200190815260200160002060010154036040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561145d57600080fd5b505af1158015611471573d6000803e3d6000fd5b50505050336005600085815260200190815260200160002060020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816005600085815260200190815260200160002060010181905550600360009054906101000a900465ffffffffffff166115026104e2565b016005600085815260200190815260200160002060020160146101000a81548165ffffffffffff021916908365ffffffffffff1602179055507f380cb3bf83f57ec05d0229938aeb5d4fba1de0228097701d1c03379c88cec5d4838383336005600089815260200190815260200160002060020160149054906101000a900465ffffffffffff166115916104e2565b604051808781526020018681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018365ffffffffffff1665ffffffffffff1681526020018265ffffffffffff1665ffffffffffff168152602001965050505050505060405180910390a1505050565b60025481565b60015481565b61162e6104e2565b65ffffffffffff166005600083815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff161080156116a5575060006005600083815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff1614155b806116ee57506116b36104e2565b65ffffffffffff1660056000838152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff16105b15156116f957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637cdd3fde6001546005600085815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660056000868152602001908152602001600020600101546040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600019166000191681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561181b57600080fd5b505af115801561182f573d6000803e3d6000fd5b505050506005600082815260200190815260200160002060008082016000905560018201600090556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160146101000a81549065ffffffffffff021916905560028201601a6101000a81549065ffffffffffff02191690556003820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556004820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600582016000905550507f9b83ce9ac5e3a4e55a5b95c0e529b8cbe35d29682e2d851f51dd4e0bf9a6d3d1816119326104e2565b604051808381526020018265ffffffffffff1665ffffffffffff1681526020019250505060405180910390a150565b600360069054906101000a900465ffffffffffff1681565b60045481565b6119876104e2565b65ffffffffffff1660056000838152602001908152602001600020600201601a9054906101000a900465ffffffffffff1665ffffffffffff161015156119cc57600080fd5b60006005600083815260200190815260200160002060020160149054906101000a900465ffffffffffff1665ffffffffffff16141515611a0b57600080fd5b600360069054906101000a900465ffffffffffff16611a286104e2565b0160056000838152602001908152602001600020600201601a6101000a81548165ffffffffffff021916908365ffffffffffff16021790555050565b600080821480611a8357508282838502925082811515611a8057fe5b04145b1515611a8e57600080fd5b929150505600a165627a7a72305820be360886965ff94b58c48a287326520577aeb8e46a36d2c7f0ea9c040eaa9dbe0029" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xa5c81c7c0d0cdaed4b866b2da6cbf578a099740bced6d6ea401a08ff99e63fcd b/pkg/transformers/test_data/test_chain/!trie_db!0xa5c81c7c0d0cdaed4b866b2da6cbf578a099740bced6d6ea401a08ff99e63fcd deleted file mode 100644 index 100af517..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xa5c81c7c0d0cdaed4b866b2da6cbf578a099740bced6d6ea401a08ff99e63fcd +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a01530dd82eba8342920e0b0e94f1caa940c9208ee1549369307fce12672f34fcc" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xa698486eab05e8aafce2080867bd63489acc93af9122d9cfdbfd323f1523baba b/pkg/transformers/test_data/test_chain/!trie_db!0xa698486eab05e8aafce2080867bd63489acc93af9122d9cfdbfd323f1523baba deleted file mode 100644 index c15a64ff..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xa698486eab05e8aafce2080867bd63489acc93af9122d9cfdbfd323f1523baba +++ /dev/null @@ -1 +0,0 @@ -"0xe1209f9e5b7f217400000000000064d922894153be9eef7b7218dc565d1d0ce2a092" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xa7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963 b/pkg/transformers/test_data/test_chain/!trie_db!0xa7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963 deleted file mode 100644 index e38f5866..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xa7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943d7bee5fcfd8028cf7b00876c5b1421c800561a6b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xa83e88c544f24f884fef77e11356372da4d7073fe1dc9b6d0672048f97461fbc b/pkg/transformers/test_data/test_chain/!trie_db!0xa83e88c544f24f884fef77e11356372da4d7073fe1dc9b6d0672048f97461fbc deleted file mode 100644 index 1e84308d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xa83e88c544f24f884fef77e11356372da4d7073fe1dc9b6d0672048f97461fbc +++ /dev/null @@ -1 +0,0 @@ -"0xf85220b84ff84d808901a98b6b0efcfacb55a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xa855e7870075f22bca3187c9fcf5f0ae0f9bcf0bc40aba289d2876006140eada b/pkg/transformers/test_data/test_chain/!trie_db!0xa855e7870075f22bca3187c9fcf5f0ae0f9bcf0bc40aba289d2876006140eada deleted file mode 100644 index ae84baf0..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xa855e7870075f22bca3187c9fcf5f0ae0f9bcf0bc40aba289d2876006140eada +++ /dev/null @@ -1 +0,0 @@ -"0xf861d720959438219779a699d67d7e7740b8c8f43d3e2dae2182a0bd71221ec6a606a213189d3d27d5da39a39474894d83029f1397c838c9ac428bcb2089880e92596fd6290000cc208a89093a80000000002a30c22001808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xa8e1de3e2a1305af70ac8d37e88888df7db23a75e44a5eb1f7da957cb254af85 b/pkg/transformers/test_data/test_chain/!trie_db!0xa8e1de3e2a1305af70ac8d37e88888df7db23a75e44a5eb1f7da957cb254af85 deleted file mode 100644 index cb44d523..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xa8e1de3e2a1305af70ac8d37e88888df7db23a75e44a5eb1f7da957cb254af85 +++ /dev/null @@ -1 +0,0 @@ -"0xf90131a02b440d3b0b2327c14c3a867f273c26a6d198524da9ecffcc6dbe65b39ff6decf80a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2a00e90d9cbe0bf11f02708860522fb09308ce0db17ba249df1a4aa8802824f374e8080a083cbaef3696047cce6331a82207455b14fe95994662a6c9133552594ce6c95aaa0151e5297e1c821d226d7df4a96b11752d522dcfd50b08d2cc58b38af68ce67c5a0c31a76584f994c2a759c12f1cc81372888596ed0ec2fa57e6e99bb2c1db470b4a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a0c2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c487725080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xa966cb9d74a564c6798b583cbef8462394b3f99aa721ec871a2b8ee82f857c5a b/pkg/transformers/test_data/test_chain/!trie_db!0xa966cb9d74a564c6798b583cbef8462394b3f99aa721ec871a2b8ee82f857c5a deleted file mode 100644 index d46d2dd8..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xa966cb9d74a564c6798b583cbef8462394b3f99aa721ec871a2b8ee82f857c5a +++ /dev/null @@ -1 +0,0 @@ -"0x6080604052600080fd00a165627a7a72305820e87fe4eeacae18669e2102297afe663d59888094e838594e73a01821fc8d2a640029" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xaa9f11e9216645caffc0b16ba04465953bbe7a9d5c1e321f1f022d21d86bc138 b/pkg/transformers/test_data/test_chain/!trie_db!0xaa9f11e9216645caffc0b16ba04465953bbe7a9d5c1e321f1f022d21d86bc138 deleted file mode 100644 index a729c897..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xaa9f11e9216645caffc0b16ba04465953bbe7a9d5c1e321f1f022d21d86bc138 +++ /dev/null @@ -1 +0,0 @@ -"0xf871a0429b0f28e1011b174b50343f41f0d9cb6707fa8659ba6f0e93ff298b0f94cb49808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b045580808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xabcda7b93e50553667d1de3cb7cd9527b993f3495bffe594a0b8eecf3f74cbfb b/pkg/transformers/test_data/test_chain/!trie_db!0xabcda7b93e50553667d1de3cb7cd9527b993f3495bffe594a0b8eecf3f74cbfb deleted file mode 100644 index b66f0409..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xabcda7b93e50553667d1de3cb7cd9527b993f3495bffe594a0b8eecf3f74cbfb +++ /dev/null @@ -1 +0,0 @@ -"0xf8669434d922894153be9eef7b7218dc565d1d0ce2a092b84ff84d0289056bc75e2d630cdc8da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xac9d0eff487a98fc0b595eb169f9866cced41ca9315a0e432aed14baad4ad852 b/pkg/transformers/test_data/test_chain/!trie_db!0xac9d0eff487a98fc0b595eb169f9866cced41ca9315a0e432aed14baad4ad852 deleted file mode 100644 index dec01d22..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xac9d0eff487a98fc0b595eb169f9866cced41ca9315a0e432aed14baad4ad852 +++ /dev/null @@ -1 +0,0 @@ -"0xf85d94203f2400f1600f3f493a9a92704a29b96795af1ab846f8440180a074fa5366290bbbc6072e78cf47c7eb339089174128a36e413312695be1c2f42fa0070abfdf0f48e22d8997a1da98af511067fa17d3472bb7b2053e26663154e6b5" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xaddb2cdc826bed296244e295c743fc71d8ca532144f8c7122a7c65adec0d9745 b/pkg/transformers/test_data/test_chain/!trie_db!0xaddb2cdc826bed296244e295c743fc71d8ca532144f8c7122a7c65adec0d9745 deleted file mode 100644 index e1abaa53..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xaddb2cdc826bed296244e295c743fc71d8ca532144f8c7122a7c65adec0d9745 +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a008cb51ef4d2a0a75ebaf16e59652f0a909bf9a461c2916e8b600f7e0b4c03624" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xaeb877203026a5476c69d73319e819d642e2ddc74cf15a8b219afcd9d488be5b b/pkg/transformers/test_data/test_chain/!trie_db!0xaeb877203026a5476c69d73319e819d642e2ddc74cf15a8b219afcd9d488be5b deleted file mode 100644 index 3806e9b3..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xaeb877203026a5476c69d73319e819d642e2ddc74cf15a8b219afcd9d488be5b +++ /dev/null @@ -1 +0,0 @@ -"0xf871a03be1026c1b3878769a10a398a4ed467d60278e117ab6ec2b3d89e69618992bb7808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b045580808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xaedf1dbd059f29ddca302e42ae94381f71559c17f7d5f03ca4e49bba1f534459 b/pkg/transformers/test_data/test_chain/!trie_db!0xaedf1dbd059f29ddca302e42ae94381f71559c17f7d5f03ca4e49bba1f534459 deleted file mode 100644 index 3f38706a..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xaedf1dbd059f29ddca302e42ae94381f71559c17f7d5f03ca4e49bba1f534459 +++ /dev/null @@ -1 +0,0 @@ -"0xe3a120835712d0afd7315e74b2750e2c6d51d6eaac342dc2f35273b6398841c43c123232" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xaf884a3280efc05cbccc0c8e2fbf065aaa4165652efa1d89d174d440c96e25cf b/pkg/transformers/test_data/test_chain/!trie_db!0xaf884a3280efc05cbccc0c8e2fbf065aaa4165652efa1d89d174d440c96e25cf deleted file mode 100644 index 51d299f7..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xaf884a3280efc05cbccc0c8e2fbf065aaa4165652efa1d89d174d440c96e25cf +++ /dev/null @@ -1 +0,0 @@ -"0xf838a120000000000000000000000000000000000000000000000000000000000000000095948e84a1e068d77059cbe263c43ad0cdc130863313" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xafc7c6a8161d69dc1b082bbf799d38f88c2f251a7504b87039b2a4f682cbf323 b/pkg/transformers/test_data/test_chain/!trie_db!0xafc7c6a8161d69dc1b082bbf799d38f88c2f251a7504b87039b2a4f682cbf323 deleted file mode 100644 index 37b70ed5..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xafc7c6a8161d69dc1b082bbf799d38f88c2f251a7504b87039b2a4f682cbf323 +++ /dev/null @@ -1 +0,0 @@ -"0xf8f1a0422861bc32af762face51a81dfb4e3f2d563beb99ee972cf1fa30b944e6b85f580a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2808080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0f39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80ca051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c194a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xb2aea4b00c6faa6890b6e8256dcb98b86808a19ab61c59994ab8b8bdf9acfa4d b/pkg/transformers/test_data/test_chain/!trie_db!0xb2aea4b00c6faa6890b6e8256dcb98b86808a19ab61c59994ab8b8bdf9acfa4d deleted file mode 100644 index 24ce005a..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xb2aea4b00c6faa6890b6e8256dcb98b86808a19ab61c59994ab8b8bdf9acfa4d +++ /dev/null @@ -1 +0,0 @@ -"0xf866942026eb4f95e2a1394797cb38a921fb1eba09291bb84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xb66ab966cb58bb54b74fef7c873db3cfe39f1667ff01c5814956fa040efda263 b/pkg/transformers/test_data/test_chain/!trie_db!0xb66ab966cb58bb54b74fef7c873db3cfe39f1667ff01c5814956fa040efda263 deleted file mode 100644 index 1a0fc69e..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xb66ab966cb58bb54b74fef7c873db3cfe39f1667ff01c5814956fa040efda263 +++ /dev/null @@ -1 +0,0 @@ -"0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806311045bee146100d55780632424be5c1461015a57806327219087146101cd5780632d61a3551461023a5780636c25b346146102655780637cdd3fde146102bc578063815d245d14610317578063a4593c5214610360578063b65337df146103c5578063bb35783b14610420578063d9638d361461048d578063dc42e309146104d9578063ee8cd74814610504578063f059212a14610571575b600080fd5b3480156100e157600080fd5b506101586004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506105c8565b005b34801561016657600080fd5b506101a96004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610819565b60405180848152602001838152602001828152602001935050505060405180910390f35b3480156101d957600080fd5b50610238600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610850565b005b34801561024657600080fd5b5061024f610abc565b6040518082815260200191505060405180910390f35b34801561027157600080fd5b506102a6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac2565b6040518082815260200191505060405180910390f35b3480156102c857600080fd5b506103156004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ada565b005b34801561032357600080fd5b5061035e6004803603810190808035600019169060200190929190803560001916906020019092919080359060200190929190505050610c0e565b005b34801561036c57600080fd5b506103c36004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050610c63565b005b3480156103d157600080fd5b5061041e6004803603810190808035600019169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ec7565b005b34801561042c57600080fd5b5061048b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611077565b005b34801561049957600080fd5b506104bc6004803603810190808035600019169060200190929190505050611097565b604051808381526020018281526020019250505060405180910390f35b3480156104e557600080fd5b506104ee6110bb565b6040518082815260200191505060405180910390f35b34801561051057600080fd5b5061056f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110c1565b005b34801561057d57600080fd5b506105b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061139d565b6040518082815260200191505060405180910390f35b60008060036000886000191660001916815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060026000886000191660001916815260200190815260200160002090506106508260010154856113b5565b82600101819055506106668260020154846113b5565b826002018190555061067c8160010154846113b5565b81600101819055506106da600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106d58360000154866113f6565b611462565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107366005546107318360000154866113f6565b611462565b6005819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8308661076d8460000154876113f6565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f6772616200000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a150505050505050565b6003602052816000526040600020602052806000526040600020600091509150508060000154908060010154908060020154905083565b6000610868826b033b2e3c9fd0803ce80000006113f6565b90506108b26000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611462565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061093c6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826113b5565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f25e802ca4c681361b4e886aa3337404f6931451d42a314f69f9381f483b4020b848483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a160008060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412158015610aab575060008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412155b1515610ab657600080fd5b50505050565b60055481565b60006020528060005260406000206000915090505481565b610b3f60036000856000191660001916815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154826113b5565b60036000856000191660001916815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600060036000856000191660001916815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015412151515610c0957600080fd5b505050565b7f726174650000000000000000000000000000000000000000000000000000000082600019161415610c5e5780600260008560001916600019168152602001908152602001600020600001819055505b505050565b60008060036000876000191660001916815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002091506002600087600019166000191681526020019081526020016000209050610ceb826000015485611462565b8260000181905550610d018260010154856113b5565b8260010181905550610d178260020154846113b5565b8260020181905550610d2d8160010154846113b5565b8160010181905550610d8a6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d858360000154866113f6565b6113b5565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610de5600454610de08360000154866113f6565b6113b5565b6004819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b83086610e1c8460000154876113f6565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f74756e6500000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a1505050505050565b6000806002600086600019166000191681526020019081526020016000209150610ef58260000154846113b5565b8260000181905550610f0b8260010154846113f6565b9050610f556000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054826113b5565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fa3600454826113b5565b6004819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8308583604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f666f6c6400000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a15050505050565b6000811215151561108757600080fd5b611092838383610850565b505050565b60026020528060005260406000206000915090508060000154908060010154905082565b60045481565b60006110d9826b033b2e3c9fd0803ce80000006113f6565b9050611124600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611462565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111af6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611462565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111fd60055482611462565b60058190555061120f60045482611462565b6004819055507fd7176cd3481e210e438a7a7ebd026b079f7009a955df920778ee60eb0a2fa1b8308483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001807f6865616c00000000000000000000000000000000000000000000000000000000815250602001935050505060405180910390a16000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541215801561136b575060008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205412155b151561137657600080fd5b60006005541215801561138c5750600060045412155b151561139757600080fd5b50505050565b60016020528060005260406000206000915090505481565b600081830190506000821315806113cb57508281135b15156113d657600080fd5b6000821215806113e557508281125b15156113f057600080fd5b92915050565b6000818302905060008212158061142d57507f80000000000000000000000000000000000000000000000000000000000000008314155b151561143857600080fd5b6000821480611451575082828281151561144e57fe5b05145b151561145c57600080fd5b92915050565b60007f8000000000000000000000000000000000000000000000000000000000000000821415151561149357600080fd5b6114a083836000036113b5565b9050929150505600a165627a7a72305820fe3b4cc787b56823b0000494bdc149bd06182ff3067aff805573ec2791616c630029" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xb849d833c3c299ab14d40e9dda4d67a6f2e7a5ec13ec49680683cdc24a3df770 b/pkg/transformers/test_data/test_chain/!trie_db!0xb849d833c3c299ab14d40e9dda4d67a6f2e7a5ec13ec49680683cdc24a3df770 deleted file mode 100644 index 4f3a51a7..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xb849d833c3c299ab14d40e9dda4d67a6f2e7a5ec13ec49680683cdc24a3df770 +++ /dev/null @@ -1 +0,0 @@ -"0xf851a062ab8b4e7f7569eb032e637fcdcfd5b561442347326a3ffca40ae225d0029d4c8080808080808080808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xb975d8ac2b88dd356291b4d8f7b58de83b7a0632edb3ebaac088213b8538c22e b/pkg/transformers/test_data/test_chain/!trie_db!0xb975d8ac2b88dd356291b4d8f7b58de83b7a0632edb3ebaac088213b8538c22e deleted file mode 100644 index 0eb361dc..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xb975d8ac2b88dd356291b4d8f7b58de83b7a0632edb3ebaac088213b8538c22e +++ /dev/null @@ -1 +0,0 @@ -"0xf842a000471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017a077a5923f8e9ef2f5935c8efc6ba46597fc03d86301b3844fe5ebd02dbc3298b2" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xb9bea21fee534e5d3a2efe93f17da081408739047e6491ea9058ec3b0b205326 b/pkg/transformers/test_data/test_chain/!trie_db!0xb9bea21fee534e5d3a2efe93f17da081408739047e6491ea9058ec3b0b205326 deleted file mode 100644 index 8e53e3f6..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xb9bea21fee534e5d3a2efe93f17da081408739047e6491ea9058ec3b0b205326 +++ /dev/null @@ -1 +0,0 @@ -"0xf90131a0bdde419a2f900b2d8212f399532144a371cbacfbd707bbba51a213a44423aae380a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2a044d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f8080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0f39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80ca016f0a9df893b180dfea7a14cd9bfa31961a121a44cde32886b8aeef67c78ec03a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a0512797b9b116aadab3366c66cfbff2e4b0e5ff3d557efe4d820ecd930a30617680" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xbd71221ec6a606a213189d3d27d5da39a39474894d83029f1397c838c9ac428b b/pkg/transformers/test_data/test_chain/!trie_db!0xbd71221ec6a606a213189d3d27d5da39a39474894d83029f1397c838c9ac428b deleted file mode 100644 index 45790c52..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xbd71221ec6a606a213189d3d27d5da39a39474894d83029f1397c838c9ac428b +++ /dev/null @@ -1 +0,0 @@ -"0xe320a1a066616b6520696c6b000000000000000000000000000000000000000000000000" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xbd787bfe3f6c07ebc0a38c8b58602d63db9e2a7766462a4a946306126aeb8d99 b/pkg/transformers/test_data/test_chain/!trie_db!0xbd787bfe3f6c07ebc0a38c8b58602d63db9e2a7766462a4a946306126aeb8d99 deleted file mode 100644 index ffb13715..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xbd787bfe3f6c07ebc0a38c8b58602d63db9e2a7766462a4a946306126aeb8d99 +++ /dev/null @@ -1 +0,0 @@ -"0xf851a0d8592c6f97b855e192b45cbc3a21093b529abc9cca3c368066d44aa31c9f0a57a09002532949cb4c50b9cd01c41e0ecfe9b2f4e7c0f2551d1ad2d5c6f05a0a1198808080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xbdde419a2f900b2d8212f399532144a371cbacfbd707bbba51a213a44423aae3 b/pkg/transformers/test_data/test_chain/!trie_db!0xbdde419a2f900b2d8212f399532144a371cbacfbd707bbba51a213a44423aae3 deleted file mode 100644 index 1ed7520f..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xbdde419a2f900b2d8212f399532144a371cbacfbd707bbba51a213a44423aae3 +++ /dev/null @@ -1 +0,0 @@ -"0xf871a0d08975b46ac1b1f8e2b45d20715c97db1e33fb7ee0a0c5de07c377436a52a88f808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b045580808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xbe7ac73e79834cc32500daf7984ba02dfc883fb3fd00bdfef7a66054cc9c5a2d b/pkg/transformers/test_data/test_chain/!trie_db!0xbe7ac73e79834cc32500daf7984ba02dfc883fb3fd00bdfef7a66054cc9c5a2d deleted file mode 100644 index 32fb18f0..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xbe7ac73e79834cc32500daf7984ba02dfc883fb3fd00bdfef7a66054cc9c5a2d +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d088905654b21d7b6c7a000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xbea5ac5b5b294572a69eeb79ac50511dad8558456cbd1f0f99342215d69d141c b/pkg/transformers/test_data/test_chain/!trie_db!0xbea5ac5b5b294572a69eeb79ac50511dad8558456cbd1f0f99342215d69d141c deleted file mode 100644 index 8d8c07ed..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xbea5ac5b5b294572a69eeb79ac50511dad8558456cbd1f0f99342215d69d141c +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d0289056b55de8cd06c5000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xc10146e60c892a940009077be47b47625f3ca8023e92cc10bf73329a699933ad b/pkg/transformers/test_data/test_chain/!trie_db!0xc10146e60c892a940009077be47b47625f3ca8023e92cc10bf73329a699933ad deleted file mode 100644 index ff6ffcd5..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xc10146e60c892a940009077be47b47625f3ca8023e92cc10bf73329a699933ad +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a00e1adb36bae65d3155a1a7f0ab1f18cb8bd59db49e62cdebf6705b13116e15caa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xc2509c936c6a49946f4d1f8ea285ba22df97bb1283f3b5a8326d7ee1b2ba2ed2 b/pkg/transformers/test_data/test_chain/!trie_db!0xc2509c936c6a49946f4d1f8ea285ba22df97bb1283f3b5a8326d7ee1b2ba2ed2 deleted file mode 100644 index e9daf740..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xc2509c936c6a49946f4d1f8ea285ba22df97bb1283f3b5a8326d7ee1b2ba2ed2 +++ /dev/null @@ -1 +0,0 @@ -"0xead72095948e84a1e068d77059cbe263c43ad0cdc130863313c22001808080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xc2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c4877250 b/pkg/transformers/test_data/test_chain/!trie_db!0xc2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c4877250 deleted file mode 100644 index 559ba853..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xc2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c4877250 +++ /dev/null @@ -1 +0,0 @@ -"0xf851808080808080808080808080a0ca8b42e2b8d76c3b83702676bba49ba99eb83413f2680ef6ba27a8557eef84818080a0ac9d0eff487a98fc0b595eb169f9866cced41ca9315a0e432aed14baad4ad85280" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xc31a76584f994c2a759c12f1cc81372888596ed0ec2fa57e6e99bb2c1db470b4 b/pkg/transformers/test_data/test_chain/!trie_db!0xc31a76584f994c2a759c12f1cc81372888596ed0ec2fa57e6e99bb2c1db470b4 deleted file mode 100644 index 85eef111..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xc31a76584f994c2a759c12f1cc81372888596ed0ec2fa57e6e99bb2c1db470b4 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d09890562915c2c03cfb000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xc34b6254fe0b63fd193c05815394207384070546c321e43b2c8fe77c7d2f909d b/pkg/transformers/test_data/test_chain/!trie_db!0xc34b6254fe0b63fd193c05815394207384070546c321e43b2c8fe77c7d2f909d deleted file mode 100644 index f91726c0..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xc34b6254fe0b63fd193c05815394207384070546c321e43b2c8fe77c7d2f909d +++ /dev/null @@ -1 +0,0 @@ -"0xf851808080a03900e16f35744fd8e6732d9253866e50977eb123efb7ecb3ae0508b5d72afef2808080808080808080a02ac25c8b39e9ba3a99e3983a69cc607e6b2a4f04adbe1abb9167b8b5d454056e808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xc4f6a1f0b681632674246c126fd0b2eb33764bdb3ec5763b93968f205314944c b/pkg/transformers/test_data/test_chain/!trie_db!0xc4f6a1f0b681632674246c126fd0b2eb33764bdb3ec5763b93968f205314944c deleted file mode 100644 index 4ce9496e..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xc4f6a1f0b681632674246c126fd0b2eb33764bdb3ec5763b93968f205314944c +++ /dev/null @@ -1 +0,0 @@ -"0xf6941000000000000000000000000000000000000000a0c74b55ae25b522915216f62ea6ffcd436f6c6d4fe14a771042f7d4cea5cfa92f" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xc6b2ffa8e1912127c6c62be9e04965e471a07d039643503ec5753ff3e00ed6b6 b/pkg/transformers/test_data/test_chain/!trie_db!0xc6b2ffa8e1912127c6c62be9e04965e471a07d039643503ec5753ff3e00ed6b6 deleted file mode 100644 index 9ae4e1c3..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xc6b2ffa8e1912127c6c62be9e04965e471a07d039643503ec5753ff3e00ed6b6 +++ /dev/null @@ -1 +0,0 @@ -"0xf871a00669e99db03fadf7104f6fce6f5dee43e3082eea0a429e7bc05c0aa06937a1b4808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b045580808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xc74b55ae25b522915216f62ea6ffcd436f6c6d4fe14a771042f7d4cea5cfa92f b/pkg/transformers/test_data/test_chain/!trie_db!0xc74b55ae25b522915216f62ea6ffcd436f6c6d4fe14a771042f7d4cea5cfa92f deleted file mode 100644 index 3c3d65f2..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xc74b55ae25b522915216f62ea6ffcd436f6c6d4fe14a771042f7d4cea5cfa92f +++ /dev/null @@ -1 +0,0 @@ -"0xf89180a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xca8b42e2b8d76c3b83702676bba49ba99eb83413f2680ef6ba27a8557eef8481 b/pkg/transformers/test_data/test_chain/!trie_db!0xca8b42e2b8d76c3b83702676bba49ba99eb83413f2680ef6ba27a8557eef8481 deleted file mode 100644 index dfed5ef9..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xca8b42e2b8d76c3b83702676bba49ba99eb83413f2680ef6ba27a8557eef8481 +++ /dev/null @@ -1 +0,0 @@ -"0xf85d94200ba85028256ef48f5ba64dd65dc258988955f6b846f8440180a0db0af948d55394775495207faf2541a5432ef2b567e0f6faccb7e193d64d48cfa098cb48227dc1977d88644fff7161f5b23b5c2a3e21dc1c28468b10c7c84c791b" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xcaabb5eace0c874816d18d87a14bdd47d6ca59824abbd2930b90caff6fd8d258 b/pkg/transformers/test_data/test_chain/!trie_db!0xcaabb5eace0c874816d18d87a14bdd47d6ca59824abbd2930b90caff6fd8d258 deleted file mode 100644 index a3dde4a2..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xcaabb5eace0c874816d18d87a14bdd47d6ca59824abbd2930b90caff6fd8d258 +++ /dev/null @@ -1 +0,0 @@ -"0xe2a0335712d0afd7315e74b2750e2c6d51d6eaac342dc2f35273b6398841c43c123232" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xcb69c18a6678a939fd2d7b440403556b57131ca3e2269d6d477c01704ab2a99a b/pkg/transformers/test_data/test_chain/!trie_db!0xcb69c18a6678a939fd2d7b440403556b57131ca3e2269d6d477c01704ab2a99a deleted file mode 100644 index 8ae6e802..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xcb69c18a6678a939fd2d7b440403556b57131ca3e2269d6d477c01704ab2a99a +++ /dev/null @@ -1 +0,0 @@ -"0xf851a0d8592c6f97b855e192b45cbc3a21093b529abc9cca3c368066d44aa31c9f0a57a073b9acd169ae7c4768c29d7dbbc8944bed84f86ddade7f2b48a0b0d5592ec11b808080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xcd9a145c136f5eca333f964b63eff22e7d5a154dac0e47e2d9effcd796a5308f b/pkg/transformers/test_data/test_chain/!trie_db!0xcd9a145c136f5eca333f964b63eff22e7d5a154dac0e47e2d9effcd796a5308f deleted file mode 100644 index 5a0ee116..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xcd9a145c136f5eca333f964b63eff22e7d5a154dac0e47e2d9effcd796a5308f +++ /dev/null @@ -1 +0,0 @@ -"0xf891a049d8c70a6f9beb022d9e57fbd45b8d49390d820889f2a835b74dc9bd160c5682808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b0455a072fa55f4ee28320ddd7ffa2b28fa312896c37fccfb15d6d409cbcf4a6a342b82808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xcdd19c234ef06438bc376231a390093b367b22505d25409880d81d150779a175 b/pkg/transformers/test_data/test_chain/!trie_db!0xcdd19c234ef06438bc376231a390093b367b22505d25409880d81d150779a175 deleted file mode 100644 index bd487e18..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xcdd19c234ef06438bc376231a390093b367b22505d25409880d81d150779a175 +++ /dev/null @@ -1 +0,0 @@ -"0xf85c933da851034713f899a122f95860eaf707b9f833b846f8440180a0fdc8e630564f657910187c9eb1d7bf01e04231d016528da0062c123203eb1c79a07661280f0be4e17138aef98a3b2d8e313db3c4acab857d5f3cf3e6e2fbd8cbda" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xcf2759c659bd860d34b51ade81828c957ccf8622569c2cb25a546bd325a84a25 b/pkg/transformers/test_data/test_chain/!trie_db!0xcf2759c659bd860d34b51ade81828c957ccf8622569c2cb25a546bd325a84a25 deleted file mode 100644 index 2c05cb1f..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xcf2759c659bd860d34b51ade81828c957ccf8622569c2cb25a546bd325a84a25 +++ /dev/null @@ -1 +0,0 @@ -"0xf871a087ff3bbe1430ed5cc0f2cc2ad5b75f139955ef1aa3d618d17cef880433e70dc6808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b045580808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xcfe663a029b4580a64c6b23d74e9c54a7fb03d16ed52c503bf8dbd2ea0332a47 b/pkg/transformers/test_data/test_chain/!trie_db!0xcfe663a029b4580a64c6b23d74e9c54a7fb03d16ed52c503bf8dbd2ea0332a47 deleted file mode 100644 index e167aa8d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xcfe663a029b4580a64c6b23d74e9c54a7fb03d16ed52c503bf8dbd2ea0332a47 +++ /dev/null @@ -1 +0,0 @@ -"0xf865933bee5fcfd8028cf7b00876c5b1421c800561a6b84ff84d8089056bc75e2d63100000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xd08975b46ac1b1f8e2b45d20715c97db1e33fb7ee0a0c5de07c377436a52a88f b/pkg/transformers/test_data/test_chain/!trie_db!0xd08975b46ac1b1f8e2b45d20715c97db1e33fb7ee0a0c5de07c377436a52a88f deleted file mode 100644 index 4734453c..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xd08975b46ac1b1f8e2b45d20715c97db1e33fb7ee0a0c5de07c377436a52a88f +++ /dev/null @@ -1 +0,0 @@ -"0xf59310000000000000000000000000000000000000a07b25204f93e559dc7c1fc1a4b9fdf17f217e89849d6c5e36c99619f168b2101c" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xd1620f6254ebf95f7c5133c1faaeb0d95e4e47a6ef5f7e9cc0c1babbf99882e6 b/pkg/transformers/test_data/test_chain/!trie_db!0xd1620f6254ebf95f7c5133c1faaeb0d95e4e47a6ef5f7e9cc0c1babbf99882e6 deleted file mode 100644 index 2e9d4ade..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xd1620f6254ebf95f7c5133c1faaeb0d95e4e47a6ef5f7e9cc0c1babbf99882e6 +++ /dev/null @@ -1 +0,0 @@ -"0xf85d9420189df410263ad1d9fe2f4af2eab3d24f1b6f41b846f8440180a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a08e9dd18a2a9762cc0e7a01eb55499cfbddd821895c655e75c7607cf896b6c0da" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xd167b284cd9e648f2508afc91308534ad0c1c0b77bb37c4abab7043a4f758ef2 b/pkg/transformers/test_data/test_chain/!trie_db!0xd167b284cd9e648f2508afc91308534ad0c1c0b77bb37c4abab7043a4f758ef2 deleted file mode 100644 index e1c27f19..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xd167b284cd9e648f2508afc91308534ad0c1c0b77bb37c4abab7043a4f758ef2 +++ /dev/null @@ -1 +0,0 @@ -"0xf891a0b849d833c3c299ab14d40e9dda4d67a6f2e7a5ec13ec49680683cdc24a3df770808080808080a0a7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963a051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c19480a063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xd44519568c01afd79cb7ddd8417238739c5aaeebc833c81e0169ffd81eb32117 b/pkg/transformers/test_data/test_chain/!trie_db!0xd44519568c01afd79cb7ddd8417238739c5aaeebc833c81e0169ffd81eb32117 deleted file mode 100644 index 90314b9d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xd44519568c01afd79cb7ddd8417238739c5aaeebc833c81e0169ffd81eb32117 +++ /dev/null @@ -1 +0,0 @@ -"0xf90131a07857f0f18874ffb3d54af6e413368716e3b932b92c1e5e625e6dc947c3eb324880a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2a044d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f8080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0f39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80ca0126fe799e67c134d54afc67d5aeee9fc376ab1d87f435750ae382befc5bd3926a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a0c2ed85fcd90ef7a8f384974bbaca81c0cd8e7be2444ca686fba240a4c487725080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xd82a7e871271fe9e9a8e25d05978546987306eeedd6c1fde6ff89b01f7554405 b/pkg/transformers/test_data/test_chain/!trie_db!0xd82a7e871271fe9e9a8e25d05978546987306eeedd6c1fde6ff89b01f7554405 deleted file mode 100644 index fce63ea0..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xd82a7e871271fe9e9a8e25d05978546987306eeedd6c1fde6ff89b01f7554405 +++ /dev/null @@ -1 +0,0 @@ -"0xf85220b84ff84d8089017fe946f406cc5000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xd8592c6f97b855e192b45cbc3a21093b529abc9cca3c368066d44aa31c9f0a57 b/pkg/transformers/test_data/test_chain/!trie_db!0xd8592c6f97b855e192b45cbc3a21093b529abc9cca3c368066d44aa31c9f0a57 deleted file mode 100644 index 3baac13b..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xd8592c6f97b855e192b45cbc3a21093b529abc9cca3c368066d44aa31c9f0a57 +++ /dev/null @@ -1 +0,0 @@ -"0xf842a00000000000000000000000000000000000000000000000000000000000000000a0a855e7870075f22bca3187c9fcf5f0ae0f9bcf0bc40aba289d2876006140eada" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xdaebc99a7107bb7774be5685fc91dc9b2a240431ff2477cb8b15d6cc57ae8bd5 b/pkg/transformers/test_data/test_chain/!trie_db!0xdaebc99a7107bb7774be5685fc91dc9b2a240431ff2477cb8b15d6cc57ae8bd5 deleted file mode 100644 index eb7e6b12..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xdaebc99a7107bb7774be5685fc91dc9b2a240431ff2477cb8b15d6cc57ae8bd5 +++ /dev/null @@ -1 +0,0 @@ -"0xf85180808080808080a0cfe663a029b4580a64c6b23d74e9c54a7fb03d16ed52c503bf8dbd2ea0332a47808080a0cdd19c234ef06438bc376231a390093b367b22505d25409880d81d150779a1758080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xdb0af948d55394775495207faf2541a5432ef2b567e0f6faccb7e193d64d48cf b/pkg/transformers/test_data/test_chain/!trie_db!0xdb0af948d55394775495207faf2541a5432ef2b567e0f6faccb7e193d64d48cf deleted file mode 100644 index 0a2ac18a..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xdb0af948d55394775495207faf2541a5432ef2b567e0f6faccb7e193d64d48cf +++ /dev/null @@ -1 +0,0 @@ -"0xf842a01000000000000000000000000000000000000000000000000000000000000000a060b37e6a056ee52545c169ae2074181fda1f14f9abb6363e4d9a152fd9f07c90" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xdb65034b0cb52ce3cc1db6ba302a9d4e12b2b6e91d432961f2088d6d1d8cc976 b/pkg/transformers/test_data/test_chain/!trie_db!0xdb65034b0cb52ce3cc1db6ba302a9d4e12b2b6e91d432961f2088d6d1d8cc976 deleted file mode 100644 index b8c0d7ed..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xdb65034b0cb52ce3cc1db6ba302a9d4e12b2b6e91d432961f2088d6d1d8cc976 +++ /dev/null @@ -1 +0,0 @@ -"0xf8419f1471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd8101a086981bd51e6d3e80868efc10e47ae05e5b490888d9de8efee4c3e08291b13c51" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xdce4225c8f8ab070aacf8bd8759e71a54c27ec9724cb5d37c1a80370eef9bb65 b/pkg/transformers/test_data/test_chain/!trie_db!0xdce4225c8f8ab070aacf8bd8759e71a54c27ec9724cb5d37c1a80370eef9bb65 deleted file mode 100644 index d3aee556..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xdce4225c8f8ab070aacf8bd8759e71a54c27ec9724cb5d37c1a80370eef9bb65 +++ /dev/null @@ -1 +0,0 @@ -"0xf8669434d922894153be9eef7b7218dc565d1d0ce2a092b84ff84d0189056bc75e2d630d84aba056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xe1e9a9ea0c7be782a715d4444db86e0e6a408f7d7663d3d16c770a9d535feb6f b/pkg/transformers/test_data/test_chain/!trie_db!0xe1e9a9ea0c7be782a715d4444db86e0e6a408f7d7663d3d16c770a9d535feb6f deleted file mode 100644 index 5416436d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xe1e9a9ea0c7be782a715d4444db86e0e6a408f7d7663d3d16c770a9d535feb6f +++ /dev/null @@ -1 +0,0 @@ -"0xf891a0addb2cdc826bed296244e295c743fc71d8ca532144f8c7122a7c65adec0d9745808080808080a059199de3c5812d70d26226c5f0ab999758a19b72cbf7c4eff6d930525a8b0455a072fa55f4ee28320ddd7ffa2b28fa312896c37fccfb15d6d409cbcf4a6a342b82808080808080a0406d82bbf3ff8b6eb8bce99f947723566e0e73bd4730e6482500142bcff67d1f80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xe54a935811e12f64c01aee3104a99b1047ce696ecd3cce171e23eab2c326fbc2 b/pkg/transformers/test_data/test_chain/!trie_db!0xe54a935811e12f64c01aee3104a99b1047ce696ecd3cce171e23eab2c326fbc2 deleted file mode 100644 index 93c9bc27..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xe54a935811e12f64c01aee3104a99b1047ce696ecd3cce171e23eab2c326fbc2 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d058905692dd3b722e3c800a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xe6e2c72b27c006bf6a0b3e89f9d5f2137134dd25d6560f27258078b60b15aaec b/pkg/transformers/test_data/test_chain/!trie_db!0xe6e2c72b27c006bf6a0b3e89f9d5f2137134dd25d6560f27258078b60b15aaec deleted file mode 100644 index edc8077d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xe6e2c72b27c006bf6a0b3e89f9d5f2137134dd25d6560f27258078b60b15aaec +++ /dev/null @@ -1 +0,0 @@ -"0xf85220b84ff84d808901fccfb344e9550bf7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xe855e4e8bfd909066a8059e6796be225553e199a2c22f4b65ddaeea511d19014 b/pkg/transformers/test_data/test_chain/!trie_db!0xe855e4e8bfd909066a8059e6796be225553e199a2c22f4b65ddaeea511d19014 deleted file mode 100644 index 0742881c..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xe855e4e8bfd909066a8059e6796be225553e199a2c22f4b65ddaeea511d19014 +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a0562e1406eac4555052e43c2bdc9e21fd697837624e9fa4704e6ced900721fc08a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xe9b9ea49eb759376e9b3311f8f50b0c48eb722b83adf0b99368624f2716011db b/pkg/transformers/test_data/test_chain/!trie_db!0xe9b9ea49eb759376e9b3311f8f50b0c48eb722b83adf0b99368624f2716011db deleted file mode 100644 index c7e71410..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xe9b9ea49eb759376e9b3311f8f50b0c48eb722b83adf0b99368624f2716011db +++ /dev/null @@ -1 +0,0 @@ -"0xf90131a0c6b2ffa8e1912127c6c62be9e04965e471a07d039643503ec5753ff3e00ed6b680a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2a044d6226c8647524b1aa102f6a7c5d428e3ff1b78976fbcfa3d8ab1209701026f8080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0f39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80ca0e54a935811e12f64c01aee3104a99b1047ce696ecd3cce171e23eab2c326fbc2a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba08424779c90fd12907998c34b725204a2c6cd6237c4aec54be342f93cdc535fbe80808080a09bdb510955ca6fd0ae2d5c77ab871254c9a8bb50cdaa80816a22151cea8c27fa80" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xec77d285a767ea2ec58ce52c0022aac4c71efc3f396f1989598c33e75e8bedd1 b/pkg/transformers/test_data/test_chain/!trie_db!0xec77d285a767ea2ec58ce52c0022aac4c71efc3f396f1989598c33e75e8bedd1 deleted file mode 100644 index aebb4dbd..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xec77d285a767ea2ec58ce52c0022aac4c71efc3f396f1989598c33e75e8bedd1 +++ /dev/null @@ -1 +0,0 @@ -"0xf866943e84a1e068d77059cbe263c43ad0cdc130863313b84ff84d0789056695af23be6fa800a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xed57d93087e1a79ee9e3f6eadfc3d2affdb420d73dc4ecf07c5a21b22a221a98 b/pkg/transformers/test_data/test_chain/!trie_db!0xed57d93087e1a79ee9e3f6eadfc3d2affdb420d73dc4ecf07c5a21b22a221a98 deleted file mode 100644 index 0f4ee6f9..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xed57d93087e1a79ee9e3f6eadfc3d2affdb420d73dc4ecf07c5a21b22a221a98 +++ /dev/null @@ -1 +0,0 @@ -"0xf6941000000000000000000000000000000000000000a05072a6c1e2e016ff4e5b6b35caf68673a43b7a13bb1fa82f2643bad3e4d1c253" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xed89ce8c7b8d2657d679fd3eb25076b5d12bd24ecfd91f2b19891722703a43e2 b/pkg/transformers/test_data/test_chain/!trie_db!0xed89ce8c7b8d2657d679fd3eb25076b5d12bd24ecfd91f2b19891722703a43e2 deleted file mode 100644 index 8ba33368..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xed89ce8c7b8d2657d679fd3eb25076b5d12bd24ecfd91f2b19891722703a43e2 +++ /dev/null @@ -1 +0,0 @@ -"0xe2a03471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017c64" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xf16e2c7b466b113f3159a527a5f17bce3863cc3cda8b21f0da41228f0be40e75 b/pkg/transformers/test_data/test_chain/!trie_db!0xf16e2c7b466b113f3159a527a5f17bce3863cc3cda8b21f0da41228f0be40e75 deleted file mode 100644 index 04adb4ac..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xf16e2c7b466b113f3159a527a5f17bce3863cc3cda8b21f0da41228f0be40e75 +++ /dev/null @@ -1 +0,0 @@ -"0xeca120000000000000000000000000000000000000000000000000000000000000000289880e92596fd6290000" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xf39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80c b/pkg/transformers/test_data/test_chain/!trie_db!0xf39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80c deleted file mode 100644 index 96b68d3d..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xf39ba3ac12d2744dd608f89cb539b72a387a2e605dba7ad9a4e935486657e80c +++ /dev/null @@ -1 +0,0 @@ -"0xf871808080a03900e16f35744fd8e6732d9253866e50977eb123efb7ecb3ae0508b5d72afef280a0b2aea4b00c6faa6890b6e8256dcb98b86808a19ab61c59994ab8b8bdf9acfa4d80808080808080a02ac25c8b39e9ba3a99e3983a69cc607e6b2a4f04adbe1abb9167b8b5d454056e808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xf417ac2b221084cc9f25360f16f68983f1636169ed35c027c83b2925ea63a3b9 b/pkg/transformers/test_data/test_chain/!trie_db!0xf417ac2b221084cc9f25360f16f68983f1636169ed35c027c83b2925ea63a3b9 deleted file mode 100644 index 551767fd..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xf417ac2b221084cc9f25360f16f68983f1636169ed35c027c83b2925ea63a3b9 +++ /dev/null @@ -1 +0,0 @@ -"0xf85220b84ff84d808901d32d8f29f3277373a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xf5bc46da5777e39236ea19c82191f7ff73ee8b732b3652ae6864c8bc2e2688e0 b/pkg/transformers/test_data/test_chain/!trie_db!0xf5bc46da5777e39236ea19c82191f7ff73ee8b732b3652ae6864c8bc2e2688e0 deleted file mode 100644 index b90a2d7f..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xf5bc46da5777e39236ea19c82191f7ff73ee8b732b3652ae6864c8bc2e2688e0 +++ /dev/null @@ -1 +0,0 @@ -"0xf871a04ef305cd67b97b743669faa6b70fab3c29d545df173e5798da1a3bef0efeb5d9808080808080a0a7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963a051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c1948080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xf5ee2d5a1e72de4b5a1e2af94497ed2082c0874454d5419cbdb0037f105e882a b/pkg/transformers/test_data/test_chain/!trie_db!0xf5ee2d5a1e72de4b5a1e2af94497ed2082c0874454d5419cbdb0037f105e882a deleted file mode 100644 index 8562ec9a..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xf5ee2d5a1e72de4b5a1e2af94497ed2082c0874454d5419cbdb0037f105e882a +++ /dev/null @@ -1 +0,0 @@ -"0xf8f1a0b849d833c3c299ab14d40e9dda4d67a6f2e7a5ec13ec49680683cdc24a3df77080a01b9a0ca00da4bf0c31264a2bf0a2352c41b0012d157942fcabc59e64f08ec8a2808080a074952353b0991411841541f86d37934e0d826eb7411a2420ea362466d8d60e03a0a7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963a051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c194a025fc93ab219268b7e46014c8ac580adba1ce1051d8cb8bcb1cd238f4187e577ba063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xf809a0ce500223d176d587be8c6a89aea88a70d80394f7eda04d8e4b1c17cc4e b/pkg/transformers/test_data/test_chain/!trie_db!0xf809a0ce500223d176d587be8c6a89aea88a70d80394f7eda04d8e4b1c17cc4e deleted file mode 100644 index efcdb266..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xf809a0ce500223d176d587be8c6a89aea88a70d80394f7eda04d8e4b1c17cc4e +++ /dev/null @@ -1 +0,0 @@ -"0xf851a0d8592c6f97b855e192b45cbc3a21093b529abc9cca3c368066d44aa31c9f0a57a0907b9cb17ed4afdf1e49593aa2a077f3019a7e851ec9faf4b21ad72aea963675808080808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xfb53e64824f62daa3a1598b6864c077c8b3feafa8d6f93bb5185dcd52a55f4b5 b/pkg/transformers/test_data/test_chain/!trie_db!0xfb53e64824f62daa3a1598b6864c077c8b3feafa8d6f93bb5185dcd52a55f4b5 deleted file mode 100644 index c515d8ef..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xfb53e64824f62daa3a1598b6864c077c8b3feafa8d6f93bb5185dcd52a55f4b5 +++ /dev/null @@ -1 +0,0 @@ -"0xf90111a021844edeb0c63d6c416c3ac4ccf639034227a206e8d39e76dadd463b61e5508ba05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xfc06e3f1445bb4688f0502c46231fc72da5d44c6419ee71c47be24fbf1928fcf b/pkg/transformers/test_data/test_chain/!trie_db!0xfc06e3f1445bb4688f0502c46231fc72da5d44c6419ee71c47be24fbf1928fcf deleted file mode 100644 index ea12be77..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xfc06e3f1445bb4688f0502c46231fc72da5d44c6419ee71c47be24fbf1928fcf +++ /dev/null @@ -1 +0,0 @@ -"0xf891a04ef305cd67b97b743669faa6b70fab3c29d545df173e5798da1a3bef0efeb5d9808080808080a0a7e84e568d915220899cd49f84d03cadbba602e3e04546e2c18064dcb0517963a051e94f71fe2273409ef0acbc4986df7bb808426470a9871d1f6d3324b780c19480a063a1b8e271db0ec0a1816192da83ae3bec40470b66f31d047ef4911d0106dde2808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xfdc8e630564f657910187c9eb1d7bf01e04231d016528da0062c123203eb1c79 b/pkg/transformers/test_data/test_chain/!trie_db!0xfdc8e630564f657910187c9eb1d7bf01e04231d016528da0062c123203eb1c79 deleted file mode 100644 index 00bb3bb3..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xfdc8e630564f657910187c9eb1d7bf01e04231d016528da0062c123203eb1c79 +++ /dev/null @@ -1 +0,0 @@ -"0xf838a1200000000000000000000000000000000000000000000000000000000000000000959438219779a699d67d7e7740b8c8f43d3e2dae2182" \ No newline at end of file diff --git a/pkg/transformers/test_data/test_chain/!trie_db!0xfe3d828c2803bd586bc34641752157c205a391ec9a1b730031bccc77a9276b02 b/pkg/transformers/test_data/test_chain/!trie_db!0xfe3d828c2803bd586bc34641752157c205a391ec9a1b730031bccc77a9276b02 deleted file mode 100644 index 19ee58cc..00000000 --- a/pkg/transformers/test_data/test_chain/!trie_db!0xfe3d828c2803bd586bc34641752157c205a391ec9a1b730031bccc77a9276b02 +++ /dev/null @@ -1 +0,0 @@ -"0xf87180a05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554aa05911f24d96912350de50f297c2d34d5d10e136757bf4cfff5fa41bfca219554a80808080808080808080808080" \ No newline at end of file diff --git a/pkg/transformers/test_data/vat_flux.go b/pkg/transformers/test_data/vat_flux.go deleted file mode 100644 index 9c4aab0a..00000000 --- a/pkg/transformers/test_data/vat_flux.go +++ /dev/null @@ -1,54 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_flux" -) - -var VatFluxLog = types.Log{ - Address: common.HexToAddress(KovanVatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xa6e4182100000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x5245500000000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000007FA9EF6609Ca7921112231f8f195138ebba29770"), - common.HexToHash("0x00000000000000000000000093086347c52a8878af71bb818509d484c6a2e1bf"), - }, - Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000084a6e418217340e006f4135ba6970d43bf43d88dcad4e7a8ca00000000000000000000000007fa9ef6609ca7921112231f8f195138ebba297700000000000000000000000093086347c52a8878af71bb818509d484c6a2e1bf000000000000000000000000000000000000000000000000000000000000000000000000000000000000007b"), - BlockNumber: 23, - TxHash: common.HexToHash("0xf98681bab9b8c75bd8aa4a7d0a8142ff527c5ea8fa54f3c2835d4533838b2e6f"), - TxIndex: 0, - BlockHash: fakes.FakeHash, - Index: 3, - Removed: false, -} - -var rawFluxLog, _ = json.Marshal(VatFluxLog) -var VatFluxModel = vat_flux.VatFluxModel{ - Ilk: "5245500000000000000000000000000000000000000000000000000000000000", - Src: "0000000000000000000000007fa9ef6609ca7921112231f8f195138ebba29770", - Dst: "00000000000000000000000093086347c52a8878af71bb818509d484c6a2e1bf", - Rad: "123", - TransactionIndex: VatFluxLog.TxIndex, - LogIndex: VatFluxLog.Index, - Raw: rawFluxLog, -} diff --git a/pkg/transformers/test_data/vat_fold.go b/pkg/transformers/test_data/vat_fold.go deleted file mode 100644 index c2f80320..00000000 --- a/pkg/transformers/test_data/vat_fold.go +++ /dev/null @@ -1,55 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_fold" -) - -var EthVatFoldLog = types.Log{ - Address: common.HexToAddress(KovanVatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0xe6a6a64d00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x5245500000000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000002"), - }, - Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000064e6a6a64d45544800000000000000000000000000000000000000000000000000000000000000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d10000000000000000000000000000000000000000000000000000000000000000"), - BlockNumber: 8940380, - TxHash: common.HexToHash("0xfb37b7a88aa8ad14538d1e244a55939fa07c1828e5ca8168bf4edd56f5fc4d57"), - TxIndex: 8, - BlockHash: fakes.FakeHash, - Index: 5, - Removed: false, -} - -var rawVatFoldLog, _ = json.Marshal(EthVatFoldLog) -var VatFoldModel = vat_fold.VatFoldModel{ - Ilk: "5245500000000000000000000000000000000000000000000000000000000000", - Urn: "0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1", - Rate: "0.000000000000000000000000002", - LogIndex: EthVatFoldLog.Index, - TransactionIndex: EthVatFoldLog.TxIndex, - Raw: rawVatFoldLog, -} diff --git a/pkg/transformers/test_data/vat_grab.go b/pkg/transformers/test_data/vat_grab.go deleted file mode 100644 index 4a7aef70..00000000 --- a/pkg/transformers/test_data/vat_grab.go +++ /dev/null @@ -1,40 +0,0 @@ -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_grab" -) - -var EthVatGrabLog = types.Log{ - Address: common.HexToAddress(KovanVatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x3690ae4c00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x5245500000000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000006a3ae20c315e845b2e398e68effe39139ec6060c"), - common.HexToHash("0x0000000000000000000000002f34f22a00ee4b7a8f8bbc4eaee1658774c624e0"), - }, - Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c43690ae4c52455000000000000000000000000000000000000000000000000000000000000000000000000000000000006a3ae20c315e845b2e398e68effe39139ec6060c0000000000000000000000002f34f22a00ee4b7a8f8bbc4eaee1658774c624e00000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1ffffffffffffffffffffffffffffffffffffffffffffffffe43e9298b1380000ffffffffffffffffffffffffffffffffffffffffffffffff24fea01c7f8f8000"), - BlockNumber: 23, - TxHash: common.HexToHash("0x7cb84c750ce4985f7811abf641d52ffcb35306d943081475226484cf1470c6fa"), - TxIndex: 4, - BlockHash: fakes.FakeHash, - Index: 5, - Removed: false, -} - -var rawVatGrabLog, _ = json.Marshal(EthVatGrabLog) -var VatGrabModel = vat_grab.VatGrabModel{ - Ilk: "5245500000000000000000000000000000000000000000000000000000000000", - Urn: "0000000000000000000000006a3ae20c315e845b2e398e68effe39139ec6060c", - V: "0000000000000000000000002f34f22a00ee4b7a8f8bbc4eaee1658774c624e0", - W: "0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1", - Dink: "115792089237316195423570985008687907853269984665640564039455584007913129639936", - Dart: "115792089237316195423570985008687907853269984665640564039441803007913129639936", - LogIndex: EthVatGrabLog.Index, - TransactionIndex: EthVatGrabLog.TxIndex, - Raw: rawVatGrabLog, -} diff --git a/pkg/transformers/test_data/vat_heal.go b/pkg/transformers/test_data/vat_heal.go deleted file mode 100644 index 01ff4bb1..00000000 --- a/pkg/transformers/test_data/vat_heal.go +++ /dev/null @@ -1,53 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_heal" -) - -var VatHealLog = types.Log{ - Address: common.HexToAddress(KovanVatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x990a5f6300000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6"), - common.HexToHash("0x0000000000000000000000007340e006f4135ba6970d43bf43d88dcad4e7a8ca"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000078"), - }, - Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000064990a5f637d7bee5fcfd8028cf7b00876c5b1421c800561a600000000000000000000000074686520762076616c75650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078"), - BlockNumber: 10, - TxHash: common.HexToHash("0x991b8079b1333024000dcaf2b00c24c5db0315e112a4ac4d912aa96a602e12b9"), - TxIndex: 2, - BlockHash: fakes.FakeHash, - Index: 3, - Removed: false, -} - -var rawHealLog, _ = json.Marshal(VatHealLog) -var VatHealModel = vat_heal.VatHealModel{ - Urn: "0000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6", - V: "0000000000000000000000007340e006f4135ba6970d43bf43d88dcad4e7a8ca", - Rad: "120", - LogIndex: VatHealLog.Index, - TransactionIndex: VatHealLog.TxIndex, - Raw: rawHealLog, -} diff --git a/pkg/transformers/test_data/vat_init.go b/pkg/transformers/test_data/vat_init.go deleted file mode 100644 index bc566d24..00000000 --- a/pkg/transformers/test_data/vat_init.go +++ /dev/null @@ -1,53 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_init" -) - -var EthVatInitLog = types.Log{ - Address: common.HexToAddress(KovanVatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x3b66319500000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000243b66319566616b6520696c6b000000000000000000000000000000000000000000000000"), - BlockNumber: 24, - TxHash: common.HexToHash("0xe8f39fbb7fea3621f543868f19b1114e305aff6a063a30d32835ff1012526f91"), - TxIndex: 7, - BlockHash: fakes.FakeHash, - Index: 8, - Removed: false, -} - -var rawVatInitLog, _ = json.Marshal(EthVatInitLog) -var VatInitModel = vat_init.VatInitModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - LogIndex: EthVatInitLog.Index, - TransactionIndex: EthVatInitLog.TxIndex, - Raw: rawVatInitLog, -} diff --git a/pkg/transformers/test_data/vat_move.go b/pkg/transformers/test_data/vat_move.go deleted file mode 100644 index 4b09dd45..00000000 --- a/pkg/transformers/test_data/vat_move.go +++ /dev/null @@ -1,55 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_move" -) - -var EthVatMoveLog = types.Log{ - Address: common.HexToAddress(KovanVatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x78f1947000000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x000000000000000000000000a730d1ff8b6bc74a26d54c20a9dda539909bab0e"), - common.HexToHash("0x000000000000000000000000b730d1ff8b6bc74a26d54c20a9dda539909bab0e"), - common.HexToHash("0x000000000000000000000000000000000000000000000000000000000000002a"), - }, - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006478f19470a730d1ff8b6bc74a26d54c20a9dda539909bab0e000000000000000000000000b730d1ff8b6bc74a26d54c20a9dda539909bab0e000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a"), - BlockNumber: 10, - TxHash: common.HexToHash("0xe8f39fbb7fea3621f543868f19b1114e305aff6a063a30d32835ff1012526f91"), - TxIndex: 7, - BlockHash: fakes.FakeHash, - Index: 8, - Removed: false, -} - -var rawVatMoveLog, _ = json.Marshal(EthVatMoveLog) -var VatMoveModel = vat_move.VatMoveModel{ - Src: "000000000000000000000000a730d1ff8b6bc74a26d54c20a9dda539909bab0e", - Dst: "000000000000000000000000b730d1ff8b6bc74a26d54c20a9dda539909bab0e", - Rad: "42", - LogIndex: EthVatMoveLog.Index, - TransactionIndex: EthVatMoveLog.TxIndex, - Raw: rawVatMoveLog, -} diff --git a/pkg/transformers/test_data/vat_slip.go b/pkg/transformers/test_data/vat_slip.go deleted file mode 100644 index fd717c61..00000000 --- a/pkg/transformers/test_data/vat_slip.go +++ /dev/null @@ -1,55 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_slip" -) - -var EthVatSlipLog = types.Log{ - Address: common.HexToAddress(KovanVatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x42066cbb00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6"), - common.HexToHash("0x000000000000000000000000000000000000000000000000000000003ade68b1"), - }, - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006442066cbb66616b6520696c6b0000000000000000000000000000000000000000000000000000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6000000000000000000000000000000000000000000000000000000003ade68b1"), - BlockNumber: 10, - TxHash: common.HexToHash("0xb114ba306c80c86d51bdbf4a5ac8ed151020cd81b70cfa1dc9822f4a1f73930b"), - TxIndex: 3, - BlockHash: fakes.FakeHash, - Index: 2, - Removed: false, -} - -var rawVatSlipLog, _ = json.Marshal(EthVatSlipLog) -var VatSlipModel = vat_slip.VatSlipModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - Guy: "0000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6", - Rad: "987654321", - TransactionIndex: EthVatSlipLog.TxIndex, - LogIndex: EthVatSlipLog.Index, - Raw: rawVatSlipLog, -} diff --git a/pkg/transformers/test_data/vat_toll.go b/pkg/transformers/test_data/vat_toll.go deleted file mode 100644 index e37b303a..00000000 --- a/pkg/transformers/test_data/vat_toll.go +++ /dev/null @@ -1,38 +0,0 @@ -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_toll" - "math/big" -) - -var EthVatTollLog = types.Log{ - Address: common.HexToAddress(KovanVatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x09b7a0b500000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b"), - common.HexToHash("0x00000000000000000000000000000000000000000000000000000000075bcd15"), - }, - Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006409b7a0b566616b6520696c6b000000000000000000000000000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b000000000000000000000000000000000000000000000000000000000000000000000000000000000075bcd15"), - BlockNumber: 21, - TxHash: common.HexToHash("0x0d59cb158b033ffdfb9a021d1e80bfbbcd99594c62c501897ccee446bcd33828"), - TxIndex: 2, - BlockHash: fakes.FakeHash, - Index: 4, - Removed: false, -} - -var rawVatTollLog, _ = json.Marshal(EthVatTollLog) -var VatTollModel = vat_toll.VatTollModel{ - Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", - Urn: "0000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b", - Take: big.NewInt(123456789).String(), - TransactionIndex: EthVatTollLog.TxIndex, - LogIndex: EthVatTollLog.Index, - Raw: rawVatTollLog, -} diff --git a/pkg/transformers/test_data/vat_tune.go b/pkg/transformers/test_data/vat_tune.go deleted file mode 100644 index 2269e917..00000000 --- a/pkg/transformers/test_data/vat_tune.go +++ /dev/null @@ -1,46 +0,0 @@ -package test_data - -import ( - "encoding/json" - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_tune" -) - -var EthVatTuneLog = types.Log{ - Address: common.HexToAddress(KovanVatContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x5dd6471a00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x4554480000000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876"), - common.HexToHash("0x0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876"), - }, - Data: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c45dd6471a45544800000000000000000000000000000000000000000000000000000000000000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b08760000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b08760000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b08760000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffe43e9298b1380000"), - BlockNumber: 8761670, - TxHash: common.HexToHash("0x95eb3d6cbd83032efa29714d4a391ce163d7d215db668aadd7d33dd5c20b1ec7"), - TxIndex: 0, - BlockHash: fakes.FakeHash, - Index: 6, - Removed: false, -} - -var rawVatTuneLog, _ = json.Marshal(EthVatTuneLog) -var dartString = "115792089237316195423570985008687907853269984665640564039455584007913129639936" -var vatTuneDart, _ = new(big.Int).SetString(dartString, 10) -var urn = "0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876" -var VatTuneModel = vat_tune.VatTuneModel{ - Ilk: "4554480000000000000000000000000000000000000000000000000000000000", - Urn: urn, - V: urn, - W: urn, - Dink: big.NewInt(0).String(), - Dart: vatTuneDart.String(), - TransactionIndex: EthVatTuneLog.TxIndex, - LogIndex: EthVatTuneLog.Index, - Raw: rawVatTuneLog, -} diff --git a/pkg/transformers/test_data/vow_flog.go b/pkg/transformers/test_data/vow_flog.go deleted file mode 100644 index 7f73cf75..00000000 --- a/pkg/transformers/test_data/vow_flog.go +++ /dev/null @@ -1,51 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package test_data - -import ( - "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vow_flog" -) - -var EthVowFlogLog = types.Log{ - Address: common.HexToAddress(KovanVowContractAddress), - Topics: []common.Hash{ - common.HexToHash("0x35aee16f00000000000000000000000000000000000000000000000000000000"), - common.HexToHash("0x0000000000000000000000008e84a1e068d77059cbe263c43ad0cdc130863313"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000539"), - common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), - }, - Data: hexutil.MustDecode("0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002435aee16f0000000000000000000000000000000000000000000000000000000000000539"), - BlockNumber: 11, - TxHash: common.HexToHash("0x47ffd75c1cda1d5c08219755743663a3790e4f5ae9e1fcb85bb3fe0d74bb7109"), - TxIndex: 4, - BlockHash: fakes.FakeHash, - Index: 3, - Removed: false, -} - -var rawVowFlogLog, _ = json.Marshal(EthVowFlogLog) -var VowFlogModel = vow_flog.VowFlogModel{ - Era: "1337", - LogIndex: EthVowFlogLog.Index, - TransactionIndex: EthVowFlogLog.TxIndex, - Raw: rawVowFlogLog, -} diff --git a/pkg/transformers/transformers.go b/pkg/transformers/transformers.go deleted file mode 100644 index 3e5625fb..00000000 --- a/pkg/transformers/transformers.go +++ /dev/null @@ -1,327 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package transformers - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/bite" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/chop_lump" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/flip" - "github.com/vulcanize/vulcanizedb/pkg/transformers/cat_file/pit_vow" - "github.com/vulcanize/vulcanizedb/pkg/transformers/deal" - "github.com/vulcanize/vulcanizedb/pkg/transformers/dent" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_drip" - ilk2 "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/ilk" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/repo" - "github.com/vulcanize/vulcanizedb/pkg/transformers/drip_file/vow" - "github.com/vulcanize/vulcanizedb/pkg/transformers/factories" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flap_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flip_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/flop_kick" - "github.com/vulcanize/vulcanizedb/pkg/transformers/frob" - "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/debt_ceiling" - "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk" - "github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/tend" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_flux" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_fold" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_grab" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_heal" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_init" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_move" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_slip" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_toll" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_tune" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vow_flog" -) - -// Custom event transformers -func GetBiteTransformer() factories.Transformer { - return factories.Transformer{ - Config: bite.GetBiteConfig(), - Converter: &bite.BiteConverter{}, - Repository: &bite.BiteRepository{}, - } -} - -func GetFlapKickTransformer() factories.Transformer { - return factories.Transformer{ - Config: flap_kick.GetFlapKickConfig(), - Converter: &flap_kick.FlapKickConverter{}, - Repository: &flap_kick.FlapKickRepository{}, - } -} - -func GetFlipKickTransformer() factories.Transformer { - return factories.Transformer{ - Config: flip_kick.GetFlipKickConfig(), - Converter: &flip_kick.FlipKickConverter{}, - Repository: &flip_kick.FlipKickRepository{}, - } -} - -func GetFrobTransformer() factories.Transformer { - return factories.Transformer{ - Config: frob.GetFrobConfig(), - Converter: &frob.FrobConverter{}, - Repository: &frob.FrobRepository{}, - } -} - -func GetFlopKickTransformer() factories.Transformer { - return factories.Transformer{ - Config: flop_kick.GetFlopKickConfig(), - Converter: &flop_kick.FlopKickConverter{}, - Repository: &flop_kick.FlopKickRepository{}, - } -} - -func getCustomEventTransformers() []factories.Transformer { - return []factories.Transformer{ - GetBiteTransformer(), - GetFlapKickTransformer(), - GetFlipKickTransformer(), - GetFrobTransformer(), - GetFlopKickTransformer(), - } -} - -// LogNote transformers -func GetCatFileChopLumpTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: chop_lump.GetCatFileChopLumpConfig(), - Converter: &chop_lump.CatFileChopLumpConverter{}, - Repository: &chop_lump.CatFileChopLumpRepository{}, - } -} - -func GetCatFileFlipTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: flip.GetCatFileFlipConfig(), - Converter: &flip.CatFileFlipConverter{}, - Repository: &flip.CatFileFlipRepository{}, - } -} - -func GetCatFilePitVowTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: pit_vow.GetCatFilePitVowConfig(), - Converter: &pit_vow.CatFilePitVowConverter{}, - Repository: &pit_vow.CatFilePitVowRepository{}, - } -} - -func GetDealTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: deal.GetDealConfig(), - Converter: &deal.DealConverter{}, - Repository: &deal.DealRepository{}, - } -} - -func GetDentTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: dent.GetDentConfig(), - Converter: &dent.DentConverter{}, - Repository: &dent.DentRepository{}, - } -} - -func GetDripDripTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: drip_drip.GetDripDripConfig(), - Converter: &drip_drip.DripDripConverter{}, - Repository: &drip_drip.DripDripRepository{}, - } -} - -func GetDripFileIlkTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: ilk2.GetDripFileIlkConfig(), - Converter: &ilk2.DripFileIlkConverter{}, - Repository: &ilk2.DripFileIlkRepository{}, - } -} - -func GetDripFileRepoTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: repo.GetDripFileRepoConfig(), - Converter: &repo.DripFileRepoConverter{}, - Repository: &repo.DripFileRepoRepository{}, - } -} - -func GetDripFileVowTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vow.GetDripFileVowConfig(), - Converter: &vow.DripFileVowConverter{}, - Repository: &vow.DripFileVowRepository{}, - } -} - -func GetFlogTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vow_flog.GetVowFlogConfig(), - Converter: &vow_flog.VowFlogConverter{}, - Repository: &vow_flog.VowFlogRepository{}, - } -} - -func GetPitFileDebtCeilingTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: debt_ceiling.GetDebtCeilingFileConfig(), - Converter: &debt_ceiling.PitFileDebtCeilingConverter{}, - Repository: &debt_ceiling.PitFileDebtCeilingRepository{}, - } -} - -func GetPitFileIlkTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: ilk.GetIlkFileConfig(), - Converter: &ilk.PitFileIlkConverter{}, - Repository: &ilk.PitFileIlkRepository{}, - } -} - -func GetPriceFeedTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: price_feeds.GetPriceFeedConfig(), - Converter: &price_feeds.PriceFeedConverter{}, - Repository: &price_feeds.PriceFeedRepository{}, - } -} - -func GetTendTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: tend.GetTendConfig(), - Converter: &tend.TendConverter{}, - Repository: &tend.TendRepository{}, - } -} - -func GetVatInitTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vat_init.GetVatInitConfig(), - Converter: &vat_init.VatInitConverter{}, - Repository: &vat_init.VatInitRepository{}, - } -} - -func GetVatGrabTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vat_grab.GetVatGrabConfig(), - Converter: &vat_grab.VatGrabConverter{}, - Repository: &vat_grab.VatGrabRepository{}, - } -} - -func GetVatFoldTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vat_fold.GetVatFoldConfig(), - Converter: &vat_fold.VatFoldConverter{}, - Repository: &vat_fold.VatFoldRepository{}, - } -} - -func GetVatHealTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vat_heal.GetVatHealConfig(), - Converter: &vat_heal.VatHealConverter{}, - Repository: &vat_heal.VatHealRepository{}, - } -} - -func GetVatMoveTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vat_move.GetVatMoveConfig(), - Converter: &vat_move.VatMoveConverter{}, - Repository: &vat_move.VatMoveRepository{}, - } -} - -func GetVatSlipTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vat_slip.GetVatSlipConfig(), - Converter: &vat_slip.VatSlipConverter{}, - Repository: &vat_slip.VatSlipRepository{}, - } -} - -func GetVatTollTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vat_toll.GetVatTollConfig(), - Converter: &vat_toll.VatTollConverter{}, - Repository: &vat_toll.VatTollRepository{}, - } -} - -func GetVatTuneTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vat_tune.GetVatTuneConfig(), - Converter: &vat_tune.VatTuneConverter{}, - Repository: &vat_tune.VatTuneRepository{}, - } -} - -func GetVatFluxTransformer() factories.LogNoteTransformer { - return factories.LogNoteTransformer{ - Config: vat_flux.GetVatFluxConfig(), - Converter: &vat_flux.VatFluxConverter{}, - Repository: &vat_flux.VatFluxRepository{}, - } -} - -func getLogNoteTransformers() []factories.LogNoteTransformer { - return []factories.LogNoteTransformer{ - GetCatFileChopLumpTransformer(), - GetCatFileFlipTransformer(), - GetCatFilePitVowTransformer(), - GetDealTransformer(), - GetDentTransformer(), - GetDripDripTransformer(), - GetDripFileIlkTransformer(), - GetDripFileRepoTransformer(), - GetDripFileVowTransformer(), - GetFlogTransformer(), - GetPitFileDebtCeilingTransformer(), - GetPitFileIlkTransformer(), - GetPriceFeedTransformer(), - GetTendTransformer(), - GetVatInitTransformer(), - GetVatGrabTransformer(), - GetVatFoldTransformer(), - GetVatHealTransformer(), - GetVatMoveTransformer(), - GetVatSlipTransformer(), - GetVatTollTransformer(), - GetVatTuneTransformer(), - GetVatFluxTransformer(), - } -} - -// `TransformerInitializers` returns a list of functions, that given a db pointer -// will return a `shared.Transformer` -func TransformerInitializers() (initializers []shared.TransformerInitializer) { - for _, transformer := range getLogNoteTransformers() { - initializers = append(initializers, transformer.NewLogNoteTransformer) - } - - for _, transformer := range getCustomEventTransformers() { - initializers = append(initializers, transformer.NewTransformer) - } - return -} diff --git a/pkg/transformers/vat_flux/config.go b/pkg/transformers/vat_flux/config.go deleted file mode 100644 index e33d8d34..00000000 --- a/pkg/transformers/vat_flux/config.go +++ /dev/null @@ -1,17 +0,0 @@ -package vat_flux - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVatFluxConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VatFluxLabel, - ContractAddresses: []string{constants.VatContractAddress()}, - ContractAbi: constants.VatABI(), - Topic: constants.GetVatFluxSignature(), - StartingBlockNumber: constants.VatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vat_flux/converter.go b/pkg/transformers/vat_flux/converter.go deleted file mode 100644 index cc22867a..00000000 --- a/pkg/transformers/vat_flux/converter.go +++ /dev/null @@ -1,73 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_flux - -import ( - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "math/big" -) - -type VatFluxConverter struct{} - -func (VatFluxConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - src := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - dst := shared.GetHexWithoutPrefix(ethLog.Topics[3].Bytes()) - radBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data) - rad := big.NewInt(0).SetBytes(radBytes).String() - - if err != nil { - return nil, err - } - - rawLogJson, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - - model := VatFluxModel{ - Ilk: ilk, - Src: src, - Dst: dst, - Rad: rad, - TransactionIndex: ethLog.TxIndex, - LogIndex: ethLog.Index, - Raw: rawLogJson, - } - - models = append(models, model) - } - - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/vat_flux/converter_test.go b/pkg/transformers/vat_flux/converter_test.go deleted file mode 100644 index 7b8727ce..00000000 --- a/pkg/transformers/vat_flux/converter_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_flux_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_flux" -) - -var _ = Describe("VatFlux converter", func() { - It("Converts logs to models", func() { - converter := vat_flux.VatFluxConverter{} - models, err := converter.ToModels([]types.Log{test_data.VatFluxLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.VatFluxModel)) - }) - - It("Returns an error there are missing topics", func() { - converter := vat_flux.VatFluxConverter{} - badLog := types.Log{ - Topics: []common.Hash{ - common.HexToHash("0x"), - common.HexToHash("0x"), - common.HexToHash("0x"), - }, - } - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) -}) diff --git a/pkg/transformers/vat_flux/model.go b/pkg/transformers/vat_flux/model.go deleted file mode 100644 index ce3e2aa2..00000000 --- a/pkg/transformers/vat_flux/model.go +++ /dev/null @@ -1,27 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_flux - -type VatFluxModel struct { - Ilk string - Src string - Dst string - Rad string - TransactionIndex uint `db:"tx_idx"` - LogIndex uint `db:"log_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vat_flux/repository.go b/pkg/transformers/vat_flux/repository.go deleted file mode 100644 index 516405e2..00000000 --- a/pkg/transformers/vat_flux/repository.go +++ /dev/null @@ -1,98 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_flux - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatFluxRepository struct { - db *postgres.DB -} - -func (repository VatFluxRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - vatFlux, ok := model.(VatFluxModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VatFluxModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(vatFlux.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec(`INSERT INTO maker.vat_flux (header_id, ilk, dst, src, rad, tx_idx, log_idx, raw_log) - VALUES($1, $2, $3, $4, $5::NUMERIC, $6, $7, $8) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, dst = $3, src = $4, rad = $5, raw_log = $8;`, - headerID, ilkID, vatFlux.Dst, vatFlux.Src, vatFlux.Rad, vatFlux.TransactionIndex, vatFlux.LogIndex, vatFlux.Raw) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VatFluxChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository VatFluxRepository) MarkHeaderChecked(headerId int64) error { - return shared.MarkHeaderChecked(headerId, repository.db, constants.VatFluxChecked) -} - -func (repository VatFluxRepository) MissingHeaders(startingBlock, endingBlock int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlock, endingBlock, repository.db, constants.VatFluxChecked) -} - -func (repository VatFluxRepository) RecheckHeaders(startingBlock, endingBlock int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlock, endingBlock, repository.db, constants.VatFluxChecked) -} - -func (repository *VatFluxRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/vat_flux/repository_test.go b/pkg/transformers/vat_flux/repository_test.go deleted file mode 100644 index 8bbde4ba..00000000 --- a/pkg/transformers/vat_flux/repository_test.go +++ /dev/null @@ -1,103 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_flux_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_flux" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("VatFlux Repository", func() { - var ( - db *postgres.DB - repository vat_flux.VatFluxRepository - ) - - BeforeEach(func() { - node := test_config.NewTestNode() - db = test_config.NewTestDB(node) - test_config.CleanTestDB(db) - repository = vat_flux.VatFluxRepository{} - repository.SetDB(db) - }) - - type VatFluxDBResult struct { - vat_flux.VatFluxModel - Id int - HeaderId int64 `db:"header_id"` - } - - Describe("Create", func() { - vatFluxWithDifferentLogIdx := test_data.VatFluxModel - vatFluxWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VatFluxChecked, - LogEventTableName: "maker.vat_flux", - TestModel: test_data.VatFluxModel, - ModelWithDifferentLogIdx: vatFluxWithDifferentLogIdx, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists vat flux records", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerId, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - anotherVatFlux := test_data.VatFluxModel - anotherVatFlux.TransactionIndex = test_data.VatFluxModel.TransactionIndex + 1 - err = repository.Create(headerId, []interface{}{test_data.VatFluxModel, anotherVatFlux}) - - var dbResult []VatFluxDBResult - err = db.Select(&dbResult, `SELECT * from maker.vat_flux where header_id = $1`, headerId) - Expect(err).NotTo(HaveOccurred()) - Expect(len(dbResult)).To(Equal(2)) - ilkID, err := shared.GetOrCreateIlk(test_data.VatFluxModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbResult[0].Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbResult[0].Dst).To(Equal(test_data.VatFluxModel.Dst)) - Expect(dbResult[0].Src).To(Equal(test_data.VatFluxModel.Src)) - Expect(dbResult[0].Rad).To(Equal(test_data.VatFluxModel.Rad)) - Expect(dbResult[0].TransactionIndex).To(Equal(test_data.VatFluxModel.TransactionIndex)) - Expect(dbResult[1].TransactionIndex).To(Equal(test_data.VatFluxModel.TransactionIndex + 1)) - Expect(dbResult[0].LogIndex).To(Equal(test_data.VatFluxModel.LogIndex)) - Expect(dbResult[0].Raw).To(MatchJSON(test_data.VatFluxModel.Raw)) - Expect(dbResult[0].HeaderId).To(Equal(headerId)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VatFluxChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vat_flux/vat_flux_suite_test.go b/pkg/transformers/vat_flux/vat_flux_suite_test.go deleted file mode 100644 index 6703caa9..00000000 --- a/pkg/transformers/vat_flux/vat_flux_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package vat_flux_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestVatFlux(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VatFlux Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/vat_fold/config.go b/pkg/transformers/vat_fold/config.go deleted file mode 100644 index f8e35c17..00000000 --- a/pkg/transformers/vat_fold/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_fold - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVatFoldConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VatFoldLabel, - ContractAddresses: []string{constants.VatContractAddress()}, - ContractAbi: constants.VatABI(), - Topic: constants.GetVatFoldSignature(), - StartingBlockNumber: constants.VatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vat_fold/converter.go b/pkg/transformers/vat_fold/converter.go deleted file mode 100644 index 3f58094f..00000000 --- a/pkg/transformers/vat_fold/converter.go +++ /dev/null @@ -1,64 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_fold - -import ( - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -type VatFoldConverter struct{} - -func (VatFoldConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - urn := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - rate := shared.ConvertToRay(ethLog.Topics[3].Big().String()) - raw, err := json.Marshal(ethLog) - - if err != nil { - return models, err - } - - model := VatFoldModel{ - Ilk: ilk, - Urn: urn, - Rate: rate, - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/vat_fold/converter_test.go b/pkg/transformers/vat_fold/converter_test.go deleted file mode 100644 index 9966a503..00000000 --- a/pkg/transformers/vat_fold/converter_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_fold_test - -import ( - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_fold" -) - -var _ = Describe("Vat fold converter", func() { - It("returns err if log missing topics", func() { - converter := vat_fold.VatFoldConverter{} - badLog := types.Log{} - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to an model", func() { - converter := vat_fold.VatFoldConverter{} - - model, err := converter.ToModels([]types.Log{test_data.EthVatFoldLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(model).To(Equal([]interface{}{test_data.VatFoldModel})) - }) -}) diff --git a/pkg/transformers/vat_fold/model.go b/pkg/transformers/vat_fold/model.go deleted file mode 100644 index 10ccc35a..00000000 --- a/pkg/transformers/vat_fold/model.go +++ /dev/null @@ -1,10 +0,0 @@ -package vat_fold - -type VatFoldModel struct { - Ilk string - Urn string - Rate string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vat_fold/repository.go b/pkg/transformers/vat_fold/repository.go deleted file mode 100644 index 96fa1c44..00000000 --- a/pkg/transformers/vat_fold/repository.go +++ /dev/null @@ -1,98 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_fold - -import ( - "fmt" - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatFoldRepository struct { - db *postgres.DB -} - -func (repository VatFoldRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - vatFold, ok := model.(VatFoldModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VatFoldModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(vatFold.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.vat_fold (header_id, ilk, urn, rate, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4::NUMERIC, $5, $6, $7) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, urn = $3, rate = $4, raw_log = $7;`, - headerID, ilkID, vatFold.Urn, vatFold.Rate, vatFold.LogIndex, vatFold.TransactionIndex, vatFold.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VatFoldChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository VatFoldRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.VatFoldChecked) -} - -func (repository VatFoldRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatFoldChecked) -} - -func (repository VatFoldRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatFoldChecked) -} - -func (repository *VatFoldRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/vat_fold/repository_test.go b/pkg/transformers/vat_fold/repository_test.go deleted file mode 100644 index 8ac0f679..00000000 --- a/pkg/transformers/vat_fold/repository_test.go +++ /dev/null @@ -1,93 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_fold_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_fold" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vat.fold repository", func() { - var ( - db *postgres.DB - repository vat_fold.VatFoldRepository - ) - - BeforeEach(func() { - node := test_config.NewTestNode() - db = test_config.NewTestDB(node) - test_config.CleanTestDB(db) - repository = vat_fold.VatFoldRepository{} - repository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.VatFoldModel - modelWithDifferentLogIdx.LogIndex++ - - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VatFoldChecked, - LogEventTableName: "maker.vat_fold", - TestModel: test_data.VatFoldModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a vat fold event", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = repository.Create(headerID, []interface{}{test_data.VatFoldModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbVatFold vat_fold.VatFoldModel - err = db.Get(&dbVatFold, `SELECT ilk, urn, rate, log_idx, tx_idx, raw_log FROM maker.vat_fold WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - - ilkID, err := shared.GetOrCreateIlk(test_data.VatFoldModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbVatFold.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbVatFold.Urn).To(Equal(test_data.VatFoldModel.Urn)) - Expect(dbVatFold.Rate).To(Equal(test_data.VatFoldModel.Rate)) - Expect(dbVatFold.LogIndex).To(Equal(test_data.VatFoldModel.LogIndex)) - Expect(dbVatFold.TransactionIndex).To(Equal(test_data.VatFoldModel.TransactionIndex)) - Expect(dbVatFold.Raw).To(MatchJSON(test_data.VatFoldModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VatFoldChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vat_fold/vat_fold_suite_test.go b/pkg/transformers/vat_fold/vat_fold_suite_test.go deleted file mode 100644 index e3ee0832..00000000 --- a/pkg/transformers/vat_fold/vat_fold_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package vat_fold_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestVatFold(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VatFold Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/vat_grab/config.go b/pkg/transformers/vat_grab/config.go deleted file mode 100644 index 89b8b309..00000000 --- a/pkg/transformers/vat_grab/config.go +++ /dev/null @@ -1,17 +0,0 @@ -package vat_grab - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVatGrabConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VatGrabLabel, - ContractAddresses: []string{constants.VatContractAddress()}, - ContractAbi: constants.VatABI(), - Topic: constants.GetVatGrabSignature(), - StartingBlockNumber: constants.VatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vat_grab/converter.go b/pkg/transformers/vat_grab/converter.go deleted file mode 100644 index 592b3171..00000000 --- a/pkg/transformers/vat_grab/converter.go +++ /dev/null @@ -1,59 +0,0 @@ -package vat_grab - -import ( - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "math/big" -) - -type VatGrabConverter struct{} - -func (VatGrabConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - urn := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - v := shared.GetHexWithoutPrefix(ethLog.Topics[3].Bytes()) - wBytes := shared.GetDataBytesAtIndex(-3, ethLog.Data) - w := shared.GetHexWithoutPrefix(wBytes) - dinkBytes := shared.GetDataBytesAtIndex(-2, ethLog.Data) - dink := big.NewInt(0).SetBytes(dinkBytes).String() - dartBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data) - dart := big.NewInt(0).SetBytes(dartBytes).String() - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - model := VatGrabModel{ - Ilk: ilk, - Urn: urn, - V: v, - W: w, - Dink: dink, - Dart: dart, - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - if len(log.Data) < constants.DataItemLength { - return errors.New("log missing data") - } - return nil -} diff --git a/pkg/transformers/vat_grab/converter_test.go b/pkg/transformers/vat_grab/converter_test.go deleted file mode 100644 index ee3f5fcc..00000000 --- a/pkg/transformers/vat_grab/converter_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package vat_grab_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_grab" -) - -var _ = Describe("Vat grab converter", func() { - var converter vat_grab.VatGrabConverter - - BeforeEach(func() { - converter = vat_grab.VatGrabConverter{} - }) - - It("returns err if log is missing topics", func() { - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("returns err if log is missing data", func() { - badLog := types.Log{ - Topics: []common.Hash{{}, {}, {}, {}}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to an model", func() { - models, err := converter.ToModels([]types.Log{test_data.EthVatGrabLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.VatGrabModel)) - }) -}) diff --git a/pkg/transformers/vat_grab/model.go b/pkg/transformers/vat_grab/model.go deleted file mode 100644 index a8a8aa20..00000000 --- a/pkg/transformers/vat_grab/model.go +++ /dev/null @@ -1,13 +0,0 @@ -package vat_grab - -type VatGrabModel struct { - Ilk string - Urn string - V string - W string - Dink string - Dart string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vat_grab/repository.go b/pkg/transformers/vat_grab/repository.go deleted file mode 100644 index 80dbcfdd..00000000 --- a/pkg/transformers/vat_grab/repository.go +++ /dev/null @@ -1,80 +0,0 @@ -package vat_grab - -import ( - "fmt" - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatGrabRepository struct { - db *postgres.DB -} - -func (repository VatGrabRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - vatGrab, ok := model.(VatGrabModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VatGrabModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(vatGrab.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.vat_grab (header_id, ilk, urn, v, w, dink, dart, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4, $5, $6::NUMERIC, $7::NUMERIC, $8, $9, $10) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, urn = $3, v = $4, w = $5, dink = $6, dart = $7, raw_log = $10;`, - headerID, ilkID, vatGrab.Urn, vatGrab.V, vatGrab.W, vatGrab.Dink, vatGrab.Dart, vatGrab.LogIndex, vatGrab.TransactionIndex, vatGrab.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VatGrabChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository VatGrabRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.VatGrabChecked) -} - -func (repository VatGrabRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatGrabChecked) -} - -func (repository VatGrabRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatGrabChecked) -} - -func (repository *VatGrabRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/vat_grab/repository_test.go b/pkg/transformers/vat_grab/repository_test.go deleted file mode 100644 index ac77c075..00000000 --- a/pkg/transformers/vat_grab/repository_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package vat_grab_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/datastore" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_grab" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vat grab repository", func() { - var ( - db *postgres.DB - vatGrabRepository vat_grab.VatGrabRepository - headerRepository datastore.HeaderRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - headerRepository = repositories.NewHeaderRepository(db) - vatGrabRepository = vat_grab.VatGrabRepository{} - vatGrabRepository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.VatGrabModel - modelWithDifferentLogIdx.LogIndex++ - - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VatGrabChecked, - LogEventTableName: "maker.vat_grab", - TestModel: test_data.VatGrabModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &vatGrabRepository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a vat grab event", func() { - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = vatGrabRepository.Create(headerID, []interface{}{test_data.VatGrabModel}) - Expect(err).NotTo(HaveOccurred()) - var dbVatGrab vat_grab.VatGrabModel - err = db.Get(&dbVatGrab, `SELECT ilk, urn, v, w, dink, dart, log_idx, tx_idx, raw_log FROM maker.vat_grab WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.VatGrabModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbVatGrab.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbVatGrab.Urn).To(Equal(test_data.VatGrabModel.Urn)) - Expect(dbVatGrab.V).To(Equal(test_data.VatGrabModel.V)) - Expect(dbVatGrab.W).To(Equal(test_data.VatGrabModel.W)) - Expect(dbVatGrab.Dink).To(Equal(test_data.VatGrabModel.Dink)) - Expect(dbVatGrab.Dart).To(Equal(test_data.VatGrabModel.Dart)) - Expect(dbVatGrab.LogIndex).To(Equal(test_data.VatGrabModel.LogIndex)) - Expect(dbVatGrab.TransactionIndex).To(Equal(test_data.VatGrabModel.TransactionIndex)) - Expect(dbVatGrab.Raw).To(MatchJSON(test_data.VatGrabModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VatGrabChecked, - Repository: &vatGrabRepository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vat_grab/vat_grab_suite_test.go b/pkg/transformers/vat_grab/vat_grab_suite_test.go deleted file mode 100644 index 428078fe..00000000 --- a/pkg/transformers/vat_grab/vat_grab_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package vat_grab_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestVatGrab(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VatGrab Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/vat_heal/config.go b/pkg/transformers/vat_heal/config.go deleted file mode 100644 index 4bc0831c..00000000 --- a/pkg/transformers/vat_heal/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_heal - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVatHealConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VatHealLabel, - ContractAddresses: []string{constants.VatContractAddress()}, - ContractAbi: constants.VatABI(), - Topic: constants.GetVatHealSignature(), - StartingBlockNumber: constants.VatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vat_heal/converter.go b/pkg/transformers/vat_heal/converter.go deleted file mode 100644 index b5192084..00000000 --- a/pkg/transformers/vat_heal/converter.go +++ /dev/null @@ -1,69 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_heal - -import ( - "encoding/json" - "errors" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - - "github.com/ethereum/go-ethereum/core/types" -) - -type VatHealConverter struct{} - -func (VatHealConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - - urn := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - v := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - radInt := ethLog.Topics[3].Big() - if err != nil { - return nil, err - } - - rawLogJson, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - - model := VatHealModel{ - Urn: urn, - V: v, - Rad: radInt.String(), - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: rawLogJson, - } - - models = append(models, model) - } - - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/vat_heal/converter_test.go b/pkg/transformers/vat_heal/converter_test.go deleted file mode 100644 index e4364897..00000000 --- a/pkg/transformers/vat_heal/converter_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_heal_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_heal" -) - -var _ = Describe("VatHeal converter", func() { - It("Converts logs to models", func() { - converter := vat_heal.VatHealConverter{} - models, err := converter.ToModels([]types.Log{test_data.VatHealLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.VatHealModel)) - }) - - It("Returns an error there are missing topics", func() { - converter := vat_heal.VatHealConverter{} - badLog := types.Log{ - Topics: []common.Hash{ - common.HexToHash("0x"), - common.HexToHash("0x"), - common.HexToHash("0x"), - }, - } - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) -}) diff --git a/pkg/transformers/vat_heal/model.go b/pkg/transformers/vat_heal/model.go deleted file mode 100644 index 675f610c..00000000 --- a/pkg/transformers/vat_heal/model.go +++ /dev/null @@ -1,26 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_heal - -type VatHealModel struct { - Urn string - V string - Rad string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vat_heal/repository.go b/pkg/transformers/vat_heal/repository.go deleted file mode 100644 index 59d567de..00000000 --- a/pkg/transformers/vat_heal/repository.go +++ /dev/null @@ -1,87 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_heal - -import ( - "fmt" - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatHealRepository struct { - db *postgres.DB -} - -func (repository *VatHealRepository) SetDB(db *postgres.DB) { - repository.db = db -} - -func (repository VatHealRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - vatHeal, ok := model.(VatHealModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VatHealModel{}) - } - - _, execErr := tx.Exec(`INSERT INTO maker.vat_heal (header_id, urn, v, rad, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4::NUMERIC, $5, $6, $7) - ON CONFlICT (header_id, tx_idx, log_idx) DO UPDATE SET urn = $2, v = $3, rad = $4, raw_log = $7;`, - headerID, vatHeal.Urn, vatHeal.V, vatHeal.Rad, vatHeal.LogIndex, vatHeal.TransactionIndex, vatHeal.Raw) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VatHealChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository VatHealRepository) MissingHeaders(startingBlock, endingBlock int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlock, endingBlock, repository.db, constants.VatHealChecked) -} - -func (repository VatHealRepository) RecheckHeaders(startingBlock, endingBlock int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlock, endingBlock, repository.db, constants.VatHealChecked) -} - -func (repository VatHealRepository) MarkHeaderChecked(headerId int64) error { - return shared.MarkHeaderChecked(headerId, repository.db, constants.VatHealChecked) -} diff --git a/pkg/transformers/vat_heal/repository_test.go b/pkg/transformers/vat_heal/repository_test.go deleted file mode 100644 index ff5292fe..00000000 --- a/pkg/transformers/vat_heal/repository_test.go +++ /dev/null @@ -1,96 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_heal_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_heal" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("VatHeal Repository", func() { - var ( - db *postgres.DB - repository vat_heal.VatHealRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repository = vat_heal.VatHealRepository{} - repository.SetDB(db) - }) - - type VatHealDBResult struct { - vat_heal.VatHealModel - Id int - HeaderId int64 `db:"header_id"` - } - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.VatHealModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VatHealChecked, - LogEventTableName: "maker.vat_heal", - TestModel: test_data.VatHealModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists vat heal records", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerId, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - anotherVatHeal := test_data.VatHealModel - anotherVatHeal.LogIndex = test_data.VatHealModel.LogIndex + 1 - err = repository.Create(headerId, []interface{}{test_data.VatHealModel, anotherVatHeal}) - - var dbResult []VatHealDBResult - err = db.Select(&dbResult, `SELECT * from maker.vat_heal where header_id = $1`, headerId) - Expect(err).NotTo(HaveOccurred()) - Expect(len(dbResult)).To(Equal(2)) - Expect(dbResult[0].Urn).To(Equal(test_data.VatHealModel.Urn)) - Expect(dbResult[0].V).To(Equal(test_data.VatHealModel.V)) - Expect(dbResult[0].Rad).To(Equal(test_data.VatHealModel.Rad)) - Expect(dbResult[0].LogIndex).To(Equal(test_data.VatHealModel.LogIndex)) - Expect(dbResult[1].LogIndex).To(Equal(test_data.VatHealModel.LogIndex + 1)) - Expect(dbResult[0].TransactionIndex).To(Equal(test_data.VatHealModel.TransactionIndex)) - Expect(dbResult[0].Raw).To(MatchJSON(test_data.VatHealModel.Raw)) - Expect(dbResult[0].HeaderId).To(Equal(headerId)) - }) - }) - - Describe("MarkCheckedHeader", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VatHealChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vat_heal/vat_heal_suite_test.go b/pkg/transformers/vat_heal/vat_heal_suite_test.go deleted file mode 100644 index 047019ea..00000000 --- a/pkg/transformers/vat_heal/vat_heal_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package vat_heal_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestVatHeal(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VatHeal Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/vat_init/config.go b/pkg/transformers/vat_init/config.go deleted file mode 100644 index 7d83c9d5..00000000 --- a/pkg/transformers/vat_init/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_init - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVatInitConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VatInitLabel, - ContractAddresses: []string{constants.VatContractAddress()}, - ContractAbi: constants.VatABI(), - Topic: constants.GetVatInitSignature(), - StartingBlockNumber: constants.VatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vat_init/converter.go b/pkg/transformers/vat_init/converter.go deleted file mode 100644 index 1b59c2c8..00000000 --- a/pkg/transformers/vat_init/converter.go +++ /dev/null @@ -1,56 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_init - -import ( - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -type VatInitConverter struct{} - -func (VatInitConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - model := VatInitModel{ - Ilk: ilk, - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 2 { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/vat_init/converter_test.go b/pkg/transformers/vat_init/converter_test.go deleted file mode 100644 index 8a2fbf12..00000000 --- a/pkg/transformers/vat_init/converter_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_init_test - -import ( - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_init" -) - -var _ = Describe("Vat init converter", func() { - var converter vat_init.VatInitConverter - - BeforeEach(func() { - converter = vat_init.VatInitConverter{} - }) - - It("returns err if log missing topics", func() { - badLog := types.Log{} - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to a model", func() { - models, err := converter.ToModels([]types.Log{test_data.EthVatInitLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.VatInitModel)) - }) -}) diff --git a/pkg/transformers/vat_init/model.go b/pkg/transformers/vat_init/model.go deleted file mode 100644 index a23422ad..00000000 --- a/pkg/transformers/vat_init/model.go +++ /dev/null @@ -1,24 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_init - -type VatInitModel struct { - Ilk string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vat_init/repository.go b/pkg/transformers/vat_init/repository.go deleted file mode 100644 index 0c8bcb8a..00000000 --- a/pkg/transformers/vat_init/repository.go +++ /dev/null @@ -1,100 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_init - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatInitRepository struct { - db *postgres.DB -} - -func (repository VatInitRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - vatInit, ok := model.(VatInitModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VatInitModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(vatInit.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT INTO maker.vat_init (header_id, ilk, log_idx, tx_idx, raw_log) - VALUES($1, $2, $3, $4, $5) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, raw_log = $5;`, - headerID, ilkID, vatInit.LogIndex, vatInit.TransactionIndex, vatInit.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VatInitChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository VatInitRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.VatInitChecked) -} - -func (repository VatInitRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatInitChecked) -} - -func (repository VatInitRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatInitChecked) -} - -func (repository *VatInitRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/vat_init/repository_test.go b/pkg/transformers/vat_init/repository_test.go deleted file mode 100644 index 36142337..00000000 --- a/pkg/transformers/vat_init/repository_test.go +++ /dev/null @@ -1,89 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_init_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_init" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vat init repository", func() { - var ( - db *postgres.DB - repository vat_init.VatInitRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repository = vat_init.VatInitRepository{} - repository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.VatInitModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VatInitChecked, - LogEventTableName: "maker.vat_init", - TestModel: test_data.VatInitModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists vat init records", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = repository.Create(headerID, []interface{}{test_data.VatInitModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbVatInit vat_init.VatInitModel - err = db.Get(&dbVatInit, `SELECT ilk, log_idx, tx_idx, raw_log FROM maker.vat_init WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.VatInitModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbVatInit.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbVatInit.LogIndex).To(Equal(test_data.VatInitModel.LogIndex)) - Expect(dbVatInit.TransactionIndex).To(Equal(test_data.VatInitModel.TransactionIndex)) - Expect(dbVatInit.Raw).To(MatchJSON(test_data.VatInitModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VatInitChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vat_init/vat_init_suite_test.go b/pkg/transformers/vat_init/vat_init_suite_test.go deleted file mode 100644 index b5e75fe4..00000000 --- a/pkg/transformers/vat_init/vat_init_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_init_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestVatInit(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VatInit Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/vat_move/config.go b/pkg/transformers/vat_move/config.go deleted file mode 100644 index 6f8884d3..00000000 --- a/pkg/transformers/vat_move/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_move - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVatMoveConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VatMoveLabel, - ContractAddresses: []string{constants.VatContractAddress()}, - ContractAbi: constants.VatABI(), - Topic: constants.GetVatMoveSignature(), - StartingBlockNumber: constants.VatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vat_move/converter.go b/pkg/transformers/vat_move/converter.go deleted file mode 100644 index 4a129bb9..00000000 --- a/pkg/transformers/vat_move/converter.go +++ /dev/null @@ -1,65 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_move - -import ( - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -type VatMoveConverter struct{} - -func (VatMoveConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return []interface{}{}, err - } - - src := shared2.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - dst := shared2.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - rad := ethLog.Topics[3].Big() - raw, err := json.Marshal(ethLog) - if err != nil { - return []interface{}{}, err - } - - models = append(models, VatMoveModel{ - Src: src, - Dst: dst, - Rad: rad.String(), - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - }) - } - - return models, nil -} - -func verifyLog(ethLog types.Log) error { - if len(ethLog.Data) <= 0 { - return errors.New("log data is empty") - } - if len(ethLog.Topics) < 4 { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/vat_move/converter_test.go b/pkg/transformers/vat_move/converter_test.go deleted file mode 100644 index 5e3313f7..00000000 --- a/pkg/transformers/vat_move/converter_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_move_test - -import ( - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_move" -) - -var _ = Describe("Vat move converter", func() { - var converter vat_move.VatMoveConverter - - BeforeEach(func() { - converter = vat_move.VatMoveConverter{} - }) - - It("returns err if logs are missing topics", func() { - badLog := types.Log{} - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to a model", func() { - models, err := converter.ToModels([]types.Log{test_data.EthVatMoveLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.VatMoveModel)) - }) -}) diff --git a/pkg/transformers/vat_move/model.go b/pkg/transformers/vat_move/model.go deleted file mode 100644 index 80c37852..00000000 --- a/pkg/transformers/vat_move/model.go +++ /dev/null @@ -1,26 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_move - -type VatMoveModel struct { - Src string - Dst string - Rad string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vat_move/repository.go b/pkg/transformers/vat_move/repository.go deleted file mode 100644 index 4bd2c26b..00000000 --- a/pkg/transformers/vat_move/repository.go +++ /dev/null @@ -1,92 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_move - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatMoveRepository struct { - db *postgres.DB -} - -func (repository VatMoveRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - vatMove, ok := model.(VatMoveModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VatMoveModel{}) - } - - _, execErr := tx.Exec( - `INSERT INTO maker.vat_move (header_id, src, dst, rad, log_idx, tx_idx, raw_log) - VALUES ($1, $2, $3, $4::NUMERIC, $5, $6, $7) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET src = $2, dst = $3, rad = $4, raw_log = $7;`, - headerID, vatMove.Src, vatMove.Dst, vatMove.Rad, vatMove.LogIndex, vatMove.TransactionIndex, vatMove.Raw, - ) - - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VatMoveChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository VatMoveRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatMoveChecked) -} - -func (repository VatMoveRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatMoveChecked) -} - -func (repository VatMoveRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.VatMoveChecked) -} - -func (repository *VatMoveRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/vat_move/repository_test.go b/pkg/transformers/vat_move/repository_test.go deleted file mode 100644 index 905559dc..00000000 --- a/pkg/transformers/vat_move/repository_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_move_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_move" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vat Move", func() { - var db *postgres.DB - var repository vat_move.VatMoveRepository - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repository = vat_move.VatMoveRepository{} - repository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.VatMoveModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VatMoveChecked, - LogEventTableName: "maker.vat_move", - TestModel: test_data.VatMoveModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("persists vat move records", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = repository.Create(headerID, []interface{}{test_data.VatMoveModel}) - - Expect(err).NotTo(HaveOccurred()) - var dbVatMove vat_move.VatMoveModel - err = db.Get(&dbVatMove, `SELECT src, dst, rad, log_idx, tx_idx, raw_log FROM maker.vat_move WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbVatMove.Src).To(Equal(test_data.VatMoveModel.Src)) - Expect(dbVatMove.Dst).To(Equal(test_data.VatMoveModel.Dst)) - Expect(dbVatMove.Rad).To(Equal(test_data.VatMoveModel.Rad)) - Expect(dbVatMove.LogIndex).To(Equal(test_data.VatMoveModel.LogIndex)) - Expect(dbVatMove.TransactionIndex).To(Equal(test_data.VatMoveModel.TransactionIndex)) - Expect(dbVatMove.Raw).To(MatchJSON(test_data.VatMoveModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VatMoveChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vat_move/vat_move_suite_test.go b/pkg/transformers/vat_move/vat_move_suite_test.go deleted file mode 100644 index e42b8919..00000000 --- a/pkg/transformers/vat_move/vat_move_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_move_test - -import ( - log "github.com/sirupsen/logrus" - "io/ioutil" - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestVatMove(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VatMove Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/vat_slip/config.go b/pkg/transformers/vat_slip/config.go deleted file mode 100644 index db910f51..00000000 --- a/pkg/transformers/vat_slip/config.go +++ /dev/null @@ -1,17 +0,0 @@ -package vat_slip - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVatSlipConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VatSlipLabel, - ContractAddresses: []string{constants.VatContractAddress()}, - ContractAbi: constants.VatABI(), - Topic: constants.GetVatSlipSignature(), - StartingBlockNumber: constants.VatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vat_slip/converter.go b/pkg/transformers/vat_slip/converter.go deleted file mode 100644 index d40311e0..00000000 --- a/pkg/transformers/vat_slip/converter.go +++ /dev/null @@ -1,62 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_slip - -import ( - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" -) - -type VatSlipConverter struct{} - -func (VatSlipConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - guy := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - rad := ethLog.Topics[3].Big() - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - model := VatSlipModel{ - Ilk: ilk, - Guy: guy, - Rad: rad.String(), - TransactionIndex: ethLog.TxIndex, - LogIndex: ethLog.Index, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - numTopicInValidLog := 4 - if len(log.Topics) < numTopicInValidLog { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/vat_slip/converter_test.go b/pkg/transformers/vat_slip/converter_test.go deleted file mode 100644 index 24107eb0..00000000 --- a/pkg/transformers/vat_slip/converter_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_slip_test - -import ( - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_slip" -) - -var _ = Describe("Vat slip converter", func() { - It("returns err if log is missing topics", func() { - converter := vat_slip.VatSlipConverter{} - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to a model", func() { - converter := vat_slip.VatSlipConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthVatSlipLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.VatSlipModel)) - }) -}) diff --git a/pkg/transformers/vat_slip/model.go b/pkg/transformers/vat_slip/model.go deleted file mode 100644 index adb69417..00000000 --- a/pkg/transformers/vat_slip/model.go +++ /dev/null @@ -1,26 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_slip - -type VatSlipModel struct { - Ilk string - Guy string - Rad string - TransactionIndex uint `db:"tx_idx"` - LogIndex uint `db:"log_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vat_slip/repository.go b/pkg/transformers/vat_slip/repository.go deleted file mode 100644 index 5ca09c93..00000000 --- a/pkg/transformers/vat_slip/repository.go +++ /dev/null @@ -1,83 +0,0 @@ -package vat_slip - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatSlipRepository struct { - db *postgres.DB -} - -func (repository VatSlipRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - vatSlip, ok := model.(VatSlipModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VatSlipModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(vatSlip.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.vat_slip (header_id, ilk, guy, rad, tx_idx, log_idx, raw_log) - VALUES($1, $2, $3, $4::NUMERIC, $5, $6, $7) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, guy = $3, rad = $4, raw_log = $7;`, - headerID, ilkID, vatSlip.Guy, vatSlip.Rad, vatSlip.TransactionIndex, vatSlip.LogIndex, vatSlip.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VatSlipChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository VatSlipRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.VatSlipChecked) -} - -func (repository VatSlipRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatSlipChecked) -} - -func (repository VatSlipRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatSlipChecked) -} - -func (repository *VatSlipRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/vat_slip/repository_test.go b/pkg/transformers/vat_slip/repository_test.go deleted file mode 100644 index 1c6d6371..00000000 --- a/pkg/transformers/vat_slip/repository_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package vat_slip_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "strconv" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_slip" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vat slip repository", func() { - var ( - db *postgres.DB - repository vat_slip.VatSlipRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repository = vat_slip.VatSlipRepository{} - repository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.VatSlipModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VatSlipChecked, - LogEventTableName: "maker.vat_slip", - TestModel: test_data.VatSlipModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a vat slip event", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = repository.Create(headerID, []interface{}{test_data.VatSlipModel}) - Expect(err).NotTo(HaveOccurred()) - - var dbVatSlip vat_slip.VatSlipModel - err = db.Get(&dbVatSlip, `SELECT ilk, guy, rad, tx_idx, log_idx, raw_log FROM maker.vat_slip WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.VatSlipModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbVatSlip.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbVatSlip.Guy).To(Equal(test_data.VatSlipModel.Guy)) - Expect(dbVatSlip.Rad).To(Equal(test_data.VatSlipModel.Rad)) - Expect(dbVatSlip.TransactionIndex).To(Equal(test_data.VatSlipModel.TransactionIndex)) - Expect(dbVatSlip.LogIndex).To(Equal(test_data.VatSlipModel.LogIndex)) - Expect(dbVatSlip.Raw).To(MatchJSON(test_data.VatSlipModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VatSlipChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vat_slip/vat_slip_suite_test.go b/pkg/transformers/vat_slip/vat_slip_suite_test.go deleted file mode 100644 index 643ccd4f..00000000 --- a/pkg/transformers/vat_slip/vat_slip_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vat_slip_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - log "github.com/sirupsen/logrus" - "io/ioutil" -) - -func TestVatSlip(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VatSlip Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/vat_toll/config.go b/pkg/transformers/vat_toll/config.go deleted file mode 100644 index 0003dc2b..00000000 --- a/pkg/transformers/vat_toll/config.go +++ /dev/null @@ -1,17 +0,0 @@ -package vat_toll - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVatTollConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VatTollLabel, - ContractAddresses: []string{constants.VatContractAddress()}, - ContractAbi: constants.VatABI(), - Topic: constants.GetVatTollSignature(), - StartingBlockNumber: constants.VatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vat_toll/converter.go b/pkg/transformers/vat_toll/converter.go deleted file mode 100644 index fce8b7b7..00000000 --- a/pkg/transformers/vat_toll/converter.go +++ /dev/null @@ -1,47 +0,0 @@ -package vat_toll - -import ( - "encoding/json" - "errors" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - - "github.com/ethereum/go-ethereum/core/types" -) - -type VatTollConverter struct{} - -func (VatTollConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - urn := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - take := ethLog.Topics[3].Big() - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - model := VatTollModel{ - Ilk: ilk, - Urn: urn, - Take: take.String(), - TransactionIndex: ethLog.TxIndex, - LogIndex: ethLog.Index, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - numTopicInValidLog := 4 - if len(log.Topics) < numTopicInValidLog { - return errors.New("log missing topics") - } - return nil -} diff --git a/pkg/transformers/vat_toll/converter_test.go b/pkg/transformers/vat_toll/converter_test.go deleted file mode 100644 index 94b049f3..00000000 --- a/pkg/transformers/vat_toll/converter_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package vat_toll_test - -import ( - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_toll" -) - -var _ = Describe("Vat toll converter", func() { - It("returns err if log is missing topics", func() { - converter := vat_toll.VatTollConverter{} - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to an model", func() { - converter := vat_toll.VatTollConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthVatTollLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.VatTollModel)) - }) -}) diff --git a/pkg/transformers/vat_toll/model.go b/pkg/transformers/vat_toll/model.go deleted file mode 100644 index 8f0d1855..00000000 --- a/pkg/transformers/vat_toll/model.go +++ /dev/null @@ -1,10 +0,0 @@ -package vat_toll - -type VatTollModel struct { - Ilk string - Urn string - Take string - TransactionIndex uint `db:"tx_idx"` - LogIndex uint `db:"log_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vat_toll/repository.go b/pkg/transformers/vat_toll/repository.go deleted file mode 100644 index 425e3301..00000000 --- a/pkg/transformers/vat_toll/repository.go +++ /dev/null @@ -1,81 +0,0 @@ -package vat_toll - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatTollRepository struct { - db *postgres.DB -} - -func (repository VatTollRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - vatToll, ok := model.(VatTollModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VatTollModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(vatToll.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.vat_toll (header_id, ilk, urn, take, tx_idx, log_idx, raw_log) - VALUES($1, $2, $3, $4::NUMERIC, $5, $6, $7)`, - headerID, ilkID, vatToll.Urn, vatToll.Take, vatToll.TransactionIndex, vatToll.LogIndex, vatToll.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VatTollChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository VatTollRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.VatTollChecked) -} - -func (repository VatTollRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatTollChecked) -} - -func (repository VatTollRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatTollChecked) -} - -func (repository *VatTollRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/vat_toll/repository_test.go b/pkg/transformers/vat_toll/repository_test.go deleted file mode 100644 index fd8b228d..00000000 --- a/pkg/transformers/vat_toll/repository_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package vat_toll_test - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "strconv" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_toll" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vat toll repository", func() { - var ( - db *postgres.DB - repository vat_toll.VatTollRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repository = vat_toll.VatTollRepository{} - repository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.VatTollModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VatTollChecked, - LogEventTableName: "maker.vat_toll", - TestModel: test_data.VatTollModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a vat toll event", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - err = repository.Create(headerID, []interface{}{test_data.VatTollModel}) - Expect(err).NotTo(HaveOccurred()) - - var dbVatToll vat_toll.VatTollModel - err = db.Get(&dbVatToll, `SELECT ilk, urn, take, tx_idx, log_idx, raw_log FROM maker.vat_toll WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.VatTollModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbVatToll.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbVatToll.Urn).To(Equal(test_data.VatTollModel.Urn)) - Expect(dbVatToll.Take).To(Equal(test_data.VatTollModel.Take)) - Expect(dbVatToll.TransactionIndex).To(Equal(test_data.VatTollModel.TransactionIndex)) - Expect(dbVatToll.LogIndex).To(Equal(test_data.VatTollModel.LogIndex)) - Expect(dbVatToll.Raw).To(MatchJSON(test_data.VatTollModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VatTollChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vat_toll/vat_toll_suite_test.go b/pkg/transformers/vat_toll/vat_toll_suite_test.go deleted file mode 100644 index b5b1e7b0..00000000 --- a/pkg/transformers/vat_toll/vat_toll_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package vat_toll_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - log "github.com/sirupsen/logrus" - "io/ioutil" -) - -func TestVatToll(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VatToll Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/vat_tune/config.go b/pkg/transformers/vat_tune/config.go deleted file mode 100644 index 1a323258..00000000 --- a/pkg/transformers/vat_tune/config.go +++ /dev/null @@ -1,17 +0,0 @@ -package vat_tune - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVatTuneConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VatTuneLabel, - ContractAddresses: []string{constants.VatContractAddress()}, - ContractAbi: constants.VatABI(), - Topic: constants.GetVatTuneSignature(), - StartingBlockNumber: constants.VatDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vat_tune/converter.go b/pkg/transformers/vat_tune/converter.go deleted file mode 100644 index e2627606..00000000 --- a/pkg/transformers/vat_tune/converter.go +++ /dev/null @@ -1,61 +0,0 @@ -package vat_tune - -import ( - "encoding/json" - "errors" - "math/big" - - "github.com/ethereum/go-ethereum/core/types" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatTuneConverter struct{} - -func (VatTuneConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) - urn := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) - v := shared.GetHexWithoutPrefix(ethLog.Topics[3].Bytes()) - wBytes := shared.GetDataBytesAtIndex(-3, ethLog.Data) - w := shared.GetHexWithoutPrefix(wBytes) - dinkBytes := shared.GetDataBytesAtIndex(-2, ethLog.Data) - dink := big.NewInt(0).SetBytes(dinkBytes) - dartBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data) - dart := big.NewInt(0).SetBytes(dartBytes) - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - model := VatTuneModel{ - Ilk: ilk, - Urn: urn, - V: v, - W: w, - Dink: dink.String(), - Dart: dart.String(), - TransactionIndex: ethLog.TxIndex, - LogIndex: ethLog.Index, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 4 { - return errors.New("log missing topics") - } - if len(log.Data) < constants.DataItemLength { - return errors.New("log missing data") - } - return nil -} diff --git a/pkg/transformers/vat_tune/converter_test.go b/pkg/transformers/vat_tune/converter_test.go deleted file mode 100644 index 6f8c21a3..00000000 --- a/pkg/transformers/vat_tune/converter_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package vat_tune_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_tune" -) - -var _ = Describe("Vat tune converter", func() { - It("returns err if log is missing topics", func() { - converter := vat_tune.VatTuneConverter{} - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("returns err if log is missing data", func() { - converter := vat_tune.VatTuneConverter{} - badLog := types.Log{ - Topics: []common.Hash{{}, {}, {}, {}}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to a model", func() { - converter := vat_tune.VatTuneConverter{} - - models, err := converter.ToModels([]types.Log{test_data.EthVatTuneLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0]).To(Equal(test_data.VatTuneModel)) - }) -}) diff --git a/pkg/transformers/vat_tune/model.go b/pkg/transformers/vat_tune/model.go deleted file mode 100644 index e32df171..00000000 --- a/pkg/transformers/vat_tune/model.go +++ /dev/null @@ -1,13 +0,0 @@ -package vat_tune - -type VatTuneModel struct { - Ilk string - Urn string - V string - W string - Dink string - Dart string - TransactionIndex uint `db:"tx_idx"` - LogIndex uint `db:"log_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vat_tune/repository.go b/pkg/transformers/vat_tune/repository.go deleted file mode 100644 index e7ea9228..00000000 --- a/pkg/transformers/vat_tune/repository.go +++ /dev/null @@ -1,82 +0,0 @@ -package vat_tune - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VatTuneRepository struct { - db *postgres.DB -} - -func (repository VatTuneRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - for _, model := range models { - vatTune, ok := model.(VatTuneModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VatTuneModel{}) - } - - ilkID, ilkErr := shared.GetOrCreateIlkInTransaction(vatTune.Ilk, tx) - if ilkErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return ilkErr - } - - _, execErr := tx.Exec( - `INSERT into maker.vat_tune (header_id, ilk, urn, v, w, dink, dart, tx_idx, log_idx, raw_log) - VALUES($1, $2, $3, $4, $5, $6::NUMERIC, $7::NUMERIC, $8, $9, $10) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, urn = $3, v = $4, w = $5, dink = $6, dart = $7, raw_log = $10;`, - headerID, ilkID, vatTune.Urn, vatTune.V, vatTune.W, vatTune.Dink, vatTune.Dart, vatTune.TransactionIndex, vatTune.LogIndex, vatTune.Raw, - ) - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VatTuneChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - return tx.Commit() -} - -func (repository VatTuneRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.VatTuneChecked) -} - -func (repository VatTuneRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatTuneChecked) -} - -func (repository VatTuneRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatTuneChecked) -} - -func (repository *VatTuneRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/vat_tune/repository_test.go b/pkg/transformers/vat_tune/repository_test.go deleted file mode 100644 index fe047c03..00000000 --- a/pkg/transformers/vat_tune/repository_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package vat_tune_test - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - "strconv" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vat_tune" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vat tune repository", func() { - var ( - db *postgres.DB - repository vat_tune.VatTuneRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repository = vat_tune.VatTuneRepository{} - repository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.VatTuneModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VatTuneChecked, - LogEventTableName: "maker.vat_heal", - TestModel: test_data.VatTuneModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &repository, - } - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a vat tune event", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = repository.Create(headerID, []interface{}{test_data.VatTuneModel}) - Expect(err).NotTo(HaveOccurred()) - - var dbVatTune vat_tune.VatTuneModel - err = db.Get(&dbVatTune, `SELECT ilk, urn, v, w, dink, dart, tx_idx, log_idx, raw_log FROM maker.vat_tune WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - ilkID, err := shared.GetOrCreateIlk(test_data.VatTuneModel.Ilk, db) - Expect(err).NotTo(HaveOccurred()) - Expect(dbVatTune.Ilk).To(Equal(strconv.Itoa(ilkID))) - Expect(dbVatTune.Urn).To(Equal(test_data.VatTuneModel.Urn)) - Expect(dbVatTune.V).To(Equal(test_data.VatTuneModel.V)) - Expect(dbVatTune.W).To(Equal(test_data.VatTuneModel.W)) - Expect(dbVatTune.Dink).To(Equal(test_data.VatTuneModel.Dink)) - Expect(dbVatTune.Dart).To(Equal(test_data.VatTuneModel.Dart)) - Expect(dbVatTune.TransactionIndex).To(Equal(test_data.VatTuneModel.TransactionIndex)) - Expect(dbVatTune.LogIndex).To(Equal(test_data.VatTuneModel.LogIndex)) - Expect(dbVatTune.Raw).To(MatchJSON(test_data.VatTuneModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VatTuneChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vat_tune/vat_tune_suite_test.go b/pkg/transformers/vat_tune/vat_tune_suite_test.go deleted file mode 100644 index 6dcefa73..00000000 --- a/pkg/transformers/vat_tune/vat_tune_suite_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package vat_tune_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - log "github.com/sirupsen/logrus" - "io/ioutil" -) - -func TestVatTune(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VatTune Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/pkg/transformers/vow_flog/config.go b/pkg/transformers/vow_flog/config.go deleted file mode 100644 index ca32ced2..00000000 --- a/pkg/transformers/vow_flog/config.go +++ /dev/null @@ -1,33 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow_flog - -import ( - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -func GetVowFlogConfig() shared.TransformerConfig { - return shared.TransformerConfig{ - TransformerName: constants.VowFlogLabel, - ContractAddresses: []string{constants.VowContractAddress()}, - ContractAbi: constants.VowABI(), - Topic: constants.GetVowFlogSignature(), - StartingBlockNumber: constants.VowDeploymentBlock(), - EndingBlockNumber: -1, - } -} diff --git a/pkg/transformers/vow_flog/converter.go b/pkg/transformers/vow_flog/converter.go deleted file mode 100644 index dcabd152..00000000 --- a/pkg/transformers/vow_flog/converter.go +++ /dev/null @@ -1,61 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow_flog - -import ( - "encoding/json" - "errors" - "github.com/ethereum/go-ethereum/core/types" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VowFlogConverter struct{} - -func (VowFlogConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) { - var models []interface{} - for _, ethLog := range ethLogs { - err := verifyLog(ethLog) - if err != nil { - return nil, err - } - - era := ethLog.Topics[2].Big() - - raw, err := json.Marshal(ethLog) - if err != nil { - return nil, err - } - model := VowFlogModel{ - Era: era.String(), - LogIndex: ethLog.Index, - TransactionIndex: ethLog.TxIndex, - Raw: raw, - } - models = append(models, model) - } - return models, nil -} - -func verifyLog(log types.Log) error { - if len(log.Topics) < 3 { - return errors.New("log missing topics") - } - if len(log.Data) < constants.DataItemLength { - return errors.New("log missing data") - } - return nil -} diff --git a/pkg/transformers/vow_flog/converter_test.go b/pkg/transformers/vow_flog/converter_test.go deleted file mode 100644 index fd26d573..00000000 --- a/pkg/transformers/vow_flog/converter_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow_flog_test - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vow_flog" - - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" -) - -var _ = Describe("Vow flog converter", func() { - var converter vow_flog.VowFlogConverter - BeforeEach(func() { - converter = vow_flog.VowFlogConverter{} - }) - - It("returns err if log is missing topics", func() { - badLog := types.Log{ - Data: []byte{1, 1, 1, 1, 1}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - Expect(err).To(HaveOccurred()) - }) - - It("returns err if log is missing data", func() { - badLog := types.Log{ - Topics: []common.Hash{{}, {}, {}, {}}, - } - - _, err := converter.ToModels([]types.Log{badLog}) - Expect(err).To(HaveOccurred()) - }) - - It("converts a log to a model", func() { - models, err := converter.ToModels([]types.Log{test_data.EthVowFlogLog}) - - Expect(err).NotTo(HaveOccurred()) - Expect(len(models)).To(Equal(1)) - Expect(models[0].(vow_flog.VowFlogModel)).To(Equal(test_data.VowFlogModel)) - }) -}) diff --git a/pkg/transformers/vow_flog/model.go b/pkg/transformers/vow_flog/model.go deleted file mode 100644 index 4fdbda8d..00000000 --- a/pkg/transformers/vow_flog/model.go +++ /dev/null @@ -1,24 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow_flog - -type VowFlogModel struct { - Era string - LogIndex uint `db:"log_idx"` - TransactionIndex uint `db:"tx_idx"` - Raw []byte `db:"raw_log"` -} diff --git a/pkg/transformers/vow_flog/repository.go b/pkg/transformers/vow_flog/repository.go deleted file mode 100644 index 6b1a735d..00000000 --- a/pkg/transformers/vow_flog/repository.go +++ /dev/null @@ -1,92 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow_flog - -import ( - "fmt" - - log "github.com/sirupsen/logrus" - - "github.com/vulcanize/vulcanizedb/pkg/core" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" -) - -type VowFlogRepository struct { - db *postgres.DB -} - -func (repository VowFlogRepository) Create(headerID int64, models []interface{}) error { - tx, dBaseErr := repository.db.Begin() - if dBaseErr != nil { - return dBaseErr - } - - for _, model := range models { - flog, ok := model.(VowFlogModel) - if !ok { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return fmt.Errorf("model of type %T, not %T", model, VowFlogModel{}) - } - - _, execErr := tx.Exec( - `INSERT into maker.vow_flog (header_id, era, log_idx, tx_idx, raw_log) - VALUES($1, $2::NUMERIC, $3, $4, $5) - ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET era = $2, raw_log = $5;`, - headerID, flog.Era, flog.LogIndex, flog.TransactionIndex, flog.Raw, - ) - - if execErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return execErr - } - } - - checkHeaderErr := shared.MarkHeaderCheckedInTransaction(headerID, tx, constants.VowFlogChecked) - if checkHeaderErr != nil { - rollbackErr := tx.Rollback() - if rollbackErr != nil { - log.Error("failed to rollback ", rollbackErr) - } - return checkHeaderErr - } - - return tx.Commit() -} - -func (repository VowFlogRepository) MarkHeaderChecked(headerID int64) error { - return shared.MarkHeaderChecked(headerID, repository.db, constants.VowFlogChecked) -} - -func (repository VowFlogRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VowFlogChecked) -} - -func (repository VowFlogRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) { - return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VowFlogChecked) -} - -func (repository *VowFlogRepository) SetDB(db *postgres.DB) { - repository.db = db -} diff --git a/pkg/transformers/vow_flog/repository_test.go b/pkg/transformers/vow_flog/repository_test.go deleted file mode 100644 index 5f843c07..00000000 --- a/pkg/transformers/vow_flog/repository_test.go +++ /dev/null @@ -1,85 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow_flog_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors" - - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories" - "github.com/vulcanize/vulcanizedb/pkg/fakes" - "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data" - "github.com/vulcanize/vulcanizedb/pkg/transformers/vow_flog" - "github.com/vulcanize/vulcanizedb/test_config" -) - -var _ = Describe("Vow flog repository", func() { - var ( - db *postgres.DB - repository vow_flog.VowFlogRepository - ) - - BeforeEach(func() { - db = test_config.NewTestDB(test_config.NewTestNode()) - test_config.CleanTestDB(db) - repository = vow_flog.VowFlogRepository{} - repository.SetDB(db) - }) - - Describe("Create", func() { - modelWithDifferentLogIdx := test_data.VowFlogModel - modelWithDifferentLogIdx.LogIndex++ - inputs := shared_behaviors.CreateBehaviorInputs{ - CheckedHeaderColumnName: constants.VowFlogChecked, - LogEventTableName: "maker.vow_flog", - TestModel: test_data.VowFlogModel, - ModelWithDifferentLogIdx: modelWithDifferentLogIdx, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryCreateBehaviors(&inputs) - - It("adds a vow flog event", func() { - headerRepository := repositories.NewHeaderRepository(db) - headerID, err := headerRepository.CreateOrUpdateHeader(fakes.FakeHeader) - Expect(err).NotTo(HaveOccurred()) - - err = repository.Create(headerID, []interface{}{test_data.VowFlogModel}) - Expect(err).NotTo(HaveOccurred()) - - var dbFlog vow_flog.VowFlogModel - err = db.Get(&dbFlog, `SELECT era, log_idx, tx_idx, raw_log FROM maker.vow_flog WHERE header_id = $1`, headerID) - Expect(err).NotTo(HaveOccurred()) - Expect(dbFlog.Era).To(Equal(test_data.VowFlogModel.Era)) - Expect(dbFlog.LogIndex).To(Equal(test_data.VowFlogModel.LogIndex)) - Expect(dbFlog.TransactionIndex).To(Equal(test_data.VowFlogModel.TransactionIndex)) - Expect(dbFlog.Raw).To(MatchJSON(test_data.VowFlogModel.Raw)) - }) - }) - - Describe("MarkHeaderChecked", func() { - inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{ - CheckedHeaderColumnName: constants.VowFlogChecked, - Repository: &repository, - } - - shared_behaviors.SharedRepositoryMarkHeaderCheckedBehaviors(&inputs) - }) -}) diff --git a/pkg/transformers/vow_flog/vow_flog_suite_test.go b/pkg/transformers/vow_flog/vow_flog_suite_test.go deleted file mode 100644 index f5b602d7..00000000 --- a/pkg/transformers/vow_flog/vow_flog_suite_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// VulcanizeDB -// Copyright © 2018 Vulcanize - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. - -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package vow_flog - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - log "github.com/sirupsen/logrus" - "io/ioutil" -) - -func TestVowFlog(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "VowFlog Suite") -} - -var _ = BeforeSuite(func() { - log.SetOutput(ioutil.Discard) -}) diff --git a/plugins/README.md b/plugins/README.md new file mode 100644 index 00000000..a17ed3f1 --- /dev/null +++ b/plugins/README.md @@ -0,0 +1,2 @@ +## Plugins +This empty directory is for Exporter plugins (.go and .so files) written, built, and linked to by the composeAndExecute command diff --git a/postgraphile/spec/server/config.spec.ts b/postgraphile/spec/server/config.spec.ts index 6b68b4d3..1a6c17f9 100644 --- a/postgraphile/spec/server/config.spec.ts +++ b/postgraphile/spec/server/config.spec.ts @@ -84,7 +84,7 @@ describe('buildServerConfig', () => { it('provides the database config to Postgraphile', () => { expect(serverUtilities.postgraphile).toHaveBeenCalledWith( `${databaseConfig.host}/${databaseConfig.database}`, - ["public", "maker"], + ["public"], jasmine.any(Object)); }); diff --git a/postgraphile/src/server/config.ts b/postgraphile/src/server/config.ts index 5c4dc310..e2be53a1 100644 --- a/postgraphile/src/server/config.ts +++ b/postgraphile/src/server/config.ts @@ -39,7 +39,7 @@ export function buildServerConfig( const middleware: PostgraphileMiddleware = utilities.postgraphile( `${databaseConfig.host}/${databaseConfig.database}`, - ["public", "maker"], + ["public"], options ); diff --git a/pkg/transformers/start_test_chain.sh b/scripts/start_test_chain.sh similarity index 83% rename from pkg/transformers/start_test_chain.sh rename to scripts/start_test_chain.sh index cd62fab5..58b7707b 100755 --- a/pkg/transformers/start_test_chain.sh +++ b/scripts/start_test_chain.sh @@ -2,7 +2,7 @@ MNEMONIC_PHRASE="whisper ordinary mystery awesome wood fox auction february blind volcano spare soft" PORT=7545 -DATABASE_PATH=pkg/transformers/test_data/test_chain/ +DATABASE_PATH=test_data/test_chain/ echo Starting ganache chain on port $PORT... ganache-cli --port $PORT \ diff --git a/pkg/transformers/stop_test_chain.sh b/scripts/stop_test_chain.sh similarity index 100% rename from pkg/transformers/stop_test_chain.sh rename to scripts/stop_test_chain.sh diff --git a/test_config/test_config.go b/test_config/test_config.go index ac954100..b6a323d4 100644 --- a/test_config/test_config.go +++ b/test_config/test_config.go @@ -99,67 +99,15 @@ func CleanTestDB(db *postgres.DB) { db.MustExec("DELETE FROM checked_headers") db.MustExec("DELETE FROM log_filters") db.MustExec("DELETE FROM logs") - db.MustExec("DELETE FROM maker.bite") - db.MustExec("DELETE FROM maker.cat_file_chop_lump") - db.MustExec("DELETE FROM maker.cat_file_flip") - db.MustExec("DELETE FROM maker.cat_file_pit_vow") - db.MustExec("DELETE FROM maker.deal") - db.MustExec("DELETE FROM maker.dent") - db.MustExec("DELETE FROM maker.drip_drip") - db.MustExec("DELETE FROM maker.drip_file_ilk") - db.MustExec("DELETE FROM maker.drip_file_repo") - db.MustExec("DELETE FROM maker.drip_file_vow") - db.MustExec("DELETE FROM maker.flap_kick") - db.MustExec("DELETE FROM maker.flip_kick") - db.MustExec("DELETE FROM maker.flop_kick") - db.MustExec("DELETE FROM maker.frob") - db.MustExec("DELETE FROM maker.pit_drip") - db.MustExec("DELETE FROM maker.pit_file_debt_ceiling") - db.MustExec("DELETE FROM maker.pit_file_ilk") - db.MustExec("DELETE FROM maker.pit_ilk_line") - db.MustExec("DELETE FROM maker.pit_ilk_spot") - db.MustExec("DELETE FROM maker.pit_line") - db.MustExec("DELETE FROM maker.pit_live") - db.MustExec("DELETE FROM maker.pit_vat") - db.MustExec("DELETE FROM maker.price_feeds") - db.MustExec("DELETE FROM maker.tend") - db.MustExec("DELETE FROM maker.vat_dai") - db.MustExec("DELETE FROM maker.vat_debt") - db.MustExec("DELETE FROM maker.vat_flux") - db.MustExec("DELETE FROM maker.vat_fold") - db.MustExec("DELETE FROM maker.vat_gem") - db.MustExec("DELETE FROM maker.vat_grab") - db.MustExec("DELETE FROM maker.vat_heal") - db.MustExec("DELETE FROM maker.vat_ilk_art") - db.MustExec("DELETE FROM maker.vat_ilk_ink") - db.MustExec("DELETE FROM maker.vat_ilk_rate") - db.MustExec("DELETE FROM maker.vat_ilk_take") - db.MustExec("DELETE FROM maker.vat_init") - db.MustExec("DELETE FROM maker.vat_move") - db.MustExec("DELETE FROM maker.vat_sin") - db.MustExec("DELETE FROM maker.vat_slip") - db.MustExec("DELETE FROM maker.vat_toll") - db.MustExec("DELETE FROM maker.vat_tune") - db.MustExec("DELETE FROM maker.vat_urn_art") - db.MustExec("DELETE FROM maker.vat_urn_ink") - db.MustExec("DELETE FROM maker.vat_vice") - db.MustExec("DELETE FROM maker.vow_flog") db.MustExec("DELETE FROM receipts") db.MustExec("DELETE FROM transactions") db.MustExec("DELETE FROM watched_contracts") - db.MustExec("DELETE FROM maker.cat_nflip") - db.MustExec("DELETE FROM maker.cat_live") - db.MustExec("DELETE FROM maker.cat_vat") - db.MustExec("DELETE FROM maker.cat_pit") - db.MustExec("DELETE FROM maker.cat_vow") - db.MustExec("DELETE FROM maker.cat_ilk_flip") - db.MustExec("DELETE FROM maker.cat_ilk_chop") - db.MustExec("DELETE FROM maker.cat_ilk_lump") - db.MustExec("DELETE FROM maker.cat_flip_ilk") - db.MustExec("DELETE FROM maker.cat_flip_ink") - db.MustExec("DELETE FROM maker.cat_flip_tab") - // TODO: add ON DELETE CASCADE? otherwise this needs to come after deleting tables that reference it - db.MustExec("DELETE FROM maker.ilks") +} + +func CleanCheckedHeadersTable(db *postgres.DB, columnNames []string) { + for _, name := range columnNames { + db.MustExec("ALTER TABLE checked_headers DROP COLUMN IF EXISTS " + name) + } } // Returns a new test node, with the same ID diff --git a/utils/utils.go b/utils/utils.go index 596d8ad3..ae610cbf 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -17,12 +17,11 @@ package utils import ( + log "github.com/sirupsen/logrus" "math/big" "os" "path/filepath" - log "github.com/sirupsen/logrus" - "github.com/vulcanize/vulcanizedb/pkg/config" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" diff --git a/vendor/github.com/dave/jennifer/.gitignore b/vendor/github.com/dave/jennifer/.gitignore new file mode 100644 index 00000000..f5730045 --- /dev/null +++ b/vendor/github.com/dave/jennifer/.gitignore @@ -0,0 +1,30 @@ +*.iml + +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +.DS_Store +.idea/ +coverage.out diff --git a/vendor/github.com/dave/jennifer/.travis.yml b/vendor/github.com/dave/jennifer/.travis.yml new file mode 100644 index 00000000..1b62d095 --- /dev/null +++ b/vendor/github.com/dave/jennifer/.travis.yml @@ -0,0 +1,14 @@ +language: go +go: + - 1.x +notificaitons: + email: + recipients: dave@brophy.uk + on_failure: always +install: + - go get -u github.com/dave/courtney + - go get -t -v ./... +script: + - courtney -e +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/dave/jennifer/LICENSE b/vendor/github.com/dave/jennifer/LICENSE new file mode 100644 index 00000000..17ab1ced --- /dev/null +++ b/vendor/github.com/dave/jennifer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 David Brophy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/dave/jennifer/README.md b/vendor/github.com/dave/jennifer/README.md new file mode 100644 index 00000000..2d9060cd --- /dev/null +++ b/vendor/github.com/dave/jennifer/README.md @@ -0,0 +1,1052 @@ +[![Build Status](https://travis-ci.org/dave/jennifer.svg?branch=master)](https://travis-ci.org/dave/jennifer) [![Go Report Card](https://goreportcard.com/badge/github.com/dave/jennifer)](https://goreportcard.com/report/github.com/dave/jennifer) [![codecov](https://img.shields.io/badge/codecov-100%25-brightgreen.svg)](https://codecov.io/gh/dave/jennifer) ![stability-stable](https://img.shields.io/badge/stability-stable-brightgreen.svg) [![Sourcegraph](https://sourcegraph.com/github.com/dave/jennifer/jen/-/badge.svg)](https://sourcegraph.com/github.com/dave/jennifer?badge) + +# Jennifer +Jennifer is a code generator for Go. + +```go +package main + +import ( + "fmt" + + . "github.com/dave/jennifer/jen" +) + +func main() { + f := NewFile("main") + f.Func().Id("main").Params().Block( + Qual("fmt", "Println").Call(Lit("Hello, world")), + ) + fmt.Printf("%#v", f) +} +``` +Output: +```go +package main + +import "fmt" + +func main() { + fmt.Println("Hello, world") +} +``` + +### Install +``` +go get -u github.com/dave/jennifer/jen +``` + +### Need help? +If you get stuck, have a question, would like a code review, or just want a +chat: I'm happy to help! Feel free to open an issue, email me or mention @dave +in your PR. + +### Examples +Jennifer has a comprehensive suite of examples - see [godoc](https://godoc.org/github.com/dave/jennifer/jen#pkg-examples) for an index. Here's some examples of jennifer being used in the real-world: + +* [genjen](genjen/render.go) (which generates much of jennifer, using data in [data.go](genjen/data.go)) +* [zerogen](https://github.com/mrsinham/zerogen/blob/master/generator.go) +* [go-contentful-generator](https://github.com/nicolai86/go-contentful-generator) + +### Rendering +For testing, a File or Statement can be rendered with the fmt package +using the %#v verb. + +```go +c := Id("a").Call(Lit("b")) +fmt.Printf("%#v", c) +// Output: +// a("b") +``` + +This is not recommended for use in production because any error will cause a +panic. For production use, [File.Render](#render) or [File.Save](#save) are +preferred. + +# Identifiers +**Identifiers** [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +### Id +Id renders an identifier. + +```go +c := If(Id("i").Op("==").Id("j")).Block( + Return(Id("i")), +) +fmt.Printf("%#v", c) +// Output: +// if i == j { +// return i +// } +``` + +### Dot +Dot renders a period followed by an identifier. Use for fields and selectors. + +```go +c := Qual("a.b/c", "Foo").Call().Dot("Bar").Index(Lit(0)).Dot("Baz") +fmt.Printf("%#v", c) +// Output: +// c.Foo().Bar[0].Baz +``` + +### Qual +Qual renders a qualified identifier. + +```go +c := Qual("encoding/gob", "NewEncoder").Call() +fmt.Printf("%#v", c) +// Output: +// gob.NewEncoder() +``` + +Imports are automatically added when +used with a File. If the path matches the local path, the package name is +omitted. If package names conflict they are automatically renamed. + +```go +f := NewFilePath("a.b/c") +f.Func().Id("init").Params().Block( + Qual("a.b/c", "Foo").Call().Comment("Local package - name is omitted."), + Qual("d.e/f", "Bar").Call().Comment("Import is automatically added."), + Qual("g.h/f", "Baz").Call().Comment("Colliding package name is renamed."), +) +fmt.Printf("%#v", f) +// Output: +// package c +// +// import ( +// f "d.e/f" +// f1 "g.h/f" +// ) +// +// func init() { +// Foo() // Local package - name is omitted. +// f.Bar() // Import is automatically added. +// f1.Baz() // Colliding package name is renamed. +// } +``` + +Note that +it is not possible to reliably determine the package name given an arbitrary +package path, so a sensible name is guessed from the path and added as an +alias. The names of all standard library packages are known so these do not +need to be aliased. If more control is needed of the aliases, see +[File.ImportName](#importname) or [File.ImportAlias](#importalias). + +### List +List renders a comma separated list. Use for multiple return functions. + +```go +c := List(Id("a"), Err()).Op(":=").Id("b").Call() +fmt.Printf("%#v", c) +// Output: +// a, err := b() +``` + +# Keywords +[Identifiers](#identifiers) **Keywords** [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +Simple keywords, predeclared identifiers and built-in functions are self +explanatory: + +| Construct | Name | +| ---------------- | ---- | +| Keywords | Break, Chan, Const, Continue, Default, Defer, Else, Fallthrough, Func, Go, Goto, Range, Select, Type, Var | +| Functions | Append, Cap, Close, Complex, Copy, Delete, Imag, Len, Make, New, Panic, Print, Println, Real, Recover | +| Types | Bool, Byte, Complex64, Complex128, Error, Float32, Float64, Int, Int8, Int16, Int32, Int64, Rune, String, Uint, Uint8, Uint16, Uint32, Uint64, Uintptr | +| Constants | True, False, Iota, Nil | +| Helpers | Err | + +Built-in functions take a list of parameters and render them appropriately: + +```go +c := Id("a").Op("=").Append(Id("a"), Id("b").Op("...")) +fmt.Printf("%#v", c) +// Output: +// a = append(a, b...) +``` + +Special cases for [If, For](#if-for), [Interface, Struct](#interface-struct), [Switch, Case](#switch-select), [Return](#return) and [Map](#map) are explained below. + +# Operators +[Identifiers](#identifiers) [Keywords](#keywords) **Operators** [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +Op renders the provided operator / token. + +```go +c := Id("a").Op(":=").Id("b").Call() +fmt.Printf("%#v", c) +// Output: +// a := b() +``` + +```go +c := Id("a").Op("=").Op("*").Id("b") +fmt.Printf("%#v", c) +// Output: +// a = *b +``` + +```go +c := Id("a").Call(Id("b").Op("...")) +fmt.Printf("%#v", c) +// Output: +// a(b...) +``` + +```go +c := If(Parens(Id("a").Op("||").Id("b")).Op("&&").Id("c")).Block() +fmt.Printf("%#v", c) +// Output: +// if (a || b) && c { +// } +``` + +# Braces +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) **Braces** [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +Several methods render curly braces, summarized below: + +| Name | Prefix | Separator | Example | +| ------------------------------ | ------------ | --------- | -------------------------------------| +| [Block](#block) | | `\n` | `func a() { ... }` or `if a { ... }` | +| [Interface](#interface-struct) | `interface` | `\n` | `interface { ... }` | +| [Struct](#interface-struct) | `struct` | `\n` | `struct { ... }` | +| [Values](#values) | | `,` | `[]int{1, 2}` or `A{B: "c"}` | + +### Block +Block renders a statement list enclosed by curly braces. Use for code blocks. + +```go +c := Func().Id("foo").Params().String().Block( + Id("a").Op("=").Id("b"), + Id("b").Op("++"), + Return(Id("b")), +) +fmt.Printf("%#v", c) +// Output: +// func foo() string { +// a = b +// b++ +// return b +// } +``` + +```go +c := If(Id("a").Op(">").Lit(10)).Block( + Id("a").Op("=").Id("a").Op("/").Lit(2), +) +fmt.Printf("%#v", c) +// Output: +// if a > 10 { +// a = a / 2 +// } +``` + +A special case applies when used directly after Case or Default, where the braces are omitted. This allows use in switch and select statements. [See example](#switch-select). + +### Interface, Struct +Interface and Struct render the keyword followed by a statement list enclosed +by curly braces. + +```go +c := Var().Id("a").Interface() +fmt.Printf("%#v", c) +// Output: +// var a interface{} +``` + +```go +c := Type().Id("a").Interface( + Id("b").Params().String(), +) +fmt.Printf("%#v", c) +// Output: +// type a interface { +// b() string +// } +``` + +```go +c := Id("c").Op(":=").Make(Chan().Struct()) +fmt.Printf("%#v", c) +// Output: +// c := make(chan struct{}) +``` + +```go +c := Type().Id("foo").Struct( + List(Id("x"), Id("y")).Int(), + Id("u").Float32(), +) +fmt.Printf("%#v", c) +// Output: +// type foo struct { +// x, y int +// u float32 +// } +``` + +# Parentheses +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) **Parentheses** [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +Several methods output parenthesis, summarized below: + +| Name | Prefix | Separator | Example | +| ----------------- | ------ | --------- | --------------------------------- | +| [Call](#call) | | `,` | `fmt.Println(b, c)` | +| [Params](#params) | | `,` | `func (a *A) Foo(i int) { ... }` | +| [Defs](#defs) | | `\n` | `const ( ... )` | +| [Parens](#parens) | | | `[]byte(s)` or `a / (b + c)` | +| [Assert](#assert) | `.` | | `s, ok := i.(string)` | + +### Call +Call renders a comma separated list enclosed by parenthesis. Use for function calls. + +```go +c := Qual("fmt", "Printf").Call( + Lit("%#v: %T\n"), + Id("a"), + Id("b"), +) +fmt.Printf("%#v", c) +// Output: +// fmt.Printf("%#v: %T\n", a, b) +``` + +### Params +Params renders a comma separated list enclosed by parenthesis. Use for function parameters and method receivers. + +```go +c := Func().Params( + Id("a").Id("A"), +).Id("foo").Params( + Id("b"), + Id("c").String(), +).String().Block( + Return(Id("b").Op("+").Id("c")), +) +fmt.Printf("%#v", c) +// Output: +// func (a A) foo(b, c string) string { +// return b + c +// } +``` + +### Defs +Defs renders a statement list enclosed in parenthesis. Use for definition lists. + +```go +c := Const().Defs( + Id("a").Op("=").Lit("a"), + Id("b").Op("=").Lit("b"), +) +fmt.Printf("%#v", c) +// Output: +// const ( +// a = "a" +// b = "b" +// ) +``` + +### Parens +Parens renders a single item in parenthesis. Use for type conversion or to specify evaluation order. + +```go +c := Id("b").Op(":=").Index().Byte().Parens(Id("s")) +fmt.Printf("%#v", c) +// Output: +// b := []byte(s) +``` + +```go +c := Id("a").Op("/").Parens(Id("b").Op("+").Id("c")) +fmt.Printf("%#v", c) +// Output: +// a / (b + c) +``` + +### Assert +Assert renders a period followed by a single item enclosed by parenthesis. Use for type assertions. + +```go +c := List(Id("b"), Id("ok")).Op(":=").Id("a").Assert(Bool()) +fmt.Printf("%#v", c) +// Output: +// b, ok := a.(bool) +``` + +# Control flow +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) **Control flow** [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +### If, For +If and For render the keyword followed by a semicolon separated list. + +```go +c := If( + Err().Op(":=").Id("a").Call(), + Err().Op("!=").Nil(), +).Block( + Return(Err()), +) +fmt.Printf("%#v", c) +// Output: +// if err := a(); err != nil { +// return err +// } +``` + +```go +c := For( + Id("i").Op(":=").Lit(0), + Id("i").Op("<").Lit(10), + Id("i").Op("++"), +).Block( + Qual("fmt", "Println").Call(Id("i")), +) +fmt.Printf("%#v", c) +// Output: +// for i := 0; i < 10; i++ { +// fmt.Println(i) +// } +``` + +### Switch, Select +Switch, Select, Case and Block are used to build switch or select statements: + +```go +c := Switch(Id("value").Dot("Kind").Call()).Block( + Case(Qual("reflect", "Float32"), Qual("reflect", "Float64")).Block( + Return(Lit("float")), + ), + Case(Qual("reflect", "Bool")).Block( + Return(Lit("bool")), + ), + Case(Qual("reflect", "Uintptr")).Block( + Fallthrough(), + ), + Default().Block( + Return(Lit("none")), + ), +) +fmt.Printf("%#v", c) +// Output: +// switch value.Kind() { +// case reflect.Float32, reflect.Float64: +// return "float" +// case reflect.Bool: +// return "bool" +// case reflect.Uintptr: +// fallthrough +// default: +// return "none" +// } +``` + +### Return +Return renders the keyword followed by a comma separated list. + +```go +c := Return(Id("a"), Id("b")) +fmt.Printf("%#v", c) +// Output: +// return a, b +``` + +# Collections +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) **Collections** [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +### Map +Map renders the keyword followed by a single item enclosed by square brackets. Use for map definitions. + +```go +c := Id("a").Op(":=").Map(String()).String().Values() +fmt.Printf("%#v", c) +// Output: +// a := map[string]string{} +``` + +### Index +Index renders a colon separated list enclosed by square brackets. Use for array / slice indexes and definitions. + +```go +c := Var().Id("a").Index().String() +fmt.Printf("%#v", c) +// Output: +// var a []string +``` + +```go +c := Id("a").Op(":=").Id("b").Index(Lit(0), Lit(1)) +fmt.Printf("%#v", c) +// Output: +// a := b[0:1] +``` + +```go +c := Id("a").Op(":=").Id("b").Index(Lit(1), Empty()) +fmt.Printf("%#v", c) +// Output: +// a := b[1:] +``` + +### Values +Values renders a comma separated list enclosed by curly braces. Use for slice or composite literals. + +```go +c := Index().String().Values(Lit("a"), Lit("b")) +fmt.Printf("%#v", c) +// Output: +// []string{"a", "b"} +``` + +Dict renders as key/value pairs. Use with Values for map or composite +literals. + +```go +c := Map(String()).String().Values(Dict{ + Lit("a"): Lit("b"), + Lit("c"): Lit("d"), +}) +fmt.Printf("%#v", c) +// Output: +// map[string]string{ +// "a": "b", +// "c": "d", +// } +``` + +```go +c := Op("&").Id("Person").Values(Dict{ + Id("Age"): Lit(1), + Id("Name"): Lit("a"), +}) +fmt.Printf("%#v", c) +// Output: +// &Person{ +// Age: 1, +// Name: "a", +// } +``` + +DictFunc executes a func(Dict) to generate the value. + +```go +c := Id("a").Op(":=").Map(String()).String().Values(DictFunc(func(d Dict) { + d[Lit("a")] = Lit("b") + d[Lit("c")] = Lit("d") +})) +fmt.Printf("%#v", c) +// Output: +// a := map[string]string{ +// "a": "b", +// "c": "d", +// } +``` + +Note: the items are ordered by key when rendered to ensure repeatable code. + +# Literals +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) **Literals** [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +### Lit +Lit renders a literal. Lit supports only built-in types (bool, string, int, complex128, float64, +float32, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr and complex64). +Passing any other type will panic. + +```go +c := Id("a").Op(":=").Lit("a") +fmt.Printf("%#v", c) +// Output: +// a := "a" +``` + +```go +c := Id("a").Op(":=").Lit(1.5) +fmt.Printf("%#v", c) +// Output: +// a := 1.5 +``` + +LitFunc generates the value to render by executing the provided +function. + +```go +c := Id("a").Op(":=").LitFunc(func() interface{} { return 1 + 1 }) +fmt.Printf("%#v", c) +// Output: +// a := 2 +``` + +For the default constant types (bool, int, float64, string, complex128), Lit +will render the untyped constant. + +| Code | Output | +| ------------- | ---------- | +| `Lit(true)` | `true` | +| `Lit(1)` | `1` | +| `Lit(1.0)` | `1.0` | +| `Lit("foo")` | `"foo"` | +| `Lit(0 + 1i)` | `(0 + 1i)` | + +For all other built-in types (float32, int8, int16, int32, int64, uint, uint8, +uint16, uint32, uint64, uintptr, complex64), Lit will also render the type. + +| Code | Output | +| ------------------------ | ------------------- | +| `Lit(float32(1))` | `float32(1)` | +| `Lit(int16(1))` | `int16(1)` | +| `Lit(uint8(0x1))` | `uint8(0x1)` | +| `Lit(complex64(0 + 1i))` | `complex64(0 + 1i)` | + +The built-in alias types byte and rune need a special case. LitRune and LitByte +render rune and byte literals. + +| Code | Output | +| ------------------------ | ----------- | +| `LitRune('x')` | `'x'` | +| `LitByte(byte(0x1))` | `byte(0x1)` | + +# Comments +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) **Comments** [Helpers](#helpers) [Misc](#misc) [File](#file) + +### Comment +Comment adds a comment. If the provided string contains a newline, the +comment is formatted in multiline style. + +```go +f := NewFile("a") +f.Comment("Foo returns the string \"foo\"") +f.Func().Id("Foo").Params().String().Block( + Return(Lit("foo")).Comment("return the string foo"), +) +fmt.Printf("%#v", f) +// Output: +// package a +// +// // Foo returns the string "foo" +// func Foo() string { +// return "foo" // return the string foo +// } +``` + +```go +c := Comment("a\nb") +fmt.Printf("%#v", c) +// Output: +// /* +// a +// b +// */ +``` + +If the comment string starts +with "//" or "/*", the automatic formatting is disabled and the string is +rendered directly. + +```go +c := Id("foo").Call(Comment("/* inline */")).Comment("//no-space") +fmt.Printf("%#v", c) +// Output: +// foo( /* inline */ ) //no-space +``` + +### Commentf +Commentf adds a comment, using a format string and a list of parameters. + +```go +name := "foo" +val := "bar" +c := Id(name).Op(":=").Lit(val).Commentf("%s is the string \"%s\"", name, val) +fmt.Printf("%#v", c) +// Output: +// foo := "bar" // foo is the string "bar" +``` + +# Helpers +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) **Helpers** [Misc](#misc) [File](#file) + +### Func methods +All constructs that accept a variadic list of items are paired with GroupFunc +functions that accept a func(*Group). Use for embedding logic. + +```go +c := Id("numbers").Op(":=").Index().Int().ValuesFunc(func(g *Group) { + for i := 0; i <= 5; i++ { + g.Lit(i) + } +}) +fmt.Printf("%#v", c) +// Output: +// numbers := []int{0, 1, 2, 3, 4, 5} +``` + +```go +increment := true +name := "a" +c := Func().Id("a").Params().BlockFunc(func(g *Group) { + g.Id(name).Op("=").Lit(1) + if increment { + g.Id(name).Op("++") + } else { + g.Id(name).Op("--") + } +}) +fmt.Printf("%#v", c) +// Output: +// func a() { +// a = 1 +// a++ +// } +``` + +### Add +Add appends the provided items to the statement. + +```go +ptr := Op("*") +c := Id("a").Op("=").Add(ptr).Id("b") +fmt.Printf("%#v", c) +// Output: +// a = *b +``` + +```go +a := Id("a") +i := Int() +c := Var().Add(a, i) +fmt.Printf("%#v", c) +// Output: +// var a int +``` + +### Do +Do calls the provided function with the statement as a parameter. Use for +embedding logic. + +```go +f := func(name string, isMap bool) *Statement { + return Id(name).Op(":=").Do(func(s *Statement) { + if isMap { + s.Map(String()).String() + } else { + s.Index().String() + } + }).Values() +} +fmt.Printf("%#v\n%#v", f("a", true), f("b", false)) +// Output: +// a := map[string]string{} +// b := []string{} +``` + +# Misc +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) **Misc** [File](#file) + +### Tag +Tag renders a struct tag + +```go +c := Type().Id("foo").Struct( + Id("A").String().Tag(map[string]string{"json": "a"}), + Id("B").Int().Tag(map[string]string{"json": "b", "bar": "baz"}), +) +fmt.Printf("%#v", c) +// Output: +// type foo struct { +// A string `json:"a"` +// B int `bar:"baz" json:"b"` +// } +``` + +Note: the items are ordered by key when rendered to ensure repeatable code. + +### Null +Null adds a null item. Null items render nothing and are not followed by a +separator in lists. + +In lists, nil will produce the same effect. + +```go +c := Func().Id("foo").Params( + nil, + Id("s").String(), + Null(), + Id("i").Int(), +).Block() +fmt.Printf("%#v", c) +// Output: +// func foo(s string, i int) {} +``` + +### Empty +Empty adds an empty item. Empty items render nothing but are followed by a +separator in lists. + +```go +c := Id("a").Op(":=").Id("b").Index(Lit(1), Empty()) +fmt.Printf("%#v", c) +// Output: +// a := b[1:] +``` + +### Line +Line inserts a blank line. + +### Clone +Be careful when passing *Statement. Consider the following... + +```go +a := Id("a") +c := Block( + a.Call(), + a.Call(), +) +fmt.Printf("%#v", c) +// Output: +// { +// a()() +// a()() +// } +``` + +Id("a") returns a *Statement, which the Call() method appends to twice. To +avoid this, use Clone. Clone makes a copy of the Statement, so further tokens can be appended +without affecting the original. + +```go +a := Id("a") +c := Block( + a.Clone().Call(), + a.Clone().Call(), +) +fmt.Printf("%#v", c) +// Output: +// { +// a() +// a() +// } +``` + +### Cgo +The cgo "C" pseudo-package is a special case, and always renders without a package alias. The +import can be added with `Qual`, `Anon` or by supplying a preamble. The preamble is added with +`File.CgoPreamble` which has the same semantics as [Comment](#comments). If a preamble is provided, +the import is separated, and preceded by the preamble. + +```go +f := NewFile("a") +f.CgoPreamble(`#include +#include + +void myprint(char* s) { +printf("%s\n", s); +} +`) +f.Func().Id("init").Params().Block( + Id("cs").Op(":=").Qual("C", "CString").Call(Lit("Hello from stdio\n")), + Qual("C", "myprint").Call(Id("cs")), + Qual("C", "free").Call(Qual("unsafe", "Pointer").Parens(Id("cs"))), +) +fmt.Printf("%#v", f) +// Output: +// package a +// +// import "unsafe" +// +// /* +// #include +// #include +// +// void myprint(char* s) { +// printf("%s\n", s); +// } +// */ +// import "C" +// +// func init() { +// cs := C.CString("Hello from stdio\n") +// C.myprint(cs) +// C.free(unsafe.Pointer(cs)) +// } +``` + +# File +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) **File** + +File represents a single source file. Package imports are managed +automaticaly by File. + +### NewFile +NewFile Creates a new file, with the specified package name. + +### NewFilePath +NewFilePath creates a new file while specifying the package path - the +package name is inferred from the path. + +### NewFilePathName +NewFilePathName creates a new file with the specified package path and name. + +```go +f := NewFilePathName("a.b/c", "main") +f.Func().Id("main").Params().Block( + Qual("a.b/c", "Foo").Call(), +) +fmt.Printf("%#v", f) +// Output: +// package main +// +// func main() { +// Foo() +// } +``` + +### Save +Save renders the file and saves to the filename provided. + +### Render +Render renders the file to the provided writer. + +```go +f := NewFile("a") +f.Func().Id("main").Params().Block() +buf := &bytes.Buffer{} +err := f.Render(buf) +if err != nil { + fmt.Println(err.Error()) +} else { + fmt.Println(buf.String()) +} +// Output: +// package a +// +// func main() {} +``` + +### Anon +Anon adds an anonymous import. + +```go +f := NewFile("c") +f.Anon("a") +f.Func().Id("init").Params().Block() +fmt.Printf("%#v", f) +// Output: +// package c +// +// import _ "a" +// +// func init() {} +``` + +### ImportName +ImportName provides the package name for a path. If specified, the alias will be omitted from the +import block. This is optional. If not specified, a sensible package name is used based on the path +and this is added as an alias in the import block. + +```go +f := NewFile("main") + +// package a should use name "a" +f.ImportName("github.com/foo/a", "a") + +// package b is not used in the code so will not be included +f.ImportName("github.com/foo/b", "b") + +f.Func().Id("main").Params().Block( + Qual("github.com/foo/a", "A").Call(), +) +fmt.Printf("%#v", f) + +// Output: +// package main +// +// import "github.com/foo/a" +// +// func main() { +// a.A() +// } +``` + +### ImportNames +ImportNames allows multiple names to be imported as a map. Use the [gennames](gennames) command to +automatically generate a go file containing a map of a selection of package names. + +### ImportAlias +ImportAlias provides the alias for a package path that should be used in the import block. A +period can be used to force a dot-import. + +```go +f := NewFile("main") + +// package a should be aliased to "b" +f.ImportAlias("github.com/foo/a", "b") + +// package c is not used in the code so will not be included +f.ImportAlias("github.com/foo/c", "c") + +f.Func().Id("main").Params().Block( + Qual("github.com/foo/a", "A").Call(), +) +fmt.Printf("%#v", f) + +// Output: +// package main +// +// import b "github.com/foo/a" +// +// func main() { +// b.A() +// } +``` + +### Comments +PackageComment adds a comment to the top of the file, above the package +keyword. + +HeaderComment adds a comment to the top of the file, above any package +comments. A blank line is rendered below the header comments, ensuring +header comments are not included in the package doc. + +CanonicalPath adds a canonical import path annotation to the package clause. + +```go +f := NewFile("c") +f.CanonicalPath = "d.e/f" +f.HeaderComment("Code generated by...") +f.PackageComment("Package c implements...") +f.Func().Id("init").Params().Block() +fmt.Printf("%#v", f) +// Output: +// // Code generated by... +// +// // Package c implements... +// package c // import "d.e/f" +// +// func init() {} +``` + +CgoPreamble adds a cgo preamble comment that is rendered directly before the "C" pseudo-package +import. + +### PackagePrefix +If you're worried about generated package aliases conflicting with local variable names, you +can set a prefix here. Package foo becomes {prefix}_foo. + +```go +f := NewFile("a") +f.PackagePrefix = "pkg" +f.Func().Id("main").Params().Block( + Qual("b.c/d", "E").Call(), +) +fmt.Printf("%#v", f) +// Output: +// package a +// +// import pkg_d "b.c/d" +// +// func main() { +// pkg_d.E() +// } +``` diff --git a/vendor/github.com/dave/jennifer/README.md.tpl b/vendor/github.com/dave/jennifer/README.md.tpl new file mode 100644 index 00000000..9000ca1d --- /dev/null +++ b/vendor/github.com/dave/jennifer/README.md.tpl @@ -0,0 +1,422 @@ +[![Build Status](https://travis-ci.org/dave/jennifer.svg?branch=master)](https://travis-ci.org/dave/jennifer) [![Go Report Card](https://goreportcard.com/badge/github.com/dave/jennifer)](https://goreportcard.com/report/github.com/dave/jennifer) [![codecov](https://img.shields.io/badge/codecov-100%25-brightgreen.svg)](https://codecov.io/gh/dave/jennifer) ![stability-stable](https://img.shields.io/badge/stability-stable-brightgreen.svg) [![Sourcegraph](https://sourcegraph.com/github.com/dave/jennifer/jen/-/badge.svg)](https://sourcegraph.com/github.com/dave/jennifer?badge) + +# Jennifer +Jennifer is a code generator for Go. + +```go +package main + +import ( + "fmt" + + . "github.com/dave/jennifer/jen" +) + +func main() {{ "ExampleNewFile" | code }} +``` +Output: +```go +{{ "ExampleNewFile" | output }} +``` + +### Install +``` +go get -u github.com/dave/jennifer/jen +``` + +### Need help? +If you get stuck, have a question, would like a code review, or just want a +chat: I'm happy to help! Feel free to open an issue, email me or mention @dave +in your PR. + +### Examples +Jennifer has a comprehensive suite of examples - see [godoc](https://godoc.org/github.com/dave/jennifer/jen#pkg-examples) for an index. Here's some examples of jennifer being used in the real-world: + +* [genjen](genjen/render.go) (which generates much of jennifer, using data in [data.go](genjen/data.go)) +* [zerogen](https://github.com/mrsinham/zerogen/blob/master/generator.go) +* [go-contentful-generator](https://github.com/nicolai86/go-contentful-generator) + +### Rendering +For testing, a File or Statement can be rendered with the fmt package +using the %#v verb. + +{{ "ExampleCall_fmt" | example }} + +This is not recommended for use in production because any error will cause a +panic. For production use, [File.Render](#render) or [File.Save](#save) are +preferred. + +# Identifiers +**Identifiers** [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +### Id +{{ "Id" | doc }} + +{{ "ExampleId" | example }} + +### Dot +{{ "Dot" | doc }} + +{{ "ExampleDot" | example }} + +### Qual +{{ "Qual[0]" | doc }} + +{{ "ExampleQual" | example }} + +{{ "Qual[1:4]" | doc }} + +{{ "ExampleQual_file" | example }} + +{{ "Qual[4:]" | doc }} + +### List +{{ "List" | doc }} + +{{ "ExampleList" | example }} + +# Keywords +[Identifiers](#identifiers) **Keywords** [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +Simple keywords, predeclared identifiers and built-in functions are self +explanatory: + +| Construct | Name | +| ---------------- | ---- | +| Keywords | Break, Chan, Const, Continue, Default, Defer, Else, Fallthrough, Func, Go, Goto, Range, Select, Type, Var | +| Functions | Append, Cap, Close, Complex, Copy, Delete, Imag, Len, Make, New, Panic, Print, Println, Real, Recover | +| Types | Bool, Byte, Complex64, Complex128, Error, Float32, Float64, Int, Int8, Int16, Int32, Int64, Rune, String, Uint, Uint8, Uint16, Uint32, Uint64, Uintptr | +| Constants | True, False, Iota, Nil | +| Helpers | Err | + +Built-in functions take a list of parameters and render them appropriately: + +{{ "ExampleAppend_more" | example }} + +Special cases for [If, For](#if-for), [Interface, Struct](#interface-struct), [Switch, Case](#switch-select), [Return](#return) and [Map](#map) are explained below. + +# Operators +[Identifiers](#identifiers) [Keywords](#keywords) **Operators** [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +{{ "Op" | doc }} + +{{ "ExampleOp" | example }} + +{{ "ExampleOp_star" | example }} + +{{ "ExampleOp_variadic" | example }} + +{{ "ExampleOp_complex_conditions" | example }} + +# Braces +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) **Braces** [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +Several methods render curly braces, summarized below: + +| Name | Prefix | Separator | Example | +| ------------------------------ | ------------ | --------- | -------------------------------------| +| [Block](#block) | | `\n` | `func a() { ... }` or `if a { ... }` | +| [Interface](#interface-struct) | `interface` | `\n` | `interface { ... }` | +| [Struct](#interface-struct) | `struct` | `\n` | `struct { ... }` | +| [Values](#values) | | `,` | `[]int{1, 2}` or `A{B: "c"}` | + +### Block +{{ "Block[:2]" | doc }} + +{{ "ExampleBlock" | example }} + +{{ "ExampleBlock_if" | example }} + +{{ "Block[2:]" | doc }} [See example](#switch-select). + +### Interface, Struct +Interface and Struct render the keyword followed by a statement list enclosed +by curly braces. + +{{ "ExampleInterface_empty" | example }} + +{{ "ExampleInterface" | example }} + +{{ "ExampleStruct_empty" | example }} + +{{ "ExampleStruct" | example }} + +# Parentheses +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) **Parentheses** [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +Several methods output parenthesis, summarized below: + +| Name | Prefix | Separator | Example | +| ----------------- | ------ | --------- | --------------------------------- | +| [Call](#call) | | `,` | `fmt.Println(b, c)` | +| [Params](#params) | | `,` | `func (a *A) Foo(i int) { ... }` | +| [Defs](#defs) | | `\n` | `const ( ... )` | +| [Parens](#parens) | | | `[]byte(s)` or `a / (b + c)` | +| [Assert](#assert) | `.` | | `s, ok := i.(string)` | + +### Call +{{ "Call" | doc }} + +{{ "ExampleCall" | example }} + +### Params +{{ "Params" | doc }} + +{{ "ExampleParams" | example }} + +### Defs +{{ "Defs" | doc }} + +{{ "ExampleDefs" | example }} + +### Parens +{{ "Parens" | doc }} + +{{ "ExampleParens" | example }} + +{{ "ExampleParens_order" | example }} + +### Assert +{{ "Assert" | doc }} + +{{ "ExampleAssert" | example }} + +# Control flow +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) **Control flow** [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +### If, For +If and For render the keyword followed by a semicolon separated list. + +{{ "ExampleIf" | example }} + +{{ "ExampleFor" | example }} + +### Switch, Select +Switch, Select, Case and Block are used to build switch or select statements: + +{{ "ExampleSwitch" | example }} + +### Return +{{ "Return" | doc }} + +{{ "ExampleReturn" | example }} + +# Collections +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) **Collections** [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +### Map +{{ "Map" | doc }} + +{{ "ExampleMap" | example }} + +### Index +{{ "Index" | doc }} + +{{ "ExampleIndex" | example }} + +{{ "ExampleIndex_index" | example }} + +{{ "ExampleIndex_empty" | example }} + +### Values +{{ "Values" | doc }} + +{{ "ExampleValues" | example }} + +{{ "Dict" | doc }} + +{{ "ExampleValues_dict_multiple" | example }} + +{{ "ExampleValues_dict_composite" | example }} + +{{ "DictFunc[0]" | doc }} + +{{ "ExampleDictFunc" | example }} + +Note: the items are ordered by key when rendered to ensure repeatable code. + +# Literals +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) **Literals** [Comments](#comments) [Helpers](#helpers) [Misc](#misc) [File](#file) + +### Lit +{{ "Lit" | doc }} + +{{ "ExampleLit" | example }} + +{{ "ExampleLit_float" | example }} + +{{ "LitFunc[1:2]" | doc }} + +{{ "ExampleLitFunc" | example }} + +For the default constant types (bool, int, float64, string, complex128), Lit +will render the untyped constant. + +| Code | Output | +| ------------- | ---------- | +| `Lit(true)` | `true` | +| `Lit(1)` | `1` | +| `Lit(1.0)` | `1.0` | +| `Lit("foo")` | `"foo"` | +| `Lit(0 + 1i)` | `(0 + 1i)` | + +For all other built-in types (float32, int8, int16, int32, int64, uint, uint8, +uint16, uint32, uint64, uintptr, complex64), Lit will also render the type. + +| Code | Output | +| ------------------------ | ------------------- | +| `Lit(float32(1))` | `float32(1)` | +| `Lit(int16(1))` | `int16(1)` | +| `Lit(uint8(0x1))` | `uint8(0x1)` | +| `Lit(complex64(0 + 1i))` | `complex64(0 + 1i)` | + +The built-in alias types byte and rune need a special case. LitRune and LitByte +render rune and byte literals. + +| Code | Output | +| ------------------------ | ----------- | +| `LitRune('x')` | `'x'` | +| `LitByte(byte(0x1))` | `byte(0x1)` | + +# Comments +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) **Comments** [Helpers](#helpers) [Misc](#misc) [File](#file) + +### Comment +{{ "Comment[:2]" | doc }} + +{{ "ExampleComment" | example }} + +{{ "ExampleComment_multiline" | example }} + +{{ "Comment[2:]" | doc }} + +{{ "ExampleComment_formatting_disabled" | example }} + +### Commentf +{{ "Commentf[0]" | doc }} + +{{ "ExampleCommentf" | example }} + +# Helpers +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) **Helpers** [Misc](#misc) [File](#file) + +### Func methods +All constructs that accept a variadic list of items are paired with GroupFunc +functions that accept a func(*Group). Use for embedding logic. + +{{ "ExampleValuesFunc" | example }} + +{{ "ExampleBlockFunc" | example }} + +### Add +{{ "Add" | doc }} + +{{ "ExampleAdd" | example }} + +{{ "ExampleAdd_var" | example }} + +### Do +{{ "Do" | doc }} + +{{ "ExampleDo" | example }} + +# Misc +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) **Misc** [File](#file) + +### Tag +{{ "Tag" | doc }} + +{{ "ExampleTag" | example }} + +Note: the items are ordered by key when rendered to ensure repeatable code. + +### Null +{{ "Null" | doc }} + +In lists, nil will produce the same effect. + +{{ "ExampleNull_and_nil" | example }} + +### Empty +{{ "Empty" | doc }} + +{{ "ExampleEmpty" | example }} + +### Line +{{ "Line" | doc }} + +### Clone +Be careful when passing *Statement. Consider the following... + +{{ "ExampleStatement_Clone_broken" | example }} + +Id("a") returns a *Statement, which the Call() method appends to twice. To +avoid this, use Clone. {{ "Statement.Clone" | doc }} + +{{ "ExampleStatement_Clone_fixed" | example }} + +### Cgo +The cgo "C" pseudo-package is a special case, and always renders without a package alias. The +import can be added with `Qual`, `Anon` or by supplying a preamble. The preamble is added with +`File.CgoPreamble` which has the same semantics as [Comment](#comments). If a preamble is provided, +the import is separated, and preceded by the preamble. + +{{ "ExampleFile_CgoPreamble" | example }} + +# File +[Identifiers](#identifiers) [Keywords](#keywords) [Operators](#operators) [Braces](#braces) [Parentheses](#parentheses) [Control flow](#control-flow) [Collections](#collections) [Literals](#literals) [Comments](#comments) [Helpers](#helpers) [Misc](#misc) **File** + +{{ "File" | doc }} + +### NewFile +{{ "NewFile" | doc }} + +### NewFilePath +{{ "NewFilePath" | doc }} + +### NewFilePathName +{{ "NewFilePathName" | doc }} + +{{ "ExampleNewFilePathName" | example }} + +### Save +{{ "File.Save" | doc }} + +### Render +{{ "File.Render" | doc }} + +{{ "ExampleFile_Render" | example }} + +### Anon +{{ "File.Anon" | doc }} + +{{ "ExampleFile_Anon" | example }} + +### ImportName +{{ "File.ImportName" | doc }} + +{{ "ExampleFile_ImportName" | example }} + +### ImportNames +{{ "File.ImportNames" | doc }} + +### ImportAlias +{{ "File.ImportAlias" | doc }} + +{{ "ExampleFile_ImportAlias" | example }} + +### Comments +{{ "File.PackageComment" | doc }} + +{{ "File.HeaderComment" | doc }} + +{{ "File.CanonicalPath" | doc }} + +{{ "ExampleFile_HeaderAndPackageComments" | example }} + +{{ "File.CgoPreamble" | doc }} + +### PackagePrefix +{{ "File.PackagePrefix" | doc }} + +{{ "ExampleFile_PackagePrefix" | example }} diff --git a/vendor/github.com/dave/jennifer/genjen/data.go b/vendor/github.com/dave/jennifer/genjen/data.go new file mode 100644 index 00000000..ff8b39a7 --- /dev/null +++ b/vendor/github.com/dave/jennifer/genjen/data.go @@ -0,0 +1,307 @@ +package main + +var keywords = []string{"break", "default", "func", "select", "chan", "else", "const", "fallthrough", "type", "continue", "var", "goto", "defer", "go", "range"} + +var identifiers = []string{"bool", "byte", "complex64", "complex128", "error", "float32", "float64", "int", "int8", "int16", "int32", "int64", "rune", "string", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", "true", "false", "iota", "nil", "err"} + +var groups = []struct { + name string // name of the function / method + comment string // comment appended to name + variadic bool // is the parameter variadic? + opening string // opening token + closing string // closing token + separator string // separator token + multi bool // items are always on multiple lines + parameters []string // parameter names + preventFunc bool // prevent the fooFunc function/method +}{ + { + name: "Parens", + comment: "renders a single item in parenthesis. Use for type conversion or to specify evaluation order.", + variadic: false, + opening: "(", + closing: ")", + separator: "", + parameters: []string{"item"}, + }, + { + name: "List", + comment: "renders a comma separated list. Use for multiple return functions.", + variadic: true, + opening: "", + closing: "", + separator: ",", + parameters: []string{"items"}, + }, + { + name: "Values", + comment: "renders a comma separated list enclosed by curly braces. Use for slice or composite literals.", + variadic: true, + opening: "{", + closing: "}", + separator: ",", + parameters: []string{"values"}, + }, + { + name: "Index", + comment: "renders a colon separated list enclosed by square brackets. Use for array / slice indexes and definitions.", + variadic: true, + opening: "[", + closing: "]", + separator: ":", + parameters: []string{"items"}, + }, + { + name: "Block", + comment: "renders a statement list enclosed by curly braces. Use for code blocks. A special case applies when used directly after Case or Default, where the braces are omitted. This allows use in switch and select statements.", + variadic: true, + opening: "{", + closing: "}", + multi: true, + parameters: []string{"statements"}, + }, + { + name: "Defs", + comment: "renders a statement list enclosed in parenthesis. Use for definition lists.", + variadic: true, + opening: "(", + closing: ")", + multi: true, + parameters: []string{"definitions"}, + }, + { + name: "Call", + comment: "renders a comma separated list enclosed by parenthesis. Use for function calls.", + variadic: true, + opening: "(", + closing: ")", + separator: ",", + parameters: []string{"params"}, + }, + { + name: "Params", + comment: "renders a comma separated list enclosed by parenthesis. Use for function parameters and method receivers.", + variadic: true, + opening: "(", + closing: ")", + separator: ",", + parameters: []string{"params"}, + }, + { + name: "Assert", + comment: "renders a period followed by a single item enclosed by parenthesis. Use for type assertions.", + variadic: false, + opening: ".(", + closing: ")", + separator: "", + parameters: []string{"typ"}, + }, + { + name: "Map", + comment: "renders the keyword followed by a single item enclosed by square brackets. Use for map definitions.", + variadic: false, + opening: "map[", + closing: "]", + separator: "", + parameters: []string{"typ"}, + }, + { + name: "If", + comment: "renders the keyword followed by a semicolon separated list.", + variadic: true, + opening: "if ", + closing: "", + separator: ";", + parameters: []string{"conditions"}, + }, + { + name: "Return", + comment: "renders the keyword followed by a comma separated list.", + variadic: true, + opening: "return ", + closing: "", + separator: ",", + parameters: []string{"results"}, + }, + { + name: "For", + comment: "renders the keyword followed by a semicolon separated list.", + variadic: true, + opening: "for ", + closing: "", + separator: ";", + parameters: []string{"conditions"}, + }, + { + name: "Switch", + comment: "renders the keyword followed by a semicolon separated list.", + variadic: true, + opening: "switch ", + closing: "", + separator: ";", + parameters: []string{"conditions"}, + }, + { + name: "Interface", + comment: "renders the keyword followed by a method list enclosed by curly braces.", + variadic: true, + opening: "interface{", + closing: "}", + multi: true, + parameters: []string{"methods"}, + }, + { + name: "Struct", + comment: "renders the keyword followed by a field list enclosed by curly braces.", + variadic: true, + opening: "struct{", + closing: "}", + multi: true, + parameters: []string{"fields"}, + }, + { + name: "Case", + comment: "renders the keyword followed by a comma separated list.", + variadic: true, + opening: "case ", + closing: ":", + separator: ",", + parameters: []string{"cases"}, + }, + { + name: "Append", + comment: "renders the append built-in function.", + variadic: true, + opening: "append(", + closing: ")", + separator: ",", + parameters: []string{"args"}, + }, + { + name: "Cap", + comment: "renders the cap built-in function.", + variadic: false, + opening: "cap(", + closing: ")", + separator: ",", + parameters: []string{"v"}, + }, + { + name: "Close", + comment: "renders the close built-in function.", + variadic: false, + opening: "close(", + closing: ")", + separator: ",", + parameters: []string{"c"}, + }, + { + name: "Complex", + comment: "renders the complex built-in function.", + variadic: false, + opening: "complex(", + closing: ")", + separator: ",", + parameters: []string{"r", "i"}, + }, + { + name: "Copy", + comment: "renders the copy built-in function.", + variadic: false, + opening: "copy(", + closing: ")", + separator: ",", + parameters: []string{"dst", "src"}, + }, + { + name: "Delete", + comment: "renders the delete built-in function.", + variadic: false, + opening: "delete(", + closing: ")", + separator: ",", + parameters: []string{"m", "key"}, + }, + { + name: "Imag", + comment: "renders the imag built-in function.", + variadic: false, + opening: "imag(", + closing: ")", + separator: ",", + parameters: []string{"c"}, + }, + { + name: "Len", + comment: "renders the len built-in function.", + variadic: false, + opening: "len(", + closing: ")", + separator: ",", + parameters: []string{"v"}, + }, + { + name: "Make", + comment: "renders the make built-in function. The final parameter of the make function is optional, so it is represented by a variadic parameter list.", + variadic: true, + opening: "make(", + closing: ")", + separator: ",", + parameters: []string{"args"}, + preventFunc: true, // the underlying function is not variadic, so we prevent the MakeFunc variation + }, + { + name: "New", + comment: "renders the new built-in function.", + variadic: false, + opening: "new(", + closing: ")", + separator: ",", + parameters: []string{"typ"}, + }, + { + name: "Panic", + comment: "renders the panic built-in function.", + variadic: false, + opening: "panic(", + closing: ")", + separator: ",", + parameters: []string{"v"}, + }, + { + name: "Print", + comment: "renders the print built-in function.", + variadic: true, + opening: "print(", + closing: ")", + separator: ",", + parameters: []string{"args"}, + }, + { + name: "Println", + comment: "renders the println built-in function.", + variadic: true, + opening: "println(", + closing: ")", + separator: ",", + parameters: []string{"args"}, + }, + { + name: "Real", + comment: "renders the real built-in function.", + variadic: false, + opening: "real(", + closing: ")", + separator: ",", + parameters: []string{"c"}, + }, + { + name: "Recover", + comment: "renders the recover built-in function.", + variadic: false, + opening: "recover(", + closing: ")", + separator: ",", + parameters: []string{}, + }, +} diff --git a/vendor/github.com/dave/jennifer/genjen/main.go b/vendor/github.com/dave/jennifer/genjen/main.go new file mode 100644 index 00000000..ff73434c --- /dev/null +++ b/vendor/github.com/dave/jennifer/genjen/main.go @@ -0,0 +1,17 @@ +package main + +import ( + "bytes" + "io/ioutil" +) + +func main() { + // notest + buf := &bytes.Buffer{} + if err := render(buf); err != nil { + panic(err) + } + if err := ioutil.WriteFile("./jen/generated.go", buf.Bytes(), 0644); err != nil { + panic(err) + } +} diff --git a/vendor/github.com/dave/jennifer/genjen/render.go b/vendor/github.com/dave/jennifer/genjen/render.go new file mode 100644 index 00000000..3ab0e93a --- /dev/null +++ b/vendor/github.com/dave/jennifer/genjen/render.go @@ -0,0 +1,260 @@ +package main + +import ( + "io" + "strings" + + . "github.com/dave/jennifer/jen" +) + +func render(w io.Writer) error { + file := NewFile("jen") + + file.HeaderComment("This file is generated - do not edit.") + file.Line() + + for _, b := range groups { + b := b // b used in closures + comment := Commentf("%s %s", b.name, b.comment) + + if b.variadic && len(b.parameters) > 1 { + panic("should not have variadic function with multiple params") + } + + var variadic Code + if b.variadic { + variadic = Op("...") + } + var funcParams []Code + var callParams []Code + for _, name := range b.parameters { + funcParams = append(funcParams, Id(name).Add(variadic).Id("Code")) + callParams = append(callParams, Id(name).Add(variadic)) + } + + addFunctionAndGroupMethod( + file, + b.name, + comment, + funcParams, + callParams, + false, + ) + + /* + // + func (s *Statement) () *Statement { + g := &Group{ + items: []Code{}|, + name: "", + open: "", + close: "", + separator: "", + multi: , + } + *s = append(*s, g) + return s + } + */ + file.Add(comment) + file.Func().Params( + Id("s").Op("*").Id("Statement"), + ).Id(b.name).Params( + funcParams..., + ).Op("*").Id("Statement").Block( + Id("g").Op(":=").Op("&").Id("Group").Values(Dict{ + Id("items"): Do(func(s *Statement) { + if b.variadic { + s.Id(b.parameters[0]) + } else { + s.Index().Id("Code").ValuesFunc(func(g *Group) { + for _, name := range b.parameters { + g.Id(name) + } + }) + } + }), + Id("name"): Lit(strings.ToLower(b.name)), + Id("open"): Lit(b.opening), + Id("close"): Lit(b.closing), + Id("separator"): Lit(b.separator), + Id("multi"): Lit(b.multi), + }), + Op("*").Id("s").Op("=").Append(Op("*").Id("s"), Id("g")), + Return(Id("s")), + ) + + if b.variadic && !b.preventFunc { + + funcName := b.name + "Func" + funcComment := Commentf("%sFunc %s", b.name, b.comment) + funcFuncParams := []Code{Id("f").Func().Params(Op("*").Id("Group"))} + funcCallParams := []Code{Id("f")} + + addFunctionAndGroupMethod( + file, + funcName, + funcComment, + funcFuncParams, + funcCallParams, + false, + ) + + /* + // + func (s *Statement) (f func(*Group)) *Statement { + g := &Group{ + name: "", + open: "", + close: "", + separator: "", + multi: , + } + f(g) + *s = append(*s, g) + return s + } + */ + file.Add(funcComment) + file.Func().Params( + Id("s").Op("*").Id("Statement"), + ).Id(funcName).Params( + funcFuncParams..., + ).Op("*").Id("Statement").Block( + Id("g").Op(":=").Op("&").Id("Group").Values(Dict{ + Id("name"): Lit(strings.ToLower(b.name)), + Id("open"): Lit(b.opening), + Id("close"): Lit(b.closing), + Id("separator"): Lit(b.separator), + Id("multi"): Lit(b.multi), + }), + Id("f").Call(Id("g")), + Op("*").Id("s").Op("=").Append(Op("*").Id("s"), Id("g")), + Return(Id("s")), + ) + } + } + + type tkn struct { + token string + name string + tokenType string + tokenDesc string + } + tokens := []tkn{} + for _, v := range identifiers { + tokens = append(tokens, tkn{ + token: v, + name: strings.ToUpper(v[:1]) + v[1:], + tokenType: "identifierToken", + tokenDesc: "identifier", + }) + } + for _, v := range keywords { + tokens = append(tokens, tkn{ + token: v, + name: strings.ToUpper(v[:1]) + v[1:], + tokenType: "keywordToken", + tokenDesc: "keyword", + }) + } + + for i, t := range tokens { + t := t // used in closures + comment := Commentf( + "%s renders the %s %s.", + t.name, + t.token, + t.tokenDesc, + ) + addFunctionAndGroupMethod( + file, + t.name, + comment, + nil, + nil, + i != 0, // only enforce test coverage on one item + ) + + /* + // + func (s *Statement) () *Statement { + t := token{ + typ: , + content: "", + } + *s = append(*s, t) + return s + } + */ + file.Add(comment) + file.Func().Params( + Id("s").Op("*").Id("Statement"), + ).Id(t.name).Params().Op("*").Id("Statement").Block( + Do(func(s *Statement) { + if i != 0 { + // only enforce test coverage on one item + s.Comment("notest") + } + }), + Id("t").Op(":=").Id("token").Values(Dict{ + Id("typ"): Id(t.tokenType), + Id("content"): Lit(t.token), + }), + Op("*").Id("s").Op("=").Append(Op("*").Id("s"), Id("t")), + Return(Id("s")), + ) + } + + return file.Render(w) +} + +// For each method on *Statement, this generates a package level +// function and a method on *Group, both with the same name. +func addFunctionAndGroupMethod( + file *File, + name string, + comment *Statement, + funcParams []Code, + callParams []Code, + notest bool, +) { + /* + // + func () *Statement { + return newStatement().() + } + */ + file.Add(comment) + file.Func().Id(name).Params(funcParams...).Op("*").Id("Statement").Block( + Do(func(s *Statement) { + if notest { + // only enforce test coverage on one item + s.Comment("notest") + } + }), + Return(Id("newStatement").Call().Dot(name).Call(callParams...)), + ) + /* + // + func (g *Group) () *Statement { + s := () + g.items = append(g.items, s) + return s + } + */ + file.Add(comment) + file.Func().Params( + Id("g").Op("*").Id("Group"), + ).Id(name).Params(funcParams...).Op("*").Id("Statement").Block( + Do(func(s *Statement) { + if notest { + // only enforce test coverage on one item + s.Comment("notest") + } + }), + Id("s").Op(":=").Id(name).Params(callParams...), + Id("g").Dot("items").Op("=").Append(Id("g").Dot("items"), Id("s")), + Return(Id("s")), + ) +} diff --git a/vendor/github.com/dave/jennifer/genjen/render_test.go b/vendor/github.com/dave/jennifer/genjen/render_test.go new file mode 100644 index 00000000..2b549d91 --- /dev/null +++ b/vendor/github.com/dave/jennifer/genjen/render_test.go @@ -0,0 +1,35 @@ +package main + +import ( + "io/ioutil" + "regexp" + "testing" + + "bytes" +) + +func TestRender(t *testing.T) { + + buf := &bytes.Buffer{} + if err := render(buf); err != nil { + t.Fatal(err.Error()) + } + generatedString := buf.String() + + existingFilePath := "../jen/generated.go" + existingBytes, err := ioutil.ReadFile(existingFilePath) + if err != nil { + t.Fatal(err.Error()) + } + existingString := string(existingBytes) + + // The "goimports" tool will often re-order the imports, so this is a + // kludge to remove it before comparing. This is not ideal! + importsRegex := regexp.MustCompile(`(?ms:\nimport \(\n.*\n\)\n)`) + generatedString = importsRegex.ReplaceAllString(generatedString, "-") + existingString = importsRegex.ReplaceAllString(existingString, "-") + + if generatedString != existingString { + t.Fatalf("Generated code is not what is present:\n%s", generatedString) + } +} diff --git a/vendor/github.com/dave/jennifer/gennames/README.md b/vendor/github.com/dave/jennifer/gennames/README.md new file mode 100644 index 00000000..ef60cfe0 --- /dev/null +++ b/vendor/github.com/dave/jennifer/gennames/README.md @@ -0,0 +1,52 @@ +# gennames +For large projects, it may be useful to generate an index of package names for commonly used packages. +The index of names can be added to each generated file using `File.ImportNames`. The `gennames` command +is used internally to generate the list of standard library package names. + +### Usage + +``` +Usage of gennames: + -filter string + Regex to filter paths (operates on full path including vendor directory) (default ".*") + -name string + Name of the variable to define (default "PackageNames") + -novendor + Exclude packages in vendor directories + -output string + Output filename to write (default "./package-names.go") + -package string + Package name in generated file (default "main") + -path string + Path to pass to go list command (default "all") + -standard + Use standard library packages +``` + +### Path +Supply a `path` to pass to the `go list` command. You may use the wildcard `/...` to recursively return +packages, but it's worth remembering that vendored packages are not returned by this method unless the +path itself is a vendored path. Use `all` to return all packages in your `GOPATH` (including vendored +packages), however remember this may take some time for a large `GOPATH`. + +### Filter +Supply a regex `filter` to limit the packages that are returned by the `go list` command. The filter +operates on the full vendored package path (e.g. `github.com/foo/bar/vendor/github.com/baz/qux`), however +the package path added to the index is unvendored (e.g. `github.com/baz/qux`). + +### Examples + +``` +gennames -filter "foo|bar" +``` + +Create a file named `package-names.go` with `package main` listing the names of all packages with paths +containing `foo` or `bar`. + +``` +gennames -output "foo/names.go" -package "foo" -path "github.com/foo/bar/vendor/..." +``` + +Create a file named `foo/names.go` with `package foo` listing the names of all packages that are vendored +inside `github.com/foo/bar`. + diff --git a/vendor/github.com/dave/jennifer/gennames/hints.go b/vendor/github.com/dave/jennifer/gennames/hints.go new file mode 100644 index 00000000..51288f1e --- /dev/null +++ b/vendor/github.com/dave/jennifer/gennames/hints.go @@ -0,0 +1,141 @@ +package main + +import ( + "fmt" + "go/build" + "io" + "os/exec" + "strings" + + "regexp" + + "path/filepath" + + . "github.com/dave/jennifer/jen" +) + +func hints(w io.Writer, pkg, name, goListPath, filter string, standard, novendor bool) error { + + // notest + + file := NewFile(pkg) + + file.HeaderComment("This file is generated - do not edit.") + file.Line() + + packages, err := getPackages(goListPath, filter, standard, novendor) + if err != nil { + return err + } + /* + // contains package name hints + var = map[string]string{ + ... + } + */ + file.Commentf("%s contains package name hints", name) + file.Var().Id(name).Op("=").Map(String()).String().Values(DictFunc(func(d Dict) { + for path, name := range packages { + d[Lit(path)] = Lit(name) + } + })) + + return file.Render(w) +} + +func getPackages(goListPath, filter string, standard, novendor bool) (map[string]string, error) { + + // notest + + r, err := regexp.Compile(filter) + if err != nil { + return nil, err + } + + cmd := exec.Command("go", "list", "-e", "-f", "{{ .Standard }} {{ .ImportPath }} {{ .Name }}", goListPath) + cmd.Env = []string{ + fmt.Sprintf("GOPATH=%s", build.Default.GOPATH), + fmt.Sprintf("GOROOT=%s", build.Default.GOROOT), + } + if standard { + cmd.Dir = filepath.Join(build.Default.GOROOT, "src") + } else { + cmd.Dir = filepath.Join(build.Default.GOPATH, "src") + } + b, err := cmd.Output() + if err != nil { + if x, ok := err.(*exec.ExitError); ok { + return nil, fmt.Errorf("go list command returned an error - %s: %s", err.Error(), string(x.Stderr)) + } + return nil, fmt.Errorf("go list command returned an error: %s", err.Error()) + } + all := strings.Split(strings.TrimSpace(string(b)), "\n") + + packages := map[string]string{} + for _, j := range all { + + parts := strings.Split(j, " ") + + isStandard := parts[0] == "true" + if isStandard != standard { + continue + } + + path := parts[1] + name := parts[2] + + if novendor && hasVendor(path) { + continue + } + + if name == "main" { + continue + } + + if !r.MatchString(path) { + continue + } + + path = unvendorPath(path) + + if packages[path] != "" { + continue + } + + packages[path] = name + } + return packages, nil +} + +func unvendorPath(path string) string { + // notest + i, ok := findVendor(path) + if !ok { + return path + } + return path[i+len("vendor/"):] +} + +// FindVendor looks for the last non-terminating "vendor" path element in the given import path. +// If there isn't one, FindVendor returns ok=false. +// Otherwise, FindVendor returns ok=true and the index of the "vendor". +// Copied from cmd/go/internal/load +func findVendor(path string) (index int, ok bool) { + // notest + // Two cases, depending on internal at start of string or not. + // The order matters: we must return the index of the final element, + // because the final one is where the effective import path starts. + switch { + case strings.Contains(path, "/vendor/"): + return strings.LastIndex(path, "/vendor/") + 1, true + case strings.HasPrefix(path, "vendor/"): + return 0, true + } + return 0, false +} + +func hasVendor(path string) bool { + // notest + _, v := findVendor(path) + return v +} diff --git a/vendor/github.com/dave/jennifer/gennames/main.go b/vendor/github.com/dave/jennifer/gennames/main.go new file mode 100644 index 00000000..1ff8e51a --- /dev/null +++ b/vendor/github.com/dave/jennifer/gennames/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "bytes" + "flag" + "io/ioutil" + "log" +) + +func main() { + // notest + + var out = flag.String("output", "./package-names.go", "Output filename to write") + var pkg = flag.String("package", "main", "Package name in generated file") + var name = flag.String("name", "PackageNames", "Name of the variable to define") + var filter = flag.String("filter", ".*", "Regex to filter paths (operates on full path including vendor directory)") + var standard = flag.Bool("standard", false, "Use standard library packages") + var novendor = flag.Bool("novendor", false, "Exclude packages in vendor directories") + var goListPath = flag.String("path", "all", "Path to pass to go list command") + flag.Parse() + + buf := &bytes.Buffer{} + if err := hints(buf, *pkg, *name, *goListPath, *filter, *standard, *novendor); err != nil { + log.Fatal(err.Error()) + } + if err := ioutil.WriteFile(*out, buf.Bytes(), 0644); err != nil { + log.Fatal(err.Error()) + } +} diff --git a/vendor/github.com/dave/jennifer/jen/add.go b/vendor/github.com/dave/jennifer/jen/add.go new file mode 100644 index 00000000..2efb3f6d --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/add.go @@ -0,0 +1,19 @@ +package jen + +// Add appends the provided items to the statement. +func Add(code ...Code) *Statement { + return newStatement().Add(code...) +} + +// Add appends the provided items to the statement. +func (g *Group) Add(code ...Code) *Statement { + s := Add(code...) + g.items = append(g.items, s) + return s +} + +// Add appends the provided items to the statement. +func (s *Statement) Add(code ...Code) *Statement { + *s = append(*s, code...) + return s +} diff --git a/vendor/github.com/dave/jennifer/jen/comments.go b/vendor/github.com/dave/jennifer/jen/comments.go new file mode 100644 index 00000000..886e885b --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/comments.go @@ -0,0 +1,108 @@ +package jen + +import ( + "fmt" + "io" + "strings" +) + +// Comment adds a comment. If the provided string contains a newline, the +// comment is formatted in multiline style. If the comment string starts +// with "//" or "/*", the automatic formatting is disabled and the string is +// rendered directly. +func Comment(str string) *Statement { + return newStatement().Comment(str) +} + +// Comment adds a comment. If the provided string contains a newline, the +// comment is formatted in multiline style. If the comment string starts +// with "//" or "/*", the automatic formatting is disabled and the string is +// rendered directly. +func (g *Group) Comment(str string) *Statement { + s := Comment(str) + g.items = append(g.items, s) + return s +} + +// Comment adds a comment. If the provided string contains a newline, the +// comment is formatted in multiline style. If the comment string starts +// with "//" or "/*", the automatic formatting is disabled and the string is +// rendered directly. +func (s *Statement) Comment(str string) *Statement { + c := comment{ + comment: str, + } + *s = append(*s, c) + return s +} + +// Commentf adds a comment, using a format string and a list of parameters. If +// the provided string contains a newline, the comment is formatted in +// multiline style. If the comment string starts with "//" or "/*", the +// automatic formatting is disabled and the string is rendered directly. +func Commentf(format string, a ...interface{}) *Statement { + return newStatement().Commentf(format, a...) +} + +// Commentf adds a comment, using a format string and a list of parameters. If +// the provided string contains a newline, the comment is formatted in +// multiline style. If the comment string starts with "//" or "/*", the +// automatic formatting is disabled and the string is rendered directly. +func (g *Group) Commentf(format string, a ...interface{}) *Statement { + s := Commentf(format, a...) + g.items = append(g.items, s) + return s +} + +// Commentf adds a comment, using a format string and a list of parameters. If +// the provided string contains a newline, the comment is formatted in +// multiline style. If the comment string starts with "//" or "/*", the +// automatic formatting is disabled and the string is rendered directly. +func (s *Statement) Commentf(format string, a ...interface{}) *Statement { + c := comment{ + comment: fmt.Sprintf(format, a...), + } + *s = append(*s, c) + return s +} + +type comment struct { + comment string +} + +func (c comment) isNull(f *File) bool { + return false +} + +func (c comment) render(f *File, w io.Writer, s *Statement) error { + if strings.HasPrefix(c.comment, "//") || strings.HasPrefix(c.comment, "/*") { + // automatic formatting disabled. + if _, err := w.Write([]byte(c.comment)); err != nil { + return err + } + return nil + } + if strings.Contains(c.comment, "\n") { + if _, err := w.Write([]byte("/*\n")); err != nil { + return err + } + } else { + if _, err := w.Write([]byte("// ")); err != nil { + return err + } + } + if _, err := w.Write([]byte(c.comment)); err != nil { + return err + } + if strings.Contains(c.comment, "\n") { + if !strings.HasSuffix(c.comment, "\n") { + if _, err := w.Write([]byte("\n")); err != nil { + return err + } + } + if _, err := w.Write([]byte("*/")); err != nil { + return err + } + } + return nil +} diff --git a/vendor/github.com/dave/jennifer/jen/custom.go b/vendor/github.com/dave/jennifer/jen/custom.go new file mode 100644 index 00000000..4966a070 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/custom.go @@ -0,0 +1,61 @@ +package jen + +// Options specifies options for the Custom method +type Options struct { + Open string + Close string + Separator string + Multi bool +} + +// Custom renders a customized statement list. Pass in options to specify multi-line, and tokens for open, close, separator. +func Custom(options Options, statements ...Code) *Statement { + return newStatement().Custom(options, statements...) +} + +// Custom renders a customized statement list. Pass in options to specify multi-line, and tokens for open, close, separator. +func (g *Group) Custom(options Options, statements ...Code) *Statement { + s := Custom(options, statements...) + g.items = append(g.items, s) + return s +} + +// Custom renders a customized statement list. Pass in options to specify multi-line, and tokens for open, close, separator. +func (s *Statement) Custom(options Options, statements ...Code) *Statement { + g := &Group{ + close: options.Close, + items: statements, + multi: options.Multi, + name: "custom", + open: options.Open, + separator: options.Separator, + } + *s = append(*s, g) + return s +} + +// CustomFunc renders a customized statement list. Pass in options to specify multi-line, and tokens for open, close, separator. +func CustomFunc(options Options, f func(*Group)) *Statement { + return newStatement().CustomFunc(options, f) +} + +// CustomFunc renders a customized statement list. Pass in options to specify multi-line, and tokens for open, close, separator. +func (g *Group) CustomFunc(options Options, f func(*Group)) *Statement { + s := CustomFunc(options, f) + g.items = append(g.items, s) + return s +} + +// CustomFunc renders a customized statement list. Pass in options to specify multi-line, and tokens for open, close, separator. +func (s *Statement) CustomFunc(options Options, f func(*Group)) *Statement { + g := &Group{ + close: options.Close, + multi: options.Multi, + name: "custom", + open: options.Open, + separator: options.Separator, + } + f(g) + *s = append(*s, g) + return s +} diff --git a/vendor/github.com/dave/jennifer/jen/dict.go b/vendor/github.com/dave/jennifer/jen/dict.go new file mode 100644 index 00000000..260cf928 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/dict.go @@ -0,0 +1,81 @@ +package jen + +import ( + "bytes" + "io" + "sort" +) + +// Dict renders as key/value pairs. Use with Values for map or composite +// literals. +type Dict map[Code]Code + +// DictFunc executes a func(Dict) to generate the value. Use with Values for +// map or composite literals. +func DictFunc(f func(Dict)) Dict { + d := Dict{} + f(d) + return d +} + +func (d Dict) render(f *File, w io.Writer, s *Statement) error { + first := true + // must order keys to ensure repeatable source + type kv struct { + k Code + v Code + } + lookup := map[string]kv{} + keys := []string{} + for k, v := range d { + if k.isNull(f) || v.isNull(f) { + continue + } + buf := &bytes.Buffer{} + if err := k.render(f, buf, nil); err != nil { + return err + } + keys = append(keys, buf.String()) + lookup[buf.String()] = kv{k: k, v: v} + } + sort.Strings(keys) + for _, key := range keys { + k := lookup[key].k + v := lookup[key].v + if first && len(keys) > 1 { + if _, err := w.Write([]byte("\n")); err != nil { + return err + } + first = false + } + if err := k.render(f, w, nil); err != nil { + return err + } + if _, err := w.Write([]byte(":")); err != nil { + return err + } + if err := v.render(f, w, nil); err != nil { + return err + } + if len(keys) > 1 { + if _, err := w.Write([]byte(",\n")); err != nil { + return err + } + } + } + return nil +} + +func (d Dict) isNull(f *File) bool { + if d == nil || len(d) == 0 { + return true + } + for k, v := range d { + if !k.isNull(f) && !v.isNull(f) { + // if any of the key/value pairs are both not null, the Dict is not + // null + return false + } + } + return true +} diff --git a/vendor/github.com/dave/jennifer/jen/do.go b/vendor/github.com/dave/jennifer/jen/do.go new file mode 100644 index 00000000..c1bceab5 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/do.go @@ -0,0 +1,22 @@ +package jen + +// Do calls the provided function with the statement as a parameter. Use for +// embedding logic. +func Do(f func(*Statement)) *Statement { + return newStatement().Do(f) +} + +// Do calls the provided function with the statement as a parameter. Use for +// embedding logic. +func (g *Group) Do(f func(*Statement)) *Statement { + s := Do(f) + g.items = append(g.items, s) + return s +} + +// Do calls the provided function with the statement as a parameter. Use for +// embedding logic. +func (s *Statement) Do(f func(*Statement)) *Statement { + f(s) + return s +} diff --git a/vendor/github.com/dave/jennifer/jen/examples_test.go b/vendor/github.com/dave/jennifer/jen/examples_test.go new file mode 100644 index 00000000..d6316b5f --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/examples_test.go @@ -0,0 +1,1610 @@ +package jen_test + +import ( + "fmt" + + "bytes" + + . "github.com/dave/jennifer/jen" +) + +func ExampleCaseBug() { + c := Switch(Id("a")).Block( + Case(Lit(1)).Block( + Var().Id("i").Int(), + Var().Id("j").Int(), + ), + ) + fmt.Printf("%#v", c) + // Output: + // switch a { + // case 1: + // var i int + // var j int + // } +} + +func ExampleCustom() { + multiLineCall := Options{ + Close: ")", + Multi: true, + Open: "(", + Separator: ",", + } + c := Id("foo").Custom(multiLineCall, Lit("a"), Lit("b"), Lit("c")) + fmt.Printf("%#v", c) + // Output: + // foo( + // "a", + // "b", + // "c", + // ) +} + +func ExampleCustomFunc() { + multiLineCall := Options{ + Close: ")", + Multi: true, + Open: "(", + Separator: ",", + } + c := Id("foo").CustomFunc(multiLineCall, func(g *Group) { + g.Lit("a") + g.Lit("b") + g.Lit("c") + }) + fmt.Printf("%#v", c) + // Output: + // foo( + // "a", + // "b", + // "c", + // ) +} + +func ExampleFile_ImportName_conflict() { + f := NewFile("main") + + // We provide a hint that package foo/a should use name "a", but because package bar/a already + // registers the required name, foo/a is aliased. + f.ImportName("github.com/foo/a", "a") + + f.Func().Id("main").Params().Block( + Qual("github.com/bar/a", "Bar").Call(), + Qual("github.com/foo/a", "Foo").Call(), + ) + fmt.Printf("%#v", f) + + // Output: + // package main + // + // import ( + // a "github.com/bar/a" + // a1 "github.com/foo/a" + // ) + // + // func main() { + // a.Bar() + // a1.Foo() + // } +} + +func ExampleFile_ImportAlias_conflict() { + f := NewFile("main") + + // We provide a hint that package foo/a should use alias "b", but because package bar/b already + // registers the required name, foo/a is aliased using the requested alias as a base. + f.ImportName("github.com/foo/a", "b") + + f.Func().Id("main").Params().Block( + Qual("github.com/bar/b", "Bar").Call(), + Qual("github.com/foo/a", "Foo").Call(), + ) + fmt.Printf("%#v", f) + + // Output: + // package main + // + // import ( + // b "github.com/bar/b" + // b1 "github.com/foo/a" + // ) + // + // func main() { + // b.Bar() + // b1.Foo() + // } +} + +func ExampleFile_ImportName() { + f := NewFile("main") + + // package a should use name "a" + f.ImportName("github.com/foo/a", "a") + + // package b is not used in the code so will not be included + f.ImportName("github.com/foo/b", "b") + + f.Func().Id("main").Params().Block( + Qual("github.com/foo/a", "A").Call(), + ) + fmt.Printf("%#v", f) + + // Output: + // package main + // + // import "github.com/foo/a" + // + // func main() { + // a.A() + // } +} + +func ExampleFile_ImportNames() { + + // package a should use name "a", package b is not used in the code so will not be included + names := map[string]string{ + "github.com/foo/a": "a", + "github.com/foo/b": "b", + } + + f := NewFile("main") + f.ImportNames(names) + f.Func().Id("main").Params().Block( + Qual("github.com/foo/a", "A").Call(), + ) + fmt.Printf("%#v", f) + + // Output: + // package main + // + // import "github.com/foo/a" + // + // func main() { + // a.A() + // } +} + +func ExampleFile_ImportAlias() { + f := NewFile("main") + + // package a should be aliased to "b" + f.ImportAlias("github.com/foo/a", "b") + + // package c is not used in the code so will not be included + f.ImportAlias("github.com/foo/c", "c") + + f.Func().Id("main").Params().Block( + Qual("github.com/foo/a", "A").Call(), + ) + fmt.Printf("%#v", f) + + // Output: + // package main + // + // import b "github.com/foo/a" + // + // func main() { + // b.A() + // } +} + +func ExampleFile_ImportAliasDot() { + f := NewFile("main") + + // package a should be a dot-import + f.ImportAlias("github.com/foo/a", ".") + + // package b should be a dot-import + f.ImportAlias("github.com/foo/b", ".") + + // package c is not used in the code so will not be included + f.ImportAlias("github.com/foo/c", ".") + + f.Func().Id("main").Params().Block( + Qual("github.com/foo/a", "A").Call(), + Qual("github.com/foo/b", "B").Call(), + ) + fmt.Printf("%#v", f) + + // Output: + // package main + // + // import ( + // . "github.com/foo/a" + // . "github.com/foo/b" + // ) + // + // func main() { + // A() + // B() + // } +} + +func ExampleFile_CgoPreamble() { + f := NewFile("a") + f.CgoPreamble(`#include +#include + +void myprint(char* s) { + printf("%s\n", s); +} +`) + f.Func().Id("init").Params().Block( + Id("cs").Op(":=").Qual("C", "CString").Call(Lit("Hello from stdio\n")), + Qual("C", "myprint").Call(Id("cs")), + Qual("C", "free").Call(Qual("unsafe", "Pointer").Parens(Id("cs"))), + ) + fmt.Printf("%#v", f) + // Output: + // package a + // + // import "unsafe" + // + // /* + // #include + // #include + // + // void myprint(char* s) { + // printf("%s\n", s); + // } + // */ + // import "C" + // + // func init() { + // cs := C.CString("Hello from stdio\n") + // C.myprint(cs) + // C.free(unsafe.Pointer(cs)) + // } +} + +func ExampleFile_CgoPreamble_anon() { + f := NewFile("a") + f.CgoPreamble(`#include `) + f.Func().Id("init").Params().Block( + Qual("foo.bar/a", "A"), + Qual("foo.bar/b", "B"), + ) + fmt.Printf("%#v", f) + // Output: + // package a + // + // import ( + // a "foo.bar/a" + // b "foo.bar/b" + // ) + // + // // #include + // import "C" + // + // func init() { + // a.A + // b.B + // } +} + +func ExampleFile_CgoPreamble_no_preamble() { + f := NewFile("a") + f.Func().Id("init").Params().Block( + Qual("C", "Foo").Call(), + Qual("fmt", "Print").Call(), + ) + fmt.Printf("%#v", f) + // Output: + // package a + // + // import ( + // "C" + // "fmt" + // ) + // + // func init() { + // C.Foo() + // fmt.Print() + // } +} + +func ExampleFile_CgoPreamble_no_preamble_single() { + f := NewFile("a") + f.Func().Id("init").Params().Block( + Qual("C", "Foo").Call(), + ) + fmt.Printf("%#v", f) + // Output: + // package a + // + // import "C" + // + // func init() { + // C.Foo() + // } +} + +func ExampleFile_CgoPreamble_no_preamble_single_anon() { + f := NewFile("a") + f.Anon("C") + f.Func().Id("init").Params().Block() + fmt.Printf("%#v", f) + // Output: + // package a + // + // import "C" + // + // func init() {} +} + +func ExampleFile_CgoPreamble_no_preamble_anon() { + f := NewFile("a") + f.Anon("C") + f.Func().Id("init").Params().Block( + Qual("fmt", "Print").Call(), + ) + fmt.Printf("%#v", f) + // Output: + // package a + // + // import ( + // "C" + // "fmt" + // ) + // + // func init() { + // fmt.Print() + // } +} + +func ExampleOp_complex_conditions() { + c := If(Parens(Id("a").Op("||").Id("b")).Op("&&").Id("c")).Block() + fmt.Printf("%#v", c) + // Output: + // if (a || b) && c { + // } +} + +func ExampleLit_bool_true() { + c := Lit(true) + fmt.Printf("%#v", c) + // Output: + // true +} + +func ExampleLit_bool_false() { + c := Lit(false) + fmt.Printf("%#v", c) + // Output: + // false +} + +func ExampleLit_byte() { + // Lit can't tell the difference between byte and uint8. Use LitByte to + // render byte literals. + c := Lit(byte(0x1)) + fmt.Printf("%#v", c) + // Output: + // uint8(0x1) +} + +func ExampleLit_complex64() { + c := Lit(complex64(0 + 0i)) + fmt.Printf("%#v", c) + // Output: + // complex64(0 + 0i) +} + +func ExampleLit_complex128() { + c := Lit(0 + 0i) + fmt.Printf("%#v", c) + // Output: + // (0 + 0i) +} + +func ExampleLit_float32() { + c := Lit(float32(1)) + fmt.Printf("%#v", c) + // Output: + // float32(1) +} + +func ExampleLit_float64_one_point_zero() { + c := Lit(1.0) + fmt.Printf("%#v", c) + // Output: + // 1.0 +} + +func ExampleLit_float64_zero() { + c := Lit(0.0) + fmt.Printf("%#v", c) + // Output: + // 0.0 +} + +func ExampleLit_float64_negative() { + c := Lit(-0.1) + fmt.Printf("%#v", c) + // Output: + // -0.1 +} + +func ExampleLit_float64_negative_whole() { + c := Lit(-1.0) + fmt.Printf("%#v", c) + // Output: + // -1.0 +} + +func ExampleLit_int() { + c := Lit(1) + fmt.Printf("%#v", c) + // Output: + // 1 +} + +func ExampleLit_int8() { + c := Lit(int8(1)) + fmt.Printf("%#v", c) + // Output: + // int8(1) +} + +func ExampleLit_int16() { + c := Lit(int16(1)) + fmt.Printf("%#v", c) + // Output: + // int16(1) +} + +func ExampleLit_int32() { + c := Lit(int32(1)) + fmt.Printf("%#v", c) + // Output: + // int32(1) +} + +func ExampleLit_int64() { + c := Lit(int64(1)) + fmt.Printf("%#v", c) + // Output: + // int64(1) +} + +func ExampleLit_uint() { + c := Lit(uint(0x1)) + fmt.Printf("%#v", c) + // Output: + // uint(0x1) +} + +func ExampleLit_uint8() { + c := Lit(uint8(0x1)) + fmt.Printf("%#v", c) + // Output: + // uint8(0x1) +} + +func ExampleLit_uint16() { + c := Lit(uint16(0x1)) + fmt.Printf("%#v", c) + // Output: + // uint16(0x1) +} + +func ExampleLit_uint32() { + c := Lit(uint32(0x1)) + fmt.Printf("%#v", c) + // Output: + // uint32(0x1) +} + +func ExampleLit_uint64() { + c := Lit(uint64(0x1)) + fmt.Printf("%#v", c) + // Output: + // uint64(0x1) +} + +func ExampleLit_uintptr() { + c := Lit(uintptr(0x1)) + fmt.Printf("%#v", c) + // Output: + // uintptr(0x1) +} + +func ExampleLit_rune() { + // Lit can't tell the difference between rune and int32. Use LitRune to + // render rune literals. + c := Lit('x') + fmt.Printf("%#v", c) + // Output: + // int32(120) +} + +func ExampleLitRune() { + c := LitRune('x') + fmt.Printf("%#v", c) + // Output: + // 'x' +} + +func ExampleLitRuneFunc() { + c := LitRuneFunc(func() rune { + return '\t' + }) + fmt.Printf("%#v", c) + // Output: + // '\t' +} + +func ExampleLitByte() { + c := LitByte(byte(1)) + fmt.Printf("%#v", c) + // Output: + // byte(0x1) +} + +func ExampleLitByteFunc() { + c := LitByteFunc(func() byte { + return byte(2) + }) + fmt.Printf("%#v", c) + // Output: + // byte(0x2) +} + +func ExampleLit_string() { + c := Lit("foo") + fmt.Printf("%#v", c) + // Output: + // "foo" +} + +func ExampleValues_dict_single() { + c := Map(String()).String().Values(Dict{ + Lit("a"): Lit("b"), + }) + fmt.Printf("%#v", c) + // Output: + // map[string]string{"a": "b"} +} + +func ExampleValues_dict_multiple() { + c := Map(String()).String().Values(Dict{ + Lit("a"): Lit("b"), + Lit("c"): Lit("d"), + }) + fmt.Printf("%#v", c) + // Output: + // map[string]string{ + // "a": "b", + // "c": "d", + // } +} + +func ExampleValues_dict_composite() { + c := Op("&").Id("Person").Values(Dict{ + Id("Age"): Lit(1), + Id("Name"): Lit("a"), + }) + fmt.Printf("%#v", c) + // Output: + // &Person{ + // Age: 1, + // Name: "a", + // } +} + +func ExampleAdd() { + ptr := Op("*") + c := Id("a").Op("=").Add(ptr).Id("b") + fmt.Printf("%#v", c) + // Output: + // a = *b +} + +func ExampleAdd_var() { + a := Id("a") + i := Int() + c := Var().Add(a, i) + fmt.Printf("%#v", c) + // Output: + // var a int +} + +func ExampleAppend() { + c := Append(Id("a"), Id("b")) + fmt.Printf("%#v", c) + // Output: + // append(a, b) +} + +func ExampleAppend_more() { + c := Id("a").Op("=").Append(Id("a"), Id("b").Op("...")) + fmt.Printf("%#v", c) + // Output: + // a = append(a, b...) +} + +func ExampleAssert() { + c := List(Id("b"), Id("ok")).Op(":=").Id("a").Assert(Bool()) + fmt.Printf("%#v", c) + // Output: + // b, ok := a.(bool) +} + +func ExampleBlock() { + c := Func().Id("foo").Params().String().Block( + Id("a").Op("=").Id("b"), + Id("b").Op("++"), + Return(Id("b")), + ) + fmt.Printf("%#v", c) + // Output: + // func foo() string { + // a = b + // b++ + // return b + // } +} + +func ExampleBlock_if() { + c := If(Id("a").Op(">").Lit(10)).Block( + Id("a").Op("=").Id("a").Op("/").Lit(2), + ) + fmt.Printf("%#v", c) + // Output: + // if a > 10 { + // a = a / 2 + // } +} + +func ExampleValuesFunc() { + c := Id("numbers").Op(":=").Index().Int().ValuesFunc(func(g *Group) { + for i := 0; i <= 5; i++ { + g.Lit(i) + } + }) + fmt.Printf("%#v", c) + // Output: + // numbers := []int{0, 1, 2, 3, 4, 5} +} + +func ExampleBlockFunc() { + increment := true + name := "a" + c := Func().Id("a").Params().BlockFunc(func(g *Group) { + g.Id(name).Op("=").Lit(1) + if increment { + g.Id(name).Op("++") + } else { + g.Id(name).Op("--") + } + }) + fmt.Printf("%#v", c) + // Output: + // func a() { + // a = 1 + // a++ + // } +} + +func ExampleBool() { + c := Var().Id("b").Bool() + fmt.Printf("%#v", c) + // Output: + // var b bool +} + +func ExampleBreak() { + c := For( + Id("i").Op(":=").Lit(0), + Id("i").Op("<").Lit(10), + Id("i").Op("++"), + ).Block( + If(Id("i").Op(">").Lit(5)).Block( + Break(), + ), + ) + fmt.Printf("%#v", c) + // Output: + // for i := 0; i < 10; i++ { + // if i > 5 { + // break + // } + // } +} + +func ExampleByte() { + c := Id("b").Op(":=").Id("a").Assert(Byte()) + fmt.Printf("%#v", c) + // Output: + // b := a.(byte) +} + +func ExampleCall() { + c := Qual("fmt", "Printf").Call( + Lit("%#v: %T\n"), + Id("a"), + Id("b"), + ) + fmt.Printf("%#v", c) + // Output: + // fmt.Printf("%#v: %T\n", a, b) +} + +func ExampleCall_fmt() { + c := Id("a").Call(Lit("b")) + fmt.Printf("%#v", c) + // Output: + // a("b") +} + +func ExampleCallFunc() { + f := func(name string, second string) { + c := Id("foo").CallFunc(func(g *Group) { + g.Id(name) + if second != "" { + g.Lit(second) + } + }) + fmt.Printf("%#v\n", c) + } + f("a", "b") + f("c", "") + // Output: + // foo(a, "b") + // foo(c) +} + +func ExampleCap() { + c := Id("i").Op(":=").Cap(Id("v")) + fmt.Printf("%#v", c) + // Output: + // i := cap(v) +} + +func ExampleCase() { + c := Switch(Id("person")).Block( + Case(Id("John"), Id("Peter")).Block( + Return(Lit("male")), + ), + Case(Id("Gill")).Block( + Return(Lit("female")), + ), + ) + fmt.Printf("%#v", c) + // Output: + // switch person { + // case John, Peter: + // return "male" + // case Gill: + // return "female" + // } +} + +func ExampleBlock_case() { + c := Select().Block( + Case(Op("<-").Id("done")).Block( + Return(Nil()), + ), + Case(List(Err(), Id("open")).Op(":=").Op("<-").Id("fail")).Block( + If(Op("!").Id("open")).Block( + Return(Err()), + ), + ), + ) + fmt.Printf("%#v", c) + // Output: + // select { + // case <-done: + // return nil + // case err, open := <-fail: + // if !open { + // return err + // } + // } +} + +func ExampleBlockFunc_case() { + preventExitOnError := true + c := Select().Block( + Case(Op("<-").Id("done")).Block( + Return(Nil()), + ), + Case(Err().Op(":=").Op("<-").Id("fail")).BlockFunc(func(g *Group) { + if !preventExitOnError { + g.Return(Err()) + } else { + g.Qual("fmt", "Println").Call(Err()) + } + }), + ) + fmt.Printf("%#v", c) + // Output: + // select { + // case <-done: + // return nil + // case err := <-fail: + // fmt.Println(err) + // } +} + +func ExampleCaseFunc() { + samIsMale := false + c := Switch(Id("person")).Block( + CaseFunc(func(g *Group) { + g.Id("John") + g.Id("Peter") + if samIsMale { + g.Id("Sam") + } + }).Block( + Return(Lit("male")), + ), + CaseFunc(func(g *Group) { + g.Id("Gill") + if !samIsMale { + g.Id("Sam") + } + }).Block( + Return(Lit("female")), + ), + ) + fmt.Printf("%#v", c) + // Output: + // switch person { + // case John, Peter: + // return "male" + // case Gill, Sam: + // return "female" + // } +} + +func ExampleChan() { + c := Func().Id("init").Params().Block( + Id("c").Op(":=").Make(Chan().Qual("os", "Signal"), Lit(1)), + Qual("os/signal", "Notify").Call(Id("c"), Qual("os", "Interrupt")), + Qual("os/signal", "Notify").Call(Id("c"), Qual("syscall", "SIGTERM")), + Go().Func().Params().Block( + Op("<-").Id("c"), + Id("cancel").Call(), + ).Call(), + ) + fmt.Printf("%#v", c) + // Output: + // func init() { + // c := make(chan os.Signal, 1) + // signal.Notify(c, os.Interrupt) + // signal.Notify(c, syscall.SIGTERM) + // go func() { + // <-c + // cancel() + // }() + // } +} + +func ExampleClose() { + c := Block( + Id("ch").Op(":=").Make(Chan().Struct()), + Go().Func().Params().Block( + Op("<-").Id("ch"), + Qual("fmt", "Println").Call(Lit("done.")), + ).Call(), + Close(Id("ch")), + ) + fmt.Printf("%#v", c) + // Output: + // { + // ch := make(chan struct{}) + // go func() { + // <-ch + // fmt.Println("done.") + // }() + // close(ch) + // } +} + +func ExampleComment() { + f := NewFile("a") + f.Comment("Foo returns the string \"foo\"") + f.Func().Id("Foo").Params().String().Block( + Return(Lit("foo")).Comment("return the string foo"), + ) + fmt.Printf("%#v", f) + // Output: + // package a + // + // // Foo returns the string "foo" + // func Foo() string { + // return "foo" // return the string foo + // } +} + +func ExampleComment_multiline() { + c := Comment("a\nb") + fmt.Printf("%#v", c) + // Output: + // /* + // a + // b + // */ +} + +func ExampleComment_formatting_disabled() { + c := Id("foo").Call(Comment("/* inline */")).Comment("//no-space") + fmt.Printf("%#v", c) + // Output: + // foo( /* inline */ ) //no-space +} + +func ExampleCommentf() { + name := "foo" + val := "bar" + c := Id(name).Op(":=").Lit(val).Commentf("%s is the string \"%s\"", name, val) + fmt.Printf("%#v", c) + // Output: + // foo := "bar" // foo is the string "bar" +} + +func ExampleComplex() { + c := Func().Id("main").Params().Block( + Id("c1").Op(":=").Lit(1+3.75i), + Id("c2").Op(":=").Complex(Lit(1), Lit(3.75)), + Qual("fmt", "Println").Call(Id("c1").Op("==").Id("c2")), + ) + fmt.Printf("%#v", c) + // Output: + // func main() { + // c1 := (1 + 3.75i) + // c2 := complex(1, 3.75) + // fmt.Println(c1 == c2) + // } +} + +func ExampleComplex128() { + c := Func().Id("main").Params().Block( + Var().Id("c").Complex128(), + Id("c").Op("=").Lit(1+2i), + Qual("fmt", "Println").Call(Id("c")), + ) + fmt.Printf("%#v", c) + // Output: + // func main() { + // var c complex128 + // c = (1 + 2i) + // fmt.Println(c) + // } +} + +func ExampleComplex64() { + c := Func().Id("main").Params().Block( + Var().Id("c64").Complex64(), + Id("c64").Op("=").Complex(Lit(5), Float32().Parens(Lit(2))), + Qual("fmt", "Printf").Call(Lit("%T\n"), Id("c64")), + ) + fmt.Printf("%#v", c) + // Output: + // func main() { + // var c64 complex64 + // c64 = complex(5, float32(2)) + // fmt.Printf("%T\n", c64) + // } +} + +func ExampleParams() { + c := Func().Params( + Id("a").Id("A"), + ).Id("foo").Params( + Id("b"), + Id("c").String(), + ).String().Block( + Return(Id("b").Op("+").Id("c")), + ) + fmt.Printf("%#v", c) + // Output: + // func (a A) foo(b, c string) string { + // return b + c + // } +} + +func ExampleIndex() { + c := Var().Id("a").Index().String() + fmt.Printf("%#v", c) + // Output: + // var a []string +} + +func ExampleIndex_index() { + c := Id("a").Op(":=").Id("b").Index(Lit(0), Lit(1)) + fmt.Printf("%#v", c) + // Output: + // a := b[0:1] +} + +func ExampleIndex_empty() { + c := Id("a").Op(":=").Id("b").Index(Lit(1), Empty()) + fmt.Printf("%#v", c) + // Output: + // a := b[1:] +} + +func ExampleOp() { + c := Id("a").Op(":=").Id("b").Call() + fmt.Printf("%#v", c) + // Output: + // a := b() +} + +func ExampleOp_star() { + c := Id("a").Op("=").Op("*").Id("b") + fmt.Printf("%#v", c) + // Output: + // a = *b +} + +func ExampleOp_variadic() { + c := Id("a").Call(Id("b").Op("...")) + fmt.Printf("%#v", c) + // Output: + // a(b...) +} + +func ExampleNewFilePath() { + f := NewFilePath("a.b/c") + f.Func().Id("init").Params().Block( + Qual("a.b/c", "Foo").Call().Comment("Local package - alias is omitted."), + Qual("d.e/f", "Bar").Call().Comment("Import is automatically added."), + Qual("g.h/f", "Baz").Call().Comment("Colliding package name is automatically renamed."), + ) + fmt.Printf("%#v", f) + // Output: + // package c + // + // import ( + // f "d.e/f" + // f1 "g.h/f" + // ) + // + // func init() { + // Foo() // Local package - alias is omitted. + // f.Bar() // Import is automatically added. + // f1.Baz() // Colliding package name is automatically renamed. + // } +} + +func ExampleStruct_empty() { + c := Id("c").Op(":=").Make(Chan().Struct()) + fmt.Printf("%#v", c) + // Output: + // c := make(chan struct{}) +} + +func ExampleStruct() { + c := Type().Id("foo").Struct( + List(Id("x"), Id("y")).Int(), + Id("u").Float32(), + ) + fmt.Printf("%#v", c) + // Output: + // type foo struct { + // x, y int + // u float32 + // } +} + +func ExampleDefer() { + c := Defer().Id("foo").Call() + fmt.Printf("%#v", c) + // Output: + // defer foo() +} + +func ExampleGoto() { + c := Goto().Id("Outer") + fmt.Printf("%#v", c) + // Output: + // goto Outer +} + +func ExampleStatement_Clone_broken() { + a := Id("a") + c := Block( + a.Call(), + a.Call(), + ) + fmt.Printf("%#v", c) + // Output: + // { + // a()() + // a()() + // } +} + +func ExampleStatement_Clone_fixed() { + a := Id("a") + c := Block( + a.Clone().Call(), + a.Clone().Call(), + ) + fmt.Printf("%#v", c) + // Output: + // { + // a() + // a() + // } +} + +func ExampleFile_Render() { + f := NewFile("a") + f.Func().Id("main").Params().Block() + buf := &bytes.Buffer{} + err := f.Render(buf) + if err != nil { + fmt.Println(err.Error()) + } else { + fmt.Println(buf.String()) + } + // Output: + // package a + // + // func main() {} +} + +func ExampleLit() { + c := Id("a").Op(":=").Lit("a") + fmt.Printf("%#v", c) + // Output: + // a := "a" +} + +func ExampleLit_float() { + c := Id("a").Op(":=").Lit(1.5) + fmt.Printf("%#v", c) + // Output: + // a := 1.5 +} + +func ExampleLitFunc() { + c := Id("a").Op(":=").LitFunc(func() interface{} { return 1 + 1 }) + fmt.Printf("%#v", c) + // Output: + // a := 2 +} + +func ExampleDot() { + c := Qual("a.b/c", "Foo").Call().Dot("Bar").Index(Lit(0)).Dot("Baz") + fmt.Printf("%#v", c) + // Output: + // c.Foo().Bar[0].Baz +} + +func ExampleList() { + c := List(Id("a"), Err()).Op(":=").Id("b").Call() + fmt.Printf("%#v", c) + // Output: + // a, err := b() +} + +func ExampleQual() { + c := Qual("encoding/gob", "NewEncoder").Call() + fmt.Printf("%#v", c) + // Output: + // gob.NewEncoder() +} + +func ExampleQual_file() { + f := NewFilePath("a.b/c") + f.Func().Id("init").Params().Block( + Qual("a.b/c", "Foo").Call().Comment("Local package - name is omitted."), + Qual("d.e/f", "Bar").Call().Comment("Import is automatically added."), + Qual("g.h/f", "Baz").Call().Comment("Colliding package name is renamed."), + ) + fmt.Printf("%#v", f) + // Output: + // package c + // + // import ( + // f "d.e/f" + // f1 "g.h/f" + // ) + // + // func init() { + // Foo() // Local package - name is omitted. + // f.Bar() // Import is automatically added. + // f1.Baz() // Colliding package name is renamed. + // } +} + +func ExampleQual_local() { + f := NewFilePath("a.b/c") + f.Func().Id("main").Params().Block( + Qual("a.b/c", "D").Call(), + ) + fmt.Printf("%#v", f) + // Output: + // package c + // + // func main() { + // D() + // } +} + +func ExampleId() { + c := If(Id("i").Op("==").Id("j")).Block( + Return(Id("i")), + ) + fmt.Printf("%#v", c) + // Output: + // if i == j { + // return i + // } +} + +func ExampleErr() { + c := If( + Err().Op(":=").Id("foo").Call(), + Err().Op("!=").Nil(), + ).Block( + Return(Err()), + ) + fmt.Printf("%#v", c) + // Output: + // if err := foo(); err != nil { + // return err + // } +} + +func ExampleSwitch() { + c := Switch(Id("value").Dot("Kind").Call()).Block( + Case(Qual("reflect", "Float32"), Qual("reflect", "Float64")).Block( + Return(Lit("float")), + ), + Case(Qual("reflect", "Bool")).Block( + Return(Lit("bool")), + ), + Case(Qual("reflect", "Uintptr")).Block( + Fallthrough(), + ), + Default().Block( + Return(Lit("none")), + ), + ) + fmt.Printf("%#v", c) + // Output: + // switch value.Kind() { + // case reflect.Float32, reflect.Float64: + // return "float" + // case reflect.Bool: + // return "bool" + // case reflect.Uintptr: + // fallthrough + // default: + // return "none" + // } +} + +func ExampleTag() { + c := Type().Id("foo").Struct( + Id("A").String().Tag(map[string]string{"json": "a"}), + Id("B").Int().Tag(map[string]string{"json": "b", "bar": "baz"}), + ) + fmt.Printf("%#v", c) + // Output: + // type foo struct { + // A string `json:"a"` + // B int `bar:"baz" json:"b"` + // } +} + +func ExampleNull_and_nil() { + c := Func().Id("foo").Params( + nil, + Id("s").String(), + Null(), + Id("i").Int(), + ).Block() + fmt.Printf("%#v", c) + // Output: + // func foo(s string, i int) {} +} + +func ExampleNull_index() { + c := Id("a").Op(":=").Id("b").Index(Lit(1), Null()) + fmt.Printf("%#v", c) + // Output: + // a := b[1] +} + +func ExampleEmpty() { + c := Id("a").Op(":=").Id("b").Index(Lit(1), Empty()) + fmt.Printf("%#v", c) + // Output: + // a := b[1:] +} + +func ExampleBlock_complex() { + collection := func(name string, key Code, value Code) *Statement { + if key == nil { + // slice + return Var().Id(name).Index().Add(value) + } else { + // map + return Var().Id(name).Map(key).Add(value) + } + } + c := Func().Id("main").Params().Block( + collection("foo", nil, String()), + collection("bar", String(), Int()), + ) + fmt.Printf("%#v", c) + // Output: + // func main() { + // var foo []string + // var bar map[string]int + // } +} + +func ExampleFunc_declaration() { + c := Func().Id("a").Params().Block() + fmt.Printf("%#v", c) + // Output: + // func a() {} +} + +func ExampleFunc_literal() { + c := Id("a").Op(":=").Func().Params().Block() + fmt.Printf("%#v", c) + // Output: + // a := func() {} +} + +func ExampleInterface() { + c := Type().Id("a").Interface( + Id("b").Params().String(), + ) + fmt.Printf("%#v", c) + // Output: + // type a interface { + // b() string + // } +} + +func ExampleInterface_empty() { + c := Var().Id("a").Interface() + fmt.Printf("%#v", c) + // Output: + // var a interface{} +} + +func ExampleParens() { + c := Id("b").Op(":=").Index().Byte().Parens(Id("s")) + fmt.Printf("%#v", c) + // Output: + // b := []byte(s) +} + +func ExampleParens_order() { + c := Id("a").Op("/").Parens(Id("b").Op("+").Id("c")) + fmt.Printf("%#v", c) + // Output: + // a / (b + c) +} + +func ExampleValues() { + c := Index().String().Values(Lit("a"), Lit("b")) + fmt.Printf("%#v", c) + // Output: + // []string{"a", "b"} +} + +func ExampleDo() { + f := func(name string, isMap bool) *Statement { + return Id(name).Op(":=").Do(func(s *Statement) { + if isMap { + s.Map(String()).String() + } else { + s.Index().String() + } + }).Values() + } + fmt.Printf("%#v\n%#v", f("a", true), f("b", false)) + // Output: + // a := map[string]string{} + // b := []string{} +} + +func ExampleReturn() { + c := Return(Id("a"), Id("b")) + fmt.Printf("%#v", c) + // Output: + // return a, b +} + +func ExampleMap() { + c := Id("a").Op(":=").Map(String()).String().Values() + fmt.Printf("%#v", c) + // Output: + // a := map[string]string{} +} + +func ExampleDict() { + c := Id("a").Op(":=").Map(String()).String().Values(Dict{ + Lit("a"): Lit("b"), + Lit("c"): Lit("d"), + }) + fmt.Printf("%#v", c) + // Output: + // a := map[string]string{ + // "a": "b", + // "c": "d", + // } +} + +func ExampleDict_nil() { + c := Id("a").Op(":=").Map(String()).String().Values() + fmt.Printf("%#v", c) + // Output: + // a := map[string]string{} +} + +func ExampleDictFunc() { + c := Id("a").Op(":=").Map(String()).String().Values(DictFunc(func(d Dict) { + d[Lit("a")] = Lit("b") + d[Lit("c")] = Lit("d") + })) + fmt.Printf("%#v", c) + // Output: + // a := map[string]string{ + // "a": "b", + // "c": "d", + // } +} + +func ExampleDefs() { + c := Const().Defs( + Id("a").Op("=").Lit("a"), + Id("b").Op("=").Lit("b"), + ) + fmt.Printf("%#v", c) + // Output: + // const ( + // a = "a" + // b = "b" + // ) +} + +func ExampleIf() { + c := If( + Err().Op(":=").Id("a").Call(), + Err().Op("!=").Nil(), + ).Block( + Return(Err()), + ) + fmt.Printf("%#v", c) + // Output: + // if err := a(); err != nil { + // return err + // } +} + +func ExampleId_local() { + c := Id("a").Op(":=").Lit(1) + fmt.Printf("%#v", c) + // Output: + // a := 1 +} + +func ExampleId_select() { + c := Id("a").Dot("b").Dot("c").Call() + fmt.Printf("%#v", c) + // Output: + // a.b.c() +} + +func ExampleId_remote() { + f := NewFile("main") + f.Func().Id("main").Params().Block( + Qual("fmt", "Println").Call( + Lit("Hello, world"), + ), + ) + fmt.Printf("%#v", f) + // Output: + // package main + // + // import "fmt" + // + // func main() { + // fmt.Println("Hello, world") + // } +} + +func ExampleFor() { + c := For( + Id("i").Op(":=").Lit(0), + Id("i").Op("<").Lit(10), + Id("i").Op("++"), + ).Block( + Qual("fmt", "Println").Call(Id("i")), + ) + fmt.Printf("%#v", c) + // Output: + // for i := 0; i < 10; i++ { + // fmt.Println(i) + // } +} + +func ExampleNewFile() { + f := NewFile("main") + f.Func().Id("main").Params().Block( + Qual("fmt", "Println").Call(Lit("Hello, world")), + ) + fmt.Printf("%#v", f) + // Output: + // package main + // + // import "fmt" + // + // func main() { + // fmt.Println("Hello, world") + // } +} + +func ExampleNewFilePathName() { + f := NewFilePathName("a.b/c", "main") + f.Func().Id("main").Params().Block( + Qual("a.b/c", "Foo").Call(), + ) + fmt.Printf("%#v", f) + // Output: + // package main + // + // func main() { + // Foo() + // } +} + +func ExampleFile_HeaderAndPackageComments() { + f := NewFile("c") + f.CanonicalPath = "d.e/f" + f.HeaderComment("Code generated by...") + f.PackageComment("Package c implements...") + f.Func().Id("init").Params().Block() + fmt.Printf("%#v", f) + // Output: + // // Code generated by... + // + // // Package c implements... + // package c // import "d.e/f" + // + // func init() {} +} + +func ExampleFile_Anon() { + f := NewFile("c") + f.Anon("a") + f.Func().Id("init").Params().Block() + fmt.Printf("%#v", f) + // Output: + // package c + // + // import _ "a" + // + // func init() {} +} + +func ExampleFile_PackagePrefix() { + f := NewFile("a") + f.PackagePrefix = "pkg" + f.Func().Id("main").Params().Block( + Qual("b.c/d", "E").Call(), + ) + fmt.Printf("%#v", f) + // Output: + // package a + // + // import pkg_d "b.c/d" + // + // func main() { + // pkg_d.E() + // } +} diff --git a/vendor/github.com/dave/jennifer/jen/file.go b/vendor/github.com/dave/jennifer/jen/file.go new file mode 100644 index 00000000..1ce442b9 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/file.go @@ -0,0 +1,262 @@ +package jen + +import ( + "bytes" + "fmt" + "regexp" + "strings" +) + +// NewFile Creates a new file, with the specified package name. +func NewFile(packageName string) *File { + return &File{ + Group: &Group{ + multi: true, + }, + name: packageName, + imports: map[string]importdef{}, + hints: map[string]importdef{}, + } +} + +// NewFilePath creates a new file while specifying the package path - the +// package name is inferred from the path. +func NewFilePath(packagePath string) *File { + return &File{ + Group: &Group{ + multi: true, + }, + name: guessAlias(packagePath), + path: packagePath, + imports: map[string]importdef{}, + hints: map[string]importdef{}, + } +} + +// NewFilePathName creates a new file with the specified package path and name. +func NewFilePathName(packagePath, packageName string) *File { + return &File{ + Group: &Group{ + multi: true, + }, + name: packageName, + path: packagePath, + imports: map[string]importdef{}, + hints: map[string]importdef{}, + } +} + +// File represents a single source file. Package imports are managed +// automaticaly by File. +type File struct { + *Group + name string + path string + imports map[string]importdef + hints map[string]importdef + comments []string + headers []string + cgoPreamble []string + // If you're worried about generated package aliases conflicting with local variable names, you + // can set a prefix here. Package foo becomes {prefix}_foo. + PackagePrefix string + // CanonicalPath adds a canonical import path annotation to the package clause. + CanonicalPath string +} + +// importdef is used to differentiate packages where we know the package name from packages where the +// import is aliased. If alias == false, then name is the actual package name, and the import will be +// rendered without an alias. If used == false, the import has not been used in code yet and should be +// excluded from the import block. +type importdef struct { + name string + alias bool +} + +// HeaderComment adds a comment to the top of the file, above any package +// comments. A blank line is rendered below the header comments, ensuring +// header comments are not included in the package doc. +func (f *File) HeaderComment(comment string) { + f.headers = append(f.headers, comment) +} + +// PackageComment adds a comment to the top of the file, above the package +// keyword. +func (f *File) PackageComment(comment string) { + f.comments = append(f.comments, comment) +} + +// CgoPreamble adds a cgo preamble comment that is rendered directly before the "C" pseudo-package +// import. +func (f *File) CgoPreamble(comment string) { + f.cgoPreamble = append(f.cgoPreamble, comment) +} + +// Anon adds an anonymous import. +func (f *File) Anon(paths ...string) { + for _, p := range paths { + f.imports[p] = importdef{name: "_", alias: true} + } +} + +// ImportName provides the package name for a path. If specified, the alias will be omitted from the +// import block. This is optional. If not specified, a sensible package name is used based on the path +// and this is added as an alias in the import block. +func (f *File) ImportName(path, name string) { + f.hints[path] = importdef{name: name, alias: false} +} + +// ImportNames allows multiple names to be imported as a map. Use the [gennames](gennames) command to +// automatically generate a go file containing a map of a selection of package names. +func (f *File) ImportNames(names map[string]string) { + for path, name := range names { + f.hints[path] = importdef{name: name, alias: false} + } +} + +// ImportAlias provides the alias for a package path that should be used in the import block. A +// period can be used to force a dot-import. +func (f *File) ImportAlias(path, alias string) { + f.hints[path] = importdef{name: alias, alias: true} +} + +func (f *File) isLocal(path string) bool { + return f.path == path +} + +var reserved = []string{ + /* keywords */ + "break", "default", "func", "interface", "select", "case", "defer", "go", "map", "struct", "chan", "else", "goto", "package", "switch", "const", "fallthrough", "if", "range", "type", "continue", "for", "import", "return", "var", + /* predeclared */ + "bool", "byte", "complex64", "complex128", "error", "float32", "float64", "int", "int8", "int16", "int32", "int64", "rune", "string", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", "true", "false", "iota", "nil", "append", "cap", "close", "complex", "copy", "delete", "imag", "len", "make", "new", "panic", "print", "println", "real", "recover", + /* common variables */ + "err", +} + +func isReservedWord(alias string) bool { + for _, name := range reserved { + if alias == name { + return true + } + } + return false +} + +func (f *File) isValidAlias(alias string) bool { + // multiple dot-imports are ok + if alias == "." { + return true + } + // the import alias is invalid if it's a reserved word + if isReservedWord(alias) { + return false + } + // the import alias is invalid if it's already been registered + for _, v := range f.imports { + if alias == v.name { + return false + } + } + return true +} + +func (f *File) isDotImport(path string) bool { + if id, ok := f.hints[path]; ok { + return id.name == "." && id.alias + } + return false +} + +func (f *File) register(path string) string { + if f.isLocal(path) { + // notest + // should never get here becasue in Qual the packageToken will be null, + // so render will never be called. + return "" + } + + // if the path has been registered previously, simply return the name + def := f.imports[path] + if def.name != "" && def.name != "_" { + return def.name + } + + // special case for "C" pseudo-package + if path == "C" { + f.imports["C"] = importdef{name: "C", alias: false} + return "C" + } + + var name string + var alias bool + + if hint := f.hints[path]; hint.name != "" { + // look up the path in the list of provided package names and aliases by ImportName / ImportAlias + name = hint.name + alias = hint.alias + } else if standardLibraryHints[path] != "" { + // look up the path in the list of standard library packages + name = standardLibraryHints[path] + alias = false + } else { + // if a hint is not found for the package, guess the alias from the package path + name = guessAlias(path) + alias = true + } + + // If the name is invalid or has been registered already, make it unique by appending a number + unique := name + i := 0 + for !f.isValidAlias(unique) { + i++ + unique = fmt.Sprintf("%s%d", name, i) + } + + // If we've changed the name to make it unique, it should definitely be an alias + if unique != name { + alias = true + } + + // Only add a prefix if the name is an alias + if f.PackagePrefix != "" && alias { + unique = f.PackagePrefix + "_" + unique + } + + // Register the eventual name + f.imports[path] = importdef{name: unique, alias: alias} + + return unique +} + +// GoString renders the File for testing. Any error will cause a panic. +func (f *File) GoString() string { + buf := &bytes.Buffer{} + if err := f.Render(buf); err != nil { + panic(err) + } + return buf.String() +} + +func guessAlias(path string) string { + alias := path + + if strings.HasSuffix(alias, "/") { + // training slashes are usually tolerated, so we can get rid of one if + // it exists + alias = alias[:len(alias)-1] + } + + if strings.Contains(alias, "/") { + // if the path contains a "/", use the last part + alias = alias[strings.LastIndex(alias, "/")+1:] + } + + // alias should be lower case + alias = strings.ToLower(alias) + + // alias should now only contain alphanumerics + importsRegex := regexp.MustCompile(`[^a-z0-9]`) + alias = importsRegex.ReplaceAllString(alias, "") + + return alias +} diff --git a/vendor/github.com/dave/jennifer/jen/file_test.go b/vendor/github.com/dave/jennifer/jen/file_test.go new file mode 100644 index 00000000..798faf63 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/file_test.go @@ -0,0 +1,48 @@ +package jen + +import ( + "fmt" + "testing" +) + +func TestGuessAlias(t *testing.T) { + + data := map[string]string{ + "A": "a", + "a": "a", + "a$": "a", + "a/b": "b", + "a/b/c": "c", + "a/b/c-d": "cd", + "a/b/c-d/": "cd", + "a.b": "ab", + "a/b.c": "bc", + "a/b-c.d": "bcd", + "a/bb-ccc.dddd": "bbcccdddd", + "a/foo-go": "foogo", + } + for path, expected := range data { + if guessAlias(path) != expected { + fmt.Printf("guessAlias test failed %s should return %s but got %s\n", path, expected, guessAlias(path)) + t.Fail() + } + } +} + +func TestValidAlias(t *testing.T) { + data := map[string]bool{ + "a": true, // ok + "b": false, // already registered + "go": false, // keyword + "int": false, // predeclared + "err": false, // common name + } + f := NewFile("test") + f.register("b") + for alias, expected := range data { + if f.isValidAlias(alias) != expected { + fmt.Printf("isValidAlias test failed %s should return %t but got %t\n", alias, expected, f.isValidAlias(alias)) + t.Fail() + } + } +} diff --git a/vendor/github.com/dave/jennifer/jen/generated.go b/vendor/github.com/dave/jennifer/jen/generated.go new file mode 100644 index 00000000..3983cf97 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/generated.go @@ -0,0 +1,2274 @@ +// This file is generated - do not edit. + +package jen + +// Parens renders a single item in parenthesis. Use for type conversion or to specify evaluation order. +func Parens(item Code) *Statement { + return newStatement().Parens(item) +} + +// Parens renders a single item in parenthesis. Use for type conversion or to specify evaluation order. +func (g *Group) Parens(item Code) *Statement { + s := Parens(item) + g.items = append(g.items, s) + return s +} + +// Parens renders a single item in parenthesis. Use for type conversion or to specify evaluation order. +func (s *Statement) Parens(item Code) *Statement { + g := &Group{ + close: ")", + items: []Code{item}, + multi: false, + name: "parens", + open: "(", + separator: "", + } + *s = append(*s, g) + return s +} + +// List renders a comma separated list. Use for multiple return functions. +func List(items ...Code) *Statement { + return newStatement().List(items...) +} + +// List renders a comma separated list. Use for multiple return functions. +func (g *Group) List(items ...Code) *Statement { + s := List(items...) + g.items = append(g.items, s) + return s +} + +// List renders a comma separated list. Use for multiple return functions. +func (s *Statement) List(items ...Code) *Statement { + g := &Group{ + close: "", + items: items, + multi: false, + name: "list", + open: "", + separator: ",", + } + *s = append(*s, g) + return s +} + +// ListFunc renders a comma separated list. Use for multiple return functions. +func ListFunc(f func(*Group)) *Statement { + return newStatement().ListFunc(f) +} + +// ListFunc renders a comma separated list. Use for multiple return functions. +func (g *Group) ListFunc(f func(*Group)) *Statement { + s := ListFunc(f) + g.items = append(g.items, s) + return s +} + +// ListFunc renders a comma separated list. Use for multiple return functions. +func (s *Statement) ListFunc(f func(*Group)) *Statement { + g := &Group{ + close: "", + multi: false, + name: "list", + open: "", + separator: ",", + } + f(g) + *s = append(*s, g) + return s +} + +// Values renders a comma separated list enclosed by curly braces. Use for slice or composite literals. +func Values(values ...Code) *Statement { + return newStatement().Values(values...) +} + +// Values renders a comma separated list enclosed by curly braces. Use for slice or composite literals. +func (g *Group) Values(values ...Code) *Statement { + s := Values(values...) + g.items = append(g.items, s) + return s +} + +// Values renders a comma separated list enclosed by curly braces. Use for slice or composite literals. +func (s *Statement) Values(values ...Code) *Statement { + g := &Group{ + close: "}", + items: values, + multi: false, + name: "values", + open: "{", + separator: ",", + } + *s = append(*s, g) + return s +} + +// ValuesFunc renders a comma separated list enclosed by curly braces. Use for slice or composite literals. +func ValuesFunc(f func(*Group)) *Statement { + return newStatement().ValuesFunc(f) +} + +// ValuesFunc renders a comma separated list enclosed by curly braces. Use for slice or composite literals. +func (g *Group) ValuesFunc(f func(*Group)) *Statement { + s := ValuesFunc(f) + g.items = append(g.items, s) + return s +} + +// ValuesFunc renders a comma separated list enclosed by curly braces. Use for slice or composite literals. +func (s *Statement) ValuesFunc(f func(*Group)) *Statement { + g := &Group{ + close: "}", + multi: false, + name: "values", + open: "{", + separator: ",", + } + f(g) + *s = append(*s, g) + return s +} + +// Index renders a colon separated list enclosed by square brackets. Use for array / slice indexes and definitions. +func Index(items ...Code) *Statement { + return newStatement().Index(items...) +} + +// Index renders a colon separated list enclosed by square brackets. Use for array / slice indexes and definitions. +func (g *Group) Index(items ...Code) *Statement { + s := Index(items...) + g.items = append(g.items, s) + return s +} + +// Index renders a colon separated list enclosed by square brackets. Use for array / slice indexes and definitions. +func (s *Statement) Index(items ...Code) *Statement { + g := &Group{ + close: "]", + items: items, + multi: false, + name: "index", + open: "[", + separator: ":", + } + *s = append(*s, g) + return s +} + +// IndexFunc renders a colon separated list enclosed by square brackets. Use for array / slice indexes and definitions. +func IndexFunc(f func(*Group)) *Statement { + return newStatement().IndexFunc(f) +} + +// IndexFunc renders a colon separated list enclosed by square brackets. Use for array / slice indexes and definitions. +func (g *Group) IndexFunc(f func(*Group)) *Statement { + s := IndexFunc(f) + g.items = append(g.items, s) + return s +} + +// IndexFunc renders a colon separated list enclosed by square brackets. Use for array / slice indexes and definitions. +func (s *Statement) IndexFunc(f func(*Group)) *Statement { + g := &Group{ + close: "]", + multi: false, + name: "index", + open: "[", + separator: ":", + } + f(g) + *s = append(*s, g) + return s +} + +// Block renders a statement list enclosed by curly braces. Use for code blocks. A special case applies when used directly after Case or Default, where the braces are omitted. This allows use in switch and select statements. +func Block(statements ...Code) *Statement { + return newStatement().Block(statements...) +} + +// Block renders a statement list enclosed by curly braces. Use for code blocks. A special case applies when used directly after Case or Default, where the braces are omitted. This allows use in switch and select statements. +func (g *Group) Block(statements ...Code) *Statement { + s := Block(statements...) + g.items = append(g.items, s) + return s +} + +// Block renders a statement list enclosed by curly braces. Use for code blocks. A special case applies when used directly after Case or Default, where the braces are omitted. This allows use in switch and select statements. +func (s *Statement) Block(statements ...Code) *Statement { + g := &Group{ + close: "}", + items: statements, + multi: true, + name: "block", + open: "{", + separator: "", + } + *s = append(*s, g) + return s +} + +// BlockFunc renders a statement list enclosed by curly braces. Use for code blocks. A special case applies when used directly after Case or Default, where the braces are omitted. This allows use in switch and select statements. +func BlockFunc(f func(*Group)) *Statement { + return newStatement().BlockFunc(f) +} + +// BlockFunc renders a statement list enclosed by curly braces. Use for code blocks. A special case applies when used directly after Case or Default, where the braces are omitted. This allows use in switch and select statements. +func (g *Group) BlockFunc(f func(*Group)) *Statement { + s := BlockFunc(f) + g.items = append(g.items, s) + return s +} + +// BlockFunc renders a statement list enclosed by curly braces. Use for code blocks. A special case applies when used directly after Case or Default, where the braces are omitted. This allows use in switch and select statements. +func (s *Statement) BlockFunc(f func(*Group)) *Statement { + g := &Group{ + close: "}", + multi: true, + name: "block", + open: "{", + separator: "", + } + f(g) + *s = append(*s, g) + return s +} + +// Defs renders a statement list enclosed in parenthesis. Use for definition lists. +func Defs(definitions ...Code) *Statement { + return newStatement().Defs(definitions...) +} + +// Defs renders a statement list enclosed in parenthesis. Use for definition lists. +func (g *Group) Defs(definitions ...Code) *Statement { + s := Defs(definitions...) + g.items = append(g.items, s) + return s +} + +// Defs renders a statement list enclosed in parenthesis. Use for definition lists. +func (s *Statement) Defs(definitions ...Code) *Statement { + g := &Group{ + close: ")", + items: definitions, + multi: true, + name: "defs", + open: "(", + separator: "", + } + *s = append(*s, g) + return s +} + +// DefsFunc renders a statement list enclosed in parenthesis. Use for definition lists. +func DefsFunc(f func(*Group)) *Statement { + return newStatement().DefsFunc(f) +} + +// DefsFunc renders a statement list enclosed in parenthesis. Use for definition lists. +func (g *Group) DefsFunc(f func(*Group)) *Statement { + s := DefsFunc(f) + g.items = append(g.items, s) + return s +} + +// DefsFunc renders a statement list enclosed in parenthesis. Use for definition lists. +func (s *Statement) DefsFunc(f func(*Group)) *Statement { + g := &Group{ + close: ")", + multi: true, + name: "defs", + open: "(", + separator: "", + } + f(g) + *s = append(*s, g) + return s +} + +// Call renders a comma separated list enclosed by parenthesis. Use for function calls. +func Call(params ...Code) *Statement { + return newStatement().Call(params...) +} + +// Call renders a comma separated list enclosed by parenthesis. Use for function calls. +func (g *Group) Call(params ...Code) *Statement { + s := Call(params...) + g.items = append(g.items, s) + return s +} + +// Call renders a comma separated list enclosed by parenthesis. Use for function calls. +func (s *Statement) Call(params ...Code) *Statement { + g := &Group{ + close: ")", + items: params, + multi: false, + name: "call", + open: "(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// CallFunc renders a comma separated list enclosed by parenthesis. Use for function calls. +func CallFunc(f func(*Group)) *Statement { + return newStatement().CallFunc(f) +} + +// CallFunc renders a comma separated list enclosed by parenthesis. Use for function calls. +func (g *Group) CallFunc(f func(*Group)) *Statement { + s := CallFunc(f) + g.items = append(g.items, s) + return s +} + +// CallFunc renders a comma separated list enclosed by parenthesis. Use for function calls. +func (s *Statement) CallFunc(f func(*Group)) *Statement { + g := &Group{ + close: ")", + multi: false, + name: "call", + open: "(", + separator: ",", + } + f(g) + *s = append(*s, g) + return s +} + +// Params renders a comma separated list enclosed by parenthesis. Use for function parameters and method receivers. +func Params(params ...Code) *Statement { + return newStatement().Params(params...) +} + +// Params renders a comma separated list enclosed by parenthesis. Use for function parameters and method receivers. +func (g *Group) Params(params ...Code) *Statement { + s := Params(params...) + g.items = append(g.items, s) + return s +} + +// Params renders a comma separated list enclosed by parenthesis. Use for function parameters and method receivers. +func (s *Statement) Params(params ...Code) *Statement { + g := &Group{ + close: ")", + items: params, + multi: false, + name: "params", + open: "(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// ParamsFunc renders a comma separated list enclosed by parenthesis. Use for function parameters and method receivers. +func ParamsFunc(f func(*Group)) *Statement { + return newStatement().ParamsFunc(f) +} + +// ParamsFunc renders a comma separated list enclosed by parenthesis. Use for function parameters and method receivers. +func (g *Group) ParamsFunc(f func(*Group)) *Statement { + s := ParamsFunc(f) + g.items = append(g.items, s) + return s +} + +// ParamsFunc renders a comma separated list enclosed by parenthesis. Use for function parameters and method receivers. +func (s *Statement) ParamsFunc(f func(*Group)) *Statement { + g := &Group{ + close: ")", + multi: false, + name: "params", + open: "(", + separator: ",", + } + f(g) + *s = append(*s, g) + return s +} + +// Assert renders a period followed by a single item enclosed by parenthesis. Use for type assertions. +func Assert(typ Code) *Statement { + return newStatement().Assert(typ) +} + +// Assert renders a period followed by a single item enclosed by parenthesis. Use for type assertions. +func (g *Group) Assert(typ Code) *Statement { + s := Assert(typ) + g.items = append(g.items, s) + return s +} + +// Assert renders a period followed by a single item enclosed by parenthesis. Use for type assertions. +func (s *Statement) Assert(typ Code) *Statement { + g := &Group{ + close: ")", + items: []Code{typ}, + multi: false, + name: "assert", + open: ".(", + separator: "", + } + *s = append(*s, g) + return s +} + +// Map renders the keyword followed by a single item enclosed by square brackets. Use for map definitions. +func Map(typ Code) *Statement { + return newStatement().Map(typ) +} + +// Map renders the keyword followed by a single item enclosed by square brackets. Use for map definitions. +func (g *Group) Map(typ Code) *Statement { + s := Map(typ) + g.items = append(g.items, s) + return s +} + +// Map renders the keyword followed by a single item enclosed by square brackets. Use for map definitions. +func (s *Statement) Map(typ Code) *Statement { + g := &Group{ + close: "]", + items: []Code{typ}, + multi: false, + name: "map", + open: "map[", + separator: "", + } + *s = append(*s, g) + return s +} + +// If renders the keyword followed by a semicolon separated list. +func If(conditions ...Code) *Statement { + return newStatement().If(conditions...) +} + +// If renders the keyword followed by a semicolon separated list. +func (g *Group) If(conditions ...Code) *Statement { + s := If(conditions...) + g.items = append(g.items, s) + return s +} + +// If renders the keyword followed by a semicolon separated list. +func (s *Statement) If(conditions ...Code) *Statement { + g := &Group{ + close: "", + items: conditions, + multi: false, + name: "if", + open: "if ", + separator: ";", + } + *s = append(*s, g) + return s +} + +// IfFunc renders the keyword followed by a semicolon separated list. +func IfFunc(f func(*Group)) *Statement { + return newStatement().IfFunc(f) +} + +// IfFunc renders the keyword followed by a semicolon separated list. +func (g *Group) IfFunc(f func(*Group)) *Statement { + s := IfFunc(f) + g.items = append(g.items, s) + return s +} + +// IfFunc renders the keyword followed by a semicolon separated list. +func (s *Statement) IfFunc(f func(*Group)) *Statement { + g := &Group{ + close: "", + multi: false, + name: "if", + open: "if ", + separator: ";", + } + f(g) + *s = append(*s, g) + return s +} + +// Return renders the keyword followed by a comma separated list. +func Return(results ...Code) *Statement { + return newStatement().Return(results...) +} + +// Return renders the keyword followed by a comma separated list. +func (g *Group) Return(results ...Code) *Statement { + s := Return(results...) + g.items = append(g.items, s) + return s +} + +// Return renders the keyword followed by a comma separated list. +func (s *Statement) Return(results ...Code) *Statement { + g := &Group{ + close: "", + items: results, + multi: false, + name: "return", + open: "return ", + separator: ",", + } + *s = append(*s, g) + return s +} + +// ReturnFunc renders the keyword followed by a comma separated list. +func ReturnFunc(f func(*Group)) *Statement { + return newStatement().ReturnFunc(f) +} + +// ReturnFunc renders the keyword followed by a comma separated list. +func (g *Group) ReturnFunc(f func(*Group)) *Statement { + s := ReturnFunc(f) + g.items = append(g.items, s) + return s +} + +// ReturnFunc renders the keyword followed by a comma separated list. +func (s *Statement) ReturnFunc(f func(*Group)) *Statement { + g := &Group{ + close: "", + multi: false, + name: "return", + open: "return ", + separator: ",", + } + f(g) + *s = append(*s, g) + return s +} + +// For renders the keyword followed by a semicolon separated list. +func For(conditions ...Code) *Statement { + return newStatement().For(conditions...) +} + +// For renders the keyword followed by a semicolon separated list. +func (g *Group) For(conditions ...Code) *Statement { + s := For(conditions...) + g.items = append(g.items, s) + return s +} + +// For renders the keyword followed by a semicolon separated list. +func (s *Statement) For(conditions ...Code) *Statement { + g := &Group{ + close: "", + items: conditions, + multi: false, + name: "for", + open: "for ", + separator: ";", + } + *s = append(*s, g) + return s +} + +// ForFunc renders the keyword followed by a semicolon separated list. +func ForFunc(f func(*Group)) *Statement { + return newStatement().ForFunc(f) +} + +// ForFunc renders the keyword followed by a semicolon separated list. +func (g *Group) ForFunc(f func(*Group)) *Statement { + s := ForFunc(f) + g.items = append(g.items, s) + return s +} + +// ForFunc renders the keyword followed by a semicolon separated list. +func (s *Statement) ForFunc(f func(*Group)) *Statement { + g := &Group{ + close: "", + multi: false, + name: "for", + open: "for ", + separator: ";", + } + f(g) + *s = append(*s, g) + return s +} + +// Switch renders the keyword followed by a semicolon separated list. +func Switch(conditions ...Code) *Statement { + return newStatement().Switch(conditions...) +} + +// Switch renders the keyword followed by a semicolon separated list. +func (g *Group) Switch(conditions ...Code) *Statement { + s := Switch(conditions...) + g.items = append(g.items, s) + return s +} + +// Switch renders the keyword followed by a semicolon separated list. +func (s *Statement) Switch(conditions ...Code) *Statement { + g := &Group{ + close: "", + items: conditions, + multi: false, + name: "switch", + open: "switch ", + separator: ";", + } + *s = append(*s, g) + return s +} + +// SwitchFunc renders the keyword followed by a semicolon separated list. +func SwitchFunc(f func(*Group)) *Statement { + return newStatement().SwitchFunc(f) +} + +// SwitchFunc renders the keyword followed by a semicolon separated list. +func (g *Group) SwitchFunc(f func(*Group)) *Statement { + s := SwitchFunc(f) + g.items = append(g.items, s) + return s +} + +// SwitchFunc renders the keyword followed by a semicolon separated list. +func (s *Statement) SwitchFunc(f func(*Group)) *Statement { + g := &Group{ + close: "", + multi: false, + name: "switch", + open: "switch ", + separator: ";", + } + f(g) + *s = append(*s, g) + return s +} + +// Interface renders the keyword followed by a method list enclosed by curly braces. +func Interface(methods ...Code) *Statement { + return newStatement().Interface(methods...) +} + +// Interface renders the keyword followed by a method list enclosed by curly braces. +func (g *Group) Interface(methods ...Code) *Statement { + s := Interface(methods...) + g.items = append(g.items, s) + return s +} + +// Interface renders the keyword followed by a method list enclosed by curly braces. +func (s *Statement) Interface(methods ...Code) *Statement { + g := &Group{ + close: "}", + items: methods, + multi: true, + name: "interface", + open: "interface{", + separator: "", + } + *s = append(*s, g) + return s +} + +// InterfaceFunc renders the keyword followed by a method list enclosed by curly braces. +func InterfaceFunc(f func(*Group)) *Statement { + return newStatement().InterfaceFunc(f) +} + +// InterfaceFunc renders the keyword followed by a method list enclosed by curly braces. +func (g *Group) InterfaceFunc(f func(*Group)) *Statement { + s := InterfaceFunc(f) + g.items = append(g.items, s) + return s +} + +// InterfaceFunc renders the keyword followed by a method list enclosed by curly braces. +func (s *Statement) InterfaceFunc(f func(*Group)) *Statement { + g := &Group{ + close: "}", + multi: true, + name: "interface", + open: "interface{", + separator: "", + } + f(g) + *s = append(*s, g) + return s +} + +// Struct renders the keyword followed by a field list enclosed by curly braces. +func Struct(fields ...Code) *Statement { + return newStatement().Struct(fields...) +} + +// Struct renders the keyword followed by a field list enclosed by curly braces. +func (g *Group) Struct(fields ...Code) *Statement { + s := Struct(fields...) + g.items = append(g.items, s) + return s +} + +// Struct renders the keyword followed by a field list enclosed by curly braces. +func (s *Statement) Struct(fields ...Code) *Statement { + g := &Group{ + close: "}", + items: fields, + multi: true, + name: "struct", + open: "struct{", + separator: "", + } + *s = append(*s, g) + return s +} + +// StructFunc renders the keyword followed by a field list enclosed by curly braces. +func StructFunc(f func(*Group)) *Statement { + return newStatement().StructFunc(f) +} + +// StructFunc renders the keyword followed by a field list enclosed by curly braces. +func (g *Group) StructFunc(f func(*Group)) *Statement { + s := StructFunc(f) + g.items = append(g.items, s) + return s +} + +// StructFunc renders the keyword followed by a field list enclosed by curly braces. +func (s *Statement) StructFunc(f func(*Group)) *Statement { + g := &Group{ + close: "}", + multi: true, + name: "struct", + open: "struct{", + separator: "", + } + f(g) + *s = append(*s, g) + return s +} + +// Case renders the keyword followed by a comma separated list. +func Case(cases ...Code) *Statement { + return newStatement().Case(cases...) +} + +// Case renders the keyword followed by a comma separated list. +func (g *Group) Case(cases ...Code) *Statement { + s := Case(cases...) + g.items = append(g.items, s) + return s +} + +// Case renders the keyword followed by a comma separated list. +func (s *Statement) Case(cases ...Code) *Statement { + g := &Group{ + close: ":", + items: cases, + multi: false, + name: "case", + open: "case ", + separator: ",", + } + *s = append(*s, g) + return s +} + +// CaseFunc renders the keyword followed by a comma separated list. +func CaseFunc(f func(*Group)) *Statement { + return newStatement().CaseFunc(f) +} + +// CaseFunc renders the keyword followed by a comma separated list. +func (g *Group) CaseFunc(f func(*Group)) *Statement { + s := CaseFunc(f) + g.items = append(g.items, s) + return s +} + +// CaseFunc renders the keyword followed by a comma separated list. +func (s *Statement) CaseFunc(f func(*Group)) *Statement { + g := &Group{ + close: ":", + multi: false, + name: "case", + open: "case ", + separator: ",", + } + f(g) + *s = append(*s, g) + return s +} + +// Append renders the append built-in function. +func Append(args ...Code) *Statement { + return newStatement().Append(args...) +} + +// Append renders the append built-in function. +func (g *Group) Append(args ...Code) *Statement { + s := Append(args...) + g.items = append(g.items, s) + return s +} + +// Append renders the append built-in function. +func (s *Statement) Append(args ...Code) *Statement { + g := &Group{ + close: ")", + items: args, + multi: false, + name: "append", + open: "append(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// AppendFunc renders the append built-in function. +func AppendFunc(f func(*Group)) *Statement { + return newStatement().AppendFunc(f) +} + +// AppendFunc renders the append built-in function. +func (g *Group) AppendFunc(f func(*Group)) *Statement { + s := AppendFunc(f) + g.items = append(g.items, s) + return s +} + +// AppendFunc renders the append built-in function. +func (s *Statement) AppendFunc(f func(*Group)) *Statement { + g := &Group{ + close: ")", + multi: false, + name: "append", + open: "append(", + separator: ",", + } + f(g) + *s = append(*s, g) + return s +} + +// Cap renders the cap built-in function. +func Cap(v Code) *Statement { + return newStatement().Cap(v) +} + +// Cap renders the cap built-in function. +func (g *Group) Cap(v Code) *Statement { + s := Cap(v) + g.items = append(g.items, s) + return s +} + +// Cap renders the cap built-in function. +func (s *Statement) Cap(v Code) *Statement { + g := &Group{ + close: ")", + items: []Code{v}, + multi: false, + name: "cap", + open: "cap(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Close renders the close built-in function. +func Close(c Code) *Statement { + return newStatement().Close(c) +} + +// Close renders the close built-in function. +func (g *Group) Close(c Code) *Statement { + s := Close(c) + g.items = append(g.items, s) + return s +} + +// Close renders the close built-in function. +func (s *Statement) Close(c Code) *Statement { + g := &Group{ + close: ")", + items: []Code{c}, + multi: false, + name: "close", + open: "close(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Complex renders the complex built-in function. +func Complex(r Code, i Code) *Statement { + return newStatement().Complex(r, i) +} + +// Complex renders the complex built-in function. +func (g *Group) Complex(r Code, i Code) *Statement { + s := Complex(r, i) + g.items = append(g.items, s) + return s +} + +// Complex renders the complex built-in function. +func (s *Statement) Complex(r Code, i Code) *Statement { + g := &Group{ + close: ")", + items: []Code{r, i}, + multi: false, + name: "complex", + open: "complex(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Copy renders the copy built-in function. +func Copy(dst Code, src Code) *Statement { + return newStatement().Copy(dst, src) +} + +// Copy renders the copy built-in function. +func (g *Group) Copy(dst Code, src Code) *Statement { + s := Copy(dst, src) + g.items = append(g.items, s) + return s +} + +// Copy renders the copy built-in function. +func (s *Statement) Copy(dst Code, src Code) *Statement { + g := &Group{ + close: ")", + items: []Code{dst, src}, + multi: false, + name: "copy", + open: "copy(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Delete renders the delete built-in function. +func Delete(m Code, key Code) *Statement { + return newStatement().Delete(m, key) +} + +// Delete renders the delete built-in function. +func (g *Group) Delete(m Code, key Code) *Statement { + s := Delete(m, key) + g.items = append(g.items, s) + return s +} + +// Delete renders the delete built-in function. +func (s *Statement) Delete(m Code, key Code) *Statement { + g := &Group{ + close: ")", + items: []Code{m, key}, + multi: false, + name: "delete", + open: "delete(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Imag renders the imag built-in function. +func Imag(c Code) *Statement { + return newStatement().Imag(c) +} + +// Imag renders the imag built-in function. +func (g *Group) Imag(c Code) *Statement { + s := Imag(c) + g.items = append(g.items, s) + return s +} + +// Imag renders the imag built-in function. +func (s *Statement) Imag(c Code) *Statement { + g := &Group{ + close: ")", + items: []Code{c}, + multi: false, + name: "imag", + open: "imag(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Len renders the len built-in function. +func Len(v Code) *Statement { + return newStatement().Len(v) +} + +// Len renders the len built-in function. +func (g *Group) Len(v Code) *Statement { + s := Len(v) + g.items = append(g.items, s) + return s +} + +// Len renders the len built-in function. +func (s *Statement) Len(v Code) *Statement { + g := &Group{ + close: ")", + items: []Code{v}, + multi: false, + name: "len", + open: "len(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Make renders the make built-in function. The final parameter of the make function is optional, so it is represented by a variadic parameter list. +func Make(args ...Code) *Statement { + return newStatement().Make(args...) +} + +// Make renders the make built-in function. The final parameter of the make function is optional, so it is represented by a variadic parameter list. +func (g *Group) Make(args ...Code) *Statement { + s := Make(args...) + g.items = append(g.items, s) + return s +} + +// Make renders the make built-in function. The final parameter of the make function is optional, so it is represented by a variadic parameter list. +func (s *Statement) Make(args ...Code) *Statement { + g := &Group{ + close: ")", + items: args, + multi: false, + name: "make", + open: "make(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// New renders the new built-in function. +func New(typ Code) *Statement { + return newStatement().New(typ) +} + +// New renders the new built-in function. +func (g *Group) New(typ Code) *Statement { + s := New(typ) + g.items = append(g.items, s) + return s +} + +// New renders the new built-in function. +func (s *Statement) New(typ Code) *Statement { + g := &Group{ + close: ")", + items: []Code{typ}, + multi: false, + name: "new", + open: "new(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Panic renders the panic built-in function. +func Panic(v Code) *Statement { + return newStatement().Panic(v) +} + +// Panic renders the panic built-in function. +func (g *Group) Panic(v Code) *Statement { + s := Panic(v) + g.items = append(g.items, s) + return s +} + +// Panic renders the panic built-in function. +func (s *Statement) Panic(v Code) *Statement { + g := &Group{ + close: ")", + items: []Code{v}, + multi: false, + name: "panic", + open: "panic(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Print renders the print built-in function. +func Print(args ...Code) *Statement { + return newStatement().Print(args...) +} + +// Print renders the print built-in function. +func (g *Group) Print(args ...Code) *Statement { + s := Print(args...) + g.items = append(g.items, s) + return s +} + +// Print renders the print built-in function. +func (s *Statement) Print(args ...Code) *Statement { + g := &Group{ + close: ")", + items: args, + multi: false, + name: "print", + open: "print(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// PrintFunc renders the print built-in function. +func PrintFunc(f func(*Group)) *Statement { + return newStatement().PrintFunc(f) +} + +// PrintFunc renders the print built-in function. +func (g *Group) PrintFunc(f func(*Group)) *Statement { + s := PrintFunc(f) + g.items = append(g.items, s) + return s +} + +// PrintFunc renders the print built-in function. +func (s *Statement) PrintFunc(f func(*Group)) *Statement { + g := &Group{ + close: ")", + multi: false, + name: "print", + open: "print(", + separator: ",", + } + f(g) + *s = append(*s, g) + return s +} + +// Println renders the println built-in function. +func Println(args ...Code) *Statement { + return newStatement().Println(args...) +} + +// Println renders the println built-in function. +func (g *Group) Println(args ...Code) *Statement { + s := Println(args...) + g.items = append(g.items, s) + return s +} + +// Println renders the println built-in function. +func (s *Statement) Println(args ...Code) *Statement { + g := &Group{ + close: ")", + items: args, + multi: false, + name: "println", + open: "println(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// PrintlnFunc renders the println built-in function. +func PrintlnFunc(f func(*Group)) *Statement { + return newStatement().PrintlnFunc(f) +} + +// PrintlnFunc renders the println built-in function. +func (g *Group) PrintlnFunc(f func(*Group)) *Statement { + s := PrintlnFunc(f) + g.items = append(g.items, s) + return s +} + +// PrintlnFunc renders the println built-in function. +func (s *Statement) PrintlnFunc(f func(*Group)) *Statement { + g := &Group{ + close: ")", + multi: false, + name: "println", + open: "println(", + separator: ",", + } + f(g) + *s = append(*s, g) + return s +} + +// Real renders the real built-in function. +func Real(c Code) *Statement { + return newStatement().Real(c) +} + +// Real renders the real built-in function. +func (g *Group) Real(c Code) *Statement { + s := Real(c) + g.items = append(g.items, s) + return s +} + +// Real renders the real built-in function. +func (s *Statement) Real(c Code) *Statement { + g := &Group{ + close: ")", + items: []Code{c}, + multi: false, + name: "real", + open: "real(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Recover renders the recover built-in function. +func Recover() *Statement { + return newStatement().Recover() +} + +// Recover renders the recover built-in function. +func (g *Group) Recover() *Statement { + s := Recover() + g.items = append(g.items, s) + return s +} + +// Recover renders the recover built-in function. +func (s *Statement) Recover() *Statement { + g := &Group{ + close: ")", + items: []Code{}, + multi: false, + name: "recover", + open: "recover(", + separator: ",", + } + *s = append(*s, g) + return s +} + +// Bool renders the bool identifier. +func Bool() *Statement { + return newStatement().Bool() +} + +// Bool renders the bool identifier. +func (g *Group) Bool() *Statement { + s := Bool() + g.items = append(g.items, s) + return s +} + +// Bool renders the bool identifier. +func (s *Statement) Bool() *Statement { + t := token{ + content: "bool", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Byte renders the byte identifier. +func Byte() *Statement { + // notest + return newStatement().Byte() +} + +// Byte renders the byte identifier. +func (g *Group) Byte() *Statement { + // notest + s := Byte() + g.items = append(g.items, s) + return s +} + +// Byte renders the byte identifier. +func (s *Statement) Byte() *Statement { + // notest + t := token{ + content: "byte", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Complex64 renders the complex64 identifier. +func Complex64() *Statement { + // notest + return newStatement().Complex64() +} + +// Complex64 renders the complex64 identifier. +func (g *Group) Complex64() *Statement { + // notest + s := Complex64() + g.items = append(g.items, s) + return s +} + +// Complex64 renders the complex64 identifier. +func (s *Statement) Complex64() *Statement { + // notest + t := token{ + content: "complex64", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Complex128 renders the complex128 identifier. +func Complex128() *Statement { + // notest + return newStatement().Complex128() +} + +// Complex128 renders the complex128 identifier. +func (g *Group) Complex128() *Statement { + // notest + s := Complex128() + g.items = append(g.items, s) + return s +} + +// Complex128 renders the complex128 identifier. +func (s *Statement) Complex128() *Statement { + // notest + t := token{ + content: "complex128", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Error renders the error identifier. +func Error() *Statement { + // notest + return newStatement().Error() +} + +// Error renders the error identifier. +func (g *Group) Error() *Statement { + // notest + s := Error() + g.items = append(g.items, s) + return s +} + +// Error renders the error identifier. +func (s *Statement) Error() *Statement { + // notest + t := token{ + content: "error", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Float32 renders the float32 identifier. +func Float32() *Statement { + // notest + return newStatement().Float32() +} + +// Float32 renders the float32 identifier. +func (g *Group) Float32() *Statement { + // notest + s := Float32() + g.items = append(g.items, s) + return s +} + +// Float32 renders the float32 identifier. +func (s *Statement) Float32() *Statement { + // notest + t := token{ + content: "float32", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Float64 renders the float64 identifier. +func Float64() *Statement { + // notest + return newStatement().Float64() +} + +// Float64 renders the float64 identifier. +func (g *Group) Float64() *Statement { + // notest + s := Float64() + g.items = append(g.items, s) + return s +} + +// Float64 renders the float64 identifier. +func (s *Statement) Float64() *Statement { + // notest + t := token{ + content: "float64", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Int renders the int identifier. +func Int() *Statement { + // notest + return newStatement().Int() +} + +// Int renders the int identifier. +func (g *Group) Int() *Statement { + // notest + s := Int() + g.items = append(g.items, s) + return s +} + +// Int renders the int identifier. +func (s *Statement) Int() *Statement { + // notest + t := token{ + content: "int", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Int8 renders the int8 identifier. +func Int8() *Statement { + // notest + return newStatement().Int8() +} + +// Int8 renders the int8 identifier. +func (g *Group) Int8() *Statement { + // notest + s := Int8() + g.items = append(g.items, s) + return s +} + +// Int8 renders the int8 identifier. +func (s *Statement) Int8() *Statement { + // notest + t := token{ + content: "int8", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Int16 renders the int16 identifier. +func Int16() *Statement { + // notest + return newStatement().Int16() +} + +// Int16 renders the int16 identifier. +func (g *Group) Int16() *Statement { + // notest + s := Int16() + g.items = append(g.items, s) + return s +} + +// Int16 renders the int16 identifier. +func (s *Statement) Int16() *Statement { + // notest + t := token{ + content: "int16", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Int32 renders the int32 identifier. +func Int32() *Statement { + // notest + return newStatement().Int32() +} + +// Int32 renders the int32 identifier. +func (g *Group) Int32() *Statement { + // notest + s := Int32() + g.items = append(g.items, s) + return s +} + +// Int32 renders the int32 identifier. +func (s *Statement) Int32() *Statement { + // notest + t := token{ + content: "int32", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Int64 renders the int64 identifier. +func Int64() *Statement { + // notest + return newStatement().Int64() +} + +// Int64 renders the int64 identifier. +func (g *Group) Int64() *Statement { + // notest + s := Int64() + g.items = append(g.items, s) + return s +} + +// Int64 renders the int64 identifier. +func (s *Statement) Int64() *Statement { + // notest + t := token{ + content: "int64", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Rune renders the rune identifier. +func Rune() *Statement { + // notest + return newStatement().Rune() +} + +// Rune renders the rune identifier. +func (g *Group) Rune() *Statement { + // notest + s := Rune() + g.items = append(g.items, s) + return s +} + +// Rune renders the rune identifier. +func (s *Statement) Rune() *Statement { + // notest + t := token{ + content: "rune", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// String renders the string identifier. +func String() *Statement { + // notest + return newStatement().String() +} + +// String renders the string identifier. +func (g *Group) String() *Statement { + // notest + s := String() + g.items = append(g.items, s) + return s +} + +// String renders the string identifier. +func (s *Statement) String() *Statement { + // notest + t := token{ + content: "string", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Uint renders the uint identifier. +func Uint() *Statement { + // notest + return newStatement().Uint() +} + +// Uint renders the uint identifier. +func (g *Group) Uint() *Statement { + // notest + s := Uint() + g.items = append(g.items, s) + return s +} + +// Uint renders the uint identifier. +func (s *Statement) Uint() *Statement { + // notest + t := token{ + content: "uint", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Uint8 renders the uint8 identifier. +func Uint8() *Statement { + // notest + return newStatement().Uint8() +} + +// Uint8 renders the uint8 identifier. +func (g *Group) Uint8() *Statement { + // notest + s := Uint8() + g.items = append(g.items, s) + return s +} + +// Uint8 renders the uint8 identifier. +func (s *Statement) Uint8() *Statement { + // notest + t := token{ + content: "uint8", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Uint16 renders the uint16 identifier. +func Uint16() *Statement { + // notest + return newStatement().Uint16() +} + +// Uint16 renders the uint16 identifier. +func (g *Group) Uint16() *Statement { + // notest + s := Uint16() + g.items = append(g.items, s) + return s +} + +// Uint16 renders the uint16 identifier. +func (s *Statement) Uint16() *Statement { + // notest + t := token{ + content: "uint16", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Uint32 renders the uint32 identifier. +func Uint32() *Statement { + // notest + return newStatement().Uint32() +} + +// Uint32 renders the uint32 identifier. +func (g *Group) Uint32() *Statement { + // notest + s := Uint32() + g.items = append(g.items, s) + return s +} + +// Uint32 renders the uint32 identifier. +func (s *Statement) Uint32() *Statement { + // notest + t := token{ + content: "uint32", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Uint64 renders the uint64 identifier. +func Uint64() *Statement { + // notest + return newStatement().Uint64() +} + +// Uint64 renders the uint64 identifier. +func (g *Group) Uint64() *Statement { + // notest + s := Uint64() + g.items = append(g.items, s) + return s +} + +// Uint64 renders the uint64 identifier. +func (s *Statement) Uint64() *Statement { + // notest + t := token{ + content: "uint64", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Uintptr renders the uintptr identifier. +func Uintptr() *Statement { + // notest + return newStatement().Uintptr() +} + +// Uintptr renders the uintptr identifier. +func (g *Group) Uintptr() *Statement { + // notest + s := Uintptr() + g.items = append(g.items, s) + return s +} + +// Uintptr renders the uintptr identifier. +func (s *Statement) Uintptr() *Statement { + // notest + t := token{ + content: "uintptr", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// True renders the true identifier. +func True() *Statement { + // notest + return newStatement().True() +} + +// True renders the true identifier. +func (g *Group) True() *Statement { + // notest + s := True() + g.items = append(g.items, s) + return s +} + +// True renders the true identifier. +func (s *Statement) True() *Statement { + // notest + t := token{ + content: "true", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// False renders the false identifier. +func False() *Statement { + // notest + return newStatement().False() +} + +// False renders the false identifier. +func (g *Group) False() *Statement { + // notest + s := False() + g.items = append(g.items, s) + return s +} + +// False renders the false identifier. +func (s *Statement) False() *Statement { + // notest + t := token{ + content: "false", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Iota renders the iota identifier. +func Iota() *Statement { + // notest + return newStatement().Iota() +} + +// Iota renders the iota identifier. +func (g *Group) Iota() *Statement { + // notest + s := Iota() + g.items = append(g.items, s) + return s +} + +// Iota renders the iota identifier. +func (s *Statement) Iota() *Statement { + // notest + t := token{ + content: "iota", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Nil renders the nil identifier. +func Nil() *Statement { + // notest + return newStatement().Nil() +} + +// Nil renders the nil identifier. +func (g *Group) Nil() *Statement { + // notest + s := Nil() + g.items = append(g.items, s) + return s +} + +// Nil renders the nil identifier. +func (s *Statement) Nil() *Statement { + // notest + t := token{ + content: "nil", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Err renders the err identifier. +func Err() *Statement { + // notest + return newStatement().Err() +} + +// Err renders the err identifier. +func (g *Group) Err() *Statement { + // notest + s := Err() + g.items = append(g.items, s) + return s +} + +// Err renders the err identifier. +func (s *Statement) Err() *Statement { + // notest + t := token{ + content: "err", + typ: identifierToken, + } + *s = append(*s, t) + return s +} + +// Break renders the break keyword. +func Break() *Statement { + // notest + return newStatement().Break() +} + +// Break renders the break keyword. +func (g *Group) Break() *Statement { + // notest + s := Break() + g.items = append(g.items, s) + return s +} + +// Break renders the break keyword. +func (s *Statement) Break() *Statement { + // notest + t := token{ + content: "break", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Default renders the default keyword. +func Default() *Statement { + // notest + return newStatement().Default() +} + +// Default renders the default keyword. +func (g *Group) Default() *Statement { + // notest + s := Default() + g.items = append(g.items, s) + return s +} + +// Default renders the default keyword. +func (s *Statement) Default() *Statement { + // notest + t := token{ + content: "default", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Func renders the func keyword. +func Func() *Statement { + // notest + return newStatement().Func() +} + +// Func renders the func keyword. +func (g *Group) Func() *Statement { + // notest + s := Func() + g.items = append(g.items, s) + return s +} + +// Func renders the func keyword. +func (s *Statement) Func() *Statement { + // notest + t := token{ + content: "func", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Select renders the select keyword. +func Select() *Statement { + // notest + return newStatement().Select() +} + +// Select renders the select keyword. +func (g *Group) Select() *Statement { + // notest + s := Select() + g.items = append(g.items, s) + return s +} + +// Select renders the select keyword. +func (s *Statement) Select() *Statement { + // notest + t := token{ + content: "select", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Chan renders the chan keyword. +func Chan() *Statement { + // notest + return newStatement().Chan() +} + +// Chan renders the chan keyword. +func (g *Group) Chan() *Statement { + // notest + s := Chan() + g.items = append(g.items, s) + return s +} + +// Chan renders the chan keyword. +func (s *Statement) Chan() *Statement { + // notest + t := token{ + content: "chan", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Else renders the else keyword. +func Else() *Statement { + // notest + return newStatement().Else() +} + +// Else renders the else keyword. +func (g *Group) Else() *Statement { + // notest + s := Else() + g.items = append(g.items, s) + return s +} + +// Else renders the else keyword. +func (s *Statement) Else() *Statement { + // notest + t := token{ + content: "else", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Const renders the const keyword. +func Const() *Statement { + // notest + return newStatement().Const() +} + +// Const renders the const keyword. +func (g *Group) Const() *Statement { + // notest + s := Const() + g.items = append(g.items, s) + return s +} + +// Const renders the const keyword. +func (s *Statement) Const() *Statement { + // notest + t := token{ + content: "const", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Fallthrough renders the fallthrough keyword. +func Fallthrough() *Statement { + // notest + return newStatement().Fallthrough() +} + +// Fallthrough renders the fallthrough keyword. +func (g *Group) Fallthrough() *Statement { + // notest + s := Fallthrough() + g.items = append(g.items, s) + return s +} + +// Fallthrough renders the fallthrough keyword. +func (s *Statement) Fallthrough() *Statement { + // notest + t := token{ + content: "fallthrough", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Type renders the type keyword. +func Type() *Statement { + // notest + return newStatement().Type() +} + +// Type renders the type keyword. +func (g *Group) Type() *Statement { + // notest + s := Type() + g.items = append(g.items, s) + return s +} + +// Type renders the type keyword. +func (s *Statement) Type() *Statement { + // notest + t := token{ + content: "type", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Continue renders the continue keyword. +func Continue() *Statement { + // notest + return newStatement().Continue() +} + +// Continue renders the continue keyword. +func (g *Group) Continue() *Statement { + // notest + s := Continue() + g.items = append(g.items, s) + return s +} + +// Continue renders the continue keyword. +func (s *Statement) Continue() *Statement { + // notest + t := token{ + content: "continue", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Var renders the var keyword. +func Var() *Statement { + // notest + return newStatement().Var() +} + +// Var renders the var keyword. +func (g *Group) Var() *Statement { + // notest + s := Var() + g.items = append(g.items, s) + return s +} + +// Var renders the var keyword. +func (s *Statement) Var() *Statement { + // notest + t := token{ + content: "var", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Goto renders the goto keyword. +func Goto() *Statement { + // notest + return newStatement().Goto() +} + +// Goto renders the goto keyword. +func (g *Group) Goto() *Statement { + // notest + s := Goto() + g.items = append(g.items, s) + return s +} + +// Goto renders the goto keyword. +func (s *Statement) Goto() *Statement { + // notest + t := token{ + content: "goto", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Defer renders the defer keyword. +func Defer() *Statement { + // notest + return newStatement().Defer() +} + +// Defer renders the defer keyword. +func (g *Group) Defer() *Statement { + // notest + s := Defer() + g.items = append(g.items, s) + return s +} + +// Defer renders the defer keyword. +func (s *Statement) Defer() *Statement { + // notest + t := token{ + content: "defer", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Go renders the go keyword. +func Go() *Statement { + // notest + return newStatement().Go() +} + +// Go renders the go keyword. +func (g *Group) Go() *Statement { + // notest + s := Go() + g.items = append(g.items, s) + return s +} + +// Go renders the go keyword. +func (s *Statement) Go() *Statement { + // notest + t := token{ + content: "go", + typ: keywordToken, + } + *s = append(*s, t) + return s +} + +// Range renders the range keyword. +func Range() *Statement { + // notest + return newStatement().Range() +} + +// Range renders the range keyword. +func (g *Group) Range() *Statement { + // notest + s := Range() + g.items = append(g.items, s) + return s +} + +// Range renders the range keyword. +func (s *Statement) Range() *Statement { + // notest + t := token{ + content: "range", + typ: keywordToken, + } + *s = append(*s, t) + return s +} diff --git a/vendor/github.com/dave/jennifer/jen/generated_test.go b/vendor/github.com/dave/jennifer/jen/generated_test.go new file mode 100644 index 00000000..fce14c70 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/generated_test.go @@ -0,0 +1,808 @@ +package jen_test + +import ( + "testing" + + . "github.com/dave/jennifer/jen" +) + +var gencases = []tc{ + { + desc: `bool group`, + code: BlockFunc(func(g *Group) { + g.Bool() + }), + expect: `{ + bool + }`, + }, + { + desc: `recover func`, + code: Recover(), + expect: `recover()`, + }, + { + desc: `recover statement`, + code: Null().Recover(), + expect: `recover()`, + }, + { + desc: `recover group`, + code: BlockFunc(func(g *Group) { + g.Recover() + }), + expect: `{ + recover() + }`, + }, + { + desc: `real func`, + code: Real(Id("a")), + expect: `real(a)`, + }, + { + desc: `real statement`, + code: Null().Real(Id("a")), + expect: `real(a)`, + }, + { + desc: `real group`, + code: BlockFunc(func(g *Group) { + g.Real(Id("a")) + }), + expect: `{ + real(a) + }`, + }, + { + desc: `printlnfunc func`, + code: PrintlnFunc(func(g *Group) { g.Id("a") }), + expect: `println(a)`, + }, + { + desc: `printlnfunc statement`, + code: Null().PrintlnFunc(func(g *Group) { g.Id("a") }), + expect: `println(a)`, + }, + { + desc: `printlnfunc group`, + code: BlockFunc(func(bg *Group) { + bg.PrintlnFunc(func(pg *Group) { pg.Id("a") }) + }), + expect: `{ + println(a) + }`, + }, + { + desc: `println func`, + code: Println(Id("a")), + expect: `println(a)`, + }, + { + desc: `println statement`, + code: Null().Println(Id("a")), + expect: `println(a)`, + }, + { + desc: `println group`, + code: BlockFunc(func(g *Group) { + g.Println(Id("a")) + }), + expect: `{ + println(a) + }`, + }, + { + desc: `printfunc func`, + code: PrintFunc(func(g *Group) { g.Id("a") }), + expect: `print(a)`, + }, + { + desc: `printfunc statement`, + code: Null().PrintFunc(func(g *Group) { g.Id("a") }), + expect: `print(a)`, + }, + { + desc: `printfunc group`, + code: BlockFunc(func(bg *Group) { + bg.PrintFunc(func(pg *Group) { pg.Id("a") }) + }), + expect: `{ + print(a) + }`, + }, + { + desc: `print func`, + code: Print(Id("a")), + expect: `print(a)`, + }, + { + desc: `print statement`, + code: Null().Print(Id("a")), + expect: `print(a)`, + }, + { + desc: `print group`, + code: BlockFunc(func(g *Group) { + g.Print(Id("a")) + }), + expect: `{ + print(a) + }`, + }, + { + desc: `panic func`, + code: Panic(Id("a")), + expect: `panic(a)`, + }, + { + desc: `panic statement`, + code: Null().Panic(Id("a")), + expect: `panic(a)`, + }, + { + desc: `panic group`, + code: BlockFunc(func(g *Group) { + g.Panic(Id("a")) + }), + expect: `{ + panic(a) + }`, + }, + { + desc: `new func`, + code: New(Id("a")), + expect: `new(a)`, + }, + { + desc: `new statement`, + code: Id("a").Op(":=").New(Id("a")), + expect: `a := new(a)`, + }, + { + desc: `new group`, + code: BlockFunc(func(g *Group) { + g.New(Id("a")) + }), + expect: `{ + new(a) + }`, + }, + { + desc: `make func`, + code: Make(Id("a")), + expect: `make(a)`, + }, + { + desc: `make statement`, + code: Id("a").Op(":=").Make(Id("a")), + expect: `a := make(a)`, + }, + { + desc: `make group`, + code: BlockFunc(func(g *Group) { + g.Make(Id("a")) + }), + expect: `{ + make(a) + }`, + }, + { + desc: `len func`, + code: Len(Id("a")), + expect: `len(a)`, + }, + { + desc: `len statement`, + code: Id("a").Op(":=").Len(Id("a")), + expect: `a := len(a)`, + }, + { + desc: `len group`, + code: BlockFunc(func(g *Group) { + g.Len(Id("a")) + }), + expect: `{ + len(a) + }`, + }, + { + desc: `imag func`, + code: Imag(Id("a")), + expect: `imag(a)`, + }, + { + desc: `imag statement`, + code: Id("a").Op(":=").Imag(Id("a")), + expect: `a := imag(a)`, + }, + { + desc: `imag group`, + code: BlockFunc(func(g *Group) { + g.Imag(Id("a")) + }), + expect: `{ + imag(a) + }`, + }, + { + desc: `delete func`, + code: Delete(Id("a"), Id("b")), + expect: `delete(a, b)`, + }, + { + desc: `delete statement`, + code: Null().Delete(Id("a"), Id("b")), + expect: `delete(a, b)`, + }, + { + desc: `delete group`, + code: BlockFunc(func(g *Group) { + g.Delete(Id("a"), Id("b")) + }), + expect: `{ + delete(a, b) + }`, + }, + { + desc: `copy func`, + code: Copy(Id("a"), Id("b")), + expect: `copy(a, b)`, + }, + { + desc: `copy statement`, + code: Id("a").Op(":=").Copy(Id("a"), Id("b")), + expect: `a := copy(a, b)`, + }, + { + desc: `copy group`, + code: BlockFunc(func(g *Group) { + g.Copy(Id("a"), Id("b")) + }), + expect: `{ + copy(a, b) + }`, + }, + { + desc: `complex func`, + code: Complex(Id("a"), Id("b")), + expect: `complex(a, b)`, + }, + { + desc: `complex statement`, + code: Id("a").Op(":=").Complex(Id("a"), Id("b")), + expect: `a := complex(a, b)`, + }, + { + desc: `complex group`, + code: BlockFunc(func(g *Group) { + g.Complex(Id("a"), Id("b")) + }), + expect: `{ + complex(a, b) + }`, + }, + { + desc: `close group`, + code: BlockFunc(func(g *Group) { g.Close(Id("a")) }), + expect: `{ + close(a) + }`, + }, + { + desc: `cap func`, + code: Cap(Id("a")), + expect: `cap(a)`, + }, + { + desc: `cap statement`, + code: Id("a").Op(":=").Cap(Id("b")), + expect: `a := cap(b)`, + }, + { + desc: `cap group`, + code: BlockFunc(func(g *Group) { + g.Cap(Id("a")) + }), + expect: `{ + cap(a) + }`, + }, + { + desc: `append group`, + code: BlockFunc(func(g *Group) { + g.Append(Id("a")) + }), + expect: `{ + append(a) + }`, + }, + { + desc: `appendfunc statement`, + code: Id("a").Op("=").AppendFunc(func(ag *Group) { ag.Id("a") }), + expect: `a = append(a)`, + }, + { + desc: `appendfunc func`, + code: AppendFunc(func(ag *Group) { ag.Id("a") }), + expect: `append(a)`, + }, + { + desc: `appendfunc group`, + code: BlockFunc(func(bg *Group) { + bg.AppendFunc(func(ag *Group) { ag.Id("a") }) + }), + expect: `{ + append(a) + }`, + }, + { + desc: `casefunc group`, + code: Switch().BlockFunc(func(g *Group) { + g.CaseFunc(func(g *Group) { g.Id("a") }).Block() + }), + expect: `switch { + case a: + }`, + }, + { + desc: `case group`, + code: Switch().BlockFunc(func(g *Group) { + g.Case(Id("a")).Block() + }), + expect: `switch { + case a: + }`, + }, + { + desc: `structfunc statement`, + code: Id("a").Op(":=").StructFunc(func(g *Group) {}).Values(), + expect: `a := struct{}{}`, + }, + { + desc: `structfunc group`, + // Don't do this! ListFunc used to kludge Group.Struct usage + // without syntax error. + code: Id("a").Op(":=").ListFunc(func(g *Group) { g.StructFunc(func(g *Group) {}) }).Values(), + expect: `a := struct{}{}`, + }, + { + desc: `structfunc func`, + code: Id("a").Op(":=").Add(StructFunc(func(g *Group) {})).Values(), + expect: `a := struct{}{}`, + }, + { + desc: `struct group`, + // Don't do this! ListFunc used to kludge Group.Struct usage + // without syntax error. + code: Id("a").Op(":=").ListFunc(func(g *Group) { g.Struct() }).Values(), + expect: `a := struct{}{}`, + }, + { + desc: `struct func`, + code: Id("a").Op(":=").Add(Struct()).Values(), + expect: `a := struct{}{}`, + }, + { + desc: `interfacefunc func`, + code: Id("a").Assert(InterfaceFunc(func(g *Group) { + g.Id("a").Call().Int() + g.Id("b").Call().Int() + })), + expect: `a.(interface{ + a() int + b() int + })`, + }, + { + desc: `interfacefunc statement`, + code: Id("a").Assert(Null().InterfaceFunc(func(g *Group) { + g.Id("a").Call().Int() + g.Id("b").Call().Int() + })), + expect: `a.(interface{ + a() int + b() int + })`, + }, + { + desc: `interfacefunc group`, + // Don't do this! ListFunc used to kludge Group.InterfaceFunc usage + // without syntax error. + code: Id("a").Assert(ListFunc(func(lg *Group) { + lg.InterfaceFunc(func(ig *Group) { + ig.Id("a").Call().Int() + ig.Id("b").Call().Int() + }) + })), + expect: `a.(interface{ + a() int + b() int + })`, + }, + { + desc: `interface func`, + code: Interface().Parens(Id("a")), + expect: `interface{}(a)`, + }, + { + desc: `interface group`, + code: BlockFunc(func(g *Group) { + g.Interface().Parens(Id("a")) + }), + expect: `{ + interface{}(a) + }`, + }, + { + desc: `interface statement`, + code: Null().Interface().Parens(Id("a")), + expect: `interface{}(a)`, + }, + { + desc: `switchfunc func`, + code: SwitchFunc(func(rg *Group) { + rg.Id("a") + }).Block(), + expect: `switch a {}`, + }, + { + desc: `switchfunc statement`, + code: Null().SwitchFunc(func(rg *Group) { + rg.Id("a") + }).Block(), + expect: `switch a { + }`, + }, + { + desc: `switchfunc group`, + code: BlockFunc(func(bg *Group) { + bg.SwitchFunc(func(rg *Group) { + rg.Id("a") + }).Block() + }), + expect: `{ + switch a { + } + }`, + }, + { + desc: `switch group`, + code: BlockFunc(func(bg *Group) { + bg.Switch().Block() + }), + expect: `{ + switch { + } + }`, + }, + { + desc: `forfunc func`, + code: ForFunc(func(rg *Group) { + rg.Id("a") + }).Block(), + expect: `for a {}`, + }, + { + desc: `forfunc statement`, + code: Null().ForFunc(func(rg *Group) { + rg.Id("a") + }).Block(), + expect: `for a { + }`, + }, + { + desc: `forfunc group`, + code: BlockFunc(func(bg *Group) { + bg.ForFunc(func(rg *Group) { + rg.Id("a") + }).Block() + }), + expect: `{ + for a { + } + }`, + }, + { + desc: `for group`, + code: BlockFunc(func(g *Group) { + g.For(Id("a")).Block() + }), + expect: `{ + for a {} + }`, + }, + { + desc: `returnfunc func`, + code: ReturnFunc(func(rg *Group) { + rg.Lit(1) + rg.Lit(2) + }), + expect: `return 1, 2`, + }, + { + desc: `returnfunc statement`, + code: Empty().ReturnFunc(func(rg *Group) { + rg.Lit(1) + rg.Lit(2) + }), + expect: `return 1, 2`, + }, + { + desc: `returnfunc group`, + code: BlockFunc(func(bg *Group) { + bg.ReturnFunc(func(rg *Group) { + rg.Lit(1) + rg.Lit(2) + }) + }), + expect: `{ + return 1, 2 + }`, + }, + { + desc: `return group`, + code: BlockFunc(func(g *Group) { + g.Return() + }), + expect: `{ + return + }`, + }, + { + desc: `iffunc group`, + code: BlockFunc(func(bg *Group) { + bg.IfFunc(func(ig *Group) { + ig.Id("a") + }).Block() + }), + expect: `{ + if a {} + }`, + }, + { + desc: `iffunc func`, + code: IfFunc(func(ig *Group) { + ig.Id("a") + }).Block(), + expect: `if a {}`, + }, + { + desc: `iffunc statement`, + code: Null().IfFunc(func(ig *Group) { + ig.Id("a") + }).Block(), + expect: `if a {}`, + }, + { + desc: `if group`, + code: BlockFunc(func(g *Group) { g.If(Id("a")).Block() }), + expect: `{ + if a {} + }`, + }, + { + desc: `map group`, + code: BlockFunc(func(g *Group) { g.Map(Int()).Int().Values(Dict{Lit(1): Lit(1)}) }), + expect: `{ + map[int]int{1:1} + }`, + }, + { + desc: `assert group`, + // Don't do this! ListFunc used to kludge Group.Assert usage without + // syntax error. + code: Id("a").ListFunc(func(g *Group) { g.Assert(Id("b")) }), + expect: `a.(b)`, + }, + { + desc: `assert func`, + code: Id("a").Add(Assert(Id("b"))), + expect: `a.(b)`, + }, + { + desc: `paramsfunc group`, + // Don't do this! ListFunc used to kludge Group.ParamsFunc usage without + // syntax error. + code: Id("a").ListFunc(func(lg *Group) { lg.ParamsFunc(func(cg *Group) { cg.Lit(1) }) }), + expect: `a(1)`, + }, + { + desc: `paramsfunc func`, + code: Id("a").Add(ParamsFunc(func(g *Group) { g.Lit(1) })), + expect: `a(1)`, + }, + { + desc: `paramsfunc statement`, + code: Id("a").ParamsFunc(func(g *Group) { g.Lit(1) }), + expect: `a(1)`, + }, + { + desc: `params group`, + // Don't do this! ListFunc used to kludge Group.Params usage without + // syntax error. + code: Id("a").ListFunc(func(g *Group) { g.Params(Lit(1)) }), + expect: `a(1)`, + }, + { + desc: `params func`, + code: Id("a").Add(Params(Lit(1))), + expect: `a(1)`, + }, + { + desc: `callfunc group`, + // Don't do this! ListFunc used to kludge Group.CallFunc usage without + // syntax error. + code: Id("a").ListFunc(func(lg *Group) { lg.CallFunc(func(cg *Group) { cg.Lit(1) }) }), + expect: `a(1)`, + }, + { + desc: `callfunc func`, + code: Id("a").Add(CallFunc(func(g *Group) { g.Lit(1) })), + expect: `a(1)`, + }, + { + desc: `call group`, + // Don't do this! ListFunc used to kludge Group.Call usage without + // syntax error. + code: Id("a").ListFunc(func(g *Group) { g.Call(Lit(1)) }), + expect: `a(1)`, + }, + { + desc: `call func`, + code: Id("a").Add(Call(Lit(1))), + expect: `a(1)`, + }, + { + desc: `defsfunc statement`, + code: Const().DefsFunc(func(g *Group) { g.Id("a").Op("=").Lit(1) }), + expect: `const ( + a = 1 + )`, + }, + { + desc: `defsfunc func`, + code: Const().Add(DefsFunc(func(g *Group) { g.Id("a").Op("=").Lit(1) })), + expect: `const ( + a = 1 + )`, + }, + { + desc: `defsfunc group`, + // Don't do this! ListFunc used to kludge Group.DefsFunc usage without + // syntax error. + code: Const().ListFunc(func(lg *Group) { lg.DefsFunc(func(dg *Group) { dg.Id("a").Op("=").Lit(1) }) }), + expect: `const ( + a = 1 + )`, + }, + { + desc: `defs group`, + // Don't do this! ListFunc used to kludge Group.Defs usage without + // syntax error. + code: Const().ListFunc(func(g *Group) { g.Defs(Id("a").Op("=").Lit(1)) }), + expect: `const ( + a = 1 + )`, + }, + { + desc: `defs func`, + code: Const().Add(Defs(Id("a").Op("=").Lit(1))), + expect: `const ( + a = 1 + )`, + }, + { + desc: `blockfunc group`, + code: BlockFunc(func(g *Group) { g.BlockFunc(func(g *Group) {}) }), + expect: `{{}}`, + }, + { + desc: `block group`, + code: BlockFunc(func(g *Group) { g.Block() }), + expect: `{{}}`, + }, + { + desc: `indexfunc group`, + code: BlockFunc(func(g *Group) { g.IndexFunc(func(g *Group) { g.Lit(1) }).Int().Values(Lit(1)) }), + expect: `{[1]int{1}}`, + }, + { + desc: `indexfunc statement`, + code: Id("a").IndexFunc(func(g *Group) { g.Lit(1) }), + expect: `a[1]`, + }, + { + desc: `indexfunc func`, + code: Id("a").Add(IndexFunc(func(g *Group) { g.Lit(1) })), + expect: `a[1]`, + }, + { + desc: `index group`, + code: BlockFunc(func(g *Group) { g.Index(Lit(1)).Int().Values(Lit(1)) }), + expect: `{[1]int{1}}`, + }, + { + desc: `index func`, + code: Id("a").Add(Index(Lit(1))), + expect: `a[1]`, + }, + { + desc: `valuesfunc func`, + code: ValuesFunc(func(vg *Group) { + vg.Lit(1) + }), + expect: `{1}`, + }, + { + desc: `valuesfunc group`, + code: BlockFunc(func(bg *Group) { + bg.ValuesFunc(func(vg *Group) { + vg.Lit(1) + }) + }), + expect: `{ + {1} + }`, + }, + { + desc: `values group`, + code: BlockFunc(func(g *Group) { + g.Values(Lit(1)) + }), + expect: `{ + {1} + }`, + }, + { + desc: `listfunc statement`, + code: Add(Null()).ListFunc(func(lg *Group) { + lg.Id("a") + lg.Id("b") + }).Op("=").Id("c"), + expect: `a, b = c`, + }, + { + desc: `listfunc func`, + code: ListFunc(func(lg *Group) { + lg.Id("a") + lg.Id("b") + }).Op("=").Id("c"), + expect: `a, b = c`, + }, + { + desc: `listfunc group`, + code: BlockFunc(func(bg *Group) { + bg.ListFunc(func(lg *Group) { + lg.Id("a") + lg.Id("b") + }).Op("=").Id("c") + }), + expect: `{ + a, b = c + }`, + }, + { + desc: `list group`, + code: BlockFunc(func(g *Group) { g.List(Id("a"), Id("b")).Op("=").Id("c") }), + expect: `{ + a, b = c + }`, + }, + { + desc: `parens func`, + code: Parens(Lit(1)), + expect: `(1)`, + }, + { + desc: `parens group`, + code: BlockFunc(func(g *Group) { g.Parens(Lit(1)) }), + expect: `{ + (1) + }`, + }, +} + +func TestGen(t *testing.T) { + caseTester(t, gencases) +} diff --git a/vendor/github.com/dave/jennifer/jen/group.go b/vendor/github.com/dave/jennifer/jen/group.go new file mode 100644 index 00000000..0b85c901 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/group.go @@ -0,0 +1,147 @@ +package jen + +import ( + "bytes" + "fmt" + "go/format" + "io" +) + +// Group represents a list of Code items, separated by tokens with an optional +// open and close token. +type Group struct { + name string + items []Code + open string + close string + separator string + multi bool +} + +func (g *Group) isNull(f *File) bool { + if g == nil { + return true + } + if g.open != "" || g.close != "" { + return false + } + for _, c := range g.items { + if !c.isNull(f) { + return false + } + } + return true +} + +func (g *Group) render(f *File, w io.Writer, s *Statement) error { + if g.name == "block" && s != nil { + // Special CaseBlock format for then the previous item in the statement + // is a Case group or the default keyword. + prev := s.previous(g) + grp, isGrp := prev.(*Group) + tkn, isTkn := prev.(token) + if isGrp && grp.name == "case" || isTkn && tkn.content == "default" { + g.open = "" + g.close = "" + } + } + if g.open != "" { + if _, err := w.Write([]byte(g.open)); err != nil { + return err + } + } + isNull, err := g.renderItems(f, w) + if err != nil { + return err + } + if !isNull && g.multi && g.close != "" { + // For multi-line blocks with a closing token, we insert a new line after the last item (but + // not if all items were null). This is to ensure that if the statement finishes with a comment, + // the closing token is not commented out. + s := "\n" + if g.separator == "," { + // We also insert add trailing comma if the separator was ",". + s = ",\n" + } + if _, err := w.Write([]byte(s)); err != nil { + return err + } + } + if g.close != "" { + if _, err := w.Write([]byte(g.close)); err != nil { + return err + } + } + return nil +} + +func (g *Group) renderItems(f *File, w io.Writer) (isNull bool, err error) { + first := true + for _, code := range g.items { + if pt, ok := code.(token); ok && pt.typ == packageToken { + // Special case for package tokens in Qual groups - for dot-imports, the package token + // will be null, so will not render and will not be registered in the imports block. + // This ensures all packageTokens that are rendered are registered. + f.register(pt.content.(string)) + } + if code == nil || code.isNull(f) { + // Null() token produces no output but also + // no separator. Empty() token products no + // output but adds a separator. + continue + } + if g.name == "values" { + if _, ok := code.(Dict); ok && len(g.items) > 1 { + panic("Error in Values: if Dict is used, must be one item only") + } + } + if !first && g.separator != "" { + // The separator token is added before each non-null item, but not before the first item. + if _, err := w.Write([]byte(g.separator)); err != nil { + return false, err + } + } + if g.multi { + // For multi-line blocks, we insert a new line before each non-null item. + if _, err := w.Write([]byte("\n")); err != nil { + return false, err + } + } + if err := code.render(f, w, nil); err != nil { + return false, err + } + first = false + } + return first, nil +} + +// Render renders the Group to the provided writer. +func (g *Group) Render(writer io.Writer) error { + return g.RenderWithFile(writer, NewFile("")) +} + +// GoString renders the Group for testing. Any error will cause a panic. +func (g *Group) GoString() string { + buf := bytes.Buffer{} + if err := g.Render(&buf); err != nil { + panic(err) + } + return buf.String() +} + +// RenderWithFile renders the Group to the provided writer, using imports from the provided file. +func (g *Group) RenderWithFile(writer io.Writer, file *File) error { + buf := &bytes.Buffer{} + if err := g.render(file, buf, nil); err != nil { + return err + } + b, err := format.Source(buf.Bytes()) + if err != nil { + return fmt.Errorf("Error %s while formatting source:\n%s", err, buf.String()) + } + if _, err := writer.Write(b); err != nil { + return err + } + return nil +} + diff --git a/vendor/github.com/dave/jennifer/jen/group_test.go b/vendor/github.com/dave/jennifer/jen/group_test.go new file mode 100644 index 00000000..0e9489e4 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/group_test.go @@ -0,0 +1,35 @@ +package jen_test + +import ( + "bytes" + "testing" + + . "github.com/dave/jennifer/jen" +) + +func TestGroup_Render(t *testing.T) { + file := NewFile("main") + file.ImportAlias("fmt", "fmtalias") + + var g *Group + BlockFunc(func(group *Group) { + g = group + }) + + g.Qual("fmt", "Errorf").Call(Lit("error")) + + expect := `{ + fmtalias.Errorf("error") +}` + + var got bytes.Buffer + + err := g.RenderWithFile(&got, file) + if err != nil { + t.Fatal(err) + } + + if got.String() != expect { + t.Fatalf("Got: %v, expect: %v", got.String(), expect) + } +} diff --git a/vendor/github.com/dave/jennifer/jen/hints.go b/vendor/github.com/dave/jennifer/jen/hints.go new file mode 100644 index 00000000..7bc307a6 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/hints.go @@ -0,0 +1,273 @@ +// This file is generated - do not edit. + +package jen + +// standardLibraryHints contains package name hints +var standardLibraryHints = map[string]string{ + "archive/tar": "tar", + "archive/zip": "zip", + "bufio": "bufio", + "builtin": "builtin", + "bytes": "bytes", + "cmd/asm/internal/arch": "arch", + "cmd/asm/internal/asm": "asm", + "cmd/asm/internal/flags": "flags", + "cmd/asm/internal/lex": "lex", + "cmd/compile/internal/amd64": "amd64", + "cmd/compile/internal/arm": "arm", + "cmd/compile/internal/arm64": "arm64", + "cmd/compile/internal/gc": "gc", + "cmd/compile/internal/mips": "mips", + "cmd/compile/internal/mips64": "mips64", + "cmd/compile/internal/ppc64": "ppc64", + "cmd/compile/internal/s390x": "s390x", + "cmd/compile/internal/ssa": "ssa", + "cmd/compile/internal/syntax": "syntax", + "cmd/compile/internal/test": "test", + "cmd/compile/internal/types": "types", + "cmd/compile/internal/wasm": "wasm", + "cmd/compile/internal/x86": "x86", + "cmd/go/internal/base": "base", + "cmd/go/internal/bug": "bug", + "cmd/go/internal/cache": "cache", + "cmd/go/internal/cfg": "cfg", + "cmd/go/internal/clean": "clean", + "cmd/go/internal/cmdflag": "cmdflag", + "cmd/go/internal/dirhash": "dirhash", + "cmd/go/internal/doc": "doc", + "cmd/go/internal/envcmd": "envcmd", + "cmd/go/internal/fix": "fix", + "cmd/go/internal/fmtcmd": "fmtcmd", + "cmd/go/internal/generate": "generate", + "cmd/go/internal/get": "get", + "cmd/go/internal/help": "help", + "cmd/go/internal/imports": "imports", + "cmd/go/internal/list": "list", + "cmd/go/internal/load": "load", + "cmd/go/internal/modcmd": "modcmd", + "cmd/go/internal/modconv": "modconv", + "cmd/go/internal/modfetch": "modfetch", + "cmd/go/internal/modfetch/codehost": "codehost", + "cmd/go/internal/modfile": "modfile", + "cmd/go/internal/modget": "modget", + "cmd/go/internal/modinfo": "modinfo", + "cmd/go/internal/modload": "modload", + "cmd/go/internal/module": "module", + "cmd/go/internal/mvs": "mvs", + "cmd/go/internal/par": "par", + "cmd/go/internal/run": "run", + "cmd/go/internal/search": "search", + "cmd/go/internal/semver": "semver", + "cmd/go/internal/str": "str", + "cmd/go/internal/test": "test", + "cmd/go/internal/tool": "tool", + "cmd/go/internal/txtar": "txtar", + "cmd/go/internal/version": "version", + "cmd/go/internal/vet": "vet", + "cmd/go/internal/web": "web", + "cmd/go/internal/web2": "web2", + "cmd/go/internal/webtest": "webtest", + "cmd/go/internal/work": "work", + "cmd/internal/bio": "bio", + "cmd/internal/browser": "browser", + "cmd/internal/buildid": "buildid", + "cmd/internal/dwarf": "dwarf", + "cmd/internal/edit": "edit", + "cmd/internal/gcprog": "gcprog", + "cmd/internal/goobj": "goobj", + "cmd/internal/obj": "obj", + "cmd/internal/obj/arm": "arm", + "cmd/internal/obj/arm64": "arm64", + "cmd/internal/obj/mips": "mips", + "cmd/internal/obj/ppc64": "ppc64", + "cmd/internal/obj/s390x": "s390x", + "cmd/internal/obj/wasm": "wasm", + "cmd/internal/obj/x86": "x86", + "cmd/internal/objabi": "objabi", + "cmd/internal/objfile": "objfile", + "cmd/internal/src": "src", + "cmd/internal/sys": "sys", + "cmd/internal/test2json": "test2json", + "cmd/link/internal/amd64": "amd64", + "cmd/link/internal/arm": "arm", + "cmd/link/internal/arm64": "arm64", + "cmd/link/internal/ld": "ld", + "cmd/link/internal/loadelf": "loadelf", + "cmd/link/internal/loadmacho": "loadmacho", + "cmd/link/internal/loadpe": "loadpe", + "cmd/link/internal/mips": "mips", + "cmd/link/internal/mips64": "mips64", + "cmd/link/internal/objfile": "objfile", + "cmd/link/internal/ppc64": "ppc64", + "cmd/link/internal/s390x": "s390x", + "cmd/link/internal/sym": "sym", + "cmd/link/internal/wasm": "wasm", + "cmd/link/internal/x86": "x86", + "cmd/vet/internal/cfg": "cfg", + "cmd/vet/internal/whitelist": "whitelist", + "compress/bzip2": "bzip2", + "compress/flate": "flate", + "compress/gzip": "gzip", + "compress/lzw": "lzw", + "compress/zlib": "zlib", + "container/heap": "heap", + "container/list": "list", + "container/ring": "ring", + "context": "context", + "crypto": "crypto", + "crypto/aes": "aes", + "crypto/cipher": "cipher", + "crypto/des": "des", + "crypto/dsa": "dsa", + "crypto/ecdsa": "ecdsa", + "crypto/elliptic": "elliptic", + "crypto/hmac": "hmac", + "crypto/internal/randutil": "randutil", + "crypto/internal/subtle": "subtle", + "crypto/md5": "md5", + "crypto/rand": "rand", + "crypto/rc4": "rc4", + "crypto/rsa": "rsa", + "crypto/sha1": "sha1", + "crypto/sha256": "sha256", + "crypto/sha512": "sha512", + "crypto/subtle": "subtle", + "crypto/tls": "tls", + "crypto/x509": "x509", + "crypto/x509/pkix": "pkix", + "database/sql": "sql", + "database/sql/driver": "driver", + "debug/dwarf": "dwarf", + "debug/elf": "elf", + "debug/gosym": "gosym", + "debug/macho": "macho", + "debug/pe": "pe", + "debug/plan9obj": "plan9obj", + "encoding": "encoding", + "encoding/ascii85": "ascii85", + "encoding/asn1": "asn1", + "encoding/base32": "base32", + "encoding/base64": "base64", + "encoding/binary": "binary", + "encoding/csv": "csv", + "encoding/gob": "gob", + "encoding/hex": "hex", + "encoding/json": "json", + "encoding/pem": "pem", + "encoding/xml": "xml", + "errors": "errors", + "expvar": "expvar", + "flag": "flag", + "fmt": "fmt", + "go/ast": "ast", + "go/build": "build", + "go/constant": "constant", + "go/doc": "doc", + "go/format": "format", + "go/importer": "importer", + "go/internal/gccgoimporter": "gccgoimporter", + "go/internal/gcimporter": "gcimporter", + "go/internal/srcimporter": "srcimporter", + "go/parser": "parser", + "go/printer": "printer", + "go/scanner": "scanner", + "go/token": "token", + "go/types": "types", + "hash": "hash", + "hash/adler32": "adler32", + "hash/crc32": "crc32", + "hash/crc64": "crc64", + "hash/fnv": "fnv", + "html": "html", + "html/template": "template", + "image": "image", + "image/color": "color", + "image/color/palette": "palette", + "image/draw": "draw", + "image/gif": "gif", + "image/internal/imageutil": "imageutil", + "image/jpeg": "jpeg", + "image/png": "png", + "index/suffixarray": "suffixarray", + "internal/bytealg": "bytealg", + "internal/cpu": "cpu", + "internal/nettrace": "nettrace", + "internal/poll": "poll", + "internal/race": "race", + "internal/singleflight": "singleflight", + "internal/syscall/unix": "unix", + "internal/syscall/windows": "windows", + "internal/syscall/windows/registry": "registry", + "internal/syscall/windows/sysdll": "sysdll", + "internal/testenv": "testenv", + "internal/testlog": "testlog", + "internal/trace": "trace", + "io": "io", + "io/ioutil": "ioutil", + "log": "log", + "log/syslog": "syslog", + "math": "math", + "math/big": "big", + "math/bits": "bits", + "math/cmplx": "cmplx", + "math/rand": "rand", + "mime": "mime", + "mime/multipart": "multipart", + "mime/quotedprintable": "quotedprintable", + "net": "net", + "net/http": "http", + "net/http/cgi": "cgi", + "net/http/cookiejar": "cookiejar", + "net/http/fcgi": "fcgi", + "net/http/httptest": "httptest", + "net/http/httptrace": "httptrace", + "net/http/httputil": "httputil", + "net/http/internal": "internal", + "net/http/pprof": "pprof", + "net/internal/socktest": "socktest", + "net/mail": "mail", + "net/rpc": "rpc", + "net/rpc/jsonrpc": "jsonrpc", + "net/smtp": "smtp", + "net/textproto": "textproto", + "net/url": "url", + "os": "os", + "os/exec": "exec", + "os/signal": "signal", + "os/signal/internal/pty": "pty", + "os/user": "user", + "path": "path", + "path/filepath": "filepath", + "plugin": "plugin", + "reflect": "reflect", + "regexp": "regexp", + "regexp/syntax": "syntax", + "runtime": "runtime", + "runtime/cgo": "cgo", + "runtime/debug": "debug", + "runtime/internal/atomic": "atomic", + "runtime/internal/sys": "sys", + "runtime/pprof": "pprof", + "runtime/pprof/internal/profile": "profile", + "runtime/race": "race", + "runtime/trace": "trace", + "sort": "sort", + "strconv": "strconv", + "strings": "strings", + "sync": "sync", + "sync/atomic": "atomic", + "syscall": "syscall", + "testing": "testing", + "testing/internal/testdeps": "testdeps", + "testing/iotest": "iotest", + "testing/quick": "quick", + "text/scanner": "scanner", + "text/tabwriter": "tabwriter", + "text/template": "template", + "text/template/parse": "parse", + "time": "time", + "unicode": "unicode", + "unicode/utf16": "utf16", + "unicode/utf8": "utf8", + "unsafe": "unsafe", +} diff --git a/vendor/github.com/dave/jennifer/jen/jen.go b/vendor/github.com/dave/jennifer/jen/jen.go new file mode 100644 index 00000000..4cf480a1 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/jen.go @@ -0,0 +1,168 @@ +// Package jen is a code generator for Go +package jen + +import ( + "bytes" + "fmt" + "go/format" + "io" + "io/ioutil" + "sort" + "strconv" +) + +// Code represents an item of code that can be rendered. +type Code interface { + render(f *File, w io.Writer, s *Statement) error + isNull(f *File) bool +} + +// Save renders the file and saves to the filename provided. +func (f *File) Save(filename string) error { + // notest + buf := &bytes.Buffer{} + if err := f.Render(buf); err != nil { + return err + } + if err := ioutil.WriteFile(filename, buf.Bytes(), 0644); err != nil { + return err + } + return nil +} + +// Render renders the file to the provided writer. +func (f *File) Render(w io.Writer) error { + body := &bytes.Buffer{} + if err := f.render(f, body, nil); err != nil { + return err + } + source := &bytes.Buffer{} + if len(f.headers) > 0 { + for _, c := range f.headers { + if err := Comment(c).render(f, source, nil); err != nil { + return err + } + if _, err := fmt.Fprint(source, "\n"); err != nil { + return err + } + } + // Append an extra newline so that header comments don't get lumped in + // with package comments. + if _, err := fmt.Fprint(source, "\n"); err != nil { + return err + } + } + for _, c := range f.comments { + if err := Comment(c).render(f, source, nil); err != nil { + return err + } + if _, err := fmt.Fprint(source, "\n"); err != nil { + return err + } + } + if _, err := fmt.Fprintf(source, "package %s", f.name); err != nil { + return err + } + if f.CanonicalPath != "" { + if _, err := fmt.Fprintf(source, " // import %q", f.CanonicalPath); err != nil { + return err + } + } + if _, err := fmt.Fprint(source, "\n\n"); err != nil { + return err + } + if err := f.renderImports(source); err != nil { + return err + } + if _, err := source.Write(body.Bytes()); err != nil { + return err + } + formatted, err := format.Source(source.Bytes()) + if err != nil { + return fmt.Errorf("Error %s while formatting source:\n%s", err, source.String()) + } + if _, err := w.Write(formatted); err != nil { + return err + } + return nil +} + +func (f *File) renderImports(source io.Writer) error { + + // Render the "C" import if it's been used in a `Qual`, `Anon` or if there's a preamble comment + hasCgo := f.imports["C"].name != "" || len(f.cgoPreamble) > 0 + + // Only separate the import from the main imports block if there's a preamble + separateCgo := hasCgo && len(f.cgoPreamble) > 0 + + filtered := map[string]importdef{} + for path, def := range f.imports { + // filter out the "C" pseudo-package so it's not rendered in a block with the other + // imports, but only if it is accompanied by a preamble comment + if path == "C" && separateCgo { + continue + } + filtered[path] = def + } + + if len(filtered) == 1 { + for path, def := range filtered { + if def.alias && path != "C" { + // "C" package should be rendered without alias even when used as an anonymous import + // (e.g. should never have an underscore). + if _, err := fmt.Fprintf(source, "import %s %s\n\n", def.name, strconv.Quote(path)); err != nil { + return err + } + } else { + if _, err := fmt.Fprintf(source, "import %s\n\n", strconv.Quote(path)); err != nil { + return err + } + } + } + } else if len(filtered) > 1 { + if _, err := fmt.Fprint(source, "import (\n"); err != nil { + return err + } + // We must sort the imports to ensure repeatable + // source. + paths := []string{} + for path := range filtered { + paths = append(paths, path) + } + sort.Strings(paths) + for _, path := range paths { + def := filtered[path] + if def.alias && path != "C" { + // "C" package should be rendered without alias even when used as an anonymous import + // (e.g. should never have an underscore). + if _, err := fmt.Fprintf(source, "%s %s\n", def.name, strconv.Quote(path)); err != nil { + return err + } + + } else { + if _, err := fmt.Fprintf(source, "%s\n", strconv.Quote(path)); err != nil { + return err + } + } + } + if _, err := fmt.Fprint(source, ")\n\n"); err != nil { + return err + } + } + + if separateCgo { + for _, c := range f.cgoPreamble { + if err := Comment(c).render(f, source, nil); err != nil { + return err + } + if _, err := fmt.Fprint(source, "\n"); err != nil { + return err + } + } + if _, err := fmt.Fprint(source, "import \"C\"\n\n"); err != nil { + return err + } + } + + return nil +} diff --git a/vendor/github.com/dave/jennifer/jen/jen_test.go b/vendor/github.com/dave/jennifer/jen/jen_test.go new file mode 100644 index 00000000..ade18362 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/jen_test.go @@ -0,0 +1,550 @@ +package jen_test + +import ( + "fmt" + "go/format" + "strings" + "testing" + + . "github.com/dave/jennifer/jen" +) + +var o1 = Options{ + Close: ")", + Multi: true, + Open: "(", + Separator: ",", +} + +var o2 = Options{ + Close: "", + Multi: false, + Open: "", + Separator: ",", +} + +var cases = []tc{ + { + desc: `scientific notation`, + code: Lit(1e3), + expect: `1000.0`, + }, + { + desc: `big float`, + code: Lit(1000000.0), + expect: `1e+06`, + }, + { + desc: `lit float whole numbers`, + code: Index().Float64().Values(Lit(-10.0), Lit(-2.0), Lit(-1.0), Lit(0.0), Lit(1.0), Lit(2.0), Lit(10.0)), + expect: "[]float64{-10.0, -2.0, -1.0, 0.0, 1.0, 2.0, 10.0}", + }, + { + desc: `custom func group`, + code: ListFunc(func(g *Group) { + g.CustomFunc(o2, func(g *Group) { + g.Id("a") + g.Id("b") + g.Id("c") + }) + }).Op("=").Id("foo").Call(), + expect: `a, b, c = foo()`, + }, + { + desc: `custom group`, + code: ListFunc(func(g *Group) { g.Custom(o2, Id("a"), Id("b"), Id("c")) }).Op("=").Id("foo").Call(), + expect: `a, b, c = foo()`, + }, + { + desc: `custom function`, + code: Id("foo").Add(Custom(o1, Lit("a"), Lit("b"), Lit("c"))), + expect: `foo( + "a", + "b", + "c", + )`, + }, + { + desc: `custom function`, + code: Id("foo").Add(Custom(o1, Lit("a"), Lit("b"), Lit("c"))), + expect: `foo( + "a", + "b", + "c", + )`, + }, + { + desc: `line statement`, + code: Block(Lit(1).Line(), Lit(2)), + expect: `{ + 1 + + 2 + }`, + }, + { + desc: `line func`, + code: Block(Lit(1), Line(), Lit(2)), + expect: `{ + 1 + + 2 + }`, + }, + { + desc: `line group`, + code: BlockFunc(func(g *Group) { + g.Id("a") + g.Line() + g.Id("b") + }), + expect: `{ + a + + b + }`, + }, + { + desc: `op group`, + code: BlockFunc(func(g *Group) { + g.Op("*").Id("a") + }), + expect: `{*a}`, + }, + { + desc: `empty group`, + code: BlockFunc(func(g *Group) { + g.Empty() + }), + expect: `{ + + }`, + }, + { + desc: `null group`, + code: BlockFunc(func(g *Group) { + g.Null() + }), + expect: `{}`, + }, + { + desc: `tag no backquote`, + code: Tag(map[string]string{"a": "`b`"}), + expect: "\"a:\\\"`b`\\\"\"", + }, + { + desc: `tag null`, + code: Tag(map[string]string{}), + expect: ``, + }, + { + desc: `litrunefunc group`, + code: BlockFunc(func(g *Group) { + g.LitByteFunc(func() byte { return byte(0xab) }) + }), + expect: `{byte(0xab)}`, + }, + { + desc: `litbyte group`, + code: BlockFunc(func(g *Group) { + g.LitByte(byte(0xab)) + }), + expect: `{byte(0xab)}`, + }, + { + desc: `litrunefunc group`, + code: BlockFunc(func(g *Group) { + g.LitRuneFunc(func() rune { return 'a' }) + }), + expect: `{'a'}`, + }, + { + desc: `litrune group`, + code: BlockFunc(func(g *Group) { + g.LitRune('a') + }), + expect: `{'a'}`, + }, + { + desc: `litfunc group`, + code: BlockFunc(func(g *Group) { + g.LitFunc(func() interface{} { + return 1 + 1 + }) + }), + expect: `{2}`, + }, + { + desc: `litfunc func`, + code: LitFunc(func() interface{} { + return 1 + 1 + }), + expect: `2`, + }, + { + desc: `group all null`, + code: List(Null(), Null()), + expect: ``, + }, + { + desc: `do group`, + code: BlockFunc(func(g *Group) { g.Do(func(s *Statement) { s.Lit(1) }) }), + expect: `{1}`, + }, + { + desc: `do func`, + code: Do(func(s *Statement) { s.Lit(1) }), + expect: `1`, + }, + { + desc: `dict empty`, + code: Values(Dict{}), + expect: `{}`, + }, + { + desc: `dict null`, + code: Values(Dict{Null(): Null()}), + expect: `{}`, + }, + { + desc: `commentf group`, + code: BlockFunc(func(g *Group) { g.Commentf("%d", 1) }), + expect: `{ + // 1 + }`, + }, + { + desc: `commentf func`, + code: Commentf("%d", 1), + expect: `// 1`, + }, + { + desc: `add func`, + code: Add(Lit(1)), + expect: `1`, + }, + { + desc: `add group`, + code: BlockFunc(func(g *Group) { g.Add(Lit(1)) }), + expect: `{1}`, + }, + { + desc: `empty block`, + code: Block(), + expect: `{}`, + }, + { + desc: `string literal`, + code: Lit("a"), + expect: `"a"`, + }, + { + desc: `int literal`, + code: Lit(1), + expect: `1`, + }, + { + desc: `simple id`, + code: Id("a"), + expect: `a`, + }, + { + desc: `foreign id`, + code: Qual("x.y/z", "a"), + expect: `z.a`, + expectImports: map[string]string{ + "x.y/z": "z", + }, + }, + { + desc: `var decl`, + code: Var().Id("a").Op("=").Lit("b"), + expect: `var a = "b"`, + }, + { + desc: `short var decl`, + code: Id("a").Op(":=").Lit("b"), + expect: `a := "b"`, + }, + { + desc: `simple if`, + code: If(Id("a").Op("==").Lit("b")).Block(), + expect: `if a == "b" {}`, + }, + { + desc: `simple if`, + code: If(Id("a").Op("==").Lit("b")).Block( + Id("a").Op("++"), + ), + expect: `if a == "b" { a++ }`, + }, + { + desc: `pointer`, + code: Op("*").Id("a"), + expect: `*a`, + }, + { + desc: `address`, + code: Op("&").Id("a"), + expect: `&a`, + }, + { + desc: `simple call`, + code: Id("a").Call( + Lit("b"), + Lit("c"), + ), + expect: `a("b", "c")`, + }, + { + desc: `call fmt.Sprintf`, + code: Qual("fmt", "Sprintf").Call( + Lit("b"), + Id("c"), + ), + expect: `fmt.Sprintf("b", c)`, + }, + { + desc: `slices`, + code: Id("a").Index( + Lit(1), + Empty(), + ), + expect: `a[1:]`, + }, + { + desc: `return`, + code: Return(Id("a")), + expect: `return a`, + }, + { + desc: `double return`, + code: Return(Id("a"), Id("b")), + expect: `return a, b`, + }, + { + desc: `func`, + code: Func().Id("a").Params( + Id("a").String(), + ).Block( + Return(Id("a")), + ), + expect: `func a(a string){ + return a + }`, + }, + { + desc: `built in func`, + code: New(Id("a")), + expect: `new(a)`, + }, + { + desc: `multip`, + code: Id("a").Op("*").Id("b"), + expect: `a * b`, + }, + { + desc: `multip ptr`, + code: Id("a").Op("*").Op("*").Id("b"), + expect: `a * *b`, + }, + { + desc: `field`, + code: Id("a").Dot("b"), + expect: `a.b`, + }, + { + desc: `method`, + code: Id("a").Dot("b").Call(Id("c"), Id("d")), + expect: `a.b(c, d)`, + }, + { + desc: `if else`, + code: If(Id("a").Op("==").Lit(1)).Block( + Id("b").Op("=").Lit(1), + ).Else().If(Id("a").Op("==").Lit(2)).Block( + Id("b").Op("=").Lit(2), + ).Else().Block( + Id("b").Op("=").Lit(3), + ), + expect: `if a == 1 { b = 1 } else if a == 2 { b = 2 } else { b = 3 }`, + }, + { + desc: `literal array`, + code: Index().String().Values(Lit("a"), Lit("b")), + expect: `[]string{"a", "b"}`, + }, + { + desc: `comment`, + code: Comment("a"), + expect: `// a`, + }, + { + desc: `null`, + code: Id("a").Params(Id("b"), Null(), Id("c")), + expect: `a(b, c)`, + }, + { + desc: `map literal single`, + code: Id("a").Values(Dict{ + Id("b"): Id("c"), + }), + expect: `a{b: c}`, + }, + { + desc: `map literal null`, + code: Id("a").Values(Dict{ + Null(): Id("c"), + Id("b"): Null(), + Id("b"): Id("c"), + }), + expect: `a{b: c}`, + }, + { + desc: `map literal multiple`, + code: Id("a").Values(Dict{ + Id("b"): Id("c"), + Id("d"): Id("e"), + }), + expect: `a{ + b: c, + d: e, + }`, + }, + { + desc: `map literal func single`, + code: Id("a").Values(DictFunc(func(d Dict) { + d[Id("b")] = Id("c") + })), + expect: `a{b: c}`, + }, + { + desc: `map literal func single null`, + code: Id("a").Values(DictFunc(func(d Dict) { + d[Null()] = Id("c") + d[Id("b")] = Null() + d[Id("b")] = Id("c") + })), + expect: `a{b: c}`, + }, + { + desc: `map literal func multiple`, + code: Id("a").Values(DictFunc(func(d Dict) { + d[Id("b")] = Id("c") + d[Id("d")] = Id("e") + })), + expect: `a{ + b: c, + d: e, + }`, + }, + { + desc: `literal func`, + code: Id("a").Op(":=").LitFunc(func() interface{} { + return "b" + }), + expect: `a := "b"`, + }, + { + desc: `dot`, + code: Id("a").Dot("b").Dot("c"), + expect: `a.b.c`, + }, + { + desc: `do`, + code: Id("a").Do(func(s *Statement) { s.Dot("b") }), + expect: `a.b`, + }, + { + desc: `tags should be ordered`, + code: Tag(map[string]string{"z": "1", "a": "2"}), + expect: "`a:\"2\" z:\"1\"`", + }, + { + desc: `dict should be ordered`, + code: Map(String()).Int().Values(Dict{Id("z"): Lit(1), Id("a"): Lit(2)}), + expect: `map[string]int{ + a:2, + z:1, + }`, + }, +} + +func TestJen(t *testing.T) { + caseTester(t, cases) +} + +func caseTester(t *testing.T, cases []tc) { + for i, c := range cases { + onlyTest := "" + if onlyTest != "" && c.desc != onlyTest { + continue + } + rendered := fmt.Sprintf("%#v", c.code) + + expected, err := format.Source([]byte(c.expect)) + if err != nil { + panic(fmt.Sprintf("Error formatting expected source in test case %d. Description: %s\nError:\n%s", i, c.desc, err)) + } + + if strings.TrimSpace(string(rendered)) != strings.TrimSpace(string(expected)) { + t.Errorf("Test case %d failed. Description: %s\nExpected:\n%s\nOutput:\n%s", i, c.desc, expected, rendered) + } + + //if c.expectImports != nil { + // f := FromContext(ctx) + // if !reflect.DeepEqual(f.Imports, c.expectImports) { + // t.Errorf("Test case %d failed. Description: %s\nImports expected:\n%s\nOutput:\n%s", i, c.desc, c.expectImports, f.Imports) + // } + //} + } +} + +// a test case +type tc struct { + // path + path string + // description for locating the test case + desc string + // code to generate + code Code + // expected generated source + expect string + // expected imports + expectImports map[string]string +} + +func TestNilStatement(t *testing.T) { + var s *Statement + c := Func().Id("a").Params( + s, + ) + got := fmt.Sprintf("%#v", c) + expect := "func a()" + if got != expect { + t.Fatalf("Got: %s, expect: %s", got, expect) + } +} + +func TestNilGroup(t *testing.T) { + var g *Group + c := Func().Id("a").Params( + g, + ) + got := fmt.Sprintf("%#v", c) + expect := "func a()" + if got != expect { + t.Fatalf("Got: %s, expect: %s", got, expect) + } +} + +func TestGroup_GoString(t *testing.T) { + BlockFunc(func(g *Group) { + g.Lit(1) + got := fmt.Sprintf("%#v", g) + expect := "{\n\t1\n}" + if got != expect { + t.Fatalf("Got: %s, expect: %s", got, expect) + } + }) +} diff --git a/vendor/github.com/dave/jennifer/jen/lit.go b/vendor/github.com/dave/jennifer/jen/lit.go new file mode 100644 index 00000000..9791f1d2 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/lit.go @@ -0,0 +1,154 @@ +package jen + +// Lit renders a literal. Lit supports only built-in types (bool, string, int, complex128, float64, +// float32, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr and complex64). +// Passing any other type will panic. +func Lit(v interface{}) *Statement { + return newStatement().Lit(v) +} + +// Lit renders a literal. Lit supports only built-in types (bool, string, int, complex128, float64, +// float32, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr and complex64). +// Passing any other type will panic. +func (g *Group) Lit(v interface{}) *Statement { + s := Lit(v) + g.items = append(g.items, s) + return s +} + +// Lit renders a literal. Lit supports only built-in types (bool, string, int, complex128, float64, +// float32, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr and complex64). +// Passing any other type will panic. +func (s *Statement) Lit(v interface{}) *Statement { + t := token{ + typ: literalToken, + content: v, + } + *s = append(*s, t) + return s +} + +// LitFunc renders a literal. LitFunc generates the value to render by executing the provided +// function. LitFunc supports only built-in types (bool, string, int, complex128, float64, float32, +// int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr and complex64). +// Returning any other type will panic. +func LitFunc(f func() interface{}) *Statement { + return newStatement().LitFunc(f) +} + +// LitFunc renders a literal. LitFunc generates the value to render by executing the provided +// function. LitFunc supports only built-in types (bool, string, int, complex128, float64, float32, +// int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr and complex64). +// Returning any other type will panic. +func (g *Group) LitFunc(f func() interface{}) *Statement { + s := LitFunc(f) + g.items = append(g.items, s) + return s +} + +// LitFunc renders a literal. LitFunc generates the value to render by executing the provided +// function. LitFunc supports only built-in types (bool, string, int, complex128, float64, float32, +// int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr and complex64). +// Returning any other type will panic. +func (s *Statement) LitFunc(f func() interface{}) *Statement { + t := token{ + typ: literalToken, + content: f(), + } + *s = append(*s, t) + return s +} + +// LitRune renders a rune literal. +func LitRune(v rune) *Statement { + return newStatement().LitRune(v) +} + +// LitRune renders a rune literal. +func (g *Group) LitRune(v rune) *Statement { + s := LitRune(v) + g.items = append(g.items, s) + return s +} + +// LitRune renders a rune literal. +func (s *Statement) LitRune(v rune) *Statement { + t := token{ + typ: literalRuneToken, + content: v, + } + *s = append(*s, t) + return s +} + +// LitRuneFunc renders a rune literal. LitRuneFunc generates the value to +// render by executing the provided function. +func LitRuneFunc(f func() rune) *Statement { + return newStatement().LitRuneFunc(f) +} + +// LitRuneFunc renders a rune literal. LitRuneFunc generates the value to +// render by executing the provided function. +func (g *Group) LitRuneFunc(f func() rune) *Statement { + s := LitRuneFunc(f) + g.items = append(g.items, s) + return s +} + +// LitRuneFunc renders a rune literal. LitRuneFunc generates the value to +// render by executing the provided function. +func (s *Statement) LitRuneFunc(f func() rune) *Statement { + t := token{ + typ: literalRuneToken, + content: f(), + } + *s = append(*s, t) + return s +} + +// LitByte renders a byte literal. +func LitByte(v byte) *Statement { + return newStatement().LitByte(v) +} + +// LitByte renders a byte literal. +func (g *Group) LitByte(v byte) *Statement { + s := LitByte(v) + g.items = append(g.items, s) + return s +} + +// LitByte renders a byte literal. +func (s *Statement) LitByte(v byte) *Statement { + t := token{ + typ: literalByteToken, + content: v, + } + *s = append(*s, t) + return s +} + +// LitByteFunc renders a byte literal. LitByteFunc generates the value to +// render by executing the provided function. +func LitByteFunc(f func() byte) *Statement { + return newStatement().LitByteFunc(f) +} + +// LitByteFunc renders a byte literal. LitByteFunc generates the value to +// render by executing the provided function. +func (g *Group) LitByteFunc(f func() byte) *Statement { + s := LitByteFunc(f) + g.items = append(g.items, s) + return s +} + +// LitByteFunc renders a byte literal. LitByteFunc generates the value to +// render by executing the provided function. +func (s *Statement) LitByteFunc(f func() byte) *Statement { + t := token{ + typ: literalByteToken, + content: f(), + } + *s = append(*s, t) + return s +} diff --git a/vendor/github.com/dave/jennifer/jen/statement.go b/vendor/github.com/dave/jennifer/jen/statement.go new file mode 100644 index 00000000..aa9ec497 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/statement.go @@ -0,0 +1,101 @@ +package jen + +import ( + "bytes" + "fmt" + "go/format" + "io" +) + +// Statement represents a simple list of code items. When rendered the items +// are separated by spaces. +type Statement []Code + +func newStatement() *Statement { + return &Statement{} +} + +// Clone makes a copy of the Statement, so further tokens can be appended +// without affecting the original. +func (s *Statement) Clone() *Statement { + return &Statement{s} +} + +func (s *Statement) previous(c Code) Code { + index := -1 + for i, item := range *s { + if item == c { + index = i + break + } + } + if index > 0 { + return (*s)[index-1] + } + return nil +} + +func (s *Statement) isNull(f *File) bool { + if s == nil { + return true + } + for _, c := range *s { + if !c.isNull(f) { + return false + } + } + return true +} + +func (s *Statement) render(f *File, w io.Writer, _ *Statement) error { + first := true + for _, code := range *s { + if code == nil || code.isNull(f) { + // Null() token produces no output but also + // no separator. Empty() token products no + // output but adds a separator. + continue + } + if !first { + if _, err := w.Write([]byte(" ")); err != nil { + return err + } + } + if err := code.render(f, w, s); err != nil { + return err + } + first = false + } + return nil +} + +// Render renders the Statement to the provided writer. +func (s *Statement) Render(writer io.Writer) error { + return s.RenderWithFile(writer, NewFile("")) +} + +// GoString renders the Statement for testing. Any error will cause a panic. +func (s *Statement) GoString() string { + buf := bytes.Buffer{} + if err := s.Render(&buf); err != nil { + panic(err) + } + return buf.String() +} + +// RenderWithFile renders the Statement to the provided writer, using imports from the provided file. +func (s *Statement) RenderWithFile(writer io.Writer, file *File) error { + buf := &bytes.Buffer{} + if err := s.render(file, buf, nil); err != nil { + return err + } + b, err := format.Source(buf.Bytes()) + if err != nil { + return fmt.Errorf("Error %s while formatting source:\n%s", err, buf.String()) + } + if _, err := writer.Write(b); err != nil { + return err + } + return nil +} + diff --git a/vendor/github.com/dave/jennifer/jen/statement_test.go b/vendor/github.com/dave/jennifer/jen/statement_test.go new file mode 100644 index 00000000..d774f6e9 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/statement_test.go @@ -0,0 +1,32 @@ +package jen_test + +import ( + "bytes" + "testing" + + . "github.com/dave/jennifer/jen" +) + +func TestStatement_Render(t *testing.T) { + file := NewFile("main") + file.ImportAlias("fmt", "fmtalias") + + statement := file.Func().Id("main").Params().Block( + Qual("fmt", "Println").Call(Lit("something")), + ) + + expect := `func main() { + fmtalias.Println("something") +}` + + var got bytes.Buffer + + err := statement.RenderWithFile(&got, file) + if err != nil { + t.Fatal(err) + } + + if got.String() != expect { + t.Fatalf("Got: %v, expect: %v", got.String(), expect) + } +} diff --git a/vendor/github.com/dave/jennifer/jen/tag.go b/vendor/github.com/dave/jennifer/jen/tag.go new file mode 100644 index 00000000..ad99aafd --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/tag.go @@ -0,0 +1,76 @@ +package jen + +import ( + "fmt" + "io" + "sort" + "strconv" +) + +// Tag renders a struct tag +func Tag(items map[string]string) *Statement { + return newStatement().Tag(items) +} + +// Tag renders a struct tag +func (g *Group) Tag(items map[string]string) *Statement { + // notest + // don't think this can ever be used in valid code? + s := Tag(items) + g.items = append(g.items, s) + return s +} + +// Tag renders a struct tag +func (s *Statement) Tag(items map[string]string) *Statement { + c := tag{ + items: items, + } + *s = append(*s, c) + return s +} + +type tag struct { + items map[string]string +} + +func (t tag) isNull(f *File) bool { + return len(t.items) == 0 +} + +func (t tag) render(f *File, w io.Writer, s *Statement) error { + + if t.isNull(f) { + // notest + // render won't be called if t is null + return nil + } + + var str string + + var sorted []string + for k := range t.items { + sorted = append(sorted, k) + } + sort.Strings(sorted) + + for _, k := range sorted { + v := t.items[k] + if len(str) > 0 { + str += " " + } + str += fmt.Sprintf(`%s:"%s"`, k, v) + } + + if strconv.CanBackquote(str) { + str = "`" + str + "`" + } else { + str = strconv.Quote(str) + } + + if _, err := w.Write([]byte(str)); err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/dave/jennifer/jen/tokens.go b/vendor/github.com/dave/jennifer/jen/tokens.go new file mode 100644 index 00000000..287a3cd6 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jen/tokens.go @@ -0,0 +1,301 @@ +package jen + +import ( + "fmt" + "io" + "strconv" + "strings" +) + +type tokenType string + +const ( + packageToken tokenType = "package" + identifierToken tokenType = "identifier" + qualifiedToken tokenType = "qualified" + keywordToken tokenType = "keyword" + operatorToken tokenType = "operator" + delimiterToken tokenType = "delimiter" + literalToken tokenType = "literal" + literalRuneToken tokenType = "literal_rune" + literalByteToken tokenType = "literal_byte" + nullToken tokenType = "null" + layoutToken tokenType = "layout" +) + +type token struct { + typ tokenType + content interface{} +} + +func (t token) isNull(f *File) bool { + if t.typ == packageToken { + // package token is null if the path is a dot-import or the local package path + return f.isDotImport(t.content.(string)) || f.isLocal(t.content.(string)) + } + return t.typ == nullToken +} + +func (t token) render(f *File, w io.Writer, s *Statement) error { + switch t.typ { + case literalToken: + var out string + switch t.content.(type) { + case bool, string, int, complex128: + // default constant types can be left bare + out = fmt.Sprintf("%#v", t.content) + case float64: + out = fmt.Sprintf("%#v", t.content) + if !strings.Contains(out, ".") && !strings.Contains(out, "e") { + // If the formatted value is not in scientific notation, and does not have a dot, then + // we add ".0". Otherwise it will be interpreted as an int. + // See: + // https://github.com/dave/jennifer/issues/39 + // https://github.com/golang/go/issues/26363 + out += ".0" + } + case float32, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr: + // other built-in types need specific type info + out = fmt.Sprintf("%T(%#v)", t.content, t.content) + case complex64: + // fmt package already renders parenthesis for complex64 + out = fmt.Sprintf("%T%#v", t.content, t.content) + default: + panic(fmt.Sprintf("unsupported type for literal: %T", t.content)) + } + if _, err := w.Write([]byte(out)); err != nil { + return err + } + case literalRuneToken: + if _, err := w.Write([]byte(strconv.QuoteRune(t.content.(rune)))); err != nil { + return err + } + case literalByteToken: + if _, err := w.Write([]byte(fmt.Sprintf("byte(%#v)", t.content))); err != nil { + return err + } + case keywordToken, operatorToken, layoutToken, delimiterToken: + if _, err := w.Write([]byte(fmt.Sprintf("%s", t.content))); err != nil { + return err + } + if t.content.(string) == "default" { + // Special case for Default, which must always be followed by a colon + if _, err := w.Write([]byte(":")); err != nil { + return err + } + } + case packageToken: + path := t.content.(string) + alias := f.register(path) + if _, err := w.Write([]byte(alias)); err != nil { + return err + } + case identifierToken: + if _, err := w.Write([]byte(t.content.(string))); err != nil { + return err + } + case nullToken: // notest + // do nothing (should never render a null token) + } + return nil +} + +// Null adds a null item. Null items render nothing and are not followed by a +// separator in lists. +func Null() *Statement { + return newStatement().Null() +} + +// Null adds a null item. Null items render nothing and are not followed by a +// separator in lists. +func (g *Group) Null() *Statement { + s := Null() + g.items = append(g.items, s) + return s +} + +// Null adds a null item. Null items render nothing and are not followed by a +// separator in lists. +func (s *Statement) Null() *Statement { + t := token{ + typ: nullToken, + } + *s = append(*s, t) + return s +} + +// Empty adds an empty item. Empty items render nothing but are followed by a +// separator in lists. +func Empty() *Statement { + return newStatement().Empty() +} + +// Empty adds an empty item. Empty items render nothing but are followed by a +// separator in lists. +func (g *Group) Empty() *Statement { + s := Empty() + g.items = append(g.items, s) + return s +} + +// Empty adds an empty item. Empty items render nothing but are followed by a +// separator in lists. +func (s *Statement) Empty() *Statement { + t := token{ + typ: operatorToken, + content: "", + } + *s = append(*s, t) + return s +} + +// Op renders the provided operator / token. +func Op(op string) *Statement { + return newStatement().Op(op) +} + +// Op renders the provided operator / token. +func (g *Group) Op(op string) *Statement { + s := Op(op) + g.items = append(g.items, s) + return s +} + +// Op renders the provided operator / token. +func (s *Statement) Op(op string) *Statement { + t := token{ + typ: operatorToken, + content: op, + } + *s = append(*s, t) + return s +} + +// Dot renders a period followed by an identifier. Use for fields and selectors. +func Dot(name string) *Statement { + // notest + // don't think this can be used in valid code? + return newStatement().Dot(name) +} + +// Dot renders a period followed by an identifier. Use for fields and selectors. +func (g *Group) Dot(name string) *Statement { + // notest + // don't think this can be used in valid code? + s := Dot(name) + g.items = append(g.items, s) + return s +} + +// Dot renders a period followed by an identifier. Use for fields and selectors. +func (s *Statement) Dot(name string) *Statement { + d := token{ + typ: delimiterToken, + content: ".", + } + t := token{ + typ: identifierToken, + content: name, + } + *s = append(*s, d, t) + return s +} + +// Id renders an identifier. +func Id(name string) *Statement { + return newStatement().Id(name) +} + +// Id renders an identifier. +func (g *Group) Id(name string) *Statement { + s := Id(name) + g.items = append(g.items, s) + return s +} + +// Id renders an identifier. +func (s *Statement) Id(name string) *Statement { + t := token{ + typ: identifierToken, + content: name, + } + *s = append(*s, t) + return s +} + +// Qual renders a qualified identifier. Imports are automatically added when +// used with a File. If the path matches the local path, the package name is +// omitted. If package names conflict they are automatically renamed. Note that +// it is not possible to reliably determine the package name given an arbitrary +// package path, so a sensible name is guessed from the path and added as an +// alias. The names of all standard library packages are known so these do not +// need to be aliased. If more control is needed of the aliases, see +// [File.ImportName](#importname) or [File.ImportAlias](#importalias). +func Qual(path, name string) *Statement { + return newStatement().Qual(path, name) +} + +// Qual renders a qualified identifier. Imports are automatically added when +// used with a File. If the path matches the local path, the package name is +// omitted. If package names conflict they are automatically renamed. Note that +// it is not possible to reliably determine the package name given an arbitrary +// package path, so a sensible name is guessed from the path and added as an +// alias. The names of all standard library packages are known so these do not +// need to be aliased. If more control is needed of the aliases, see +// [File.ImportName](#importname) or [File.ImportAlias](#importalias). +func (g *Group) Qual(path, name string) *Statement { + s := Qual(path, name) + g.items = append(g.items, s) + return s +} + +// Qual renders a qualified identifier. Imports are automatically added when +// used with a File. If the path matches the local path, the package name is +// omitted. If package names conflict they are automatically renamed. Note that +// it is not possible to reliably determine the package name given an arbitrary +// package path, so a sensible name is guessed from the path and added as an +// alias. The names of all standard library packages are known so these do not +// need to be aliased. If more control is needed of the aliases, see +// [File.ImportName](#importname) or [File.ImportAlias](#importalias). +func (s *Statement) Qual(path, name string) *Statement { + g := &Group{ + close: "", + items: []Code{ + token{ + typ: packageToken, + content: path, + }, + token{ + typ: identifierToken, + content: name, + }, + }, + name: "qual", + open: "", + separator: ".", + } + *s = append(*s, g) + return s +} + +// Line inserts a blank line. +func Line() *Statement { + return newStatement().Line() +} + +// Line inserts a blank line. +func (g *Group) Line() *Statement { + s := Line() + g.items = append(g.items, s) + return s +} + +// Line inserts a blank line. +func (s *Statement) Line() *Statement { + t := token{ + typ: layoutToken, + content: "\n", + } + *s = append(*s, t) + return s +} diff --git a/vendor/github.com/dave/jennifer/jennifer.go b/vendor/github.com/dave/jennifer/jennifer.go new file mode 100644 index 00000000..37efad44 --- /dev/null +++ b/vendor/github.com/dave/jennifer/jennifer.go @@ -0,0 +1,9 @@ +// Package jennifer is a code generator for Go +package jennifer + +//go:generate go get github.com/dave/jennifer/genjen +//go:generate genjen +//go:generate go get github.com/dave/jennifer/gennames +//go:generate gennames -output "jen/hints.go" -package "jen" -name "standardLibraryHints" -standard -novendor -path "./..." +//go:generate go get github.com/dave/rebecca/cmd/becca +//go:generate becca -package=github.com/dave/jennifer/jen