reorganizing contract-specific modules into event_triggered contract directories
This commit is contained in:
parent
d66e50dad6
commit
44177e0772
@ -12,13 +12,14 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered
|
package dai
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic"
|
"github.com/vulcanize/vulcanizedb/examples/generic"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
@ -30,9 +31,9 @@ import (
|
|||||||
|
|
||||||
type ERC20ConverterInterface interface {
|
type ERC20ConverterInterface interface {
|
||||||
ToTransferEntity(watchedEvent core.WatchedEvent) (*TransferEntity, error)
|
ToTransferEntity(watchedEvent core.WatchedEvent) (*TransferEntity, error)
|
||||||
ToTransferModel(entity *TransferEntity) *TransferModel
|
ToTransferModel(entity *TransferEntity) *event_triggered.TransferModel
|
||||||
ToApprovalEntity(watchedEvent core.WatchedEvent) (*ApprovalEntity, error)
|
ToApprovalEntity(watchedEvent core.WatchedEvent) (*ApprovalEntity, error)
|
||||||
ToApprovalModel(entity *ApprovalEntity) *ApprovalModel
|
ToApprovalModel(entity *ApprovalEntity) *event_triggered.ApprovalModel
|
||||||
}
|
}
|
||||||
|
|
||||||
type ERC20Converter struct {
|
type ERC20Converter struct {
|
||||||
@ -70,12 +71,12 @@ func (c ERC20Converter) ToTransferEntity(watchedEvent core.WatchedEvent) (*Trans
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c ERC20Converter) ToTransferModel(entity *TransferEntity) *TransferModel {
|
func (c ERC20Converter) ToTransferModel(entity *TransferEntity) *event_triggered.TransferModel {
|
||||||
to := entity.Dst.String()
|
to := entity.Dst.String()
|
||||||
from := entity.Src.String()
|
from := entity.Src.String()
|
||||||
tokens := entity.Wad.String()
|
tokens := entity.Wad.String()
|
||||||
|
|
||||||
return &TransferModel{
|
return &event_triggered.TransferModel{
|
||||||
TokenName: c.config.Name,
|
TokenName: c.config.Name,
|
||||||
TokenAddress: c.config.Address,
|
TokenAddress: c.config.Address,
|
||||||
To: to,
|
To: to,
|
||||||
@ -102,12 +103,12 @@ func (c ERC20Converter) ToApprovalEntity(watchedEvent core.WatchedEvent) (*Appro
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c ERC20Converter) ToApprovalModel(entity *ApprovalEntity) *ApprovalModel {
|
func (c ERC20Converter) ToApprovalModel(entity *ApprovalEntity) *event_triggered.ApprovalModel {
|
||||||
tokenOwner := entity.Src.String()
|
tokenOwner := entity.Src.String()
|
||||||
spender := entity.Guy.String()
|
spender := entity.Guy.String()
|
||||||
tokens := entity.Wad.String()
|
tokens := entity.Wad.String()
|
||||||
|
|
||||||
return &ApprovalModel{
|
return &event_triggered.ApprovalModel{
|
||||||
TokenName: c.config.Name,
|
TokenName: c.config.Name,
|
||||||
TokenAddress: c.config.Address,
|
TokenAddress: c.config.Address,
|
||||||
Owner: tokenOwner,
|
Owner: tokenOwner,
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package dai_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered/dai"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic"
|
"github.com/vulcanize/vulcanizedb/examples/generic"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
@ -36,7 +37,7 @@ var expectedTransferModel = event_triggered.TransferModel{
|
|||||||
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
||||||
}
|
}
|
||||||
|
|
||||||
var expectedTransferEntity = event_triggered.TransferEntity{
|
var expectedTransferEntity = dai.TransferEntity{
|
||||||
TokenName: "Dai",
|
TokenName: "Dai",
|
||||||
TokenAddress: common.HexToAddress(constants.DaiContractAddress),
|
TokenAddress: common.HexToAddress(constants.DaiContractAddress),
|
||||||
Src: common.HexToAddress("0x000000000000000000000000000000000000Af21"),
|
Src: common.HexToAddress("0x000000000000000000000000000000000000Af21"),
|
||||||
@ -56,7 +57,7 @@ var expectedApprovalModel = event_triggered.ApprovalModel{
|
|||||||
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
||||||
}
|
}
|
||||||
|
|
||||||
var expectedApprovalEntity = event_triggered.ApprovalEntity{
|
var expectedApprovalEntity = dai.ApprovalEntity{
|
||||||
TokenName: "Dai",
|
TokenName: "Dai",
|
||||||
TokenAddress: common.HexToAddress(constants.DaiContractAddress),
|
TokenAddress: common.HexToAddress(constants.DaiContractAddress),
|
||||||
Src: common.HexToAddress("0x000000000000000000000000000000000000Af21"),
|
Src: common.HexToAddress("0x000000000000000000000000000000000000Af21"),
|
||||||
@ -96,11 +97,11 @@ var approvalEvent = core.WatchedEvent{
|
|||||||
|
|
||||||
var _ = Describe("Transfer Converter", func() {
|
var _ = Describe("Transfer Converter", func() {
|
||||||
|
|
||||||
var daiConverter *event_triggered.ERC20Converter
|
var daiConverter *dai.ERC20Converter
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
daiConverter, err = event_triggered.NewERC20Converter(generic.DaiConfig)
|
daiConverter, err = dai.NewERC20Converter(generic.DaiConfig)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -124,11 +125,11 @@ var _ = Describe("Transfer Converter", func() {
|
|||||||
|
|
||||||
var _ = Describe("Approval Converter", func() {
|
var _ = Describe("Approval Converter", func() {
|
||||||
|
|
||||||
var daiConverter *event_triggered.ERC20Converter
|
var daiConverter *dai.ERC20Converter
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
daiConverter, err = event_triggered.NewERC20Converter(generic.DaiConfig)
|
daiConverter, err = dai.NewERC20Converter(generic.DaiConfig)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
})
|
})
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package dai_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -23,5 +23,5 @@ import (
|
|||||||
|
|
||||||
func TestLogKill(t *testing.T) {
|
func TestLogKill(t *testing.T) {
|
||||||
RegisterFailHandler(Fail)
|
RegisterFailHandler(Fail)
|
||||||
RunSpecs(t, "ERC20 Event Triggered test Suite")
|
RunSpecs(t, "Dai ERC20 Event Triggered Test Suite")
|
||||||
}
|
}
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered
|
package dai
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/big"
|
"math/big"
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package dai_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered/dai"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic"
|
"github.com/vulcanize/vulcanizedb/examples/generic"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/test_helpers"
|
"github.com/vulcanize/vulcanizedb/examples/test_helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
@ -80,7 +81,7 @@ var _ = Describe("Integration test with vulcanizedb", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("creates token_transfers entry for each Transfer event received", func() {
|
It("creates token_transfers entry for each Transfer event received", func() {
|
||||||
transformer, err := event_triggered.NewTransformer(db, generic.DaiConfig)
|
transformer, err := dai.NewTransformer(db, generic.DaiConfig)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
transformer.Execute()
|
transformer.Execute()
|
||||||
@ -106,7 +107,7 @@ var _ = Describe("Integration test with vulcanizedb", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("creates token_approvals entry for each Approval event received", func() {
|
It("creates token_approvals entry for each Approval event received", func() {
|
||||||
transformer, err := event_triggered.NewTransformer(db, generic.DaiConfig)
|
transformer, err := dai.NewTransformer(db, generic.DaiConfig)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
transformer.Execute()
|
transformer.Execute()
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package dai_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@ -23,6 +23,7 @@ import (
|
|||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered/dai"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/test_helpers"
|
"github.com/vulcanize/vulcanizedb/examples/test_helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/config"
|
"github.com/vulcanize/vulcanizedb/pkg/config"
|
||||||
@ -31,7 +32,7 @@ import (
|
|||||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||||
)
|
)
|
||||||
|
|
||||||
var transferEntity = &event_triggered.TransferEntity{
|
var transferEntity = &dai.TransferEntity{
|
||||||
TokenName: "Dai",
|
TokenName: "Dai",
|
||||||
TokenAddress: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
|
TokenAddress: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
|
||||||
Src: common.HexToAddress("0x000000000000000000000000000000000000Af21"),
|
Src: common.HexToAddress("0x000000000000000000000000000000000000Af21"),
|
||||||
@ -41,7 +42,7 @@ var transferEntity = &event_triggered.TransferEntity{
|
|||||||
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
||||||
}
|
}
|
||||||
|
|
||||||
var approvalEntity = &event_triggered.ApprovalEntity{
|
var approvalEntity = &dai.ApprovalEntity{
|
||||||
TokenName: "Dai",
|
TokenName: "Dai",
|
||||||
TokenAddress: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
|
TokenAddress: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
|
||||||
Src: common.HexToAddress("0x000000000000000000000000000000000000Af21"),
|
Src: common.HexToAddress("0x000000000000000000000000000000000000Af21"),
|
||||||
@ -53,7 +54,7 @@ var approvalEntity = &event_triggered.ApprovalEntity{
|
|||||||
|
|
||||||
var _ = Describe("Approval and Transfer Repository Tests", func() {
|
var _ = Describe("Approval and Transfer Repository Tests", func() {
|
||||||
var db *postgres.DB
|
var db *postgres.DB
|
||||||
var converter event_triggered.ERC20Converter
|
var converter dai.ERC20Converter
|
||||||
var repository event_triggered.ERC20EventRepository
|
var repository event_triggered.ERC20EventRepository
|
||||||
var logRepository repositories.LogRepository
|
var logRepository repositories.LogRepository
|
||||||
var blockRepository repositories.BlockRepository
|
var blockRepository repositories.BlockRepository
|
||||||
@ -93,7 +94,7 @@ var _ = Describe("Approval and Transfer Repository Tests", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
repository = event_triggered.ERC20EventRepository{DB: db}
|
repository = event_triggered.ERC20EventRepository{DB: db}
|
||||||
converter = event_triggered.ERC20Converter{}
|
converter = dai.ERC20Converter{}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
@ -12,13 +12,14 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered
|
package dai
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic"
|
"github.com/vulcanize/vulcanizedb/examples/generic"
|
||||||
"github.com/vulcanize/vulcanizedb/libraries/shared"
|
"github.com/vulcanize/vulcanizedb/libraries/shared"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/datastore"
|
"github.com/vulcanize/vulcanizedb/pkg/datastore"
|
||||||
@ -30,7 +31,7 @@ type ERC20EventTransformer struct {
|
|||||||
Converter ERC20ConverterInterface
|
Converter ERC20ConverterInterface
|
||||||
WatchedEventRepository datastore.WatchedEventRepository
|
WatchedEventRepository datastore.WatchedEventRepository
|
||||||
FilterRepository datastore.FilterRepository
|
FilterRepository datastore.FilterRepository
|
||||||
Repository ERC20EventDatastore
|
Repository event_triggered.ERC20EventDatastore
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTransformer(db *postgres.DB, config generic.ContractConfig) (shared.Transformer, error) {
|
func NewTransformer(db *postgres.DB, config generic.ContractConfig) (shared.Transformer, error) {
|
||||||
@ -43,7 +44,7 @@ func NewTransformer(db *postgres.DB, config generic.ContractConfig) (shared.Tran
|
|||||||
|
|
||||||
wer := repositories.WatchedEventRepository{DB: db}
|
wer := repositories.WatchedEventRepository{DB: db}
|
||||||
fr := repositories.FilterRepository{DB: db}
|
fr := repositories.FilterRepository{DB: db}
|
||||||
lkr := ERC20EventRepository{DB: db}
|
lkr := event_triggered.ERC20EventRepository{DB: db}
|
||||||
transformer = ERC20EventTransformer{
|
transformer = ERC20EventTransformer{
|
||||||
Converter: cnvtr,
|
Converter: cnvtr,
|
||||||
WatchedEventRepository: wer,
|
WatchedEventRepository: wer,
|
@ -12,14 +12,14 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package dai_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered/dai"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/mocks"
|
"github.com/vulcanize/vulcanizedb/examples/mocks"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
)
|
)
|
||||||
@ -63,7 +63,7 @@ var _ = Describe("Mock ERC20 transformer", func() {
|
|||||||
var watchedEventsRepo mocks.MockWatchedEventsRepository
|
var watchedEventsRepo mocks.MockWatchedEventsRepository
|
||||||
var mockEventRepo mocks.MockEventRepo
|
var mockEventRepo mocks.MockEventRepo
|
||||||
var filterRepo mocks.MockFilterRepository
|
var filterRepo mocks.MockFilterRepository
|
||||||
var transformer event_triggered.ERC20EventTransformer
|
var transformer dai.ERC20EventTransformer
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
mockERC20Converter = mocks.MockERC20Converter{}
|
mockERC20Converter = mocks.MockERC20Converter{}
|
||||||
@ -72,7 +72,7 @@ var _ = Describe("Mock ERC20 transformer", func() {
|
|||||||
mockEventRepo = mocks.MockEventRepo{}
|
mockEventRepo = mocks.MockEventRepo{}
|
||||||
filterRepo = mocks.MockFilterRepository{}
|
filterRepo = mocks.MockFilterRepository{}
|
||||||
|
|
||||||
transformer = event_triggered.ERC20EventTransformer{
|
transformer = dai.ERC20EventTransformer{
|
||||||
Converter: &mockERC20Converter,
|
Converter: &mockERC20Converter,
|
||||||
WatchedEventRepository: &watchedEventsRepo,
|
WatchedEventRepository: &watchedEventsRepo,
|
||||||
FilterRepository: filterRepo,
|
FilterRepository: filterRepo,
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered
|
package tusd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic"
|
"github.com/vulcanize/vulcanizedb/examples/generic"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/geth"
|
"github.com/vulcanize/vulcanizedb/pkg/geth"
|
||||||
@ -30,9 +31,9 @@ import (
|
|||||||
|
|
||||||
type GenericConverterInterface interface {
|
type GenericConverterInterface interface {
|
||||||
ToBurnEntity(watchedEvent core.WatchedEvent) (*BurnEntity, error)
|
ToBurnEntity(watchedEvent core.WatchedEvent) (*BurnEntity, error)
|
||||||
ToBurnModel(entity *BurnEntity) *BurnModel
|
ToBurnModel(entity *BurnEntity) *event_triggered.BurnModel
|
||||||
ToMintEntity(watchedEvent core.WatchedEvent) (*MintEntity, error)
|
ToMintEntity(watchedEvent core.WatchedEvent) (*MintEntity, error)
|
||||||
ToMintModel(entity *MintEntity) *MintModel
|
ToMintModel(entity *MintEntity) *event_triggered.MintModel
|
||||||
}
|
}
|
||||||
|
|
||||||
type GenericConverter struct {
|
type GenericConverter struct {
|
||||||
@ -70,11 +71,11 @@ func (c GenericConverter) ToBurnEntity(watchedEvent core.WatchedEvent) (*BurnEnt
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c GenericConverter) ToBurnModel(entity *BurnEntity) *BurnModel {
|
func (c GenericConverter) ToBurnModel(entity *BurnEntity) *event_triggered.BurnModel {
|
||||||
burner := entity.Burner.String()
|
burner := entity.Burner.String()
|
||||||
tokens := entity.Value.String()
|
tokens := entity.Value.String()
|
||||||
|
|
||||||
return &BurnModel{
|
return &event_triggered.BurnModel{
|
||||||
TokenName: c.config.Name,
|
TokenName: c.config.Name,
|
||||||
TokenAddress: c.config.Address,
|
TokenAddress: c.config.Address,
|
||||||
Burner: burner,
|
Burner: burner,
|
||||||
@ -100,12 +101,12 @@ func (c GenericConverter) ToMintEntity(watchedEvent core.WatchedEvent) (*MintEnt
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c GenericConverter) ToMintModel(entity *MintEntity) *MintModel {
|
func (c GenericConverter) ToMintModel(entity *MintEntity) *event_triggered.MintModel {
|
||||||
mintee := entity.To.String()
|
mintee := entity.To.String()
|
||||||
minter := c.config.Owner
|
minter := c.config.Owner
|
||||||
tokens := entity.Amount.String()
|
tokens := entity.Amount.String()
|
||||||
|
|
||||||
return &MintModel{
|
return &event_triggered.MintModel{
|
||||||
TokenName: c.config.Name,
|
TokenName: c.config.Name,
|
||||||
TokenAddress: c.config.Address,
|
TokenAddress: c.config.Address,
|
||||||
Mintee: mintee,
|
Mintee: mintee,
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package tusd_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic"
|
"github.com/vulcanize/vulcanizedb/examples/generic"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered/tusd"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
)
|
)
|
||||||
@ -35,7 +36,7 @@ var expectedBurnModel = event_triggered.BurnModel{
|
|||||||
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
||||||
}
|
}
|
||||||
|
|
||||||
var expectedBurnEntity = event_triggered.BurnEntity{
|
var expectedBurnEntity = tusd.BurnEntity{
|
||||||
TokenName: "Tusd",
|
TokenName: "Tusd",
|
||||||
TokenAddress: common.HexToAddress(constants.TusdContractAddress),
|
TokenAddress: common.HexToAddress(constants.TusdContractAddress),
|
||||||
Burner: common.HexToAddress("0x09BbBBE21a5975cAc061D82f7b843bCE061BA391"),
|
Burner: common.HexToAddress("0x09BbBBE21a5975cAc061D82f7b843bCE061BA391"),
|
||||||
@ -54,7 +55,7 @@ var expectedMintModel = event_triggered.MintModel{
|
|||||||
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
||||||
}
|
}
|
||||||
|
|
||||||
var expectedMintEntity = event_triggered.MintEntity{
|
var expectedMintEntity = tusd.MintEntity{
|
||||||
TokenName: "Tusd",
|
TokenName: "Tusd",
|
||||||
TokenAddress: common.HexToAddress(constants.TusdContractAddress),
|
TokenAddress: common.HexToAddress(constants.TusdContractAddress),
|
||||||
To: common.HexToAddress("0x09BbBBE21a5975cAc061D82f7b843bCE061BA391"),
|
To: common.HexToAddress("0x09BbBBE21a5975cAc061D82f7b843bCE061BA391"),
|
||||||
@ -93,11 +94,11 @@ var mintEvent = core.WatchedEvent{
|
|||||||
|
|
||||||
var _ = Describe("Transfer Converter", func() {
|
var _ = Describe("Transfer Converter", func() {
|
||||||
|
|
||||||
var converter *event_triggered.GenericConverter
|
var converter *tusd.GenericConverter
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
converter, err = event_triggered.NewGenericConverter(generic.TusdConfig)
|
converter, err = tusd.NewGenericConverter(generic.TusdConfig)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -121,11 +122,11 @@ var _ = Describe("Transfer Converter", func() {
|
|||||||
|
|
||||||
var _ = Describe("Approval Converter", func() {
|
var _ = Describe("Approval Converter", func() {
|
||||||
|
|
||||||
var converter *event_triggered.GenericConverter
|
var converter *tusd.GenericConverter
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
converter, err = event_triggered.NewGenericConverter(generic.TusdConfig)
|
converter, err = tusd.NewGenericConverter(generic.TusdConfig)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
})
|
})
|
||||||
|
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered
|
package tusd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/big"
|
"math/big"
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package tusd_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic"
|
"github.com/vulcanize/vulcanizedb/examples/generic"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered/tusd"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/test_helpers"
|
"github.com/vulcanize/vulcanizedb/examples/test_helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||||
@ -80,7 +81,7 @@ var _ = Describe("Integration test with vulcanizedb", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("creates token_burns entry for each Burn event received", func() {
|
It("creates token_burns entry for each Burn event received", func() {
|
||||||
transformer, err := event_triggered.NewTransformer(db, generic.TusdConfig)
|
transformer, err := tusd.NewTransformer(db, generic.TusdConfig)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
transformer.Execute()
|
transformer.Execute()
|
||||||
@ -105,7 +106,7 @@ var _ = Describe("Integration test with vulcanizedb", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("creates token_mints entry for each Mint event received", func() {
|
It("creates token_mints entry for each Mint event received", func() {
|
||||||
transformer, err := event_triggered.NewTransformer(db, generic.TusdConfig)
|
transformer, err := tusd.NewTransformer(db, generic.TusdConfig)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
transformer.Execute()
|
transformer.Execute()
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package tusd_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@ -23,6 +23,7 @@ import (
|
|||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered/tusd"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
"github.com/vulcanize/vulcanizedb/examples/generic/helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/test_helpers"
|
"github.com/vulcanize/vulcanizedb/examples/test_helpers"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/config"
|
"github.com/vulcanize/vulcanizedb/pkg/config"
|
||||||
@ -31,7 +32,7 @@ import (
|
|||||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
|
||||||
)
|
)
|
||||||
|
|
||||||
var burnEntity = &event_triggered.BurnEntity{
|
var burnEntity = &tusd.BurnEntity{
|
||||||
TokenName: "Tusd",
|
TokenName: "Tusd",
|
||||||
TokenAddress: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
|
TokenAddress: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
|
||||||
Burner: common.HexToAddress("0x09BbBBE21a5975cAc061D82f7b843bCE061BA391"),
|
Burner: common.HexToAddress("0x09BbBBE21a5975cAc061D82f7b843bCE061BA391"),
|
||||||
@ -40,7 +41,7 @@ var burnEntity = &event_triggered.BurnEntity{
|
|||||||
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
TxHash: "0x135391a0962a63944e5908e6fedfff90fb4be3e3290a21017861099bad6546ae",
|
||||||
}
|
}
|
||||||
|
|
||||||
var mintEntity = &event_triggered.MintEntity{
|
var mintEntity = &tusd.MintEntity{
|
||||||
TokenName: "Tusd",
|
TokenName: "Tusd",
|
||||||
TokenAddress: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
|
TokenAddress: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
|
||||||
To: common.HexToAddress("0x09BbBBE21a5975cAc061D82f7b843bCE061BA391"),
|
To: common.HexToAddress("0x09BbBBE21a5975cAc061D82f7b843bCE061BA391"),
|
||||||
@ -51,7 +52,7 @@ var mintEntity = &event_triggered.MintEntity{
|
|||||||
|
|
||||||
var _ = Describe("Approval and Transfer Repository Tests", func() {
|
var _ = Describe("Approval and Transfer Repository Tests", func() {
|
||||||
var db *postgres.DB
|
var db *postgres.DB
|
||||||
var converter event_triggered.GenericConverter
|
var converter tusd.GenericConverter
|
||||||
var repository event_triggered.GenericEventRepository
|
var repository event_triggered.GenericEventRepository
|
||||||
var logRepository repositories.LogRepository
|
var logRepository repositories.LogRepository
|
||||||
var blockRepository repositories.BlockRepository
|
var blockRepository repositories.BlockRepository
|
||||||
@ -91,7 +92,7 @@ var _ = Describe("Approval and Transfer Repository Tests", func() {
|
|||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
repository = event_triggered.GenericEventRepository{DB: db}
|
repository = event_triggered.GenericEventRepository{DB: db}
|
||||||
converter = event_triggered.GenericConverter{}
|
converter = tusd.GenericConverter{}
|
||||||
})
|
})
|
||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered
|
package tusd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic"
|
"github.com/vulcanize/vulcanizedb/examples/generic"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
||||||
"github.com/vulcanize/vulcanizedb/libraries/shared"
|
"github.com/vulcanize/vulcanizedb/libraries/shared"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/datastore"
|
"github.com/vulcanize/vulcanizedb/pkg/datastore"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||||
@ -30,7 +31,7 @@ type GenericTransformer struct {
|
|||||||
Converter GenericConverterInterface
|
Converter GenericConverterInterface
|
||||||
WatchedEventRepository datastore.WatchedEventRepository
|
WatchedEventRepository datastore.WatchedEventRepository
|
||||||
FilterRepository datastore.FilterRepository
|
FilterRepository datastore.FilterRepository
|
||||||
Repository GenericEventDatastore
|
Repository event_triggered.GenericEventDatastore
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTransformer(db *postgres.DB, config generic.ContractConfig) (shared.Transformer, error) {
|
func NewTransformer(db *postgres.DB, config generic.ContractConfig) (shared.Transformer, error) {
|
||||||
@ -43,7 +44,7 @@ func NewTransformer(db *postgres.DB, config generic.ContractConfig) (shared.Tran
|
|||||||
|
|
||||||
wer := repositories.WatchedEventRepository{DB: db}
|
wer := repositories.WatchedEventRepository{DB: db}
|
||||||
fr := repositories.FilterRepository{DB: db}
|
fr := repositories.FilterRepository{DB: db}
|
||||||
lkr := GenericEventRepository{DB: db}
|
lkr := event_triggered.GenericEventRepository{DB: db}
|
||||||
transformer = GenericTransformer{
|
transformer = GenericTransformer{
|
||||||
Converter: cnvtr,
|
Converter: cnvtr,
|
||||||
WatchedEventRepository: wer,
|
WatchedEventRepository: wer,
|
@ -12,14 +12,14 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package tusd_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/examples/constants"
|
"github.com/vulcanize/vulcanizedb/examples/constants"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered/tusd"
|
||||||
"github.com/vulcanize/vulcanizedb/examples/mocks"
|
"github.com/vulcanize/vulcanizedb/examples/mocks"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
)
|
)
|
||||||
@ -63,7 +63,7 @@ var _ = Describe("Mock ERC20 transformer", func() {
|
|||||||
var watchedEventsRepo mocks.MockWatchedEventsRepository
|
var watchedEventsRepo mocks.MockWatchedEventsRepository
|
||||||
var mockEventRepo mocks.MockEventRepo
|
var mockEventRepo mocks.MockEventRepo
|
||||||
var filterRepo mocks.MockFilterRepository
|
var filterRepo mocks.MockFilterRepository
|
||||||
var transformer event_triggered.GenericTransformer
|
var transformer tusd.GenericTransformer
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
mockERC20Converter = mocks.MockERC20Converter{}
|
mockERC20Converter = mocks.MockERC20Converter{}
|
||||||
@ -72,7 +72,7 @@ var _ = Describe("Mock ERC20 transformer", func() {
|
|||||||
mockEventRepo = mocks.MockEventRepo{}
|
mockEventRepo = mocks.MockEventRepo{}
|
||||||
filterRepo = mocks.MockFilterRepository{}
|
filterRepo = mocks.MockFilterRepository{}
|
||||||
|
|
||||||
transformer = event_triggered.GenericTransformer{
|
transformer = tusd.GenericTransformer{
|
||||||
Converter: &mockERC20Converter,
|
Converter: &mockERC20Converter,
|
||||||
WatchedEventRepository: &watchedEventsRepo,
|
WatchedEventRepository: &watchedEventsRepo,
|
||||||
FilterRepository: filterRepo,
|
FilterRepository: filterRepo,
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package event_triggered_test
|
package tusd_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -23,5 +23,5 @@ import (
|
|||||||
|
|
||||||
func TestLogKill(t *testing.T) {
|
func TestLogKill(t *testing.T) {
|
||||||
RegisterFailHandler(Fail)
|
RegisterFailHandler(Fail)
|
||||||
RunSpecs(t, "ERC20 Event Triggered test Suite")
|
RunSpecs(t, "Tusd Generic Event Triggered Test Suite")
|
||||||
}
|
}
|
@ -16,63 +16,65 @@ package mocks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
et1 "github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
et1 "github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/erc20_watcher/event_triggered/dai"
|
||||||
et2 "github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
et2 "github.com/vulcanize/vulcanizedb/examples/generic/event_triggered"
|
||||||
|
"github.com/vulcanize/vulcanizedb/examples/generic/event_triggered/tusd"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MockERC20Converter struct {
|
type MockERC20Converter struct {
|
||||||
WatchedEvents []*core.WatchedEvent
|
WatchedEvents []*core.WatchedEvent
|
||||||
TransfersToConvert []et1.TransferEntity
|
TransfersToConvert []dai.TransferEntity
|
||||||
ApprovalsToConvert []et1.ApprovalEntity
|
ApprovalsToConvert []dai.ApprovalEntity
|
||||||
BurnsToConvert []et2.BurnEntity
|
BurnsToConvert []tusd.BurnEntity
|
||||||
MintsToConvert []et2.MintEntity
|
MintsToConvert []tusd.MintEntity
|
||||||
block int64
|
block int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlkc *MockERC20Converter) ToTransferModel(entity *et1.TransferEntity) *et1.TransferModel {
|
func (mlkc *MockERC20Converter) ToTransferModel(entity *dai.TransferEntity) *et1.TransferModel {
|
||||||
mlkc.TransfersToConvert = append(mlkc.TransfersToConvert, *entity)
|
mlkc.TransfersToConvert = append(mlkc.TransfersToConvert, *entity)
|
||||||
return &et1.TransferModel{}
|
return &et1.TransferModel{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlkc *MockERC20Converter) ToTransferEntity(watchedEvent core.WatchedEvent) (*et1.TransferEntity, error) {
|
func (mlkc *MockERC20Converter) ToTransferEntity(watchedEvent core.WatchedEvent) (*dai.TransferEntity, error) {
|
||||||
mlkc.WatchedEvents = append(mlkc.WatchedEvents, &watchedEvent)
|
mlkc.WatchedEvents = append(mlkc.WatchedEvents, &watchedEvent)
|
||||||
e := &et1.TransferEntity{Block: watchedEvent.BlockNumber}
|
e := &dai.TransferEntity{Block: watchedEvent.BlockNumber}
|
||||||
mlkc.block++
|
mlkc.block++
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlkc *MockERC20Converter) ToApprovalModel(entity *et1.ApprovalEntity) *et1.ApprovalModel {
|
func (mlkc *MockERC20Converter) ToApprovalModel(entity *dai.ApprovalEntity) *et1.ApprovalModel {
|
||||||
mlkc.ApprovalsToConvert = append(mlkc.ApprovalsToConvert, *entity)
|
mlkc.ApprovalsToConvert = append(mlkc.ApprovalsToConvert, *entity)
|
||||||
return &et1.ApprovalModel{}
|
return &et1.ApprovalModel{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlkc *MockERC20Converter) ToApprovalEntity(watchedEvent core.WatchedEvent) (*et1.ApprovalEntity, error) {
|
func (mlkc *MockERC20Converter) ToApprovalEntity(watchedEvent core.WatchedEvent) (*dai.ApprovalEntity, error) {
|
||||||
mlkc.WatchedEvents = append(mlkc.WatchedEvents, &watchedEvent)
|
mlkc.WatchedEvents = append(mlkc.WatchedEvents, &watchedEvent)
|
||||||
e := &et1.ApprovalEntity{Block: watchedEvent.BlockNumber}
|
e := &dai.ApprovalEntity{Block: watchedEvent.BlockNumber}
|
||||||
mlkc.block++
|
mlkc.block++
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlkc *MockERC20Converter) ToBurnEntity(watchedEvent core.WatchedEvent) (*et2.BurnEntity, error) {
|
func (mlkc *MockERC20Converter) ToBurnEntity(watchedEvent core.WatchedEvent) (*tusd.BurnEntity, error) {
|
||||||
mlkc.WatchedEvents = append(mlkc.WatchedEvents, &watchedEvent)
|
mlkc.WatchedEvents = append(mlkc.WatchedEvents, &watchedEvent)
|
||||||
e := &et2.BurnEntity{Block: watchedEvent.BlockNumber}
|
e := &tusd.BurnEntity{Block: watchedEvent.BlockNumber}
|
||||||
mlkc.block++
|
mlkc.block++
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlkc *MockERC20Converter) ToBurnModel(entity *et2.BurnEntity) *et2.BurnModel {
|
func (mlkc *MockERC20Converter) ToBurnModel(entity *tusd.BurnEntity) *et2.BurnModel {
|
||||||
mlkc.BurnsToConvert = append(mlkc.BurnsToConvert, *entity)
|
mlkc.BurnsToConvert = append(mlkc.BurnsToConvert, *entity)
|
||||||
return &et2.BurnModel{}
|
return &et2.BurnModel{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlkc *MockERC20Converter) ToMintEntity(watchedEvent core.WatchedEvent) (*et2.MintEntity, error) {
|
func (mlkc *MockERC20Converter) ToMintEntity(watchedEvent core.WatchedEvent) (*tusd.MintEntity, error) {
|
||||||
mlkc.WatchedEvents = append(mlkc.WatchedEvents, &watchedEvent)
|
mlkc.WatchedEvents = append(mlkc.WatchedEvents, &watchedEvent)
|
||||||
e := &et2.MintEntity{Block: watchedEvent.BlockNumber}
|
e := &tusd.MintEntity{Block: watchedEvent.BlockNumber}
|
||||||
mlkc.block++
|
mlkc.block++
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlkc *MockERC20Converter) ToMintModel(entity *et2.MintEntity) *et2.MintModel {
|
func (mlkc *MockERC20Converter) ToMintModel(entity *tusd.MintEntity) *et2.MintModel {
|
||||||
mlkc.MintsToConvert = append(mlkc.MintsToConvert, *entity)
|
mlkc.MintsToConvert = append(mlkc.MintsToConvert, *entity)
|
||||||
return &et2.MintModel{}
|
return &et2.MintModel{}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user