Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
5359f70
add initial precompile configs and handle them
ceyonur Aug 24, 2022
8a488c5
add verify to precompile configs
ceyonur Aug 25, 2022
538f598
add unit tests for initial configs and verify
ceyonur Aug 25, 2022
9c7c30c
Merge branch 'master' into trustless-precompile-configs
ceyonur Aug 25, 2022
27e207f
add a nil check for initial fee config verification
ceyonur Aug 26, 2022
1d5100b
Merge branch 'trustless-precompile-configs' of github.com:ava-labs/su…
ceyonur Aug 26, 2022
97d3472
conditionally verify allowlist
ceyonur Aug 26, 2022
e70a808
Update precompile/stateful_precompile_config.go
ceyonur Aug 29, 2022
38cc210
add config test to precompile package
ceyonur Aug 30, 2022
55d59e4
add 0 test case for gas limit
ceyonur Aug 30, 2022
258ae40
add comments for allowlist storage keys
ceyonur Aug 30, 2022
c60ec84
move allow list role to different file
ceyonur Aug 31, 2022
bf00bb5
Update precompile/allow_list.go
ceyonur Aug 31, 2022
65bd9e8
rename test
ceyonur Aug 31, 2022
dfd41f5
Update precompile/allow_list.go
ceyonur Aug 31, 2022
8075ba1
rename test & use func to create config
ceyonur Aug 31, 2022
d351f9a
Merge branch 'trustless-precompile-configs' of github.com:ava-labs/su…
ceyonur Aug 31, 2022
3ffa6dc
Remove unnecessary role checks
ceyonur Aug 31, 2022
1e3ab67
Merge branch 'master' into trustless-precompile-configs
ceyonur Sep 1, 2022
b844bbb
use config constructor for precompile tests
ceyonur Sep 1, 2022
2777e0e
Update accounts/abi/bind/precompile_template.go
ceyonur Sep 1, 2022
83a9db6
Update precompile/contract_native_minter.go
ceyonur Sep 1, 2022
415a32b
Update precompile/contract_deployer_allow_list.go
ceyonur Sep 1, 2022
333aa8b
Update precompile/allow_list.go
ceyonur Sep 1, 2022
abfa39e
add equals methods
ceyonur Sep 1, 2022
2d3a517
Merge branch 'trustless-precompile-configs' of github.com:ava-labs/su…
ceyonur Sep 1, 2022
77e4fc3
Merge branch 'master' into trustless-precompile-configs
ceyonur Sep 14, 2022
409c736
initialize reward manager precompile by precompilegen
ceyonur Sep 16, 2022
718440d
add reward upgrade to block verification
ceyonur Sep 20, 2022
9d74ff4
handle empty case in configure
ceyonur Sep 20, 2022
dd7ef82
use single field to decide allow fee recipieints
ceyonur Sep 26, 2022
5ed8a4e
add coinbase verification
ceyonur Oct 6, 2022
c142828
configure miner with coinbase in state accordingly
ceyonur Oct 6, 2022
e7f0d1f
Merge branch 'master' into fee-recipients-precompile
ceyonur Oct 6, 2022
89baa42
Remove abis
ceyonur Oct 6, 2022
034cd0d
use header coinbase for verification
ceyonur Oct 6, 2022
c33b269
remove hashToBool util methods
ceyonur Oct 6, 2022
cc772a4
Merge branch 'master' into fee-recipients-precompile
ceyonur Oct 7, 2022
263ad50
use require and remove unneccessary address field from test
ceyonur Oct 11, 2022
4ce6fbd
add unit tests
ceyonur Oct 11, 2022
152f179
cleanups
ceyonur Oct 11, 2022
cfab9a7
Merge branch 'master' into fee-recipients-precompile
ceyonur Oct 11, 2022
21ac1c2
Update consensus/dummy/consensus.go
ceyonur Oct 11, 2022
7dae0c2
Update contract-examples/contracts/IAllowList.sol
ceyonur Oct 11, 2022
382f492
Update core/stateful_precompile_test.go
ceyonur Oct 12, 2022
d428cfa
Update core/stateful_precompile_test.go
ceyonur Oct 12, 2022
ee7fac5
Update core/stateful_precompile_test.go
ceyonur Oct 12, 2022
bdf3ecb
Update precompile/reward_manager.go
ceyonur Oct 12, 2022
ebd3849
Update precompile/reward_manager.go
ceyonur Oct 12, 2022
e489d4f
Update precompile/reward_manager.go
ceyonur Oct 12, 2022
6caf6df
review fixes
ceyonur Oct 12, 2022
860ed7c
Merge branch 'fee-recipients-precompile' of github.com:ava-labs/subne…
ceyonur Oct 12, 2022
be39982
add e2e tests and example contract
ceyonur Oct 12, 2022
1e1abc6
add initial config to test
ceyonur Oct 13, 2022
b332dc5
Merge branch 'master' into fee-recipients-precompile
ceyonur Oct 13, 2022
25e8ab4
Update contract-examples/tasks.ts
ceyonur Nov 8, 2022
55a9830
Update contract-examples/test/ExampleRewardDistributor.ts
ceyonur Nov 8, 2022
c264ce8
Update contract-examples/test/ExampleRewardDistributor.ts
ceyonur Nov 8, 2022
e8b03a1
review fixes
ceyonur Nov 8, 2022
257e7f3
Merge branch 'fee-recipients-precompile' of github.com:ava-labs/subne…
ceyonur Nov 8, 2022
58753ab
Update consensus/dummy/consensus.go
ceyonur Nov 9, 2022
0d47935
Update params/config.go
ceyonur Nov 9, 2022
6e4fd03
Update params/config.go
ceyonur Nov 9, 2022
22553b1
fixs after review
ceyonur Nov 9, 2022
4198407
Merge branch 'master' into fee-recipients-precompile
ceyonur Nov 9, 2022
8d42bf7
add string method to reward manager
ceyonur Nov 9, 2022
f1110af
revert coinbase syntactic verification
ceyonur Nov 9, 2022
4d626e3
review fixes
ceyonur Nov 15, 2022
7cf7bc9
review fixes
ceyonur Nov 15, 2022
344cfda
add disabled precompile test cases
ceyonur Nov 15, 2022
79f136f
use hash value instead of address
ceyonur Nov 15, 2022
68fd611
Merge branch 'master' into fee-recipients-precompile
ceyonur Nov 16, 2022
8b40ad2
config cleanup
ceyonur Nov 16, 2022
d65327a
Update contract-examples/tasks.ts
ceyonur Nov 18, 2022
71b9782
Update contract-examples/tasks.ts
ceyonur Nov 18, 2022
35c167b
more nit fixes
ceyonur Nov 18, 2022
33ac69b
Merge branch 'fee-recipients-precompile' of github.com:ava-labs/subne…
ceyonur Nov 18, 2022
8061582
Merge branch 'master' into fee-recipients-precompile
ceyonur Nov 18, 2022
8603049
fix conflict
ceyonur Nov 18, 2022
541d94b
Merge branch 'fee-recipients-precompile' of github.com:ava-labs/subne…
ceyonur Nov 18, 2022
d6e2a0c
move inline string ABIs to separate files and embed them
ceyonur Nov 30, 2022
53d4efd
Merge branch 'master' into embed-abis
ceyonur Nov 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 14 additions & 60 deletions accounts/abi/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const (
readAllowListFuncKey = "readAllowList"
)

