-
Notifications
You must be signed in to change notification settings - Fork 35
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
1 parent
3e8c21f
commit e0c8f78
Showing
9 changed files
with
293 additions
and
26 deletions.
There are no files selected for viewing
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,24 @@ | ||
// SPDX-License-Identifier: Apache 2 | ||
|
||
// implement this interface if you want to configure the visibility rules of your smart contract | ||
// the TEN platform will interpret this information | ||
interface ContractTransparencyConfig { | ||
// configuration per event log type | ||
struct EventLogConfig { | ||
bytes eventSignature; | ||
bool isPublic; // everyone can see and query for this event | ||
bool topic1CanView; // If the event is private, and this is true, it means that the address from topic1 is an EOA that can view this event | ||
bool topic2CanView; // same | ||
bool topic3CanView; // same | ||
bool visibleToSender; // if true, the tx signer will see this event. Default false | ||
} | ||
|
||
struct VisibilityConfig { | ||
bool isTransparent; // If true - the internal state via getStorageAt will be accessible to everyone. All events will be public. Default false | ||
EventLogConfig[] eventLogConfigs; // mapping from event signature to visibility configs per event | ||
} | ||
|
||
// keep the logic independent of the environment | ||
// max gas: 1 Million | ||
function visibilityRules() external pure returns (VisibilityConfig memory); | ||
} |
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,93 @@ | ||
package evm | ||
|
||
import ( | ||
"errors" | ||
"math/big" | ||
"strings" | ||
|
||
ethereum "github.com/ethereum/go-ethereum" | ||
"github.com/ethereum/go-ethereum/accounts/abi" | ||
"github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/event" | ||
) | ||
|
||
// file generated by ethereum tooling to help calling the "visibilityRules" function | ||
|
||
// Reference imports to suppress errors if they are not otherwise used. | ||
var ( | ||
_ = errors.New | ||
_ = big.NewInt | ||
_ = strings.NewReader | ||
_ = ethereum.NotFound | ||
_ = bind.Bind | ||
_ = common.Big1 | ||
_ = types.BloomLookup | ||
_ = event.NewSubscription | ||
_ = abi.ConvertType | ||
) | ||
|
||
// ContractTranspMetaData contains all meta data concerning the TransparencyConfig contract. | ||
var ContractTranspMetaData = &bind.MetaData{ | ||
ABI: "[{\"inputs\":[],\"name\":\"visibilityRules\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"isTransparent\",\"type\":\"bool\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"eventSignature\",\"type\":\"bytes\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"topic1CanView\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"topic2CanView\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"topic3CanView\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"visibleToSender\",\"type\":\"bool\"}],\"internalType\":\"structContractTransparencyConfig.EventLogConfig[]\",\"name\":\"eventLogConfigs\",\"type\":\"tuple[]\"}],\"internalType\":\"structContractTransparencyConfig.VisibilityConfig\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", | ||
} | ||
|
||
// ContractTransparencyConfigEventLogConfig is an auto generated low-level Go binding around an user-defined struct. | ||
type ContractTransparencyConfigEventLogConfig struct { | ||
EventSignature []byte | ||
IsPublic bool | ||
Topic1CanView bool | ||
Topic2CanView bool | ||
Topic3CanView bool | ||
VisibleToSender bool | ||
} | ||
|
||
// ContractTransparencyConfigVisibilityConfig is an auto generated low-level Go binding around an user-defined struct. | ||
type ContractTransparencyConfigVisibilityConfig struct { | ||
IsTransparent bool | ||
EventLogConfigs []ContractTransparencyConfigEventLogConfig | ||
} | ||
|
||
// TransparencyConfig is an auto generated Go binding around an Ethereum contract. | ||
type TransparencyConfig struct { | ||
TransparencyConfigCaller // Read-only binding to the contract | ||
} | ||
|
||
// TransparencyConfigCaller is an auto generated read-only Go binding around an Ethereum contract. | ||
type TransparencyConfigCaller struct { | ||
contract *bind.BoundContract // Generic contract wrapper for the low level calls | ||
} | ||
|
||
// NewTransparencyConfigCaller creates a new read-only instance of TransparencyConfig, bound to a specific deployed contract. | ||
func NewTransparencyConfigCaller(address common.Address, caller bind.ContractCaller) (*TransparencyConfigCaller, error) { | ||
contract, err := bindContractTransp(address, caller, nil, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &TransparencyConfigCaller{contract: contract}, nil | ||
} | ||
|
||
// bindContractTransp binds a generic wrapper to an already deployed contract. | ||
func bindContractTransp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { | ||
parsed, err := ContractTranspMetaData.GetAbi() | ||
if err != nil { | ||
return nil, err | ||
} | ||
return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil | ||
} | ||
|
||
// VisibilityRules is a free data retrieval call binding the contract method 0x30173dd1. | ||
// | ||
// Solidity: function visibilityRules() pure returns((bool,(bytes,bool,bool,bool,bool,bool)[])) | ||
func (_ContractTransp *TransparencyConfigCaller) VisibilityRules(opts *bind.CallOpts) (ContractTransparencyConfigVisibilityConfig, error) { | ||
var out []interface{} | ||
err := _ContractTransp.contract.Call(opts, &out, "visibilityRules") | ||
if err != nil { | ||
return *new(ContractTransparencyConfigVisibilityConfig), err | ||
} | ||
|
||
out0 := *abi.ConvertType(out[0], new(ContractTransparencyConfigVisibilityConfig)).(*ContractTransparencyConfigVisibilityConfig) | ||
|
||
return out0, err | ||
} |
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
Oops, something went wrong.