Skip to content

Commit

Permalink
Merge pull request #85 from Cerebellum-Network/feature/add-missing-ev…
Browse files Browse the repository at this point in the history
…ents

Add missing events
  • Loading branch information
khssnv authored Apr 22, 2024
2 parents 4198885 + ad94bb6 commit 811cf09
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 17 deletions.
16 changes: 10 additions & 6 deletions blockchain/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ go 1.18
require github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.1

require (
github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect
github.com/Cerebellum-Network/chainbridge-substrate-events v1.0.0-rc2 // indirect
github.com/Cerebellum-Network/go-substrate-rpc-client/v9 v9.0.3 // indirect
github.com/ChainSafe/go-schnorrkel v1.1.0 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/base58 v1.0.4 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect
github.com/ethereum/go-ethereum v1.10.20 // indirect
github.com/decred/base58 v1.0.5 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/ethereum/go-ethereum v1.13.10 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect
github.com/pierrec/xxHash v0.1.5 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/vedhavyas/go-subkey/v2 v2.0.0 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect
golang.org/x/sys v0.16.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
)
20 changes: 20 additions & 0 deletions blockchain/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
github.com/Cerebellum-Network/chainbridge-substrate-events v1.0.0-rc2 h1:jaIgwH+SHKQs5Arlb7CNOrbXdTh7fByLAf0uPMqaZuw=
github.com/Cerebellum-Network/chainbridge-substrate-events v1.0.0-rc2/go.mod h1:UBNG8WPGnrixc5auI0qg7TpzOa16o7rzZFRxXwMui08=
github.com/Cerebellum-Network/go-substrate-rpc-client/v9 v9.0.3 h1:sDALT60rVsICvSX9gSMejFeOrkeIziLsQWqOQUkBlPo=
github.com/Cerebellum-Network/go-substrate-rpc-client/v9 v9.0.3/go.mod h1:xaMq//F++u8q/cGcGAUvHEbMKfOeIY15ioQNCXjEUa0=
github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM=
github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4=
github.com/ChainSafe/go-schnorrkel v1.1.0 h1:rZ6EU+CZFCjB4sHUE1jIu8VDoB/wRKZxoe1tkcO71Wk=
github.com/ChainSafe/go-schnorrkel v1.1.0/go.mod h1:ABkENxiP+cvjFiByMIZ9LYbRoNNLeBLiakC1XeTFxfE=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ=
Expand All @@ -14,11 +20,17 @@ github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsP
github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo=
github.com/decred/base58 v1.0.4 h1:QJC6B0E0rXOPA8U/kw2rP+qiRJsUaE2Er+pYb3siUeA=
github.com/decred/base58 v1.0.4/go.mod h1:jJswKPEdvpFpvf7dsDvFZyLT22xZ9lWqEByX38oGd9E=
github.com/decred/base58 v1.0.5 h1:hwcieUM3pfPnE/6p3J100zoRfGkQxBulZHo7GZfOqic=
github.com/decred/base58 v1.0.5/go.mod h1:s/8lukEHFA6bUQQb/v3rjUySJ2hu+RioCzLukAVkrfw=
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
github.com/ethereum/go-ethereum v1.10.20 h1:75IW830ClSS40yrQC1ZCMZCt5I+zU16oqId2SiQwdQ4=
github.com/ethereum/go-ethereum v1.10.20/go.mod h1:LWUN82TCHGpxB3En5HVmLLzPD7YSrEUFmFfN1nKkVN0=
github.com/ethereum/go-ethereum v1.13.10 h1:Ppdil79nN+Vc+mXfge0AuUgmKWuVv4eMqzoIVSdqZek=
github.com/ethereum/go-ethereum v1.13.10/go.mod h1:sc48XYQxCzH3fG9BcrXCOOgQk2JfZzNAmIKnceogzsA=
github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E=
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
Expand All @@ -30,6 +42,8 @@ github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is=
github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc=
github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o=
github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU=
github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E=
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaGHBu1fghwxIPiopAHV06JlXrMHjk=
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU=
Expand All @@ -53,11 +67,17 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o=
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU=
Expand Down
47 changes: 47 additions & 0 deletions blockchain/pallets/contracts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package pallets

import "github.com/centrifuge/go-substrate-rpc-client/v4/types"

// Events
type (
// These commented-out names are already defined in go-substrate-rpc-client, but some other
// types are missing.
// https://github.com/centrifuge/go-substrate-rpc-client/blob/8f01d19/types/event_record.go#L127
//
// EventContractsCodeRemoved
// EventContractsCodeStored
// EventContractsContractCodeUpdated
// EventContractsContractEmitted
// EventContractsInstantiated
// EventContractsTerminated

EventContractsCalled struct {
Phase types.Phase
Caller types.AccountID
Contract types.AccountID
Topics []types.Hash
}

EventContractsDelegateCalled struct {
Phase types.Phase
Contract types.AccountID
CodeHash types.Hash
Topics []types.Hash
}

EventContractsStorageDepositTransferredAndHeld struct {
Phase types.Phase
From types.AccountID
To types.AccountID
Amount types.U128
Topics []types.Hash
}

EventContractsStorageDepositTransferredAndReleased struct {
Phase types.Phase
From types.AccountID
To types.AccountID
Amount types.U128
Topics []types.Hash
}
)
21 changes: 21 additions & 0 deletions blockchain/pallets/ddcnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ type StorageNodeProps struct {
Mode StorageNodeMode
}

// Events
type (
EventDdcNodesNodeCreated struct {
Phase types.Phase
NodePubKey NodePubKey
Topics []types.Hash
}

EventDdcNodesNodeDeleted struct {
Phase types.Phase
NodePubKey NodePubKey
Topics []types.Hash
}

EventDdcNodesNodeParamsChanged struct {
Phase types.Phase
NodePubKey NodePubKey
Topics []types.Hash
}
)

type DdcNodesApi interface {
GetStorageNodes(pubkey StorageNodePubKey) (types.Option[StorageNode], error)
}
Expand Down
59 changes: 59 additions & 0 deletions blockchain/pallets/ddcstaking.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package pallets

import "github.com/centrifuge/go-substrate-rpc-client/v4/types"

// Events
type (
EventDdcStakingBonded struct {
Phase types.Phase
Stash types.AccountID
Amount types.U128
Topics []types.Hash
}

EventDdcStakingChilled struct {
Phase types.Phase
Stash types.AccountID
Topics []types.Hash
}

EventDdcStakingChillSoon struct {
Phase types.Phase
Stash types.AccountID
ClusterId ClusterId
Block types.BlockNumber
Topics []types.Hash
}

EventDdcStakingUnbonded struct {
Phase types.Phase
Stash types.AccountID
Amount types.U128
Topics []types.Hash
}

EventDdcStakingWithdrawn struct {
Phase types.Phase
Stash types.AccountID
Amount types.U128
Topics []types.Hash
}

EventDdcStakingActivated struct {
Phase types.Phase
Stash types.AccountID
Topics []types.Hash
}

EventDdcStakingLeaveSoon struct {
Phase types.Phase
Stash types.AccountID
Topics []types.Hash
}

EventDdcStakingLeft struct {
Phase types.Phase
Stash types.AccountID
Topics []types.Hash
}
)
20 changes: 20 additions & 0 deletions blockchain/pallets/events.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package pallets

import (
chainbridge "github.com/Cerebellum-Network/chainbridge-substrate-events"
"github.com/centrifuge/go-substrate-rpc-client/v4/types"
)

type Events struct {
types.EventRecords
chainbridge.Events

Contracts_Called []EventContractsCalled //nolint:stylecheck,golint
Contracts_DelegateCalled []EventContractsDelegateCalled //nolint:stylecheck,golint
Contracts_StorageDepositTransferredAndHeld []EventContractsStorageDepositTransferredAndHeld //nolint:stylecheck,golint
Contracts_StorageDepositTransferredAndReleased []EventContractsStorageDepositTransferredAndReleased //nolint:stylecheck,golint

DdcClusters_ClusterCreated []EventDdcClustersClusterCreated //nolint:stylecheck,golint
DdcClusters_ClusterNodeAdded []EventDdcClustersClusterNodeAdded //nolint:stylecheck,golint
Expand All @@ -21,6 +28,10 @@ type Events struct {
DdcCustomers_BucketUpdated []EventDdcCustomersBucketUpdated //nolint:stylecheck,golint
DdcCustomers_BucketRemoved []EventDdcCustomersBucketRemoved //nolint:stylecheck,golint

DdcNodes_NodeCreated []EventDdcNodesNodeCreated //nolint:stylecheck,golint
DdcNodes_NodeDeleted []EventDdcNodesNodeDeleted //nolint:stylecheck,golint
DdcNodes_NodeParamsChanged []EventDdcNodesNodeParamsChanged //nolint:stylecheck,golint

DdcPayouts_BillingReportInitialized []EventDdcPayoutsBillingReportInitialized //nolint:stylecheck,golint
DdcPayouts_ChargingStarted []EventDdcPayoutsChargingStarted //nolint:stylecheck,golint
DdcPayouts_Charged []EventDdcPayoutsCharged //nolint:stylecheck,golint
Expand All @@ -35,4 +46,13 @@ type Events struct {
DdcPayouts_RewardingFinished []EventDdcPayoutsRewardingFinished //nolint:stylecheck,golint
DdcPayouts_BillingReportFinalized []EventDdcPayoutsBillingReportFinalized //nolint:stylecheck,golint
DdcPayouts_AuthorisedCaller []EventDdcPayoutsAuthorisedCaller //nolint:stylecheck,golint

DdcStaking_Bonded []EventDdcStakingBonded //nolint:stylecheck,golint
DdcStaking_Chilled []EventDdcStakingChilled //nolint:stylecheck,golint
DdcStaking_ChillSoon []EventDdcStakingChillSoon //nolint:stylecheck,golint
DdcStaking_Unbonded []EventDdcStakingUnbonded //nolint:stylecheck,golint
DdcStaking_Withdrawn []EventDdcStakingWithdrawn //nolint:stylecheck,golint
DdcStaking_Activated []EventDdcStakingActivated //nolint:stylecheck,golint
DdcStaking_LeaveSoon []EventDdcStakingLeaveSoon //nolint:stylecheck,golint
DdcStaking_Left []EventDdcStakingLeft //nolint:stylecheck,golint
}
Loading

0 comments on commit 811cf09

Please sign in to comment.