type BindHook func(lang Lang, types []string, contracts map[string]*tmplContract, structs map[string]*tmplStruct) (data interface{}, templateSource string, err error)

// Lang is a target programming language selector to generate bindings for.
type Lang int

Expand Down Expand Up @@ -101,7 +103,11 @@ func isKeyWord(arg string) bool {
// to be used as is in client code, but rather as an intermediate struct which
// enforces compile time type safety and naming convention opposed to having to
// manually maintain hard coded strings that break on runtime.
func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]string, pkg string, lang Lang, libs map[string]string, aliases map[string]string, isPrecompile bool) (string, error) {
func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]string, pkg string, lang Lang, libs map[string]string, aliases map[string]string) (string, error) {
return BindHelper(types, abis, bytecodes, fsigs, pkg, lang, libs, aliases, nil)
}

func BindHelper(types []string, abis []string, bytecodes []string, fsigs []map[string]string, pkg string, lang Lang, libs map[string]string, aliases map[string]string, bindHook BindHook) (string, error) {
var (
// contracts is the map of each individual contract requested binding
contracts = make(map[string]*tmplContract)
Expand Down Expand Up @@ -178,11 +184,6 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
normalized.Outputs = make([]abi.Argument, len(original.Outputs))
copy(normalized.Outputs, original.Outputs)
for j, output := range normalized.Outputs {
if isPrecompile {
if output.Name == "" {
return "", fmt.Errorf("ABI outputs for %s require a name to generate the precompile binding, re-generate the ABI from a Solidity source file with all named outputs", normalized.Name)
}
}
if output.Name != "" {
normalized.Outputs[j].Name = capitalise(output.Name)
}
Expand Down Expand Up @@ -291,19 +292,14 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
templateSource string
)

// Generate the contract template data according to contract type (precompile/non)
if isPrecompile {
if lang != LangGo {
return "", errors.New("only GoLang binding for precompiled contracts is supported yet")
}

if len(contracts) != 1 {
return "", errors.New("cannot generate more than 1 contract")
// Generate the contract template data according to hook
if bindHook != nil {
var err error
data, templateSource, err = bindHook(lang, types, contracts, structs)
if err != nil {
return "", err
}
precompileType := types[0]
firstContract := contracts[precompileType]
data, templateSource = createPrecompileDataAndTemplate(firstContract, structs)
} else {
} else { // default to generate contract binding
templateSource = tmplSource[lang]
data = &tmplData{
Package: pkg,
Expand Down Expand Up @@ -710,45 +706,3 @@ func hasStruct(t abi.Type) bool {
return false
}
}

func createPrecompileDataAndTemplate(contract *tmplContract, structs map[string]*tmplStruct) (interface{}, string) {
funcs := make(map[string]*tmplMethod)

for k, v := range contract.Transacts {
funcs[k] = v
}

for k, v := range contract.Calls {
funcs[k] = v
}
isAllowList := allowListEnabled(funcs)
if isAllowList {
// remove these functions as we will directly inherit AllowList
delete(funcs, readAllowListFuncKey)
delete(funcs, setAdminFuncKey)
delete(funcs, setEnabledFuncKey)
delete(funcs, setNoneFuncKey)
}

precompileContract := &tmplPrecompileContract{
tmplContract: contract,
AllowList: isAllowList,
Funcs: funcs,
}

data := &tmplPrecompileData{
Contract: precompileContract,
Structs: structs,
}
return data, tmplSourcePrecompileGo
}

func allowListEnabled(funcs map[string]*tmplMethod) bool {
keys := []string{readAllowListFuncKey, setAdminFuncKey, setEnabledFuncKey, setNoneFuncKey}
for _, key := range keys {
if _, ok := funcs[key]; !ok {
return false
}
}
return true
}
4 changes: 2 additions & 2 deletions accounts/abi/bind/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,7 @@ func golangBindings(t *testing.T, overload bool) {
types = []string{tt.name}
}
// Generate the binding and create a Go source file in the workspace
bind, err := Bind(types, tt.abi, tt.bytecode, tt.fsigs, "bindtest", LangGo, tt.libs, tt.aliases, false)
bind, err := Bind(types, tt.abi, tt.bytecode, tt.fsigs, "bindtest", LangGo, tt.libs, tt.aliases)
if err != nil {
t.Fatalf("test %d: failed to generate binding: %v", i, err)
}
Expand Down Expand Up @@ -2529,7 +2529,7 @@ public class Test {
},
}
for i, c := range cases {
binding, err := Bind([]string{c.name}, []string{c.abi}, []string{c.bytecode}, nil, "bindtest", LangJava, nil, nil, false)
binding, err := Bind([]string{c.name}, []string{c.abi}, []string{c.bytecode}, nil, "bindtest", LangJava, nil, nil)
if err != nil {
t.Fatalf("test %d: failed to generate binding: %v", i, err)
}
Expand Down
109 changes: 109 additions & 0 deletions accounts/abi/bind/precompile_bind.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// (c) 2019-2020, Ava Labs, Inc.
//
// This file is a derived work, based on the go-ethereum library whose original
// notices appear below.
//
// It is distributed under a license compatible with the licensing terms of the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********
// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

// Package bind generates Ethereum contract Go bindings.
//
// Detailed usage document and tutorial available on the go-ethereum Wiki page:
// https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts
package bind

import (
"errors"
"fmt"
)

func PrecompileBind(types []string, abis []string, bytecodes []string, fsigs []map[string]string, pkg string, lang Lang, libs map[string]string, aliases map[string]string, abifilename string) (string, error) {
// create hook
var createPrecompileFunc BindHook = func(lang Lang, types []string, contracts map[string]*tmplContract, structs map[string]*tmplStruct) (interface{}, string, error) {
// verify first
if lang != LangGo {
return nil, "", errors.New("only GoLang binding for precompiled contracts is supported yet")
}

if len(types) != 1 {
return nil, "", errors.New("cannot generate more than 1 contract")
}
funcs := make(map[string]*tmplMethod)

contract := contracts[types[0]]

for k, v := range contract.Transacts {
if err := checkOutputName(*v); err != nil {
return nil, "", err
}
funcs[k] = v
}

for k, v := range contract.Calls {
if err := checkOutputName(*v); err != nil {
return nil, "", err
}
funcs[k] = v
}
isAllowList := allowListEnabled(funcs)
if isAllowList {
// remove these functions as we will directly inherit AllowList
delete(funcs, readAllowListFuncKey)
delete(funcs, setAdminFuncKey)
delete(funcs, setEnabledFuncKey)
delete(funcs, setNoneFuncKey)
}

precompileContract := &tmplPrecompileContract{
tmplContract: contract,
AllowList: isAllowList,
Funcs: funcs,
ABIFilename: abifilename,
}

data := &tmplPrecompileData{
Contract: precompileContract,
Structs: structs,
}
return data, tmplSourcePrecompileGo, nil
}

return BindHelper(types, abis, bytecodes, fsigs, pkg, lang, libs, aliases, createPrecompileFunc)
}

func allowListEnabled(funcs map[string]*tmplMethod) bool {
keys := []string{readAllowListFuncKey, setAdminFuncKey, setEnabledFuncKey, setNoneFuncKey}
for _, key := range keys {
if _, ok := funcs[key]; !ok {
return false
}
}
return true
}

func checkOutputName(method tmplMethod) error {
for _, output := range method.Original.Outputs {
if output.Name == "" {
return fmt.Errorf("ABI outputs for %s require a name to generate the precompile binding, re-generate the ABI from a Solidity source file with all named outputs", method.Original.Name)
}
}
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func golangBindingsFailure(t *testing.T) {
for i, tt := range bindFailedTests {
t.Run(tt.name, func(t *testing.T) {
// Generate the binding
_, err := Bind([]string{tt.name}, tt.abi, tt.bytecode, tt.fsigs, "bindtest", LangGo, tt.libs, tt.aliases, true)
_, err := PrecompileBind([]string{tt.name}, tt.abi, tt.bytecode, tt.fsigs, "bindtest", LangGo, tt.libs, tt.aliases, "")
if err == nil {
t.Fatalf("test %d: no error occurred but was expected", i)
}
Expand Down
17 changes: 12 additions & 5 deletions accounts/abi/bind/precompile_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ type tmplPrecompileData struct {
// tmplPrecompileContract contains the data needed to generate an individual contract binding.
type tmplPrecompileContract struct {
*tmplContract
AllowList bool // Indicator whether the contract uses AllowList precompile
Funcs map[string]*tmplMethod // Contract functions that include both Calls + Transacts in tmplContract
AllowList bool // Indicator whether the contract uses AllowList precompile
Funcs map[string]*tmplMethod // Contract functions that include both Calls + Transacts in tmplContract
ABIFilename string // Path to the ABI file
}

// tmplSourcePrecompileGo is the Go precompiled source template.
Expand Down Expand Up @@ -53,6 +54,8 @@ import (
"github.com/ava-labs/subnet-evm/accounts/abi"
"github.com/ava-labs/subnet-evm/vmerrs"

_ "embed"

"github.com/ethereum/go-ethereum/common"
)

Expand All @@ -63,9 +66,6 @@ const (
{{- if .Contract.Fallback}}
{{.Contract.Type}}FallbackGasCost uint64 = 0 // SET A GAS COST LESS THAN 2300 HERE
{{- end}}

// {{.Contract.Type}}RawABI contains the raw ABI of {{.Contract.Type}} contract.
{{.Contract.Type}}RawABI = "{{.Contract.InputABI}}"
)

// CUSTOM CODE STARTS HERE
Expand Down Expand Up @@ -94,6 +94,13 @@ var (
Err{{.Contract.Type}}CannotFallback = errors.New("non-enabled cannot call fallback function")
{{- end}}

// {{.Contract.Type}}RawABI contains the raw ABI of {{.Contract.Type}} contract.
{{- if .Contract.ABIFilename | eq ""}}
{{.Contract.Type}}RawABI = "{{.Contract.InputABI}}"
{{- else}}
//go:embed {{.Contract.ABIFilename}}
{{.Contract.Type}}RawABI string
{{- end}}
{{.Contract.Type}}ABI abi.ABI // will be initialized by init function

{{.Contract.Type}}Precompile StatefulPrecompiledContract // will be initialized by init function
Expand Down
2 changes: 1 addition & 1 deletion cmd/abigen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func abigen(c *cli.Context) error {
}
}
// Generate the contract binding
code, err := bind.Bind(types, abis, bins, sigs, c.String(pkgFlag.Name), lang, libs, aliases, false)
code, err := bind.Bind(types, abis, bins, sigs, c.String(pkgFlag.Name), lang, libs, aliases)
if err != nil {
utils.Fatalf("Failed to generate ABI binding: %v", err)
}
Expand Down
24 changes: 19 additions & 5 deletions cmd/precompilegen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,35 @@ func precompilegen(c *cli.Context) error {
kind = strings.TrimSpace(kind)
}
types = append(types, kind)

outFlagSet := c.IsSet(outFlag.Name)
outFlag := c.String(outFlag.Name)
abifilename := ""
abipath := ""
// we should not generate the abi file if output is set to stdout
if outFlagSet {
// get file name from the output path
pathNoExt := strings.TrimSuffix(outFlag, filepath.Ext(outFlag))
abipath = pathNoExt + ".abi"
abifilename = filepath.Base(abipath)
}
// Generate the contract precompile
code, err := bind.Bind(types, abis, bins, sigs, pkg, lang, libs, aliases, true)
code, err := bind.PrecompileBind(types, abis, bins, sigs, pkg, lang, libs, aliases, abifilename)
if err != nil {
utils.Fatalf("Failed to generate ABI precompile: %v", err)
}

// Either flush it out to a file or display on the standard output
if !c.IsSet(outFlag.Name) {
if !outFlagSet {
fmt.Printf("%s\n", code)
return nil
}

if err := os.WriteFile(c.String(outFlag.Name), []byte(code), 0o600); err != nil {
utils.Fatalf("Failed to write ABI precompile: %v", err)
if err := os.WriteFile(outFlag, []byte(code), 0o600); err != nil {
utils.Fatalf("Failed to write generated precompile: %v", err)
}

if err := os.WriteFile(abipath, []byte(abis[0]), 0o600); err != nil {
utils.Fatalf("Failed to write ABI: %v", err)
}

fmt.Println("Precompile Generation was a success!")
Expand Down
3 changes: 3 additions & 0 deletions contract-examples/test/ExampleRewardManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ describe("ExampleRewardManager", function () {
expect(balance.gt(previousBalance)).to.be.true
})

<<<<<<< HEAD
=======

>>>>>>> master
it("should return false for allowFeeRecipients check", async function () {
let res = await contract.areFeeRecipientsAllowed();
expect(res).to.be.false
Expand Down
1 change: 1 addition & 0 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func (w *worker) commitNewWork() (*types.Block, error) {
if w.coinbase == (common.Address{}) {
return nil, errors.New("cannot mine without etherbase")
}

header.Coinbase = w.coinbase

configuredCoinbase, isAllowFeeRecipient, err := w.chain.GetCoinbaseAt(parent.Header())
Expand Down
1 change: 1 addition & 0 deletions precompile/reward_manager.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[],"name":"allowFeeRecipients","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"areFeeRecipientsAllowed","outputs":[{"internalType":"bool","name":"isAllowed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRewardAddress","outputs":[{"internalType":"address","name":"rewardAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"disableRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"readAllowList","outputs":[{"internalType":"uint256","name":"role","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setNone","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setRewardAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}]
9 changes: 6 additions & 3 deletions precompile/reward_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"github.com/ava-labs/subnet-evm/constants"
"github.com/ava-labs/subnet-evm/vmerrs"

_ "embed"

"github.com/ethereum/go-ethereum/common"
)

Expand All @@ -26,9 +28,6 @@ const (
CurrentRewardAddressGasCost uint64 = readGasCostPerSlot
DisableRewardsGasCost uint64 = (writeGasCostPerSlot) + ReadAllowListGasCost // write 1 slot + read allow list
SetRewardAddressGasCost uint64 = (writeGasCostPerSlot) + ReadAllowListGasCost // write 1 slot + read allow list

// RewardManagerRawABI contains the raw ABI of RewardManager contract.
RewardManagerRawABI = "[{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isAllowed\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"readAllowList\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"role\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setNone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
)

// Singleton StatefulPrecompiledContract and signatures.
Expand All @@ -44,6 +43,10 @@ var (
ErrCannotEnableBothRewards = errors.New("cannot enable both fee recipients and reward address at the same time")
ErrEmptyRewardAddress = errors.New("reward address cannot be empty")

// RewardManagerRawABI contains the raw ABI of RewardManager contract.
//go:embed reward_manager.abi
RewardManagerRawABI string

RewardManagerABI abi.ABI // will be initialized by init function
RewardManagerPrecompile StatefulPrecompiledContract // will be initialized by init function

Expand Down