-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
107 additions
and
6 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
integration-tests/deployment/ccip/contractwrappers/rmn1_6/rmn.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package rmn1_6 | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
|
||
"github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip/view" | ||
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_remote" | ||
) | ||
|
||
type RMN struct { | ||
*rmn_remote.RMNRemote | ||
} | ||
|
||
func (rmn *RMN) GetVersionedConfig(opts *bind.CallOpts) (view.RMNRemoteVersionedConfig, error) { | ||
config, err := rmn.RMNRemote.GetVersionedConfig(opts) | ||
if err != nil { | ||
return view.RMNRemoteVersionedConfig{}, err | ||
} | ||
var signers []view.RMNRemoteSigner | ||
for _, signer := range config.Config.Signers { | ||
signers = append(signers, view.RMNRemoteSigner{ | ||
OnchainPublicKey: signer.OnchainPublicKey.Hex(), | ||
NodeIndex: signer.NodeIndex, | ||
}) | ||
} | ||
return view.RMNRemoteVersionedConfig{ | ||
Version: config.Version, | ||
MinSigners: config.Config.MinSigners, | ||
Signers: signers, | ||
}, nil | ||
|
||
} | ||
|
||
func New(rmn *rmn_remote.RMNRemote) *RMN { | ||
return &RMN{rmn} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package view | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
) | ||
|
||
type RMN struct { | ||
Contract | ||
IsCursed bool `json:"isCursed"` | ||
Config RMNRemoteVersionedConfig `json:"config"` | ||
} | ||
|
||
type RMNRemoteVersionedConfig struct { | ||
Version uint32 `json:"version"` | ||
Signers []RMNRemoteSigner `json:"signers"` | ||
MinSigners uint64 `json:"minSigners"` | ||
} | ||
|
||
type RMNRemoteSigner struct { | ||
OnchainPublicKey string `json:"onchain_public_key"` | ||
NodeIndex uint64 `json:"node_index"` | ||
} | ||
|
||
func RMNSnapshot(rmnReader RMNReader) (RMN, error) { | ||
tv, err := rmnReader.TypeAndVersion(nil) | ||
if err != nil { | ||
return RMN{}, err | ||
} | ||
config, err := rmnReader.GetVersionedConfig(nil) | ||
if err != nil { | ||
return RMN{}, err | ||
} | ||
isCursed, err := rmnReader.IsCursed0(nil) | ||
if err != nil { | ||
return RMN{}, err | ||
} | ||
return RMN{ | ||
Contract: Contract{ | ||
Address: rmnReader.Address().Hex(), | ||
TypeAndVersion: tv, | ||
}, | ||
IsCursed: isCursed, | ||
Config: config, | ||
}, nil | ||
} | ||
|
||
type RMNReader interface { | ||
ContractState | ||
GetVersionedConfig(opts *bind.CallOpts) (RMNRemoteVersionedConfig, error) | ||
IsCursed(opts *bind.CallOpts, subject [16]byte) (bool, error) | ||
IsCursed0(opts *bind.CallOpts) (bool, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters